Use RAND_poll() for seeding randomness after fork().

OpenSSL deprecated RAND_cleanup(), and OpenSSL 1.1.0 made it into a
no-op.  Replace it with RAND_poll(), per an OpenSSL community
recommendation.  While this has no user-visible consequences under
OpenSSL defaults, it might help under non-default settings.

Daniel Gustafsson, reviewed by David Steele and Michael Paquier.

Discussion: https://postgr.es/m/9B038FA5-23E8-40D0-B932-D515E1D8F66A@yesql.se
This commit is contained in:
Noah Misch 2020-07-25 14:50:59 -07:00
parent 0a0727ccfc
commit ce4939ff70
1 changed files with 4 additions and 2 deletions

View File

@ -109,10 +109,12 @@ fork_process(void)
}
/*
* Make sure processes do not share OpenSSL randomness state.
* Make sure processes do not share OpenSSL randomness state. This is
* no longer required in OpenSSL 1.1.1 and later versions, but until
* we drop support for version < 1.1.1 we need to do this.
*/
#ifdef USE_OPENSSL
RAND_cleanup();
RAND_poll();
#endif
}