From 339654e1631f5e0707db0ad3cbad8b4db02cf4f9 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Fri, 11 Apr 2008 17:34:42 +0000 Subject: [PATCH] Fix from HEAD. --- apps/cms.c | 6 +++--- crypto/cms/cms.h | 4 ++-- crypto/cms/cms_smime.c | 23 +++++++++++++---------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/apps/cms.c b/apps/cms.c index aa02708d65..70bf45f3f4 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -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) diff --git a/crypto/cms/cms.h b/crypto/cms/cms.h index 0494170af8..0323de717f 100644 --- a/crypto/cms/cms.h +++ b/crypto/cms/cms.h @@ -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); diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c index 06dd8995ec..a529feb30e 100644 --- a/crypto/cms/cms_smime.c +++ b/crypto/cms/cms_smime.c @@ -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); -- 2.25.1