Repository navigation
Crl Processing Changes: Allow for multiple CRLs per issuer - #12116
aidankeefe2022 wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
An AKID-less CRL update can discard another signing key’s revocations, allowing revoked certificates to pass, and the cycle test does not exercise the new CRL-walk guard.
2 open issues
What changed in this PR
This PR updates wolfSSL’s certificate revocation checks to distinguish CRLs by issuer name and authority key identifier (AKID), supporting issuers with multiple signing keys.
Changes:
- Keeps separate CRL series for different keys and adds same-name fallback handling.
- Passes AKIDs through certificate and chain checks, with bounded chain traversal.
- Adds fixtures and regression tests for key rollover, CRL-only keys, unverifiable CRLs, and cycles.
| File | Description |
|---|---|
wolfssl/wolfcrypt/asn.h |
Makes signer AKID fields available for CRL checks. |
wolfssl/crl.h |
Adds AKID to the internal CRL-check interface. |
wolfcrypt/src/asn.c |
Copies signer AKIDs in CRL-enabled builds. |
tests/unit-mcdc/test_internal_revocation_whitebox.c |
Updates CRL mocks for the new argument. |
tests/unit-mcdc/test_crl_whitebox.c |
Adds AKID matching and CRL-series test vectors. |
tests/api/test_certman.h |
Registers new CRL regression tests. |
tests/api/test_certman.c |
Tests rollover, fallback, verification failures, and chain traversal. |
tests/api/test_certman_crl_fixtures.h |
Adds certificate, key, and CRL fixtures. |
tests/api/include.am |
Includes the fixture header in source distributions. |
src/internal.c |
Follows issuer AKIDs and bounds CRL chain traversal. |
src/crl.c |
Updates CRL storage, matching, and fallback behavior. |
Review effort: Balanced
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12116
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): tests/api/include.am, tests/api/test_certman.h, tests/api/test_certman_crl_fixtures.h
Coverage: 8 of 8 in-scope changed file(s) opened by the reviewer
Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Max
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12116
Scan targets checked: wolfssl-src, wolfssl-bugs
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs
Not reviewed (no scan target covers them): tests/api/include.am, tests/api/test_certman.h, tests/api/test_certman_crl_fixtures.h
Coverage: 4 of 7 in-scope changed file(s) opened by the reviewer; not opened: src/ssl_certman.c, tests/api.c, tests/api/test_certman.c
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
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
There was a problem hiding this comment.
🟡 Changes recommended
The comment in src/crl.c incorrectly implies that a fresh CRL-only-key CRL can cover an expired own-key CRL despite an AKID mismatch, and needs to describe the verified-CRL and shared-trust-anchor requirements.
1 open issue
2 resolved since last review
Review effort: Balanced
|
retest this please |
|
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12116
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): tests/api/include.am, tests/api/test_certman.h, tests/api/test_certman_crl_fixtures.h
Coverage: 5 of 6 in-scope changed file(s) opened by the reviewer; not opened: tests/api/test_certman.c
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
fc91154 to
0de70a7
Compare
There was a problem hiding this comment.
🟡 Changes recommended
CRL replacement can retain superseded revocations, while certificate-cache round-trips omit metadata needed to recognize same-anchor CRLs, causing erroneous CRL_MISSING failures.
2 open issues
1 resolved since last review
Review effort: Balanced
|
retest this please |
Major change for adding CRLs They are now only reported as duplicates if the issuer name and AKID do not match if AKDI is avaible. We then go into out normal checks for CLR number and date. This means that multiple CRLs from one issuer are added and we do not miss any revocations. When checking certs with issuer we match with name and AKID. If that does not work we then fall back to matching to any CRL with same issuer name. This can lead to rejecting when we should not but it is better than accpeting when we should not trade-off.
…that AKIDN mismatch leads to same trust anchor
Now crls with out akids are treated as their own series from same Issuer. We also now verify the crl later after akid check.
0de70a7 to
395bafb
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12116
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): .github/workflows/enterprise.yml, .github/workflows/os-check.yml, .github/workflows/smoke-test.yml, .gitignore, certs/crl/gen/.gitignore, certs/crl/gen/gen-crl-fixtures.sh, certs/crl/include.am, scripts/crl-gen-openssl.test, tests/api/include.am, tests/api/test_certman.h, tests/api/test_certman_crl_fixtures.h
Coverage: 8 of 10 in-scope changed file(s) opened by the reviewer; not opened: src/ssl_certman.c, tests/api.c
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
|
@claude review |
| ret = AddCRL_EntryLocked(crl, ent); | ||
| if (ret != 0) { | ||
| CRL_Entry_free(ent, crl->heap); | ||
| if (ret == WC_NO_ERR_TRACE(DUPE_ENTRY_E)) | ||
| ret = 0; |
There was a problem hiding this comment.
🔴 Apps that refresh a CRL with no CRL number through X509_STORE_add_crl now have the newer CRL silently dropped, so its revocations are ignored. The merge runs each copy through AddCRL_EntryLocked. There, CompareCRLnumber sees two empty crlNumber strings as MP_EQ and returns DUPE_ENTRY_E, which src/crl.c:1982-1983 turns into success. Fix: when either side has crlNumberSet == 0, order the two CRLs by thisUpdate (lastDate) rather than treating them as equal. At minimum, do not report WOLFSSL_SUCCESS when the only incoming entry was dropped.
Why this was flagged
An app adds a CRL without the CRL Number extension (a v1 CRL, or one made with the wolfSSL_X509_CRL_* generation APIs without a number) to an X509_STORE. Later it adds a newer CRL from the same issuer and key, also with no number, through wolfSSL_X509_STORE_add_crl. The merge loop at src/crl.c:1979 calls AddCRL_EntryLocked. At src/crl.c:1066, CompareCRLnumber reads both empty crlNumber strings as 0 with mp_read_radix and returns MP_EQ, so it returns DUPE_ENTRY_E. At src/crl.c:1982-1983 that is freed and mapped to ret = 0, so the call returns WOLFSSL_SUCCESS but the store keeps only the old CRL. Certs revoked in the new CRL are then accepted, and once the old CRL's nextUpdate passes, handshakes fail with CRL_CERT_DATE_ERR. On the base branch the new entries were appended to the list, so CheckCertCRLList also read the newer CRL and found those revocations.
Verification: When there is no CRL number, crlNumber is never filled (crl.c:215-217). Both numbers read as 0, mp_cmp returns MP_EQ, and the newer CRL is dropped. The base appended the copied list to the tail (*tail = toAdd;), so the newer CRL's revocations were honored. The caller gets WOLFSSL_SUCCESS (src/crl.c ~1971-1985) and has no sign that anything was dropped.
| if (ent->verified == 0 && crl->cm != NULL) { | ||
| /* ent is a private copy and crl->cm owns crl, so the result can | ||
| * be cached on it. */ | ||
| ret = VerifyCRLE(crl, ent, crl->cm, 1); | ||
| if (ret == WC_NO_ERR_TRACE(ASN_CRL_NO_SIGNER_E)) { | ||
| ret = 0; | ||
| } | ||
| else if (ret != 0) { | ||
| WOLFSSL_MSG("CRL failed to verify against the store's CAs"); |
There was a problem hiding this comment.
🔴 Loading a multi-CRL file now stops at the first CRL that fails its signature check, so later CRLs, including other issuers', are never loaded. X509StoreCheckCRLCopies (src/crl.c:1892) makes wolfSSL_X509_STORE_add_crl return WOLFSSL_FAILURE. wolfSSL_X509_load_crl_file then breaks its PEM loop (src/x509.c:10214, src/x509.c:10274). Fix: have the loaders skip a CRL whose add fails and keep reading the rest of the file. LoadCertByIssuer needs the same change for later .rN files (src/internal.c:18044). The base branch added every CRL and verified each one only when it was used.
Why this was flagged
An app loads a PEM bundle of CRLs with wolfSSL_X509_load_crl_file, or the hash directory through LoadCertByIssuer. One CRL near the front fails VerifyCRLE against the store's CAs. That gives ASN_CRL_CONFIRM_E, and X509StoreCheckCRLCopies returns it (src/crl.c:1888-1893). add_crl returns WOLFSSL_FAILURE and the loop at src/x509.c:10212-10214 breaks. The function returns the count loaded so far, so the caller sees a positive success. Every CRL after it is never added, so certs from those unrelated issuers get CRL_MISSING. If the failing CRL is the first one, the store's CRL is never created and wolfSSL_CertManagerEnableCRL(WOLFSSL_CRL_CHECKALL) never runs (src/crl.c:1931-1936). On base, add_crl failed only on alloc or lock errors, so every CRL was added and only the bad CRL's issuer was affected.
Verification: X509StoreCheckCRLCopies (src/crl.c:1885-1894) calls VerifyCRLE(crl, ent, crl->cm, 1) and swallows only ASN_CRL_NO_SIGNER_E. add_crl then returns WOLFSSL_FAILURE (src/crl.c:1930-1933). wolfSSL_X509_load_crl_file hits break at src/x509.c:10212-10214 and 10272-10274, so every later CRL in the file is never read. On the base, add_crl only appended, so the whole bundle loaded.
|
Decided to go in another direction new change is here #12165 |



Description
Zendesk #: https://wolfssl.zendesk.com/agent/tickets/22769
A CA that rolls its signing key keeps the same subject name, so CRLs from both keys share an issuer name. Before this PR, wolfSSL keyed stored CRLs by issuer name alone. A CRL from one key could evict the other key's CRL, or be rejected as a duplicate of it, and the revocations it carried were lost. This PR keys CRLs by issuer name and Authority Key Identifier (AKID), and matches certs to CRLs the same way.
Behavior changes
Storing CRLs (
AddCRL,wolfSSL_CertManagerLoadCRL*,wolfSSL_X509_STORE_load_locations)DUPE_ENTRY_E, and loading a higher-numbered CRL from the other key evicted the stored one.DupCRL_Entrycleared it on copies.Checking a cert (
CheckCertCRL*,wolfSSL_CertManagerCheckCRL, handshake)CRL_MISSING, not success.CRL_CERT_DATE_ERR.CRL_MISSINGif none apply. Callers that tested forASN_CRL_CONFIRM_EorASN_CRL_NO_SIGNER_Efrom a cert check will now seeCRL_MISSINGor a result from another CRL.WOLFSSL_CRL_CHECKALLchain walk (ProcessPeerCertsChainCRLCheck)FindSignerByAkidOrName. PreviouslyGetCAByNamereturned whichever same-name root sorted first, which could be the root whose CRL isn't loaded.WOLFSSL_MAX_CHAIN_DEPTHwithASN_PATHLEN_SIZE_E. Previously a loop of two or more CAs was only stopped by a CRL error.wolfSSL_X509_STORE_add_crlNO_VERIFYload would.X509_STORE_add_crlreturns failure and the store is unchanged. The same checks now also run on the first add, when the store has no CRL yet.verifierKeyHash). A copy is accepted only if the store's signer for it has the same key.X509_STOREget_crlcallbackuserCrl->cmwas overwritten with the connection's CertManager, so one connection's verification result was cached on a CRL object the application might share with connections that use other trust stores. Now the CRL is verified against the connection's CAs on every use, and nothing is cached on it.Other
wolfSSL_X509_CRL_printprints the full 20-byte AKID. It used to stop at the first zero byte, and skipped the AKID entirely when the first byte was zero.test_sk_X509_CRL_encodewrites its generated CRLs tocerts/crl/gen/instead ofcerts/crl/. These CRLs really revokeserver-cert.pemandserver-ecc.pem, and the example client loads every CRL incerts/crl/, so it would then reject the test servers.scripts/crl-gen-openssl.testnow reads from the new path and deletes stale outputs first.Internal / ABI notes
CheckCertCRL_extakes a new trailingconst byte* akidargument (WOLFSSL_LOCAL).FindSignerByAkidOrNameis no longerstaticand returns the cert itself for a self-signed CA. The name-constraint walk already stops on self-signed CAs, so its behavior is unchanged.GetCATrustAnchor()inssl_certman.c.Signer.authKeyIdHashandauthKeyIdSetnow also exist whenHAVE_CRLis defined, even withIGNORE_NAME_CONSTRAINTS.CRL_EntrygainsverifierKeySetandverifierKeyHash. Both are internal structs, but their layout changes under these configs.Tests
certmanAPI tests:same_name_key_rollover.skip_unverifiable.X509_STORE_add_crlseries rules and copied entries:store_add_same_series,store_add_foreign_verified,store_add_foreign_key.crl_only_signing_key.other_key_fallback,other_key_trust_anchor.get_crlCRL shared across trust stores:get_crl_cb_shared.CRL_CHECKALLwalk:chain_same_name_key_rollover,chain_walk_follows_akid,chain_walk_cycle.test_wolfSSL_CRL_unverified_no_evictis extended to cover same-series and other-key bogus CRLs.tests/unit-mcdc/test_crl_whitebox.ccover the AKID decisions inAddCRLandCheckCertCRLList.certs/crl/gen/gen-crl-fixtures.shintotests/api/test_certman_crl_fixtures.h. They are valid 2026-01-01 to 2046-01-01, and the tests pin the clock withwc_SetTimeCb.Checklist