Skip to content

Commit 748b058

Browse files
committed
wolfcrypt/src/aes.c: fix for -Wrestrict in wc_AesCbcDecrypt() when WOLFSSL_AESNI.
1 parent 7569cfd commit 748b058

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

wolfcrypt/src/aes.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,11 +859,11 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
859859
#endif
860860

861861
#elif defined(WOLFSSL_KCAPI_AES)
862-
/* Only CBC and GCM that are in wolfcrypt/src/port/kcapi/kcapi_aes.c */
862+
/* Only CBC and GCM are in wolfcrypt/src/port/kcapi/kcapi_aes.c */
863863
#if defined(WOLFSSL_AES_COUNTER) || defined(HAVE_AESCCM) || \
864864
defined(WOLFSSL_CMAC) || defined(WOLFSSL_AES_OFB) || \
865865
defined(WOLFSSL_AES_CFB) || defined(HAVE_AES_ECB) || \
866-
defined(WOLFSSL_AES_DIRECT) || \
866+
defined(WOLFSSL_AES_DIRECT) || defined(WOLFSSL_AES_XTS) || \
867867
(defined(HAVE_AES_CBC) && defined(WOLFSSL_NO_KCAPI_AES_CBC))
868868

869869
#define NEED_AES_TABLES
@@ -5460,8 +5460,12 @@ int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
54605460
#else
54615461
while (blocks--) {
54625462
int ret;
5463+
#ifdef WOLFSSL_AESNI
5464+
ret = wc_AesDecrypt(aes, in, out);
5465+
#else
54635466
XMEMCPY(aes->tmp, in, AES_BLOCK_SIZE);
54645467
ret = wc_AesDecrypt(aes, (byte*)aes->tmp, out);
5468+
#endif
54655469
if (ret != 0)
54665470
return ret;
54675471
xorbuf(out, (byte*)aes->reg, AES_BLOCK_SIZE);

0 commit comments

Comments
 (0)