From 55f722f0e596b9b84de2b4439938cd6601ad4da9 Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <daniel@yesql.se>
Date: Tue, 25 Aug 2020 15:42:44 +0200
Subject: [PATCH] Consistently use USE_OPENSSL_RANDOM for randomness

The USE_OPENSSL_RANDOM macro is defined when OpenSSL is used
as a randomness provider, but the implementation of strong
randomness is guarded by USE_OPENSSL. This is technically the
same thing today, but for hygiene use the correct macros.
---
 src/backend/postmaster/fork_process.c | 4 ++--
 src/port/pg_strong_random.c           | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/postmaster/fork_process.c b/src/backend/postmaster/fork_process.c
index 15d6340800..836db0c3ef 100644
--- a/src/backend/postmaster/fork_process.c
+++ b/src/backend/postmaster/fork_process.c
@@ -16,7 +16,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <unistd.h>
-#ifdef USE_OPENSSL
+#if defined(USE_OPENSSL) || defined(USE_OPENSSL_RANDOM)
 #include <openssl/rand.h>
 #endif
 
@@ -113,7 +113,7 @@ fork_process(void)
 		 * 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
+#if defined(USE_OPENSSL) || defined(USE_OPENSSL_RANDOM)
 		RAND_poll();
 #endif
 	}
diff --git a/src/port/pg_strong_random.c b/src/port/pg_strong_random.c
index 14e8382cd8..812727aecb 100644
--- a/src/port/pg_strong_random.c
+++ b/src/port/pg_strong_random.c
@@ -24,7 +24,7 @@
 #include <unistd.h>
 #include <sys/time.h>
 
-#ifdef USE_OPENSSL
+#ifdef USE_OPENSSL_RANDOM
 #include <openssl/rand.h>
 #endif
 #ifdef USE_WIN32_RANDOM
-- 
2.21.1 (Apple Git-122.3)

