aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/cms/cms_sd.c
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-04-26 18:30:45 +0200
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-08-12 13:54:37 +0200
commiteeccc237239d6f2b6fbc557be7062bfe2ab836be (patch)
tree888f18ed5067404a0703b62f94a263317109f5be /crypto/cms/cms_sd.c
parente3efe7a53299dff3cd2222542b6a999b1360d626 (diff)
downloadopenssl-eeccc237239d6f2b6fbc557be7062bfe2ab836be.tar.gz
Introduce X509_add_cert[s] simplifying various additions to cert lists
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12615)
Diffstat (limited to 'crypto/cms/cms_sd.c')
-rw-r--r--crypto/cms/cms_sd.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index 9b345de553..4fac4e6182 100644
--- a/crypto/cms/cms_sd.c
+++ b/crypto/cms/cms_sd.c
@@ -20,6 +20,7 @@
#include "crypto/evp.h"
#include "crypto/cms.h"
#include "crypto/ess.h"
+#include "crypto/x509.h" /* for X509_add_cert_new() */
DEFINE_STACK_OF(CMS_RevocationInfoChoice)
DEFINE_STACK_OF(CMS_SignerInfo)
@@ -510,12 +511,8 @@ STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms)
for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++) {
si = sk_CMS_SignerInfo_value(sinfos, i);
if (si->signer != NULL) {
- if (signers == NULL) {
- signers = sk_X509_new_null();
- if (signers == NULL)
- return NULL;
- }
- if (!sk_X509_push(signers, si->signer)) {
+ if (!X509_add_cert_new(&signers, si->signer,
+ X509_ADD_FLAG_DEFAULT)) {
sk_X509_free(signers);
return NULL;
}