0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-03 09:56:38 -05:00

[fuzz] Improve fuzzing stability for ellswift_roundtrip harness

`CPubKey::VerifyPubKey` uses rng internally which leads to instability
in the fuzz test.

We fix this by avoiding `VerifyPubKey` in the test and verifying the
decoded public key with a fuzzer chosen message instead.
This commit is contained in:
dergoegge 2024-01-10 16:16:36 +00:00
parent 9e1306fc88
commit 154fcce55c

View file

@ -322,7 +322,10 @@ FUZZ_TARGET(ellswift_roundtrip, .init = initialize_key)
auto encoded_ellswift = key.EllSwiftCreate(ent32);
auto decoded_pubkey = encoded_ellswift.Decode();
assert(key.VerifyPubKey(decoded_pubkey));
uint256 hash{ConsumeUInt256(fdp)};
std::vector<unsigned char> sig;
key.Sign(hash, sig);
assert(decoded_pubkey.Verify(hash, sig));
}
FUZZ_TARGET(bip324_ecdh, .init = initialize_key)