Skip to content

Commit

Permalink
Merge #762: [Random] WIN32 Seed Cleanup: Move nLastPerfmon behind win…
Browse files Browse the repository at this point in the history
…32 ifdef.

3f8c6b7 WIN32 Seed Cleanup: Move nLastPerfmon behind win32 ifdef. Code to avoid calling Perfmon too often is only needed when perfmon is actually going to get called. This is not intended to make any functional difference in the addition of entropy to the random pool. (21E14)

Tree-SHA512: 24a58a905eaa418ccd7fed7e0789c664e29583f3788e3e5aa11a371923e579d1a253705bdd34a2ba28c3a19f0bbd7d87a16eccaa12ced9e7c8c81f95516e2821
  • Loading branch information
Mrs-X committed Dec 2, 2018
2 parents 4b1be14 + 3f8c6b7 commit abfceb3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/random.cpp
Expand Up @@ -47,15 +47,16 @@ void RandAddSeedPerfmon()
{
RandAddSeed();

#ifdef WIN32
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
// Seed with the entire set of perfmon data

// This can take up to 2 seconds, so only do it every 10 minutes
static int64_t nLastPerfmon;
if (GetTime() < nLastPerfmon + 10 * 60)
return;
nLastPerfmon = GetTime();

#ifdef WIN32
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
// Seed with the entire set of perfmon data
std::vector<unsigned char> vData(250000, 0);
long ret = 0;
unsigned long nSize = 0;
Expand Down

0 comments on commit abfceb3

Please sign in to comment.