1 From e8e1d35744c68b165e172a687e870a549438bdf0 Mon Sep 17 00:00:00 2001
2 From: Jacob Barthelmeh <jacob@wolfssl.com>
3 Date: Tue, 13 Aug 2019 14:12:45 -0600
4 Subject: [PATCH] build with devcrypto and aesccm
7 diff --git a/configure.ac b/configure.ac
8 index f943cc6ef..cf03e7f52 100644
11 @@ -1096,6 +1096,10 @@ then
12 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
13 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
14 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_AES"
15 + if test "$ENABLED_AESCCM" = "yes"
17 + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
19 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HASH"
20 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_HASH_RAW"
22 @@ -1106,6 +1110,10 @@ then
23 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
24 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_AES"
25 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
26 + if test "$ENABLED_AESCCM" = "yes"
28 + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
32 if test "$ENABLED_DEVCRYPTO" = "cbc"
33 diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c
34 index beeae72a6..b583d03e9 100644
35 --- a/wolfcrypt/src/aes.c
36 +++ b/wolfcrypt/src/aes.c
38 #elif defined(WOLFSSL_DEVCRYPTO_AES)
39 /* if all AES is enabled with devcrypto then tables are not needed */
41 + #if defined(HAVE_AESCCM)
42 + static int wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
44 + wc_AesEncryptDirect(aes, outBlock, inBlock);
51 /* using wolfCrypt software implementation */
52 @@ -1314,7 +1322,8 @@ static const word32 Td[4][256] = {
56 -#if defined(HAVE_AES_CBC) || defined(WOLFSSL_AES_DIRECT)
57 +#if (defined(HAVE_AES_CBC) && !defined(WOLFSSL_DEVCRYPTO_CBC)) \
58 + || defined(WOLFSSL_AES_DIRECT)
59 static const byte Td4[256] =
61 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U,
62 diff --git a/wolfcrypt/src/port/devcrypto/devcrypto_aes.c b/wolfcrypt/src/port/devcrypto/devcrypto_aes.c
63 index 5c63421e2..d5061f364 100644
64 --- a/wolfcrypt/src/port/devcrypto/devcrypto_aes.c
65 +++ b/wolfcrypt/src/port/devcrypto/devcrypto_aes.c
66 @@ -168,7 +168,7 @@ static int wc_DevCrypto_AesDirect(Aes* aes, byte* out, const byte* in,
70 -#if defined(WOLFSSL_AES_DIRECT)
71 +#if defined(WOLFSSL_AES_DIRECT) || defined(HAVE_AESCCM)
72 void wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in)
74 wc_DevCrypto_AesDirect(aes, out, in, AES_BLOCK_SIZE, COP_ENCRYPT);