Skip to content

Commit 4fcfcc2

Browse files
committed
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 5624ab0 commit 4fcfcc2

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
@@ -495,10 +495,6 @@ static void SeedSlow(CSHA512& hasher) noexcept
495495
GetOSRand(buffer);
496496
hasher.Write(buffer, sizeof(buffer));
497497

498-
// OpenSSL RNG (for now)
499-
RAND_bytes(buffer, sizeof(buffer));
500-
hasher.Write(buffer, sizeof(buffer));
501-
502498
// High-precision timestamp.
503499
//
504500
// Note that we also commit to a timestamp in the Fast seeder, so we indirectly commit to a

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)