Require MESSAGE flag in PSA MAC setup.

Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
This commit is contained in:
Mateusz Starzyk 2021-08-17 15:24:32 +02:00
parent 186c0216b0
commit dd55b25bd5

View File

@ -2398,7 +2398,7 @@ static psa_status_t psa_mac_setup( psa_mac_operation_t *operation,
status = psa_get_and_lock_key_slot_with_policy( status = psa_get_and_lock_key_slot_with_policy(
key, key,
&slot, &slot,
is_sign ? PSA_KEY_USAGE_SIGN_HASH : PSA_KEY_USAGE_VERIFY_HASH, is_sign ? PSA_KEY_USAGE_SIGN_MESSAGE : PSA_KEY_USAGE_VERIFY_MESSAGE,
alg ); alg );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
goto exit; goto exit;
@ -2583,8 +2583,9 @@ static psa_status_t psa_mac_compute_internal( mbedtls_svc_key_id_t key,
uint8_t operation_mac_size = 0; uint8_t operation_mac_size = 0;
status = psa_get_and_lock_key_slot_with_policy( status = psa_get_and_lock_key_slot_with_policy(
key, &slot, key,
is_sign ? PSA_KEY_USAGE_SIGN_HASH : PSA_KEY_USAGE_VERIFY_HASH, &slot,
is_sign ? PSA_KEY_USAGE_SIGN_MESSAGE : PSA_KEY_USAGE_VERIFY_MESSAGE,
alg ); alg );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
goto exit; goto exit;