tls: fix WolfSSL CA certificate buffer loading#3440
Merged
scaprile merged 1 commit intocesanta:masterfrom Feb 16, 2026
Merged
Conversation
Member
|
Thank you! |
Contributor
Author
|
This feels a bit intrusive in terms of personal information, but it’s done 🙂 |
Collaborator
|
Mac tests now pass. |
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.
Issue: #2821
Why ?
When using WolfSSL with Mongoose, loading CA certificates from a memory buffer often failed with "Invalid file" or ASN.1 parsing errors.
load_ca_certs) based on a stack ofX509_INFOstructures.What ? (the implemented fix)
The patch transitions from manual OpenSSL-style parsing to the native WolfSSL API for memory-based certificate loading.
Used
wolfSSL_CTX_load_verify_bufferdirectly whenMG_TLS_WOLFSSLis defined. This required implementing a forward declaration (extern) for the native WolfSSL function, which avoids including<wolfssl/ssl.h>and thereby prevents macro/type collisions with the OpenSSL compatibility headers already used by Mongoose.Finally, encapsulated OpenSSL-specific helpers (
load_ca_certs,add_ca_certs) within#if MG_TLS != MG_TLS_WOLFSSL. This keeps the binary lean and avoids "undefined symbol" errors for structures not used by WolfSSL.Tested on macOS, Apple Silicon (arm64), WolfSSL (Homebrew).