Skip to content

Commit 5624ab0

Browse files
committed
random: stop feeding RNG output back into OpenSSL
On the ::SLOW or ::SLEEP paths, we would feed our RNG output back into OpenSSL using RAND_add. This commit removes that functionality. RAND_add(): https://www.openssl.org/docs/manmaster/man3/RAND_add.html RAND_add() mixes the num bytes at buf into the internal state of the random generator. This function will not normally be needed, as mentioned above. The randomness argument is an estimate of how much randomness is contained in buf, in bytes, and should be a number between zero and num.
1 parent 6fde676 commit 5624ab0

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

src/random.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -586,14 +586,6 @@ static void ProcRand(unsigned char* out, int num, RNGLevel level)
586586
SeedStartup(startup_hasher, rng);
587587
rng.MixExtract(out, num, std::move(startup_hasher), true);
588588
}
589-
590-
// For anything but the 'fast' level, feed the resulting RNG output (after an additional hashing step) back into OpenSSL.
591-
if (level != RNGLevel::FAST) {
592-
unsigned char buf[64];
593-
CSHA512().Write(out, num).Finalize(buf);
594-
RAND_add(buf, sizeof(buf), num);
595-
memory_cleanse(buf, 64);
596-
}
597589
}
598590

599591
void GetRandBytes(unsigned char* buf, int num) noexcept { ProcRand(buf, num, RNGLevel::FAST); }

0 commit comments

Comments
 (0)