From efa76c4bf7cab1c22aa476cd2730e891450ad4a0 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Mon, 12 Jun 2023 23:36:57 +0200 Subject: [PATCH] group: remove unneeded normalize_weak in `secp256k1_ge_is_valid_var` 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. --- src/group_impl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/group_impl.h b/src/group_impl.h index 44d98434..83a45c2d 100644 --- a/src/group_impl.h +++ b/src/group_impl.h @@ -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); }