[nginx] SSL: default DH parameters compatible with OpenSSL 1.1.0.

Maxim Dounin mdounin at mdounin.ru
Tue Oct 18 14:48:43 UTC 2016


details:   http://hg.nginx.org/nginx/rev/131bc715ce87
branches:  stable-1.10
changeset: 6770:131bc715ce87
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Tue Oct 18 17:25:38 2016 +0300
description:
SSL: default DH parameters compatible with OpenSSL 1.1.0.

This is a direct commit to stable as there is no corresponding code
in mainline, default DH parameters were removed in 1aa9650a8154.

diffstat:

 src/event/ngx_event_openssl.c |  19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diffs (36 lines):

diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -951,6 +951,8 @@ ngx_ssl_dhparam(ngx_conf_t *cf, ngx_ssl_
             return NGX_ERROR;
         }
 
+#if OPENSSL_VERSION_NUMBER < 0x10100005L
+
         dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
         dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
 
@@ -960,6 +962,23 @@ ngx_ssl_dhparam(ngx_conf_t *cf, ngx_ssl_
             return NGX_ERROR;
         }
 
+#else
+        {
+        BIGNUM  *p, *g;
+
+        p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
+        g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
+
+        if (p == NULL || g == NULL || !DH_set0_pqg(dh, p, NULL, g)) {
+            ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "BN_bin2bn() failed");
+            DH_free(dh);
+            BN_free(p);
+            BN_free(g);
+            return NGX_ERROR;
+        }
+        }
+#endif
+
         SSL_CTX_set_tmp_dh(ssl->ctx, dh);
 
         DH_free(dh);



More information about the nginx-devel mailing list