15e64ae67SNicolas Toromanoff /* SPDX-License-Identifier: BSD-2-Clause */ 25e64ae67SNicolas Toromanoff /* 35e64ae67SNicolas Toromanoff * Copyright (c) 2021, STMicroelectronics - All Rights Reserved 45e64ae67SNicolas Toromanoff */ 55e64ae67SNicolas Toromanoff 65e64ae67SNicolas Toromanoff #ifndef __DRIVERS_CRYPTO_STM32_COMMON_H 75e64ae67SNicolas Toromanoff #define __DRIVERS_CRYPTO_STM32_COMMON_H 85e64ae67SNicolas Toromanoff 95e64ae67SNicolas Toromanoff #include <tee_api_types.h> 105e64ae67SNicolas Toromanoff 114320f5cfSThomas Bourgoin enum stm32_cipher_ip_id { 124320f5cfSThomas Bourgoin CRYP_IP, 134320f5cfSThomas Bourgoin SAES_IP, 144320f5cfSThomas Bourgoin }; 154320f5cfSThomas Bourgoin 164320f5cfSThomas Bourgoin /* 174320f5cfSThomas Bourgoin * Crypto algorithm common macro used in stm32_saes and stm32_cryp driver 184320f5cfSThomas Bourgoin */ 194320f5cfSThomas Bourgoin 204320f5cfSThomas Bourgoin #define INT8_BIT U(8) 214320f5cfSThomas Bourgoin #define AES_BLOCK_SIZE_BIT U(128) 224320f5cfSThomas Bourgoin #define AES_BLOCK_SIZE (AES_BLOCK_SIZE_BIT / INT8_BIT) 234320f5cfSThomas Bourgoin #define AES_BLOCK_NB_U32 (AES_BLOCK_SIZE / sizeof(uint32_t)) 244320f5cfSThomas Bourgoin #define DES_BLOCK_SIZE_BIT U(64) 254320f5cfSThomas Bourgoin #define DES_BLOCK_SIZE (DES_BLOCK_SIZE_BIT / INT8_BIT) 264320f5cfSThomas Bourgoin #define DES_BLOCK_NB_U32 (DES_BLOCK_SIZE / sizeof(uint32_t)) 274320f5cfSThomas Bourgoin #define MAX_BLOCK_SIZE_BIT AES_BLOCK_SIZE_BIT 284320f5cfSThomas Bourgoin #define MAX_BLOCK_SIZE AES_BLOCK_SIZE 294320f5cfSThomas Bourgoin #define MAX_BLOCK_NB_U32 AES_BLOCK_NB_U32 304320f5cfSThomas Bourgoin #define AES_KEYSIZE_128 U(16) 314320f5cfSThomas Bourgoin #define AES_KEYSIZE_192 U(24) 324320f5cfSThomas Bourgoin #define AES_KEYSIZE_256 U(32) 334320f5cfSThomas Bourgoin #define AES_IVSIZE U(16) 344320f5cfSThomas Bourgoin 35fa8cb7a8SNicolas Toromanoff TEE_Result stm32_register_authenc(void); 364320f5cfSThomas Bourgoin TEE_Result stm32_register_cipher(enum stm32_cipher_ip_id); 3781f5b20cSNicolas Toromanoff TEE_Result stm32_register_ecc(void); 38*e880aa97SNicolas Toromanoff TEE_Result stm32_register_hash(void); 39*e880aa97SNicolas Toromanoff TEE_Result stm32_register_hmac(void); 405e64ae67SNicolas Toromanoff 415e64ae67SNicolas Toromanoff #endif /* __DRIVERS_CRYPTO_STM32_COMMON_H */ 42