comparison src/event/ngx_event_openssl.c @ 7420:b3a4f6d23e82 stable-1.14

SSL: enabled TLSv1.3 with BoringSSL. BoringSSL currently requires SSL_CTX_set_max_proto_version(TLS1_3_VERSION) to be able to enable TLS 1.3. This is because by default max protocol version is set to TLS 1.2, and the SSL_OP_NO_* options are merely used as a blacklist within the version range specified using the SSL_CTX_set_min_proto_version() and SSL_CTX_set_max_proto_version() functions. With this change, we now call SSL_CTX_set_max_proto_version() with an explicit maximum version set. This enables TLS 1.3 with BoringSSL. As a side effect, this change also limits maximum protocol version to the newest protocol we know about, TLS 1.3. This seems to be a good change, as enabling unknown protocols might have unexpected results. Additionally, we now explicitly call SSL_CTX_set_min_proto_version() with 0. This is expected to help with Debian system-wide default of MinProtocol set to TLSv1.2, see http://mailman.nginx.org/pipermail/nginx-ru/2017-October/060411.html. Note that there is no SSL_CTX_set_min_proto_version macro in BoringSSL, so we call SSL_CTX_set_min_proto_version() and SSL_CTX_set_max_proto_version() as long as the TLS1_3_VERSION macro is defined.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 07 Aug 2018 02:15:28 +0300
parents c5d7a72abadc
children 11be3c0723bd
comparison
equal deleted inserted replaced
7419:c5d7a72abadc 7420:b3a4f6d23e82
326 #ifdef SSL_OP_NO_TLSv1_3 326 #ifdef SSL_OP_NO_TLSv1_3
327 SSL_CTX_clear_options(ssl->ctx, SSL_OP_NO_TLSv1_3); 327 SSL_CTX_clear_options(ssl->ctx, SSL_OP_NO_TLSv1_3);
328 if (!(protocols & NGX_SSL_TLSv1_3)) { 328 if (!(protocols & NGX_SSL_TLSv1_3)) {
329 SSL_CTX_set_options(ssl->ctx, SSL_OP_NO_TLSv1_3); 329 SSL_CTX_set_options(ssl->ctx, SSL_OP_NO_TLSv1_3);
330 } 330 }
331 #endif
332
333 #ifdef TLS1_3_VERSION
334 SSL_CTX_set_min_proto_version(ssl->ctx, 0);
335 SSL_CTX_set_max_proto_version(ssl->ctx, TLS1_3_VERSION);
331 #endif 336 #endif
332 337
333 #ifdef SSL_OP_NO_COMPRESSION 338 #ifdef SSL_OP_NO_COMPRESSION
334 SSL_CTX_set_options(ssl->ctx, SSL_OP_NO_COMPRESSION); 339 SSL_CTX_set_options(ssl->ctx, SSL_OP_NO_COMPRESSION);
335 #endif 340 #endif