Skip to content

Commit 575275f

Browse files
committed
Remove CheckOcspResponderChain and related references. Function is not compliant with RFC 6960, 4.2.2.2.
1 parent a3f5260 commit 575275f

2 files changed

Lines changed: 0 additions & 83 deletions

File tree

.wolfssl_known_macro_extras

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,6 @@ WOLFSSL_NO_KCAPI_SHA224
843843
WOLFSSL_NO_KTRI_ORACLE_WARNING
844844
WOLFSSL_NO_LMS_SHAKE256_256
845845
WOLFSSL_NO_OCSP_DATE_CHECK
846-
WOLFSSL_NO_OCSP_ISSUER_CHAIN_CHECK
847846
WOLFSSL_NO_OCSP_OPTIONAL_CERTS
848847
WOLFSSL_NO_RSA_KEY_CHECK
849848
WOLFSSL_NO_SERVER_GROUPS_EXT

src/ocsp.c

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@
2121

2222
#include <wolfssl/wolfcrypt/libwolfssl_sources.h>
2323

24-
/* Name change compatibility layer no longer needs to be included here */
25-
26-
/*
27-
* WOLFSSL_NO_OCSP_ISSUER_CHAIN_CHECK:
28-
* Disable looking for an authorized responder in the verification path of
29-
* the issuer. This will make the authorized responder only look at the
30-
* OCSP response signer and direct issuer.
31-
*/
32-
3324
/*
3425
* OCSP responder missing features:
3526
* - Support for multiple requests and responses in a single OCSP exchange
@@ -590,73 +581,6 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
590581
return ret;
591582
}
592583

593-
#ifndef WOLFSSL_NO_OCSP_ISSUER_CHAIN_CHECK
594-
static int CheckOcspResponderChain(OcspEntry* single, byte* issuerNameHash,
595-
byte* issuerKeyHash, void* vp, Signer* pendingCAs) {
596-
/* Attempt to build a chain up to cert's issuer */
597-
WOLFSSL_CERT_MANAGER* cm = (WOLFSSL_CERT_MANAGER*)vp;
598-
Signer* ca = NULL;
599-
Signer* prev = NULL;
600-
int passed = 0;
601-
602-
/*
603-
* Relation between certs:
604-
* CA
605-
* / \
606-
* intermediate(s) cert in OCSP response
607-
* | with OCSP key usage ext
608-
* issuer of cert
609-
* in OCSP request
610-
*/
611-
612-
if (issuerKeyHash == NULL)
613-
return 0;
614-
615-
/* Select CertID issuer by key hash so a same-DN / different-key trust
616-
* anchor cannot hijack the starting point. */
617-
ca = GetCAByKeyHash(cm, single->issuerKeyHash);
618-
if (ca != NULL && XMEMCMP(ca->subjectNameHash, single->issuerHash,
619-
OCSP_DIGEST_SIZE) != 0) {
620-
ca = NULL;
621-
}
622-
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
623-
if (ca == NULL && pendingCAs != NULL) {
624-
ca = findSignerByKeyHash(pendingCAs, single->issuerKeyHash);
625-
if (ca != NULL && XMEMCMP(ca->subjectNameHash, single->issuerHash,
626-
OCSP_DIGEST_SIZE) != 0) {
627-
ca = NULL;
628-
}
629-
}
630-
#else
631-
(void)pendingCAs;
632-
#endif
633-
for (; ca != NULL && ca != prev;
634-
prev = ca) {
635-
Signer* parent = GetCAByName(cm, ca->issuerNameHash);
636-
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
637-
if (parent == NULL && pendingCAs != NULL) {
638-
parent = findSignerByName(pendingCAs, ca->issuerNameHash);
639-
}
640-
#endif
641-
if (parent == NULL || parent == ca)
642-
break;
643-
644-
if (XMEMCMP(parent->subjectNameHash, issuerNameHash,
645-
OCSP_DIGEST_SIZE) == 0 &&
646-
XMEMCMP(parent->subjectKeyHash, issuerKeyHash,
647-
KEYID_SIZE) == 0) {
648-
WOLFSSL_MSG("\tOCSP Response signed by authorized "
649-
"responder delegated by issuer "
650-
"(found in chain)");
651-
passed = 1;
652-
break;
653-
}
654-
ca = parent;
655-
}
656-
return passed;
657-
}
658-
#endif
659-
660584
/* Enforce https://www.rfc-editor.org/rfc/rfc6960#section-4.2.2.2. Both halves
661585
* of CertID (issuerNameHash and issuerKeyHash) must match; name-only matching
662586
* would authorize a same-DN / different-key CA. issuerKeyHash may be NULL when
@@ -702,12 +626,6 @@ int CheckOcspResponder(OcspResponse *bs, byte* subjectNameHash,
702626
"delegated by issuer");
703627
passed = 1;
704628
}
705-
#ifndef WOLFSSL_NO_OCSP_ISSUER_CHAIN_CHECK
706-
else if (vp != NULL) {
707-
passed = CheckOcspResponderChain(single, issuerNameHash,
708-
issuerKeyHash, vp, bs->pendingCAs);
709-
}
710-
#endif
711629
}
712630

713631
if (!passed) {

0 commit comments

Comments
 (0)