Fix multiple issues with WOLFSSL_CHECK_SIG_FAULTS + HAVE_PK_CALLBACKS. - #11000
Fix multiple issues with WOLFSSL_CHECK_SIG_FAULTS + HAVE_PK_CALLBACKS.#11000kareem-wolfssl wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes fault-hardening signature verification paths when WOLFSSL_CHECK_SIG_FAULTS is enabled alongside HAVE_PK_CALLBACKS, avoiding NULL dereferences when ssl->buffers.key is intentionally absent, and corrects the SM2/SM3 verify call to match the signing input.
Changes:
- Guard PK-callback key-buffer access (
ssl->buffers.key) in TLS 1.3 and TLS 1.2 fault-check verification paths. - Align TLS 1.2 SM2/SM3 verification with the SM2/SM3 signing input (verify over handshake messages, not the digest).
- Expand CI coverage by adding faultharden-enabled configurations to existing GitHub Actions workflows.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/tls13.c | Prevents NULL dereference when building PK-callback key buffer info for fault-check ECC verify in TLS 1.3. |
| src/internal.c | Fixes NULL deref for PK-callback key buffer info in multiple TLS 1.2 fault-check verify sites and corrects SM2/SM3 verify input to match signing. |
| .github/workflows/wolfsm.yml | Adds an SM-focused faultharden CI configuration. |
| .github/workflows/os-check.yml | Adds an all-config faultharden CI configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Frauschi
left a comment
There was a problem hiding this comment.
🐺 Skoll Code Review
Overall recommendation: APPROVE
Findings: 4 total — 4 posted, 0 skipped
Posted findings
- [Medium] New sm-faultharden CI config omits PK callbacks, so the SM2 + HAVE_PK_CALLBACKS code this PR fixes is still never compiled —
.github/workflows/wolfsm.yml:101 - [Medium] Fault check still runs without usable key material when the private key is held by a PK callback, so the handshake fails —
src/internal.c:38600 - [Medium] No test exercises the NULL private-key scenario the PR fixes; CI additions give compile coverage only —
.github/workflows/os-check.yml:168 - [Low] Dual-algorithm alt-key site left with the unguarded dereference pattern —
src/tls13.c:10727
Review generated by Skoll via Claude/Codex
|
Three CI notes, from having built these combinations while chasing a related async NULL deref in 1. The 2. Offering a second entry, if you want it in the same PR. {"name": "pkcallbacks-testprivkey", "minutes": 1.5,
"comment": "TEST_PK_PRIVKEY makes the examples leave the private key to the PK callback, so ssl->buffers.key stays NULL. Without it scripts/pkcallbacks.test always runs with the key loaded and never reaches those branches",
"configure": ["--enable-pkcallbacks", "CPPFLAGS=-DTEST_PK_PRIVKEY"]}Verified locally with the CFLAGS the workflow applies at make time: it configures, builds without warnings, and It has to stay separate from 3. |
|
Retest this please |
Fix passing in NULL key to PK callbacks. Fix --enable-all + TEST_PK_PRIVKEY build (DTLS and benchmark issues).
…h --enable-all --enable-pkcallbacks are now resolved.
Description
Fixes zd#22213
Fixes NULL deref since ssl->buffers.key is expected to be NULL when using WOLFSSL_CHECK_SIG_FAULTS + HAVE_PK_CALLBACKS.
Fixes Sm2wSm3Verify call to match the earlier Sm2wSm3Sign call.
Testing
Built in tests
Checklist