Skip to content

certman: keep peer intermediates as chain CAs - #1338

Open
ejohnstown wants to merge 2 commits into
wolfSSL:masterfrom
ejohnstown:certman-chain
Open

ejohnstown wants to merge 2 commits into
wolfSSL:masterfrom
ejohnstown:certman-chain

Conversation

@ejohnstown

Copy link
Copy Markdown
Contributor

wolfSSH_CERTMAN_VerifyCerts_buffer() loads a peer's intermediate only
when the cert below needs it as issuer, and keeps it as a
WOLFSSL_CHAIN_CA on wolfSSL 5.8.4 and later, the same as TLS.

  • This matches TLS rather than leaving no state behind: kept
    intermediates are cleared with
    wolfSSL_CertManagerUnloadIntermediateCerts().
  • Chains must now be strictly ordered; a padded or reordered chain
    fails with WS_CERT_NO_SIGNER_E. This needs a ChangeLog line.
  • CheckProfile() treats a self-issued leaf with no signer as a profile
    mismatch instead of dereferencing NULL.
  • F-13950 (ancestor name constraints) was fixed in wolfSSL 5.9.4.

Issue: F-10586, F-8862

VerifyCerts_buffer() loaded every verified cert above the leaf as a
trusted root. It now loads an intermediate only when the cert below
needs it as issuer, and on wolfSSL 5.8.4 or later keeps it as a
WOLFSSL_CHAIN_CA, as TLS does, tagging it only after an untyped load
gave the cert below a new signer, since the typed load retags matches.

- every cert above the leaf must still pass the CA check
- use the typed load only without NO_SKID, mapping failures to WS_ codes
  and logging a failed retag as an error
- document the kept intermediates and the strict chain order
- test that roots stay roots and a CA loads only for a cert it signs

Issue: F-10586
wc_ParseCert() with NO_VERIFY does not look up the signer of a
self-issued leaf, so CheckProfile() treats a NULL cert->ca as a
profile mismatch instead of dereferencing it.

- test a self-issued leaf that reaches the issuer-DN match

Issue: F-8862
Copilot AI balanced review requested due to automatic review settings October 22, 2026 20:49

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #1338

Scan targets checked: wolfssh-src, wolfssh-bugs
Coverage: 1 of 4 in-scope changed file(s) opened by the reviewer; not opened: tests/unit.c, wolfssh/certman.h, wolfssh/internal.h

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Lite

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