From 9c245b7fc597cc428ae630c2cf0a2a182bbd1a56 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 16 Jul 2019 15:44:45 -0700 Subject: [PATCH] Fixes When building with GCC-8 and enable-intelasm set, GCC reported a memcpy from and two the same pointer being possible. Added a check for the same pointer and skipped the copy if the same. --- wolfcrypt/src/aes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index e12a2d258..1d246cb6d 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -1628,7 +1628,8 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock) #endif /* if input and output same will overwrite input iv */ - XMEMCPY(aes->tmp, inBlock, AES_BLOCK_SIZE); + if ((const byte*)aes->tmp != inBlock) + XMEMCPY(aes->tmp, inBlock, AES_BLOCK_SIZE); AES_ECB_decrypt(inBlock, outBlock, AES_BLOCK_SIZE, (byte*)aes->key, aes->rounds); return;