Unify variable type and rename to be unambiguous

Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
This commit is contained in:
gabor-mezei-arm 2021-05-12 11:03:09 +02:00
parent 2b8373f856
commit f048618b43
No known key found for this signature in database
GPG Key ID: 106F5A41ECC305BD

View File

@ -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,