fuzz: Abort when using global PRNG without re-seed

This commit is contained in:
MarcoFalke
2024-12-13 14:42:21 +01:00
parent fa7809aeab
commit fa18acb457
7 changed files with 77 additions and 2 deletions

View File

@@ -671,9 +671,11 @@ void MakeRandDeterministicDANGEROUS(const uint256& seed) noexcept
{
GetRNGState().MakeDeterministic(seed);
}
std::atomic<bool> g_used_g_prng{false}; // Only accessed from tests
void GetRandBytes(Span<unsigned char> bytes) noexcept
{
g_used_g_prng = true;
ProcRand(bytes.data(), bytes.size(), RNGLevel::FAST, /*always_use_real_rng=*/false);
}