1 From 9fd38dc340c38dee6e5935da174f90270a63bfbf Mon Sep 17 00:00:00 2001
2 From: Jacob Barthelmeh <jacob@wolfssl.com>
3 Date: Fri, 30 Aug 2019 16:15:48 -0600
4 Subject: [PATCH] build fix for aesccm + devcrypto=cbc + wpas and afalg
7 diff --git a/configure.ac b/configure.ac
8 index 61fad39dd..30731eb52 100644
11 @@ -1045,6 +1045,10 @@ AC_ARG_ENABLE([afalg],
13 if test "$ENABLED_AFALG" = "yes"
15 + if test "$ENABLED_AESCCM" = "yes"
17 + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
19 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG"
20 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_HASH"
22 diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c
23 index fef2f9c74..d294f6236 100644
24 --- a/wolfcrypt/src/aes.c
25 +++ b/wolfcrypt/src/aes.c
28 #endif /* HAVE_AES_DECRYPT */
30 -#elif defined(WOLFSSL_IMX6_CAAM) && !defined(NO_IMX6_CAAM_AES)
31 +#elif (defined(WOLFSSL_IMX6_CAAM) && !defined(NO_IMX6_CAAM_AES)) || \
32 + ((defined(WOLFSSL_AFALG) || defined(WOLFSSL_DEVCRYPTO_AES)) && \
33 + defined(HAVE_AESCCM))
34 static int wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
36 wc_AesEncryptDirect(aes, outBlock, inBlock);
39 #elif defined(WOLFSSL_AFALG)
40 #elif defined(WOLFSSL_DEVCRYPTO_AES)
41 - /* if all AES is enabled with devcrypto then tables are not needed */
43 - #if defined(HAVE_AESCCM)
44 - static int wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
46 - wc_AesEncryptDirect(aes, outBlock, inBlock);
53 /* using wolfCrypt software implementation */
54 @@ -1593,8 +1585,8 @@ static void wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
55 #endif /* HAVE_AES_CBC || WOLFSSL_AES_DIRECT || HAVE_AESGCM */
57 #if defined(HAVE_AES_DECRYPT)
58 -#if (defined(HAVE_AES_CBC) || defined(WOLFSSL_AES_DIRECT)) && \
59 - !defined(WOLFSSL_DEVCRYPTO_CBC)
60 +#if (defined(HAVE_AES_CBC) && !defined(WOLFSSL_DEVCRYPTO_CBC)) || \
61 + defined(WOLFSSL_AES_DIRECT)
63 /* load 4 Td Tables into cache by cache line stride */
64 static WC_INLINE word32 PreFetchTd(void)