diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2008-03-18 13:45:43 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2008-03-18 13:45:43 +0000 |
commit | e4f0e40eac4ee00d8447741c76c9862a36b0e734 (patch) | |
tree | a4f0e588c3177e3ce7e3eb420867c5deeb47cd60 /apps | |
parent | 6e3bc4f0730a3cb7d2d263153cb234da51637b38 (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 'apps')
-rw-r--r-- | apps/cms.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/apps/cms.c b/apps/cms.c index eb54a0d623..9de8c7e2c7 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -116,7 +116,6 @@ int MAIN(int argc, char **argv) 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 @@ int MAIN(int argc, char **argv) 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 @@ int MAIN(int argc, char **argv) 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 @@ int MAIN(int argc, char **argv) { 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) |