From f1652528be5a287a3c33a4fae1e5763693333c2b Mon Sep 17 00:00:00 2001 From: stratospher <44024636+stratospher@users.noreply.github.com> Date: Thu, 15 Jun 2023 23:36:19 +0530 Subject: [PATCH] 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. --- src/secp256k1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/secp256k1.c b/src/secp256k1.c index bdbd97cc4088f..3851f9625af3a 100644 --- a/src/secp256k1.c +++ b/src/secp256k1.c @@ -247,8 +247,8 @@ static int secp256k1_pubkey_load(const secp256k1_context* ctx, secp256k1_ge* ge, } else { /* Otherwise, fall back to 32-byte big endian for X and Y. */ secp256k1_fe x, y; - secp256k1_fe_set_b32_mod(&x, pubkey->data); - secp256k1_fe_set_b32_mod(&y, pubkey->data + 32); + ARG_CHECK(secp256k1_fe_set_b32_limit(&x, pubkey->data)); + ARG_CHECK(secp256k1_fe_set_b32_limit(&y, pubkey->data + 32)); secp256k1_ge_set_xy(ge, &x, &y); } ARG_CHECK(!secp256k1_fe_is_zero(&ge->x));