summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbeck <>2024-02-01 23:16:38 +0000
committerbeck <>2024-02-01 23:16:38 +0000
commit1a2091e2b9d474443262fc4e56a89d7be94af154 (patch)
treee81e5d5b6df5169c4c0066932a5d84091614d019 /src
parent555b4e1a5af97f780be7eba8d1827c5ffe71a9fe (diff)
downloadopenbsd-1a2091e2b9d474443262fc4e56a89d7be94af154.tar.gz
openbsd-1a2091e2b9d474443262fc4e56a89d7be94af154.tar.bz2
openbsd-1a2091e2b9d474443262fc4e56a89d7be94af154.zip
Fix the verifier to use the trust store
the trust store is yet another obscure way to add a trust anchor
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/x509/x509_verify.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/libcrypto/x509/x509_verify.c b/src/lib/libcrypto/x509/x509_verify.c
index c4c89a23b9..19bb925d9c 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.67 2023/11/13 10:33:00 tb Exp $ */ 1/* $OpenBSD: x509_verify.c,v 1.68 2024/02/01 23:16:38 beck 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 *
@@ -287,6 +287,18 @@ x509_verify_ctx_cert_is_root(struct x509_verify_ctx *ctx, X509 *cert,
287 287
288 /* Check by lookup if we have a legacy xsc */ 288 /* Check by lookup if we have a legacy xsc */
289 if (ctx->xsc != NULL) { 289 if (ctx->xsc != NULL) {
290 /*
291 * "alternative" lookup method, using the "trusted" stack in the
292 * xsc as the source for roots.
293 */
294 if (ctx->xsc->trusted != NULL) {
295 for (i = 0; i < sk_X509_num(ctx->xsc->trusted); i++) {
296 if (X509_cmp(sk_X509_value(ctx->xsc->trusted,
297 i), cert) == 0)
298 return x509_verify_check_chain_end(cert,
299 full_chain);
300 }
301 }
290 if ((match = x509_vfy_lookup_cert_match(ctx->xsc, 302 if ((match = x509_vfy_lookup_cert_match(ctx->xsc,
291 cert)) != NULL) { 303 cert)) != NULL) {
292 X509_free(match); 304 X509_free(match);