Fix from HEAD.
authorDr. Stephen Henson <steve@openssl.org>
Fri, 11 Apr 2008 17:34:42 +0000 (17:34 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 11 Apr 2008 17:34:42 +0000 (17:34 +0000)
apps/cms.c
crypto/cms/cms.h
crypto/cms/cms_smime.c

index aa02708d65ebf646a2eab0fd61e72c46a560f7b2..70bf45f3f4602e88f10c69b2c45bd7c58dcbc524 100644 (file)
@@ -890,7 +890,7 @@ int MAIN(int argc, char **argv)
                        }
                if (!(flags & CMS_STREAM))
                        {
-                       if (!CMS_final(cms, in, flags))
+                       if (!CMS_final(cms, in, NULL, flags))
                                goto end;
                        }
                }
@@ -977,7 +977,7 @@ int MAIN(int argc, char **argv)
                /* If not streaming or resigning finalize structure */
                if ((operation == SMIME_SIGN) && !(flags & CMS_STREAM))
                        {
-                       if (!CMS_final(cms, in, flags))
+                       if (!CMS_final(cms, in, NULL, flags))
                                goto end;
                        }
                }
@@ -1027,7 +1027,7 @@ int MAIN(int argc, char **argv)
                }
        else if (operation == SMIME_UNCOMPRESS)
                {
-               if (!CMS_uncompress(cms, indata, out, flags))
+               if (!CMS_uncompress(cms, out, indata, flags))
                        goto end;
                }
        else if (operation == SMIME_DIGEST_VERIFY)
index 0494170af87a4c2635cb961a2988d4ef04b0df26..0323de717ff8684f8c5447665024bf11ae5e3e07 100644 (file)
@@ -130,7 +130,7 @@ int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
 CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
 int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
 
-int CMS_final(CMS_ContentInfo *cms, BIO *data, int flags);
+int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags);
 
 CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
                                                BIO *data, unsigned int flags);
@@ -216,7 +216,7 @@ int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
 
 int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
        
-int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
+int CMS_uncompress(CMS_ContentInfo *cms, BIO *out, BIO *dcont,
                                                        unsigned int flags);
 CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
 
index 06dd8995ec1d952cca2cd84c8ccb5abdad65fdee..a529feb30eec3b90a9d58f42986040cbf7cdcee0 100644 (file)
@@ -149,7 +149,7 @@ CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags)
        if (!cms)
                return NULL;
 
-       if (CMS_final(cms, in, flags))
+       if (CMS_final(cms, in, NULL, flags))
                return cms;
 
        CMS_ContentInfo_free(cms);
@@ -197,7 +197,7 @@ CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
                CMS_set_detached(cms, 0);
                }
 
-       if ((flags & CMS_STREAM) || CMS_final(cms, in, flags))
+       if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags))
                return cms;
 
        CMS_ContentInfo_free(cms);
@@ -252,7 +252,8 @@ CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
                CMS_set_detached(cms, 0);
                }
 
-       if ((flags & (CMS_STREAM|CMS_PARTIAL)) || CMS_final(cms, in, flags))
+       if ((flags & (CMS_STREAM|CMS_PARTIAL))
+               || CMS_final(cms, in, NULL, flags))
                return cms;
 
        CMS_ContentInfo_free(cms);
@@ -467,7 +468,8 @@ CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
                CMS_set_detached(cms, 0);
                }
 
-       if ((flags & (CMS_STREAM|CMS_PARTIAL)) || CMS_final(cms, data, flags))
+       if ((flags & (CMS_STREAM|CMS_PARTIAL))
+               || CMS_final(cms, data, NULL, flags))
                return cms;
        else
                goto err;
@@ -534,7 +536,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
                goto err;
 
        /* Finalize structure */
-       if (!CMS_final(cms, rct_cont, flags))
+       if (!CMS_final(cms, rct_cont, NULL, flags))
                goto err;
 
        /* Set embedded content */
@@ -578,7 +580,8 @@ CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *data,
                CMS_set_detached(cms, 0);
                }
 
-       if ((flags & (CMS_STREAM|CMS_PARTIAL)) || CMS_final(cms, data, flags))
+       if ((flags & (CMS_STREAM|CMS_PARTIAL))
+               || CMS_final(cms, data, NULL, flags))
                return cms;
        else
                goto err;
@@ -690,11 +693,11 @@ int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert,
        return r;
        }
 
-int CMS_final(CMS_ContentInfo *cms, BIO *data, int flags)
+int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags)
        {
        BIO *cmsbio;
        int ret = 0;
-       if (!(cmsbio = CMS_dataInit(cms, NULL)))
+       if (!(cmsbio = CMS_dataInit(cms, dcont)))
                {
                CMSerr(CMS_F_CMS_FINAL,ERR_R_MALLOC_FAILURE);
                return 0;
@@ -722,7 +725,7 @@ int CMS_final(CMS_ContentInfo *cms, BIO *data, int flags)
 
 #ifdef ZLIB
 
-int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
+int CMS_uncompress(CMS_ContentInfo *cms, BIO *out, BIO *dcont,
                                                        unsigned int flags)
        {
        BIO *cont;
@@ -760,7 +763,7 @@ CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags)
                CMS_set_detached(cms, 0);
                }
 
-       if (CMS_final(cms, in, flags))
+       if (CMS_final(cms, in, NULL, flags))
                return cms;
 
        CMS_ContentInfo_free(cms);