Skip to content

Commit 182993f

Browse files
authored
dsa: adopt the crypto-bigint-backed rfc6979 implementation (#1396)
1 parent 4c13062 commit 182993f

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

dsa/src/generate/secret_number.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@ where
3636
let hash = (hash % q).to_be_bytes();
3737
let hash = truncate_hash(&hash, size);
3838

39-
let q_bytes = q.to_be_bytes();
40-
let q_bytes = truncate_hash(&q_bytes, size);
41-
4239
let x_bytes = Zeroizing::new(signing_key.x().to_be_bytes());
4340
let x_bytes = truncate_hash(&x_bytes, size);
4441

42+
let mut kgen = rfc6979::KGenerator::<D, BoxedUint>::new(x_bytes, hash, &[], q);
43+
4544
let mut buffer = vec![0; size];
4645
loop {
47-
rfc6979::generate_k_mut::<D>(x_bytes, q_bytes, hash, &[], &mut buffer);
46+
kgen.fill_next_k(&mut buffer);
4847

4948
let k = BoxedUint::from_be_slice(&buffer, q.bits_precision())
5049
.map_err(|_| signature::Error::new())?;

0 commit comments

Comments
 (0)