headers: resolve wolfSSL's config through settings.h - #31
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review comments were identified, and all supplied assessments indicate approval readiness.
Pull request overview
This PR standardizes wolfSSL configuration resolution through settings.h and improves header-only integration.
Changes:
- Removed redundant direct
options.hinclusions. - Added configuration-resolution and freestanding regression checks.
- Updated documentation, examples, workflows, and lint coverage.
File summaries
| File | Summary |
|---|---|
wolfcert/memory.h |
Resolves wolfSSL settings consistently. |
wolfcert/check_config.h |
Validates settings through settings.h. |
src/scep/scep_server.c |
Removes redundant options include. |
src/scep/scep_msg.c |
Removes redundant options include. |
src/scep/scep_client.c |
Removes redundant options include. |
src/pkcs7_util.c |
Removes redundant options include. |
src/key_algs.h |
Relies on centralized configuration. |
src/internal.h |
Removes redundant options include. |
src/est/est_server.c |
Removes redundant options include. |
src/ca_issue.c |
Removes redundant options include. |
scripts/ci/config-probe.c |
Adds configuration probing. |
scripts/ci/compile-freestanding.sh |
Tests native user-settings resolution. |
scripts/ci/check-config-resolution.sh |
Verifies consistent configuration resolution. |
examples/user_settings.h.example |
Clarifies shared configuration usage. |
docs/EMBEDDED.md |
Documents settings resolution. |
docs/CI.md |
Documents the new CI gate. |
.github/workflows/pr.yml |
Runs configuration-resolution checks. |
.github/workflows/lint.yml |
Extends license-header checks. |
Review details
- Files reviewed: 18/18 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #31
Scan targets checked: wolfcert-src, wolfcert-bugs
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
c883790 to
cb9ee51
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #31
Scan targets checked: wolfcert-src, wolfcert-bugs
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
cb9ee51 to
b9697b8
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #31
Scan targets checked: wolfcert-src, wolfcert-bugs
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
fa11a54 to
2e8cc06
Compare
Frauschi
left a comment
There was a problem hiding this comment.
Went through the config-resolution change carefully and reproduced each of these against the current head.
The headline one is that the umbrella path still diverges from the est.h path. wolfcert.h includes memory.h before types.h, so memory.h evaluates the eight new selectors before user_settings.h has been read. With WOLFSSL_NO_OPTIONS_H set inside user_settings.h - which examples/user_settings.h.example encourages - <wolfcert/est.h> builds and <wolfcert/wolfcert.h> fails outright. That is the same per-translation-unit split this PR sets out to remove, moved one layer up, and swapping two lines in wolfcert.h closes it.
Second thing worth settling before merge: the include-order invariant has no diagnostic at all under WOLFCERT_NO_WOLFSSL_FEATURE_CHECK, and docs/EMBEDDED.md states the wrong precondition for it. The rest are smaller - a probe that reports a false negative, a dead settings.h include, and a set -e abort that truncates the new gate's own report.
The approach is right and the new gate is a good idea. I would just like it to catch the case above before this goes in.
bf56473 to
e665642
Compare
|
Thank you @Frauschi for reviewing. |
Frauschi
left a comment
There was a problem hiding this comment.
Second round. All seven comments from the first round are fixed - I re-ran both original reproductions rather than reading the diff, and both are closed: the WOLFCERT_NO_WOLFSSL_FEATURE_CHECK path now errors on both entry headers where it used to link a sizeof mismatch, and the WOLFSSL_NO_OPTIONS_H-inside-user_settings.h case now preprocesses identically from est.h and wolfcert.h. Locally 29/29 with no warnings, and the branch rebases clean onto current main.
Two gaps left, both small, and both about the fix surviving rather than the fix being right:
- The
wolfcert.hordering fix has no regression test - the gate is green with it reverted (mutation-proved below). memory.hstill has no ordering diagnostic, so the silent ABI mismatch is closed on one of the two readers.
Details inline.
e665642 to
182ee50
Compare
- check_config.h includes <wolfssl/wolfcrypt/settings.h> in place of <wolfssl/options.h>, defining WOLFSSL_USE_OPTIONS_H first unless WOLFSSL_USER_SETTINGS, WOLFSSL_NO_OPTIONS_H, WOLFSSL_CUSTOM_CONFIG, ARDUINO, PLATFORMIO, USE_HAL_DRIVER, NUCLEUS_PLUS_2_3 or WOLFSSL_MX2_CONF_INCLUDE is defined. It resolves this above tier 1 and stops a build whose wolfSSL header arrived first, with the tier-2 checks silent in that case. - memory.h reaches that resolution through <wolfcert/types.h>; wolfcert.h includes types.h before memory.h; CMakeLists.txt and configure.ac probe wolfSSL through the same preamble. - The 32 files that included <wolfssl/options.h> after a wolfCert header drop that include, internal.h drops its settings.h include, and compile-freestanding.sh stages no options.h. - scripts/ci/check-config-resolution.sh compares what <wolfcert/est.h> and <wolfcert/wolfcert.h> resolve from scripts/ci/config-probe.c against a disagreeing options.h, over five cases; pr.yml runs it in no-posix-arm and lint.yml covers scripts/ci/*.c and *.h. - docs/EMBEDDED.md and docs/CI.md describe the new behaviour; examples/user_settings.h.example and memory.h's comments name the macros integrators actually define.
182ee50 to
688ef57
Compare
Problem
wolfCert read wolfSSL's feature set in two public headers that resolved it
independently —
wolfcert/memory.handwolfcert/check_config.h— both via abare
<wolfssl/options.h>, which a wolfSSL configured by its ownuser_settings.hdoes not meaningfully have.wolfcert.hreachesmemory.hbeforetypes.hwhile every other public headergoes straight to
types.h→check_config.h, so the two readers disagree andthe project compiles or fails per translation unit under identical flags:
#include <wolfcert/wolfcert.h>#include <wolfcert/est.h>Fix
check_config.hresolves the feature set once:check_config.hthis sits above tier 1, sotypes.halways reacheswolfSSL's config;
WOLFCERT_NO_WOLFSSL_FEATURE_CHECKnow skips the tier-2#errorchecks only.CMakeLists.txtandconfigure.acprobe through the same preamble, soconfigure no longer rejects a
--enable-usersettingswolfSSL the headersaccept.
memory.hreaches that resolution through<wolfcert/types.h>rather thanrepeating the selectors, and
wolfcert.hincludestypes.hbefore it.Previously a selector set inside
user_settings.hresolved differently perTU, and
<wolfcert/memory.h>alone had no ordering check at all.options.hunread — silent otherwise, and silent here means a linked ABImismatch. It sits outside the tier-2 gate, and silences tier 2 when it fires,
since that feature set was never resolved: one error instead of twelve.
src/,tests/,cli/andexamples/included<wolfssl/options.h>after a wolfCert header, re-applying a foreign build'smacros over the validated config. Deleted, not guarded.
Tests
scripts/ci/check-config-resolution.shpreprocesses one<wolfcert/est.h>andone
<wolfcert/wolfcert.h>TU and compares resolved macros, exit status anddiagnostics. Each case stages an
options.hthat disagrees withuser_settings.h; an absent or forwarding one lets both agree for the wrongreason.
WOLFSSL_USER_SETTINGSusersettings-winsoptions.hoptionsh-decoy#errorsoptionsh-winsoptions.hwolfssl-header-firstselector-in-user-settingscompile-freestanding.shno longer fabricates anoptions.hstub, so itindependently catches the same defect for the 5 sources in its compile set.
Verification
WOLFSSL_NO_OPTIONS_Hset insideuser_settings.h, and underWOLFCERT_CUSTOM_ALLOCwith-Werror.check_config.h-only andmemory.h-onlyeach fail; reverting
memory.halone reddens the freestanding gate.Not in this PR
The selector block is still written out three times —
check_config.h,CMakeLists.txtandconfigure.ac— and the gate compares only the headers, soheader/build-file drift would have configure probing a different feature set
than the headers compile against. One internal header included by both would
close it by construction.