diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-04-26 18:30:45 +0200 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-08-12 13:54:37 +0200 |
commit | eeccc237239d6f2b6fbc557be7062bfe2ab836be (patch) | |
tree | 888f18ed5067404a0703b62f94a263317109f5be /crypto/pkcs7 | |
parent | Add public API for gettables and settables for keymanagement, signatures and ... (diff) | |
download | openssl-eeccc237239d6f2b6fbc557be7062bfe2ab836be.tar.xz openssl-eeccc237239d6f2b6fbc557be7062bfe2ab836be.zip |
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/pkcs7')
-rw-r--r-- | crypto/pkcs7/pk7_lib.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/crypto/pkcs7/pk7_lib.c b/crypto/pkcs7/pk7_lib.c index abe3570c68..797d1d2c25 100644 --- a/crypto/pkcs7/pk7_lib.c +++ b/crypto/pkcs7/pk7_lib.c @@ -13,7 +13,7 @@ #include <openssl/x509.h> #include "crypto/asn1.h" #include "crypto/evp.h" -#include "crypto/x509.h" +#include "crypto/x509.h" /* for sk_X509_add1_cert() */ #include "pk7_local.h" DEFINE_STACK_OF(X509) @@ -262,18 +262,7 @@ int PKCS7_add_certificate(PKCS7 *p7, X509 *x509) return 0; } - if (*sk == NULL) - *sk = sk_X509_new_null(); - if (*sk == NULL) { - PKCS7err(PKCS7_F_PKCS7_ADD_CERTIFICATE, ERR_R_MALLOC_FAILURE); - return 0; - } - X509_up_ref(x509); - if (!sk_X509_push(*sk, x509)) { - X509_free(x509); - return 0; - } - return 1; + return X509_add_cert_new(sk, x509, X509_ADD_FLAG_UP_REF); } int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl) |