|
21 | 21 |
|
22 | 22 | #include <wolfssl/wolfcrypt/libwolfssl_sources.h> |
23 | 23 |
|
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 | | - |
33 | 24 | /* |
34 | 25 | * OCSP responder missing features: |
35 | 26 | * - Support for multiple requests and responses in a single OCSP exchange |
@@ -590,73 +581,6 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest, |
590 | 581 | return ret; |
591 | 582 | } |
592 | 583 |
|
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 | | - |
660 | 584 | /* Enforce https://www.rfc-editor.org/rfc/rfc6960#section-4.2.2.2. Both halves |
661 | 585 | * of CertID (issuerNameHash and issuerKeyHash) must match; name-only matching |
662 | 586 | * would authorize a same-DN / different-key CA. issuerKeyHash may be NULL when |
@@ -702,12 +626,6 @@ int CheckOcspResponder(OcspResponse *bs, byte* subjectNameHash, |
702 | 626 | "delegated by issuer"); |
703 | 627 | passed = 1; |
704 | 628 | } |
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 |
711 | 629 | } |
712 | 630 |
|
713 | 631 | if (!passed) { |
|
0 commit comments