aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/bip324.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/fuzz/bip324.cpp')
-rw-r--r--src/test/fuzz/bip324.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/test/fuzz/bip324.cpp b/src/test/fuzz/bip324.cpp
index 0619916819..9892e7a81c 100644
--- a/src/test/fuzz/bip324.cpp
+++ b/src/test/fuzz/bip324.cpp
@@ -56,7 +56,7 @@ FUZZ_TARGET(bip324_cipher_roundtrip, .init=Initialize)
// (potentially buggy) edge cases triggered by specific values of contents/AAD, so we can avoid
// reading the actual data for those from the fuzzer input (which would need large amounts of
// data).
- XoRoShiRo128PlusPlus rng(provider.ConsumeIntegral<uint64_t>());
+ InsecureRandomContext rng(provider.ConsumeIntegral<uint64_t>());
// Compare session IDs and garbage terminators.
assert(initiator.GetSessionID() == responder.GetSessionID());
@@ -79,10 +79,8 @@ FUZZ_TARGET(bip324_cipher_roundtrip, .init=Initialize)
unsigned length_bits = 2 * ((mode >> 5) & 7);
unsigned length = provider.ConsumeIntegralInRange<unsigned>(0, (1 << length_bits) - 1);
// Generate aad and content.
- std::vector<std::byte> aad(aad_length);
- for (auto& val : aad) val = std::byte{(uint8_t)rng()};
- std::vector<std::byte> contents(length);
- for (auto& val : contents) val = std::byte{(uint8_t)rng()};
+ auto aad = rng.randbytes<std::byte>(aad_length);
+ auto contents = rng.randbytes<std::byte>(length);
// Pick sides.
auto& sender{from_init ? initiator : responder};