本文整理汇总了C++中ENGINE_new函数的典型用法代码示例。如果您正苦于以下问题:C++ ENGINE_new函数的具体用法?C++ ENGINE_new怎么用?C++ ENGINE_new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ENGINE_new函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:e_qat.c
示例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,代码来源:engine.c
示例3: ca_engine_init
void
ca_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,代码来源:ca.c
示例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,代码来源:Pkcs11.cpp
示例5: dst__openssl_init
isc_result_t
dst__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,代码来源:openssl_link.c
示例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,代码来源:e_ossltest.c
示例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,代码来源:eng_rdrand.c
示例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,代码来源:e_nuron.c
示例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,代码来源:eng_openssl.c
示例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,代码来源:e_afalg.c
示例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,代码来源:e_dasync.c
示例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,代码来源:gost_eng.c
示例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,代码来源:e_sureware.cpp
示例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,代码来源:e_tpm.c
示例15: ossl_engine_s_alloc
static VALUE
ossl_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,代码来源:ossl_engine.c
示例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,代码来源:eng_keystore.cpp
示例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,代码来源:e_padlock.c
示例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,代码来源:hw_zencod.c
示例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,代码来源:cba_ecdh_engine.c
示例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,代码来源:eng_list.c
注:本文中的ENGINE_new函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论