Add ML-DSA 65/87 Sign/Verify/KeyGen benchmarks#488
Open
miyazakh wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds functional ML-DSA level 65/87 benchmark entry points (sign/verify/keygen, including DMA variants) and wires configuration so individual ML-DSA levels can be compiled out and benchmark comm buffers scale to the largest enabled level.
Changes:
- Implement ML-DSA 65/87 benchmark entry points by delegating to the shared ML-DSA helper routines with the requested parameter set.
- Extend ML-DSA helpers and vector compilation to support per-level feature gates (
WOLFSSL_NO_ML_DSA_44/65/87) and per-level test vectors. - Update benchmark configuration headers to expose per-level toggles and size
WOLFHSM_CFG_COMM_DATA_LENbased on enabled ML-DSA level(s).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| benchmark/bench_modules/wh_bench_mod_mldsa.c | Adds ML-DSA 65/87 benchmark entry points and extends helper logic/vectors to be parameter-set aware and feature-gated. |
| benchmark/config/user_settings.h | Adds per-ML-DSA-level compile-time toggles (disabled by default). |
| benchmark/config/wolfhsm_cfg.h | Includes user_settings.h early (when enabled) and sizes WOLFHSM_CFG_COMM_DATA_LEN to the largest enabled ML-DSA level. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #define WOLFSSL_MLDSA_NO_MAKE_KEY | ||
| #endif | ||
|
|
||
| /* The following options can be individually disabled ML-DSA levels */ |
Comment on lines
2733
to
2737
| /* Time only the verify operation */ | ||
| benchStartRet = wh_Bench_StartOp(ctx, id); | ||
| ret = wc_MlDsaKey_VerifyCtx(&key, ml_dsa_44_sig, | ||
| sizeof(ml_dsa_44_sig), NULL, 0, test_msg, | ||
| sizeof(test_msg), &verified); | ||
| ret = wc_MlDsaKey_VerifyCtx(&key, sigData, sigDataSz, NULL, 0, | ||
| test_msg, sizeof(test_msg), &verified); | ||
| benchStopRet = wh_Bench_StopOp(ctx, id); |
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.
Add ML-DSA 65/87 Sign/Verify/KeyGen benchmarks
Summary
wh_bench_mod_mldsa.c, which previously returnedWH_ERROR_NOTIMPLstubs._benchMlDsaSign/_benchMlDsaVerify/_benchMlDsaKeyGenhelpers to select the correct test key/message/signature data based on the requestedparamSet(WC_ML_DSA_44/WC_ML_DSA_65/WC_ML_DSA_87).WOLFSSL_NO_ML_DSA_44/65/87feature gates so any level can be individually disabled and its test data compiled out.user_settings.h,wolfhsm_cfg.h) to support the new levels.Changes
benchmark/bench_modules/wh_bench_mod_mldsa.cwh_Bench_Mod_MlDsa65{Sign,Verify,KeyGen}[Dma]andwh_Bench_Mod_MlDsa87{Sign,Verify,KeyGen}[Dma], which previously just returnedWH_ERROR_NOTIMPL; add ML-DSA 65/87 key/message/signature test vectors; guard each level's data and helper cases withWOLFSSL_NO_ML_DSA_44/65/87benchmark/config/user_settings.hWOLFSSL_NO_ML_DSA_44/65/87toggles so individual ML-DSA levels can be excluded from the buildbenchmark/config/wolfhsm_cfg.huser_settings.hearly so the ML-DSA feature gates are visible when sizing buffers; sizeWOLFHSM_CFG_COMM_DATA_LENto the largest enabled ML-DSA level (1280*8for 87,1280*5for 65,1280*4otherwise)Details
Benchmark entry points (
wh_bench_mod_mldsa.c)Previously,
wh_Bench_Mod_MlDsa65Sign/Verify/KeyGenand the corresponding ML-DSA 87 and DMA variants were stubs that unconditionally returnedWH_ERROR_NOTIMPL. They now call the shared_benchMlDsaSign,_benchMlDsaVerify, and_benchMlDsaKeyGenhelpers withWC_ML_DSA_65/WC_ML_DSA_87as the parameter set, matching the existing ML-DSA 44 pattern.The shared helpers were extended with a
switch (paramSet)to select the correct static test key (and, for verify, message/signature) buffer for the requested level, each guarded by the correspondingWOLFSSL_NO_ML_DSA_xxmacro so disabled levels don't pull in their test data.Config changes
WOLFHSM_CFG_COMM_DATA_LENmust be large enough to hold the biggest enabled ML-DSA level's key/signature payload for non-DMA client/server messages, so it now scales with which levels are enabled.wolfhsm_cfg.hneeds to see theWOLFSSL_NO_ML_DSA_xxgates fromuser_settings.hbefore computing that buffer size, souser_settings.his now included early (it's guarded, so the later include fromwh_settings.hremains a no-op).Impact
WOLFSSL_NO_ML_DSA_44/65/87, shrinking both the compiled test data and the comm buffer accordingly.