summaryrefslogtreecommitdiffstats
path: root/crypto/cms
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2008-04-10 11:22:14 +0000
committerDr. Stephen Henson <steve@openssl.org>2008-04-10 11:22:14 +0000
commite0fbd0730995c8594ddf7408695f3a77263b64cd (patch)
treeab005905f1b582b416963c3b5ffeb8cf3f1ff590 /crypto/cms
parenteaee098e1f3204cdb9f44eee6c0a0f898f26049e (diff)
Add additional parameter to CMS_final() to handle detached content.
Diffstat (limited to 'crypto/cms')
-rw-r--r--crypto/cms/cms.h2
-rw-r--r--crypto/cms/cms_smime.c19
2 files changed, 12 insertions, 9 deletions
diff --git a/crypto/cms/cms.h b/crypto/cms/cms.h
index db40f19581..9b32231d70 100644
--- a/crypto/cms/cms.h
+++ b/crypto/cms/cms.h
@@ -135,7 +135,7 @@ int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags)
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);
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c
index b18c789f64..a9a11f5fdb 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 ((flags & CMS_STREAM) || CMS_final(cms, in, flags))
+ if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags))
return cms;
CMS_ContentInfo_free(cms);
@@ -194,7 +194,7 @@ CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
if(!(flags & CMS_DETACHED))
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);
@@ -246,7 +246,8 @@ CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
if(!(flags & CMS_DETACHED))
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);
@@ -459,7 +460,8 @@ CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
if(!(flags & CMS_DETACHED))
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;
@@ -526,7 +528,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 */
@@ -567,7 +569,8 @@ CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *data,
if(!(flags & CMS_DETACHED))
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;
@@ -679,11 +682,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;