Set memory BIOs up properly when stripping text headers from S/MIME messages.
[openssl.git] / crypto / pkcs7 / pk7_smime.c
index 64a3cc476362356e0c10ced32a4389ae4c969c66..a577141d3b0a143bbad03c12c8bb804c4581033e 100644 (file)
@@ -1,5 +1,5 @@
 /* pk7_smime.c */
-/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
+/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project.
  */
 /* ====================================================================
@@ -124,7 +124,7 @@ int PKCS7_final(PKCS7 *p7, BIO *data, int flags)
 
        SMIME_crlf_copy(data, p7bio, flags);
 
-       BIO_flush(p7bio);
+       (void)BIO_flush(p7bio);
 
 
         if (!PKCS7_dataFinal(p7,p7bio))
@@ -216,7 +216,8 @@ PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert,
                        {
                        if (!pkcs7_copy_existing_digest(p7, si))
                                goto err;
-                       if (!PKCS7_SIGNER_INFO_sign(si))
+                       if (!(flags & PKCS7_PARTIAL) &&
+                                       !PKCS7_SIGNER_INFO_sign(si))
                                goto err;
                        }
                }
@@ -379,6 +380,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
                        PKCS7err(PKCS7_F_PKCS7_VERIFY,ERR_R_MALLOC_FAILURE);
                        goto err;
                }
+               BIO_set_mem_eof_return(tmpout, 0);
        } else tmpout = out;
 
        /* We now have to 'read' from p7bio to calculate digests etc. */