Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a10f61a
Confine callback-accepted chain CAs to their own connection
mattia-moffa Aug 7, 2026
f017778
Remove code repetition
mattia-moffa Sep 16, 2026
0cbac24
Fix test #define gating
mattia-moffa Sep 16, 2026
85a8592
Address Fenrir findings
mattia-moffa Sep 16, 2026
25fa25f
Fix handling of CAs waived by the verify callback
mattia-moffa Oct 14, 2026
93ac3a2
Fix server only build
mattia-moffa Oct 14, 2026
9888cf9
ParseCertRelative NO_SKID: don't rerun GetCA if CA already found
mattia-moffa Nov 6, 2026
54a28ec
Let OCSP find CAs the verify callback accepted
mattia-moffa Nov 6, 2026
89307a1
Ensure wolfSSL_clear() also clears the waived CA list
mattia-moffa Nov 6, 2026
6bf68e7
Let stapled OCSP responses find CAs accepted by verify callback
mattia-moffa Nov 7, 2026
9afe5a1
Don't cache chain CA whose CRL result was held for OCSP staple
mattia-moffa Nov 16, 2026
11dc317
Let CRL checks and X509_verify_cert find CAs waived by verify callback
mattia-moffa Nov 17, 2026
d58d991
Don't cache OCSP responses signed by a CA waived by cert callback
mattia-moffa Nov 17, 2026
e930d7c
Reset the waived CA list for each Certificate message
mattia-moffa Nov 17, 2026
4e49be4
Search the cert manager before the waived CA list
mattia-moffa Nov 17, 2026
6e052c2
Set the word32 unknown extension callback on the chain signer parse
mattia-moffa Nov 17, 2026
bfd5e47
Make the chain CA tests prove the connection's CA list is used
mattia-moffa Nov 17, 2026
b70240c
Resolve a chain signer's issuer in both pools
mattia-moffa Nov 17, 2026
e3e0145
Don't copy a CA into waived CA list if already in cert manager
mattia-moffa Nov 17, 2026
63bb22e
Fix CI failures on new chain CA test
mattia-moffa Nov 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions src/crl.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static int FindRevokedSerial(RevokedCert* rc, byte* serial, int serialSz,
/* cacheResult should only be set when cm is the owning cm of crl. A cached
* result is not valid for other cms because they can trust different CAs. */
static int VerifyCRLE(const WOLFSSL_CRL* crl, CRL_Entry* crle,
WOLFSSL_CERT_MANAGER* cm, int cacheResult)
WOLFSSL_CERT_MANAGER* cm, Signer* extraCa, int cacheResult)
{
Signer* ca = NULL;
SignatureCtx sigCtx;
Expand All @@ -510,6 +510,18 @@ static int VerifyCRLE(const WOLFSSL_CRL* crl, CRL_Entry* crle,
#else /* NO_SKID */
ca = GetCA(cm, crle->issuerHash);
#endif /* NO_SKID */
if (ca == NULL && extraCa != NULL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nothing in the suite covers a CRL issued by a waived CA. A memio case CRL-checking server-chain.pem against certs/crl/ca-int.pem and ca-int2.pem would lock this in.

ca = findSignerByName(extraCa, crle->issuerHash);
#ifndef NO_SKID
if ((ca != NULL) && crle->extAuthKeyIdSet &&
(XMEMCMP(ca->subjectKeyIdHash, crle->extAuthKeyId,
SIGNER_DIGEST_SIZE) != 0)) {
ca = NULL;
}
#endif
if (ca != NULL)
cacheResult = 0;
}
if (ca == NULL) {
WOLFSSL_MSG("Did NOT find CRL issuer CA");
return ASN_CRL_NO_SIGNER_E;
Expand Down Expand Up @@ -538,7 +550,7 @@ static int VerifyCRLE(const WOLFSSL_CRL* crl, CRL_Entry* crle,

static int CheckCertCRLList(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
int serialSz, byte* serialHash, int *pFoundEntry,
WOLFSSL_CERT_MANAGER* cm)
WOLFSSL_CERT_MANAGER* cm, Signer* extraCa)
{
CRL_Entry* crle;
int foundEntry = 0;
Expand All @@ -558,7 +570,7 @@ static int CheckCertCRLList(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
if (cm != crl->cm) {
/* cm is not the owning cm of crl. The cached result is only
* valid for the owning cm. Verify again without caching. */
ret = VerifyCRLE(crl, crle, cm, 0);
ret = VerifyCRLE(crl, crle, cm, extraCa, 0);
if (ret != 0) {
WOLFSSL_MSG("Cannot use CRL as it didn't verify");
break;
Expand All @@ -574,7 +586,7 @@ static int CheckCertCRLList(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
/* A different thread may have verified the entry while we
* were waiting for the mutex. */
if (crle->verified == 0)
ret = VerifyCRLE(crl, crle, cm, 1);
ret = VerifyCRLE(crl, crle, cm, extraCa, 1);

wc_UnLockMutex(&crle->verifyMutex);

Expand Down Expand Up @@ -629,7 +641,7 @@ static int CheckCertCRLList(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
static int CheckCertCRLCm(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
int serialSz, byte* serialHash, const byte* extCrlInfo,
int extCrlInfoSz, void* issuerName, WOLFSSL_CERT_MANAGER* cm,
int canRetry)
int canRetry, Signer* extraCa)
{
int foundEntry = 0;
int ret = 0;
Expand All @@ -651,7 +663,7 @@ static int CheckCertCRLCm(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
#endif

ret = CheckCertCRLList(crl, issuerHash, serial, serialSz, serialHash,
&foundEntry, cm);
&foundEntry, cm, extraCa);

#ifdef HAVE_CRL_IO
if (foundEntry == 0) {
Expand All @@ -665,7 +677,7 @@ static int CheckCertCRLCm(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
else if (cbRet >= 0) {
/* try again */
ret = CheckCertCRLList(crl, issuerHash, serial, serialSz,
serialHash, &foundEntry, cm);
serialHash, &foundEntry, cm, extraCa);
}
}
}
Expand All @@ -684,7 +696,7 @@ static int CheckCertCRLCm(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
if (loadRet == WOLFSSL_SUCCESS) {
/* try again */
ret = CheckCertCRLList(crl, issuerHash, serial, serialSz,
serialHash, &foundEntry, cm);
serialHash, &foundEntry, cm, extraCa);
}
}
}
Expand Down Expand Up @@ -731,10 +743,10 @@ static int CheckCertCRLCm(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,

int CheckCertCRL_ex(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
int serialSz, byte* serialHash, const byte* extCrlInfo,
int extCrlInfoSz, void* issuerName)
int extCrlInfoSz, void* issuerName, Signer* extraCa)
{
return CheckCertCRLCm(crl, issuerHash, serial, serialSz, serialHash,
extCrlInfo, extCrlInfoSz, issuerName, crl->cm, 1);
extCrlInfo, extCrlInfoSz, issuerName, crl->cm, 1, extraCa);
}

/* Get the issuer X509_NAME of cert to pass to CheckCertCRLCm(). */
Expand All @@ -754,28 +766,28 @@ static void* CertCrlIssuerName(DecodedCert* cert)
}

static int CheckDecodedCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert,
WOLFSSL_CERT_MANAGER* cm, int canRetry)
WOLFSSL_CERT_MANAGER* cm, int canRetry, Signer* extraCa)
{
void* issuerName = CertCrlIssuerName(cert);

return CheckCertCRLCm(crl, cert->issuerHash, cert->serial, cert->serialSz,
NULL, cert->extCrlInfo, cert->extCrlInfoSz, issuerName, cm,
canRetry);
canRetry, extraCa);
}

/* Is the cert ok with CRL, return 0 on success */
int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert, Signer* extraCa)
{
return CheckDecodedCertCRL(crl, cert, crl->cm, 1);
return CheckDecodedCertCRL(crl, cert, crl->cm, 1, extraCa);
}

/* Check cert against crl using cm for CRL signature verification. Does not
* modify crl, so crl can be a caller-owned object shared between threads.
* Return 0 on success. */
int CheckCertCRLFromCm(WOLFSSL_CERT_MANAGER* cm, WOLFSSL_CRL* crl,
DecodedCert* cert)
DecodedCert* cert, Signer* extraCa)
{
return CheckDecodedCertCRL(crl, cert, cm, 0);
return CheckDecodedCertCRL(crl, cert, cm, 0, extraCa);
}

#ifdef HAVE_CRL_UPDATE_CB
Expand Down
Loading
Loading