Skip to content

Commit

Permalink
Use sanity check timestamps as entropy
Browse files Browse the repository at this point in the history
Cherry-picked from: 2c0a6f1
  • Loading branch information
sipa authored and xanimo committed Jun 18, 2024
1 parent 4a3c6dd commit 23bc7a0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 23bc7a0

Please sign in to comment.