您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ENGINE_new函数代码示例

51自学网 2021-06-01 20:32:36
  C++
这篇教程C++ ENGINE_new函数代码示例写得很实用,希望能帮到您。

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

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

示例1: DEBUG

static ENGINE *engine_qat(void){    ENGINE *ret = NULL;    unsigned int devmasks[] = { 0, 0, 0 };    DEBUG("[%s] engine_qat/n", __func__);    if (access(QAT_DEV, F_OK) != 0) {        QATerr(QAT_F_ENGINE_QAT, QAT_R_MEM_DRV_NOT_PRESENT);        return ret;    }    if (!getDevices(devmasks)) {        QATerr(QAT_F_ENGINE_QAT, QAT_R_QAT_DEV_NOT_PRESENT);        return ret;    }    ret = ENGINE_new();    if (!ret)        return NULL;    if (!bind_qat(ret, engine_qat_id)) {        WARN("qat engine bind failed!/n");        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:Muffo,项目名称:QAT_Engine,代码行数:29,


示例2: openssl_engine

int openssl_engine(lua_State *L){	const ENGINE* eng = NULL;	if(lua_isnoneornil(L, 1)){		eng = ENGINE_new();	}else if(lua_isstring(L, 1)){		const char* id = luaL_checkstring(L, 1);		eng = ENGINE_by_id(id);	}else if(lua_isboolean(L,1)){		int first = lua_toboolean(L, 1);		if(first)			eng = ENGINE_get_first();		else			eng = ENGINE_get_last();	}else		luaL_error(L, 			"#1 may be string, boolean, nil, userdata for engine or none/n"			"/tstring for an engine id to load/n"			"/ttrue for first engine, false or last engine/n"			"/tnil or none will create a new engine/n"			"/tbut we get %s:%s",lua_typename(L,lua_type(L,  1)),lua_tostring(L,1));	if(eng){		PUSH_OBJECT((void*)eng,"openssl.engine");	}else		lua_pushnil(L);	return 1;}
开发者ID:alemic,项目名称:lua-openssl,代码行数:26,


示例3: ca_engine_init

voidca_engine_init(void){	ENGINE		*e;	const char	*errstr, *name;	if ((e = ENGINE_get_default_RSA()) == NULL) {		if ((e = ENGINE_new()) == NULL) {			errstr = "ENGINE_new";			goto fail;		}		if (!ENGINE_set_name(e, rsae_method.name)) {			errstr = "ENGINE_set_name";			goto fail;		}		if ((rsa_default = RSA_get_default_method()) == NULL) {			errstr = "RSA_get_default_method";			goto fail;		}	} else if ((rsa_default = ENGINE_get_RSA(e)) == NULL) {		errstr = "ENGINE_get_RSA";		goto fail;	}	if ((name = ENGINE_get_name(e)) == NULL)		name = "unknown RSA engine";	log_debug("debug: %s: using %s", __func__, name);	if (rsa_default->flags & RSA_FLAG_SIGN_VER)		fatalx("unsupported RSA engine");	if (rsa_default->rsa_mod_exp == NULL)		rsae_method.rsa_mod_exp = NULL;	if (rsa_default->bn_mod_exp == NULL)		rsae_method.bn_mod_exp = NULL;	if (rsa_default->rsa_keygen == NULL)		rsae_method.rsa_keygen = NULL;	rsae_method.flags = rsa_default->flags |	    RSA_METHOD_FLAG_NO_CHECK;	rsae_method.app_data = rsa_default->app_data;	if (!ENGINE_set_RSA(e, &rsae_method)) {		errstr = "ENGINE_set_RSA";		goto fail;	}	if (!ENGINE_set_default_RSA(e)) {		errstr = "ENGINE_set_default_RSA";		goto fail;	}	return; fail:	ssl_error(errstr);	fatalx("%s", errstr);}
开发者ID:gunhu,项目名称:OpenSMTPD,代码行数:57,


示例4: LoadEngine

    static ENGINE* LoadEngine()    {      // This function creates an engine for PKCS#11 and inspired by      // the "ENGINE_load_dynamic" function from OpenSSL, in file      // "crypto/engine/eng_dyn.c"      ENGINE* engine = ENGINE_new();      if (!engine)      {        LOG(ERROR) << "Cannot create an OpenSSL engine for PKCS#11";        throw OrthancException(ErrorCode_InternalError);      }      // Create a PKCS#11 context using libp11      context_ = pkcs11_new();      if (!context_)      {        LOG(ERROR) << "Cannot create a libp11 context for PKCS#11";        ENGINE_free(engine);        throw OrthancException(ErrorCode_InternalError);      }      if (!ENGINE_set_id(engine, PKCS11_ENGINE_ID) ||          !ENGINE_set_name(engine, PKCS11_ENGINE_NAME) ||          !ENGINE_set_cmd_defns(engine, PKCS11_ENGINE_COMMANDS) ||          // Register the callback functions          !ENGINE_set_init_function(engine, EngineInitialize) ||          !ENGINE_set_finish_function(engine, EngineFinalize) ||          !ENGINE_set_destroy_function(engine, EngineDestroy) ||          !ENGINE_set_ctrl_function(engine, EngineControl) ||          !ENGINE_set_load_pubkey_function(engine, EngineLoadPublicKey) ||          !ENGINE_set_load_privkey_function(engine, EngineLoadPrivateKey) ||          !ENGINE_set_RSA(engine, PKCS11_get_rsa_method()) ||          !ENGINE_set_ECDSA(engine, PKCS11_get_ecdsa_method()) ||          !ENGINE_set_ECDH(engine, PKCS11_get_ecdh_method()) ||#if OPENSSL_VERSION_NUMBER  >= 0x10100002L          !ENGINE_set_EC(engine, PKCS11_get_ec_key_method()) ||#endif          // Make OpenSSL know about our PKCS#11 engine          !ENGINE_add(engine))      {        LOG(ERROR) << "Cannot initialize the OpenSSL engine for PKCS#11";        pkcs11_finish(context_);        ENGINE_free(engine);        throw OrthancException(ErrorCode_InternalError);      }      // If the "ENGINE_add" worked, it gets a structural      // reference. We release our just-created reference.      ENGINE_free(engine);      return ENGINE_by_id(PKCS11_ENGINE_ID);    }
开发者ID:PACSinTERRA,项目名称:orthanc,代码行数:57,


示例5: dst__openssl_init

isc_result_tdst__openssl_init() {	isc_result_t result;#ifdef  DNS_CRYPTO_LEAKS	CRYPTO_malloc_debug_init();	CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);#endif	CRYPTO_set_mem_functions(mem_alloc, mem_realloc, mem_free);	nlocks = CRYPTO_num_locks();	locks = mem_alloc(sizeof(isc_mutex_t) * nlocks);	if (locks == NULL)		return (ISC_R_NOMEMORY);	result = isc_mutexblock_init(locks, nlocks);	if (result != ISC_R_SUCCESS)		goto cleanup_mutexalloc;	CRYPTO_set_locking_callback(lock_callback);	CRYPTO_set_id_callback(id_callback);	rm = mem_alloc(sizeof(RAND_METHOD));	if (rm == NULL) {		result = ISC_R_NOMEMORY;		goto cleanup_mutexinit;	}	rm->seed = NULL;	rm->bytes = entropy_get;	rm->cleanup = NULL;	rm->add = entropy_add;	rm->pseudorand = entropy_getpseudo;	rm->status = entropy_status;#ifdef USE_ENGINE	e = ENGINE_new();	if (e == NULL) {		result = ISC_R_NOMEMORY;		goto cleanup_rm;	}	ENGINE_set_RAND(e, rm);	RAND_set_rand_method(rm);#else	RAND_set_rand_method(rm);#endif /* USE_ENGINE */	return (ISC_R_SUCCESS);#ifdef USE_ENGINE cleanup_rm:	mem_free(rm);#endif cleanup_mutexinit:	CRYPTO_set_locking_callback(NULL);	DESTROYMUTEXBLOCK(locks, nlocks); cleanup_mutexalloc:	mem_free(locks);	return (result);}
开发者ID:OPSF,项目名称:uClinux,代码行数:55,


示例6: ENGINE_new

static ENGINE *engine_ossltest(void){    ENGINE *ret = ENGINE_new();    if (ret == NULL)        return NULL;    if (!bind_ossltest(ret)) {        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:277800076,项目名称:openssl,代码行数:11,


示例7: ENGINE_new

static ENGINE *ENGINE_rdrand(void){    ENGINE *ret = ENGINE_new();    if (!ret)        return NULL;    if (!bind_helper(ret)) {        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:NickAger,项目名称:elm-slider,代码行数:11,


示例8: ENGINE_new

static ENGINE *engine_nuron(void){    ENGINE *ret = ENGINE_new();    if (!ret)        return NULL;    if (!bind_helper(ret)) {        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:johnjohnsp1,项目名称:opensgx,代码行数:11,


示例9: ENGINE_new

static ENGINE *engine_openssl(void){    ENGINE *ret = ENGINE_new();    if (ret == NULL)        return NULL;    if (!bind_helper(ret)) {        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:Bilibili,项目名称:openssl,代码行数:11,


示例10: ENGINE_new

static ENGINE *engine_afalg(void){    ENGINE *ret = ENGINE_new();    if (ret == NULL)        return NULL;    if (!bind_afalg(ret)) {        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:AlexanderPankiv,项目名称:node,代码行数:11,


示例11: ENGINE_new

static ENGINE *engine_dasync(void){    ENGINE *ret = ENGINE_new();    if (!ret)        return NULL;    if (!bind_dasync(ret)) {        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:1234-,项目名称:openssl,代码行数:11,


示例12: ENGINE_new

static ENGINE *engine_gost(void){    ENGINE *ret = ENGINE_new();    if (!ret)        return NULL;    if (!bind_gost(ret, engine_gost_id)) {        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:119120119,项目名称:node,代码行数:11,


示例13: ENGINE_new

static ENGINE *engine_sureware(void){    ENGINE *ret = ENGINE_new();    if(!ret)        return NULL;    if(!bind_sureware(ret))    {        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:12,


示例14: ENGINE_new

static ENGINE *engine_tpm(void){	ENGINE *ret = ENGINE_new();	DBG("%s", __FUNCTION__);	if (!ret)		return NULL;	if (!bind_helper(ret)) {		ENGINE_free(ret);		return NULL;	}	return ret;}
开发者ID:tavlima,项目名称:openssl-tpm-engine,代码行数:12,


示例15: ossl_engine_s_alloc

static VALUEossl_engine_s_alloc(VALUE klass){    ENGINE *e;    VALUE obj;    if (!(e = ENGINE_new())) {       ossl_raise(eEngineError, NULL);    }    WrapEngine(klass, obj, e);    return obj;}
开发者ID:Emily,项目名称:rubinius,代码行数:13,


示例16: ENGINE_keystore

ENGINE* ENGINE_keystore() {    ALOGV("ENGINE_keystore");    Unique_ENGINE engine(ENGINE_new());    if (engine.get() == NULL) {        return NULL;    }    if (!keystore_engine_setup(engine.get())) {        return NULL;    }    return engine.release();}
开发者ID:TeamNyx,项目名称:system_security,代码行数:14,


示例17: ENGINE_new

/* Constructor */static ENGINE *ENGINE_padlock(void){    ENGINE *eng = ENGINE_new();    if (eng == NULL) {        return NULL;    }    if (!padlock_bind_helper(eng)) {        ENGINE_free(eng);        return NULL;    }    return eng;}
开发者ID:Dmitry-Me,项目名称:openssl,代码行数:16,


示例18: ENGINE_new

/* As this is only ever called once, there's no need for locking * (indeed - the lock will already be held by our caller!!!) */static ENGINE *ENGINE_zencod ( void ){	ENGINE *eng = ENGINE_new () ;	if ( !eng ) {		return NULL ;	}	if ( !bind_helper ( eng ) ) {		ENGINE_free ( eng ) ;		return NULL ;	}	return eng ;}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:18,


示例19: fprintf

static ENGINE *engine_hwdev(void){    fprintf(stderr, "arrive at engine_test/n");	ENGINE *ret = ENGINE_new();	if(!ret) {		return NULL;    }	if(!bind_helper(ret)) {		ENGINE_free(ret);		return NULL;    }	return ret;}
开发者ID:winstard,项目名称:GmSSL,代码行数:15,


示例20: ENGINE_by_id

ENGINE *ENGINE_by_id(const char *id){	ENGINE *iterator;	ENGINE *tmp;	tmp = engine_list_head;    while (tmp) {        printf("my engine iterator, id%s/n", tmp->id);		tmp = tmp->next;    }    printf("my engine, file:%s line:%d/n", __FILE__, __LINE__);	if (id == NULL) {		ENGINEerr(ENGINE_F_ENGINE_BY_ID,		    ERR_R_PASSED_NULL_PARAMETER);		return NULL;	}	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);    printf("my engine, file:%s line:%d/n", __FILE__, __LINE__);	iterator = engine_list_head;	while (iterator && (strcmp(id, iterator->id) != 0) && printf("my engine iterator, id%s/n", iterator->id))		iterator = iterator->next;	if (iterator) {		/* We need to return a structural reference. If this is an		 * ENGINE type that returns copies, make a duplicate - otherwise		 * increment the existing ENGINE's reference count. */		if (iterator->flags & ENGINE_FLAGS_BY_ID_COPY) {			ENGINE *cp = ENGINE_new();			if (!cp)				iterator = NULL;			else {				engine_cpy(cp, iterator);				iterator = cp;			}		} else {			iterator->struct_ref++;			engine_ref_debug(iterator, 0, 1)		}	}	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);    printf("my engine, file:%s line:%d/n", __FILE__, __LINE__);	if (iterator == NULL) {		ENGINEerr(ENGINE_F_ENGINE_BY_ID, ENGINE_R_NO_SUCH_ENGINE);		ERR_asprintf_error_data("id=%s", id);	}	return iterator;}
开发者ID:luocn99,项目名称:nginx,代码行数:48,


示例21: ENGINE_aesni

/* Constructor */static ENGINE *ENGINE_aesni(void){	ENGINE *eng = ENGINE_new();	if (!eng) {		return NULL;	}	if (!aesni_bind_helper(eng)) {		ENGINE_free(eng);		return NULL;	}	return eng;}
开发者ID:evenmatrix,项目名称:streamster2-pyopenssl,代码行数:17,


示例22: ENGINE_load_t4

/* * This makes the engine "built-in" with OpenSSL. * On non-T4 CPUs this just returns. * Called by ENGINE_load_builtin_engines(). */voidENGINE_load_t4(void){#ifdef	COMPILE_HW_T4	ENGINE *toadd = ENGINE_new();	if (toadd != NULL) {		if (t4_bind_helper(toadd, ENGINE_T4_ID) != 0) {			(void) ENGINE_add(toadd);			(void) ENGINE_free(toadd);			ERR_clear_error();		} else {			(void) ENGINE_free(toadd);		}	}#endif}
开发者ID:Nebraska,项目名称:userland-gate,代码行数:21,


示例23: ENGINE_new

static ENGINE *engine_dynamic(void){    ENGINE *ret = ENGINE_new();    if (ret == NULL)        return NULL;    if (!ENGINE_set_id(ret, engine_dynamic_id) ||        !ENGINE_set_name(ret, engine_dynamic_name) ||        !ENGINE_set_init_function(ret, dynamic_init) ||        !ENGINE_set_finish_function(ret, dynamic_finish) ||        !ENGINE_set_ctrl_function(ret, dynamic_ctrl) ||        !ENGINE_set_flags(ret, ENGINE_FLAGS_BY_ID_COPY) ||        !ENGINE_set_cmd_defns(ret, dynamic_cmd_defns)) {        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:tuskitumizhou,项目名称:openssl,代码行数:17,


示例24: engine_load_devcrypto_int

/* * In case this engine is built into libcrypto, then it doesn't offer any * ability to be dynamically loadable. */void engine_load_devcrypto_int(void){    ENGINE *e = NULL;    if (!open_devcrypto())        return;    if ((e = ENGINE_new()) == NULL        || !bind_devcrypto(e)) {        close_devcrypto();        ENGINE_free(e);        return;    }    ENGINE_add(e);    ENGINE_free(e);          /* Loose our local reference */    ERR_clear_error();}
开发者ID:ciz,项目名称:openssl,代码行数:22,


示例25: sc_get_engine

static ENGINE *sc_get_engine(void){	static ENGINE *smart_engine = NULL;	if ((smart_engine = ENGINE_new()) == NULL)		fatal("ENGINE_new failed");	ENGINE_set_id(smart_engine, "sectok");	ENGINE_set_name(smart_engine, "libsectok");	ENGINE_set_RSA(smart_engine, sc_get_rsa_method());	ENGINE_set_DSA(smart_engine, DSA_get_default_openssl_method());	ENGINE_set_DH(smart_engine, DH_get_default_openssl_method());	ENGINE_set_RAND(smart_engine, RAND_SSLeay());	ENGINE_set_BN_mod_exp(smart_engine, BN_mod_exp);	return smart_engine;}
开发者ID:Te-k,项目名称:openssh-backdoor,代码行数:19,


示例26: DEBUG

static ENGINE *engine_qat(void){    ENGINE *ret = NULL;    DEBUG("- Starting/n");    ret = ENGINE_new();    if (!ret) {        WARN("Failed to create Engine/n");        QATerr(QAT_F_ENGINE_QAT, QAT_R_QAT_CREATE_ENGINE_FAILURE);        return NULL;    }    if (!bind_qat(ret, engine_qat_id)) {        WARN("Qat engine bind failed/n");        ENGINE_free(ret);        return NULL;    }    return ret;}
开发者ID:i10a,项目名称:QAT_Engine,代码行数:21,


示例27: Cryptography_add_osrandom_engine

/* Returns 1 if successfully added, 2 if engine has previously been added,   and 0 for error. */int Cryptography_add_osrandom_engine(void) {    ENGINE *e;    ERR_load_Cryptography_OSRandom_strings();    e = ENGINE_by_id(Cryptography_osrandom_engine_id);    if (e != NULL) {        ENGINE_free(e);        return 2;    } else {        ERR_clear_error();    }    e = ENGINE_new();    if (e == NULL) {        return 0;    }    if (!ENGINE_set_id(e, Cryptography_osrandom_engine_id) ||            !ENGINE_set_name(e, Cryptography_osrandom_engine_name) ||            !ENGINE_set_RAND(e, &osrandom_rand) ||            !ENGINE_set_init_function(e, osrandom_init) ||            !ENGINE_set_finish_function(e, osrandom_finish) ||            !ENGINE_set_cmd_defns(e, osrandom_cmd_defns) ||            !ENGINE_set_ctrl_function(e, osrandom_ctrl)) {        ENGINE_free(e);        return 0;    }    if (!ENGINE_add(e)) {        ENGINE_free(e);        return 0;    }    if (!ENGINE_free(e)) {        return 0;    }    return 1;}
开发者ID:reaperhulk,项目名称:cryptography,代码行数:39,


示例28: ENGINEerr

ENGINE *ENGINE_by_id(const char *id){    ENGINE *iterator;    char *load_dir = NULL;    if (id == NULL) {        ENGINEerr(ENGINE_F_ENGINE_BY_ID, ERR_R_PASSED_NULL_PARAMETER);        return NULL;    }    CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);    iterator = engine_list_head;    while (iterator && (strcmp(id, iterator->id) != 0))        iterator = iterator->next;    if (iterator != NULL) {        /*         * We need to return a structural reference. If this is an ENGINE         * type that returns copies, make a duplicate - otherwise increment         * the existing ENGINE's reference count.         */        if (iterator->flags & ENGINE_FLAGS_BY_ID_COPY) {            ENGINE *cp = ENGINE_new();            if (cp == NULL)                iterator = NULL;            else {                engine_cpy(cp, iterator);                iterator = cp;            }        } else {            iterator->struct_ref++;            engine_ref_debug(iterator, 0, 1);        }    }    CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);    if (iterator != NULL)        return iterator;    /*     * Prevent infinite recursion if we're looking for the dynamic engine.     */    if (strcmp(id, "dynamic")) {# ifdef OPENSSL_SYS_VMS        if ((load_dir = getenv("OPENSSL_ENGINES")) == 0)            load_dir = "SSLROOT:[ENGINES]";# else        if ((load_dir = getenv("OPENSSL_ENGINES")) == 0)            load_dir = ENGINESDIR;# endif        iterator = ENGINE_by_id("dynamic");        if (!iterator || !ENGINE_ctrl_cmd_string(iterator, "ID", id, 0) ||            !ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) ||            !ENGINE_ctrl_cmd_string(iterator, "DIR_ADD",                                    load_dir, 0) ||            !ENGINE_ctrl_cmd_string(iterator, "LIST_ADD", "1", 0) ||            !ENGINE_ctrl_cmd_string(iterator, "LOAD", NULL, 0))            goto notfound;        return iterator;    } notfound:    ENGINE_free(iterator);    ENGINEerr(ENGINE_F_ENGINE_BY_ID, ENGINE_R_NO_SUCH_ENGINE);    ERR_add_error_data(2, "id=", id);    return NULL;    /* EEK! Experimental code ends */}
开发者ID:Voxer,项目名称:openssl,代码行数:62,


示例29: ENGINE_load_builtin_engines

voidENGINE_load_builtin_engines(void){    ENGINE *engine;    int ret;    engine = ENGINE_new();    if (engine == NULL)	return;    ENGINE_set_id(engine, "builtin");    ENGINE_set_name(engine,		    "Heimdal crypto builtin (ltm) engine version " PACKAGE_VERSION);    ENGINE_set_RSA(engine, RSA_ltm_method());    ENGINE_set_DH(engine, DH_ltm_method());    ret = add_engine(engine);    if (ret != 1)	ENGINE_finish(engine);#ifdef USE_HCRYPTO_TFM    /*     * TFM     */    engine = ENGINE_new();    if (engine == NULL)	return;    ENGINE_set_id(engine, "tfm");    ENGINE_set_name(engine,		    "Heimdal crypto tfm engine version " PACKAGE_VERSION);    ENGINE_set_RSA(engine, RSA_tfm_method());    ENGINE_set_DH(engine, DH_tfm_method());    ret = add_engine(engine);    if (ret != 1)	ENGINE_finish(engine);#endif /* USE_HCRYPTO_TFM */#ifdef USE_HCRYPTO_LTM    /*     * ltm     */    engine = ENGINE_new();    if (engine == NULL)	return;    ENGINE_set_id(engine, "ltm");    ENGINE_set_name(engine,		    "Heimdal crypto ltm engine version " PACKAGE_VERSION);    ENGINE_set_RSA(engine, RSA_ltm_method());    ENGINE_set_DH(engine, DH_ltm_method());    ret = add_engine(engine);    if (ret != 1)	ENGINE_finish(engine);#endif#ifdef HAVE_GMP    /*     * gmp     */    engine = ENGINE_new();    if (engine == NULL)	return;    ENGINE_set_id(engine, "gmp");    ENGINE_set_name(engine,		    "Heimdal crypto gmp engine version " PACKAGE_VERSION);    ENGINE_set_RSA(engine, RSA_gmp_method());    ret = add_engine(engine);    if (ret != 1)	ENGINE_finish(engine);#endif}
开发者ID:tombibsd,项目名称:netbsd-src,代码行数:79,


示例30: ENGINE_load_cryptodev

voidENGINE_load_cryptodev(void){	ENGINE *engine = ENGINE_new();	int fd;	if (engine == NULL)		return;	if ((fd = get_dev_crypto()) < 0) {		ENGINE_free(engine);		return;	}	/*	 * find out what asymmetric crypto algorithms we support	 */	if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) {		close(fd);		ENGINE_free(engine);		return;	}	close(fd);	if (!ENGINE_set_id(engine, "cryptodev") ||	    !ENGINE_set_name(engine, "BSD cryptodev engine") ||	    !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) ||	    !ENGINE_set_digests(engine, cryptodev_engine_digests) ||	    !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) ||	    !ENGINE_set_cmd_defns(engine, cryptodev_defns)) {		ENGINE_free(engine);		return;	}	if (ENGINE_set_RSA(engine, &cryptodev_rsa)) {		const RSA_METHOD *rsa_meth = RSA_PKCS1_SSLeay();		cryptodev_rsa.bn_mod_exp = rsa_meth->bn_mod_exp;		cryptodev_rsa.rsa_mod_exp = rsa_meth->rsa_mod_exp;		cryptodev_rsa.rsa_pub_enc = rsa_meth->rsa_pub_enc;		cryptodev_rsa.rsa_pub_dec = rsa_meth->rsa_pub_dec;		cryptodev_rsa.rsa_priv_enc = rsa_meth->rsa_priv_enc;		cryptodev_rsa.rsa_priv_dec = rsa_meth->rsa_priv_dec;		if (cryptodev_asymfeat & CRF_MOD_EXP) {			cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp;			if (cryptodev_asymfeat & CRF_MOD_EXP_CRT)				cryptodev_rsa.rsa_mod_exp =				    cryptodev_rsa_mod_exp;			else				cryptodev_rsa.rsa_mod_exp =				    cryptodev_rsa_nocrt_mod_exp;		}	}	if (ENGINE_set_DSA(engine, &cryptodev_dsa)) {		const DSA_METHOD *meth = DSA_OpenSSL();		memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD));		if (cryptodev_asymfeat & CRF_DSA_SIGN)			cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign;		if (cryptodev_asymfeat & CRF_MOD_EXP) {			cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp;			cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp;		}		if (cryptodev_asymfeat & CRF_DSA_VERIFY)			cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify;	}	if (ENGINE_set_DH(engine, &cryptodev_dh)){		const DH_METHOD *dh_meth = DH_OpenSSL();		cryptodev_dh.generate_key = dh_meth->generate_key;		cryptodev_dh.compute_key = dh_meth->compute_key;		cryptodev_dh.bn_mod_exp = dh_meth->bn_mod_exp;		if (cryptodev_asymfeat & CRF_MOD_EXP) {			cryptodev_dh.bn_mod_exp = cryptodev_mod_exp_dh;			if (cryptodev_asymfeat & CRF_DH_COMPUTE_KEY)				cryptodev_dh.compute_key =				    cryptodev_dh_compute_key;		}	}	ENGINE_add(engine);	ENGINE_free(engine);	ERR_clear_error();}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:85,



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


C++ ENGINE_register_all_complete函数代码示例
C++ ENGINE_load_builtin_engines函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。