mirror of
https://github.com/espressif/mbedtls.git
synced 2025-06-15 13:32:52 +08:00
pk: fix position for mbedtls_platform_zeroize
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
b4468c45ac
commit
5e7494ea75
@ -646,6 +646,7 @@ int mbedtls_pk_wrap_as_opaque(mbedtls_pk_context *pk,
|
|||||||
psa_key_type_t key_type;
|
psa_key_type_t key_type;
|
||||||
size_t bits;
|
size_t bits;
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
|
psa_status_t status;
|
||||||
|
|
||||||
/* export the private key material in the format PSA wants */
|
/* export the private key material in the format PSA wants */
|
||||||
if (mbedtls_pk_get_type(pk) != MBEDTLS_PK_ECKEY) {
|
if (mbedtls_pk_get_type(pk) != MBEDTLS_PK_ECKEY) {
|
||||||
@ -668,11 +669,11 @@ int mbedtls_pk_wrap_as_opaque(mbedtls_pk_context *pk,
|
|||||||
psa_set_key_algorithm(&attributes, PSA_ALG_ECDSA(hash_alg));
|
psa_set_key_algorithm(&attributes, PSA_ALG_ECDSA(hash_alg));
|
||||||
|
|
||||||
/* import private key into PSA */
|
/* import private key into PSA */
|
||||||
if (PSA_SUCCESS != psa_import_key(&attributes, d, d_len, key)) {
|
status = psa_import_key(&attributes, d, d_len, key);
|
||||||
return MBEDTLS_ERR_PK_HW_ACCEL_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
mbedtls_platform_zeroize(d, sizeof(d));
|
mbedtls_platform_zeroize(d, sizeof(d));
|
||||||
|
if (status != PSA_SUCCESS) {
|
||||||
|
return PSA_PK_TO_MBEDTLS_ERR(status);
|
||||||
|
}
|
||||||
|
|
||||||
/* make PK context wrap the key slot */
|
/* make PK context wrap the key slot */
|
||||||
mbedtls_pk_free(pk);
|
mbedtls_pk_free(pk);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user