summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2026-05-04 13:55:20 +0000
committertb <>2026-05-04 13:55:20 +0000
commit278ba6b3d2099e38f40df9ffac2e09e3407502fc (patch)
tree0a6c87696debc2d6b694ae8c620aabb8b8db7dc0 /src
parenta17f0caa37cf3ea77cf7f5ba99bc04613c18666f (diff)
downloadopenbsd-278ba6b3d2099e38f40df9ffac2e09e3407502fc.tar.gz
openbsd-278ba6b3d2099e38f40df9ffac2e09e3407502fc.tar.bz2
openbsd-278ba6b3d2099e38f40df9ffac2e09e3407502fc.zip
verifier: re-enable the callback override for depth
kirill reported that his nginx reverse proxy setup stopped working with x509_verify.c r1.74 and r1.75. It turns out that nginx relies on a verify callback that always returns 1. In revision 1.74 we removed the possibility of the verify_cb() to override X509_V_ERR_CERT_CHAIN_TOO_LONG, which is what breaks the config in kirill's setup since it used to use the nginx default of setting the depth to 1. Re-enable this to make the new scenario "2a with depth 1 and depth callback" pass. As shown by the other new test scenario "14b with yolo calback" with a "just say yes" cb, the guard added in r1.74 still prevents the overwrite. This makes kirill's reproducer work as verified by kirill and myself. It was also tested by kirill in the real life setup. discussed with beck ok jsing kenjiro
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/x509/x509_verify.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/libcrypto/x509/x509_verify.c b/src/lib/libcrypto/x509/x509_verify.c
index fc3fbc14da..640558b685 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.75 2026/04/01 14:38:26 jsing Exp $ */ 1/* $OpenBSD: x509_verify.c,v 1.76 2026/05/04 13:55:20 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -668,11 +668,9 @@ x509_verify_build_chains(struct x509_verify_ctx *ctx, X509 *cert,
668 depth = sk_X509_num(current_chain->certs); 668 depth = sk_X509_num(current_chain->certs);
669 if (depth > 0) 669 if (depth > 0)
670 depth--; 670 depth--;
671 if (depth >= ctx->max_depth) { 671 if (depth >= ctx->max_depth && !x509_verify_cert_error(ctx, cert, depth,
672 (void)x509_verify_cert_error(ctx, cert, depth, 672 X509_V_ERR_CERT_CHAIN_TOO_LONG, 0))
673 X509_V_ERR_CERT_CHAIN_TOO_LONG, 0);
674 return; 673 return;
675 }
676 674
677 count = ctx->chains_count; 675 count = ctx->chains_count;
678 676