From 766106e616c8326a79cf36e8478b0af4a7aa8d42 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 5 May 2017 11:45:37 -0700 Subject: [PATCH] Use sanity check timestamps as entropy Cherry-picked from: 2c0a6f157da3c6bb3b0a1e77f003caf0d9cb9d6c --- src/random.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/random.cpp b/src/random.cpp index 5224ddd608d..9d1396c9014 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -317,6 +317,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; }