RFC4507 (including RFC4507bis) TLS stateless session resumption support
[openssl.git] / apps / smime.c
index a76e88d14172a25bd078a75db627925dcc7bf27d..af2960685f6389d71041c0931166981d8aec9e7e 100644 (file)
@@ -688,15 +688,22 @@ int MAIN(int argc, char **argv)
        else if (operation & SMIME_SIGNERS)
                {
                int i;
-               /* If detached data and SMIME output enable partial
-                * signing.
+               /* If detached data content we only enable streaming if
+                * S/MIME output format.
                 */
                if (operation == SMIME_SIGN)
                        {
-                       if (indef || (flags & PKCS7_DETACHED))
+                       if (flags & PKCS7_DETACHED)
+                               {
+                               if (outformat == FORMAT_SMIME)
+                                       flags |= PKCS7_STREAM;
+                               }
+                       else if (indef)
                                flags |= PKCS7_STREAM;
                        flags |= PKCS7_PARTIAL;
                        p7 = PKCS7_sign(NULL, NULL, other, in, flags);
+                       if (!p7)
+                               goto end;
                        }
                else
                        flags |= PKCS7_REUSE_DIGEST;