本文整理汇总了C++中OPENSSL_strdup函数的典型用法代码示例。如果您正苦于以下问题:C++ OPENSSL_strdup函数的具体用法?C++ OPENSSL_strdup怎么用?C++ OPENSSL_strdup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OPENSSL_strdup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: RSA_meth_set1_name
int RSA_meth_set1_name(RSA_METHOD *meth, const char *name)
{
OPENSSL_free(meth->name);
meth->name = OPENSSL_strdup(name);
return meth->name != NULL;
}
开发者ID:277800076,项目名称:openssl,代码行数:7,代码来源:rsa_meth.c
示例2: YAK_CTX_init
static void YAK_CTX_init(YAK_CTX *ctx, const char *name,
const char *peer_name, const BIGNUM *p,
const EC_POINT *g, const BIGNUM *q,
const BIGNUM *secret)
{
ctx->p.name = OPENSSL_strdup(name);
ctx->p.peer_name = OPENSSL_strdup(peer_name);
ctx->p.p = BN_dup(p);
ctx->p.g = BN_dup(g);
ctx->p.q = BN_dup(q);
ctx->secret = BN_dup(secret);
ctx->xa = BN_new();
ctx->key = BN_new();
ctx->ctx = BN_CTX_new();
}
开发者ID:stonecoldpat,项目名称:Authenticated-Key-Exchange-Over-Bitcoin,代码行数:16,代码来源:yak.c
示例3: DSOerr
char *DSO_convert_filename(DSO *dso, const char *filename)
{
char *result = NULL;
if (dso == NULL) {
DSOerr(DSO_F_DSO_CONVERT_FILENAME, ERR_R_PASSED_NULL_PARAMETER);
return (NULL);
}
if (filename == NULL)
filename = dso->filename;
if (filename == NULL) {
DSOerr(DSO_F_DSO_CONVERT_FILENAME, DSO_R_NO_FILENAME);
return (NULL);
}
if ((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) {
if (dso->name_converter != NULL)
result = dso->name_converter(dso, filename);
else if (dso->meth->dso_name_converter != NULL)
result = dso->meth->dso_name_converter(dso, filename);
}
if (result == NULL) {
result = OPENSSL_strdup(filename);
if (result == NULL) {
DSOerr(DSO_F_DSO_CONVERT_FILENAME, ERR_R_MALLOC_FAILURE);
return (NULL);
}
}
return (result);
}
开发者ID:FdaSilvaYY,项目名称:openssl,代码行数:29,代码来源:dso_lib.c
示例4: ssl_get_new_session
int ssl_get_new_session(SSL *s, int session)
{
/* This gets used by clients and servers. */
SSL_SESSION *ss = NULL;
if ((ss = SSL_SESSION_new()) == NULL) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL_GET_NEW_SESSION,
ERR_R_MALLOC_FAILURE);
return 0;
}
/* If the context has a default timeout, use it */
if (s->session_ctx->session_timeout == 0)
ss->timeout = SSL_get_default_timeout(s);
else
ss->timeout = s->session_ctx->session_timeout;
SSL_SESSION_free(s->session);
s->session = NULL;
if (session) {
if (!ssl_generate_session_id(s, ss)) {
/* SSLfatal() already called */
SSL_SESSION_free(ss);
return 0;
}
if (s->ext.hostname) {
ss->ext.hostname = OPENSSL_strdup(s->ext.hostname);
if (ss->ext.hostname == NULL) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL_GET_NEW_SESSION,
ERR_R_INTERNAL_ERROR);
SSL_SESSION_free(ss);
return 0;
}
}
} else {
ss->session_id_length = 0;
}
if (s->sid_ctx_length > sizeof ss->sid_ctx) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL_GET_NEW_SESSION,
ERR_R_INTERNAL_ERROR);
SSL_SESSION_free(ss);
return 0;
}
memcpy(ss->sid_ctx, s->sid_ctx, s->sid_ctx_length);
ss->sid_ctx_length = s->sid_ctx_length;
s->session = ss;
ss->ssl_version = s->version;
ss->verify_result = X509_V_OK;
/* If client supports extended master secret set it in session */
if (s->s3->flags & TLS1_FLAGS_RECEIVED_EXTMS)
ss->flags |= SSL_SESS_FLAG_EXTMS;
return 1;
}
开发者ID:xemdetia,项目名称:openssl,代码行数:59,代码来源:ssl_sess.c
示例5: OPENSSL_zalloc
UI_METHOD *UI_create_method(char *name)
{
UI_METHOD *ui_method = OPENSSL_zalloc(sizeof(*ui_method));
if (ui_method != NULL)
ui_method->name = OPENSSL_strdup(name);
return ui_method;
}
开发者ID:benlaurie,项目名称:openssl-old-2,代码行数:8,代码来源:ui_lib.c
示例6: X509_VERIFY_PARAM_set1_name
int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name)
{
OPENSSL_free(param->name);
param->name = OPENSSL_strdup(name);
if (param->name)
return 1;
return 0;
}
开发者ID:Astel,项目名称:openssl,代码行数:8,代码来源:x509_vpm.c
示例7: OPENSSL_strdup
char *BIO_ADDR_path_string(const BIO_ADDR *ap)
{
#ifdef AF_UNIX
if (ap->sa.sa_family == AF_UNIX)
return OPENSSL_strdup(ap->s_un.sun_path);
#endif
return NULL;
}
开发者ID:francois-wellenreiter,项目名称:openssl,代码行数:8,代码来源:b_addr.c
示例8: pkcs11_CTX_init_args
/*
* Set private init args for module
*/
void pkcs11_CTX_init_args(PKCS11_CTX * ctx, const char *init_args)
{
PKCS11_CTX_private *cpriv = PRIVCTX(ctx);
/* Free previously duplicated string */
if (cpriv->init_args) {
OPENSSL_free(cpriv->init_args);
}
cpriv->init_args = init_args ? OPENSSL_strdup(init_args) : NULL;
}
开发者ID:DDvO,项目名称:libp11,代码行数:12,代码来源:p11_load.c
示例9: PSPAKE_CTX_init
static void PSPAKE_CTX_init(PSPAKE_CTX *ctx, const char *password, const char *name, const char *peer_name)
{
ctx->g = BN_bin2bn(pspake_g, sizeof(pspake_g), NULL);
ctx->h = BN_bin2bn(pspake_h, sizeof(pspake_h), NULL);
ctx->q = BN_bin2bn(pspake_q, sizeof(pspake_q), NULL);
ctx->ctx = BN_CTX_new();
ctx->r = BN_new();
ctx->y = BN_new();
ctx->key = NULL;
ctx->y_ = NULL;
ctx->name = OPENSSL_strdup(name);
ctx->peer_name = OPENSSL_strdup(peer_name);
/* hash the given string password to get a Big Number ctx->secret */
ctx->secret = BN_new();
hashpassword(ctx->secret, password, ctx->ctx, ctx->q);
}
开发者ID:qzhouayi,项目名称:New_graduation_thesis,代码行数:19,代码来源:pspake.c
示例10: OPENSSL_zalloc
EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,
const char *pem_str, const char *info)
{
EVP_PKEY_ASN1_METHOD *ameth = OPENSSL_zalloc(sizeof(*ameth));
if (ameth == NULL)
return NULL;
ameth->pkey_id = id;
ameth->pkey_base_id = id;
ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC;
if (info) {
ameth->info = OPENSSL_strdup(info);
if (!ameth->info)
goto err;
}
/*
* One of the following must be true:
*
* pem_str == NULL AND ASN1_PKEY_ALIAS is set
* pem_str != NULL AND ASN1_PKEY_ALIAS is clear
*
* Anything else is an error and may lead to a corrupt ASN1 method table
*/
if (!((pem_str == NULL && (flags & ASN1_PKEY_ALIAS) != 0)
|| (pem_str != NULL && (flags & ASN1_PKEY_ALIAS) == 0)))
goto err;
if (pem_str) {
ameth->pem_str = OPENSSL_strdup(pem_str);
if (!ameth->pem_str)
goto err;
}
return ameth;
err:
EVP_PKEY_asn1_free(ameth);
return NULL;
}
开发者ID:AlexanderPankiv,项目名称:node,代码行数:43,代码来源:ameth_lib.c
示例11: ossl_provider_set_module_path
/* Setters */
int ossl_provider_set_module_path(OSSL_PROVIDER *prov, const char *module_path)
{
OPENSSL_free(prov->path);
if (module_path == NULL)
return 1;
if ((prov->path = OPENSSL_strdup(module_path)) != NULL)
return 1;
CRYPTOerr(CRYPTO_F_OSSL_PROVIDER_SET_MODULE_PATH, ERR_R_MALLOC_FAILURE);
return 0;
}
开发者ID:Ana06,项目名称:openssl,代码行数:11,代码来源:provider_core.c
示例12: X509_TRUST_add
int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int),
char *name, int arg1, void *arg2)
{
int idx;
X509_TRUST *trtmp;
/*
* This is set according to what we change: application can't set it
*/
flags &= ~X509_TRUST_DYNAMIC;
/* This will always be set for application modified trust entries */
flags |= X509_TRUST_DYNAMIC_NAME;
/* Get existing entry if any */
idx = X509_TRUST_get_by_id(id);
/* Need a new entry */
if (idx == -1) {
if ((trtmp = OPENSSL_malloc(sizeof(*trtmp))) == NULL) {
X509err(X509_F_X509_TRUST_ADD, ERR_R_MALLOC_FAILURE);
return 0;
}
trtmp->flags = X509_TRUST_DYNAMIC;
} else
trtmp = X509_TRUST_get0(idx);
/* OPENSSL_free existing name if dynamic */
if (trtmp->flags & X509_TRUST_DYNAMIC_NAME)
OPENSSL_free(trtmp->name);
/* dup supplied name */
if ((trtmp->name = OPENSSL_strdup(name)) == NULL) {
X509err(X509_F_X509_TRUST_ADD, ERR_R_MALLOC_FAILURE);
return 0;
}
/* Keep the dynamic flag of existing entry */
trtmp->flags &= X509_TRUST_DYNAMIC;
/* Set all other flags */
trtmp->flags |= flags;
trtmp->trust = id;
trtmp->check_trust = ck;
trtmp->arg1 = arg1;
trtmp->arg2 = arg2;
/* If its a new entry manage the dynamic table */
if (idx == -1) {
if (trtable == NULL
&& (trtable = sk_X509_TRUST_new(tr_cmp)) == NULL) {
X509err(X509_F_X509_TRUST_ADD, ERR_R_MALLOC_FAILURE);
return 0;
}
if (!sk_X509_TRUST_push(trtable, trtmp)) {
X509err(X509_F_X509_TRUST_ADD, ERR_R_MALLOC_FAILURE);
return 0;
}
}
return 1;
}
开发者ID:a1sams1a,项目名称:openssl-is523,代码行数:55,代码来源:x509_trs.c
示例13: OPENSSL_zalloc
DSA_METHOD *DSA_meth_new(const char *name, int flags)
{
DSA_METHOD *dsam = OPENSSL_zalloc(sizeof(DSA_METHOD));
if (dsam != NULL) {
dsam->name = OPENSSL_strdup(name);
dsam->flags = flags;
}
return dsam;
}
开发者ID:277800076,项目名称:openssl,代码行数:11,代码来源:dsa_meth.c
示例14: OPENSSL_zalloc
RSA_METHOD *RSA_meth_new(const char *name, int flags)
{
RSA_METHOD *meth = OPENSSL_zalloc(sizeof(RSA_METHOD));
if (meth != NULL) {
meth->name = OPENSSL_strdup(name);
meth->flags = flags;
}
return meth;
}
开发者ID:277800076,项目名称:openssl,代码行数:11,代码来源:rsa_meth.c
示例15: SSL_SESSION_set1_hostname
int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname)
{
OPENSSL_free(s->ext.hostname);
if (hostname == NULL) {
s->ext.hostname = NULL;
return 1;
}
s->ext.hostname = OPENSSL_strdup(hostname);
return s->ext.hostname != NULL;
}
开发者ID:dgalaxy,项目名称:openssl,代码行数:11,代码来源:ssl_sess.c
示例16: OPENSSL_zalloc
DH_METHOD *DH_meth_new(const char *name, int flags)
{
DH_METHOD *dhm = OPENSSL_zalloc(sizeof(DH_METHOD));
if (dhm != NULL) {
dhm->name = OPENSSL_strdup(name);
dhm->flags = flags;
}
return dhm;
}
开发者ID:277800076,项目名称:openssl,代码行数:11,代码来源:dh_meth.c
示例17: OPENSSL_malloc
static RSA_METHOD *RSA_meth_new(const char *name, int flags)
{
RSA_METHOD *meth = OPENSSL_malloc(sizeof(RSA_METHOD));
if (meth == NULL)
return NULL;
memcpy(meth, RSA_get_default_method(), sizeof(RSA_METHOD));
meth->name = OPENSSL_strdup(name);
meth->flags = flags;
return meth;
}
开发者ID:nmav,项目名称:libp11,代码行数:11,代码来源:p11_rsa.c
示例18: ossl_provider_add_parameter
int ossl_provider_add_parameter(OSSL_PROVIDER *prov,
const char *name, const char *value)
{
INFOPAIR *pair = NULL;
if ((pair = OPENSSL_zalloc(sizeof(*pair))) != NULL
&& (prov->parameters != NULL
|| (prov->parameters = sk_INFOPAIR_new_null()) != NULL)
&& (pair->name = OPENSSL_strdup(name)) != NULL
&& (pair->value = OPENSSL_strdup(value)) != NULL
&& sk_INFOPAIR_push(prov->parameters, pair) > 0)
return 1;
if (pair != NULL) {
OPENSSL_free(pair->name);
OPENSSL_free(pair->value);
OPENSSL_free(pair);
}
CRYPTOerr(CRYPTO_F_OSSL_PROVIDER_ADD_PARAMETER, ERR_R_MALLOC_FAILURE);
return 0;
}
开发者ID:Ana06,项目名称:openssl,代码行数:21,代码来源:provider_core.c
示例19: test_good_configuration
static int test_good_configuration()
{
SETUP_SSL_TEST_CTX_TEST_FIXTURE();
fixture.test_section = "ssltest_good";
fixture.expected_ctx->method = SSL_TEST_METHOD_DTLS;
fixture.expected_ctx->handshake_mode = SSL_TEST_HANDSHAKE_RESUME;
fixture.expected_ctx->app_data_size = 1024;
fixture.expected_ctx->max_fragment_size = 2048;
fixture.expected_ctx->expected_result = SSL_TEST_SERVER_FAIL;
fixture.expected_ctx->expected_client_alert = SSL_AD_UNKNOWN_CA;
fixture.expected_ctx->expected_server_alert = 0; /* No alert. */
fixture.expected_ctx->expected_protocol = TLS1_1_VERSION;
fixture.expected_ctx->expected_servername = SSL_TEST_SERVERNAME_SERVER2;
fixture.expected_ctx->session_ticket_expected = SSL_TEST_SESSION_TICKET_YES;
fixture.expected_ctx->compression_expected = SSL_TEST_COMPRESSION_NO;
fixture.expected_ctx->resumption_expected = 1;
fixture.expected_ctx->extra.client.verify_callback =
SSL_TEST_VERIFY_REJECT_ALL;
fixture.expected_ctx->extra.client.servername = SSL_TEST_SERVERNAME_SERVER2;
fixture.expected_ctx->extra.client.npn_protocols =
OPENSSL_strdup("foo,bar");
TEST_check(fixture.expected_ctx->extra.client.npn_protocols != NULL);
fixture.expected_ctx->extra.server.servername_callback =
SSL_TEST_SERVERNAME_IGNORE_MISMATCH;
fixture.expected_ctx->extra.server.broken_session_ticket = 1;
fixture.expected_ctx->resume_extra.server2.alpn_protocols =
OPENSSL_strdup("baz");
TEST_check(
fixture.expected_ctx->resume_extra.server2.alpn_protocols != NULL);
fixture.expected_ctx->resume_extra.client.ct_validation =
SSL_TEST_CT_VALIDATION_STRICT;
EXECUTE_SSL_TEST_CTX_TEST();
}
开发者ID:dgervais,项目名称:openssl,代码行数:39,代码来源:ssl_test_ctx_test.c
示例20: OPENSSL_malloc
RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth)
{
RSA_METHOD *ret;
ret = OPENSSL_malloc(sizeof(RSA_METHOD));
if (ret != NULL) {
memcpy(ret, meth, sizeof(*meth));
ret->name = OPENSSL_strdup(meth->name);
}
return ret;
}
开发者ID:277800076,项目名称:openssl,代码行数:13,代码来源:rsa_meth.c
注:本文中的OPENSSL_strdup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论