本文整理汇总了C++中CRYPTO_new_ex_data函数的典型用法代码示例。如果您正苦于以下问题:C++ CRYPTO_new_ex_data函数的具体用法?C++ CRYPTO_new_ex_data怎么用?C++ CRYPTO_new_ex_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CRYPTO_new_ex_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: EC_KEY_new_method
EC_KEY *
EC_KEY_new_method(ENGINE *engine)
{
EC_KEY *ret;
if ((ret = calloc(1, sizeof(EC_KEY))) == NULL) {
ECerror(ERR_R_MALLOC_FAILURE);
return NULL;
}
ret->meth = EC_KEY_get_default_method();
#ifndef OPENSSL_NO_ENGINE
if (engine != NULL) {
if (!ENGINE_init(engine)) {
ECerror(ERR_R_ENGINE_LIB);
goto err;
}
ret->engine = engine;
} else
ret->engine = ENGINE_get_default_EC();
if (ret->engine) {
ret->meth = ENGINE_get_EC(ret->engine);
if (ret->meth == NULL) {
ECerror(ERR_R_ENGINE_LIB);
goto err;
}
}
#endif
ret->version = 1;
ret->flags = 0;
ret->group = NULL;
ret->pub_key = NULL;
ret->priv_key = NULL;
ret->enc_flag = 0;
ret->conv_form = POINT_CONVERSION_UNCOMPRESSED;
ret->references = 1;
ret->method_data = NULL;
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data))
goto err;
if (ret->meth->init != NULL && ret->meth->init(ret) == 0)
goto err;
return ret;
err:
EC_KEY_free(ret);
return NULL;
}
开发者ID:libressl-portable,项目名称:openbsd,代码行数:48,代码来源:ec_kmeth.c
示例2: x509_cb
static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
void *exarg)
{
X509 *ret = (X509 *)*pval;
switch (operation) {
case ASN1_OP_NEW_POST:
ret->name = NULL;
ret->ex_flags = 0;
ret->ex_pathlen = -1;
ret->skid = NULL;
ret->akid = NULL;
#ifndef OPENSSL_NO_RFC3779
ret->rfc3779_addr = NULL;
ret->rfc3779_asid = NULL;
#endif
ret->aux = NULL;
ret->crldp = NULL;
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data);
break;
case ASN1_OP_D2I_POST:
OPENSSL_free(ret->name);
ret->name = X509_NAME_oneline(ret->cert_info.subject, NULL, 0);
break;
case ASN1_OP_FREE_POST:
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data);
X509_CERT_AUX_free(ret->aux);
ASN1_OCTET_STRING_free(ret->skid);
AUTHORITY_KEYID_free(ret->akid);
CRL_DIST_POINTS_free(ret->crldp);
policy_cache_free(ret->policy_cache);
GENERAL_NAMES_free(ret->altname);
NAME_CONSTRAINTS_free(ret->nc);
#ifndef OPENSSL_NO_RFC3779
sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free);
ASIdentifiers_free(ret->rfc3779_asid);
#endif
OPENSSL_free(ret->name);
break;
}
return 1;
}
开发者ID:DeqiangSun,项目名称:openssl,代码行数:48,代码来源:x_x509.c
示例3: OPENSSL_malloc
DH *DH_new(void) {
DH *dh = OPENSSL_malloc(sizeof(DH));
if (dh == NULL) {
OPENSSL_PUT_ERROR(DH, ERR_R_MALLOC_FAILURE);
return NULL;
}
OPENSSL_memset(dh, 0, sizeof(DH));
CRYPTO_MUTEX_init(&dh->method_mont_p_lock);
dh->references = 1;
CRYPTO_new_ex_data(&dh->ex_data);
return dh;
}
开发者ID:ro-ot,项目名称:boringssl,代码行数:16,代码来源:dh.c
示例4: CRYPTO_THREAD_run_once
ENGINE *ENGINE_new(void)
{
ENGINE *ret;
CRYPTO_THREAD_run_once(&engine_lock_init, do_engine_lock_init);
ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
ret->struct_ref = 1;
engine_ref_debug(ret, 0, 1);
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ENGINE, ret, &ret->ex_data);
return ret;
}
开发者ID:3nGercog,项目名称:openssl,代码行数:16,代码来源:eng_lib.c
示例5: OPENSSL_zalloc
UI *UI_new_method(const UI_METHOD *method)
{
UI *ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
UIerr(UI_F_UI_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return NULL;
}
if (method == NULL)
ret->meth = UI_get_default_method();
else
ret->meth = method;
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_UI, ret, &ret->ex_data);
return ret;
}
开发者ID:crypto-org-ua,项目名称:openssl-ua,代码行数:16,代码来源:ui_lib.c
示例6: ENGINEerr
ENGINE *ENGINE_new(void)
{
ENGINE *ret;
ret = (ENGINE *)OPENSSL_malloc(sizeof(ENGINE));
if(ret == NULL)
{
ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
memset(ret, 0, sizeof(ENGINE));
ret->struct_ref = 1;
engine_ref_debug(ret, 0, 1)
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ENGINE, ret, &ret->ex_data);
return ret;
}
开发者ID:oss-forks,项目名称:openssl,代码行数:16,代码来源:eng_lib.c
示例7: OPENSSL_strdup
UI_METHOD *UI_create_method(const char *name)
{
UI_METHOD *ui_method = NULL;
if ((ui_method = OPENSSL_zalloc(sizeof(*ui_method))) == NULL
|| (ui_method->name = OPENSSL_strdup(name)) == NULL
|| !CRYPTO_new_ex_data(CRYPTO_EX_INDEX_UI_METHOD, ui_method,
&ui_method->ex_data)) {
if (ui_method)
OPENSSL_free(ui_method->name);
OPENSSL_free(ui_method);
UIerr(UI_F_UI_CREATE_METHOD, ERR_R_MALLOC_FAILURE);
return NULL;
}
return ui_method;
}
开发者ID:danielctull-forks,项目名称:openssl,代码行数:16,代码来源:ui_lib.c
示例8: OPENSSL_zalloc
DSA *DSA_new_method(ENGINE *engine)
{
DSA *ret;
ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return (NULL);
}
ret->meth = DSA_get_default_method();
#ifndef OPENSSL_NO_ENGINE
if (engine) {
if (!ENGINE_init(engine)) {
DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_ENGINE_LIB);
OPENSSL_free(ret);
return NULL;
}
ret->engine = engine;
} else
ret->engine = ENGINE_get_default_DSA();
if (ret->engine) {
ret->meth = ENGINE_get_DSA(ret->engine);
if (ret->meth == NULL) {
DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
OPENSSL_free(ret);
return NULL;
}
}
#endif
ret->references = 1;
ret->flags = ret->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW;
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data);
if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
#ifndef OPENSSL_NO_ENGINE
if (ret->engine)
ENGINE_finish(ret->engine);
#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data);
OPENSSL_free(ret);
ret = NULL;
}
return (ret);
}
开发者ID:QFangMobile,项目名称:openssl,代码行数:46,代码来源:dsa_lib.c
示例9: OPENSSL_malloc
SSL_SESSION *ssl_session_new(const SSL_X509_METHOD *x509_method) {
SSL_SESSION *session = OPENSSL_malloc(sizeof(SSL_SESSION));
if (session == NULL) {
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
return 0;
}
OPENSSL_memset(session, 0, sizeof(SSL_SESSION));
session->x509_method = x509_method;
session->verify_result = X509_V_ERR_INVALID_CALL;
session->references = 1;
session->timeout = SSL_DEFAULT_SESSION_TIMEOUT;
session->auth_timeout = SSL_DEFAULT_SESSION_TIMEOUT;
session->time = time(NULL);
CRYPTO_new_ex_data(&session->ex_data);
return session;
}
开发者ID:boringssl,项目名称:boringssl,代码行数:17,代码来源:ssl_session.c
示例10: OPENSSL_PUT_ERROR
SSL_SESSION *SSL_SESSION_new(void) {
SSL_SESSION *ss;
ss = (SSL_SESSION *)OPENSSL_malloc(sizeof(SSL_SESSION));
if (ss == NULL) {
OPENSSL_PUT_ERROR(SSL, SSL_SESSION_new, ERR_R_MALLOC_FAILURE);
return 0;
}
memset(ss, 0, sizeof(SSL_SESSION));
ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */
ss->references = 1;
ss->timeout = SSL_DEFAULT_SESSION_TIMEOUT;
ss->time = (unsigned long)time(NULL);
CRYPTO_new_ex_data(&g_ex_data_class, ss, &ss->ex_data);
return ss;
}
开发者ID:friends110110,项目名称:boringssl,代码行数:17,代码来源:ssl_sess.c
示例11: OPENSSL_zalloc
ENGINE *ENGINE_new(void)
{
ENGINE *ret;
if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)
|| (ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
ret->struct_ref = 1;
engine_ref_debug(ret, 0, 1);
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ENGINE, ret, &ret->ex_data)) {
OPENSSL_free(ret);
return NULL;
}
return ret;
}
开发者ID:Castaglia,项目名称:openssl,代码行数:17,代码来源:eng_lib.c
示例12: RSAerr
RSA *RSA_new_method(ENGINE *engine)
{
RSA *ret;
ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
if (ret == NULL)
{
RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
return NULL;
}
ret->meth = &rsa_pkcs1_eay_meth;
ret->pad=0;
ret->version=0;
ret->n=NULL;
ret->e=NULL;
ret->d=NULL;
ret->p=NULL;
ret->q=NULL;
ret->dmp1=NULL;
ret->dmq1=NULL;
ret->iqmp=NULL;
ret->references=1;
ret->_method_mod_n=NULL;
ret->_method_mod_p=NULL;
ret->_method_mod_q=NULL;
ret->blinding=NULL;
ret->mt_blinding=NULL;
ret->bignum_data=NULL;
ret->flags=ret->meth->flags & ~RSA_FLAG_NON_FIPS_ALLOW;
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data))
{
OPENSSL_free(ret);
return(NULL);
}
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data);
OPENSSL_free(ret);
ret=NULL;
}
return(ret);
}
开发者ID:Aorjoa,项目名称:bootloader,代码行数:45,代码来源:rsa.c
示例13: OPENSSL_zalloc
EC_KEY *EC_KEY_new_method(ENGINE *engine)
{
EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return (NULL);
}
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_EC_KEY, ret, &ret->ex_data)) {
OPENSSL_free(ret);
return NULL;
}
ret->meth = EC_KEY_get_default_method();
#ifndef OPENSSL_NO_ENGINE
if (engine != NULL) {
if (!ENGINE_init(engine)) {
ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_ENGINE_LIB);
OPENSSL_free(ret);
return NULL;
}
ret->engine = engine;
} else
ret->engine = ENGINE_get_default_EC();
if (ret->engine != NULL) {
ret->meth = ENGINE_get_EC(ret->engine);
if (ret->meth == NULL) {
ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
OPENSSL_free(ret);
return NULL;
}
}
#endif
ret->version = 1;
ret->conv_form = POINT_CONVERSION_UNCOMPRESSED;
ret->references = 1;
if (ret->meth->init != NULL && ret->meth->init(ret) == 0) {
EC_KEY_free(ret);
return NULL;
}
return ret;
}
开发者ID:GarikRC,项目名称:openssl,代码行数:44,代码来源:ec_kmeth.c
示例14: ENGINE_new
ENGINE *
ENGINE_new(void)
{
ENGINE *ret;
if (!OPENSSL_init_crypto(0, NULL))
return NULL;
ret = malloc(sizeof(ENGINE));
if (ret == NULL) {
ENGINEerror(ERR_R_MALLOC_FAILURE);
return NULL;
}
memset(ret, 0, sizeof(ENGINE));
ret->struct_ref = 1;
engine_ref_debug(ret, 0, 1)
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ENGINE, ret, &ret->ex_data);
return ret;
}
开发者ID:mr-moai-2016,项目名称:znk_project,代码行数:19,代码来源:eng_lib.c
示例15: x509_cb
static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
void *exarg)
{
X509 *ret = (X509 *)*pval;
switch (operation) {
case ASN1_OP_NEW_POST:
ret->name = NULL;
ret->ex_flags = 0;
ret->ex_pathlen = -1;
ret->skid = NULL;
ret->akid = NULL;
ret->aux = NULL;
ret->crldp = NULL;
CRYPTO_new_ex_data(&ret->ex_data);
break;
case ASN1_OP_D2I_POST:
if (ret->name != NULL)
OPENSSL_free(ret->name);
ret->name = X509_NAME_oneline(ret->cert_info->subject, NULL, 0);
break;
case ASN1_OP_FREE_POST:
CRYPTO_free_ex_data(&g_ex_data_class, ret, &ret->ex_data);
X509_CERT_AUX_free(ret->aux);
ASN1_OCTET_STRING_free(ret->skid);
AUTHORITY_KEYID_free(ret->akid);
CRL_DIST_POINTS_free(ret->crldp);
policy_cache_free(ret->policy_cache);
GENERAL_NAMES_free(ret->altname);
NAME_CONSTRAINTS_free(ret->nc);
if (ret->name != NULL)
OPENSSL_free(ret->name);
break;
}
return 1;
}
开发者ID:caiolima,项目名称:webkit,代码行数:43,代码来源:x_x509.c
示例16: ECDSAerr
static ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine)
{
ECDSA_DATA *ret;
ret=(ECDSA_DATA *)OPENSSL_malloc(sizeof(ECDSA_DATA));
if (ret == NULL)
{
ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return(NULL);
}
ret->init = NULL;
ret->meth = ECDSA_get_default_method();
ret->engine = engine;
#ifndef OPENSSL_NO_ENGINE
if (!ret->engine)
ret->engine = ENGINE_get_default_ECDSA();
if (ret->engine)
{
ret->meth = ENGINE_get_ECDSA(ret->engine);
if (!ret->meth)
{
ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
OPENSSL_free(ret);
return NULL;
}
}
#endif
ret->flags = ret->meth->flags;
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data);
#if 0
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data);
OPENSSL_free(ret);
ret=NULL;
}
#endif
return(ret);
}
开发者ID:0omega,项目名称:platform_external_openssl,代码行数:43,代码来源:ecs_lib.c
示例17: UI_new_method
UI *
UI_new_method(const UI_METHOD *method)
{
UI *ret;
ret = malloc(sizeof(UI));
if (ret == NULL) {
UIerr(UI_F_UI_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return NULL;
}
if (method == NULL)
ret->meth = UI_get_default_method();
else
ret->meth = method;
ret->strings = NULL;
ret->user_data = NULL;
ret->flags = 0;
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_UI, ret, &ret->ex_data);
return ret;
}
开发者ID:NSGod,项目名称:openbsd,代码行数:21,代码来源:ui_lib.c
示例18: zlib_stateful_init
static int zlib_stateful_init(COMP_CTX *ctx)
{
int err;
struct zlib_state *state =
(struct zlib_state *)OPENSSL_malloc(sizeof(struct zlib_state));
if (state == NULL)
goto err;
state->istream.zalloc = zlib_zalloc;
state->istream.zfree = zlib_zfree;
state->istream.opaque = Z_NULL;
state->istream.next_in = Z_NULL;
state->istream.next_out = Z_NULL;
state->istream.avail_in = 0;
state->istream.avail_out = 0;
err = inflateInit_(&state->istream, ZLIB_VERSION, sizeof(z_stream));
if (err != Z_OK)
goto err;
state->ostream.zalloc = zlib_zalloc;
state->ostream.zfree = zlib_zfree;
state->ostream.opaque = Z_NULL;
state->ostream.next_in = Z_NULL;
state->ostream.next_out = Z_NULL;
state->ostream.avail_in = 0;
state->ostream.avail_out = 0;
err = deflateInit_(&state->ostream, Z_DEFAULT_COMPRESSION,
ZLIB_VERSION, sizeof(z_stream));
if (err != Z_OK)
goto err;
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_COMP, ctx, &ctx->ex_data);
CRYPTO_set_ex_data(&ctx->ex_data, zlib_stateful_ex_idx, state);
return 1;
err:
if (state)
OPENSSL_free(state);
return 0;
}
开发者ID:03050903,项目名称:godot,代码行数:40,代码来源:c_zlib.c
示例19: BIO_set
int BIO_set(BIO *bio, const BIO_METHOD *method)
{
bio->method=method;
bio->callback=NULL;
bio->cb_arg=NULL;
bio->init=0;
bio->shutdown=1;
bio->flags=0;
bio->retry_reason=0;
bio->num=0;
bio->ptr=NULL;
bio->prev_bio=NULL;
bio->next_bio=NULL;
bio->references=1;
bio->num_read=0L;
bio->num_write=0L;
CRYPTO_new_ex_data(bio_meth,bio,&bio->ex_data);
if (method->create != NULL)
if (!method->create(bio))
return(0);
return(1);
}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:22,代码来源:bio_lib.c
示例20: X509_STORE_new
X509_STORE *
X509_STORE_new(void)
{
X509_STORE *ret;
if ((ret = malloc(sizeof(X509_STORE))) == NULL)
return NULL;
ret->objs = sk_X509_OBJECT_new(x509_object_cmp);
ret->cache = 1;
ret->get_cert_methods = sk_X509_LOOKUP_new_null();
ret->verify = 0;
ret->verify_cb = 0;
if ((ret->param = X509_VERIFY_PARAM_new()) == NULL)
goto err;
ret->get_issuer = 0;
ret->check_issued = 0;
ret->check_revocation = 0;
ret->get_crl = 0;
ret->check_crl = 0;
ret->cert_crl = 0;
ret->lookup_certs = 0;
ret->lookup_crls = 0;
ret->cleanup = 0;
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data))
goto err;
ret->references = 1;
return ret;
err:
X509_VERIFY_PARAM_free(ret->param);
sk_X509_LOOKUP_free(ret->get_cert_methods);
sk_X509_OBJECT_free(ret->objs);
free(ret);
return NULL;
}
开发者ID:randombit,项目名称:hacrypto,代码行数:39,代码来源:x509_lu.c
注:本文中的CRYPTO_new_ex_data函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论