diff options
Diffstat (limited to 'modules/encryption')
-rw-r--r-- | modules/encryption/enc_bcrypt.cpp | 6 | ||||
-rw-r--r-- | modules/encryption/enc_md5.cpp | 17 | ||||
-rw-r--r-- | modules/encryption/enc_none.cpp | 17 | ||||
-rw-r--r-- | modules/encryption/enc_old.cpp | 10 | ||||
-rw-r--r-- | modules/encryption/enc_sha1.cpp | 17 | ||||
-rw-r--r-- | modules/encryption/enc_sha256.cpp | 14 |
6 files changed, 38 insertions, 43 deletions
diff --git a/modules/encryption/enc_bcrypt.cpp b/modules/encryption/enc_bcrypt.cpp index 07bd7d949..b5e65648e 100644 --- a/modules/encryption/enc_bcrypt.cpp +++ b/modules/encryption/enc_bcrypt.cpp @@ -888,14 +888,14 @@ class EBCRYPT : public Module throw ModuleException("BCrypt could not load!"); } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { dest = "bcrypt:" + Generate(src, Salt()); Log(LOG_DEBUG_2) << "(enc_bcrypt) hashed password from [" << src << "] to [" << dest << "]"; return EVENT_ALLOW; } - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) @@ -935,7 +935,7 @@ class EBCRYPT : public Module } } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); rounds = block->Get<unsigned int>("rounds", "10"); diff --git a/modules/encryption/enc_md5.cpp b/modules/encryption/enc_md5.cpp index 2e5225c2c..1b19316e5 100644 --- a/modules/encryption/enc_md5.cpp +++ b/modules/encryption/enc_md5.cpp @@ -250,7 +250,7 @@ class MD5Context : public Encryption::Context * operation, processing another message block, and updating the * context. */ - void Update(const unsigned char *input, size_t len) anope_override + void Update(const unsigned char *input, size_t len) override { unsigned i, index, partLen; @@ -285,7 +285,7 @@ class MD5Context : public Encryption::Context /* MD5 finalization. Ends an MD5 message-digest opera * the message digest and zeroizing the context. */ - void Finalize() anope_override + void Finalize() override { unsigned char bits[8]; unsigned index, padLen; @@ -309,7 +309,7 @@ class MD5Context : public Encryption::Context memset(this->buffer, 0, sizeof(this->buffer)); } - Encryption::Hash GetFinalizedHash() anope_override + Encryption::Hash GetFinalizedHash() override { Encryption::Hash hash; hash.first = this->digest; @@ -323,12 +323,12 @@ class MD5Provider : public Encryption::Provider public: MD5Provider(Module *creator) : Encryption::Provider(creator, "md5") { } - Encryption::Context *CreateContext(Encryption::IV *iv) anope_override + Encryption::Context *CreateContext(Encryption::IV *iv) override { return new MD5Context(iv); } - Encryption::IV GetDefaultIV() anope_override + Encryption::IV GetDefaultIV() override { Encryption::IV iv; iv.first = md5_iv; @@ -345,10 +345,11 @@ class EMD5 : public Module EMD5(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR), md5provider(this) { - + if (ModuleManager::FindFirstOf(ENCRYPTION) == this) + throw ModuleException("enc_md5 is deprecated and can not be used as a primary encryption method"); } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { MD5Context context; @@ -364,7 +365,7 @@ class EMD5 : public Module return EVENT_ALLOW; } - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) diff --git a/modules/encryption/enc_none.cpp b/modules/encryption/enc_none.cpp index b1e2c738a..970530c9b 100644 --- a/modules/encryption/enc_none.cpp +++ b/modules/encryption/enc_none.cpp @@ -14,10 +14,11 @@ class ENone : public Module public: ENone(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR) { - + if (ModuleManager::FindFirstOf(ENCRYPTION) == this) + throw ModuleException("enc_none is deprecated and can not be used as a primary encryption method"); } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { Anope::string buf = "plain:"; Anope::string cpass; @@ -28,17 +29,7 @@ class ENone : public Module return EVENT_ALLOW; } - EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) anope_override - { - if (!hashm.equals_cs("plain")) - return EVENT_CONTINUE; - size_t pos = src.find(':'); - Anope::string buf = src.substr(pos + 1); - Anope::B64Decode(buf, dest); - return EVENT_ALLOW; - } - - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) diff --git a/modules/encryption/enc_old.cpp b/modules/encryption/enc_old.cpp index beab76d15..9f051cf91 100644 --- a/modules/encryption/enc_old.cpp +++ b/modules/encryption/enc_old.cpp @@ -19,14 +19,14 @@ class OldMD5Provider : public Encryption::Provider public: OldMD5Provider(Module *creator) : Encryption::Provider(creator, "oldmd5") { } - Encryption::Context *CreateContext(Encryption::IV *iv) anope_override + Encryption::Context *CreateContext(Encryption::IV *iv) override { if (md5) return md5->CreateContext(iv); return NULL; } - Encryption::IV GetDefaultIV() anope_override + Encryption::IV GetDefaultIV() override { if (md5) return md5->GetDefaultIV(); @@ -44,6 +44,8 @@ class EOld : public Module EOld(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR), oldmd5provider(this) { + if (ModuleManager::FindFirstOf(ENCRYPTION) == this) + throw ModuleException("enc_old is deprecated and can not be used as a primary encryption method"); ModuleManager::LoadModule("enc_md5", User::Find(creator, true)); if (!md5) @@ -51,7 +53,7 @@ class EOld : public Module } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { if (!md5) return EVENT_CONTINUE; @@ -79,7 +81,7 @@ class EOld : public Module return EVENT_ALLOW; } - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) diff --git a/modules/encryption/enc_sha1.cpp b/modules/encryption/enc_sha1.cpp index 9bad4a790..c59794aa2 100644 --- a/modules/encryption/enc_sha1.cpp +++ b/modules/encryption/enc_sha1.cpp @@ -125,7 +125,7 @@ class SHA1Context : public Encryption::Context memset(this->digest, 0, sizeof(this->digest)); } - void Update(const unsigned char *data, size_t len) anope_override + void Update(const unsigned char *data, size_t len) override { uint32_t i, j; @@ -146,7 +146,7 @@ class SHA1Context : public Encryption::Context memcpy(&this->buffer[j], &data[i], len - i); } - void Finalize() anope_override + void Finalize() override { uint32_t i; unsigned char finalcount[8]; @@ -169,7 +169,7 @@ class SHA1Context : public Encryption::Context this->Transform(this->buffer); } - Encryption::Hash GetFinalizedHash() anope_override + Encryption::Hash GetFinalizedHash() override { Encryption::Hash hash; hash.first = this->digest; @@ -183,12 +183,12 @@ class SHA1Provider : public Encryption::Provider public: SHA1Provider(Module *creator) : Encryption::Provider(creator, "sha1") { } - Encryption::Context *CreateContext(Encryption::IV *iv) anope_override + Encryption::Context *CreateContext(Encryption::IV *iv) override { return new SHA1Context(iv); } - Encryption::IV GetDefaultIV() anope_override + Encryption::IV GetDefaultIV() override { Encryption::IV iv; iv.first = sha1_iv; @@ -205,10 +205,11 @@ class ESHA1 : public Module ESHA1(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR), sha1provider(this) { - + if (ModuleManager::FindFirstOf(ENCRYPTION) == this) + throw ModuleException("enc_sha1 is deprecated and can not be used as a primary encryption method"); } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { SHA1Context context; @@ -224,7 +225,7 @@ class ESHA1 : public Module return EVENT_ALLOW; } - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) diff --git a/modules/encryption/enc_sha256.cpp b/modules/encryption/enc_sha256.cpp index da3822602..384da515e 100644 --- a/modules/encryption/enc_sha256.cpp +++ b/modules/encryption/enc_sha256.cpp @@ -172,7 +172,7 @@ class SHA256Context : public Encryption::Context memset(this->digest, 0, sizeof(this->digest)); } - void Update(const unsigned char *message, size_t mlen) anope_override + void Update(const unsigned char *message, size_t mlen) override { unsigned tmp_len = SHA256_BLOCK_SIZE - this->len, rem_len = mlen < tmp_len ? mlen : tmp_len; @@ -194,7 +194,7 @@ class SHA256Context : public Encryption::Context this->tot_len += (block_nb + 1) << 6; } - void Finalize() anope_override + void Finalize() override { unsigned block_nb = 1 + ((SHA256_BLOCK_SIZE - 9) < (this->len % SHA256_BLOCK_SIZE)); unsigned len_b = (this->tot_len + this->len) << 3; @@ -207,7 +207,7 @@ class SHA256Context : public Encryption::Context UNPACK32(this->h[i], &this->digest[i << 2]); } - Encryption::Hash GetFinalizedHash() anope_override + Encryption::Hash GetFinalizedHash() override { Encryption::Hash hash; hash.first = this->digest; @@ -221,12 +221,12 @@ class SHA256Provider : public Encryption::Provider public: SHA256Provider(Module *creator) : Encryption::Provider(creator, "sha256") { } - Encryption::Context *CreateContext(Encryption::IV *iv) anope_override + Encryption::Context *CreateContext(Encryption::IV *iv) override { return new SHA256Context(iv); } - Encryption::IV GetDefaultIV() anope_override + Encryption::IV GetDefaultIV() override { Encryption::IV iv; iv.first = sha256_h0; @@ -280,7 +280,7 @@ class ESHA256 : public Module use_iv = false; } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { if (!use_iv) NewRandomIV(); @@ -301,7 +301,7 @@ class ESHA256 : public Module return EVENT_ALLOW; } - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) |