refactor(Core/Misc): add braces and impove codestyle (#6402)

This commit is contained in:
Kargatum 2021-06-25 00:50:18 +07:00 committed by GitHub
parent 33c271cc7c
commit 3c24b511f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 1486 additions and 401 deletions

View file

@ -30,24 +30,34 @@ bool Acore::Crypto::AES::Process(IV const& iv, uint8* data, size_t length, Tag&
ASSERT(length <= static_cast<size_t>(std::numeric_limits<int>::max()));
int len = static_cast<int>(length);
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 (!_encrypting && !EVP_CIPHER_CTX_ctrl(_ctx, EVP_CTRL_GCM_SET_TAG, sizeof(tag), tag))
{
return false;
}
if (!EVP_CipherFinal_ex(_ctx, data + outLen, &outLen))
{
return false;
}
ASSERT(len == outLen);
if (_encrypting && !EVP_CIPHER_CTX_ctrl(_ctx, EVP_CTRL_GCM_GET_TAG, sizeof(tag), tag))
{
return false;
}
return true;
}