Fix return code checks.

GitOrigin-RevId: a4ace29e0bf81441b207d234c2e190dcb777b0cb
This commit is contained in:
levlam 2020-06-13 20:57:47 +03:00
parent 40630b9ad8
commit 584a0309c5

View File

@ -277,9 +277,11 @@ void AesState::init(Slice key, bool encrypt) {
CHECK(impl_->ctx);
if (encrypt) {
CHECK(1 == EVP_EncryptInit_ex(impl_->ctx, EVP_aes_256_ecb(), nullptr, key.ubegin(), nullptr));
int res = EVP_EncryptInit_ex(impl_->ctx, EVP_aes_256_ecb(), nullptr, key.ubegin(), nullptr);
LOG_IF(FATAL, res != 1);
} else {
CHECK(1 == EVP_DecryptInit_ex(impl_->ctx, EVP_aes_256_ecb(), nullptr, key.ubegin(), nullptr));
int res = EVP_DecryptInit_ex(impl_->ctx, EVP_aes_256_ecb(), nullptr, key.ubegin(), nullptr);
LOG_IF(FATAL, res != 1);
}
EVP_CIPHER_CTX_set_padding(impl_->ctx, 0);
impl_->encrypt = encrypt;