ml-dsa: fix hardcoded MlDsa44 in Wycheproof verification tests (#1382)

The mldsa_verify_test macro previously hardcoded MlDsa44 for decoding both verifying keys and signatures. Due to public key length mismatches, this caused tests for ML-DSA-65 and ML-DSA-87 to fail type conversion and be silently skipped.

Using $params ensures test vectors for all parameter sets are properly decoded and verified.
This commit is contained in:
Lukas Zobernig
2026-06-17 16:03:34 +02:00
committed by GitHub
parent a08448edee
commit 58ce150e60
+2 -2
View File
@@ -114,7 +114,7 @@ macro_rules! mldsa_verify_test {
for group in &tests.groups {
if let Ok(encoded_vk) = group.public_key.as_slice().try_into() {
let vk = VerifyingKey::<MlDsa44>::decode(&encoded_vk);
let vk = VerifyingKey::<$params>::decode(&encoded_vk);
for test in &group.tests {
println!("Test #{}: {} ({:?})", test.id, &test.comment, &test.result);
@@ -123,7 +123,7 @@ macro_rules! mldsa_verify_test {
.as_slice()
.try_into()
.ok()
.and_then(|sig| Signature::<MlDsa44>::decode(&sig))
.and_then(|sig| Signature::<$params>::decode(&sig))
{
if test.ctx.is_empty() {
let result = vk.verify(&test.msg, &sig);