mirror of
https://github.com/curl/curl.git
synced 2026-07-10 06:47:18 +03:00
mbedtls: replace memset() with psa_hash_operation_init()
To initialize hash contexts.
Ref: https://arm-software.github.io/psa-api/crypto/1.1/api/ops/hashes.html#c.psa_hash_operation_init
Follow-up to 3a305831d1 #19077
Closes #22220
This commit is contained in:
parent
ddc76c24c5
commit
5b10939ef7
2 changed files with 6 additions and 4 deletions
|
|
@ -128,8 +128,9 @@ typedef psa_hash_operation_t my_md5_ctx;
|
|||
|
||||
static CURLcode my_md5_init(void *ctx)
|
||||
{
|
||||
memset(ctx, 0, sizeof(my_md5_ctx));
|
||||
if(psa_hash_setup(ctx, PSA_ALG_MD5) != PSA_SUCCESS)
|
||||
psa_hash_operation_t *pctx = (psa_hash_operation_t *)ctx;
|
||||
*pctx = psa_hash_operation_init();
|
||||
if(psa_hash_setup(pctx, PSA_ALG_MD5) != PSA_SUCCESS)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,8 +148,9 @@ typedef psa_hash_operation_t my_sha256_ctx;
|
|||
|
||||
static CURLcode my_sha256_init(void *ctx)
|
||||
{
|
||||
memset(ctx, 0, sizeof(my_sha256_ctx));
|
||||
if(psa_hash_setup(ctx, PSA_ALG_SHA_256) != PSA_SUCCESS)
|
||||
psa_hash_operation_t *pctx = (psa_hash_operation_t *)ctx;
|
||||
*pctx = psa_hash_operation_init();
|
||||
if(psa_hash_setup(pctx, PSA_ALG_SHA_256) != PSA_SUCCESS)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue