1 /* 2 * Copyright (c) 2019-2020, Arm Limited. All rights reserved. 3 * Copyright (c) 2021 STMicroelectronics. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 */ 8 9 #include "crypto_hw.h" 10 #if defined(GENERATOR_HW_CRYPTO_DPA_SUPPORTED) 11 #include "stm32hal.h" 12 #endif 13 #ifdef PSA_USE_SE_ST 14 extern int se_st_engine_init(void);/* fixme include se api.h */ 15 #endif 16 17 /* 18 * \brief Initialize the stm crypto accelerator 19 */ 20 crypto_hw_accelerator_init(void)21int crypto_hw_accelerator_init(void) 22 { 23 #if defined(GENERATOR_HW_CRYPTO_DPA_SUPPORTED) 24 __HAL_RCC_SHSI_ENABLE(); 25 #endif 26 #ifdef PSA_USE_SE_ST 27 return se_st_engine_init(); 28 #else 29 return 0; 30 #endif 31 } 32 33 /* 34 * \brief Deallocate the stm crypto accelerator 35 */ crypto_hw_accelerator_finish(void)36int crypto_hw_accelerator_finish(void) 37 { 38 return 0; 39 } 40 41 42