提交 e5991ec5 编写于 作者: D Dr. Stephen Henson

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: NMatt Caswell <matt@openssl.org>
上级 2e430277
......@@ -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 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册