secp256k1-zkp icon indicating copy to clipboard operation
secp256k1-zkp copied to clipboard

fix and verify `compressed` argument in _eckey_pubkey_serialize calls

Open theStack opened this issue 1 year ago • 1 comments

In several calls of the internal function secp256k1_eckey_pubkey_serialize, the public API flag SECP256K1_EC_COMPRESSED is passed, which is meant to be only used for the public function secp256k1_ec_pubkey_serialize. It works as intended in all of those cases (it wouldn't for SECP256K1_EC_UNCOMPRESSED though), but it's still kind of a type mismatch that can't be detected by the compiler. To avoid cases like this in the future, a VERIFY_CHECK is added that the compressed parameter needs to be either 0 or 1.

theStack avatar Oct 26 '24 20:10 theStack

LGTM

apoelstra avatar Oct 28 '24 21:10 apoelstra

Closing this, as a corresponding PR was opened and merged in upstream (see https://github.com/bitcoin-core/secp256k1/pull/1642), i.e. it will be available here once a rebase on v0.7.0 (or later) is done.

theStack avatar Aug 31 '25 12:08 theStack