2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Introduce USE_OPENSSL define to Windows build, remove CRYPTO and AES conditions.

This commit is contained in:
Ondřej Surý
2018-07-19 16:05:57 -04:00
parent 51f7ed99fe
commit 83cde08522
38 changed files with 81 additions and 196 deletions

View File

@@ -207,6 +207,7 @@ my @substdefh = ("AES_CC",
"HAVE_DSA_GET0_PQG",
"HAVE_ECDSA_SIG_GET0",
"HAVE_RSA_SET0_KEY",
"USE_OPENSSL",
"USE_PKCS11",
"HAVE_PKCS11_ED25519",
"HAVE_PKCS11_ED448",
@@ -321,10 +322,8 @@ my @substvar = ("BIND9_VERSION",
my %configdefd;
my @substdefd = ("CRYPTO",
"PK11_LIB_LOCATION",
my @substdefd = ("PK11_LIB_LOCATION",
"USE_GSSAPI",
"USE_PKCS11",
"USE_PYTHON",
"USE_ISC_SPNEGO");
@@ -332,8 +331,7 @@ my @substdefd = ("CRYPTO",
my %configcond;
my @substcond = ("AES",
"ATOMIC",
my @substcond = ("ATOMIC",
"GSSAPI",
"GEOIP",
"IDNKIT",
@@ -426,11 +424,9 @@ my @help = (
" with-extra-tests build with extra test suite\n",
" with-system-tests build with system test suite\n",
" with-samples build with sample programs\n",
" with-openssl[=PATH] build with OpenSSL yes|no|path\n",
" with-openssl[=PATH] build with OpenSSL yes|path (mandatory)\n",
" with-pkcs11[=PATH] build with PKCS#11 support yes|no|provider-path\n",
" with-ecdsa crypto ECDSA\n",
" with-eddsa crypto EDDSA yes|all|no\n",
" with-aes crypto AES\n",
" with-cc-alg choose the algorithm for cookies aes|sha1|sha256\n",
" with-gssapi[=PATH] build with MIT KfW GSSAPI yes|no|path\n",
" with-libxml2[=PATH] build with libxml2 library yes|no|path\n",
@@ -1265,8 +1261,6 @@ if ($enable_native_pkcs11 eq "yes") {
print "native PKCS#11 support: no PKCS#11 provider defined?\n";
}
}
$configdefd{"CRYPTO"} = "PKCS11CRYPTO";
$configdefh{"USE_PKCS11"} = 1;
if ($use_eddsa eq "no") {
if ($verbose) {
print "no EDDSA support in native PKCS#11\n";
@@ -1287,16 +1281,6 @@ if ($enable_native_pkcs11 eq "yes") {
$configdefh{"HAVE_PKCS11_ED448"} = 1;
}
}
if ($use_aes eq "no") {
if ($verbose) {
print "no AES support in native PKCS#11\n";
}
} else {
if ($verbose) {
print "enabled AES support in native PKCS#11\n";
}
$use_aes = "pkcs11";
}
}
# enable-fixed-rrset
@@ -1430,14 +1414,18 @@ if ($use_openssl eq "yes") {
}
$cryptolib = "openssl";
$configcond{"OPENSSL"} = 1;
$configdefd{"CRYPTO"} = "OPENSSL";
$configvar{"OPENSSL_PATH"} = "$openssl_path";
$configinc{"OPENSSL_INC"} = "$openssl_inc";
$configlib{"OPENSSL_LIB"} = "$openssl_lib";
$configdll{"OPENSSL_DLL"} = "$openssl_dll";
}
if ($cryptolib eq "openssl") {
$configdefh{"USE_OPENSSL"} = 1;
} else {
$configdefh{"USE_PKCS11"} = 1;
}
# check OpenSSL
if ($use_openssl eq "yes") {
if ($verbose) {
@@ -1673,89 +1661,6 @@ if ($use_openssl eq "no") {
$use_aes = "no";
}
}
if ($use_aes eq "auto") {
if ($verbose) {
print "checking for OpenSSL EVP AES support\n";
}
$use_aes = "evp";
open F, ">testevpaes.c" || die $!;
print F << 'EOF';
#include <openssl/evp.h>
int
main(void)
{
EVP_CIPHER *aes128, *aes192, *aes256;
aes128 = EVP_aes_128_ecb();
aes192 = EVP_aes_192_ecb();
aes256 = EVP_aes_256_ecb();
if (aes128 == NULL || aes192 == NULL || aes256 == NULL)
return (1);
return (0);
}
EOF
close F;
my $include = $configinc{"OPENSSL_INC"};
my $library = $configlib{"OPENSSL_LIB"};
$compret = `cl /nologo /MD /I "$include" testevpaes.c "$library"`;
if (grep { -f and -x } ".\\testevpaes.exe") {
`.\\testevpaes.exe`;
if ($? != 0) {
if ($verbose) {
print "EVP AES test failed: disabling EVP AES\n";
}
$use_aes = "auto";
}
} else {
if ($verbose) {
print "can't compile EVP AES test: $compret\n";
print "disabling EVP AES\n";
}
$use_aes = "auto";
}
}
if ($use_aes eq "auto") {
if ($verbose) {
print "checking for OpenSSL native AES support\n";
}
$use_aes = "native";
open F, ">testaes.c" || die $!;
print F << 'EOF';
#include <openssl/aes.h>
AES_KEY k;
const unsigned char bufin[16];
unsigned char bufout[16];
int
main(void)
{
AES_encrypt(bufin, bufout, &k);
return (0);
}
EOF
close F;
my $include = $configinc{"OPENSSL_INC"};
my $library = $configlib{"OPENSSL_LIB"};
$compret = `cl /nologo /MD /I "$include" testaes.c "$library"`;
if (grep { -f and -x } ".\\testaes.exe") {
`.\\testaes.exe`;
if ($? != 0) {
if ($verbose) {
print "native AES test failed: disabling AES\n";
}
$use_aes = "no";
}
} else {
if ($verbose) {
print "can't compile native AES test: $compret\n";
print "disabling AES\n";
}
$use_aes = "no";
}
}
# with-cc-alg
if ($cookie_algorithm eq "aes") {
@@ -1778,7 +1683,6 @@ if ($cryptolib ne "") {
# with-pkcs11
if ($use_pkcs11 ne "no") {
$configcond{"PKCS11"} = 1;
$configdefd{"USE_PKCS11"} = "USE_PKCS11";
$configvar{"PKCS11_TOOLS"} = "pkcs11";
$configdefd{"PK11_LIB_LOCATION"} = "PK11_LIB_LOCATION=\"$pkcs11_path\"";
}