From: Emmanuel Hocdet Date: Wed, 12 Jul 2017 10:53:02 +0000 (+0200) Subject: BUG/MINOR: ssl: remove haproxy SSLv3 support when ssl lib have no SSLv3 X-Git-Tag: v1.8-dev3~227 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=23877ab6533e97981edcb3d11bc74ab44b8531aa;p=thirdparty%2Fhaproxy.git BUG/MINOR: ssl: remove haproxy SSLv3 support when ssl lib have no SSLv3 The commit 5db33cbd "MEDIUM: ssl: ssl_methods implementation is reworked and factored for min/max tlsxx" drop the case when ssl lib have removed SSLv3. The commit 1e59fcc5 "BUG/MINOR: ssl: Be sure that SSLv3 connection methods exist for openssl < 1.1.0" fix build but it's false because haproxy think that ssl lib support SSLv3. SSL_OP_NO_* are flags to set in ssl_options and is the way haproxy do the link between ssl capabilities and haproxy configuration. (The mapping table is done via methodVersions). SSL_OP_NO_* is set to 0 when ssl lib doesn't support a new TLS version. Older version (like SSLv3) can be removed at build or unsupported (like libressl). In all case OPENSSL_NO_SSL3 is define. To keep the same logic, this patch alter SSL_OP_NO_SSLv3 to 0 when SSLv3 is not supported by ssl lib (when OPENSSL_NO_SSL3 is define). --- diff --git a/src/ssl_sock.c b/src/ssl_sock.c index b53779db7b..7fa6420a37 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -1808,6 +1808,10 @@ ssl_sock_generate_certificate(const char *servername, struct bind_conf *bind_con #ifndef SSL_OP_NO_COMPRESSION /* needs OpenSSL >= 0.9.9 */ #define SSL_OP_NO_COMPRESSION 0 #endif +#ifdef OPENSSL_NO_SSL3 /* SSLv3 support removed */ +#undef SSL_OP_NO_SSLv3 +#define SSL_OP_NO_SSLv3 0 +#endif #ifndef SSL_OP_NO_TLSv1_1 /* needs OpenSSL >= 1.0.1 */ #define SSL_OP_NO_TLSv1_1 0 #endif @@ -1835,7 +1839,7 @@ typedef enum { SET_CLIENT, SET_SERVER } set_context_func; static void ctx_set_SSLv3_func(SSL_CTX *ctx, set_context_func c) { -#if SSL_OP_NO_SSLv3 && !defined(OPENSSL_NO_SSL3_METHOD) +#if SSL_OP_NO_SSLv3 c == SET_SERVER ? SSL_CTX_set_ssl_version(ctx, SSLv3_server_method()) : SSL_CTX_set_ssl_version(ctx, SSLv3_client_method()); #endif