From e36f7bcefdf04e4fe82ab321b8386aad92a95c3f Mon Sep 17 00:00:00 2001 From: Justin Smith Date: Fri, 12 Apr 2024 12:40:08 -0400 Subject: [PATCH] rand_fork_unsafe_buffering_enabled always 0 except Windows --- crypto/rand_extra/forkunsafe.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crypto/rand_extra/forkunsafe.c b/crypto/rand_extra/forkunsafe.c index 0f1ececc89..a3c00e04d1 100644 --- a/crypto/rand_extra/forkunsafe.c +++ b/crypto/rand_extra/forkunsafe.c @@ -19,13 +19,13 @@ #include "../fipsmodule/rand/internal.h" +#if !defined(OPENSSL_WINDOWS) // g_buffering_enabled is true if fork-unsafe buffering has been enabled. static int g_buffering_enabled = 0; // g_lock protects |g_buffering_enabled|. static struct CRYPTO_STATIC_MUTEX g_lock = CRYPTO_STATIC_MUTEX_INIT; -#if !defined(OPENSSL_WINDOWS) void RAND_enable_fork_unsafe_buffering(int fd) { // We no longer support setting the file-descriptor with this function. if (fd != -1) { @@ -36,7 +36,6 @@ void RAND_enable_fork_unsafe_buffering(int fd) { g_buffering_enabled = 1; CRYPTO_STATIC_MUTEX_unlock_write(&g_lock); } -#endif int rand_fork_unsafe_buffering_enabled(void) { CRYPTO_STATIC_MUTEX_lock_read(&g_lock); @@ -44,3 +43,8 @@ int rand_fork_unsafe_buffering_enabled(void) { CRYPTO_STATIC_MUTEX_unlock_read(&g_lock); return ret; } +#else +int rand_fork_unsafe_buffering_enabled(void) { + return 0; +} +#endif