]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix building against OpenSSL 1.1.x on Windows
authorMichał Kępień <michal@isc.org>
Thu, 26 Sep 2019 13:11:15 +0000 (15:11 +0200)
committerMichał Kępień <michal@isc.org>
Fri, 27 Sep 2019 10:13:34 +0000 (12:13 +0200)
Backport portions of 05d7aa5734bb02007387622dce801ec4d1eebaf9 required
to support compilation against OpenSSL 1.1.x on Windows.

config.h.win32
win32utils/Configure

index f441b1f341fccae9d8cd3f3178ca938d7e5b8d5a..66aaacdf47231f64d4db0001a0fb782c536c426f 100644 (file)
@@ -364,6 +364,18 @@ typedef __int64 off_t;
 /* Define if your OpenSSL version supports AES */
 @HAVE_OPENSSL_AES@
 
+/* Define if your OpenSSL version supports DH functions. */
+@HAVE_DH_GET0_KEY@
+
+/* Define if your OpenSSL version supports DSA functions. */
+@HAVE_DSA_GET0_PQG@
+
+/* Define if your OpenSSL version supports ECDSA functions. */
+@HAVE_ECDSA_SIG_GET0@
+
+/* Define if your OpenSSL version supports RSA functions. */
+@HAVE_RSA_SET0_KEY@
+
 /* HMAC_*() return ints */
 @HMAC_RETURN_INT@
 
index 6f9381404ff840a674aba50840192e548a25772c..82d6a7982499db4e1344293430e5fed6b094252b 100644 (file)
@@ -345,6 +345,9 @@ my @substdefh = ("ALLOW_FILTER_AAAA",
                  "DNS_RDATASET_FIXED",
                  "ENABLE_RPZ_NSDNAME",
                  "ENABLE_RPZ_NSIP",
+                 "HAVE_DH_GET0_KEY",
+                 "HAVE_DSA_GET0_PQG",
+                 "HAVE_ECDSA_SIG_GET0",
                  "HAVE_EVP_SHA256",
                  "HAVE_EVP_SHA384",
                  "HAVE_EVP_SHA512",
@@ -366,6 +369,7 @@ my @substdefh = ("ALLOW_FILTER_AAAA",
                  "HAVE_PKCS11_ED448",
                  "HAVE_PKCS11_GOST",
                  "HAVE_READLINE",
+                 "HAVE_RSA_SET0_KEY",
                  "HAVE_ZLIB",
                  "ISC_LIST_CHECKINIT",
                  "PREFER_GOSTASN1",
@@ -1790,6 +1794,41 @@ EOF
     }
 }
 
+# check OpenSSL built-in support for DH/DSA/ECDSA/RSA functions
+if ($use_openssl eq "yes") {
+    if ($verbose) {
+        printf "checking OpenSSL built-in support for DH/DSA/ECDSA/RSA functions\n";
+    }
+    open F, ">testosslfunc.c" || die $!;
+    print F << 'EOF';
+#include <stdio.h>
+#include <openssl/opensslv.h>
+
+int main() {
+        if (OPENSSL_VERSION_NUMBER >= 0x10100000L) {
+                return (0);
+        }
+        printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
+               OPENSSL_VERSION_NUMBER);
+        printf("This version has no built-in support for DH/DSA/ECDSA/RSA functions.\n\n");
+        return (1);
+}
+EOF
+    close F;
+    my $include = $configinc{"OPENSSL_INC"};
+    my $library = $configlib{"OPENSSL_LIB"};
+    $compret = `cl /nologo /MD /I "$include" testosslfunc.c "$library"`;
+    if (grep { -f and -x } ".\\testosslfunc.exe") {
+        `.\\testosslfunc.exe`;
+        if ($? == 0) {
+            $configdefh{"HAVE_DH_GET0_KEY"} = 1;
+            $configdefh{"HAVE_DSA_GET0_PQG"} = 1;
+            $configdefh{"HAVE_ECDSA_SIG_GET0"} = 1;
+            $configdefh{"HAVE_RSA_SET0_KEY"} = 1;
+        }
+    }
+}
+
 # check FIPS_mode
 
 if ($use_openssl eq "yes") {