mirror of
https://github.com/RustCrypto/signatures
synced 2026-06-21 13:45:42 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user