From 7eb6ed660241c0da4b41cf49e25b196ecb319b28 Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Tue, 5 Nov 2019 11:46:13 +0100 Subject: [PATCH] STM32F7 HAL CRYPT patch to add missing UNLOCK --- .../device/stm32f7xx_hal_cryp.c | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_cryp.c b/targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_cryp.c index 36892d6297f..0c0f71a8d05 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_cryp.c +++ b/targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_cryp.c @@ -1021,6 +1021,10 @@ HAL_StatusTypeDef HAL_CRYP_Encrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, u default: hcryp->ErrorCode |= HAL_CRYP_ERROR_NOT_SUPPORTED; + + /* Process unlocked */ + __HAL_UNLOCK(hcryp); // MBED patch + return HAL_ERROR; } @@ -1057,6 +1061,10 @@ HAL_StatusTypeDef HAL_CRYP_Encrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, u default: hcryp->ErrorCode |= HAL_CRYP_ERROR_NOT_SUPPORTED; + + /* Process unlocked */ + __HAL_UNLOCK(hcryp); // MBED patch + return HAL_ERROR; } #endif /*end AES or CRYP */ @@ -1065,10 +1073,10 @@ HAL_StatusTypeDef HAL_CRYP_Encrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, u { /* Change the CRYP peripheral state */ hcryp->State = HAL_CRYP_STATE_READY; - + } + /* Process unlocked */ - __HAL_UNLOCK(hcryp); - } + __HAL_UNLOCK(hcryp); // MBED patch } else { @@ -1186,6 +1194,10 @@ HAL_StatusTypeDef HAL_CRYP_Decrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, u default: hcryp->ErrorCode |= HAL_CRYP_ERROR_NOT_SUPPORTED; + + /* Process unlocked */ + __HAL_UNLOCK(hcryp); // MBED patch + return HAL_ERROR; } @@ -1230,10 +1242,10 @@ HAL_StatusTypeDef HAL_CRYP_Decrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, u { /* Change the CRYP peripheral state */ hcryp->State = HAL_CRYP_STATE_READY; - - /* Process unlocked */ - __HAL_UNLOCK(hcryp); } + + /* Process unlocked */ + __HAL_UNLOCK(hcryp); // MBED patch } else {