Use sanity check timestamps as entropy

This commit is contained in:
Pieter Wuille 2017-05-05 11:45:37 -07:00
parent 33f853d8d8
commit 2c0a6f157d

View file

@ -298,6 +298,10 @@ bool Random_SanityCheck()
uint64_t stop = GetPerformanceCounter(); uint64_t stop = GetPerformanceCounter();
if (stop == start) return false; 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; return true;
} }