diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 077b29438..1ecab4e07 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -2460,10 +2460,10 @@ cleanup: /* Asymmetric cryptography */ /****************************************************************/ -static psa_status_t psa_sign_verify_check_alg( uint8_t do_hash, +static psa_status_t psa_sign_verify_check_alg( int input_is_message, psa_algorithm_t alg ) { - if( do_hash ) + if( input_is_message ) { if( ! PSA_ALG_IS_SIGN_MESSAGE( alg ) ) return( PSA_ERROR_INVALID_ARGUMENT ); @@ -2484,7 +2484,7 @@ static psa_status_t psa_sign_verify_check_alg( uint8_t do_hash, } static psa_status_t psa_sign_internal( mbedtls_svc_key_id_t key, - uint8_t do_hash, + int input_is_message, psa_algorithm_t alg, const uint8_t * input, size_t input_length, @@ -2498,7 +2498,7 @@ static psa_status_t psa_sign_internal( mbedtls_svc_key_id_t key, *signature_length = 0; - status = psa_sign_verify_check_alg( do_hash, alg ); + status = psa_sign_verify_check_alg( input_is_message, alg ); if( status != PSA_SUCCESS ) return status; @@ -2511,8 +2511,8 @@ static psa_status_t psa_sign_internal( mbedtls_svc_key_id_t key, status = psa_get_and_lock_key_slot_with_policy( key, &slot, - do_hash ? PSA_KEY_USAGE_SIGN_MESSAGE : - PSA_KEY_USAGE_SIGN_HASH, + input_is_message ? PSA_KEY_USAGE_SIGN_MESSAGE : + PSA_KEY_USAGE_SIGN_HASH, alg ); if( status != PSA_SUCCESS ) @@ -2528,7 +2528,7 @@ static psa_status_t psa_sign_internal( mbedtls_svc_key_id_t key, .core = slot->attr }; - if( do_hash ) + if( input_is_message ) { status = psa_driver_wrapper_sign_message( &attributes, slot->key.data, slot->key.bytes, @@ -2564,7 +2564,7 @@ exit: } static psa_status_t psa_verify_internal( mbedtls_svc_key_id_t key, - uint8_t do_hash, + int input_is_message, psa_algorithm_t alg, const uint8_t * input, size_t input_length, @@ -2575,14 +2575,14 @@ static psa_status_t psa_verify_internal( mbedtls_svc_key_id_t key, psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; psa_key_slot_t *slot; - status = psa_sign_verify_check_alg( do_hash, alg ); + status = psa_sign_verify_check_alg( input_is_message, alg ); if( status != PSA_SUCCESS ) return status; status = psa_get_and_lock_key_slot_with_policy( key, &slot, - do_hash ? PSA_KEY_USAGE_VERIFY_MESSAGE : - PSA_KEY_USAGE_VERIFY_HASH, + input_is_message ? PSA_KEY_USAGE_VERIFY_MESSAGE : + PSA_KEY_USAGE_VERIFY_HASH, alg ); if( status != PSA_SUCCESS ) @@ -2592,7 +2592,7 @@ static psa_status_t psa_verify_internal( mbedtls_svc_key_id_t key, .core = slot->attr }; - if( do_hash ) + if( input_is_message ) { status = psa_driver_wrapper_verify_message( &attributes, slot->key.data, slot->key.bytes,