openvswitch: bump to version 2.10.0

- Rebased the python target/host separation patch
 - Dropped the now-in-upstream openssl-1.1 compat patch
 - Added a patch to disable tests/

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
This commit is contained in:
Yousong Zhou 2018-08-21 00:39:58 +00:00
parent e3edf8fd01
commit 1b485efbcb
9 changed files with 65 additions and 385 deletions

View File

@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=openvswitch
PKG_VERSION:=2.9.2
PKG_RELEASE:=2
PKG_VERSION:=2.10.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.openvswitch.org/releases/
PKG_HASH:=90f084dc282fdb588a2cfff351fea359492f69600f1e4a1286e24e44901de113
PKG_HASH:=64f7cdcfffc73b2e09980d04ee22731eadd6453698b92d7397c9e45c7c174050
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE

View File

@ -1,7 +1,7 @@
From c27232c954cdbe0207252ad88fddad4fd6ac0fbc Mon Sep 17 00:00:00 2001
From 054968d5748c9ff73a69155cd64f0e81287d3bb3 Mon Sep 17 00:00:00 2001
From: Helmut Schaa <helmut.schaa@googlemail.com>
Date: Wed, 8 Jan 2014 13:48:33 +0100
Subject: [PATCH 100/104] netdev-linux: Use unsigned int for ifi_flags
Subject: [PATCH 100/105] netdev-linux: Use unsigned int for ifi_flags
ifi_flags is unsigned, the local equivalents should do the same.
@ -10,9 +10,11 @@ Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
lib/netdev-linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index e16ea58a0..5ada9a21f 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2810,7 +2810,7 @@ update_flags(struct netdev_linux *netdev
@@ -3115,7 +3115,7 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
enum netdev_flags on, enum netdev_flags *old_flagsp)
OVS_REQUIRES(netdev->mutex)
{

View File

@ -1,7 +1,7 @@
From a6df8dd455c8be7c0c2ba79f35cf5390e892b39e Mon Sep 17 00:00:00 2001
From a3eabe1e639c98ce8537df4ac4187a8c047dac59 Mon Sep 17 00:00:00 2001
From: Helmut Schaa <helmut.schaa@googlemail.com>
Date: Wed, 8 Jan 2014 13:48:49 +0100
Subject: [PATCH 101/104] netdev-linux: Let interface flag survive internal
Subject: [PATCH 101/105] netdev-linux: Let interface flag survive internal
port setup
Due to a race condition when bringing up an internal port on Linux
@ -17,9 +17,11 @@ Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
lib/netdev-linux.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 5ada9a21f..bb8275cfa 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2813,7 +2813,13 @@ update_flags(struct netdev_linux *netdev
@@ -3118,7 +3118,13 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
unsigned int old_flags, new_flags;
int error = 0;

View File

@ -1,17 +1,19 @@
From b3cc748d502f7f87aeb103b3f69573b0e640e2ba Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Wed, 28 Feb 2018 13:42:44 +0800
Subject: [PATCH 102/104] python: separate host/target python for cross-compile
From b5c6d8c2e1ba0c3d9b93622f68f6c0b9e9c62f0d Mon Sep 17 00:00:00 2001
From: Yousong Zhou <zhouyousong@yunionyun.com>
Date: Tue, 21 Aug 2018 12:21:05 +0000
Subject: [PATCH 102/105] python: separate host/target python for cross-compile
At the moment, python-six is a requirement for openvswitch python
library on target machine.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
Makefile.am | 2 +-
m4/openvswitch.m4 | 12 ++++--------
2 files changed, 5 insertions(+), 9 deletions(-)
Makefile.am | 2 +-
m4/openvswitch.m4 | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 788972804..cd90cc176 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -60,7 +60,7 @@ endif
@ -23,30 +25,17 @@ Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
ALL_LOCAL =
BUILT_SOURCES =
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 5743f83ce..acb6b140e 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -351,20 +351,16 @@ else:
if test $ovs_cv_python = no; then
AC_MSG_ERROR([cannot find python 2.7 or higher.])
fi
- AM_MISSING_PROG([PYTHON], [python])
+ AC_SUBST([PYTHON])
PYTHON=$ovs_cv_python
+ AM_MISSING_PROG([PYTHON_HOST], [python])
+ PYTHON_HOST=$ovs_cv_python_host
@@ -449,7 +449,9 @@ AC_DEFUN([OVS_CHECK_PYTHON],
fi])
AC_SUBST([PYTHON])
PYTHON=$ovs_cv_python
+ PYTHON_HOST=$ovs_cv_python_host
AC_SUBST([HAVE_PYTHON])
+ AM_MISSING_PROG([PYTHON_HOST], [python])
HAVE_PYTHON=yes
AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
# HAVE_PYTHON is always true. (Python has not always been a build
# requirement, so this variable is now obsolete.)
AC_SUBST([HAVE_PYTHON])
HAVE_PYTHON=yes
- AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])
-
- AC_MSG_CHECKING([whether $PYTHON has six library])
- if ! $PYTHON -c 'import six ; six.moves.range' >&AS_MESSAGE_LOG_FD 2>&1; then
- AC_MSG_ERROR([Missing Python six library or version too old.])
- fi
- AC_MSG_RESULT([yes])])
+ AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
dnl Checks for Python 3.x, x >= 4.
AC_DEFUN([OVS_CHECK_PYTHON3],

View File

@ -1,7 +1,7 @@
From 05a6fa94778f9d6c54ca676de80708d03d6c365a Mon Sep 17 00:00:00 2001
From 0b8ef58a26ed8d426acfe1fa27713cbcc2427f3f Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Wed, 14 Mar 2018 16:40:01 +0800
Subject: [PATCH 103/104] ovs-ctl: fix setting hostname
Subject: [PATCH 103/105] ovs-ctl: fix setting hostname
The command "hostname" is not available in OpenWrt by default.
@ -13,9 +13,11 @@ Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
utilities/ovs-ctl.in | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 43c8f32b7..6203ecff5 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -64,9 +64,7 @@ insert_mod_if_required () {
@@ -36,9 +36,7 @@ insert_mod_if_required () {
}
set_hostname () {

View File

@ -1,7 +1,7 @@
From 43b855e201bd25a015ba6444cabce12b8cc181ec Mon Sep 17 00:00:00 2001
From 97107da940da7814c3e9e947aee1c247cd7b95db Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Wed, 14 Mar 2018 16:44:13 +0800
Subject: [PATCH 104/104] ovs-lib: fix install_dir()
Subject: [PATCH 104/105] ovs-lib: fix install_dir()
The command "install" is not available in OpenWrt by default
@ -10,9 +10,11 @@ Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
utilities/ovs-lib.in | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index 090a14434..f2a30e065 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -157,7 +157,10 @@ install_dir () {
@@ -159,7 +159,10 @@ install_dir () {
[ "${OVS_USER##*:}" != "" ] && INSTALL_GROUP="${OVS_USER##*:}"
if test ! -d "$DIR"; then

View File

@ -0,0 +1,22 @@
From f5c6e5d4c567f3705de503b7271d384d1aad88ab Mon Sep 17 00:00:00 2001
From: Yousong Zhou <zhouyousong@yunionyun.com>
Date: Tue, 21 Aug 2018 13:02:21 +0000
Subject: [PATCH 105/105] build: disable building tests
Signed-off-by: Yousong Zhou <zhouyousong@yunionyun.com>
---
Makefile.am | 1 -
1 file changed, 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index cd90cc176..2e9e50f3a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -477,7 +477,6 @@ include m4/automake.mk
include lib/automake.mk
include ofproto/automake.mk
include utilities/automake.mk
-include tests/automake.mk
include include/automake.mk
include third-party/automake.mk
include debian/automake.mk

View File

@ -1,34 +0,0 @@
From bca4ff53aef16d38aeb1569edaaca6ac4feac6e8 Mon Sep 17 00:00:00 2001
From: Eneas U de Queiroz <cote2004-github@yahoo.com>
Date: Tue, 5 Jun 2018 10:36:51 -0300
Subject: [PATCH] Removed calls to AP deprecated in openssl 1.1
In openssl 1.1, there is no need to initialize the library. It is
automatically done when first used. This allows to compile openvswitch
with openssl 1.1.0 with deprecated API disabled.
Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
lib/stream-ssl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c
index ebb6f3a6c8..c7443470f5 100644
--- a/lib/stream-ssl.c
+++ b/lib/stream-ssl.c
@@ -947,12 +947,14 @@ do_ssl_init(void)
{
SSL_METHOD *method;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
#ifdef _WIN32
/* The following call is needed if we "#include <openssl/applink.c>". */
CRYPTO_malloc_init();
#endif
SSL_library_init();
SSL_load_error_strings();
+#endif
if (!RAND_status()) {
/* We occasionally see OpenSSL fail to seed its random number generator

View File

@ -1,305 +0,0 @@
From a513cb5fed8c4f63d60b6da12ae9f63a258a9e44 Mon Sep 17 00:00:00 2001
From: Eneas U de Queiroz <cote2004-github@yahoo.com>
Date: Wed, 6 Jun 2018 08:20:35 -0300
Subject: [PATCH] dhparams: Add pregenerated .c file to the repository.
The version of dhparams.c generated by any given version of OpenSSL or
LibreSSL might work only with that version of the library. This can be
inconvenient for cross-compiling if the "openssl" program on the build
machine has a different version from the library on the host where OVS will
run, since it could generate code that won't compile.
This commit fixes the problem by generating dhparams.c that works on the
currently important versions of OpenSSL and LibreSSL.
Submitted-at: https://github.com/openvswitch/ovs/pull/235
Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
build-aux/automake.mk | 1 +
build-aux/generate-dhparams-c | 31 +++++++
lib/automake.mk | 17 ++--
lib/dhparams.c | 192 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 233 insertions(+), 9 deletions(-)
create mode 100755 build-aux/generate-dhparams-c
create mode 100644 lib/dhparams.c
diff --git a/build-aux/automake.mk b/build-aux/automake.mk
index a1f2f856f..3a3b31ce1 100644
--- a/build-aux/automake.mk
+++ b/build-aux/automake.mk
@@ -4,6 +4,7 @@ EXTRA_DIST += \
build-aux/cksum-schema-check \
build-aux/dist-docs \
build-aux/dpdkstrip.py \
+ build-aux/generate-dhparams-c \
build-aux/sodepends.py \
build-aux/soexpand.py \
build-aux/text2c \
diff --git a/build-aux/generate-dhparams-c b/build-aux/generate-dhparams-c
new file mode 100755
index 000000000..a75e1d5a7
--- /dev/null
+++ b/build-aux/generate-dhparams-c
@@ -0,0 +1,31 @@
+#! /bin/sh -e
+
+cat <<'EOF'
+/* Generated automatically; do not modify! -*- buffer-read-only: t -*-
+ *
+ * If you do need to regenerate this file, run "make generate-dhparams-c". */
+
+#include <config.h>
+#include "lib/dhparams.h"
+#include "openvswitch/util.h"
+
+static int
+my_DH_set0_pqg(DH *dh, BIGNUM *p, const BIGNUM **q OVS_UNUSED, BIGNUM *g)
+{
+ ovs_assert(q == NULL);
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
+ dh->p = p;
+ dh->g = g;
+ return 1;
+#else
+ return DH_set0_pqg(dh, p, NULL, g);
+#endif
+}
+EOF
+(openssl dhparam -C -in lib/dh1024.pem -noout &&
+openssl dhparam -C -in lib/dh2048.pem -noout &&
+openssl dhparam -C -in lib/dh4096.pem -noout) | sed '
+ s/\(get_dh[0-9]*\)()/\1(void)/
+ s/\(DH_set0_pqg\)/my_\1/
+ s/[ ]*$//
+'
diff --git a/lib/automake.mk b/lib/automake.mk
index fb781e847..3bec3fd56 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -450,15 +450,16 @@ lib_libopenvswitch_la_SOURCES += \
lib/route-table-bsd.c
endif
+.PHONY: generate-dhparams-c
if HAVE_OPENSSL
-lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c
-nodist_lib_libopenvswitch_la_SOURCES += lib/dhparams.c
-lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
- $(AM_V_GEN)(echo '#include "lib/dhparams.h"' && \
- openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout && \
- openssl dhparam -C -in $(srcdir)/lib/dh2048.pem -noout && \
- openssl dhparam -C -in $(srcdir)/lib/dh4096.pem -noout) \
- | sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp && \
+lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c lib/dhparams.c
+
+# Manually regenerates lib/dhparams.c. Not normally necessary since
+# lib/dhparams.c is part of the repository and doesn't normally need
+# updates.
+generate-dhparams-c:
+ $(AM_V_GEN)cd $(srcdir) && \
+ build-aux/generate-dhparams-c > lib/dhparams.c.tmp && \
mv lib/dhparams.c.tmp lib/dhparams.c
else
lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
diff --git a/lib/dhparams.c b/lib/dhparams.c
new file mode 100644
index 000000000..c9c338bf1
--- /dev/null
+++ b/lib/dhparams.c
@@ -0,0 +1,192 @@
+/* Generated automatically; do not modify! -*- buffer-read-only: t -*-
+ *
+ * If you do need to regenerate this file, run "make generate-dhparams-c". */
+
+#include <config.h>
+#include "lib/dhparams.h"
+#include "openvswitch/util.h"
+
+static int
+my_DH_set0_pqg(DH *dh, BIGNUM *p, const BIGNUM **q OVS_UNUSED, BIGNUM *g)
+{
+ ovs_assert(q == NULL);
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
+ dh->p = p;
+ dh->g = g;
+ return 1;
+#else
+ return DH_set0_pqg(dh, p, NULL, g);
+#endif
+}
+#ifndef HEADER_DH_H
+# include <openssl/dh.h>
+#endif
+
+DH *get_dh1024(void)
+{
+ static unsigned char dhp_1024[] = {
+ 0xF4, 0x88, 0xFD, 0x58, 0x4E, 0x49, 0xDB, 0xCD, 0x20, 0xB4,
+ 0x9D, 0xE4, 0x91, 0x07, 0x36, 0x6B, 0x33, 0x6C, 0x38, 0x0D,
+ 0x45, 0x1D, 0x0F, 0x7C, 0x88, 0xB3, 0x1C, 0x7C, 0x5B, 0x2D,
+ 0x8E, 0xF6, 0xF3, 0xC9, 0x23, 0xC0, 0x43, 0xF0, 0xA5, 0x5B,
+ 0x18, 0x8D, 0x8E, 0xBB, 0x55, 0x8C, 0xB8, 0x5D, 0x38, 0xD3,
+ 0x34, 0xFD, 0x7C, 0x17, 0x57, 0x43, 0xA3, 0x1D, 0x18, 0x6C,
+ 0xDE, 0x33, 0x21, 0x2C, 0xB5, 0x2A, 0xFF, 0x3C, 0xE1, 0xB1,
+ 0x29, 0x40, 0x18, 0x11, 0x8D, 0x7C, 0x84, 0xA7, 0x0A, 0x72,
+ 0xD6, 0x86, 0xC4, 0x03, 0x19, 0xC8, 0x07, 0x29, 0x7A, 0xCA,
+ 0x95, 0x0C, 0xD9, 0x96, 0x9F, 0xAB, 0xD0, 0x0A, 0x50, 0x9B,
+ 0x02, 0x46, 0xD3, 0x08, 0x3D, 0x66, 0xA4, 0x5D, 0x41, 0x9F,
+ 0x9C, 0x7C, 0xBD, 0x89, 0x4B, 0x22, 0x19, 0x26, 0xBA, 0xAB,
+ 0xA2, 0x5E, 0xC3, 0x55, 0xE9, 0x2F, 0x78, 0xC7
+ };
+ static unsigned char dhg_1024[] = {
+ 0x02
+ };
+ DH *dh = DH_new();
+ BIGNUM *dhp_bn, *dhg_bn;
+
+ if (dh == NULL)
+ return NULL;
+ dhp_bn = BN_bin2bn(dhp_1024, sizeof (dhp_1024), NULL);
+ dhg_bn = BN_bin2bn(dhg_1024, sizeof (dhg_1024), NULL);
+ if (dhp_bn == NULL || dhg_bn == NULL
+ || !my_DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {
+ DH_free(dh);
+ BN_free(dhp_bn);
+ BN_free(dhg_bn);
+ return NULL;
+ }
+ return dh;
+}
+#ifndef HEADER_DH_H
+# include <openssl/dh.h>
+#endif
+
+DH *get_dh2048(void)
+{
+ static unsigned char dhp_2048[] = {
+ 0xF6, 0x42, 0x57, 0xB7, 0x08, 0x7F, 0x08, 0x17, 0x72, 0xA2,
+ 0xBA, 0xD6, 0xA9, 0x42, 0xF3, 0x05, 0xE8, 0xF9, 0x53, 0x11,
+ 0x39, 0x4F, 0xB6, 0xF1, 0x6E, 0xB9, 0x4B, 0x38, 0x20, 0xDA,
+ 0x01, 0xA7, 0x56, 0xA3, 0x14, 0xE9, 0x8F, 0x40, 0x55, 0xF3,
+ 0xD0, 0x07, 0xC6, 0xCB, 0x43, 0xA9, 0x94, 0xAD, 0xF7, 0x4C,
+ 0x64, 0x86, 0x49, 0xF8, 0x0C, 0x83, 0xBD, 0x65, 0xE9, 0x17,
+ 0xD4, 0xA1, 0xD3, 0x50, 0xF8, 0xF5, 0x59, 0x5F, 0xDC, 0x76,
+ 0x52, 0x4F, 0x3D, 0x3D, 0x8D, 0xDB, 0xCE, 0x99, 0xE1, 0x57,
+ 0x92, 0x59, 0xCD, 0xFD, 0xB8, 0xAE, 0x74, 0x4F, 0xC5, 0xFC,
+ 0x76, 0x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 BIGNUM *dhp_bn, *dhg_bn;
+
+ if (dh == NULL)
+ return NULL;
+ dhp_bn = BN_bin2bn(dhp_2048, sizeof (dhp_2048), NULL);
+ dhg_bn = BN_bin2bn(dhg_2048, sizeof (dhg_2048), NULL);
+ if (dhp_bn == NULL || dhg_bn == NULL
+ || !my_DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {
+ DH_free(dh);
+ BN_free(dhp_bn);
+ BN_free(dhg_bn);
+ return NULL;
+ }
+ return dh;
+}
+#ifndef HEADER_DH_H
+# include <openssl/dh.h>
+#endif
+
+DH *get_dh4096(void)
+{
+ static unsigned char dhp_4096[] = {
+ 0xFA, 0x14, 0x72, 0x52, 0xC1, 0x4D, 0xE1, 0x5A, 0x49, 0xD4,
+ 0xEF, 0x09, 0x2D, 0xC0, 0xA8, 0xFD, 0x55, 0xAB, 0xD7, 0xD9,
+ 0x37, 0x04, 0x28, 0x09, 0xE2, 0xE9, 0x3E, 0x77, 0xE2, 0xA1,
+ 0x7A, 0x18, 0xDD, 0x46, 0xA3, 0x43, 0x37, 0x23, 0x90, 0x97,
+ 0xF3, 0x0E, 0xC9, 0x03, 0x50, 0x7D, 0x65, 0xCF, 0x78, 0x62,
+ 0xA6, 0x3A, 0x62, 0x22, 0x83, 0xA1, 0x2F, 0xFE, 0x79, 0xBA,
+ 0x35, 0xFF, 0x59, 0xD8, 0x1D, 0x61, 0xDD, 0x1E, 0x21, 0x13,
+ 0x17, 0xFE, 0xCD, 0x38, 0x87, 0x9E, 0xF5, 0x4F, 0x79, 0x10,
+ 0x61, 0x8D, 0xD4, 0x22, 0xF3, 0x5A, 0xED, 0x5D, 0xEA, 0x21,
+ 0xE9, 0x33, 0x6B, 0x48, 0x12, 0x0A, 0x20, 0x77, 0xD4, 0x25,
+ 0x60, 0x61, 0xDE, 0xF6, 0xB4, 0x4F, 0x1C, 0x63, 0x40, 0x8B,
+ 0x3A, 0x21, 0x93, 0x8B, 0x79, 0x53, 0x51, 0x2C, 0xCA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3, 0x9F, 0x0B, 0x45, 0x29, 0xD4,
+ 0xCB, 0x29, 0x66, 0xEE, 0x1E, 0x7E, 0x3D, 0xD7, 0x13, 0x4E,
+ 0xDB, 0x90, 0x90, 0x58, 0xCB, 0x5E, 0x9B, 0xCD, 0x2E, 0x2B,
+ 0x0F, 0xA9, 0x4E, 0x78, 0xAC, 0x05, 0x11, 0x7F, 0xE3, 0x9E,
+ 0x27, 0xD4, 0x99, 0xE1, 0xB9, 0xBD, 0x78, 0xE1, 0x84, 0x41,
+ 0xA0, 0xDF
+ };
+ static unsigned char dhg_4096[] = {
+ 0x02
+ };
+ DH *dh = DH_new();
+ BIGNUM *dhp_bn, *dhg_bn;
+
+ if (dh == NULL)
+ return NULL;
+ dhp_bn = BN_bin2bn(dhp_4096, sizeof (dhp_4096), NULL);
+ dhg_bn = BN_bin2bn(dhg_4096, sizeof (dhg_4096), NULL);
+ if (dhp_bn == NULL || dhg_bn == NULL
+ || !my_DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {
+ DH_free(dh);
+ BN_free(dhp_bn);
+ BN_free(dhg_bn);
+ return NULL;
+ }
+ return dh;
+}
--
2.16.4