mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
random: replace construct/assign with explicit Reseed()
This commit is contained in:
@@ -124,7 +124,7 @@ public:
|
||||
explicit AddrManDeterministic(const NetGroupManager& netgroupman, FuzzedDataProvider& fuzzed_data_provider)
|
||||
: AddrMan(netgroupman, /*deterministic=*/true, GetCheckRatio())
|
||||
{
|
||||
WITH_LOCK(m_impl->cs, m_impl->insecure_rand = FastRandomContext{ConsumeUInt256(fuzzed_data_provider)});
|
||||
WITH_LOCK(m_impl->cs, m_impl->insecure_rand.Reseed(ConsumeUInt256(fuzzed_data_provider)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
|
||||
// ecdsa_signature_parse_der_lax are executed during this test.
|
||||
// Specifically branches that run only when an ECDSA
|
||||
// signature's R and S values have leading zeros.
|
||||
g_insecure_rand_ctx = FastRandomContext{uint256{33}};
|
||||
g_insecure_rand_ctx.Reseed(uint256{33});
|
||||
|
||||
TxOrphanageTest orphanage;
|
||||
CKey key;
|
||||
|
||||
@@ -212,7 +212,7 @@ public:
|
||||
prevector_tester() {
|
||||
SeedRandomForTest();
|
||||
rand_seed = InsecureRand256();
|
||||
rand_cache = FastRandomContext(rand_seed);
|
||||
rand_cache.Reseed(rand_seed);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE(xoroshiro128plusplus_reference_values)
|
||||
BOOST_TEST(0x6ea7c59f89bbfc75 == rng());
|
||||
|
||||
// seed with a random number
|
||||
rng = InsecureRandomContext(0x1a26f3fa8546b47a);
|
||||
rng.Reseed(0x1a26f3fa8546b47a);
|
||||
BOOST_TEST(0xc8dc5e08d844ac7d == rng());
|
||||
BOOST_TEST(0x5b5f1f6d499dad1b == rng());
|
||||
BOOST_TEST(0xbeb0031f93313d6f == rng());
|
||||
|
||||
@@ -34,5 +34,5 @@ void SeedRandomForTest(SeedRand seedtype)
|
||||
const uint256& seed{seedtype == SeedRand::SEED ? ctx_seed : uint256::ZERO};
|
||||
LogPrintf("%s: Setting random seed for current tests to %s=%s\n", __func__, RANDOM_CTX_SEED, seed.GetHex());
|
||||
MakeRandDeterministicDANGEROUS(seed);
|
||||
g_insecure_rand_ctx = FastRandomContext(GetRandHash());
|
||||
g_insecure_rand_ctx.Reseed(GetRandHash());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user