Add manual pages for certficate/key loading and friends.
[openssl.git] / crypto / asn1 / p7_enc_c.c
index 2860d3e9255b83644742115f310460a1abddac65..031178ab52c0f6c806669a541bf13547efd07dcd 100644 (file)
 
 #include <stdio.h>
 #include "cryptlib.h"
-#include "asn1_mac.h"
-#include "x509.h"
+#include <openssl/asn1_mac.h>
+#include <openssl/x509.h>
 
-/*
- * ASN1err(ASN1_F_PKCS7_ENC_CONTENT_NEW,ASN1_R_LENGTH_MISMATCH);
- * ASN1err(ASN1_F_D2I_PKCS7_ENC_CONTENT,ASN1_R_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,25 +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);
+       /* M_ASN1_New(ret->content_type,ASN1_OBJECT_new); */
+       /* 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);
+       OPENSSL_free(a);
        }