I was surprised to see that this may be violated in secp256k1_eckey_pubkey_parse
:
https://github.com/bitcoin-core/secp256k1/blob/cc557575522c4cf11e5bcde1fea9637339cea21f/src/eckey_impl.h#L26-L31
I claim
ge(j)
objects should always represent valid points on the curve.- This invariant should be checked in VERIFY mode, in
secp256k1_ge(j)_verify
or at least insecp256k1_ge_set_xy
- There should be a separate function
secp256k1_ge_try_set_xy
which checks if (x,y) is on the curve, and only if yes, returns 1 and outputs age
. That function can be used to implementsecp256k1_eckey_pubkey_parse
. secp256k1_ge_is_valid_var
should be removed (or repurposed tosecp256k1_ge_verify_on_curve_var
without return value, as mentioned above).