Repository navigation
Add configurable IV length for AES-GCM benchmark - #549
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change consistently applies the validated IV length, preserves existing defaults and buffer safety, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
This PR makes the AES-GCM benchmark IV length configurable, enabling 12-byte nonces while preserving the existing 16-byte default.
Changes:
- Adds
WOLFHSM_CFG_BENCH_AES_GCM_IV_SIZEwith compile-time validation for values from 1 to 16. - Applies the setting to standard and DMA encryption/decryption benchmarks while retaining full-block IV buffers.
- Documents the option and recommended 12-byte setting.
| File | Description |
|---|---|
benchmark/README.md |
Documents the IV length option, default, and supported range. |
benchmark/bench_modules/wh_bench_mod_aes.c |
Defines and validates the option and uses it in all four AES-GCM benchmark calls. |
Review effort: Balanced
kojiws
force-pushed
the
add_bench_aes_gcm_iv_length
branch
from
October 26, 2026 02:35
bfe225e to
7c15470
Compare
bigbrett
requested changes
Oct 26, 2026
bigbrett
left a comment
Contributor
There was a problem hiding this comment.
Great addition. I think we should just make the default 12 bytes too, and allow user to override if for some reason they want a slower implementation
kojiws
force-pushed
the
add_bench_aes_gcm_iv_length
branch
from
October 26, 2026 15:13
7c15470 to
6a4c89e
Compare
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.
Summary
Make the IV length used by the AES-GCM benchmarks configurable via a new macro,
WOLFHSM_CFG_BENCH_AES_GCM_IV_SIZE. The IV length was previously fixed at 16 bytes (sizeof(iv)), which made it impossible to benchmark with the recommended 96-bit (12-byte) GCM nonce.Changes
benchmark/bench_modules/wh_bench_mod_aes.cWOLFHSM_CFG_BENCH_AES_GCM_IV_SIZE, defaulting to 12.#error. The bound is written as the literal 16 becauseWC_AES_BLOCK_SIZEis an enum and cannot be evaluated by the preprocessor.ivbuffer itself staysWC_AES_BLOCK_SIZEbytes, since it is also passed towc_AesSetIV(), which always reads a full block.benchmark/README.md: document the new option.Usage
or
-DWOLFHSM_CFG_BENCH_AES_GCM_IV_SIZE=16in the compiler flags.Testing
Tested with wolfSSL v5.9.4-stable.
DMA=1with IV size 12 and 16, run with--type dma: builds and runs with no failures, including the AES-GCM DMA benchmarks.#error; 1, 12 and 16 build.