Fix mac_key_policy test function

Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
This commit is contained in:
Mateusz Starzyk 2021-08-19 15:11:50 +02:00
parent dd55b25bd5
commit 18f662b0af

View File

@ -879,7 +879,7 @@ void mac_key_policy( int policy_usage_arg,
mbedtls_test_update_key_usage_flags( policy_usage ) ); mbedtls_test_update_key_usage_flags( policy_usage ) );
status = psa_mac_sign_setup( &operation, key, exercise_alg ); status = psa_mac_sign_setup( &operation, key, exercise_alg );
if( ( policy_usage & PSA_KEY_USAGE_SIGN_HASH ) == 0 ) if( ( mbedtls_test_update_key_usage_flags(policy_usage) & PSA_KEY_USAGE_SIGN_MESSAGE ) == 0 )
TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED ); TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
else else
TEST_EQUAL( status, expected_status ); TEST_EQUAL( status, expected_status );
@ -888,7 +888,7 @@ void mac_key_policy( int policy_usage_arg,
memset( mac, 0, sizeof( mac ) ); memset( mac, 0, sizeof( mac ) );
status = psa_mac_verify_setup( &operation, key, exercise_alg ); status = psa_mac_verify_setup( &operation, key, exercise_alg );
if( ( policy_usage & PSA_KEY_USAGE_VERIFY_HASH ) == 0 ) if( ( mbedtls_test_update_key_usage_flags(policy_usage) & PSA_KEY_USAGE_VERIFY_MESSAGE ) == 0 )
TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED ); TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
else else
TEST_EQUAL( status, expected_status ); TEST_EQUAL( status, expected_status );