musig: ensure point_load output is normalized

This is similar to the upstream commit "Normalize ge produced from
secp256k1_pubkey_load".
This commit is contained in:
Jonas Nick 2023-07-25 07:28:33 +00:00
parent 7a07f3d33f
commit e593ed5685
No known key found for this signature in database
GPG Key ID: 4861DBF262123605

View File

@ -41,8 +41,10 @@ static void secp256k1_point_load(secp256k1_ge *ge, const unsigned char *data) {
} else { } else {
/* Otherwise, fall back to 32-byte big endian for X and Y. */ /* Otherwise, fall back to 32-byte big endian for X and Y. */
secp256k1_fe x, y; secp256k1_fe x, y;
secp256k1_fe_set_b32_mod(&x, data); int ret = 1;
secp256k1_fe_set_b32_mod(&y, data + 32); ret &= secp256k1_fe_set_b32_limit(&x, data);
ret &= secp256k1_fe_set_b32_limit(&y, data + 32);
VERIFY_CHECK(ret);
secp256k1_ge_set_xy(ge, &x, &y); secp256k1_ge_set_xy(ge, &x, &y);
} }
} }