本文整理汇总了C++中M_ASN1_OCTET_STRING_free函数的典型用法代码示例。如果您正苦于以下问题:C++ M_ASN1_OCTET_STRING_free函数的具体用法?C++ M_ASN1_OCTET_STRING_free怎么用?C++ M_ASN1_OCTET_STRING_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了M_ASN1_OCTET_STRING_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: X509_EXTENSION_free
void X509_EXTENSION_free(X509_EXTENSION *a)
{
if (a == NULL) return;
ASN1_OBJECT_free(a->object);
M_ASN1_OCTET_STRING_free(a->value);
OPENSSL_free(a);
}
示例2: X509_SIG_free
void X509_SIG_free(X509_SIG *a)
{
if (a == NULL) return;
X509_ALGOR_free(a->algor);
M_ASN1_OCTET_STRING_free(a->digest);
OPENSSL_free(a);
}
示例3: X509_SIG_new
X509_SIG *PKCS8_encrypt_pbe(int pbe_nid,
const uint8_t *pass_raw, size_t pass_raw_len,
uint8_t *salt, size_t salt_len,
int iterations, PKCS8_PRIV_KEY_INFO *p8inf) {
X509_SIG *pkcs8 = NULL;
X509_ALGOR *pbe;
pkcs8 = X509_SIG_new();
if (pkcs8 == NULL) {
OPENSSL_PUT_ERROR(PKCS8, PKCS8_encrypt_pbe, ERR_R_MALLOC_FAILURE);
goto err;
}
pbe = PKCS5_pbe_set(pbe_nid, iterations, salt, salt_len);
if (!pbe) {
OPENSSL_PUT_ERROR(PKCS8, PKCS8_encrypt_pbe, ERR_R_ASN1_LIB);
goto err;
}
X509_ALGOR_free(pkcs8->algor);
pkcs8->algor = pbe;
M_ASN1_OCTET_STRING_free(pkcs8->digest);
pkcs8->digest = pkcs12_item_i2d_encrypt(
pbe, ASN1_ITEM_rptr(PKCS8_PRIV_KEY_INFO), pass_raw, pass_raw_len, p8inf);
if (!pkcs8->digest) {
OPENSSL_PUT_ERROR(PKCS8, PKCS8_encrypt_pbe, PKCS8_R_ENCRYPT_ERROR);
goto err;
}
return pkcs8;
err:
X509_SIG_free(pkcs8);
return NULL;
}
示例4: GENERAL_NAME_free
void GENERAL_NAME_free(GENERAL_NAME *a)
{
if (a == NULL) return;
switch(a->type) {
case GEN_X400:
case GEN_EDIPARTY:
ASN1_TYPE_free(a->d.other);
break;
case GEN_OTHERNAME:
OTHERNAME_free(a->d.otherName);
break;
case GEN_EMAIL:
case GEN_DNS:
case GEN_URI:
M_ASN1_IA5STRING_free(a->d.ia5);
break;
case GEN_DIRNAME:
X509_NAME_free(a->d.dirn);
break;
case GEN_IPADD:
M_ASN1_OCTET_STRING_free(a->d.ip);
break;
case GEN_RID:
ASN1_OBJECT_free(a->d.rid);
break;
}
OPENSSL_free (a);
}
示例5: X509_EXTENSION_create_by_NID
static X509_EXTENSION *do_ext_i2d(X509V3_EXT_METHOD *method, int ext_nid,
int crit, void *ext_struc)
{
unsigned char *ext_der, *p;
int ext_len;
ASN1_OCTET_STRING *ext_oct;
X509_EXTENSION *ext;
/* Convert internal representation to DER */
ext_len = method->i2d(ext_struc, NULL);
if(!(ext_der = OPENSSL_malloc(ext_len))) goto merr;
p = ext_der;
method->i2d(ext_struc, &p);
if(!(ext_oct = M_ASN1_OCTET_STRING_new())) goto merr;
ext_oct->data = ext_der;
ext_oct->length = ext_len;
ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct);
if(!ext) goto merr;
M_ASN1_OCTET_STRING_free(ext_oct);
return ext;
merr:
X509V3err(X509V3_F_DO_EXT_I2D,ERR_R_MALLOC_FAILURE);
return NULL;
}
示例6: PKCS12err
X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
const char *pass, int passlen,
unsigned char *salt, int saltlen, int iter,
PKCS8_PRIV_KEY_INFO *p8inf)
{
X509_SIG *p8 = NULL;
X509_ALGOR *pbe;
if (!(p8 = X509_SIG_new())) {
PKCS12err(PKCS12_F_PKCS8_ENCRYPT, ERR_R_MALLOC_FAILURE);
goto err;
}
if(pbe_nid == -1) pbe = PKCS5_pbe2_set(cipher, iter, salt, saltlen);
else pbe = PKCS5_pbe_set(pbe_nid, iter, salt, saltlen);
if(!pbe) {
PKCS12err(PKCS12_F_PKCS8_ENCRYPT, ERR_R_ASN1_LIB);
goto err;
}
X509_ALGOR_free(p8->algor);
p8->algor = pbe;
M_ASN1_OCTET_STRING_free(p8->digest);
p8->digest = PKCS12_item_i2d_encrypt(pbe, ASN1_ITEM_rptr(PKCS8_PRIV_KEY_INFO),
pass, passlen, p8inf, 1);
if(!p8->digest) {
PKCS12err(PKCS12_F_PKCS8_ENCRYPT, PKCS12_R_ENCRYPT_ERROR);
goto err;
}
return p8;
err:
X509_SIG_free(p8);
return NULL;
}
示例7: d2i_ocsp_nonce
static void *
d2i_ocsp_nonce(void *a, const unsigned char **pp, long length)
{
ASN1_OCTET_STRING *os, **pos;
pos = a;
if (!pos || !*pos)
os = ASN1_OCTET_STRING_new();
else
os = *pos;
if (!ASN1_OCTET_STRING_set(os, *pp, length))
goto err;
*pp += length;
if (pos)
*pos = os;
return os;
err:
if (os && (!pos || (*pos != os)))
M_ASN1_OCTET_STRING_free(os);
OCSPerr(OCSP_F_D2I_OCSP_NONCE, ERR_R_MALLOC_FAILURE);
return NULL;
}
示例8: PROXYPOLICY_free
/**
* @ingroup proxypolicy
*
* Frees a PROXYPOLICY
*
* @param policy the proxy policy to free
*/
void PROXYPOLICY_free(
PROXYPOLICY * policy)
{
if(policy == NULL) return;
ASN1_OBJECT_free(policy->policy_language);
M_ASN1_OCTET_STRING_free(policy->policy);
OPENSSL_free(policy);
}
示例9: PKCS12_MAC_DATA_free
void PKCS12_MAC_DATA_free (PKCS12_MAC_DATA *a)
{
if (a == NULL) return;
X509_SIG_free (a->dinfo);
M_ASN1_OCTET_STRING_free(a->salt);
M_ASN1_INTEGER_free(a->iter);
OPENSSL_free (a);
}
示例10: ASN1_HEADER_free
void ASN1_HEADER_free(ASN1_HEADER *a)
{
if (a == NULL) return;
M_ASN1_OCTET_STRING_free(a->header);
if (a->meth != NULL)
a->meth->destroy(a->data);
OPENSSL_free(a);
}
示例11: NETSCAPE_PKEY_free
static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *a)
{
if (a == NULL) return;
M_ASN1_INTEGER_free(a->version);
X509_ALGOR_free(a->algor);
M_ASN1_OCTET_STRING_free(a->private_key);
OPENSSL_free(a);
}
示例12: ASN1_TYPE_get_int_octetstring
/* int max_len: for returned value */
int
ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
int max_len)
{
int ret = -1, n;
ASN1_INTEGER *ai = NULL;
ASN1_OCTET_STRING *os = NULL;
const unsigned char *p;
long length;
ASN1_const_CTX c;
if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL)) {
goto err;
}
p = M_ASN1_STRING_data(a->value.sequence);
length = M_ASN1_STRING_length(a->value.sequence);
c.pp = &p;
c.p = p;
c.max = p + length;
c.error = ASN1_R_DATA_IS_WRONG;
M_ASN1_D2I_start_sequence();
c.q = c.p;
if ((ai = d2i_ASN1_INTEGER(NULL, &c.p, c.slen)) == NULL)
goto err;
c.slen -= (c.p - c.q);
c.q = c.p;
if ((os = d2i_ASN1_OCTET_STRING(NULL, &c.p, c.slen)) == NULL)
goto err;
c.slen -= (c.p - c.q);
if (!M_ASN1_D2I_end_sequence())
goto err;
if (num != NULL)
*num = ASN1_INTEGER_get(ai);
ret = M_ASN1_STRING_length(os);
if (max_len > ret)
n = ret;
else
n = max_len;
if (data != NULL)
memcpy(data, M_ASN1_STRING_data(os), n);
if (0) {
err:
ASN1err(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,
ASN1_R_DATA_IS_WRONG);
}
if (os != NULL)
M_ASN1_OCTET_STRING_free(os);
if (ai != NULL)
M_ASN1_INTEGER_free(ai);
return (ret);
}
示例13: X509_PKEY_free
void X509_PKEY_free(X509_PKEY *x)
{
if (x == NULL) return;
if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor);
if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey);
if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey);
if ((x->key_data != NULL) && (x->key_free)) OPENSSL_free(x->key_data);
OPENSSL_free(x);
}
示例14: ASN1_TYPE_set_octetstring
static int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
{
ASN1_STRING *os;
if ((os=M_ASN1_OCTET_STRING_new()) == NULL) return(0);
if (!M_ASN1_OCTET_STRING_set(os,data,len))
{
M_ASN1_OCTET_STRING_free(os);
return 0;
}
ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,os);
return(1);
}
示例15: PKCS7_SIGNER_INFO_free
void PKCS7_SIGNER_INFO_free(PKCS7_SIGNER_INFO *a)
{
if (a == NULL) return;
M_ASN1_INTEGER_free(a->version);
PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial);
X509_ALGOR_free(a->digest_alg);
sk_X509_ATTRIBUTE_pop_free(a->auth_attr,X509_ATTRIBUTE_free);
X509_ALGOR_free(a->digest_enc_alg);
M_ASN1_OCTET_STRING_free(a->enc_digest);
sk_X509_ATTRIBUTE_pop_free(a->unauth_attr,X509_ATTRIBUTE_free);
if (a->pkey != NULL)
EVP_PKEY_free(a->pkey);
OPENSSL_free(a);
}