Skip to content

Keep CA temporary when the verify callback waives a held CRL error - #12115

Closed
padelsbach wants to merge 11 commits into
wolfSSL:masterfrom
padelsbach:ca-trust-held-crl
Closed

padelsbach wants to merge 11 commits into
wolfSSL:masterfrom
padelsbach:ca-trust-held-crl

Conversation

@padelsbach

Copy link
Copy Markdown
Contributor

Description

Follow up to #11110, please merge that first. Address the case where the CRL error was cleared by the callback but the CA is still added to the store.

Testing

Added unit test

Checklist

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

When an application's verify callback accepted a chain wolfSSL had
rejected, any CA in that chain was added to the WOLFSSL_CTX certificate
manager. This meant later connections trusted that same CA as well.

This change makes it so that these CAs are added to a list owned by the
Certificate message and reach ParseCertRelative() via its extraCa
argument.
- A chain could become longer than the waived CA's path length; the
  limit was being lost and silently replaced with the maximum
- A hash used to authorize delegated OCSP responders was left blank on
  waived CAs
- OCSP responses signed by a waived CA no longer fail to verify
- The callback is no longer asked again for every cert below a waived CA
  in WOLFSSL_SMALL_CERT_VERIFY builds
- Unknown-extension callback is now called on waived CAs with an unknown
  critical extension
- Changed waived CA list lifetime to last for the whole connection
  rather than the Certificate message, so it's still there when a
  stapled OCSP status arrives
The lookup that searches an OCSP responder's extra signer list was
compiled only when OCSP stapling v2 was enabled, while it's now needed
for the certs accepted via the verify callback.
Copilot AI balanced review requested due to automatic review settings November 12, 2026 21:04
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

gcc-arm-cortex-m0plus

  • FLASH: .text +260 B (+0.4%, 71,427 B / 262,144 B, total: 27% used)

gcc-arm-cortex-m3

  • FLASH: .text +652 B (+0.5%, 132,849 B / 262,144 B, total: 51% used)

gcc-arm-cortex-m4

  • FLASH: .text +640 B (+0.3%, 210,124 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: .text +256 B (+0.3%, 74,231 B / 262,144 B, total: 28% used)

gcc-arm-cortex-m4-crypto-only

  • FLASH: .text +256 B (+0.1%, 183,059 B / 262,144 B, total: 70% used)

gcc-arm-cortex-m4-dtls13

  • FLASH: .text +704 B (+0.4%, 197,656 B / 1,048,576 B, total: 19% used)

gcc-arm-cortex-m4-min-ecc

  • FLASH: .text +256 B (+0.4%, 68,697 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .text +832 B (+0.1%, 804,636 B / 1,048,576 B, total: 77% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .text +320 B (+0.1%, 224,340 B / 262,144 B, total: 86% used)

gcc-arm-cortex-m4-pq

  • FLASH: .text +640 B (+0.2%, 314,576 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .text +768 B (+0.2%, 345,104 B / 1,048,576 B, total: 33% used)

gcc-arm-cortex-m4-sp-math

  • FLASH: .text +256 B (+0.4%, 68,697 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +640 B (+0.5%, 133,585 B / 262,144 B, total: 51% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .text +640 B (+0.3%, 251,298 B / 262,144 B, total: 96% used)

gcc-arm-cortex-m7

  • FLASH: .text +640 B (+0.3%, 210,188 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m7-pq

  • FLASH: .text +640 B (+0.2%, 315,408 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .text +640 B (+0.3%, 251,298 B / 262,144 B, total: 96% used)

stm32-sim-stm32h753

  • FLASH: .text +256 B (+0.1%, 205,676 B / 2,097,152 B, total: 10% used)

zephyr-frdm_rw612

  • FLASH: datas +16 B, log_const_area -8 B, rodata +36 B, text +11,944 B (+4.2%, 294,452 B / 67,108,864 B, total: 0% used)
  • RAM: bss +49 B, datas +16 B (+0.1%, 58,423 B / 983,040 B, total: 6% used)

Catch memory regressions in CI with MemBrowse. Free for open source.

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.

🟡 Changes recommended

Temporary CA waivers persist across subsequent Certificate messages, allowing later chains to reuse trust exceptions that the verification callback no longer accepts.

3 open issues
What changed in this PR

This follows #11110 by keeping chain CAs temporary when a verification callback waives a held CRL error, rather than adding them to the shared certificate manager.

Changes:

  • Tracks callback-accepted CAs separately, including descendants whose verification depends on them.
  • Makes temporary signers available to certificate and OCSP verification.
  • Adds regression tests for CA non-persistence and waived CRL errors.
File Description
wolfssl/​wolfcrypt/​asn.h Declares parsing with additional signers.
wolfssl/​ssl.h Clarifies the temporary-CA scope comment.
wolfssl/​internal.h Adds waived-CA storage and helper declarations.
wolfcrypt/​src/​asn.c Extends certificate and OCSP signer lookup.
tests/​api/​test_ocsp.c Tests non-persistence after a CRL-error waiver.
tests/​api.c Tests non-persistence of callback-accepted CA chains.
src/​ssl.c Clears waived CAs when resetting a connection.
src/​ocsp.c Includes waived CAs during OCSP response verification.
src/​internal.c Implements temporary-CA handling and cleanup.

Review effort: Balanced

Comment thread src/internal.c
}
#endif
/* Parse Certificate */
extraSigners = SslWaivedCAsJoin(ssl, extraSigners, &waivedTail);
Comment thread src/internal.c
Comment on lines +17950 to +17951
if (SSL_CM(ssl)->unknownExtCallback != NULL)
wc_SetUnknownExtCallback(dCertAdd, SSL_CM(ssl)->unknownExtCallback);
Comment thread src/internal.c
Comment on lines +20747 to +20748
if (caIsTemp) {
ret = ProcessPeerCertAddWaivedCA(ssl, cert);
@padelsbach
padelsbach marked this pull request as draft November 12, 2026 21:21
@padelsbach

Copy link
Copy Markdown
Contributor Author

CI failures are real, from #11110 conflicting with #11752. This needs a more substantial fix in 11110. Closing

@padelsbach padelsbach closed this Nov 13, 2026
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