summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorEneas U de Queiroz <cote2004-github@yahoo.com>2018-06-05 15:25:42 -0700
committerBen Pfaff <blp@ovn.org>2018-06-06 07:55:55 -0700
commit0d08baa59b7d251fb943bc578b98fd9269df10f2 (patch)
tree9e8293020cd3f88a178e4fb95848a48d366d29e9 /build-aux
parent88125d68d56bed1ecc7f5ede7695ab4137d535f4 (diff)
downloadopenvswitch-0d08baa59b7d251fb943bc578b98fd9269df10f2.tar.gz
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>
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/automake.mk1
-rwxr-xr-xbuild-aux/generate-dhparams-c32
2 files changed, 33 insertions, 0 deletions
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..5d5bba213
--- /dev/null
+++ b/build-aux/generate-dhparams-c
@@ -0,0 +1,32 @@
+#! /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/[ ]*$//
+ s/ / /g
+'