Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the change making Zephyr’s smaller SHA-3/SHAKE implementation opt-in.
No open issues 🎉
What changed in this PR
Makes the smaller SHA-3/SHAKE implementation opt-in for Zephyr, favoring PQC performance by default at the cost of increased flash and stack usage.
Changes:
- Adds
CONFIG_WOLFSSL_SHA3_SMALL, disabled by default and restricted to compatible configurations. - Maps the new option to
WOLFSSL_SHA3_SMALLinstead of enabling it automatically for PQC builds.
| File | Description |
|---|---|
zephyr/user_settings.h |
Replaces the forced PQC small-permutation define with the Kconfig-controlled mapping. |
zephyr/Kconfig |
Adds the small-permutation option with assembly, FIPS, and user-settings restrictions. |
Review effort: Balanced
|
|
@claude review |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12239
Scan targets checked: wolfssl-pr-general
Review type: general (no scan target covers the changed files)
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Max
The module's user_settings.h defined WOLFSSL_SHA3_SMALL for every build with ML-KEM, ML-DSA, XMSS or Falcon enabled, FIPS v6 builds included. The small Keccak permutation runs about 1.5x slower: on STM32H743 (Cortex-M7) and RW612 (Cortex-M33) with the C permutation at -O2, it made BlockSha3 45-50% slower, ML-KEM-768 25-35% slower and ML-DSA-65 key generation and verification 36-43% slower. It saves about 3 KB of flash (2.8 KB at -Os) and 170 bytes of stack. Add CONFIG_WOLFSSL_SHA3_SMALL, default n, so PQC builds get the fast permutation and size-constrained targets can still opt in. The option is only offered where the C permutation is built: the Arm assembly BlockSha3 ignores WOLFSSL_SHA3_SMALL, FIPS v7 and FIPS Ready take their SHA-3 settings from user_settings-fips-v7.h, and FIPS v2 and v5 never defined it. Builds that supply their own settings file are unaffected. PQC builds without the Arm assembly grow by about 3 KB of flash and 170 bytes of stack unless they enable the option. Under FIPS v6 the compiled sha3.c changes, so the module has to be rehashed as after any other configuration change.
d6a45dd to
03eaddf
Compare
Description
The Zephyr module defined
WOLFSSL_SHA3_SMALLfor every build with ML-KEM, ML-DSA, XMSS or Falcon. That small Keccak permutation made ML-KEM-768 25-35% and ML-DSA-65 36-43% slower on Cortex-M7 and Cortex-M33 to save about 3 KB of flash and 170 bytes of stack. This turns it into an opt-in Kconfig option.Changes
CONFIG_WOLFSSL_SHA3_SMALL, default n, offered only where the C permutation is built (no Arm assembly, no FIPS v2/v5/v7/Ready, no user settings file).WOLFSSL_SHA3_SMALLinzephyr/user_settings.hinstead of forcing the define in the PQC block.Upgrade note
CONFIG_WOLFSSL_SHA3_SMALL=yto keep the old size.sha3.cdifferently and need the usual rehash.Testing
wolfssl_tls_sockandwolfssl_tls_threadsamples (ML-KEM on qemu_x86) now build the full C permutation.