当前位置: 首页>>代码示例>>C++>>正文


C++ M_ASN1_INTEGER_free函数代码示例

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


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

示例1: M_ASN1_D2I_vars

RSA *d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length)
	{
	int i=ASN1_R_PARSING;
	ASN1_INTEGER *bs=NULL;
	M_ASN1_D2I_vars(a,RSA *,RSA_new);

	M_ASN1_D2I_Init();
	M_ASN1_D2I_start_sequence();
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn;

	M_ASN1_INTEGER_free(bs);
	bs=NULL;

	M_ASN1_D2I_Finish_2(a);

err_bn:
	i=ERR_R_BN_LIB;
err:
	ASN1err(ASN1_F_D2I_RSAPUBLICKEY,i);
	if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret);
	if (bs != NULL) M_ASN1_INTEGER_free(bs);
	return(NULL);
	}
开发者ID:houzhenggang,项目名称:mt7688_mips_ecos,代码行数:26,代码来源:d2i_r_pu.c

示例2: PBKDF2PARAM_free

void PBKDF2PARAM_free (PBKDF2PARAM *a)
{
	if(a==NULL) return;
	ASN1_TYPE_free(a->salt);
	M_ASN1_INTEGER_free(a->iter);
	M_ASN1_INTEGER_free(a->keylength);
	X509_ALGOR_free(a->prf);
	OPENSSL_free (a);
}
开发者ID:jhbsz,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:9,代码来源:p5_pbev2.c

示例3: d2i_ASN1_UINTEGER

ASN1_INTEGER *
d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, long length)
{
	ASN1_INTEGER *ret = NULL;
	const unsigned char *p;
	unsigned char *s;
	long len;
	int inf, tag, xclass;
	int i;

	if ((a == NULL) || ((*a) == NULL)) {
		if ((ret = M_ASN1_INTEGER_new()) == NULL)
			return (NULL);
		ret->type = V_ASN1_INTEGER;
	} else
		ret = (*a);

	p = *pp;
	inf = ASN1_get_object(&p, &len, &tag, &xclass, length);
	if (inf & 0x80) {
		i = ASN1_R_BAD_OBJECT_HEADER;
		goto err;
	}

	if (tag != V_ASN1_INTEGER) {
		i = ASN1_R_EXPECTING_AN_INTEGER;
		goto err;
	}

	/* We must malloc stuff, even for 0 bytes otherwise it
	 * signifies a missing NULL parameter. */
	s = malloc((int)len + 1);
	if (s == NULL) {
		i = ERR_R_MALLOC_FAILURE;
		goto err;
	}
	ret->type = V_ASN1_INTEGER;
	if (len) {
		if ((*p == 0) && (len != 1)) {
			p++;
			len--;
		}
		memcpy(s, p, len);
		p += len;
	}

	free(ret->data);
	ret->data = s;
	ret->length = (int)len;
	if (a != NULL)
		(*a) = ret;
	*pp = p;
	return (ret);

err:
	ASN1err(ASN1_F_D2I_ASN1_UINTEGER, i);
	if (a == NULL || *a != ret)
		M_ASN1_INTEGER_free(ret);
	return (NULL);
}
开发者ID:Heratom,项目名称:Firefly-project,代码行数:60,代码来源:a_int.c

示例4: PKCS7_ENCRYPT_free

void PKCS7_ENCRYPT_free(PKCS7_ENCRYPT *a)
{
    if (a == NULL) return;
    M_ASN1_INTEGER_free(a->version);
    PKCS7_ENC_CONTENT_free(a->enc_data);
    OPENSSL_free(a);
}
开发者ID:houzhenggang,项目名称:mt7688_mips_ecos,代码行数:7,代码来源:p7_enc.c

示例5: 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);
	}
开发者ID:houzhenggang,项目名称:mt7688_mips_ecos,代码行数:8,代码来源:n_pkey.c

示例6: 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);
}
开发者ID:ahenroid,项目名称:ptptl-0.2,代码行数:8,代码来源:p12_mac.c

示例7: M_ASN1_D2I_vars

RSA *d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length)
	{
	int i=ASN1_R_PARSING;
	ASN1_INTEGER *bs=NULL;
	M_ASN1_D2I_vars(a,RSA *,RSA_new);

	M_ASN1_D2I_Init();
	M_ASN1_D2I_start_sequence();
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if (bs->length == 0)
		ret->version=0;
	else	ret->version=bs->data[0];
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->d=BN_bin2bn(bs->data,bs->length,ret->d)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->dmp1=BN_bin2bn(bs->data,bs->length,ret->dmp1)) == NULL)
		goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->dmq1=BN_bin2bn(bs->data,bs->length,ret->dmq1)) == NULL)
		goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->iqmp=BN_bin2bn(bs->data,bs->length,ret->iqmp)) == NULL)
		goto err_bn;

	M_ASN1_INTEGER_free(bs);

	M_ASN1_D2I_Finish_2(a);
err_bn:
	i=ERR_R_BN_LIB;
err:
	ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,i);
	if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret);
	if (bs != NULL) M_ASN1_INTEGER_free(bs);

	return(NULL);
	}
开发者ID:ahenroid,项目名称:ptptl-0.2,代码行数:44,代码来源:d2i_r_pr.c

示例8: 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);
}
开发者ID:DiamondLovesYou,项目名称:libressl-pnacl-sys,代码行数:57,代码来源:evp_asn1.c

示例9: PKCS8_PRIV_KEY_INFO_free

void PKCS8_PRIV_KEY_INFO_free (PKCS8_PRIV_KEY_INFO *a)
{
	if (a == NULL) return;
	M_ASN1_INTEGER_free (a->version);
	X509_ALGOR_free(a->pkeyalg);
	/* Clear sensitive data */
	if (a->pkey->value.octet_string)
		OPENSSL_cleanse(a->pkey->value.octet_string->data,
				a->pkey->value.octet_string->length);
	ASN1_TYPE_free (a->pkey);
	sk_X509_ATTRIBUTE_pop_free (a->attributes, X509_ATTRIBUTE_free);
	OPENSSL_free (a);
}
开发者ID:aosm,项目名称:OpenSSL096,代码行数:13,代码来源:p8_pkey.c

示例10: PKCS7_RECIP_INFO_set

int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509)
	{
	int ret;
	EVP_PKEY *pkey = NULL;
	if (!ASN1_INTEGER_set(p7i->version,0))
		return 0;
	if (!X509_NAME_set(&p7i->issuer_and_serial->issuer,
		X509_get_issuer_name(x509)))
		return 0;

	M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial);
	if (!(p7i->issuer_and_serial->serial=
		M_ASN1_INTEGER_dup(X509_get_serialNumber(x509))))
		return 0;

	pkey = X509_get_pubkey(x509);

	if (!pkey || !pkey->ameth || !pkey->ameth->pkey_ctrl)
		{
		PKCS7err(PKCS7_F_PKCS7_RECIP_INFO_SET,
			PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
		goto err;
		}

	ret = pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_PKCS7_ENCRYPT,
						0, p7i);
	if (ret == -2)
		{
		PKCS7err(PKCS7_F_PKCS7_RECIP_INFO_SET,
			PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
		goto err;
		}
	if (ret <= 0)
		{
		PKCS7err(PKCS7_F_PKCS7_RECIP_INFO_SET,
				PKCS7_R_ENCRYPTION_CTRL_FAILURE);
		goto err;
		}

	EVP_PKEY_free(pkey);

	CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509);
	p7i->cert=x509;

	return 1;

	err:
	if (pkey)
		EVP_PKEY_free(pkey);
	return 0;
	}
开发者ID:OpenKod,项目名称:src,代码行数:51,代码来源:pk7_lib.c

示例11: 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);
	}
开发者ID:ahenroid,项目名称:ptptl-0.2,代码行数:14,代码来源:p7_signi.c

示例12: X509_set_version

int X509_set_version(X509 *x, long version)
{
    if (x == NULL)
        return (0);
    if (version == 0) {
        M_ASN1_INTEGER_free(x->cert_info->version);
        x->cert_info->version = NULL;
        return (1);
    }
    if (x->cert_info->version == NULL) {
        if ((x->cert_info->version = M_ASN1_INTEGER_new()) == NULL)
            return (0);
    }
    return (ASN1_INTEGER_set(x->cert_info->version, version));
}
开发者ID:03050903,项目名称:godot,代码行数:15,代码来源:x509_set.c

示例13: X509_REVOKED_set_serialNumber

int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial)
{
	ASN1_INTEGER *in;

	if (x == NULL) return(0);
	in=x->serialNumber;
	if (in != serial) {
		in=M_ASN1_INTEGER_dup(serial);
		if (in != NULL) {
			M_ASN1_INTEGER_free(x->serialNumber);
			x->serialNumber=in;
		}
	}
	return(in != NULL);
}
开发者ID:hotelzululima,项目名称:libopenssl,代码行数:15,代码来源:x509cset.c

示例14: PKCS7_SIGNER_INFO_set

int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
	     EVP_MD *dgst)
	{
	char is_dsa;
	if (pkey->type == EVP_PKEY_DSA) is_dsa = 1;
	else is_dsa = 0;
	/* We now need to add another PKCS7_SIGNER_INFO entry */
	ASN1_INTEGER_set(p7i->version,1);
	X509_NAME_set(&p7i->issuer_and_serial->issuer,
		X509_get_issuer_name(x509));

	/* because ASN1_INTEGER_set is used to set a 'long' we will do
	 * things the ugly way. */
	M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial);
	p7i->issuer_and_serial->serial=
		M_ASN1_INTEGER_dup(X509_get_serialNumber(x509));

	/* lets keep the pkey around for a while */
	CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
	p7i->pkey=pkey;

	/* Set the algorithms */
	if (is_dsa) p7i->digest_alg->algorithm=OBJ_nid2obj(NID_sha1);
	else	
		p7i->digest_alg->algorithm=OBJ_nid2obj(EVP_MD_type(dgst));

	if (p7i->digest_alg->parameter != NULL)
		ASN1_TYPE_free(p7i->digest_alg->parameter);
	if ((p7i->digest_alg->parameter=ASN1_TYPE_new()) == NULL)
		goto err;
	p7i->digest_alg->parameter->type=V_ASN1_NULL;

	p7i->digest_enc_alg->algorithm=OBJ_nid2obj(EVP_PKEY_type(pkey->type));

	if (p7i->digest_enc_alg->parameter != NULL)
		ASN1_TYPE_free(p7i->digest_enc_alg->parameter);
	if(is_dsa) p7i->digest_enc_alg->parameter = NULL;
	else {
		if (!(p7i->digest_enc_alg->parameter=ASN1_TYPE_new()))
			goto err;
		p7i->digest_enc_alg->parameter->type=V_ASN1_NULL;
	}

	return(1);
err:
	return(0);
	}
开发者ID:jhbsz,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:47,代码来源:pk7_lib.c

示例15: PKCS7_SIGNER_INFO_set

int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
	     const EVP_MD *dgst)
	{
	int ret;

	/* We now need to add another PKCS7_SIGNER_INFO entry */
	if (!ASN1_INTEGER_set(p7i->version,1))
		goto err;
	if (!X509_NAME_set(&p7i->issuer_and_serial->issuer,
			X509_get_issuer_name(x509)))
		goto err;

	/* because ASN1_INTEGER_set is used to set a 'long' we will do
	 * things the ugly way. */
	M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial);
	if (!(p7i->issuer_and_serial->serial=
			M_ASN1_INTEGER_dup(X509_get_serialNumber(x509))))
		goto err;

	/* lets keep the pkey around for a while */
	CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
	p7i->pkey=pkey;

	/* Set the algorithms */

	X509_ALGOR_set0(p7i->digest_alg, OBJ_nid2obj(EVP_MD_type(dgst)),
				V_ASN1_NULL, NULL);

	if (pkey->ameth && pkey->ameth->pkey_ctrl)
		{
		ret = pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_PKCS7_SIGN,
						0, p7i);
		if (ret > 0)
			return 1;
		if (ret != -2)
			{
			PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SET,
					PKCS7_R_SIGNING_CTRL_FAILURE);
			return 0;
			}
		}
	PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SET,
			PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
err:
	return 0;
	}
开发者ID:OpenKod,项目名称:src,代码行数:46,代码来源:pk7_lib.c


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