Skip to content

Commit 897c60c

Browse files
committed
Pass deterministic signing tests
1 parent 6d88434 commit 897c60c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

ml-dsa/tests/sig-gen.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,27 @@ fn acvp_sig_gen() {
1414

1515
// Verify the test vectors
1616
for tg in tv.test_groups {
17-
if tg.deterministic {
18-
// TODO(RLB): Implement the ML-DSA deterministic signature mode and use it for these
19-
// tests
20-
continue;
21-
}
22-
2317
for tc in tg.tests {
2418
match tg.parameter_set {
25-
acvp::ParameterSet::MlDsa44 => verify::<MlDsa44>(&tc),
26-
acvp::ParameterSet::MlDsa65 => verify::<MlDsa65>(&tc),
27-
acvp::ParameterSet::MlDsa87 => verify::<MlDsa87>(&tc),
19+
acvp::ParameterSet::MlDsa44 => verify::<MlDsa44>(&tc, tg.deterministic),
20+
acvp::ParameterSet::MlDsa65 => verify::<MlDsa65>(&tc, tg.deterministic),
21+
acvp::ParameterSet::MlDsa87 => verify::<MlDsa87>(&tc, tg.deterministic),
2822
}
2923
}
3024
}
3125
}
3226

33-
fn verify<P: MlDsaParams>(tc: &acvp::TestCase) {
27+
fn verify<P: MlDsaParams>(tc: &acvp::TestCase, deterministic: bool) {
3428
// Import the signing key
3529
let sk_bytes = EncodedSigningKey::<P>::try_from(tc.sk.as_slice()).unwrap();
3630
let sk = SigningKey::<P>::decode(&sk_bytes);
3731

3832
// Verify correctness
39-
let rnd = B32::try_from(tc.rnd.as_slice()).unwrap();
33+
let rnd = if deterministic {
34+
B32::default()
35+
} else {
36+
B32::try_from(tc.rnd.as_slice()).unwrap()
37+
};
4038
let sig = sk.sign_internal(&[&tc.message], &rnd);
4139
let sig_bytes = sig.encode();
4240

0 commit comments

Comments
 (0)