Skip to content

Name Constraints cert chain walk#10687

Open
rlm2002 wants to merge 2 commits into
wolfSSL:masterfrom
rlm2002:zd-NameConstraints
Open

Name Constraints cert chain walk#10687
rlm2002 wants to merge 2 commits into
wolfSSL:masterfrom
rlm2002:zd-NameConstraints

Conversation

@rlm2002

@rlm2002 rlm2002 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Description

Implements chain walk to ParseCertRelative to perform Name Constraints check for certificate ancestors which applies every ancestor CA's name constraints to the cert under verification, per RFC 5280 §4.2.1.10. Previously only the immediate signer's NCs were enforced.

Walk runs whenever cert->ca is set and verification is enabled. FindSignerByAkidOrName helper performs AKID→SKID lookup with subjectNameHash validation. Lookup falls back to name-only when cert has no AKID extension. NO_SKID builds cannot disambiguate same-DN sibling CAs in the CM.

issuerNameHash ifdef widened to include !IGNORE_NAME_CONSTRAINTS

Adds authKeyIdHash + authKeyIdSet to Signer for AKID parent lookup.

WOLFSSL_MAX_CHAIN_DEPTH macro (default 20) bounds the walk and provides cycle/depth protection. Walk also terminates on self-loops and A→B→A two-step cycles.

CN-as-DNS fallback in ConfirmNameConstraints now skips CA certs since the convention (RFC 6125 §6.4.4) is scoped to leaf service identity

Adds regression tests and supporting cert chain.

  • test_wolfSSL_CertManagerNameConstraint_skid_disambiguates loads a permissive same-DN sibling alongside the strict NC-bearing CA, requiring AKID→SKID disambiguation to pick the real signer
  • test_wolfSSL_CertManagerNameConstraint_valid_chain verifies a leaf is accepted under a grandparent's permitted URI and rejected when violating it
  • Cert/key fixtures under certs/test/nc-ancestor/ with gen-nc-ancestor.sh to regenerate from committed keys. SKID hash-table rows are pinned so the AKID-vs-name behavior is reproducibly observable

Fixes zd#21877, #21879, #21895

Testing

./configure --enable-all && make check

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@rlm2002 rlm2002 self-assigned this Jun 15, 2026
@rlm2002 rlm2002 marked this pull request as ready for review June 15, 2026 20:01
@github-actions

Copy link
Copy Markdown

retest this please

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

gcc-arm-cortex-m0plus

  • FLASH: .text +176 B (+0.3%, 63,671 B / 262,144 B, total: 24% used)

gcc-arm-cortex-m3

  • FLASH: .text +192 B (+0.2%, 121,601 B / 262,144 B, total: 46% used)

gcc-arm-cortex-m4

  • FLASH: .text +192 B (+0.1%, 199,244 B / 262,144 B, total: 76% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: .text +192 B (+0.3%, 66,251 B / 262,144 B, total: 25% used)

gcc-arm-cortex-m4-crypto-only

  • FLASH: .text +128 B (+0.1%, 173,802 B / 262,144 B, total: 66% used)

gcc-arm-cortex-m4-dtls13

  • FLASH: .text +192 B (+0.1%, 179,992 B / 1,048,576 B, total: 17% used)

gcc-arm-cortex-m4-min-ecc

  • FLASH: .text +128 B (+0.2%, 61,165 B / 262,144 B, total: 23% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .text +256 B (+0.0%, 768,388 B / 1,048,576 B, total: 73% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .text +128 B (+0.1%, 211,501 B / 262,144 B, total: 81% used)

gcc-arm-cortex-m4-pq

  • FLASH: .text +128 B (+0.0%, 278,064 B / 1,048,576 B, total: 27% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .text +192 B (+0.1%, 323,664 B / 1,048,576 B, total: 31% used)

gcc-arm-cortex-m4-sp-math

  • FLASH: .text +128 B (+0.2%, 61,165 B / 262,144 B, total: 23% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +192 B (+0.2%, 122,381 B / 262,144 B, total: 47% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .text +192 B (+0.1%, 234,878 B / 262,144 B, total: 90% used)

gcc-arm-cortex-m7

  • FLASH: .text +192 B (+0.1%, 199,244 B / 262,144 B, total: 76% used)

gcc-arm-cortex-m7-pq

  • FLASH: .text +128 B (+0.0%, 278,640 B / 1,048,576 B, total: 27% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .text +192 B (+0.1%, 234,942 B / 262,144 B, total: 90% used)

linuxkm-pie

  • Data: __patchable_function_entries +8 B (+0.0%, 24,296 B)

stm32-sim-stm32h753

  • FLASH: .text +64 B (+0.0%, 181,748 B / 2,097,152 B, total: 9% used)
    No memory changes detected for:
  • linuxkm-standard

@rlm2002 rlm2002 force-pushed the zd-NameConstraints branch from 95ec6df to 4c99169 Compare June 16, 2026 19:09
@rlm2002

rlm2002 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Retest this please Jenkins: PRB-fips-repo-and-harness-test-v3-part2 failure

@rlm2002 rlm2002 force-pushed the zd-NameConstraints branch 2 times, most recently from f6e930f to 6e9bc5e Compare June 17, 2026 18:57
@rlm2002

rlm2002 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Retest this please Jenkins: PRB-fips-repo-and-harness-test-v3-part2 returned failure (FAIL-ingish...)

@rlm2002 rlm2002 force-pushed the zd-NameConstraints branch 3 times, most recently from 1fa102a to 92ac05b Compare June 18, 2026 20:44
rlm2002 added 2 commits June 18, 2026 14:52
  - Ancestor walk added to ParseCertRelative
  - FindSignerByAkidOrName helper: AKID->SKID with name-hash
    validation, name-only fallback only when AKID is absent
  - Signer fields: authKeyIdSet, authKeyIdHash
  - issuerNameHash ifdef widened to include !IGNORE_NAME_CONSTRAINTS
  - WOLFSSL_MAX_CHAIN_DEPTH macro (default 20)
  - Self-loop and A->B->A cycle termination
  - CN-as-DNS fallback in ConfirmNameConstraints gated on !cert->isCA
  - test_wolfSSL_CertManagerNameConstraint_valid_chain
  - test_wolfSSL_CertManagerNameConstraint_skid_disambiguates
  - Cert/key fixtures under certs/test/nc-ancestor/
  - gen-nc-ancestor.sh to regenerate from committed keys
@rlm2002 rlm2002 force-pushed the zd-NameConstraints branch from 92ac05b to 0052ec4 Compare June 18, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant