Use sanity check timestamps as entropy

Cherry-picked from: 2c0a6f157da3c6bb3b0a1e77f003caf0d9cb9d6c
This commit is contained in:
Pieter Wuille 2017-05-05 11:45:37 -07:00 committed by xanimo
parent 4a3c6ddc11
commit 23bc7a072e
No known key found for this signature in database
GPG Key ID: 6E8F17C1B1BCDCBE

View File

@ -330,6 +330,10 @@ bool Random_SanityCheck()
uint64_t stop = GetPerformanceCounter();
if (stop == start) return false;
// We called GetPerformanceCounter. Use it as entropy.
RAND_add((const unsigned char*)&start, sizeof(start), 1);
RAND_add((const unsigned char*)&stop, sizeof(stop), 1);
return true;
}