• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ENGINE_load_builtin_engines函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ENGINE_load_builtin_engines函数的典型用法代码示例。如果您正苦于以下问题:C++ ENGINE_load_builtin_engines函数的具体用法?C++ ENGINE_load_builtin_engines怎么用?C++ ENGINE_load_builtin_engines使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ENGINE_load_builtin_engines函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: init_openssl

static void init_openssl(void)
{
    atexit(fini_openssl);
    OpenSSL_add_all_algorithms();
    ENGINE_load_builtin_engines();
    ENGINE_register_all_complete();
}
开发者ID:dreamsxin,项目名称:eis,代码行数:7,代码来源:libmain.c


示例2: ENGINE_load_builtin_engines

//ignore
unsigned char *HMACRSA(const EVP_MD *evp_md, const void *key, int key_len,const unsigned char *d, size_t n, unsigned char *md,unsigned int *md_len)
{
    HMAC_CTX c;
    static unsigned char m[EVP_MAX_MD_SIZE];
    //TODO: get/set rsa engine struct
    const char *engine_id = "rsa";
    ENGINE_load_builtin_engines();
    ENGINE *e = ENGINE_by_id(engine_id);//ENGINE_;
    if(!e)
      fprintf(stderr,"Engine not available\n");

    ENGINE_init(e);
    if (md == NULL)
        md = m;
    HMAC_CTX_init(&c);

    if (!HMAC_Init_ex(&c, key, key_len, evp_md, NULL))
        goto err;
    if (!HMAC_Update(&c, d, n))
        goto err;
    if (!HMAC_Final(&c, md, md_len))
        goto err;
    HMAC_CTX_cleanup(&c);
    ENGINE_free(e);
    return md;
 err:
    HMAC_CTX_cleanup(&c);
    ENGINE_free(e);
    return NULL;
}
开发者ID:FireElementalNE,项目名称:CSCI6320-project,代码行数:31,代码来源:macLocal.c


示例3: main

int main(int argc, char **argv)
{
    int i;
    testdata *test = test_cases;

    CRYPTO_malloc_debug_init();
    CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);

    OpenSSL_add_all_digests();
# ifndef OPENSSL_NO_ENGINE
    ENGINE_load_builtin_engines();
    ENGINE_register_all_digests();
# endif

    printf("PKCS5_PBKDF2_HMAC() tests ");
    for (i = 0; test->pass != NULL; i++, test++) {
        test_p5_pbkdf2(i, "sha1", test, sha1_results[i]);
        test_p5_pbkdf2(i, "sha256", test, sha256_results[i]);
        test_p5_pbkdf2(i, "sha512", test, sha512_results[i]);
        printf(".");
    }
    printf(" done\n");

# ifndef OPENSSL_NO_ENGINE
    ENGINE_cleanup();
# endif
    EVP_cleanup();
    CRYPTO_cleanup_all_ex_data();
    ERR_remove_thread_state(NULL);
    ERR_free_strings();
    CRYPTO_mem_leaks_fp(stderr);
    return 0;
}
开发者ID:375670450,项目名称:openssl,代码行数:34,代码来源:p5_crpt2_test.c


示例4: tor_init

void
tor_init (void)
{
	if (initialized) {
		return;
	}

	ERR_load_crypto_strings();
	OpenSSL_add_all_algorithms();

	// enable proper threading
	locks.length = CRYPTO_num_locks();
	locks.item   = malloc(locks.length * sizeof(uv_mutex_t));

	for (size_t i = 0; i < locks.length; i++) {
		uv_mutex_init(&locks.item[i]);
	}

	CRYPTO_set_locking_callback(_locking_callback);
	CRYPTO_set_id_callback(uv_thread_self);
	CRYPTO_set_dynlock_create_callback(_dynlock_create_callback);
	CRYPTO_set_dynlock_lock_callback(_dynlock_lock_callback);
	CRYPTO_set_dynlock_destroy_callback(_dynlock_destroy_callback);

	ENGINE_load_builtin_engines();
	ENGINE_register_all_complete();

	initialized = true;
}
开发者ID:postfix,项目名称:libtor,代码行数:29,代码来源:tor.c


示例5: init_aesni

/* Use AES-NI if available. This is not supported with low-level calls,
   we have to use EVP) */
static void init_aesni(void)
{
	ENGINE *e;
	const char *engine_id = "aesni";

	ENGINE_load_builtin_engines();
	e = ENGINE_by_id(engine_id);
	if (!e) {
		//fprintf(stderr, "AES-NI engine not available\n");
		return;
	}
	if (!ENGINE_init(e)) {
		fprintf(stderr, "AES-NI engine could not init\n");
		ENGINE_free(e);
		return;
	}
	if (!ENGINE_set_default(e, ENGINE_METHOD_ALL & ~ENGINE_METHOD_RAND)) {
		/* This should only happen when 'e' can't initialise, but the
		 * previous statement suggests it did. */
		fprintf(stderr, "AES-NI engine initialized but then failed\n");
		abort();
	}
	ENGINE_finish(e);
	ENGINE_free(e);
}
开发者ID:bensteinfeld,项目名称:john-the-ripper,代码行数:27,代码来源:rar_fmt.c


示例6: openssl_init

void openssl_init(bool threaded)
{
    // initialize the SSL library
    SSL_load_error_strings();
    SSL_library_init();

    unsigned int randSeed = 0;
    RAND_bytes( (unsigned char*)&randSeed, sizeof(randSeed) );
    srand( randSeed );

#ifndef OPENSSL_NO_ENGINE
    /* Load all bundled ENGINEs into memory and make them visible */
    ENGINE_load_builtin_engines();
    /* Register all of them for every algorithm they collectively implement */
    ENGINE_register_all_complete();
#endif // NO_ENGINE

    if(threaded)
    {
	// provide locking functions to OpenSSL since we'll be running with
	// threads accessing openssl in parallel.
	CRYPTO_set_id_callback( threads_thread_id );
	CRYPTO_set_locking_callback( threads_locking_callback );
    }
}
开发者ID:florentchandelier,项目名称:EncFSMP,代码行数:25,代码来源:openssl.cpp


示例7: ssl_init

int ssl_init(void) { /* init SSL before parsing configuration file */
    SSL_load_error_strings();
    SSL_library_init();
    index_cli=SSL_get_ex_new_index(0, "cli index",
        NULL, NULL, NULL);
    index_opt=SSL_CTX_get_ex_new_index(0, "opt index",
        NULL, NULL, NULL);
    index_redirect=SSL_SESSION_get_ex_new_index(0, "redirect index",
        NULL, NULL, NULL);
    index_addr=SSL_SESSION_get_ex_new_index(0, "addr index",
        NULL, NULL, cb_free);
    if(index_cli<0 || index_opt<0 || index_redirect<0 || index_addr<0) {
        s_log(LOG_ERR, "Application specific data initialization failed");
        return 1;
    }
#ifndef OPENSSL_NO_ENGINE
    ENGINE_load_builtin_engines();
#endif
#ifndef OPENSSL_NO_DH
    dh_params=get_dh2048();
    if(!dh_params) {
        s_log(LOG_ERR, "Failed to get default DH parameters");
        return 1;
    }
#endif /* OPENSSL_NO_DH */
    return 0;
}
开发者ID:NickolasLapp,项目名称:stunnel_local,代码行数:27,代码来源:ssl.c


示例8: apps_startup

static int apps_startup()
{
#ifdef SIGPIPE
    signal(SIGPIPE, SIG_IGN);
#endif
    CRYPTO_malloc_init();
    ERR_load_crypto_strings();
    ERR_load_SSL_strings();

    OPENSSL_load_builtin_modules();
#ifndef OPENSSL_NO_ENGINE
    ENGINE_load_builtin_engines();
#endif
    if (!app_load_modules(NULL)) {
        ERR_print_errors(bio_err);
        BIO_printf(bio_err, "Error loading default configuration\n");
        return 0;
    }

    OpenSSL_add_all_algorithms();
    OpenSSL_add_ssl_algorithms();
    setup_ui_method();
    /*SSL_library_init();*/
    return 1;
}
开发者ID:NTASTE,项目名称:openssl,代码行数:25,代码来源:openssl.c


示例9: QBox_MakeUpToken

char* QBox_MakeUpToken(const QBox_AuthPolicy* auth)
{
	char* uptoken;
	char* policy_str;
	char* encoded_digest;
	char* encoded_policy_str;
	char digest[EVP_MAX_MD_SIZE + 1];
	unsigned int dgtlen = sizeof(digest);

	HMAC_CTX ctx;

	ENGINE_load_builtin_engines();
	ENGINE_register_all_complete();

	policy_str = QBox_AuthPolicy_json(auth);
	encoded_policy_str = QBox_String_Encode(policy_str);
	free(policy_str);

	bzero(digest, sizeof(digest));

	HMAC_CTX_init(&ctx);
	HMAC_Init_ex(&ctx, QBOX_SECRET_KEY, strlen(QBOX_SECRET_KEY), EVP_sha1(), NULL);
	HMAC_Update(&ctx, encoded_policy_str, strlen(encoded_policy_str));
	HMAC_Final(&ctx, digest, &dgtlen);
	HMAC_CTX_cleanup(&ctx);

	encoded_digest = QBox_Memory_Encode(digest, dgtlen);
	uptoken = QBox_String_Concat(QBOX_ACCESS_KEY, ":", encoded_digest, ":", encoded_policy_str, NULL);
	free(encoded_policy_str);
	free(encoded_digest);

	return uptoken;
}
开发者ID:WadeLeng,项目名称:c-sdk,代码行数:33,代码来源:auth_policy.c


示例10: ossl_engine_s_load

static VALUE
ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
{
#if !defined(HAVE_ENGINE_LOAD_BUILTIN_ENGINES)
    return Qnil;
#else
    VALUE name;

    rb_scan_args(argc, argv, "01", &name);
    if(NIL_P(name)){
        ENGINE_load_builtin_engines();
        return Qtrue;
    }
    StringValue(name);
#ifndef OPENSSL_NO_STATIC_ENGINE
    OSSL_ENGINE_LOAD_IF_MATCH(dynamic);
    OSSL_ENGINE_LOAD_IF_MATCH(cswift);
    OSSL_ENGINE_LOAD_IF_MATCH(chil);
    OSSL_ENGINE_LOAD_IF_MATCH(atalla);
    OSSL_ENGINE_LOAD_IF_MATCH(nuron);
    OSSL_ENGINE_LOAD_IF_MATCH(ubsec);
    OSSL_ENGINE_LOAD_IF_MATCH(aep);
    OSSL_ENGINE_LOAD_IF_MATCH(sureware);
    OSSL_ENGINE_LOAD_IF_MATCH(4758cca);
#endif
#ifdef HAVE_ENGINE_LOAD_OPENBSD_DEV_CRYPTO
    OSSL_ENGINE_LOAD_IF_MATCH(openbsd_dev_crypto);
#endif
    OSSL_ENGINE_LOAD_IF_MATCH(openssl);
    rb_warning("no such builtin loader for `%s'", RSTRING_PTR(name));
    return Qnil;
#endif /* HAVE_ENGINE_LOAD_BUILTIN_ENGINES */
}
开发者ID:Sophrinix,项目名称:iphone-macruby,代码行数:33,代码来源:ossl_engine.c


示例11: malloc

void BTCTrader::signRequest ( QString* header, QNetworkRequest* newRequest )
{
    nonce += 1;
    *header = ( header->length() == 0 ) ? "nonce=" + QString::number( nonce ) : "nonce=" + QString::number( nonce ) + "&" + *header;

    QByteArray key = QByteArray::fromBase64( restSign.toStdString().c_str() );
    unsigned char* result;
    unsigned int result_len = 512;
    HMAC_CTX ctx;

    result = (unsigned char*) malloc(sizeof(unsigned char) * result_len);

    ENGINE_load_builtin_engines();
    ENGINE_register_all_complete();

    HMAC_CTX_init(&ctx);
    HMAC_Init_ex(&ctx, key.constData(), key.length(), EVP_sha512(), NULL);
    HMAC_Update(&ctx, (unsigned char*)header->toAscii().constData(), header->length());
    HMAC_Final(&ctx, result, &result_len);
    HMAC_CTX_cleanup(&ctx);

    newRequest->setRawHeader( "Rest-Key", restKey.toStdString().c_str() );
    newRequest->setRawHeader( "Rest-Sign", QByteArray::fromRawData( (char*)result, result_len ).toBase64() );
    newRequest->setRawHeader( "content-type","application/x-www-form-urlencoded" );
    free ( result );
}
开发者ID:blackish,项目名称:GoxMobile,代码行数:26,代码来源:btctrader.cpp


示例12: main

int main(int argc, char **argv) {
	OpenSSL_add_all_algorithms();
	
	int len = 128 * MB;
	if (argc > 1) {
		len = atoi(argv[1]) * MB;
	}
	
	unsigned char *buf = (unsigned char *) malloc(TOTAL_LEN);
	if (!buf) {
		fprintf(stderr, "Error Allocating Memory");
	}
	
	ENGINE_load_builtin_engines();
#ifdef OPENCL_ENGINE
	ENGINE *e = ENGINE_by_id("dynamic");
	if (!ENGINE_ctrl_cmd_string(e, "SO_PATH", OPENCL_ENGINE, 0) ||
		!ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0)) {
		fprintf(stderr, "Failed to load OpenCL engine!\n");
		return -1;
	}
	ENGINE_set_default(e, ENGINE_METHOD_ALL);
#endif
	
	run(argv[0], buf, len);
	
	free(buf);
	
	return 0;
}
开发者ID:Optiminer,项目名称:OpenCL-AES,代码行数:30,代码来源:benchmark.c


示例13: setup_engine

static ENGINE *
setup_engine (const char *engine)
{
  ENGINE *e = NULL;

  ENGINE_load_builtin_engines ();

  if (engine)
    {
      if (strcmp (engine, "auto") == 0)
	{
	  msg (M_INFO, "Initializing OpenSSL auto engine support");
	  ENGINE_register_all_complete ();
	  return NULL;
	}
      if ((e = ENGINE_by_id (engine)) == NULL
	 && (e = try_load_engine (engine)) == NULL)
	{
	  msg (M_FATAL, "OpenSSL error: cannot load engine '%s'", engine);
	}

      if (!ENGINE_set_default (e, ENGINE_METHOD_ALL))
	{
	  msg (M_FATAL, "OpenSSL error: ENGINE_set_default failed on engine '%s'",
	       engine);
	}

      msg (M_INFO, "Initializing OpenSSL support for engine '%s'",
	   ENGINE_get_id (e));
    }
  return e;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:32,代码来源:crypto_openssl.c


示例14: openssl_config_int

int openssl_config_int(const OPENSSL_INIT_SETTINGS *settings)
{
    int ret;
    const char *filename;
    const char *appname;
    unsigned long flags;

    if (openssl_configured)
        return 1;

    filename = settings ? settings->filename : NULL;
    appname = settings ? settings->appname : NULL;
    flags = settings ? settings->flags : DEFAULT_CONF_MFLAGS;

#ifdef OPENSSL_INIT_DEBUG
    fprintf(stderr, "OPENSSL_INIT: openssl_config_int(%s, %s, %lu)\n",
            filename, appname, flags);
#endif

    OPENSSL_load_builtin_modules();
#ifndef OPENSSL_NO_ENGINE
    /* Need to load ENGINEs */
    ENGINE_load_builtin_engines();
#endif
    ERR_clear_error();
#ifndef OPENSSL_SYS_UEFI
    ret = CONF_modules_load_file(filename, appname, flags);
#endif
    openssl_configured = 1;
    return ret;
}
开发者ID:Ana06,项目名称:openssl,代码行数:31,代码来源:conf_sap.c


示例15: OPENSSL_config

void OPENSSL_config(const char *config_name)
	{
	if (openssl_configured)
		return;

	OPENSSL_load_builtin_modules();
#ifndef OPENSSL_NO_ENGINE
	/* Need to load ENGINEs */
	ENGINE_load_builtin_engines();
#endif
	/* Add others here? */


	ERR_clear_error();
	if (CONF_modules_load_file(NULL, config_name,
	CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0)
		{
		BIO *bio_err;
		ERR_load_crypto_strings();
		if ((bio_err=BIO_new_fp(stderr, BIO_NOCLOSE)) != NULL)
			{
			BIO_printf(bio_err,"Auto configuration failed\n");
			ERR_print_errors(bio_err);
			BIO_free(bio_err);
			}
		fprintf(stderr, "OpenSSL could not auto-configure.\n");
		exit(1);
		}

	return;
	}
开发者ID:Acidburn0zzz,项目名称:openssl,代码行数:31,代码来源:conf_sap.c


示例16: global_init

int global_init(void)
{
    ENGINE_load_builtin_engines();
# ifndef OPENSSL_NO_STATIC_ENGINE
    OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL);
# endif
    return 1;
}
开发者ID:Vonage,项目名称:openssl,代码行数:8,代码来源:afalgtest.c


示例17: _libssh2_openssl_crypto_init

void _libssh2_openssl_crypto_init(void)
{
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
    ENGINE_load_builtin_engines();
    ENGINE_register_all_complete();
#else
    OpenSSL_add_all_algorithms();
    OpenSSL_add_all_ciphers();
    ENGINE_load_builtin_engines();
    ENGINE_register_all_complete();
#endif
#ifndef HAVE_EVP_AES_128_CTR
    _libssh2_EVP_aes_128_ctr();
    _libssh2_EVP_aes_192_ctr();
    _libssh2_EVP_aes_256_ctr();
#endif
}
开发者ID:stinb,项目名称:libssh2,代码行数:17,代码来源:openssl.c


示例18: ssh_SSLeay_add_all_algorithms

void
ssh_SSLeay_add_all_algorithms(void)
{
	SSLeay_add_all_algorithms();

	/* Enable use of crypto hardware */
	ENGINE_load_builtin_engines();
	ENGINE_register_all_complete();
}
开发者ID:jogindersingh1985,项目名称:openssha,代码行数:9,代码来源:openssl-compat.c


示例19: load_tpm_certificate

static int load_tpm_certificate(struct openconnect_info *vpninfo)
{
	ENGINE *e;
	EVP_PKEY *key;
	UI_METHOD *meth = NULL;
	int ret = 0;

	ENGINE_load_builtin_engines();

	e = ENGINE_by_id("tpm");
	if (!e) {
		vpn_progress(vpninfo, PRG_ERR, _("Can't load TPM engine.\n"));
		openconnect_report_ssl_errors(vpninfo);
		return -EINVAL;
	}
	if (!ENGINE_init(e) || !ENGINE_set_default_RSA(e) ||
	    !ENGINE_set_default_RAND(e)) {
		vpn_progress(vpninfo, PRG_ERR, _("Failed to init TPM engine\n"));
		openconnect_report_ssl_errors(vpninfo);
		ENGINE_free(e);
		return -EINVAL;
	}

	if (vpninfo->cert_password) {
		if (!ENGINE_ctrl_cmd(e, "PIN", strlen(vpninfo->cert_password),
				     vpninfo->cert_password, NULL, 0)) {
			vpn_progress(vpninfo, PRG_ERR,
				     _("Failed to set TPM SRK password\n"));
			openconnect_report_ssl_errors(vpninfo);
		}
		vpninfo->cert_password = NULL;
		free(vpninfo->cert_password);
	} else {
		/* Provide our own UI method to handle the PIN callback. */
		meth = create_openssl_ui(vpninfo);
	}
	key = ENGINE_load_private_key(e, vpninfo->sslkey, meth, NULL);
	if (meth)
		UI_destroy_method(meth);
	if (!key) {
		vpn_progress(vpninfo, PRG_ERR,
			     _("Failed to load TPM private key\n"));
		openconnect_report_ssl_errors(vpninfo);
		ret = -EINVAL;
		goto out;
	}
	if (!SSL_CTX_use_PrivateKey(vpninfo->https_ctx, key)) {
		vpn_progress(vpninfo, PRG_ERR, _("Add key from TPM failed\n"));
		openconnect_report_ssl_errors(vpninfo);
		ret = -EINVAL;
	}
	EVP_PKEY_free(key);
 out:
	ENGINE_finish(e);
	ENGINE_free(e);
	return ret;
}
开发者ID:shahrdad1,项目名称:openconnect,代码行数:57,代码来源:openssl.c


示例20: ssh_OpenSSL_add_all_algorithms

void
ssh_OpenSSL_add_all_algorithms(void)
{
	OpenSSL_add_all_algorithms();

	/* Enable use of crypto hardware */
	ENGINE_load_builtin_engines();
	ENGINE_register_all_complete();
	OPENSSL_config(NULL);
}
开发者ID:0x0mar,项目名称:backdoored-ssh,代码行数:10,代码来源:openssl-compat.c



注:本文中的ENGINE_load_builtin_engines函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ENGINE_new函数代码示例发布时间:2022-05-30
下一篇:
C++ ENGINE_init函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap