@@ -14,29 +14,27 @@ fn acvp_sig_gen() {
14
14
15
15
// Verify the test vectors
16
16
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
-
23
17
for tc in tg. tests {
24
18
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 ) ,
28
22
}
29
23
}
30
24
}
31
25
}
32
26
33
- fn verify < P : MlDsaParams > ( tc : & acvp:: TestCase ) {
27
+ fn verify < P : MlDsaParams > ( tc : & acvp:: TestCase , deterministic : bool ) {
34
28
// Import the signing key
35
29
let sk_bytes = EncodedSigningKey :: < P > :: try_from ( tc. sk . as_slice ( ) ) . unwrap ( ) ;
36
30
let sk = SigningKey :: < P > :: decode ( & sk_bytes) ;
37
31
38
32
// 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
+ } ;
40
38
let sig = sk. sign_internal ( & [ & tc. message ] , & rnd) ;
41
39
let sig_bytes = sig. encode ( ) ;
42
40
0 commit comments