Skip to content

Commit

Permalink
group: remove unneeded normalize_weak in secp256k1_ge_is_valid_var
Browse files Browse the repository at this point in the history
After calculating the right-hand side of the elliptic curve equation
(x^3 + 7), the field element `x3` has a magnitude of 2 (1 as result of
`secp256k1_fe_mul`, then increased by 1 due to `secp256k1_fe_add_int`).
This is fine for `secp256k1_fe_equal_var`, as the second parameter only
requires the magnitude to not exceed 31, and the normalize_weak call can
hence be dropped.
  • Loading branch information
theStack committed Jun 12, 2023
1 parent 67214f5 commit efa76c4
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/group_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ static int secp256k1_ge_is_valid_var(const secp256k1_ge *a) {
secp256k1_fe_sqr(&y2, &a->y);
secp256k1_fe_sqr(&x3, &a->x); secp256k1_fe_mul(&x3, &x3, &a->x);
secp256k1_fe_add_int(&x3, SECP256K1_B);
secp256k1_fe_normalize_weak(&x3);
return secp256k1_fe_equal_var(&y2, &x3);
}

Expand Down

0 comments on commit efa76c4

Please sign in to comment.