diff options
author | Emilia Kasper <ekasper@google.com> | 2014-03-24 12:33:54 +0100 |
---|---|---|
committer | Emilia Kasper <ekasper@google.com> | 2014-03-24 12:33:54 +0100 |
commit | 7c5718be271d9a47e8538adfde1909cd58943244 (patch) | |
tree | 3434acbea2aaf8fea3fe3d29a737fac035aa08d5 /ssl/ssl_cert.c | |
parent | 3a98f9cf20c6af604799ee079bec496b296bb5cc (diff) |
Allow duplicate certs in ssl_build_cert_chain
Diffstat (limited to 'ssl/ssl_cert.c')
-rw-r--r-- | ssl/ssl_cert.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index fd59158128..09ea611d8a 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -1192,6 +1192,7 @@ int ssl_build_cert_chain(CERT *c, X509_STORE *chain_store, int flags) STACK_OF(X509) *chain = NULL, *untrusted = NULL; X509 *x; int i, rv = 0; + unsigned long error; if (!cpk->x509) { @@ -1208,11 +1209,23 @@ int ssl_build_cert_chain(CERT *c, X509_STORE *chain_store, int flags) { x = sk_X509_value(cpk->chain, i); if (!X509_STORE_add_cert(chain_store, x)) - goto err; + { + error = ERR_peek_last_error(); + if (ERR_GET_LIB(error) != ERR_LIB_X509 || + ERR_GET_REASON(error) != X509_R_CERT_ALREADY_IN_HASH_TABLE) + goto err; + ERR_clear_error(); + } } /* Add EE cert too: it might be self signed */ if (!X509_STORE_add_cert(chain_store, cpk->x509)) - goto err; + { + error = ERR_peek_last_error(); + if (ERR_GET_LIB(error) != ERR_LIB_X509 || + ERR_GET_REASON(error) != X509_R_CERT_ALREADY_IN_HASH_TABLE) + goto err; + ERR_clear_error(); + } } else { |