Skip to content

Add true zero-allocation X.509 certificate verification under WOLFSSL_NO_MALLOC#10821

Open
aidangarske wants to merge 1 commit into
masterfrom
feature/x509-no-malloc-verify
Open

Add true zero-allocation X.509 certificate verification under WOLFSSL_NO_MALLOC#10821
aidangarske wants to merge 1 commit into
masterfrom
feature/x509-no-malloc-verify

Conversation

@aidangarske

Copy link
Copy Markdown
Member

Makes the X.509 verify path (wc_ParseCert) truly be no malloc, so embedded/no-heap builds can validate certificate chains without dynamic memory.

Previously a strict no-heap build failed to parse any real certificate. The public-key copy (StoreKey/StoreEccKey) and the SubjectAltName list (AltNameNew/SetDNSEntry) needed the heap and returned MEMORY_E. This references the public key and alt-name strings in place in the source DER (the same contract wolfSSL already uses for subjectCN), with SAN entries held in a fixed per-cert pool (WC_ASN_MAX_ALTNAMES, default 8).

Gated by a new internal WC_ASN_NO_HEAP (WOLFSSL_NO_MALLOC && NO_WOLFSSL_MEMORY && !XMALLOC_USER && !WOLFSSL_STATIC_MEMORY): only builds with genuinely no allocator take the in-place path; builds with a real allocator (callbacks, XMALLOC_USER, static memory) keep the existing heap paths. Default malloc builds are byte-for-byte unchanged

Under no-heap, IP/RID SANs (which need a heap-synthesized string) and CertManager CA storage are fail-closed (documented limitations). Adds a heap-free parse test (cert_no_malloc_test).

@aidangarske aidangarske self-assigned this Jun 30, 2026
@aidangarske aidangarske requested a review from dgarske June 30, 2026 19:08
@aidangarske aidangarske marked this pull request as ready for review June 30, 2026 19:08
@github-actions

Copy link
Copy Markdown

retest this please

@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

gcc-arm-cortex-m0plus

  • FLASH: .text +8 B (+0.0%, 63,591 B / 262,144 B, total: 24% used)

gcc-arm-cortex-m3

  • FLASH: .text +8 B (+0.0%, 121,541 B / 262,144 B, total: 46% used)

gcc-arm-cortex-m4-pq

  • FLASH: .text +64 B (+0.0%, 278,128 B / 1,048,576 B, total: 27% used)

stm32-sim-stm32h753

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.

2 participants