2 * Copyright (c) 2019 Nordic Semiconductor ASA
4 * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
8 * @addtogroup mbedtls_glue_aes
11 #ifndef MBEDTLS_AES_ALT_H
12 #define MBEDTLS_AES_ALT_H
14 #if !defined(MBEDTLS_CONFIG_FILE)
15 #include "../config.h"
17 #include MBEDTLS_CONFIG_FILE
20 #define CC310_MBEDTLS_AES_CONTEXT_WORDS (24) //!< AES context size in words in nrf_cc310_mbedcrypto library.
21 #define VANILLA_MBEDTLS_AES_CONTEXT_WORDS (70) //!< AES context size in words in standard mbed TLS.
22 #define VANILLA_MBEDTLS_AES_XTS_CONTEXT_WORDS (140) //!< AES XTS context size in words in standard mbed TLS.
24 #if defined(MBEDTLS_AES_ALT)
29 /** @brief Typedef of mbedcrypto AES glue context.
31 typedef struct mbedtls_aes_context
35 #if defined(CONFIG_CC310_MBEDTLS_AES_C)
36 uint32_t buffer_cc310[CC310_MBEDTLS_AES_CONTEXT_WORDS]; //!< Array the size of an AES context in the nrf_cc310_mbedcrypto library.
37 #endif /* CONFIG_CC310_MBEDTLS_AES_C */
38 #if defined(CONFIG_VANILLA_MBEDTLS_AES_C)
39 uint32_t buffer_vanilla_mbedtls[VANILLA_MBEDTLS_AES_CONTEXT_WORDS]; //!< Array the size of an AES context in vanilla mbed TLS.
40 #endif /* CONFIG_VANILLA_MBEDTLS_AES_C */
41 uint32_t dummy; //!< Dummy value in case no backend is enabled.
42 } buffer; //!< Union with size of the largest enabled backend context.
43 void* handle; //!< Pointer to the function table in an initialized glue context.
44 } mbedtls_aes_context;
47 /** @brief Typedef of mbedcrypto glue AES XTS context
49 typedef struct mbedtls_aes_xts_context
53 #if defined(CONFIG_VANILLA_MBEDTLS_CIPHER_MODE_XTS)
54 uint32_t buffer_vanilla_mbedtls[VANILLA_MBEDTLS_AES_XTS_CONTEXT_WORDS]; //!< Array the size of the memory required for an AES XTS context in vanilla mbed TLS.
55 #endif /* CONFIG_VANILLA_MBEDTLS_CIPHER_MODE_XTS */
56 uint32_t dummy; //!< Dummy value in case no backend is enabled.
57 } buffer; //!< Array with length equal to the size of the largest enabled backend.
58 void* handle; //!< Pointer to the function table in an initialized glue context.
59 } mbedtls_aes_xts_context;
61 #endif /* MBEDTLS_AES_ALT */
63 #endif /* MBEDTLS_AES_ALT_H */