Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Commit

Permalink
derisk collision attack
Browse files Browse the repository at this point in the history
  • Loading branch information
Akilesh Tangella authored and Akilesh Tangella committed Jul 4, 2023
1 parent 3eda848 commit 224f6e9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions circuit/src/ecc/generic/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ where

let r_point = v_1.add(&v_2);
let x_candidate = r_point.x;
let r_mod_n = <P as RnsParams<Fq, N, NUM_LIMBS, NUM_BITS>>::compose(r.limbs);
let x_candidate_mod_n =
<P as RnsParams<Fp, N, NUM_LIMBS, NUM_BITS>>::compose(x_candidate.limbs);
r_mod_n == x_candidate_mod_n
for i in 0..NUM_LIMBS {
if x_candidate.limbs[i] != r.limbs[i] {
return false;
}
}
return true;
}
}

Expand Down

0 comments on commit 224f6e9

Please sign in to comment.