From 9762b9389d340ec7db40c2eb32c563ab5e5f8e2d Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Wed, 24 Apr 2019 10:46:59 +0200 Subject: [PATCH] fixup! Fix OpenSSL error, wrong initialization order. --- src/network/openssl.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/network/openssl.c b/src/network/openssl.c index ddec867..81b07f7 100644 --- a/src/network/openssl.c +++ b/src/network/openssl.c @@ -149,29 +149,48 @@ static const SSL_METHOD* get_ssl_method(const char* tls_version, long* flags) if (!strcmp(tls_version, "1.0")) { - // not much to do. +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return TLSv1_method(); +#endif } else if (!strcmp(tls_version, "1.1")) { +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return TLSv1_1_method(); +#else *flags |= SSL_OP_NO_TLSv1; +#endif } else if (!strcmp(tls_version, "1.2")) { +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return TLSv1_2_method(); +#else *flags |= SSL_OP_NO_TLSv1; *flags |= SSL_OP_NO_TLSv1_1; +#endif } else if (!strcmp(tls_version, "1.3")) { +#if OPENSSL_VERSION_NUMBER < 0x10100000L + LOG_ERROR("TLS 1.3 is not supported by this version of OpenSSL"); + return 0; +#else *flags |= SSL_OP_NO_TLSv1; *flags |= SSL_OP_NO_TLSv1_1; *flags |= SSL_OP_NO_TLSv1_2; +#endif } else { LOG_ERROR("Unable to recognize tls_version: %s", tls_version); return 0; } +#if OPENSSL_VERSION_NUMBER >= 0x10100000L return TLS_method(); +#else +#error "Unknown OpenSSL version!" +#endif } /**