Skip to content

Commit

Permalink
Normalize ge produced from secp256k1_pubkey_load
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stratospher committed Jun 17, 2023
1 parent 67214f5 commit f165252
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/secp256k1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit f165252

Please sign in to comment.