Seek out and destroy another evil cast.
[openssl.git] / crypto / asn1 / p7_enc_c.c
index 8914d874027394dd1df068045da844dea702e416..582cc78b069dcdea568944694bfd5588439686ec 100644 (file)
 
 #include <stdio.h>
 #include "cryptlib.h"
-#include "asn1_mac.h"
-#include "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);
- */
+#include <openssl/asn1_mac.h>
+#include <openssl/x509.h>
 
 int i2d_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT *a, unsigned char **pp)
        {
@@ -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);
@@ -118,7 +114,7 @@ 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);
        }