Skip to content

Commit

Permalink
Account for the cofactor when checking Hasse bound
Browse files Browse the repository at this point in the history
Fixes #4041
  • Loading branch information
randombit committed May 5, 2024
1 parent 7eb9dbb commit 2b8cf53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/pubkey/ec_group/ec_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ bool EC_Group::verify_group(RandomNumberGenerator& rng, bool strong) const {
}

// check the Hasse bound (roughly)
if((p - order).abs().bits() > (p.bits() / 2) + 1) {
if((p - get_cofactor() * order).abs().bits() > (p.bits() / 2) + 1) {
return false;
}

Expand Down

0 comments on commit 2b8cf53

Please sign in to comment.