Skip to content

Commit f165252

Browse files
committed
Normalize ge produced from secp256k1_pubkey_load
The output ge is normalized when sizeof(secp256k1_ge_storage) = 64 but not when it's not 64. ARG_CHECK at the end of the function assumes normalization. So normalize ge in the other code path too.
1 parent 67214f5 commit f165252

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/secp256k1.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ static int secp256k1_pubkey_load(const secp256k1_context* ctx, secp256k1_ge* ge,
247247
} else {
248248
/* Otherwise, fall back to 32-byte big endian for X and Y. */
249249
secp256k1_fe x, y;
250-
secp256k1_fe_set_b32_mod(&x, pubkey->data);
251-
secp256k1_fe_set_b32_mod(&y, pubkey->data + 32);
250+
ARG_CHECK(secp256k1_fe_set_b32_limit(&x, pubkey->data));
251+
ARG_CHECK(secp256k1_fe_set_b32_limit(&y, pubkey->data + 32));
252252
secp256k1_ge_set_xy(ge, &x, &y);
253253
}
254254
ARG_CHECK(!secp256k1_fe_is_zero(&ge->x));

0 commit comments

Comments
 (0)