OpenSSL CVS Repository
http://cvs.openssl.org/
____________________________________________________________
________________
Server: cvs.openssl.org Name: Dr.
Stephen Henson
Root: /v/openssl/cvs Email: steve openssl.org
Module: openssl Date:
18-Mar-2008 14:45:44
Branch: HEAD Handle:
2008031813454300
Modified files:
openssl/apps cms.c
openssl/crypto/cms cms_io.c cms_lib.c cms_smime.c
Log:
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.
Summary:
Revision Changes Path
1.7 +5 -18 openssl/apps/cms.c
1.2 +0 -14 openssl/crypto/cms/cms_io.c
1.7 +1 -0 openssl/crypto/cms/cms_lib.c
1.9 +5 -4 openssl/crypto/cms/cms_smime.c
____________________________________________________________
________________
patch -p0 <<' .'
Index: openssl/apps/cms.c
============================================================
================
$ cvs diff -u -r1.6 -r1.7 cms.c
--- openssl/apps/cms.c 16 Mar 2008 20:59:09 -0000 1.6
+++ openssl/apps/cms.c 18 Mar 2008 13:45:43 -0000 1.7
 -116,7 +116,6 
char *passargin = NULL, *passin = NULL;
char *inrand = NULL;
int need_rand = 0;
- int indef = 0;
const EVP_MD *sign_md = NULL;
int informat = FORMAT_SMIME, outformat = FORMAT_SMIME;
int keyform = FORMAT_PEM;
 -232,11 +231,11 
else if (!strcmp (*args, "-no_attr_verify"))
flags |= CMS_NO_ATTR_VERIFY;
else if (!strcmp (*args, "-stream"))
- indef = 1;
+ flags |= CMS_STREAM;
else if (!strcmp (*args, "-indef"))
- indef = 1;
+ flags |= CMS_STREAM;
else if (!strcmp (*args, "-noindef"))
- indef = 0;
+ flags &= ~CMS_STREAM;
else if (!strcmp (*args, "-nooldmime"))
flags |= CMS_NOOLDMIMETYPE;
else if (!strcmp (*args, "-crlfeol"))
 -726,32 +725,22 
if (operation == SMIME_DATA_CREATE)
{
- if (indef)
- flags |= CMS_STREAM;
cms = CMS_data_create(in, flags);
}
else if (operation == SMIME_DIGEST_CREATE)
{
- if (indef)
- flags |= CMS_STREAM;
cms = CMS_digest_create(in, sign_md, flags);
}
else if (operation == SMIME_COMPRESS)
{
- if (indef)
- flags |= CMS_STREAM;
cms = CMS_compress(in, -1, flags);
}
else if (operation == SMIME_ENCRYPT)
{
- if (indef)
- flags |= CMS_STREAM;
cms = CMS_encrypt(encerts, in, cipher, flags);
}
else if (operation == SMIME_ENCRYPTED_ENCRYPT)
{
- if (indef)
- flags |= CMS_STREAM;
cms = CMS_EncryptedData_encrypt(in, cipher,
secret_key, secret_keylen,
flags);
 -766,11 +755,9 
{
if (flags & CMS_DETACHED)
{
- if (outformat == FORMAT_SMIME)
- flags |= CMS_STREAM;
+ if (outformat != FORMAT_SMIME)
+ flags &= ~CMS_STREAM;
}
- else if (indef)
- flags |= CMS_STREAM;
flags |= CMS_PARTIAL;
cms = CMS_sign(NULL, NULL, other, in, flags);
if (!cms)
 .
patch -p0 <<' .'
Index: openssl/crypto/cms/cms_io.c
============================================================
================
$ cvs diff -u -r1.1 -r1.2 cms_io.c
--- openssl/crypto/cms/cms_io.c 12 Mar 2008 21:14:20
-0000 1.1
+++ openssl/crypto/cms/cms_io.c 18 Mar 2008 13:45:43
-0000 1.2
 -89,20 +89,6 
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,
 .
patch -p0 <<' .'
Index: openssl/crypto/cms/cms_lib.c
============================================================
================
$ cvs diff -u -r1.6 -r1.7 cms_lib.c
--- openssl/crypto/cms/cms_lib.c 16 Mar 2008 21:05:37
-0000 1.6
+++ openssl/crypto/cms/cms_lib.c 18 Mar 2008 13:45:43
-0000 1.7
 -184,6 +184,7 
{
case NID_pkcs7_data:
+ case NID_pkcs7_enveloped:
case NID_pkcs7_encrypted:
case NID_id_smime_ct_compressedData:
/* Nothing to do */
 .
patch -p0 <<' .'
Index: openssl/crypto/cms/cms_smime.c
============================================================
================
$ cvs diff -u -r1.8 -r1.9 cms_smime.c
--- openssl/crypto/cms/cms_smime.c 18 Mar 2008 01:00:38
-0000 1.8
+++ openssl/crypto/cms/cms_smime.c 18 Mar 2008 13:45:43
-0000 1.9
 -447,8 +447,8 
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 
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 
break;
if (cert)
return 0;
+ ERR_clear_error();
}
}
 .
____________________________________________________________
__________
OpenSSL Project http://www.openssl.org
CVS Repository Commit List
openssl-cvs openssl.org
Automated List Manager
majordomo openssl.org
|