Skip to content

Commit 3d6dd46

Browse files
author
Cruz Monrreal
authored
Merge pull request #8946 from juhoeskeli/STM32L4_aes_set_key_fix
STM32L4: before calling HAL_CRYP_DeInit initialize the Instance member
2 parents e30194f + 361d804 commit 3d6dd46

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

features/mbedtls/targets/TARGET_STM/aes_alt.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,14 @@ static int aes_set_key(mbedtls_aes_context *ctx, const unsigned char *key, unsig
5656
return (MBEDTLS_ERR_AES_INVALID_KEY_LENGTH);
5757
}
5858

59+
ctx->hcryp_aes.Init.DataType = CRYP_DATATYPE_8B;
60+
ctx->hcryp_aes.Instance = CRYP;
61+
5962
/* Deinitializes the CRYP peripheral */
6063
if (HAL_CRYP_DeInit(&ctx->hcryp_aes) == HAL_ERROR) {
6164
return (HAL_ERROR);
6265
}
6366

64-
ctx->hcryp_aes.Init.DataType = CRYP_DATATYPE_8B;
65-
ctx->hcryp_aes.Instance = CRYP;
6667
/* Enable CRYP clock */
6768
__HAL_RCC_CRYP_CLK_ENABLE();
6869

0 commit comments

Comments
 (0)