diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-05-05 11:45:37 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2017-05-05 11:56:24 -0700 |
commit | 2c0a6f157da3c6bb3b0a1e77f003caf0d9cb9d6c (patch) | |
tree | d07d700e05c3f9d5ddc889128eea024275af5370 /src/random.cpp | |
parent | 33f853d8d88917b145e2793bf8eb1b4e3790e7e7 (diff) |
Use sanity check timestamps as entropy
Diffstat (limited to 'src/random.cpp')
-rw-r--r-- | src/random.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/random.cpp b/src/random.cpp index 8107cb3105..805d7d3872 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -298,6 +298,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; } |