Fix TLS CBC MAC verify and benchmark PQ option table for crypto callback builds - #11447
Open
dgarske wants to merge 2 commits into
Open
Fix TLS CBC MAC verify and benchmark PQ option table for crypto callback builds#11447dgarske wants to merge 2 commits into
dgarske wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Find-mapped callback devices can still select the raw-state verification path, and regression coverage is still needed.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request updates TLS CBC MAC verification for crypto-callback devices and fixes PQ benchmark compilation for NO_MAIN_DRIVER builds.
Changes:
- Routes callback-backed HMAC verification through public update/final operations.
- Aligns the PQ benchmark option-table guard with its use sites.
File summaries
| File | Description |
|---|---|
wolfcrypt/benchmark/benchmark.c |
Fixes conditional compilation of the PQ option table. |
src/tls.c |
Adjusts TLS CBC HMAC verification dispatch. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…vice is registered since the raw-hash constant-time path reads software hash state a device does not maintain
…ts use sites are compiled out
dgarske
force-pushed
the
cryptocb_fixes
branch
from
September 12, 2026 17:03
8252dd2 to
2581369
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical TLS CBC HMAC callback handling remains unresolved for INVALID_DEVID find mappings and needs regression coverage.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
| * software threat model. A device that declines HMAC and falls | ||
| * through to software then runs the same update/final variant | ||
| * FIPS and selftest builds always use (see the #else branch). */ | ||
| if (hmac->devId != INVALID_DEVID) { |
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.
PR: crypto callback TLS CBC MAC verify and benchmark NO_MAIN_DRIVER fixes
Two independent fixes for crypto callback devices backing the TLS and hash path, such as a wolfHSM offload port.
1. TLS CBC record MAC verification with a crypto callback device
TLS_hmac()verifies CBC record MACs withHmac_UpdateFinal_CT(), which reads the raw hash state viawc_Sha*FinalRaw(). A callback device that computes the HMAC never populates that software state, so the MAC comes out wrong and the peer reports a decrypt error on any MAC-then-Encrypt CBC suite. When the HMAC'sdevIdis a callback device,TLS_hmac()now usesHmac_UpdateFinal()instead: the public update/final path, which works for device-backed and software HMAC alike and keeps the Lucky13 padding-time equalization. It is the same variant FIPS and self-test builds already use.2. benchmark.c PQ option table under NO_MAIN_DRIVER
bench_pq_asym_opt[]is guarded by!WOLFSSL_BENCHMARK_ALL && !MAIN_NO_ARGS, but its only readers are inside#ifndef NO_MAIN_DRIVER, so aNO_MAIN_DRIVERbuild hits-Werror=unused-const-variable. Add!NO_MAIN_DRIVERto the guard.Test status
test_wc_CryptoCb_TLS_CBC_HMAC(tests/api.c) drives a TLS 1.2 CBC handshake through a callback device that owns the HMAC key and never populates the software hash state; it fails without fix 1 and passes with it. It needsWOLF_CRYPTO_CB_SETKEY, so a new.github/workflows/cryptocb-setkey.ymlrunsmake checkunder--enable-cryptocbutils=setkey.check-source-textclean.