diff options
author | beck <> | 2020-11-15 17:54:49 +0000 |
---|---|---|
committer | beck <> | 2020-11-15 17:54:49 +0000 |
commit | e681f33cab66602fd8f3f572d86bdce2b13b2de9 (patch) | |
tree | 89003755c0c8fffbadb16cf615c01c6cb7350ffa /src/lib | |
parent | a1afbc94cbbe3c87d24fd146e4abf9fec963cf5c (diff) | |
download | openbsd-e681f33cab66602fd8f3f572d86bdce2b13b2de9.tar.gz openbsd-e681f33cab66602fd8f3f572d86bdce2b13b2de9.tar.bz2 openbsd-e681f33cab66602fd8f3f572d86bdce2b13b2de9.zip |
Return the specific failure for a "self signed certificate" in the chain
in order to be compatible with the openssl error craziness in the legacy
verifier case.
This will fix a regress problem noticed by znc
ok tb@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/x509/x509_verify.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/libcrypto/x509/x509_verify.c b/src/lib/libcrypto/x509/x509_verify.c index c76a5e103e..5f048bee4f 100644 --- a/src/lib/libcrypto/x509/x509_verify.c +++ b/src/lib/libcrypto/x509/x509_verify.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_verify.c,v 1.19 2020/11/11 18:49:34 jsing Exp $ */ | 1 | /* $OpenBSD: x509_verify.c,v 1.20 2020/11/15 17:54:49 beck Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> |
4 | * | 4 | * |
@@ -477,6 +477,19 @@ x509_verify_build_chains(struct x509_verify_ctx *ctx, X509 *cert, | |||
477 | count = ctx->chains_count; | 477 | count = ctx->chains_count; |
478 | ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY; | 478 | ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY; |
479 | ctx->error_depth = depth; | 479 | ctx->error_depth = depth; |
480 | if (ctx->xsc != NULL) { | ||
481 | /* | ||
482 | * Long ago experiments at Muppet labs resulted in a | ||
483 | * situation where software not only sees these errors | ||
484 | * but forced developers to expect them in certain cases. | ||
485 | * so we must mimic this awfulness for the legacy case. | ||
486 | */ | ||
487 | if (cert->ex_flags & EXFLAG_SS) | ||
488 | ctx->error = (depth == 0) ? | ||
489 | X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: | ||
490 | X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN; | ||
491 | |||
492 | } | ||
480 | 493 | ||
481 | for (i = 0; i < sk_X509_num(ctx->roots); i++) { | 494 | for (i = 0; i < sk_X509_num(ctx->roots); i++) { |
482 | candidate = sk_X509_value(ctx->roots, i); | 495 | candidate = sk_X509_value(ctx->roots, i); |