summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2025-07-10 18:48:31 +0000
committertb <>2025-07-10 18:48:31 +0000
commit7271e56bc7f8882f1d22ce1a617330e4fd975593 (patch)
treebdff3d12cb9ca4d9a49cd6c8539e338a3efe28e8 /src
parentd25f32ed32ab5666e77ae5843fcd4f087baf139a (diff)
downloadopenbsd-7271e56bc7f8882f1d22ce1a617330e4fd975593.tar.gz
openbsd-7271e56bc7f8882f1d22ce1a617330e4fd975593.tar.bz2
openbsd-7271e56bc7f8882f1d22ce1a617330e4fd975593.zip
Add missing check to X509_CRL_verify()
When fixing CVE-2014-8275 in commit 684400ce, Henson added a check that the AlgorithmIdentifier in the certificate's signature matches the one in the tbsCertificate. A corresponding check for CRLs was missed. BoringSSL added such a check in 2022, so this should be fine for us to do as well even though OpenSSL still doesn't have it. The only caller will set an error on the stack, so we don't do it here. There's no obvious check that X509_REQ_verify() could do. ok beck kenjiro
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/asn1/x_crl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c
index f614884eec..19caf56cec 100644
--- a/src/lib/libcrypto/asn1/x_crl.c
+++ b/src/lib/libcrypto/asn1/x_crl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_crl.c,v 1.49 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: x_crl.c,v 1.50 2025/07/10 18:48:31 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -540,6 +540,12 @@ LCRYPTO_ALIAS(X509_CRL_add0_revoked);
540int 540int
541X509_CRL_verify(X509_CRL *crl, EVP_PKEY *pkey) 541X509_CRL_verify(X509_CRL *crl, EVP_PKEY *pkey)
542{ 542{
543 /*
544 * The CertificateList's signature AlgorithmIdentifier must match
545 * the one inside the TBSCertList, see RFC 5280, 5.1.1.2, 5.1.2.2.
546 */
547 if (X509_ALGOR_cmp(crl->sig_alg, crl->crl->sig_alg) != 0)
548 return 0;
543 return ASN1_item_verify(&X509_CRL_INFO_it, crl->sig_alg, crl->signature, 549 return ASN1_item_verify(&X509_CRL_INFO_it, crl->sig_alg, crl->signature,
544 crl->crl, pkey); 550 crl->crl, pkey);
545} 551}