]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
cast arg of EVP_PKEY_CTX_set1_pbe_pass() to const void * to satisfy both openssl... 10943/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 5 Nov 2021 09:17:42 +0000 (10:17 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 5 Nov 2021 09:17:42 +0000 (10:17 +0100)
pdns/credentials.cc

index f7d3417edb1e87c90caf95158c88ba05626419ef..b3a09e5c8193e90b2412f8c589e7df564fd3eaab 100644 (file)
@@ -105,7 +105,8 @@ static std::string hashPasswordInternal(const std::string& password, const std::
     throw std::runtime_error("Error intializing the scrypt context to hash the supplied password");
   }
 
-  if (EVP_PKEY_CTX_set1_pbe_pass(pctx.get(), reinterpret_cast<const unsigned char*>(password.data()), password.size()) <= 0) {
+  // OpenSSL 3.0 changed the string arg to const unsigned char*, other versions use const char *, so cast to const void * to satisfy both
+  if (EVP_PKEY_CTX_set1_pbe_pass(pctx.get(), reinterpret_cast<const void*>(password.data()), password.size()) <= 0) {
     throw std::runtime_error("Error adding the password to the scrypt context to hash the supplied password");
   }