mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -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:
parent
9e1306fc88
commit
154fcce55c
1 changed files with 4 additions and 1 deletions
|
@ -322,7 +322,10 @@ FUZZ_TARGET(ellswift_roundtrip, .init = initialize_key)
|
||||||
auto encoded_ellswift = key.EllSwiftCreate(ent32);
|
auto encoded_ellswift = key.EllSwiftCreate(ent32);
|
||||||
auto decoded_pubkey = encoded_ellswift.Decode();
|
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)
|
FUZZ_TARGET(bip324_ecdh, .init = initialize_key)
|
||||||
|
|
Loading…
Add table
Reference in a new issue