From 2be531806762b4eb60644688caeb8001e7425aa4 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Thu, 22 Oct 2020 09:56:33 +0000 Subject: [PATCH] Feature: Read standard OpenSSL random seed file if any and linked with OpenSSL --- src/prng.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/prng.c b/src/prng.c index 753f50f2..3d1a2ce4 100644 --- a/src/prng.c +++ b/src/prng.c @@ -64,6 +64,10 @@ static void prng_initial_seed(void) pid_t ppid; #endif } seed; +#ifdef HAVE_OPENSSL + char buffer[1024]; + const char *filename; +#endif memset(&seed, 0, sizeof(seed)); @@ -79,6 +83,13 @@ static void prng_initial_seed(void) #endif prng_write(&seed, sizeof(seed)); + +#ifdef HAVE_OPENSSL + filename = RAND_file_name(buffer, sizeof(buffer)); + if (filename) + RAND_load_file(filename, -1); + ERR_get_error(); // clear error if any +#endif } static void prng_cross_seed(void)