diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2008-04-18 11:19:56 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2008-04-18 11:19:56 +0000 |
commit | d14089025989d7d1defe7d7e7f113883a2d243ca (patch) | |
tree | 5db84461dfb9e1c2fea484ef805256ad6621c3c7 /crypto/cms | |
parent | eb492df2bb9a8d13a1ea56faa026f4a8df671bb5 (diff) |
Update from HEAD.
Diffstat (limited to 'crypto/cms')
-rw-r--r-- | crypto/cms/cms_smime.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c index c42de11f9e..f79c504e91 100644 --- a/crypto/cms/cms_smime.c +++ b/crypto/cms/cms_smime.c @@ -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)) { |