src: ensure that openssl's PRNG is fully seeded
authorBen Noordhuis <info@bnoordhuis.nl>
Tue, 25 Mar 2014 22:35:28 +0000 (23:35 +0100)
committerFedor Indutny <fedor.indutny@gmail.com>
Wed, 26 Mar 2014 07:31:32 +0000 (11:31 +0400)
commitf68a116c3c061151ab120f10fdc9230192d6b157
tree4a485242514eeadb3f943cf3543cf3b7f0f626a8
parent70f198ddb1ba464da97799f59ae9233320ecc49d
src: ensure that openssl's PRNG is fully seeded

Ensure that OpenSSL has enough entropy (at least 256 bits) for its PRNG.

The entropy pool starts out empty and needs to fill up before the PRNG
can be used securely.

OpenSSL normally fills the pool automatically but not when someone
starts generating random numbers before the pool is full: in that case
OpenSSL keeps lowering the entropy estimate to thwart attackers trying
to guess the initial state of the PRNG.

When that happens, we wait until enough entropy is available, something
that normally should never take longer than a few milliseconds.

Fixes #7338.
src/node_crypto.cc