From b8cf254627e1dc40722d5e4eb5ba142c79e87d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Silv=C3=A9n?= Date: Tue, 27 Jul 2021 20:19:41 +0200 Subject: [PATCH] No memory allocation for each C_DecryptUpdate. Before this change the allocated memory was growing after each C_DecryptUpdate. --- src/lib/crypto/SymmetricAlgorithm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/crypto/SymmetricAlgorithm.cpp b/src/lib/crypto/SymmetricAlgorithm.cpp index 1db8f507c..611d5bdeb 100644 --- a/src/lib/crypto/SymmetricAlgorithm.cpp +++ b/src/lib/crypto/SymmetricAlgorithm.cpp @@ -121,7 +121,9 @@ bool SymmetricAlgorithm::decryptUpdate(const ByteString& encryptedData, ByteStri } currentBufferSize += encryptedData.size(); - currentAEADBuffer += encryptedData; + if (currentCipherMode == SymMode::GCM) { + currentAEADBuffer += encryptedData; + } return true; }