1 /* 2 * Copyright (c) 2020 Markus Fuchs <markus.fuchs@de.sauter-bc.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 */ 7 8 #ifndef ZEPHYR_DRIVERS_CRYPTO_CRYPTO_STM32_PRIV_H_ 9 #define ZEPHYR_DRIVERS_CRYPTO_CRYPTO_STM32_PRIV_H_ 10 11 /* Maximum supported key length is 256 bits */ 12 #define CRYPTO_STM32_AES_MAX_KEY_LEN (256 / 8) 13 14 struct crypto_stm32_config { 15 struct stm32_pclken pclken; 16 }; 17 18 struct crypto_stm32_data { 19 CRYP_HandleTypeDef hcryp; 20 struct k_sem device_sem; 21 struct k_sem session_sem; 22 }; 23 24 struct crypto_stm32_session { 25 CRYP_ConfigTypeDef config; 26 uint32_t key[CRYPTO_STM32_AES_MAX_KEY_LEN / sizeof(uint32_t)]; 27 bool in_use; 28 }; 29 30 #define CRYPTO_STM32_CFG(dev) \ 31 ((const struct crypto_stm32_config *const)(dev)->config) 32 33 #define CRYPTO_STM32_DATA(dev) \ 34 ((struct crypto_stm32_data *const)(dev)->data) 35 36 #define CRYPTO_STM32_SESSN(ctx) \ 37 ((struct crypto_stm32_session *const)(ctx)->drv_sessn_state) 38 39 #endif /* ZEPHYR_DRIVERS_CRYPTO_CRYPTO_STM32_PRIV_H_ */ 40