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/pkcs12 | |
parent | e3efe7a53299dff3cd2222542b6a999b1360d626 (diff) |
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/pkcs12')
-rw-r--r-- | crypto/pkcs12/p12_kiss.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/pkcs12/p12_kiss.c b/crypto/pkcs12/p12_kiss.c index 88925f76d9..eaf6501c1c 100644 --- a/crypto/pkcs12/p12_kiss.c +++ b/crypto/pkcs12/p12_kiss.c @@ -10,6 +10,7 @@ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/pkcs12.h> +#include "crypto/x509.h" /* for X509_add_cert_new() */ DEFINE_STACK_OF(X509) DEFINE_STACK_OF(PKCS7) @@ -99,12 +100,8 @@ int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, ERR_pop_to_mark(); } - if (ca && x) { - if (*ca == NULL) - *ca = sk_X509_new_null(); - if (*ca == NULL) - goto err; - if (!sk_X509_push(*ca, x)) + if (ca != NULL && x != NULL) { + if (!X509_add_cert_new(ca, x, X509_ADD_FLAG_DEFAULT)) goto err; x = NULL; } |