Commit c2df7c6
committed
Add opt-in X.509 cross-consistency checks (EKU chaining, RSA-PSS key params, critical BasicConstraints)
Follow-up to the algorithm-confusion hardening in wolfSSL#10131 (SigOidMatchesKeyOid).
An audit of X.509 parsing/validation found three further "logically related
fields that should agree but are not cross-checked" gaps. Each fix is gated
behind a new, default-off macro so existing builds are byte-for-byte unchanged
(the full testsuite passes with the macros off).
WOLFSSL_CHECK_EKU_CHAIN (B1):
The issuing CA's extendedKeyUsage did not constrain the certs it issued
(only the leaf's EKU was checked, at TLS time). Propagate the CA's effective
EKU onto its Signer in FillSigner and, during chain verification, reject a
certificate that asserts an EKU not permitted by the issuing CA. An absent
CA EKU or anyExtendedKeyUsage imposes no restriction.
WOLFSSL_CHECK_RSAPSS_KEY_PARAMS (B2):
An id-RSASSA-PSS issuer key's restricting parameters (RFC 4055) were parsed
and then discarded (the long-standing "TODO: store parameters so that usage
can be checked" in DecodeRsaPublicKey). Capture the SPKI PSS parameters on
the DecodedCert/Signer and require a signature made by that key to use the
mandated hash/MGF/salt.
WOLFSSL_REQUIRE_CRITICAL_BASIC_CONSTRAINTS (B7):
RFC 5280 4.2.1.9 requires CA certificates to mark basicConstraints critical;
wolfSSL stored the critical bit but never required it. Reject an intermediate
CA whose basicConstraints is not critical. Self-signed trust anchors are
exempt, as their own extensions are not processed during path validation.
All three are validated with dedicated proof-of-concept programs and EKU
positive/negative controls; B1+B2 pass the standard testsuite, and B7's
rejections are limited to non-conforming (non-critical-BC) intermediates.
https://claude.ai/code/session_01NSH5QDCbE9n1hKYQUYbKQA1 parent beff858 commit c2df7c6
2 files changed
Lines changed: 127 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21474 | 21474 | | |
21475 | 21475 | | |
21476 | 21476 | | |
| 21477 | + | |
| 21478 | + | |
| 21479 | + | |
| 21480 | + | |
| 21481 | + | |
| 21482 | + | |
| 21483 | + | |
| 21484 | + | |
| 21485 | + | |
| 21486 | + | |
| 21487 | + | |
| 21488 | + | |
| 21489 | + | |
| 21490 | + | |
| 21491 | + | |
| 21492 | + | |
| 21493 | + | |
| 21494 | + | |
| 21495 | + | |
| 21496 | + | |
| 21497 | + | |
| 21498 | + | |
| 21499 | + | |
| 21500 | + | |
| 21501 | + | |
21477 | 21502 | | |
21478 | 21503 | | |
21479 | 21504 | | |
| |||
23157 | 23182 | | |
23158 | 23183 | | |
23159 | 23184 | | |
| 23185 | + | |
| 23186 | + | |
| 23187 | + | |
| 23188 | + | |
| 23189 | + | |
| 23190 | + | |
| 23191 | + | |
| 23192 | + | |
| 23193 | + | |
| 23194 | + | |
| 23195 | + | |
| 23196 | + | |
| 23197 | + | |
| 23198 | + | |
| 23199 | + | |
23160 | 23200 | | |
23161 | 23201 | | |
23162 | 23202 | | |
| |||
23419 | 23459 | | |
23420 | 23460 | | |
23421 | 23461 | | |
| 23462 | + | |
| 23463 | + | |
| 23464 | + | |
| 23465 | + | |
| 23466 | + | |
| 23467 | + | |
| 23468 | + | |
| 23469 | + | |
| 23470 | + | |
| 23471 | + | |
| 23472 | + | |
| 23473 | + | |
| 23474 | + | |
| 23475 | + | |
| 23476 | + | |
| 23477 | + | |
| 23478 | + | |
| 23479 | + | |
| 23480 | + | |
| 23481 | + | |
| 23482 | + | |
| 23483 | + | |
| 23484 | + | |
| 23485 | + | |
| 23486 | + | |
| 23487 | + | |
| 23488 | + | |
| 23489 | + | |
| 23490 | + | |
| 23491 | + | |
| 23492 | + | |
| 23493 | + | |
| 23494 | + | |
| 23495 | + | |
| 23496 | + | |
| 23497 | + | |
| 23498 | + | |
| 23499 | + | |
| 23500 | + | |
| 23501 | + | |
| 23502 | + | |
| 23503 | + | |
| 23504 | + | |
| 23505 | + | |
| 23506 | + | |
| 23507 | + | |
23422 | 23508 | | |
23423 | 23509 | | |
23424 | 23510 | | |
| |||
23642 | 23728 | | |
23643 | 23729 | | |
23644 | 23730 | | |
| 23731 | + | |
| 23732 | + | |
| 23733 | + | |
| 23734 | + | |
| 23735 | + | |
| 23736 | + | |
| 23737 | + | |
| 23738 | + | |
| 23739 | + | |
| 23740 | + | |
| 23741 | + | |
| 23742 | + | |
| 23743 | + | |
| 23744 | + | |
| 23745 | + | |
| 23746 | + | |
| 23747 | + | |
| 23748 | + | |
| 23749 | + | |
| 23750 | + | |
23645 | 23751 | | |
23646 | 23752 | | |
23647 | 23753 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1779 | 1779 | | |
1780 | 1780 | | |
1781 | 1781 | | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
1782 | 1793 | | |
1783 | 1794 | | |
1784 | 1795 | | |
| |||
2185 | 2196 | | |
2186 | 2197 | | |
2187 | 2198 | | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
2188 | 2209 | | |
2189 | 2210 | | |
2190 | 2211 | | |
| |||
0 commit comments