[bitcoin/bitcoin] Enable libsecp256k1 ecdh module, add ECDH function to CKey (#14049)

Empact commented on this pull request.

> @@ -285,6 +286,17 @@ bool CKey::Derive(CKey& keyChild, ChainCode &ccChild, unsigned int nChild, const
return ret;
}

+bool CKey::ComputeECDHSecret(const CPubKey& pubkey, CPrivKey& secret_out) const
+{
+ secp256k1_pubkey pubkey_internal;
+ if (!secp256k1_ec_pubkey_parse(secp256k1_context_sign, &pubkey_internal, pubkey.data(), pubkey.size())) {
+ return false;
+ }
+
+ secret_out.resize(32);
+ return secp256k1_ecdh(secp256k1_context_sign, &secret_out[0], &pubkey_internal, &keydata[0]) == 1;

Is it better to pass a `SECP256K1_CONTEXT_NONE` context, given the context is not currently used by these functions?