Fixing bug for calculating last xor_size in KM_SymmetricCrypt_AES_CFB() 02/297402/3
authorDongsun Lee <ds73.lee@samsung.com>
Fri, 18 Aug 2023 01:45:24 +0000 (10:45 +0900)
committerDong Sun Lee <ds73.lee@samsung.com>
Mon, 4 Sep 2023 23:44:19 +0000 (23:44 +0000)
Change-Id: Id791464205464ae190d5c8bc4837a1a67585a748

ta/src/crypto_symmetric.c

index 76f0bf219941164166f1866b3054e2fd1faabf8e..e7182f70bc363a244f205cfe9d5b134521f284f7 100644 (file)
@@ -76,7 +76,7 @@ TEE_Result KM_SymmetricCrypt_AES_CFB(TEE_ObjectHandle key, uint32_t mode,
 
                // is it the last, shorter than AES_BLOCK_SIZE fragment of input?
                if (input_index + AES_BLOCK_SIZE > input_size) {
-                       xor_size = input_index + AES_BLOCK_SIZE - input_size;
+                       xor_size = input_size - input_index;
                }
 
                // result of this is now XORed with input (plaintext/ciphertext)