diff options
author | Shauren <shauren.trinity@gmail.com> | 2021-03-02 01:06:28 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-03-02 01:06:28 +0100 |
commit | 55eef73c482bcc9040a3d097d4a9291fee3fdd67 (patch) | |
tree | b8d83d2f74c530f509d013661265b68a1472be19 /src/common/Cryptography/AES.cpp | |
parent | e38174566419be017995f60301ae2840500502ea (diff) |
Core/PacketIO: Increase max allowed incoming packet size for CMSG_HOTFIX_REQUEST
Diffstat (limited to 'src/common/Cryptography/AES.cpp')
-rw-r--r-- | src/common/Cryptography/AES.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/common/Cryptography/AES.cpp b/src/common/Cryptography/AES.cpp index 7d4ccc7c46f..1b011da7c9b 100644 --- a/src/common/Cryptography/AES.cpp +++ b/src/common/Cryptography/AES.cpp @@ -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; +} |