From 2f44ef51f48d39eb42d475cf753b93838844de15 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sat, 30 Jan 2021 15:10:52 +0100 Subject: --version: print OpenSSL versions build/run-time and directories --- socket.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'socket.c') diff --git a/socket.c b/socket.c index 49af2235..62fd43d2 100644 --- a/socket.c +++ b/socket.c @@ -10,6 +10,7 @@ #include "config.h" #include "fetchmail.h" +#include "tls-aux.h" #include #include @@ -902,8 +903,8 @@ static const char *SSLCertGetCN(const char *mycert, return ret; } -#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x1010000fL -/* OSSL_proto_version_logic for OpenSSL 1.0.x and LibreSSL */ +#if !defined(OSSL110_API) +/* ===== implementation for OpenSSL 1.0.X and LibreSSL ===== */ static int OSSL10X_proto_version_logic(int sock, const char **myproto, int *avoid_ssl_versions) { if (!*myproto) { @@ -971,10 +972,8 @@ static int OSSL10X_proto_version_logic(int sock, const char **myproto, int *avoi return 0; } #define OSSL_proto_version_logic(a,b,c) OSSL10X_proto_version_logic((a),(b),(c)) -#undef OSSL110_API #else -/* implementation for OpenSSL 1.1.0 */ -#define OSSL110_API 1 +/* ===== implementation for OpenSSL 1.1.0 ===== */ static int OSSL110_proto_version_logic(int sock, const char **myproto, int *avoid_ssl_versions) { @@ -1072,10 +1071,8 @@ int SSLOpen(int sock, char *mycert, char *mykey, const char *myproto, int certck SSL_load_error_strings(); SSL_library_init(); OpenSSL_add_all_algorithms(); /* see Debian Bug#576430 and manpage */ - ver = SSLeay(); -#else - ver = OpenSSL_version_num(); #endif + ver = OpenSSL_version_num(); /* version switch through tls-aux.h */ if (ver < OPENSSL_VERSION_NUMBER) { report(stderr, GT_("Loaded OpenSSL library %#lx older than headers %#lx, refusing to work.\n"), (long)ver, (long)(OPENSSL_VERSION_NUMBER)); -- cgit v1.2.3