mirror of https://github.com/ARMmbed/mbed-os.git
STM mbedtls: clear algo value for md5/sha1 and sha256
The hw block for mbedtls is shared, thus HASH algo value should be cleared in the init.pull/4695/head
parent
d92e4b5fcd
commit
744c364683
|
@ -100,6 +100,8 @@ void mbedtls_md5_starts( mbedtls_md5_context *ctx )
|
|||
|
||||
/* HASH Configuration */
|
||||
ctx->hhash_md5.Init.DataType = HASH_DATATYPE_8B;
|
||||
/* clear CR ALGO value */
|
||||
HASH->CR &= ~HASH_CR_ALGO_Msk;
|
||||
if (HAL_HASH_Init(&ctx->hhash_md5) != 0) {
|
||||
// return error code
|
||||
return;
|
||||
|
|
|
@ -98,6 +98,8 @@ void mbedtls_sha1_starts( mbedtls_sha1_context *ctx )
|
|||
|
||||
/* HASH Configuration */
|
||||
ctx->hhash_sha1.Init.DataType = HASH_DATATYPE_8B;
|
||||
/* clear CR ALGO value */
|
||||
HASH->CR &= ~HASH_CR_ALGO_Msk;
|
||||
if (HAL_HASH_Init(&ctx->hhash_sha1) == HAL_ERROR) {
|
||||
// error found to be returned
|
||||
return;
|
||||
|
|
|
@ -99,6 +99,8 @@ void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 )
|
|||
ctx->is224 = is224;
|
||||
/* HASH Configuration */
|
||||
ctx->hhash_sha256.Init.DataType = HASH_DATATYPE_8B;
|
||||
/* clear CR ALGO value */
|
||||
HASH->CR &= ~HASH_CR_ALGO_Msk;
|
||||
if (HAL_HASH_Init(&ctx->hhash_sha256) == HAL_ERROR) {
|
||||
// error found to be returned
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue