aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-03-24 16:21:21 +0000
committerDr. Stephen Henson <steve@openssl.org>2015-03-24 17:35:59 +0000
commite5991ec528b1c339062440811e2641f5ea2b328b (patch)
treeddc57a4cb678bb4aeb1261d702d7711f1d86a001
parent2e430277578d3dd586cd005682a54a59d6158146 (diff)
downloadopenssl-e5991ec528b1c339062440811e2641f5ea2b328b.tar.gz
Fix verify algorithm.
Disable loop checking when we retry verification with an alternative path. This fixes the case where an intermediate CA is explicitly trusted and part of the untrusted certificate list. By disabling loop checking for this case the untrusted CA can be replaced by the explicitly trusted case and verification will succeed. Reviewed-by: Matt Caswell <matt@openssl.org>
-rw-r--r--crypto/x509/x509_vfy.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
index bb6e1ce9af..61f02b58a6 100644
--- a/crypto/x509/x509_vfy.c
+++ b/crypto/x509/x509_vfy.c
@@ -365,8 +365,16 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
&& !(ctx->param->flags & X509_V_FLAG_TRUSTED_FIRST)
&& !(ctx->param->flags & X509_V_FLAG_NO_ALT_CHAINS)) {
while (j-- > 1) {
+ STACK_OF(X509) *chtmp = ctx->chain;
xtmp2 = sk_X509_value(ctx->chain, j - 1);
+ /*
+ * Temporarily set chain to NULL so we don't discount
+ * duplicates: the same certificate could be an untrusted
+ * CA found in the trusted store.
+ */
+ ctx->chain = NULL;
ok = ctx->get_issuer(&xtmp, ctx, xtmp2);
+ ctx->chain = chtmp;
if (ok < 0)
goto end;
/* Check if we found an alternate chain */