summaryrefslogtreecommitdiffstats
path: root/crypto/cms
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2008-03-18 13:45:43 +0000
committerDr. Stephen Henson <steve@openssl.org>2008-03-18 13:45:43 +0000
commite4f0e40eac4ee00d8447741c76c9862a36b0e734 (patch)
treea4f0e588c3177e3ce7e3eb420867c5deeb47cd60 /crypto/cms
parent6e3bc4f0730a3cb7d2d263153cb234da51637b38 (diff)
Various tidies/fixes:
Make streaming support in cms cleaner. Note errors in various S/MIME functions if CMS_final() fails. Add streaming support for enveloped data.
Diffstat (limited to 'crypto/cms')
-rw-r--r--crypto/cms/cms_io.c14
-rw-r--r--crypto/cms/cms_lib.c1
-rw-r--r--crypto/cms/cms_smime.c9
3 files changed, 6 insertions, 18 deletions
diff --git a/crypto/cms/cms_io.c b/crypto/cms/cms_io.c
index 1bb60b8dcb..051757b560 100644
--- a/crypto/cms/cms_io.c
+++ b/crypto/cms/cms_io.c
@@ -89,20 +89,6 @@ int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms)
IMPLEMENT_PEM_rw_const(CMS, CMS_ContentInfo, PEM_STRING_CMS, CMS_ContentInfo)
-#if 0
-/* Streaming encode support for CMS */
-
-static BIO *cmsbio_init(ASN1_VALUE *val, BIO *out)
- {
- return CMS_dataInit((CMS_ContentInfo *)val, out);
- }
-
-static int cmsbio_final(ASN1_VALUE *val, BIO *cmsbio)
- {
- return CMS_dataFinal((CMS_ContentInfo *)val, cmsbio);
- }
-#endif
-
BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms)
{
return BIO_new_NDEF(out, (ASN1_VALUE *)cms,
diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c
index a8cefd06b7..8c3854dfc9 100644
--- a/crypto/cms/cms_lib.c
+++ b/crypto/cms/cms_lib.c
@@ -184,6 +184,7 @@ int CMS_dataFinal(CMS_ContentInfo *cms, BIO *cmsbio)
{
case NID_pkcs7_data:
+ case NID_pkcs7_enveloped:
case NID_pkcs7_encrypted:
case NID_id_smime_ct_compressedData:
/* Nothing to do */
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c
index dcc0e6ba10..c9be5a03e5 100644
--- a/crypto/cms/cms_smime.c
+++ b/crypto/cms/cms_smime.c
@@ -447,8 +447,8 @@ CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
if ((flags & (CMS_STREAM|CMS_PARTIAL)) || CMS_final(cms, data, flags))
return cms;
-
- return cms;
+ else
+ goto err;
merr:
CMSerr(CMS_F_CMS_SIGN, ERR_R_MALLOC_FAILURE);
@@ -483,8 +483,8 @@ CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *data,
if ((flags & (CMS_STREAM|CMS_PARTIAL)) || CMS_final(cms, data, flags))
return cms;
-
- return cms;
+ else
+ goto err;
merr:
CMSerr(CMS_F_CMS_ENCRYPT, ERR_R_MALLOC_FAILURE);
@@ -530,6 +530,7 @@ int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert,
break;
if (cert)
return 0;
+ ERR_clear_error();
}
}