mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-07-23 09:39:19 +08:00
pk: let psa_export_key() check if the key is exportable or not
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
3a815cbd2f
commit
5ac511b45a
@ -1400,14 +1400,9 @@ int mbedtls_pk_copy_from_psa(mbedtls_svc_key_id_t key_id, mbedtls_pk_context *pk
|
||||
return MBEDTLS_ERR_PK_BAD_INPUT_DATA;
|
||||
}
|
||||
|
||||
if ((psa_get_key_usage_flags(&key_attr) & PSA_KEY_USAGE_EXPORT) != PSA_KEY_USAGE_EXPORT) {
|
||||
ret = MBEDTLS_ERR_PK_BAD_INPUT_DATA;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
status = psa_export_key(key_id, exp_key, sizeof(exp_key), &exp_key_len);
|
||||
if (status != PSA_SUCCESS) {
|
||||
ret = psa_generic_status_to_mbedtls(status);
|
||||
ret = MBEDTLS_ERR_PK_BAD_INPUT_DATA;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user