X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=crypto%2Fasn1%2Fp7_enc_c.c;h=582cc78b069dcdea568944694bfd5588439686ec;hb=3cf4f5d05eb90edcbe71f20fafd2721ebcf0c72e;hp=f98afb51b8d9c06db0dea22c85b346e65961918d;hpb=31b8d8684441e6cd5138832bb1b2ddb10acd6ba6;p=openssl.git diff --git a/crypto/asn1/p7_enc_c.c b/crypto/asn1/p7_enc_c.c index f98afb51b8..582cc78b06 100644 --- a/crypto/asn1/p7_enc_c.c +++ b/crypto/asn1/p7_enc_c.c @@ -58,17 +58,10 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include -/* - * ASN1err(ASN1_F_PKCS7_ENC_CONTENT_NEW,ERR_R_ASN1_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_PKCS7_ENC_CONTENT,ERR_R_ASN1_LENGTH_MISMATCH); - */ - -int i2d_PKCS7_ENC_CONTENT(a,pp) -PKCS7_ENC_CONTENT *a; -unsigned char **pp; +int i2d_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -85,10 +78,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(a,pp,length) -PKCS7_ENC_CONTENT **a; -unsigned char **pp; -long length; +PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT **a, + unsigned char **pp, long length) { M_ASN1_D2I_vars(a,PKCS7_ENC_CONTENT *,PKCS7_ENC_CONTENT_new); @@ -103,27 +94,27 @@ long length; ASN1_F_D2I_PKCS7_ENC_CONTENT); } -PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new() +PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new(void) { PKCS7_ENC_CONTENT *ret=NULL; ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7_ENC_CONTENT); /* M_ASN1_New(ret->content_type,ASN1_OBJECT_new); */ - ret->content_type=OBJ_nid2obj(NID_pkcs7_encrypted); + /* We will almost always want this: so make it the default */ + ret->content_type=OBJ_nid2obj(NID_pkcs7_data); M_ASN1_New(ret->algorithm,X509_ALGOR_new); ret->enc_data=NULL; return(ret); M_ASN1_New_Error(ASN1_F_PKCS7_ENC_CONTENT_NEW); } -void PKCS7_ENC_CONTENT_free(a) -PKCS7_ENC_CONTENT *a; +void PKCS7_ENC_CONTENT_free(PKCS7_ENC_CONTENT *a) { if (a == NULL) return; ASN1_OBJECT_free(a->content_type); X509_ALGOR_free(a->algorithm); - ASN1_OCTET_STRING_free(a->enc_data); - Free((char *)a); + M_ASN1_OCTET_STRING_free(a->enc_data); + Free(a); }