Skip to content

Commit fd67b8d

Browse files
committed
feat: add SLH-DSA-SHA2 to bench driver and parser
- pqc_bench.sh: enable-slhdsa=yes,sha2 in configure flags; add six SHA2 run_bench calls alongside the existing SHAKE set - pqc_parse.py: add _WOLFSSL_SLHDSA_SHA2_RE pattern to normalise wolfSSL SLH-DSA-SHA2-[SF] names to canonical SLH-DSA-SHA2-{bits}{sf}
1 parent 0879d0c commit fd67b8d

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

wolfcrypt/benchmark/pqc_bench.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ if [ "$SKIP_BUILD" -eq 0 ]; then
169169
./configure \
170170
--enable-mlkem \
171171
--enable-dilithium \
172-
--enable-slhdsa \
172+
"--enable-slhdsa=yes,sha2" \
173173
--enable-memory \
174174
"--enable-trackmemory=verbose" \
175175
"--enable-stacksize=verbose" \
@@ -247,14 +247,22 @@ run_bench "ML-KEM-1024" -kyber1024
247247
# '-ml-dsa' benchmarks all three security levels (44/65/87) in one pass.
248248
run_bench "ML-DSA (levels 44/65/87)" -ml-dsa
249249

250-
# SLH-DSA (NIST FIPS 205, formerly SPHINCS+) — all parameter sets
250+
# SLH-DSA (NIST FIPS 205, formerly SPHINCS+) — SHAKE parameter sets
251251
run_bench "SLH-DSA-SHAKE-128s" -slhdsa-shake128s
252252
run_bench "SLH-DSA-SHAKE-128f" -slhdsa-shake128f
253253
run_bench "SLH-DSA-SHAKE-192s" -slhdsa-shake192s
254254
run_bench "SLH-DSA-SHAKE-192f" -slhdsa-shake192f
255255
run_bench "SLH-DSA-SHAKE-256s" -slhdsa-shake256s
256256
run_bench "SLH-DSA-SHAKE-256f" -slhdsa-shake256f
257257

258+
# SLH-DSA (NIST FIPS 205) — SHA2 parameter sets
259+
run_bench "SLH-DSA-SHA2-128s" -slhdsa-sha2-128s
260+
run_bench "SLH-DSA-SHA2-128f" -slhdsa-sha2-128f
261+
run_bench "SLH-DSA-SHA2-192s" -slhdsa-sha2-192s
262+
run_bench "SLH-DSA-SHA2-192f" -slhdsa-sha2-192f
263+
run_bench "SLH-DSA-SHA2-256s" -slhdsa-sha2-256s
264+
run_bench "SLH-DSA-SHA2-256f" -slhdsa-sha2-256f
265+
258266
echo ""
259267

260268
# ---------------------------------------------------------------------------

wolfcrypt/benchmark/pqc_parse.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,11 @@ def make_record(
109109
# ---------------------------------------------------------------------------
110110

111111
# wolfSSL emits "ML-KEM 512 " (space-separated, trailing space)
112-
_WOLFSSL_MLKEM_RE = re.compile(r"ML-KEM\s+(\d+)\s*$", re.IGNORECASE)
113-
_WOLFSSL_MLDSA_RE = re.compile(r"ML-DSA\s*$", re.IGNORECASE)
114-
_WOLFSSL_SLHDSA_RE = re.compile(r"SLH-DSA-([SF])\s*$", re.IGNORECASE)
115-
_WOLFSSL_DILITH_RE = re.compile(r"DILITHIUM\s*$", re.IGNORECASE)
112+
_WOLFSSL_MLKEM_RE = re.compile(r"ML-KEM\s+(\d+)\s*$", re.IGNORECASE)
113+
_WOLFSSL_MLDSA_RE = re.compile(r"ML-DSA\s*$", re.IGNORECASE)
114+
_WOLFSSL_SLHDSA_SHA2_RE = re.compile(r"SLH-DSA-SHA2-([SF])\s*$", re.IGNORECASE)
115+
_WOLFSSL_SLHDSA_RE = re.compile(r"SLH-DSA-([SF])\s*$", re.IGNORECASE)
116+
_WOLFSSL_DILITH_RE = re.compile(r"DILITHIUM\s*$", re.IGNORECASE)
116117

117118
# Canonical algorithm names already in NIST form (liboqs / OpenSSL / CIRCL)
118119
_CANONICAL_RE = re.compile(
@@ -152,6 +153,10 @@ def normalise_algorithm(raw_algo: str, raw_keysize: str = "") -> str:
152153
if _WOLFSSL_MLDSA_RE.match(algo):
153154
return f"ML-DSA-{keysize}"
154155

156+
m = _WOLFSSL_SLHDSA_SHA2_RE.match(algo)
157+
if m:
158+
return f"SLH-DSA-SHA2-{keysize}{m.group(1).lower()}"
159+
155160
m = _WOLFSSL_SLHDSA_RE.match(algo)
156161
if m:
157162
return f"SLH-DSA-SHAKE-{keysize}{m.group(1).lower()}"

0 commit comments

Comments
 (0)