diff options
author | Sadie Powell <sadie@witchery.services> | 2020-06-19 03:28:42 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2020-06-19 03:28:42 +0100 |
commit | 57dfd6249a69ae6b667230c3597fb4b86e31db70 (patch) | |
tree | 78f8939054418d50e275623ad67d0d83a146957d /src | |
parent | 4316ae10b1f631b7434807a2a3998e9f8558b51e (diff) |
Use InspIRCd::TimingSafeCompare in more places.
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_bcrypt.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_pbkdf2.cpp | 2 |
2 files changed, 1 insertions, 12 deletions
diff --git a/src/modules/m_bcrypt.cpp b/src/modules/m_bcrypt.cpp index 04cb06b08..a8de729d2 100644 --- a/src/modules/m_bcrypt.cpp +++ b/src/modules/m_bcrypt.cpp @@ -56,17 +56,6 @@ class BCryptProvider : public HashProvider return Generate(data, Salt()); } - bool Compare(const std::string& input, const std::string& hash) CXX11_OVERRIDE - { - std::string ret = Generate(input, hash); - if (ret.empty()) - return false; - - if (ret == hash) - return true; - return false; - } - std::string ToPrintable(const std::string& raw) CXX11_OVERRIDE { return raw; diff --git a/src/modules/m_pbkdf2.cpp b/src/modules/m_pbkdf2.cpp index a4ac69f12..8a57936fd 100644 --- a/src/modules/m_pbkdf2.cpp +++ b/src/modules/m_pbkdf2.cpp @@ -126,7 +126,7 @@ class PBKDF2Provider : public HashProvider return false; std::string cmp = PBKDF2(input, hs.salt, hs.iterations, hs.length); - return (cmp == hs.hash); + return InspIRCd::TimingSafeCompare(cmp, hs.hash); } std::string ToPrintable(const std::string& raw) CXX11_OVERRIDE |