diff options
author | Magnus Hagander <magnus@hagander.net> | 2020-11-06 13:21:28 +0100 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2020-11-06 13:21:28 +0100 |
commit | 5ee180a3947060b98284a935f26f92c71d698f7c (patch) | |
tree | 1444d1ad7c5f982cd1e4bb53226d190e9448baa3 /src/backend/postmaster/fork_process.c | |
parent | 4f841ce3f7f4d429a3a275f82745d63c78cde4b2 (diff) | |
download | postgresql-5ee180a3947060b98284a935f26f92c71d698f7c.tar.gz postgresql-5ee180a3947060b98284a935f26f92c71d698f7c.zip |
Add pg_strong_random_init function to initialize random number generator
Currently only OpenSSL requires this initialization, but in the future
other SSL implementations are likely to need it as well. Abstracting
this functionality out into a separate function makes this cleaner and
more clear, and also removes the dependency on OpenSSL headers from
fork_process.c.
OpenSSL is special in that we need to initialize this random number
generator even if we're not going to use it directly, until we drop
support for everything prior to OpenSSL 1.1.1. (And of course also if we
actually use it). All other implementations are left empty at this time,
but more are expected to be added in the future.
Author: Daniel Gustafsson <daniel@yesql.se>, Michael Paquier <michael@paquier.xyz>
Reviewed-By: Magnus Hagander <magnus@hagander.net>
Discussion: https://postgr.es/m/F6291C3C-747C-4C93-BCE0-28BB420B1FF5@yesql.se
Diffstat (limited to 'src/backend/postmaster/fork_process.c')
-rw-r--r-- | src/backend/postmaster/fork_process.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/backend/postmaster/fork_process.c b/src/backend/postmaster/fork_process.c index 15d63408007..5247b9f23c9 100644 --- a/src/backend/postmaster/fork_process.c +++ b/src/backend/postmaster/fork_process.c @@ -16,9 +16,6 @@ #include <sys/stat.h> #include <sys/time.h> #include <unistd.h> -#ifdef USE_OPENSSL -#include <openssl/rand.h> -#endif #include "postmaster/fork_process.h" @@ -108,14 +105,8 @@ fork_process(void) } } - /* - * 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_poll(); -#endif + /* do post-fork initialization for random number generation */ + pg_strong_random_init(); } return result; |