From 2b61f9a7312fe7c462f9d69741abf588fc1bfce4 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 7 Aug 2018 10:35:25 -0400 Subject: [PATCH] fixed #1217. verify decryption result --- libi2pd/Crypto.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libi2pd/Crypto.cpp b/libi2pd/Crypto.cpp index 24ce9c72..0a9093a2 100644 --- a/libi2pd/Crypto.cpp +++ b/libi2pd/Crypto.cpp @@ -1081,7 +1081,8 @@ namespace crypto EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, 16, (uint8_t *)(msg + msgLen)); EVP_DecryptInit_ex(ctx, NULL, NULL, key, nonce); EVP_DecryptUpdate(ctx, NULL, &outlen, ad, adLen); - ret = EVP_DecryptUpdate(ctx, buf, &outlen, msg, msgLen) > 0; + EVP_DecryptUpdate(ctx, buf, &outlen, msg, msgLen); + ret = EVP_DecryptFinal_ex(ctx, buf + outlen, &outlen) > 0; } EVP_CIPHER_CTX_free (ctx);