From 5b52d9f15e311b82ee5f5c5ed9927c65b63731bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= Date: Mon, 4 Apr 2022 21:28:26 -0700 Subject: [PATCH] git-compat-util: really support openssl as a source of entropy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 05cd988dce5 (wrapper: add a helper to generate numbers from a CSPRNG, 2022-01-17), configure openssl as the source for entropy in NON-STOP but doesn't add the needed header or link options. Since the only system that is configured to use openssl as a source of entropy is NON-STOP, add the header unconditionally, and -lcrypto to the list of external libraries. An additional change is required to make sure a NO_OPENSSL=1 build will be able to work as well (tested on Linux with a modified value of CSPRNG_METHOD = openssl), and the more complex logic that allows for compatibility with APPLE_COMMON_CRYPTO or allowing for simpler ways to link (without libssl) has been punted for now. Reported-by: Randall Becker Signed-off-by: Carlo Marcelo Arenas Belón Signed-off-by: Junio C Hamano --- Makefile | 1 + git-compat-util.h | 4 ++++ imap-send.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 198b759e76..e106728194 100644 --- a/Makefile +++ b/Makefile @@ -1940,6 +1940,7 @@ endif ifneq ($(findstring openssl,$(CSPRNG_METHOD)),) BASIC_CFLAGS += -DHAVE_OPENSSL_CSPRNG + EXTLIBS += -lcrypto -lssl endif ifneq ($(PROCFS_EXECUTABLE_PATH),) diff --git a/git-compat-util.h b/git-compat-util.h index 50597c76be..f439f2691d 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -521,6 +521,10 @@ void warning_errno(const char *err, ...) __attribute__((format (printf, 1, 2))); #include #endif /* NO_OPENSSL */ +#ifdef HAVE_OPENSSL_CSPRNG +#include +#endif + /* * Let callers be aware of the constant return value; this can help * gcc with -Wuninitialized analysis. We restrict this trick to gcc, though, diff --git a/imap-send.c b/imap-send.c index e6090a0346..c091b4e94b 100644 --- a/imap-send.c +++ b/imap-send.c @@ -27,7 +27,7 @@ #include "exec-cmd.h" #include "run-command.h" #include "parse-options.h" -#ifdef NO_OPENSSL +#if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG) typedef void *SSL; #endif #ifdef USE_CURL_FOR_IMAP_SEND