Fix PKCS7_ENC_CONTENT_new() to include a sensible default content type and add
[openssl.git] / crypto / asn1 / p7_enc_c.c
index ce8f9c155947e34062fd7edb6a0b098e05942aa0..d8dcb112462e1624fbe8378a767c996428cdb658 100644 (file)
 #include <openssl/asn1_mac.h>
 #include <openssl/x509.h>
 
-/*
- * 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(PKCS7_ENC_CONTENT *a, unsigned char **pp)
        {
        M_ASN1_I2D_vars(a);
@@ -106,7 +101,8 @@ PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new(void)
 
        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);