Skip to content

Add X509_STORE intermediates to the CertManager as chain CAs - #11917

Open
holtrop-wolfssl wants to merge 2 commits into
wolfSSL:masterfrom
holtrop-wolfssl:zd22694-a
Open

holtrop-wolfssl wants to merge 2 commits into
wolfSSL:masterfrom
holtrop-wolfssl:zd22694-a

Conversation

@holtrop-wolfssl

Copy link
Copy Markdown
Contributor

Description

X509StorePushCertsToCM() and wolfSSL_X509_STORE_add_cert() on a CTX-owned store added non-self-signed certificates to the CertManager as WOLFSSL_USER_CA. AddCA() skips the CA:TRUE and keyCertSign admission checks for that type, so a CA:FALSE certificate, or a CA:TRUE certificate without keyCertSign, became a permanent trust anchor for anything signed by its key.

Add them as WOLFSSL_CHAIN_CA instead so AddCA() enforces both checks and wolfSSL_CertManagerUnloadIntermediateCerts() can remove them. Self-signed roots are still added as WOLFSSL_USER_CA.

Fixes ZD#22694 part A

Testing

How did you test?

Checklist

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

@holtrop-wolfssl holtrop-wolfssl self-assigned this Oct 28, 2026
Copilot AI balanced review requested due to automatic review settings October 28, 2026 20:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the changes treating non-self-signed certificates in CTX-owned stores as chain CAs.

No open issues 🎉

What changed in this PR

This PR tightens certificate admission for CTX-owned X509 stores by treating non-self-signed certificates as chain CAs rather than permanent trust anchors.

Changes:

  • Enforce CA and keyCertSign checks for intermediates added before or after store attachment, while preserving self-signed root handling.
  • Add regression coverage for invalid intermediates, valid chain verification, and intermediate unloading.
File Description
tests/​api/​test_ossl_x509_str.h Declares and registers the new regression test.
tests/​api/​test_ossl_x509_str.c Tests certificate admission and intermediate unloading.
src/​x509_str.c Uses WOLFSSL_CHAIN_CA for non-self-signed store certificates.

Review effort: Balanced

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

X509StorePushCertsToCM() and wolfSSL_X509_STORE_add_cert() on a
CTX-owned store added non-self-signed certificates to the CertManager as
WOLFSSL_USER_CA. AddCA() skips the CA:TRUE and keyCertSign admission
checks for that type, so a CA:FALSE certificate, or a CA:TRUE
certificate without keyCertSign, became a permanent trust anchor for
anything signed by its key.

Add them as WOLFSSL_CHAIN_CA instead so AddCA() enforces both checks and
wolfSSL_CertManagerUnloadIntermediateCerts() can remove them.
Self-signed roots are still added as WOLFSSL_USER_CA.

ZD-22694 part A
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.

3 participants