From f4ecaf05c00ead85c6a65108942253feb73b67be Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Tue, 1 Dec 2020 18:31:14 -0600 Subject: [PATCH] openssl/aes.h: refactor WOLFSSL_AES_KEY typedef to inline sizeof(Aes) long words, rather than computing the size of Aes from its members. --- wolfssl/openssl/aes.h | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/wolfssl/openssl/aes.h b/wolfssl/openssl/aes.h index 4fdf9fef0..20912ddd4 100644 --- a/wolfssl/openssl/aes.h +++ b/wolfssl/openssl/aes.h @@ -42,32 +42,7 @@ * OpenSSL compatibility layer. This makes code working with an AES structure * to need the size of the structure. */ typedef struct WOLFSSL_AES_KEY { - /* aligned and big enough for Aes from wolfssl/wolfcrypt/aes.h */ - ALIGN16 void* holder[(376 + WC_ASYNC_DEV_SIZE)/ sizeof(void*)]; - #ifdef GCM_TABLE - /* key-based fast multiplication table. */ - ALIGN16 void* M0[4096 / sizeof(void*)]; - #elif defined(GCM_TABLE_4BIT) - #if !defined(WORD64_AVAILABLE) || defined(BIG_ENDIAN_ORDER) - ALIGN16 byte M0[16][AES_BLOCK_SIZE]; - #else - ALIGN16 byte M0[32][AES_BLOCK_SIZE]; - #endif - #endif /* GCM_TABLE */ - #if defined(WOLFSSL_DEVCRYPTO) && \ - (defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC)) - /* large enough for additional devcrypto information */ - void* devKey[288 / sizeof(void*)]; - #endif - #ifdef WOLFSSL_AFALG - void* afalg_holder[288 / sizeof(void*)]; - #endif - #ifdef HAVE_PKCS11 - void* pkcs11_holder[(AES_MAX_ID_LEN + sizeof(int)) / sizeof(void*)]; - #endif - #if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLF_CRYPTO_CB) - void* async_holder[128 / sizeof(void*)]; - #endif + void *buf[(sizeof(Aes) / sizeof(void *)) + 1]; } WOLFSSL_AES_KEY; typedef WOLFSSL_AES_KEY AES_KEY;