You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Report the failing certificate field through the verify callback (1/6) - #12319
The verify callback and the CRL error callback are unchanged. Returning ok only logs. Returning a non-zero value from the verify callback still accepts the certificate. One certificate error calls that callback once.
Returning 0 from the CRL callback keeps the CRL failure. Returning non-zero waives a signature, signer, or nextUpdate failure. A bad encoding and an unknown critical extension stay failures, because the signature check has yet to run. A waived CRL is stored unverified, so the signature is checked again at use.
The store context carries the field, the reason, the condition, the role, and the extension OID of the one error that stopped the certificate. The CRL carries the same detail while the CRL callback runs, including a CRL that fails while it is loaded. X509_verify_cert fills the caller's store with that detail.
Test plan
./configure --enable-opensslextra --enable-crl CFLAGS="-Werror" and make
The leaf path called the verify callback and then called it again on the fatal exit. A CRL load waiver now keeps a CRL only when the signature check has run, and stores that CRL unverified. The caller's X509 store receives the failing field. Key usage, extended key usage, and CRL results are filled when the parser left them empty.
The verify callback and the CRL callback are unchanged. Returning ok only logs. Returning non-zero still accepts a certificate. Returning non-zero from the CRL callback still waives a signature, signer, or nextUpdate failure. This follows wolfSSL#12319, which replaced wolfSSL#11972 after the revert in wolfSSL#12297.
the make check linux (2) red here is the test's guards, not the parsing change, and it is not a compile break. i built it both ways at f9d7c8a.
--enable-coding=no turns off NO_CODING, which leaves WOLFSSL_PEM_TO_DER undefined, so there is no pem decoder. test_wolfSSL_CertVerifyDetail then dies on its pem ca:
f9d7c8a fixed the pqc variant of this, the coding=no one is still open. the date case is also the only thing in there that needs a clock, so NO_ASN_TIME belongs on that block rather than on the whole test.
the trap is that the outer condition appears twice, once at file scope over the verifyDetail struct and verifyDetailCb, once inside the function. i changed only the in-function copy the first time and got 'verifyDetail' undeclared. both copies have to stay identical.
this does not cost coverage in coding=no. the three der fixtures still run there, only the pem date case drops out, which the baseline run shows too since it got all the way to 6107 before failing.
so NO_ASN_TIME gains the test rather than skipping it.
separately, certs/test/include.am never picked up the six new certs/test/cert-detail/*.der fixtures, and nothing else in the build system names them, so make dist ships a tarball those tests cannot run from. one EXTRA_DIST += block fixes it.
sameehj
changed the title
Report the failing certificate field through the verify callback
Report the failing certificate field through the verify callback (1/6)
Dec 1, 2026
The guard fix and the dist entry are in c318fce. Both copies of the outer guard match. The date case requires WOLFSSL_PEM_TO_DER and a certificate time check, so the DER cases still run when the clock is off. certs/test/include.am ships the fixtures with one directory entry, EXTRA_DIST += certs/test/cert-detail.
This pull request is 1/6. The store and trust-anchor part and the CRL part will follow as the next pull requests on this callback.
Pull request wolfSSL#11972 added a separate certificate-event callback. Review found that the same information belongs on the verify callback and the CRL error callback. Pull request wolfSSL#12297 reverted wolfSSL#11972.
The verify callback and the CRL error callback are unchanged. Returning ok only logs. Returning non-zero from the verify callback still accepts the certificate. One certificate error calls that callback once.
Returning 0 from the CRL callback keeps the CRL failure. Returning non-zero waives a signature, signer, or nextUpdate failure. A bad encoding and an unknown critical extension stay failures. A waived CRL is stored unverified.
The store and the CRL carry the field, the reason, the condition, the role, and the extension OID of the one error that stopped the check. That includes a key below the minimum size, an issuer the peer sent that is not a CA, a CA without keyCertSign, an empty Certificate message, a chain past the depth limit, and a negative pathLen integer.
The OpenWrt 21.02 test fetches its package indexes from the archive.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical defects can bypass TLS Finished verification, accept incompletely parsed CRLs, and expose another verification’s callback details when thread-local storage is unavailable.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
In builds without real thread-local storage, uninitialized CRL error state can expose indeterminate metadata, while several verification paths omit or retain stale callback details.
After a callback waives a leaf error, X509StoreVerifyIssuer() can notify the trusted issuer with ok=1 while the detail still describes the leaf's failure. That helper resets and restores error and error_depth, but not the new detail members. Save, clear, and restore the detail around issuer notifications so a successful callback cannot expose another certificate's condition or extension OID.
Populate detail for path-length and invalid-CA failures
src/x509_str.c:726
X509StoreCheckPathLen() reports PATH_LENGTH_EXCEEDED after successful per-certificate checks have cleared the new detail, so its callback and the returned store expose condition NONE. Populate CHAIN/CONSTRAINT/CERT_PATH_LEN and the signer role before reporting that failure, clearing unrelated extension data. The direct INVALID_CA callback at src/x509_str.c:1277–1280 also needs matching chain-failure detail.
Capture OIDs for revoked-entry extensions
wolfcrypt/src/asn.c:40862
The OID is recorded only for CRL-level extensions. ParseCRL_EntryExtensions() also returns ASN_CRIT_EXT_E for an unknown critical revoked-entry extension, but never fills these members. For example, loading certs/crl/extra-crls/crl_critical_entry.pem with a CRL error callback reports CRL_EXT_UNKNOWN_CRITICAL while wolfSSL_CRL_get_error_ext_oid() returns NULL. Please retain the OID in the entry-extension parser too, so both rejection paths supply the advertised detail.
Long-form OID headers are not decoded
wolfcrypt/src/asn_orig.c:9755
A valid OID with 128 or more content octets uses a long-form DER length and skips this assignment entirely. With the original ASN parser, the normalized ASN_PARSE_E is then reported as ENCODING/CRL_FORMAT, with no extension OID. Decode the OID header with GetASNObjectId() rather than assuming a two-byte header.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The new error-detail API can retain stale expiry information after successful context reuse or incorrectly attribute an expired leaf’s failure to a successful issuer callback. Path-length failures, signature failures under WOLFSSL_SMALL_CERT_VERIFY, and critical revoked-entry extensions also lack expected detail or OID information. CRL-loading callbacks that return nonzero additionally need regression coverage to verify that permitted waivers remain unverified and are rechecked at use, while malformed and unknown-critical-extension CRLs remain rejected with both ASN parsers.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
With NO_ASN_TIME, the test still expects a not-yet-valid failure, but both date checks in X509StoreVerifyCert() are compiled out. No such failure reaches storeDetailCb, so the assertions at tests/api/test_certman.c:6721 compare zero-initialized fields against the expected validity error values and fail.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Certificate-version and invalid-CA rejection paths may provide incomplete failure details or incorrect certificate roles to verification callbacks, requiring human review of those paths.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Verification callbacks receive missing or misleading failure details: with ALLOW_V1_EXTENSIONS disabled, the template parser leaves version failures unidentified for v1/v2 certificates containing extensions; the non-CA issuer path can expose unset or stale details; and certificate and CRL checks with matching RSA-PSS OIDs but differing parameters report encoding/format errors instead of signature-algorithm mismatches.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
CRL load waivers change trust decisions across TLS and X.509 verification. It remains unconfirmed whether waiver ordering, signature rechecks, and fatal-certificate callbacks preserve the intended rejection and waiver semantics across both ASN.1 parsers and supported feature configurations, including platforms without real thread-local storage. Maintainer review and configuration-matrix runtime validation are needed to resolve these security-sensitive uncertainties.
A v1 or v2 certificate with extensions and a parameter mismatch were reaching the callback as an unnamed or generic format error. The error codes stay the same.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Certificate-version failures detected during TLS processing may leave both error getters reporting NONE, so the error classification behavior needs human review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
X509_verify_certfills the caller's store with that detail.Test plan
./configure --enable-opensslextra --enable-crl CFLAGS="-Werror"andmake./tests/unit.test -test_wolfSSL_CertVerifyDetail -test_wolfSSL_CrlVerifyDetail./tests/unit.test --group certman