Make S/MIME encrypt work again.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 25 Mar 2004 00:58:59 +0000 (00:58 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 25 Mar 2004 00:58:59 +0000 (00:58 +0000)
crypto/pkcs7/pk7_doit.c

index 35c7dcd0b3e7778b884328bfb664a3e72d282b72..b78e22819cd8f0593fd8080ae787dc7bc829b9bc 100644 (file)
@@ -257,10 +257,15 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
                        bio=BIO_new(BIO_s_null());
                else
                        {
-                       ASN1_OCTET_STRING *os;
-                       os = PKCS7_get_octet_string(p7->d.sign->contents);
-                       if (os && os->length > 0)
-                               bio = BIO_new_mem_buf(os->data, os->length);
+                       if (PKCS7_type_is_signed(p7))
+                               {
+                               ASN1_OCTET_STRING *os;
+                               os = PKCS7_get_octet_string(
+                                                       p7->d.sign->contents);
+                               if (os && os->length > 0)
+                                       bio = BIO_new_mem_buf(os->data,
+                                                               os->length);
+                               }
                        if(bio == NULL)
                                {
                                bio=BIO_new(BIO_s_mem());