[x509] native wn_x509 lightweight X.509 parser as default cert backend#90
Merged
Conversation
This was referenced Jul 1, 2026
SparkiDev
suggested changes
Jul 2, 2026
…fSSL-diff/verify/negative tests, fuzz, chain-anchor fix
…zed build-test + examples harness
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Adds
wn_x509, a hand-written zero-allocation X.509 v3 parser + verifier as anopt-in cert backend for the TLS 1.3 client (
WOLFNANO_X509_LITE,make X509_LITE=1).The default stays wolfSSL
asn.c/DecodedCert(full DN, policies, nameconstraints, CRL/OCSP, ML-DSA leaf keys). The cert path calls one stable
wn_X509_*seam; the backend is a compile-time choice.Provenance: the DER TLV layer is lifted from wolfTPM
tpm2_asn.c; the field walkfollows wolfSSL
examples/asn1/asn1.c+ RFC 5280. All signature math stays inwolfCrypt
wc_*. In-place references into the caller's DER, no allocation.Footprint (Cortex-M33,
-Os -flto -Wl,--gc-sections, ArmGNU 14.2)WOLFNANO_X509_LITE(native)The LITE backend drops
asn.c's reachable cert parser (~14-16 KB aftergc-sections) for the ~4-5 KB
wn_x509walker. Reproduce:sh bench/footprint-clients.sh.Parser + verify (feature-macro gated)
validity, subject CN; strict DER (minimal lengths, exact TLV consumption).
dNSName; critical-unknown fail-closed, duplicate-ext reject, dNSName
embedded-NUL reject.
presented intermediates, pinned anchor trusted a priori; pure-function
wn_X509_TimeValid(caller supplies the time via the XTIME seam).Intended scope (use the default asn.c backend for these): no DN name-chaining,
pathLen, name constraints, or CRL/OCSP; the model is a pinned trust anchor.
Testing (both backends, vs wolfSSL master + pin)
wc_ParseCertover 13 certs (ECC P-256/P-384, Ed25519,RSA-2048/3072), every field byte-compared.
certs/test/bad-*vectors; chain-verify, generated-PKI constraint tests, ML-DSA-44 leaf, libFuzzer harness.