Skip to content

Commit d805e06

Browse files
committed
add AesEax struct to header for public use
1 parent 3943852 commit d805e06

2 files changed

Lines changed: 18 additions & 13 deletions

File tree

wolfcrypt/src/aes.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
7676
#include <wolfssl/wolfcrypt/port/nxp/se050_port.h>
7777
#endif
7878

79-
#if defined(WOLFSSL_AES_SIV) || defined(WOLFSSL_AES_EAX)
79+
#if defined(WOLFSSL_AES_SIV)
8080
#include <wolfssl/wolfcrypt/cmac.h>
81-
#endif /* WOLFSSL_AES_SIV || WOLFSSL_AES_EAX */
81+
#endif /* WOLFSSL_AES_SIV */
8282

8383
#if defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_AES)
8484
#include <wolfssl/wolfcrypt/port/psa/psa.h>
@@ -11789,17 +11789,6 @@ int wc_AesSivDecrypt(const byte* key, word32 keySz, const byte* assoc,
1178911789

1179011790
#if defined(WOLFSSL_AES_EAX)
1179111791

11792-
struct AesEax {
11793-
Aes aes;
11794-
Cmac nonceCmac;
11795-
Cmac aadCmac;
11796-
Cmac ciphertextCmac;
11797-
byte nonceCmacFinal[AES_BLOCK_SIZE];
11798-
byte aadCmacFinal[AES_BLOCK_SIZE];
11799-
byte ciphertextCmacFinal[AES_BLOCK_SIZE];
11800-
byte prefixBuf[AES_BLOCK_SIZE];
11801-
};
11802-
1180311792
/*
1180411793
* AES EAX one-shot API
1180511794
* Encrypts input data and computes an auth tag over the input

wolfssl/wolfcrypt/aes.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,22 @@ int wc_AesSivDecrypt(const byte* key, word32 keySz, const byte* assoc,
602602

603603
#ifdef WOLFSSL_AES_EAX
604604

605+
/* Because of the circular dependency between AES and CMAC, we need to prevent
606+
* inclusion of AES EAX from CMAC to avoid a recursive inclusion */
607+
#ifndef WOLF_CRYPT_CMAC_H
608+
#include <wolfssl/wolfcrypt/cmac.h>
609+
struct AesEax {
610+
Aes aes;
611+
Cmac nonceCmac;
612+
Cmac aadCmac;
613+
Cmac ciphertextCmac;
614+
byte nonceCmacFinal[AES_BLOCK_SIZE];
615+
byte aadCmacFinal[AES_BLOCK_SIZE];
616+
byte ciphertextCmacFinal[AES_BLOCK_SIZE];
617+
byte prefixBuf[AES_BLOCK_SIZE];
618+
};
619+
#endif /* !defined(WOLF_CRYPT_CMAC_H) */
620+
605621
typedef struct AesEax AesEax;
606622

607623
/* One-shot API */

0 commit comments

Comments
 (0)