]> git.kaiwu.me - nginx.git/commitdiff
SSL: fixed SSL_clear_options() usage with OpenSSL 1.1.0+.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 16 Jul 2018 14:47:20 +0000 (17:47 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 16 Jul 2018 14:47:20 +0000 (17:47 +0300)
In OpenSSL 1.1.0 the SSL_CTRL_CLEAR_OPTIONS macro was removed, so
conditional compilation test on it results in SSL_clear_options()
and SSL_CTX_clear_options() not being used.  Notably, this caused
"ssl_prefer_server_ciphers off" to not work in SNI-based virtual
servers if server preference was switched on in the default server.

It looks like the only possible fix is to test OPENSSL_VERSION_NUMBER
explicitly.

src/event/ngx_event_openssl.c
src/http/ngx_http_request.c

index c3bb90e381389a399cd093106cb154760d505e97..2dfecd44c1d955020c139589c3f581151a79181f 100644 (file)
@@ -295,7 +295,7 @@ ngx_ssl_create(ngx_ssl_t *ssl, ngx_uint_t protocols, void *data)
 
     SSL_CTX_set_options(ssl->ctx, SSL_OP_SINGLE_DH_USE);
 
-#ifdef SSL_CTRL_CLEAR_OPTIONS
+#if OPENSSL_VERSION_NUMBER >= 0x009080dfL
     /* only in 0.9.8m+ */
     SSL_CTX_clear_options(ssl->ctx,
                           SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1);
index f302e561ee6f05da865ad173b40fa5f4e82d2d00..979009158ce498dc579560210db5c68dd410fc05 100644 (file)
@@ -912,7 +912,7 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
 
         SSL_set_verify_depth(ssl_conn, SSL_CTX_get_verify_depth(sscf->ssl.ctx));
 
-#ifdef SSL_CTRL_CLEAR_OPTIONS
+#if OPENSSL_VERSION_NUMBER >= 0x009080dfL
         /* only in 0.9.8m+ */
         SSL_clear_options(ssl_conn, SSL_get_options(ssl_conn) &
                                     ~SSL_CTX_get_options(sscf->ssl.ctx));