]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Update from HEAD.
authorDr. Stephen Henson <steve@openssl.org>
Fri, 18 Apr 2008 11:19:56 +0000 (11:19 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 18 Apr 2008 11:19:56 +0000 (11:19 +0000)
crypto/cms/cms_smime.c
test/cms-test.pl

index c42de11f9e9f99b1bc8af71c6ae063d858a382cd..f79c504e913705c650967fa652818b4649225f2f 100644 (file)
@@ -462,23 +462,23 @@ CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
        {
        CMS_ContentInfo *cms;
        int i;
+
        cms = CMS_ContentInfo_new();
-       if (!cms)
+       if (!cms || !CMS_SignedData_init(cms))
                goto merr;
+
        if (pkey && !CMS_add1_signer(cms, signcert, pkey, NULL, flags))
                {
                CMSerr(CMS_F_CMS_SIGN, CMS_R_ADD_SIGNER_ERROR);
                goto err;
                }
+
        for (i = 0; i < sk_X509_num(certs); i++)
                {
                X509 *x = sk_X509_value(certs, i);
                if (!CMS_add1_cert(cms, x))
                        goto merr;
                }
-       /* If no signer or certs initialize signedData */
-       if (!pkey && !i && !CMS_SignedData_init(cms))
-               goto merr;
 
        if(!(flags & CMS_DETACHED))
                {
index 7421f1c19d42493f4aff66dddff07ccfff942694..a84e089ddc4d38d3269f6b856487450945b521fe 100644 (file)
@@ -81,6 +81,7 @@ my @smime_pkcs7_tests = (
     [
         "signed content DER format, RSA key",
         "-sign -in smcont.txt -outform DER -nodetach"
+          . " -certfile $smdir/smroot.pem"
           . " -signer $smdir/smrsa1.pem -out test.cms",
         "-verify -in test.cms -inform DER "
           . " -CAfile $smdir/smroot.pem -out smtst.txt"