| 325 | } |
| 326 | |
| 327 | ECDHSecret CKey::ComputeBIP324ECDHSecret(const EllSwiftPubKey& their_ellswift, const EllSwiftPubKey& our_ellswift, bool initiating) const |
| 328 | { |
| 329 | assert(keydata); |
| 330 | |
| 331 | ECDHSecret output; |
| 332 | // BIP324 uses the initiator as party A, and the responder as party B. Remap the inputs |
| 333 | // accordingly: |
| 334 | bool success = secp256k1_ellswift_xdh(secp256k1_context_static, |
| 335 | UCharCast(output.data()), |
| 336 | UCharCast(initiating ? our_ellswift.data() : their_ellswift.data()), |
| 337 | UCharCast(initiating ? their_ellswift.data() : our_ellswift.data()), |
| 338 | keydata->data(), |
| 339 | initiating ? 0 : 1, |
| 340 | secp256k1_ellswift_xdh_hash_function_bip324, |
| 341 | nullptr); |
| 342 | // Should always succeed for valid keys (assert above). |
| 343 | assert(success); |
| 344 | return output; |
| 345 | } |
| 346 | |
| 347 | KeyPair CKey::ComputeKeyPair(const uint256* merkle_root) const |
| 348 | { |
no test coverage detected