summaryrefslogtreecommitdiffstats
path: root/apps/smime.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2003-02-15 00:50:55 +0000
committerDr. Stephen Henson <steve@openssl.org>2003-02-15 00:50:55 +0000
commit27068df7e05d5d3cadd4b0f10762b32cf8b01beb (patch)
treeaa3ffe43660e6f8d42dd6a5c5d5a3bd05d567e73 /apps/smime.c
parentb12753dffcf096c7d7110397ea9905b07a2ed573 (diff)
Single pass processing to cleartext S/MIME signing.
Diffstat (limited to 'apps/smime.c')
-rw-r--r--apps/smime.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/smime.c b/apps/smime.c
index cc248d377b..83daa71ca1 100644
--- a/apps/smime.c
+++ b/apps/smime.c
@@ -1,9 +1,9 @@
/* smime.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
- * project 1999.
+ * project.
*/
/* ====================================================================
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -478,8 +478,14 @@ int MAIN(int argc, char **argv)
if(operation == SMIME_ENCRYPT) {
p7 = PKCS7_encrypt(encerts, in, cipher, flags);
} else if(operation == SMIME_SIGN) {
+ /* If detached data and SMIME output enable partial
+ * signing.
+ */
+ if ((flags & PKCS7_DETACHED) && (outformat == FORMAT_SMIME))
+ flags |= PKCS7_PARTSIGN;
p7 = PKCS7_sign(signer, key, other, in, flags);
- if (BIO_reset(in) != 0 && (flags & PKCS7_DETACHED)) {
+ /* Don't need to rewind for partial signing */
+ if (!(flags & PKCS7_PARTSIGN) && (BIO_reset(in) != 0)) {
BIO_printf(bio_err, "Can't rewind input file\n");
goto end;
}