This is in preparation for allowing code reuse by keypair functions
This is a partial backport of secp256k1 [[https://github.com/bitcoin-core/secp256k1/pull/558 | PR558]] : https://github.com/bitcoin-core/secp256k1/pull/558/commits/f0010349b876bc6b3f0a6ec6c8bad0b12ca17b51