mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/PacketIO: Increase max allowed incoming packet size for CMSG_HOTFIX_REQUEST
This commit is contained in:
@@ -63,3 +63,25 @@ bool Trinity::Crypto::AES::Process(IV const& iv, uint8* data, size_t length, Tag
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Trinity::Crypto::AES::ProcessNoIntegrityCheck(IV const& iv, uint8* data, size_t partialLength)
|
||||
{
|
||||
ASSERT(!_encrypting, "Partial encryption is not allowed");
|
||||
ASSERT(partialLength <= std::numeric_limits<int>::max());
|
||||
int len = static_cast<int>(partialLength);
|
||||
if (!EVP_CipherInit_ex(_ctx, nullptr, nullptr, nullptr, iv.data(), -1))
|
||||
return false;
|
||||
|
||||
int outLen;
|
||||
if (!EVP_CipherUpdate(_ctx, data, &outLen, data, len))
|
||||
return false;
|
||||
|
||||
len -= outLen;
|
||||
|
||||
if (!EVP_CipherFinal_ex(_ctx, data + outLen, &outLen))
|
||||
return false;
|
||||
|
||||
ASSERT(len == outLen);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace Crypto
|
||||
void Init(Key const& key);
|
||||
|
||||
bool Process(IV const& iv, uint8* data, size_t length, Tag& tag);
|
||||
bool ProcessNoIntegrityCheck(IV const& iv, uint8* data, size_t partialLength);
|
||||
|
||||
private:
|
||||
EVP_CIPHER_CTX* _ctx;
|
||||
|
||||
@@ -41,6 +41,18 @@ struct WorldPacketCryptIV
|
||||
std::array<uint8, 12> Value;
|
||||
};
|
||||
|
||||
bool WorldPacketCrypt::PeekDecryptRecv(uint8* data, size_t length)
|
||||
{
|
||||
if (_initialized)
|
||||
{
|
||||
WorldPacketCryptIV iv{ _clientCounter, 0x544E4C43 };
|
||||
if (!_clientDecrypt.ProcessNoIntegrityCheck(iv.Value, data, length))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WorldPacketCrypt::DecryptRecv(uint8* data, size_t length, Trinity::Crypto::AES::Tag& tag)
|
||||
{
|
||||
if (_initialized)
|
||||
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
WorldPacketCrypt();
|
||||
|
||||
void Init(Trinity::Crypto::AES::Key const& key);
|
||||
bool PeekDecryptRecv(uint8* data, size_t length);
|
||||
bool DecryptRecv(uint8* data, size_t length, Trinity::Crypto::AES::Tag& tag);
|
||||
bool EncryptSend(uint8* data, size_t length, Trinity::Crypto::AES::Tag& tag);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user