Skip to content

Add benchmark support for every ML-DSA and ML-KEM parameter set - #662

Open
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:bench_param_sets
Open

dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:bench_param_sets

Conversation

@dgarske

@dgarske dgarske commented Oct 30, 2026

Copy link
Copy Markdown
Member

Description

examples/bench/bench hardcoded TPM_MLDSA_65 and TPM_MLKEM_768, so it measured one parameter set per algorithm and had no reference to the other four at all. A part that implements 44, 87, 512 or 1024 was never exercised by the benchmark.

bench_pqc_mldsa and bench_pqc_mlkem now take the parameter set, and the caller walks ML-DSA 44, 65 and 87 and ML-KEM 512, 768 and 1024. The reported strength is the parameter set name rather than the enum value, so the output reads as before for the sets that were already covered.

A build without a given set needs no special handling: bench_asym_done already prints Skipped (not supported) and returns 0 for an unsupported scheme, so an absent set reports itself and the rest of the family still runs. The existing buffers already cover the largest set, MAX_MLDSA_SIG_SIZE being ML-DSA-87's 4627 bytes and the ML-KEM ciphertext buffer 1600 against ML-KEM-1024's 1568.

Testing

Against the fwTPM simulator with --enable-fwtpm --enable-v185, all eighteen rows appear and run: key generation, sign and verify at each ML-DSA set, and key generation, encapsulate and decapsulate at each ML-KEM set.

Builds clean with --enable-fwtpm, --enable-swtpm --disable-fwtpm and --enable-fwtpm --enable-v185, which covers the case where neither WOLFTPM_MLDSA nor WOLFTPM_MLKEM is defined and the new loop variables compile out.

@dgarske dgarske self-assigned this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant