Hi Willy,

On 05/28/2015 06:19 PM, Willy Tarreau wrote:
>> RSA 1024 is (at last) being phased out, and we have
>> seen on this mailing-list that a DH greater than 2048-bit is simply too
>> costly for a lot of users.
> 
> OK so that means that probably people will prefer to build their own
> DH-1024 to use with 2048 keys.

I hope most users are going to use DH-2048 with RSA-4096 instead, but
yeah, that's the idea :)

>> I didn't have enough time to implement the 3 patches I promised yet,
> 
> I'm not the one who will blame you for that, if you knew the number of
> things I don't have the time to do!

I can't even begin to imagine!

>> I expect to be able to send the ssl-dh-param-file patch tomorrow, as it
>> is mostly written (but not well tested yet), as well as the patch to
>> move from 1024-bit DH to 2048-bit by default.
> 
> Great! Do you think it would make sense to backport the ssl-dh-param-file
> to 1.5 ? I mean, will some users need this in the short term (or said
> differently, may we use this as an incentive to be more careful about
> that ?).

Here it is. Yes, while I am of course a bit reluctant about the idea of
adding a new feature in 1.5, I think it makes sense to backport this one
because it makes it easier to use custom DH parameters, which is the
best option security-wise. Note that if we decide to go the safe way by
not backporting it, it is still possible to work around and do the same
thing by adding custom DH parameters to each cert file.

> Also for 1.5.13 as I understand it, I should regenerate a new dhparam-1024
> to get rid of oakley group 2. I'll need some directions on how to do this
> correctly.

Yes, of course. I am attaching a patch that replace all the hard-coded
DH parameters by new ones, removing the 8192-bit one in the process
because I don't think it will ever be used (it's just too CPU-intensive,
especially now that ECDHE is widely available). Just replace the content
of dh1024_p, dh1024_g, dh2048_p, dh2048_g, dh4096_p and dh4096_g by the
values you get from running those commands on your own host (preferably
with some entropy available):

$ openssl dhparam 1024 -C
$ openssl dhparam 2048 -C
$ openssl dhparam 4096 -C

Please don't hesitate to get back to me if needed, I know I have the bad
habit of skipping crucial steps in my explanations.

-- 
RĂ©mi
From fe610d85b580c8dcf2aa9e07d5ed98abd6604ebd Mon Sep 17 00:00:00 2001
From: Remi Gacogne <rgaco...@aquaray.fr>
Date: Fri, 29 May 2015 15:53:22 +0200
Subject: [PATCH] MEDIUM: ssl: add the possibility to use a global DH
 parameters file

This patch adds the ssl-dh-param-file global setting. It sets the
default DH parameters that will be used during the SSL/TLS handshake when
ephemeral Diffie-Hellman (DHE) key exchange is used, for all "bind" lines
which do not explicitely define theirs.
---
 doc/configuration.txt    | 17 ++++++++++++++-
 include/proto/ssl_sock.h |  3 +++
 src/cfgparse.c           | 18 +++++++++++++++
 src/ssl_sock.c           | 57 +++++++++++++++++++++++++++++++++++++-----------
 4 files changed, 81 insertions(+), 14 deletions(-)

diff --git a/doc/configuration.txt b/doc/configuration.txt
index 9676643..655ede0 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -766,6 +766,20 @@ ssl-default-server-options [<option>]...
   default ssl-options to force on all "server" lines. Please check the "server"
   keyword to see available options.
 
+ssl-dh-param-file <file>
+  This setting is only available when support for OpenSSL was built in. It sets
+  the default DH parameters that are used during the SSL/TLS handshake when
+  ephemeral Diffie-Hellman (DHE) key exchange is used, for all "bind" lines
+  which do not explicitely define theirs. It will be overridden by custom DH
+  parameters found in a bind certificate file if any. If custom DH parameters
+  are not specified either by using ssl-dh-param-file or by setting them directly
+  in the certificate file, pre-generated DH parameters of the size specified
+  by tune.ssl.default-dh-param will be used. Custom parameters are known to be
+  more secure and therefore their use is recommended.
+  Custom DH parameters may be generated by using the OpenSSL command
+  "openssl dhparam <size>", where size should be at least 2048, as 1024-bit DH
+  parameters should not be considered secure anymore.
+
 ssl-server-verify [none|required]
   The default behavior for SSL verify on servers side. If specified to 'none',
   servers certificates are not verified. The default is 'required' except if
@@ -1224,7 +1238,8 @@ tune.ssl.default-dh-param <number>
   this maximum value. Default value if 1024. Only 1024 or higher values are
   allowed. Higher values will increase the CPU load, and values greater than
   1024 bits are not supported by Java 7 and earlier clients. This value is not
-  used if static Diffie-Hellman parameters are supplied via the certificate file.
+  used if static Diffie-Hellman parameters are supplied either directly
+  in the certificate file or by using the ssl-dh-param-file parameter.
 
 tune.zlib.memlevel <number>
   Sets the memLevel parameter in zlib initialization for each session. It
diff --git a/include/proto/ssl_sock.h b/include/proto/ssl_sock.h
index fa5eef5..4db516e 100644
--- a/include/proto/ssl_sock.h
+++ b/include/proto/ssl_sock.h
@@ -64,6 +64,9 @@ struct tls_keys_ref *tlskeys_ref_lookup(const char *filename);
 struct tls_keys_ref *tlskeys_ref_lookupid(int unique_id);
 void tlskeys_finalize_config(void);
 #endif
+#ifndef OPENSSL_NO_DH
+int ssl_sock_load_global_dh_param_from_file(const char *filename);
+#endif
 
 #endif /* _PROTO_SSL_SOCK_H */
 
diff --git a/src/cfgparse.c b/src/cfgparse.c
index bb31188..db7a624 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -753,6 +753,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
 		}
 		global.tune.ssl_max_record = atol(args[1]);
 	}
+#ifndef OPENSSL_NO_DH
 	else if (!strcmp(args[0], "tune.ssl.default-dh-param")) {
 		if (alertif_too_many_args(1, file, linenum, args, &err_code))
 			goto out;
@@ -769,6 +770,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
 		}
 	}
 #endif
+#endif
 	else if (!strcmp(args[0], "tune.buffers.limit")) {
 		if (alertif_too_many_args(1, file, linenum, args, &err_code))
 			goto out;
@@ -1187,6 +1189,22 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
 		goto out;
 #endif
 	}
+#ifdef USE_OPENSSL
+#ifndef OPENSSL_NO_DH
+	else if (!strcmp(args[0], "ssl-dh-param-file")) {
+		if (*(args[1]) == 0) {
+			Alert("parsing [%s:%d] : '%s' expects a file path as an argument.\n", file, linenum, args[0]);
+			err_code |= ERR_ALERT | ERR_FATAL;
+			goto out;
+		}
+		if (ssl_sock_load_global_dh_param_from_file(args[1])) {
+			Alert("parsing [%s:%d] : '%s': unable to load DH parameters from file <%s>.\n", file, linenum, args[0], args[1]);
+			err_code |= ERR_ALERT | ERR_FATAL;
+			goto out;
+		}
+	}
+#endif
+#endif
 	else if (!strcmp(args[0], "ssl-server-verify")) {
 		if (alertif_too_many_args(1, file, linenum, args, &err_code))
 			goto out;
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index e528db2..20a5324 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -124,6 +124,7 @@ struct list tlskeys_reference = LIST_HEAD_INIT(tlskeys_reference);
 
 #ifndef OPENSSL_NO_DH
 static int ssl_dh_ptr_index = -1;
+static DH *global_dh = NULL;
 static DH *local_dh_1024 = NULL;
 static DH *local_dh_2048 = NULL;
 static DH *local_dh_4096 = NULL;
@@ -1332,22 +1333,44 @@ static DH *ssl_get_tmp_dh(SSL *ssl, int export, int keylen)
 	return dh;
 }
 
-/* Loads Diffie-Hellman parameter from a file. Returns 1 if loaded, else -1
-   if an error occured, and 0 if parameter not found. */
-int ssl_sock_load_dh_params(SSL_CTX *ctx, const char *file)
+static DH * ssl_sock_get_dh_from_file(const char *filename)
 {
-	int ret = -1;
-	BIO *in;
 	DH *dh = NULL;
+	BIO *in = BIO_new(BIO_s_file());
 
-	in = BIO_new(BIO_s_file());
 	if (in == NULL)
 		goto end;
 
-	if (BIO_read_filename(in, file) <= 0)
+	if (BIO_read_filename(in, filename) <= 0)
 		goto end;
 
-	dh = PEM_read_bio_DHparams(in, NULL, ctx->default_passwd_callback, ctx->default_passwd_callback_userdata);
+	dh = PEM_read_bio_DHparams(in, NULL, NULL, NULL);
+
+end:
+        if (in)
+                BIO_free(in);
+
+	return dh;
+}
+
+int ssl_sock_load_global_dh_param_from_file(const char *filename)
+{
+	global_dh = ssl_sock_get_dh_from_file(filename);
+
+	if (global_dh) {
+		return 0;
+	}
+
+	return -1;
+}
+
+/* Loads Diffie-Hellman parameter from a file. Returns 1 if loaded, else -1
+   if an error occured, and 0 if parameter not found. */
+int ssl_sock_load_dh_params(SSL_CTX *ctx, const char *file)
+{
+	int ret = -1;
+	DH *dh = ssl_sock_get_dh_from_file(file);
+
 	if (dh) {
 		ret = 1;
 		SSL_CTX_set_tmp_dh(ctx, dh);
@@ -1358,6 +1381,10 @@ int ssl_sock_load_dh_params(SSL_CTX *ctx, const char *file)
 			SSL_CTX_set_ex_data(ctx, ssl_dh_ptr_index, dh);
 		}
 	}
+	else if (global_dh) {
+		SSL_CTX_set_tmp_dh(ctx, global_dh);
+		ret = 0; /* DH params not found */
+	}
 	else {
 		/* Clear openssl global errors stack */
 		ERR_clear_error();
@@ -1381,9 +1408,6 @@ end:
 	if (dh)
 		DH_free(dh);
 
-	if (in)
-		BIO_free(in);
-
 	return ret;
 }
 #endif
@@ -1901,9 +1925,11 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, SSL_CTX *ctx, struct proxy
 		cfgerr++;
 	}
 
-	/* If tune.ssl.default-dh-param has not been set and
-	   no static DH params were in the certificate file. */
+	/* If tune.ssl.default-dh-param has not been set,
+	   neither has ssl-default-dh-file and no static DH
+	   params were in the certificate file. */
 	if (global.tune.ssl_default_dh_param == 0 &&
+	    global_dh == NULL &&
 	    (ssl_dh_ptr_index == -1 ||
 	     SSL_CTX_get_ex_data(ctx, ssl_dh_ptr_index) == NULL)) {
 
@@ -5083,6 +5109,11 @@ static void __ssl_sock_deinit(void)
                 DH_free(local_dh_8192);
                 local_dh_8192 = NULL;
         }
+
+	if (global_dh) {
+		DH_free(global_dh);
+		global_dh = NULL;
+	}
 #endif
 
         ERR_remove_state(0);
-- 
2.4.2

From 7f07d219fea6d140909a7708ee7fabfb6bbfa389 Mon Sep 17 00:00:00 2001
From: Remi Gacogne <rgaco...@aquaray.fr>
Date: Fri, 29 May 2015 16:26:17 +0200
Subject: [PATCH] MEDIUM: ssl: replace standards DH groups with custom ones

It is likely that powerful adversaries have been pre-computing the
standardized DH groups, because being widely used have made them
valuable targets. While users are advised to generate their own
DH parameters, replace the ones we ship by values been randomly
generated for this product only.
---
 src/ssl_sock.c | 342 +++++++++++++++++----------------------------------------
 1 file changed, 103 insertions(+), 239 deletions(-)

diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 20a5324..976c67a 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -128,7 +128,6 @@ static DH *global_dh = NULL;
 static DH *local_dh_1024 = NULL;
 static DH *local_dh_2048 = NULL;
 static DH *local_dh_4096 = NULL;
-static DH *local_dh_8192 = NULL;
 #endif /* OPENSSL_NO_DH */
 
 #if (defined SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB && !defined OPENSSL_NO_OCSP)
@@ -1038,32 +1037,28 @@ static int ssl_sock_switchctx_cbk(SSL *ssl, int *al, struct bind_conf *s)
 
 static DH * ssl_get_dh_1024(void)
 {
-#if (OPENSSL_VERSION_NUMBER < 0x0090801fL || defined OPENSSL_IS_BORINGSSL)
-	static const unsigned char rfc_2409_prime_1024[] = {
-		0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC9,0x0F,0xDA,0xA2,
-		0x21,0x68,0xC2,0x34,0xC4,0xC6,0x62,0x8B,0x80,0xDC,0x1C,0xD1,
-		0x29,0x02,0x4E,0x08,0x8A,0x67,0xCC,0x74,0x02,0x0B,0xBE,0xA6,
-		0x3B,0x13,0x9B,0x22,0x51,0x4A,0x08,0x79,0x8E,0x34,0x04,0xDD,
-		0xEF,0x95,0x19,0xB3,0xCD,0x3A,0x43,0x1B,0x30,0x2B,0x0A,0x6D,
-		0xF2,0x5F,0x14,0x37,0x4F,0xE1,0x35,0x6D,0x6D,0x51,0xC2,0x45,
-		0xE4,0x85,0xB5,0x76,0x62,0x5E,0x7E,0xC6,0xF4,0x4C,0x42,0xE9,
-		0xA6,0x37,0xED,0x6B,0x0B,0xFF,0x5C,0xB6,0xF4,0x06,0xB7,0xED,
-		0xEE,0x38,0x6B,0xFB,0x5A,0x89,0x9F,0xA5,0xAE,0x9F,0x24,0x11,
-		0x7C,0x4B,0x1F,0xE6,0x49,0x28,0x66,0x51,0xEC,0xE6,0x53,0x81,
-		0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-	};
-#endif
+	static unsigned char dh1024_p[]={
+		0xD0,0x0D,0x7B,0x60,0xAC,0x41,0xC4,0x96,0x46,0x38,0x0A,0xA8,
+		0xF6,0x4E,0x1A,0xE7,0x19,0x21,0x1F,0x28,0x67,0xBE,0xFD,0xDB,
+		0xCE,0x7A,0x87,0xE9,0x79,0x4F,0x19,0x48,0xD7,0xC5,0x74,0x5D,
+		0xF9,0xC5,0xBD,0xC8,0xF7,0x41,0x54,0x99,0x8D,0x5B,0x42,0x30,
+		0xC9,0xE1,0x70,0x41,0x52,0x51,0xE4,0xD7,0x92,0x5A,0x43,0x10,
+		0x50,0x1B,0xC7,0xA7,0xD1,0x49,0x6B,0x19,0x91,0x46,0x52,0xDB,
+		0xBB,0x3C,0xC3,0x60,0x1A,0x3E,0xBB,0xEC,0x3B,0xA9,0xC1,0xB2,
+		0xDC,0x1A,0xF5,0x3D,0x0F,0x9E,0xBC,0xC5,0xD8,0xD0,0xDF,0x4D,
+		0x8A,0xA3,0x2C,0x1F,0x63,0xF6,0x74,0x8D,0x8A,0x11,0xDA,0x44,
+		0xD6,0xB7,0x8F,0x38,0x61,0x27,0xA6,0x5F,0x88,0xD3,0xA6,0xEF,
+		0x10,0x05,0x07,0x06,0x92,0x3D,0x16,0xAB,
+		};
+	static unsigned char dh1024_g[]={
+		0x02,
+		};
+
 	DH *dh = DH_new();
 	if (dh) {
-#if (OPENSSL_VERSION_NUMBER >= 0x0090801fL && !defined OPENSSL_IS_BORINGSSL)
-		dh->p = get_rfc2409_prime_1024(NULL);
-#else
-		dh->p = BN_bin2bn(rfc_2409_prime_1024, sizeof rfc_2409_prime_1024, NULL);
-#endif
-		/* See RFC 2409, Section 6 "Oakley Groups"
-		   for the reason why 2 is used as generator.
-		*/
-		BN_dec2bn(&dh->g, "2");
+		dh->p = BN_bin2bn(dh1024_p, sizeof dh1024_p, NULL);
+		dh->g = BN_bin2bn(dh1024_g, sizeof dh1024_g, NULL);
+
 		if (!dh->p || !dh->g) {
 			DH_free(dh);
 			dh = NULL;
@@ -1074,43 +1069,39 @@ static DH * ssl_get_dh_1024(void)
 
 static DH *ssl_get_dh_2048(void)
 {
-#if (OPENSSL_VERSION_NUMBER < 0x0090801fL || defined OPENSSL_IS_BORINGSSL)
-	static const unsigned char rfc_3526_prime_2048[] = {
-		0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC9,0x0F,0xDA,0xA2,
-		0x21,0x68,0xC2,0x34,0xC4,0xC6,0x62,0x8B,0x80,0xDC,0x1C,0xD1,
-		0x29,0x02,0x4E,0x08,0x8A,0x67,0xCC,0x74,0x02,0x0B,0xBE,0xA6,
-		0x3B,0x13,0x9B,0x22,0x51,0x4A,0x08,0x79,0x8E,0x34,0x04,0xDD,
-		0xEF,0x95,0x19,0xB3,0xCD,0x3A,0x43,0x1B,0x30,0x2B,0x0A,0x6D,
-		0xF2,0x5F,0x14,0x37,0x4F,0xE1,0x35,0x6D,0x6D,0x51,0xC2,0x45,
-		0xE4,0x85,0xB5,0x76,0x62,0x5E,0x7E,0xC6,0xF4,0x4C,0x42,0xE9,
-		0xA6,0x37,0xED,0x6B,0x0B,0xFF,0x5C,0xB6,0xF4,0x06,0xB7,0xED,
-		0xEE,0x38,0x6B,0xFB,0x5A,0x89,0x9F,0xA5,0xAE,0x9F,0x24,0x11,
-		0x7C,0x4B,0x1F,0xE6,0x49,0x28,0x66,0x51,0xEC,0xE4,0x5B,0x3D,
-		0xC2,0x00,0x7C,0xB8,0xA1,0x63,0xBF,0x05,0x98,0xDA,0x48,0x36,
-		0x1C,0x55,0xD3,0x9A,0x69,0x16,0x3F,0xA8,0xFD,0x24,0xCF,0x5F,
-		0x83,0x65,0x5D,0x23,0xDC,0xA3,0xAD,0x96,0x1C,0x62,0xF3,0x56,
-		0x20,0x85,0x52,0xBB,0x9E,0xD5,0x29,0x07,0x70,0x96,0x96,0x6D,
-		0x67,0x0C,0x35,0x4E,0x4A,0xBC,0x98,0x04,0xF1,0x74,0x6C,0x08,
-		0xCA,0x18,0x21,0x7C,0x32,0x90,0x5E,0x46,0x2E,0x36,0xCE,0x3B,
-		0xE3,0x9E,0x77,0x2C,0x18,0x0E,0x86,0x03,0x9B,0x27,0x83,0xA2,
-		0xEC,0x07,0xA2,0x8F,0xB5,0xC5,0x5D,0xF0,0x6F,0x4C,0x52,0xC9,
-		0xDE,0x2B,0xCB,0xF6,0x95,0x58,0x17,0x18,0x39,0x95,0x49,0x7C,
-		0xEA,0x95,0x6A,0xE5,0x15,0xD2,0x26,0x18,0x98,0xFA,0x05,0x10,
-		0x15,0x72,0x8E,0x5A,0x8A,0xAC,0xAA,0x68,0xFF,0xFF,0xFF,0xFF,
-		0xFF,0xFF,0xFF,0xFF,
-	};
-#endif
+	static unsigned char dh2048_p[]={
+		0x91,0x29,0xB2,0xA4,0x50,0x20,0x97,0xA7,0x5D,0xFC,0x33,0x2B,
+		0xA1,0xBC,0x84,0x08,0xE2,0xCB,0xCC,0x25,0xC4,0x86,0xC1,0x1E,
+		0x17,0x9C,0x8F,0x80,0x02,0x6B,0xB7,0x91,0xCC,0xD9,0x9B,0x25,
+		0x73,0x11,0x49,0x8F,0x54,0x66,0x31,0xBE,0xC7,0x23,0xD8,0x9A,
+		0x2C,0xD0,0x4B,0xBF,0x65,0xB8,0x4C,0x56,0xAF,0x0B,0xD9,0xED,
+		0x17,0x25,0xF9,0x54,0xD5,0xEE,0x5C,0x06,0x6B,0x67,0x56,0x29,
+		0x16,0x2D,0x05,0xAD,0x69,0x77,0xCA,0x45,0x55,0x06,0x07,0xAC,
+		0x37,0x5F,0x18,0x58,0xDB,0xD4,0x7A,0x86,0x77,0xA6,0x9F,0x7F,
+		0xF4,0x65,0xEB,0x91,0x09,0x34,0x84,0x72,0xCC,0x8F,0x6C,0x48,
+		0x6D,0x1F,0x18,0x72,0x15,0x5A,0x7B,0x3A,0xC1,0xCE,0x9E,0xAA,
+		0x20,0x38,0xD3,0x37,0x9D,0xF0,0x52,0xE2,0x18,0x28,0x58,0x64,
+		0xEA,0xE7,0xB1,0x1D,0xF2,0x1C,0x0D,0x26,0x11,0xB1,0x1D,0xEB,
+		0xEB,0x6E,0x79,0x61,0xBB,0xBC,0xE0,0xE3,0x1C,0x03,0x4B,0xF3,
+		0xA8,0x7A,0xFB,0xED,0x77,0xDC,0x49,0x9A,0x0B,0x4F,0x52,0x7D,
+		0x2C,0x1C,0x57,0x7B,0x83,0x09,0xCC,0xBB,0xA2,0x0E,0x61,0xBB,
+		0x1B,0xE1,0x0D,0x13,0xA8,0xE9,0x9E,0xAC,0xAF,0xD5,0xE5,0x57,
+		0xD4,0x40,0x12,0x38,0xF5,0xB2,0x01,0x77,0x28,0xAB,0xC8,0xAE,
+		0x8C,0xB3,0x5D,0x1A,0xE7,0x11,0xCB,0xFA,0x4E,0xE6,0x81,0x2A,
+		0xAF,0xEA,0x5D,0x13,0xF9,0x87,0x4B,0x8E,0x46,0x52,0xF4,0x5E,
+		0xA9,0x92,0x06,0xB5,0xE3,0xB2,0xF9,0xC4,0x7C,0x68,0xBC,0x61,
+		0xEF,0xAB,0xCD,0x25,0x80,0xB0,0x8F,0xFE,0x86,0x99,0xAF,0x71,
+		0xE2,0x0E,0xFC,0x93,
+		};
+	static unsigned char dh2048_g[]={
+		0x02,
+		};
+
 	DH *dh = DH_new();
 	if (dh) {
-#if (OPENSSL_VERSION_NUMBER >= 0x0090801fL && !defined OPENSSL_IS_BORINGSSL)
-		dh->p = get_rfc3526_prime_2048(NULL);
-#else
-		dh->p = BN_bin2bn(rfc_3526_prime_2048, sizeof rfc_3526_prime_2048, NULL);
-#endif
-		/* See RFC 3526, Section 3 "2048-bit MODP Group"
-		   for the reason why 2 is used as generator.
-		*/
-		BN_dec2bn(&dh->g, "2");
+		dh->p = BN_bin2bn(dh2048_p, sizeof dh2048_p, NULL);
+		dh->g = BN_bin2bn(dh2048_g, sizeof dh2048_g, NULL);
+
 		if (!dh->p || !dh->g) {
 			DH_free(dh);
 			dh = NULL;
@@ -1121,175 +1112,60 @@ static DH *ssl_get_dh_2048(void)
 
 static DH *ssl_get_dh_4096(void)
 {
-#if (OPENSSL_VERSION_NUMBER < 0x0090801fL || defined OPENSSL_IS_BORINGSSL)
-	static const unsigned char rfc_3526_prime_4096[] = {
-                0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC9,0x0F,0xDA,0xA2,
-                0x21,0x68,0xC2,0x34,0xC4,0xC6,0x62,0x8B,0x80,0xDC,0x1C,0xD1,
-                0x29,0x02,0x4E,0x08,0x8A,0x67,0xCC,0x74,0x02,0x0B,0xBE,0xA6,
-                0x3B,0x13,0x9B,0x22,0x51,0x4A,0x08,0x79,0x8E,0x34,0x04,0xDD,
-                0xEF,0x95,0x19,0xB3,0xCD,0x3A,0x43,0x1B,0x30,0x2B,0x0A,0x6D,
-                0xF2,0x5F,0x14,0x37,0x4F,0xE1,0x35,0x6D,0x6D,0x51,0xC2,0x45,
-                0xE4,0x85,0xB5,0x76,0x62,0x5E,0x7E,0xC6,0xF4,0x4C,0x42,0xE9,
-                0xA6,0x37,0xED,0x6B,0x0B,0xFF,0x5C,0xB6,0xF4,0x06,0xB7,0xED,
-                0xEE,0x38,0x6B,0xFB,0x5A,0x89,0x9F,0xA5,0xAE,0x9F,0x24,0x11,
-                0x7C,0x4B,0x1F,0xE6,0x49,0x28,0x66,0x51,0xEC,0xE4,0x5B,0x3D,
-                0xC2,0x00,0x7C,0xB8,0xA1,0x63,0xBF,0x05,0x98,0xDA,0x48,0x36,
-                0x1C,0x55,0xD3,0x9A,0x69,0x16,0x3F,0xA8,0xFD,0x24,0xCF,0x5F,
-                0x83,0x65,0x5D,0x23,0xDC,0xA3,0xAD,0x96,0x1C,0x62,0xF3,0x56,
-                0x20,0x85,0x52,0xBB,0x9E,0xD5,0x29,0x07,0x70,0x96,0x96,0x6D,
-                0x67,0x0C,0x35,0x4E,0x4A,0xBC,0x98,0x04,0xF1,0x74,0x6C,0x08,
-                0xCA,0x18,0x21,0x7C,0x32,0x90,0x5E,0x46,0x2E,0x36,0xCE,0x3B,
-                0xE3,0x9E,0x77,0x2C,0x18,0x0E,0x86,0x03,0x9B,0x27,0x83,0xA2,
-                0xEC,0x07,0xA2,0x8F,0xB5,0xC5,0x5D,0xF0,0x6F,0x4C,0x52,0xC9,
-                0xDE,0x2B,0xCB,0xF6,0x95,0x58,0x17,0x18,0x39,0x95,0x49,0x7C,
-                0xEA,0x95,0x6A,0xE5,0x15,0xD2,0x26,0x18,0x98,0xFA,0x05,0x10,
-                0x15,0x72,0x8E,0x5A,0x8A,0xAA,0xC4,0x2D,0xAD,0x33,0x17,0x0D,
-                0x04,0x50,0x7A,0x33,0xA8,0x55,0x21,0xAB,0xDF,0x1C,0xBA,0x64,
-                0xEC,0xFB,0x85,0x04,0x58,0xDB,0xEF,0x0A,0x8A,0xEA,0x71,0x57,
-                0x5D,0x06,0x0C,0x7D,0xB3,0x97,0x0F,0x85,0xA6,0xE1,0xE4,0xC7,
-                0xAB,0xF5,0xAE,0x8C,0xDB,0x09,0x33,0xD7,0x1E,0x8C,0x94,0xE0,
-                0x4A,0x25,0x61,0x9D,0xCE,0xE3,0xD2,0x26,0x1A,0xD2,0xEE,0x6B,
-                0xF1,0x2F,0xFA,0x06,0xD9,0x8A,0x08,0x64,0xD8,0x76,0x02,0x73,
-                0x3E,0xC8,0x6A,0x64,0x52,0x1F,0x2B,0x18,0x17,0x7B,0x20,0x0C,
-                0xBB,0xE1,0x17,0x57,0x7A,0x61,0x5D,0x6C,0x77,0x09,0x88,0xC0,
-                0xBA,0xD9,0x46,0xE2,0x08,0xE2,0x4F,0xA0,0x74,0xE5,0xAB,0x31,
-                0x43,0xDB,0x5B,0xFC,0xE0,0xFD,0x10,0x8E,0x4B,0x82,0xD1,0x20,
-                0xA9,0x21,0x08,0x01,0x1A,0x72,0x3C,0x12,0xA7,0x87,0xE6,0xD7,
-                0x88,0x71,0x9A,0x10,0xBD,0xBA,0x5B,0x26,0x99,0xC3,0x27,0x18,
-                0x6A,0xF4,0xE2,0x3C,0x1A,0x94,0x68,0x34,0xB6,0x15,0x0B,0xDA,
-                0x25,0x83,0xE9,0xCA,0x2A,0xD4,0x4C,0xE8,0xDB,0xBB,0xC2,0xDB,
-                0x04,0xDE,0x8E,0xF9,0x2E,0x8E,0xFC,0x14,0x1F,0xBE,0xCA,0xA6,
-                0x28,0x7C,0x59,0x47,0x4E,0x6B,0xC0,0x5D,0x99,0xB2,0x96,0x4F,
-                0xA0,0x90,0xC3,0xA2,0x23,0x3B,0xA1,0x86,0x51,0x5B,0xE7,0xED,
-                0x1F,0x61,0x29,0x70,0xCE,0xE2,0xD7,0xAF,0xB8,0x1B,0xDD,0x76,
-                0x21,0x70,0x48,0x1C,0xD0,0x06,0x91,0x27,0xD5,0xB0,0x5A,0xA9,
-                0x93,0xB4,0xEA,0x98,0x8D,0x8F,0xDD,0xC1,0x86,0xFF,0xB7,0xDC,
-                0x90,0xA6,0xC0,0x8F,0x4D,0xF4,0x35,0xC9,0x34,0x06,0x31,0x99,
-                0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-	};
-#endif
-	DH *dh = DH_new();
-	if (dh) {
-#if (OPENSSL_VERSION_NUMBER >= 0x0090801fL && !defined OPENSSL_IS_BORINGSSL)
-		dh->p = get_rfc3526_prime_4096(NULL);
-#else
-		dh->p = BN_bin2bn(rfc_3526_prime_4096, sizeof rfc_3526_prime_4096, NULL);
-#endif
-		/* See RFC 3526, Section 5 "4096-bit MODP Group"
-		   for the reason why 2 is used as generator.
-		*/
-		BN_dec2bn(&dh->g, "2");
-		if (!dh->p || !dh->g) {
-			DH_free(dh);
-			dh = NULL;
-		}
-	}
-	return dh;
-}
+	static unsigned char dh4096_p[]={
+		0xD0,0x1C,0xEB,0x66,0xD2,0x69,0xF0,0x45,0xD4,0x5E,0x7F,0xFE,
+		0x5E,0xBA,0x00,0x7D,0xFE,0xBE,0x91,0x27,0xC6,0xF2,0x8D,0x21,
+		0x08,0xCF,0xE9,0x14,0x3E,0x96,0xAE,0x1B,0x24,0x69,0x15,0x83,
+		0x1C,0x99,0x33,0x9C,0x05,0x50,0xF4,0x03,0xBD,0x39,0xC6,0xD2,
+		0x3E,0xC7,0x98,0xFD,0x65,0x7F,0x1A,0xF5,0x57,0xA4,0xEF,0xB9,
+		0xA4,0xF4,0x66,0xD9,0x69,0x90,0x41,0x6A,0x88,0x8C,0x94,0x1A,
+		0x13,0xFA,0xDF,0xF8,0x99,0x9F,0xB4,0xBB,0xAF,0x0F,0x4C,0x73,
+		0x6D,0x11,0x7E,0xB8,0xC9,0x19,0x36,0xBB,0x2B,0x30,0x5D,0x64,
+		0x51,0x68,0x74,0xC0,0xE6,0x9B,0x7E,0x43,0x82,0x74,0xC7,0x65,
+		0x7A,0x8A,0x20,0xA0,0x9F,0x78,0x5E,0xA6,0xF1,0xFB,0xF6,0x38,
+		0xA5,0x1A,0xA1,0xE1,0x49,0xCE,0x63,0x3F,0x20,0xEF,0xCF,0xAD,
+		0x12,0x6E,0xDB,0x56,0x14,0x37,0x99,0xAB,0x19,0xB9,0xB0,0xE9,
+		0x61,0xFC,0x93,0x91,0x51,0x13,0x4C,0x68,0x54,0x43,0xBF,0x56,
+		0xBF,0x67,0xD1,0xC9,0x36,0x50,0xB1,0x21,0x5A,0xE7,0xD8,0xE8,
+		0xAB,0x99,0x2E,0x3F,0x11,0xF2,0x13,0x75,0x10,0xBF,0x04,0x6D,
+		0x7E,0xFD,0x61,0xB7,0x71,0xD8,0x58,0x6B,0xE5,0x2C,0x5F,0xC8,
+		0x4B,0xED,0xA9,0x9B,0x22,0x4D,0xD6,0x7B,0x12,0x33,0x89,0xA2,
+		0xD7,0x83,0x83,0xB0,0xA6,0x86,0x0A,0xED,0xC9,0x5A,0x19,0x4A,
+		0xBB,0x1B,0x2D,0xC5,0xB8,0xBD,0xD2,0x40,0x22,0x48,0x82,0x44,
+		0x40,0x7A,0xF6,0x44,0x20,0xDE,0xF6,0x51,0x9D,0x3C,0xE1,0xA7,
+		0xFF,0x6A,0x68,0xBF,0xBD,0xF8,0x59,0x89,0xBA,0x7E,0x55,0x7E,
+		0xC8,0xB0,0xBF,0xA7,0x63,0x1B,0xA6,0x7D,0x54,0x47,0x26,0x7E,
+		0xA4,0xF6,0x65,0xAB,0x89,0xB3,0xA2,0x9D,0x52,0xD7,0x8E,0x6C,
+		0x50,0x38,0x13,0x1A,0x2A,0x94,0xC7,0x69,0x16,0xA9,0x92,0x41,
+		0x3C,0xA9,0x02,0x8C,0xC0,0x2A,0x88,0x6C,0x7D,0x16,0xE2,0xBE,
+		0xEB,0xA7,0x6F,0xA1,0xFD,0x51,0x8A,0xAD,0x17,0x69,0x06,0x02,
+		0xDF,0x98,0x01,0xC9,0x49,0x29,0xD3,0x5B,0x3F,0xBC,0x96,0x82,
+		0x23,0x7E,0x02,0x4B,0x70,0xC9,0x61,0x26,0x55,0xA7,0x19,0xC8,
+		0x9F,0x37,0xF8,0xA2,0x4D,0x4C,0xAC,0x41,0x8D,0xAA,0x7B,0x90,
+		0x47,0x51,0x6C,0x8B,0xBB,0x19,0x5F,0xC7,0x52,0x56,0x29,0x9C,
+		0x7C,0x5E,0xB8,0x6D,0x2C,0x04,0x40,0xD1,0x62,0x69,0x15,0x35,
+		0x95,0x44,0x3C,0x86,0xDD,0x09,0xDF,0x61,0xB3,0xCD,0x01,0x17,
+		0x87,0xC7,0x7A,0x0A,0xD0,0xF5,0x7A,0xBC,0x15,0xD3,0xC3,0xBC,
+		0x49,0xD5,0xDA,0xBD,0xBD,0x5F,0x30,0xC4,0xDE,0xD8,0x3E,0xC2,
+		0x5A,0x62,0xC0,0xE4,0xC9,0x12,0x95,0x36,0x12,0x07,0x3F,0xA1,
+		0xD9,0x52,0x54,0x2A,0x3E,0xFC,0x47,0x4A,0x90,0x07,0x66,0x25,
+		0x36,0x40,0x8D,0x47,0xFB,0xEB,0x0F,0x86,0xA2,0xF6,0x87,0xE6,
+		0x0D,0x2C,0x65,0xDD,0x99,0x1D,0x2A,0xB2,0xFD,0xDF,0xE0,0x9F,
+		0xB7,0x26,0x1F,0xCB,0xB4,0xBE,0x7C,0x52,0x53,0x74,0xCE,0x7E,
+		0x34,0xDE,0x29,0x5B,0x95,0x1C,0xC7,0x1F,0x89,0x4D,0x8E,0xB3,
+		0xE5,0x72,0x26,0x00,0xF2,0xAB,0x70,0xCC,0x8A,0xDA,0xED,0xD2,
+		0xB1,0xA0,0x66,0xDB,0xC7,0x35,0xE2,0x4E,0xF2,0xCE,0x75,0xC3,
+		0x9B,0x34,0xD1,0x84,0x34,0xDE,0x99,0x4B,
+		};
+	static unsigned char dh4096_g[]={
+		0x02,
+		};
 
-static DH *ssl_get_dh_8192(void)
-{
-#if (OPENSSL_VERSION_NUMBER < 0x0090801fL || defined OPENSSL_IS_BORINGSSL)
-	static const unsigned char rfc_3526_prime_8192[] = {
-                0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC9,0x0F,0xDA,0xA2,
-                0x21,0x68,0xC2,0x34,0xC4,0xC6,0x62,0x8B,0x80,0xDC,0x1C,0xD1,
-                0x29,0x02,0x4E,0x08,0x8A,0x67,0xCC,0x74,0x02,0x0B,0xBE,0xA6,
-                0x3B,0x13,0x9B,0x22,0x51,0x4A,0x08,0x79,0x8E,0x34,0x04,0xDD,
-                0xEF,0x95,0x19,0xB3,0xCD,0x3A,0x43,0x1B,0x30,0x2B,0x0A,0x6D,
-                0xF2,0x5F,0x14,0x37,0x4F,0xE1,0x35,0x6D,0x6D,0x51,0xC2,0x45,
-                0xE4,0x85,0xB5,0x76,0x62,0x5E,0x7E,0xC6,0xF4,0x4C,0x42,0xE9,
-                0xA6,0x37,0xED,0x6B,0x0B,0xFF,0x5C,0xB6,0xF4,0x06,0xB7,0xED,
-                0xEE,0x38,0x6B,0xFB,0x5A,0x89,0x9F,0xA5,0xAE,0x9F,0x24,0x11,
-                0x7C,0x4B,0x1F,0xE6,0x49,0x28,0x66,0x51,0xEC,0xE4,0x5B,0x3D,
-                0xC2,0x00,0x7C,0xB8,0xA1,0x63,0xBF,0x05,0x98,0xDA,0x48,0x36,
-                0x1C,0x55,0xD3,0x9A,0x69,0x16,0x3F,0xA8,0xFD,0x24,0xCF,0x5F,
-                0x83,0x65,0x5D,0x23,0xDC,0xA3,0xAD,0x96,0x1C,0x62,0xF3,0x56,
-                0x20,0x85,0x52,0xBB,0x9E,0xD5,0x29,0x07,0x70,0x96,0x96,0x6D,
-                0x67,0x0C,0x35,0x4E,0x4A,0xBC,0x98,0x04,0xF1,0x74,0x6C,0x08,
-                0xCA,0x18,0x21,0x7C,0x32,0x90,0x5E,0x46,0x2E,0x36,0xCE,0x3B,
-                0xE3,0x9E,0x77,0x2C,0x18,0x0E,0x86,0x03,0x9B,0x27,0x83,0xA2,
-                0xEC,0x07,0xA2,0x8F,0xB5,0xC5,0x5D,0xF0,0x6F,0x4C,0x52,0xC9,
-                0xDE,0x2B,0xCB,0xF6,0x95,0x58,0x17,0x18,0x39,0x95,0x49,0x7C,
-                0xEA,0x95,0x6A,0xE5,0x15,0xD2,0x26,0x18,0x98,0xFA,0x05,0x10,
-                0x15,0x72,0x8E,0x5A,0x8A,0xAA,0xC4,0x2D,0xAD,0x33,0x17,0x0D,
-                0x04,0x50,0x7A,0x33,0xA8,0x55,0x21,0xAB,0xDF,0x1C,0xBA,0x64,
-                0xEC,0xFB,0x85,0x04,0x58,0xDB,0xEF,0x0A,0x8A,0xEA,0x71,0x57,
-                0x5D,0x06,0x0C,0x7D,0xB3,0x97,0x0F,0x85,0xA6,0xE1,0xE4,0xC7,
-                0xAB,0xF5,0xAE,0x8C,0xDB,0x09,0x33,0xD7,0x1E,0x8C,0x94,0xE0,
-                0x4A,0x25,0x61,0x9D,0xCE,0xE3,0xD2,0x26,0x1A,0xD2,0xEE,0x6B,
-                0xF1,0x2F,0xFA,0x06,0xD9,0x8A,0x08,0x64,0xD8,0x76,0x02,0x73,
-                0x3E,0xC8,0x6A,0x64,0x52,0x1F,0x2B,0x18,0x17,0x7B,0x20,0x0C,
-                0xBB,0xE1,0x17,0x57,0x7A,0x61,0x5D,0x6C,0x77,0x09,0x88,0xC0,
-                0xBA,0xD9,0x46,0xE2,0x08,0xE2,0x4F,0xA0,0x74,0xE5,0xAB,0x31,
-                0x43,0xDB,0x5B,0xFC,0xE0,0xFD,0x10,0x8E,0x4B,0x82,0xD1,0x20,
-                0xA9,0x21,0x08,0x01,0x1A,0x72,0x3C,0x12,0xA7,0x87,0xE6,0xD7,
-                0x88,0x71,0x9A,0x10,0xBD,0xBA,0x5B,0x26,0x99,0xC3,0x27,0x18,
-                0x6A,0xF4,0xE2,0x3C,0x1A,0x94,0x68,0x34,0xB6,0x15,0x0B,0xDA,
-                0x25,0x83,0xE9,0xCA,0x2A,0xD4,0x4C,0xE8,0xDB,0xBB,0xC2,0xDB,
-                0x04,0xDE,0x8E,0xF9,0x2E,0x8E,0xFC,0x14,0x1F,0xBE,0xCA,0xA6,
-                0x28,0x7C,0x59,0x47,0x4E,0x6B,0xC0,0x5D,0x99,0xB2,0x96,0x4F,
-                0xA0,0x90,0xC3,0xA2,0x23,0x3B,0xA1,0x86,0x51,0x5B,0xE7,0xED,
-                0x1F,0x61,0x29,0x70,0xCE,0xE2,0xD7,0xAF,0xB8,0x1B,0xDD,0x76,
-                0x21,0x70,0x48,0x1C,0xD0,0x06,0x91,0x27,0xD5,0xB0,0x5A,0xA9,
-                0x93,0xB4,0xEA,0x98,0x8D,0x8F,0xDD,0xC1,0x86,0xFF,0xB7,0xDC,
-                0x90,0xA6,0xC0,0x8F,0x4D,0xF4,0x35,0xC9,0x34,0x02,0x84,0x92,
-                0x36,0xC3,0xFA,0xB4,0xD2,0x7C,0x70,0x26,0xC1,0xD4,0xDC,0xB2,
-                0x60,0x26,0x46,0xDE,0xC9,0x75,0x1E,0x76,0x3D,0xBA,0x37,0xBD,
-                0xF8,0xFF,0x94,0x06,0xAD,0x9E,0x53,0x0E,0xE5,0xDB,0x38,0x2F,
-                0x41,0x30,0x01,0xAE,0xB0,0x6A,0x53,0xED,0x90,0x27,0xD8,0x31,
-                0x17,0x97,0x27,0xB0,0x86,0x5A,0x89,0x18,0xDA,0x3E,0xDB,0xEB,
-                0xCF,0x9B,0x14,0xED,0x44,0xCE,0x6C,0xBA,0xCE,0xD4,0xBB,0x1B,
-                0xDB,0x7F,0x14,0x47,0xE6,0xCC,0x25,0x4B,0x33,0x20,0x51,0x51,
-                0x2B,0xD7,0xAF,0x42,0x6F,0xB8,0xF4,0x01,0x37,0x8C,0xD2,0xBF,
-                0x59,0x83,0xCA,0x01,0xC6,0x4B,0x92,0xEC,0xF0,0x32,0xEA,0x15,
-                0xD1,0x72,0x1D,0x03,0xF4,0x82,0xD7,0xCE,0x6E,0x74,0xFE,0xF6,
-                0xD5,0x5E,0x70,0x2F,0x46,0x98,0x0C,0x82,0xB5,0xA8,0x40,0x31,
-                0x90,0x0B,0x1C,0x9E,0x59,0xE7,0xC9,0x7F,0xBE,0xC7,0xE8,0xF3,
-                0x23,0xA9,0x7A,0x7E,0x36,0xCC,0x88,0xBE,0x0F,0x1D,0x45,0xB7,
-                0xFF,0x58,0x5A,0xC5,0x4B,0xD4,0x07,0xB2,0x2B,0x41,0x54,0xAA,
-                0xCC,0x8F,0x6D,0x7E,0xBF,0x48,0xE1,0xD8,0x14,0xCC,0x5E,0xD2,
-                0x0F,0x80,0x37,0xE0,0xA7,0x97,0x15,0xEE,0xF2,0x9B,0xE3,0x28,
-                0x06,0xA1,0xD5,0x8B,0xB7,0xC5,0xDA,0x76,0xF5,0x50,0xAA,0x3D,
-                0x8A,0x1F,0xBF,0xF0,0xEB,0x19,0xCC,0xB1,0xA3,0x13,0xD5,0x5C,
-                0xDA,0x56,0xC9,0xEC,0x2E,0xF2,0x96,0x32,0x38,0x7F,0xE8,0xD7,
-                0x6E,0x3C,0x04,0x68,0x04,0x3E,0x8F,0x66,0x3F,0x48,0x60,0xEE,
-                0x12,0xBF,0x2D,0x5B,0x0B,0x74,0x74,0xD6,0xE6,0x94,0xF9,0x1E,
-                0x6D,0xBE,0x11,0x59,0x74,0xA3,0x92,0x6F,0x12,0xFE,0xE5,0xE4,
-                0x38,0x77,0x7C,0xB6,0xA9,0x32,0xDF,0x8C,0xD8,0xBE,0xC4,0xD0,
-                0x73,0xB9,0x31,0xBA,0x3B,0xC8,0x32,0xB6,0x8D,0x9D,0xD3,0x00,
-                0x74,0x1F,0xA7,0xBF,0x8A,0xFC,0x47,0xED,0x25,0x76,0xF6,0x93,
-                0x6B,0xA4,0x24,0x66,0x3A,0xAB,0x63,0x9C,0x5A,0xE4,0xF5,0x68,
-                0x34,0x23,0xB4,0x74,0x2B,0xF1,0xC9,0x78,0x23,0x8F,0x16,0xCB,
-                0xE3,0x9D,0x65,0x2D,0xE3,0xFD,0xB8,0xBE,0xFC,0x84,0x8A,0xD9,
-                0x22,0x22,0x2E,0x04,0xA4,0x03,0x7C,0x07,0x13,0xEB,0x57,0xA8,
-                0x1A,0x23,0xF0,0xC7,0x34,0x73,0xFC,0x64,0x6C,0xEA,0x30,0x6B,
-                0x4B,0xCB,0xC8,0x86,0x2F,0x83,0x85,0xDD,0xFA,0x9D,0x4B,0x7F,
-                0xA2,0xC0,0x87,0xE8,0x79,0x68,0x33,0x03,0xED,0x5B,0xDD,0x3A,
-                0x06,0x2B,0x3C,0xF5,0xB3,0xA2,0x78,0xA6,0x6D,0x2A,0x13,0xF8,
-                0x3F,0x44,0xF8,0x2D,0xDF,0x31,0x0E,0xE0,0x74,0xAB,0x6A,0x36,
-                0x45,0x97,0xE8,0x99,0xA0,0x25,0x5D,0xC1,0x64,0xF3,0x1C,0xC5,
-                0x08,0x46,0x85,0x1D,0xF9,0xAB,0x48,0x19,0x5D,0xED,0x7E,0xA1,
-                0xB1,0xD5,0x10,0xBD,0x7E,0xE7,0x4D,0x73,0xFA,0xF3,0x6B,0xC3,
-                0x1E,0xCF,0xA2,0x68,0x35,0x90,0x46,0xF4,0xEB,0x87,0x9F,0x92,
-                0x40,0x09,0x43,0x8B,0x48,0x1C,0x6C,0xD7,0x88,0x9A,0x00,0x2E,
-                0xD5,0xEE,0x38,0x2B,0xC9,0x19,0x0D,0xA6,0xFC,0x02,0x6E,0x47,
-                0x95,0x58,0xE4,0x47,0x56,0x77,0xE9,0xAA,0x9E,0x30,0x50,0xE2,
-                0x76,0x56,0x94,0xDF,0xC8,0x1F,0x56,0xE8,0x80,0xB9,0x6E,0x71,
-                0x60,0xC9,0x80,0xDD,0x98,0xED,0xD3,0xDF,0xFF,0xFF,0xFF,0xFF,
-                0xFF,0xFF,0xFF,0xFF,
-	};
-#endif
 	DH *dh = DH_new();
 	if (dh) {
-#if (OPENSSL_VERSION_NUMBER >= 0x0090801fL && !defined OPENSSL_IS_BORINGSSL)
-		dh->p = get_rfc3526_prime_8192(NULL);
-#else
-		dh->p = BN_bin2bn(rfc_3526_prime_8192, sizeof rfc_3526_prime_8192, NULL);
-#endif
-		/* See RFC 3526, Section 7 "8192-bit MODP Group"
-		   for the reason why 2 is used as generator.
-		*/
-		BN_dec2bn(&dh->g, "2");
+		dh->p = BN_bin2bn(dh4096_p, sizeof dh4096_p, NULL);
+		dh->g = BN_bin2bn(dh4096_g, sizeof dh4096_g, NULL);
+
 		if (!dh->p || !dh->g) {
 			DH_free(dh);
 			dh = NULL;
@@ -1317,10 +1193,7 @@ static DH *ssl_get_tmp_dh(SSL *ssl, int export, int keylen)
 		keylen = global.tune.ssl_default_dh_param;
 	}
 
-	if (keylen >= 8192) {
-		dh = local_dh_8192;
-	}
-	else if (keylen >= 4096) {
+	if (keylen >= 4096) {
 		dh = local_dh_4096;
 	}
 	else if (keylen >= 2048) {
@@ -1974,10 +1847,6 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, SSL_CTX *ctx, struct proxy
 				if (local_dh_4096 == NULL) {
 					local_dh_4096 = ssl_get_dh_4096();
 				}
-				if (global.tune.ssl_default_dh_param >= 8192 &&
-				    local_dh_8192 == NULL) {
-					local_dh_8192 = ssl_get_dh_8192();
-				}
 			}
 		}
 	}
@@ -5105,11 +4974,6 @@ static void __ssl_sock_deinit(void)
                 local_dh_4096 = NULL;
         }
 
-        if (local_dh_8192) {
-                DH_free(local_dh_8192);
-                local_dh_8192 = NULL;
-        }
-
 	if (global_dh) {
 		DH_free(global_dh);
 		global_dh = NULL;
-- 
2.4.2

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to