]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Load an openssl configuration file, if any, during startup
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 21 Jan 2020 14:00:01 +0000 (15:00 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 21 Jan 2020 14:00:01 +0000 (15:00 +0100)
This way dnsdist will load the default OpenSSL configuration, or a
custom one specified via the OPENSSL_CONF environment variable.
It allows loading an engine or configuration various options supported
by OpenSSL.
This requires OpenSSL >= 1.1.0.

pdns/dnsdistdist/libssl.cc

index ee9b9ef0fc2a98fabc5de114559bc7366779dde1..41c90bbd91b2f5694983705a476ad499d94c3653 100644 (file)
@@ -72,7 +72,11 @@ static int s_keyLogIndex{-1};
 void registerOpenSSLUser()
 {
   if (s_users.fetch_add(1) == 0) {
-#if (OPENSSL_VERSION_NUMBER < 0x1010000fL || defined LIBRESSL_VERSION_NUMBER)
+#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL && !defined LIBRESSL_VERSION_NUMBER)
+    /* load the default configuration file (or one specified via OPENSSL_CONF),
+       which can then be used to load engines */
+    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, nullptr);
+#else /* (OPENSSL_VERSION_NUMBER < 0x1010000fL || defined LIBRESSL_VERSION_NUMBER) */
     SSL_load_error_strings();
     OpenSSL_add_ssl_algorithms();
     openssl_thread_setup();