aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-04-05 19:24:49 +0100
committerGravatar Sadie Powell2025-04-06 00:45:31 +0100
commit28073d2506685a508135a487b41ea3aed63bf522 (patch)
treec2328a7a857a2910ac9849eaa6b0c9b9091711f0 /include
parentRewrite every single hash module for the new interface. (diff)
Delete the old hashing interface and modules.
Diffstat (limited to 'include')
-rw-r--r--include/inspircd.h8
-rw-r--r--include/modules.h10
-rw-r--r--include/modules/hash.h80
3 files changed, 0 insertions, 98 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index b7d20b3da..1ccb621f9 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -269,14 +269,6 @@ public:
*/
size_t BindPorts(FailedPortList& failedports);
- /** Compares a password to a hashed password.
- * @param password The hashed password.
- * @param passwordhash If non-empty then the algorithm the password is hashed with.
- * @param value The value to check to see if the password is valid.
- * @return True if the password is correct, otherwise, false.
- */
- static bool CheckPassword(const std::string& password, const std::string& passwordhash, const std::string& value);
-
/** Generates a random integer.
* @param max The maximum value for the integer.
* @return A random integer between 0 and \p max.
diff --git a/include/modules.h b/include/modules.h
index 6ac604e5b..0b0b628ef 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -143,7 +143,6 @@ enum Implementation
I_OnCheckInvite,
I_OnCheckKey,
I_OnCheckLimit,
- I_OnCheckPassword,
I_OnCheckReady,
I_OnCommandBlocked,
I_OnDecodeMetadata,
@@ -827,15 +826,6 @@ public:
*/
virtual ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask) ATTR_NOT_NULL(2, 3);
- /** Called when checking if a password is valid.
- * @param password The hashed password.
- * @param passwordhash The name of the algorithm used to hash the password.
- * @param value The value to check to see if the password is valid.
- * @return MOD_RES_ALLOW if the password is correct, MOD_RES_DENY if the password is incorrect,
- * or MOD_RES_PASSTHRU to let another module handle the event.
- */
- virtual ModResult OnCheckPassword(const std::string& password, const std::string& passwordhash, const std::string& value);
-
/** Called before a topic is changed.
* Return 1 to deny the topic change, 0 to check details on the change, -1 to let it through with no checks
* As with other 'pre' events, you should only ever block a local event.
diff --git a/include/modules/hash.h b/include/modules/hash.h
deleted file mode 100644
index 739916b02..000000000
--- a/include/modules/hash.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- * Copyright (C) 2014 Daniel Vassdal <shutter@canternet.org>
- * Copyright (C) 2013, 2021-2023 Sadie Powell <sadie@witchery.services>
- * Copyright (C) 2012 Robby <robby@chatbelgie.be>
- * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
- * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- * Copyright (C) 2006 Craig Edwards <brain@inspircd.org>
- *
- * This file is part of InspIRCd. InspIRCd is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#pragma once
-
-#include "stringutils.h"
-
-class HashProvider
- : public DataProvider
-{
-public:
- const unsigned int out_size;
- const unsigned int block_size;
- HashProvider(Module* mod, const std::string& Name, unsigned int osiz = 0, unsigned int bsiz = 0)
- : DataProvider(mod, "hash/" + Name)
- , out_size(osiz)
- , block_size(bsiz)
- {
- }
-
- virtual std::string GenerateRaw(const std::string& data) = 0;
-
- virtual std::string ToPrintable(const std::string& raw)
- {
- return Hex::Encode(raw);
- }
-
- virtual bool Compare(const std::string& input, const std::string& hash)
- {
- return InspIRCd::TimingSafeCompare(Generate(input), hash);
- }
-
- std::string Generate(const std::string& data)
- {
- return ToPrintable(GenerateRaw(data));
- }
-
- /** HMAC algorithm, RFC 2104 */
- std::string hmac(const std::string& key, const std::string& msg)
- {
- std::string hmac1, hmac2;
- std::string kbuf = key.length() > block_size ? GenerateRaw(key) : key;
- kbuf.resize(block_size);
-
- for (size_t n = 0; n < block_size; n++)
- {
- hmac1.push_back(static_cast<char>(kbuf[n] ^ 0x5C));
- hmac2.push_back(static_cast<char>(kbuf[n] ^ 0x36));
- }
- hmac2.append(msg);
- hmac1.append(GenerateRaw(hmac2));
- return GenerateRaw(hmac1);
- }
-
- bool IsKDF() const
- {
- return (!block_size);
- }
-};