From 4fcfcc294e7cb17956e283d09050cb997093a35d Mon Sep 17 00:00:00 2001 From: fanquake Date: Sat, 26 Oct 2019 08:22:11 -0400 Subject: [PATCH] random: stop retrieving random bytes from OpenSSL On the ::SLOW path we would use OpenSSL as an additional source of random bytes. This commit removes that functionality. Note that this was always only an additional source, and that we never checked the return value RAND_bytes(): https://www.openssl.org/docs/manmaster/man3/RAND_bytes.html RAND_bytes() puts num cryptographically strong pseudo-random bytes into buf. --- src/random.cpp | 4 ---- src/random.h | 1 - src/randomenv.cpp | 1 - 3 files changed, 6 deletions(-) diff --git a/src/random.cpp b/src/random.cpp index 8bdf45ef67d..d4187408139 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -495,10 +495,6 @@ static void SeedSlow(CSHA512& hasher) noexcept GetOSRand(buffer); hasher.Write(buffer, sizeof(buffer)); - // OpenSSL RNG (for now) - RAND_bytes(buffer, sizeof(buffer)); - hasher.Write(buffer, sizeof(buffer)); - // High-precision timestamp. // // Note that we also commit to a timestamp in the Fast seeder, so we indirectly commit to a diff --git a/src/random.h b/src/random.h index 7768f9d3c50..2d8ab085e3a 100644 --- a/src/random.h +++ b/src/random.h @@ -35,7 +35,6 @@ * that fast seeding includes, but additionally: * - OS entropy (/dev/urandom, getrandom(), ...). The application will terminate if * this entropy source fails. - * - Bytes from OpenSSL's RNG (which itself may be seeded from various sources) * - Another high-precision timestamp (indirectly committing to a benchmark of all the * previous sources). * These entropy sources are slower, but designed to make sure the RNG state contains diff --git a/src/randomenv.cpp b/src/randomenv.cpp index 603c88eaabe..ec42ddabc32 100644 --- a/src/randomenv.cpp +++ b/src/randomenv.cpp @@ -70,7 +70,6 @@ namespace { void RandAddSeedPerfmon(CSHA512& hasher) { #ifdef WIN32 - // Don't need this on Linux, OpenSSL automatically uses /dev/urandom // Seed with the entire set of perfmon data // This can take up to 2 seconds, so only do it every 10 minutes