Skip to content

Commit

Permalink
musig: VERIFY_CHECK preconditions of _musig_keyaggcoef_internal()
Browse files Browse the repository at this point in the history
  • Loading branch information
real-or-random committed Apr 21, 2023
1 parent da77028 commit a0b51af
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modules/musig/keyagg_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ static void secp256k1_musig_keyaggcoef_sha256(secp256k1_sha256 *sha) {
static void secp256k1_musig_keyaggcoef_internal(secp256k1_scalar *r, const unsigned char *pk_hash, secp256k1_ge *pk, const secp256k1_ge *second_pk) {
secp256k1_sha256 sha;

VERIFY_CHECK(!secp256k1_ge_is_infinity(pk));
#ifdef VERIFY
VERIFY_CHECK(pk->x.normalized && pk->y.normalized);
VERIFY_CHECK(secp256k1_ge_is_infinity(second_pk) || (second_pk->x.normalized && second_pk->y.normalized));
#endif

if (!secp256k1_ge_is_infinity(second_pk)
&& secp256k1_fe_equal(&pk->x, &second_pk->x)
&& secp256k1_fe_is_odd(&pk->y) == secp256k1_fe_is_odd(&second_pk->y)) {
Expand Down

0 comments on commit a0b51af

Please sign in to comment.