Skip to content

Commit 78f43b3

Browse files
committed
Fixup verifying key
1 parent 79c61dc commit 78f43b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dsa/src/verifying_key.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,19 @@ impl VerifyingKey {
6767
if signature.r() >= q || signature.s() >= q {
6868
return Some(false);
6969
}
70+
let q = q.widen(s.bits_precision());
71+
let q = &q;
7072

71-
let w = Option::from(s.inv_mod(q))?;
73+
let w: BoxedUint = Option::from(s.inv_mod(q))?;
7274

7375
let n = q.bits() / 8;
7476
let block_size = hash.len(); // Hash function output size
7577

7678
let z_len = min(n as usize, block_size);
7779
let z = BoxedUint::from_be_slice(&hash[..z_len], z_len as u32 * 8).unwrap();
7880

81+
let z = z.widen(q.bits_precision());
82+
7983
let u1 = (&z * &w) % q;
8084
let u2 = r.mul_mod(&w, q);
8185

0 commit comments

Comments
 (0)