aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_pbkdf2.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2024-08-27 16:20:49 +0100
committerGravatar Sadie Powell2024-08-27 16:31:38 +0100
commit3f7a7df7409e177f158bdd677321e4a61eb6a440 (patch)
treec0aa2641655d40fb497007f5c705e40a072f87a4 /src/modules/m_pbkdf2.cpp
parentUse GenRandom instead of GenRandomInt to populate Bcrypt entropy. (diff)
Deprecate the raw overload of GenRandomStr in favour of GenRandom.
The raw overload was almost always misused where GenRandom would be better. While we're making changes to this code switch the printable mode to use a static array like Anope does.
Diffstat (limited to 'src/modules/m_pbkdf2.cpp')
-rw-r--r--src/modules/m_pbkdf2.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modules/m_pbkdf2.cpp b/src/modules/m_pbkdf2.cpp
index c715659f0..63808804b 100644
--- a/src/modules/m_pbkdf2.cpp
+++ b/src/modules/m_pbkdf2.cpp
@@ -119,7 +119,10 @@ public:
std::string GenerateRaw(const std::string& data) override
{
- PBKDF2Hash hs(this->iterations, this->dkey_length, ServerInstance->GenRandomStr(dkey_length, false));
+ std::string salt(dkey_length, '\0');
+ ServerInstance->GenRandom(salt.data(), salt.length());
+
+ PBKDF2Hash hs(this->iterations, this->dkey_length, salt);
hs.hash = PBKDF2(data, hs.salt, this->iterations, this->dkey_length);
return hs.ToString();
}