Skip to content

Commit 602c0b2

Browse files
fanquakeFuzzbawls
authored andcommitted
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.
1 parent b1c8396 commit 602c0b2

File tree

3 files changed

+0
-6
lines changed

3 files changed

+0
-6
lines changed

src/random.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,10 +522,6 @@ static void SeedSlow(CSHA512& hasher, RNGState& rng) noexcept
522522
GetOSRand(buffer);
523523
hasher.Write(buffer, sizeof(buffer));
524524

525-
// OpenSSL RNG (for now)
526-
RAND_bytes(buffer, sizeof(buffer));
527-
hasher.Write(buffer, sizeof(buffer));
528-
529525
// Add the events hasher into the mix
530526
rng.SeedEvents(hasher);
531527

src/random.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
* that fast seeding includes, but additionally:
3636
* - OS entropy (/dev/urandom, getrandom(), ...). The application will terminate if
3737
* this entropy source fails.
38-
* - Bytes from OpenSSL's RNG (which itself may be seeded from various sources)
3938
* - Another high-precision timestamp (indirectly committing to a benchmark of all the
4039
* previous sources).
4140
* These entropy sources are slower, but designed to make sure the RNG state contains

src/randomenv.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ namespace {
7070
void RandAddSeedPerfmon(CSHA512& hasher)
7171
{
7272
#ifdef WIN32
73-
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
7473
// Seed with the entire set of perfmon data
7574

7675
// This can take up to 2 seconds, so only do it every 10 minutes

0 commit comments

Comments
 (0)