]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Credentials: Fix compilation without OpenSSL 1.1.1
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 23 Jun 2021 16:00:25 +0000 (18:00 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 16 Sep 2021 12:12:28 +0000 (14:12 +0200)
pdns/credentials.cc

index 1d392322bdfdda78087003ca3834491e9b3cc490..2cefba2a17e342206458d6aafb3ac55d8d49e296 100644 (file)
@@ -87,9 +87,9 @@ void SensitiveData::clear()
   d_data.clear();
 }
 
-#ifdef HAVE_EVP_PKEY_CTX_SET1_SCRYPT_SALT
 static std::string hashPasswordInternal(const std::string& password, const std::string& salt, uint64_t workFactor, uint64_t parallelFactor, uint64_t blockSize)
 {
+#ifdef HAVE_EVP_PKEY_CTX_SET1_SCRYPT_SALT
   auto pctx = std::unique_ptr<EVP_PKEY_CTX, void (*)(EVP_PKEY_CTX*)>(EVP_PKEY_CTX_new_id(EVP_PKEY_SCRYPT, nullptr), EVP_PKEY_CTX_free);
   if (!pctx) {
     throw std::runtime_error("Error getting a scrypt context to hash the supplied password");
@@ -128,8 +128,10 @@ static std::string hashPasswordInternal(const std::string& password, const std::
   }
 
   return out;
-}
+#else
+  throw std::runtime_error("Hashing support is not available");
 #endif
+}
 
 static std::string generateRandomSalt()
 {