| 181 | } |
| 182 | |
| 183 | bool CKey::SignECDSA(const uint256& hash, std::vector<uint8_t>& vchSig, uint32_t test_case) const { |
| 184 | if (!fValid) |
| 185 | return false; |
| 186 | vchSig.resize(CPubKey::SIGNATURE_SIZE); |
| 187 | size_t nSigLen = CPubKey::SIGNATURE_SIZE; |
| 188 | unsigned char extra_entropy[32] = {0}; |
| 189 | WriteLE32(extra_entropy, test_case); |
| 190 | secp256k1_ecdsa_signature sig; |
| 191 | int ret = secp256k1_ecdsa_sign(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, test_case ? extra_entropy : nullptr); |
| 192 | assert(ret); |
| 193 | secp256k1_ecdsa_signature_serialize_der(secp256k1_context_sign, (unsigned char*)vchSig.data(), &nSigLen, &sig); |
| 194 | vchSig.resize(nSigLen); |
| 195 | return true; |
| 196 | } |
| 197 | |
| 198 | bool CKey::SignSchnorr(const uint256 &hash, std::vector<uint8_t> &vchSig, uint32_t test_case) const |
| 199 | { |
no test coverage detected