summaryrefslogtreecommitdiffstats
path: root/crypto/ts
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/ts
parentAdd public API for gettables and settables for keymanagement, signatures and ... (diff)
downloadopenssl-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/ts')
-rw-r--r--crypto/ts/ts_conf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/ts/ts_conf.c b/crypto/ts/ts_conf.c
index 199a3b82e3..71664fa091 100644
--- a/crypto/ts/ts_conf.c
+++ b/crypto/ts/ts_conf.c
@@ -78,8 +78,13 @@ STACK_OF(X509) *TS_CONF_load_certs(const char *file)
allcerts = PEM_X509_INFO_read_bio(certs, NULL, NULL, NULL);
for (i = 0; i < sk_X509_INFO_num(allcerts); i++) {
X509_INFO *xi = sk_X509_INFO_value(allcerts, i);
- if (xi->x509) {
- sk_X509_push(othercerts, xi->x509);
+
+ if (xi->x509 != NULL) {
+ if (!X509_add_cert(othercerts, xi->x509, X509_ADD_FLAG_DEFAULT)) {
+ sk_X509_pop_free(othercerts, X509_free);
+ othercerts = NULL;
+ goto end;
+ }
xi->x509 = NULL;
}
}