Blame SOURCES/bind-9.11-rh1685940.patch

3ce7d3
From 9fcd066217e8b6f52b601bdd8a0cb6455f98b88c Mon Sep 17 00:00:00 2001
3ce7d3
From: Petr Mensik <pemensik@redhat.com>
3ce7d3
Date: Thu, 7 Mar 2019 14:33:28 +0100
3ce7d3
Subject: [PATCH] Do not replace random generator on single thread
3ce7d3
3ce7d3
DHCP builds fails to initialize dst library entropy generator. It does
3ce7d3
not require it for anything. Instead of initializing it, skip replacing
3ce7d3
custom random generator in single thread builds. Should use OpenSSL
3ce7d3
default random generator in case of SSL.
3ce7d3
3ce7d3
Related: rhbz#1685940
3ce7d3
---
3ce7d3
 lib/dns/openssl_link.c | 8 +++++++-
3ce7d3
 1 file changed, 7 insertions(+), 1 deletion(-)
3ce7d3
3ce7d3
diff --git a/lib/dns/openssl_link.c b/lib/dns/openssl_link.c
3ce7d3
index ec6dc7f..ca3ffbc 100644
3ce7d3
--- a/lib/dns/openssl_link.c
3ce7d3
+++ b/lib/dns/openssl_link.c
3ce7d3
@@ -31,6 +31,7 @@
3ce7d3
 #include <isc/mem.h>
3ce7d3
 #include <isc/mutex.h>
3ce7d3
 #include <isc/mutexblock.h>
3ce7d3
+#include <isc/platform.h>
3ce7d3
 #include <isc/string.h>
3ce7d3
 #include <isc/thread.h>
3ce7d3
 #include <isc/util.h>
3ce7d3
@@ -220,6 +221,7 @@ dst__openssl_init(const char *engine) {
3ce7d3
 	ERR_load_crypto_strings();
3ce7d3
 #endif
3ce7d3
 
3ce7d3
+#ifdef ISC_PLATFORM_USETHREADS
3ce7d3
 	rm = mem_alloc(sizeof(RAND_METHOD) FILELINE);
3ce7d3
 	if (rm == NULL) {
3ce7d3
 		result = ISC_R_NOMEMORY;
3ce7d3
@@ -231,6 +233,7 @@ dst__openssl_init(const char *engine) {
3ce7d3
 	rm->add = entropy_add;
3ce7d3
 	rm->pseudorand = entropy_getpseudo;
3ce7d3
 	rm->status = entropy_status;
3ce7d3
+#endif
3ce7d3
 
3ce7d3
 #if !defined(OPENSSL_NO_ENGINE)
3ce7d3
 #if !defined(CONF_MFLAGS_DEFAULT_SECTION)
3ce7d3
@@ -264,6 +267,7 @@ dst__openssl_init(const char *engine) {
3ce7d3
 		}
3ce7d3
 	}
3ce7d3
 
3ce7d3
+#ifdef ISC_PLATFORM_USETHREADS
3ce7d3
 	re = ENGINE_get_default_RAND();
3ce7d3
 	if (re == NULL) {
3ce7d3
 		re = ENGINE_new();
3ce7d3
@@ -276,6 +280,7 @@ dst__openssl_init(const char *engine) {
3ce7d3
 		ENGINE_free(re);
3ce7d3
 	} else
3ce7d3
 		ENGINE_finish(re);
3ce7d3
+#endif
3ce7d3
 #else
3ce7d3
 	RAND_set_rand_method(rm);
3ce7d3
 #endif /* !defined(OPENSSL_NO_ENGINE) */
3ce7d3
@@ -286,7 +291,8 @@ dst__openssl_init(const char *engine) {
3ce7d3
 	if (e != NULL)
3ce7d3
 		ENGINE_free(e);
3ce7d3
 	e = NULL;
3ce7d3
-	mem_free(rm FILELINE);
3ce7d3
+	if (rm != NULL)
3ce7d3
+		mem_free(rm FILELINE);
3ce7d3
 	rm = NULL;
3ce7d3
 #endif
3ce7d3
  cleanup_mutexinit:
3ce7d3
-- 
3ce7d3
2.20.1
3ce7d3