0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-10 10:52:31 -05:00

Report amount of data gathered from environment

This commit is contained in:
Pieter Wuille 2019-11-05 10:54:20 -08:00
parent 64e1e022ce
commit d1c02775aa
2 changed files with 5 additions and 0 deletions

View file

@ -23,6 +23,7 @@ public:
CSHA512& Write(const unsigned char* data, size_t len); CSHA512& Write(const unsigned char* data, size_t len);
void Finalize(unsigned char hash[OUTPUT_SIZE]); void Finalize(unsigned char hash[OUTPUT_SIZE]);
CSHA512& Reset(); CSHA512& Reset();
uint64_t Size() const { return bytes; }
}; };
#endif // BITCOIN_CRYPTO_SHA512_H #endif // BITCOIN_CRYPTO_SHA512_H

View file

@ -525,7 +525,9 @@ static void SeedPeriodic(CSHA512& hasher, RNGState& rng)
SeedTimestamp(hasher); SeedTimestamp(hasher);
// Dynamic environment data (performance monitoring, ...) // Dynamic environment data (performance monitoring, ...)
auto old_size = hasher.Size();
RandAddDynamicEnv(hasher); RandAddDynamicEnv(hasher);
LogPrintf("Feeding %i bytes of dynamic environment data into RNG\n", hasher.Size() - old_size);
// Strengthen for 10 ms // Strengthen for 10 ms
SeedStrengthen(hasher, rng, 10000); SeedStrengthen(hasher, rng, 10000);
@ -540,10 +542,12 @@ static void SeedStartup(CSHA512& hasher, RNGState& rng) noexcept
SeedSlow(hasher); SeedSlow(hasher);
// Dynamic environment data (performance monitoring, ...) // Dynamic environment data (performance monitoring, ...)
auto old_size = hasher.Size();
RandAddDynamicEnv(hasher); RandAddDynamicEnv(hasher);
// Static environment data // Static environment data
RandAddStaticEnv(hasher); RandAddStaticEnv(hasher);
LogPrintf("Feeding %i bytes of environment data into RNG\n", hasher.Size() - old_size);
// Strengthen for 100 ms // Strengthen for 100 ms
SeedStrengthen(hasher, rng, 100000); SeedStrengthen(hasher, rng, 100000);