mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-05-04 09:24:46 +03:00
Unify variable type and rename to be unambiguous
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
This commit is contained in:
parent
2b8373f856
commit
f048618b43
@ -2460,10 +2460,10 @@ cleanup:
|
|||||||
/* Asymmetric cryptography */
|
/* 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 )
|
psa_algorithm_t alg )
|
||||||
{
|
{
|
||||||
if( do_hash )
|
if( input_is_message )
|
||||||
{
|
{
|
||||||
if( ! PSA_ALG_IS_SIGN_MESSAGE( alg ) )
|
if( ! PSA_ALG_IS_SIGN_MESSAGE( alg ) )
|
||||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
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,
|
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,
|
psa_algorithm_t alg,
|
||||||
const uint8_t * input,
|
const uint8_t * input,
|
||||||
size_t input_length,
|
size_t input_length,
|
||||||
@ -2498,7 +2498,7 @@ static psa_status_t psa_sign_internal( mbedtls_svc_key_id_t key,
|
|||||||
|
|
||||||
*signature_length = 0;
|
*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 )
|
if( status != PSA_SUCCESS )
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
@ -2511,7 +2511,7 @@ static psa_status_t psa_sign_internal( mbedtls_svc_key_id_t key,
|
|||||||
|
|
||||||
status = psa_get_and_lock_key_slot_with_policy(
|
status = psa_get_and_lock_key_slot_with_policy(
|
||||||
key, &slot,
|
key, &slot,
|
||||||
do_hash ? PSA_KEY_USAGE_SIGN_MESSAGE :
|
input_is_message ? PSA_KEY_USAGE_SIGN_MESSAGE :
|
||||||
PSA_KEY_USAGE_SIGN_HASH,
|
PSA_KEY_USAGE_SIGN_HASH,
|
||||||
alg );
|
alg );
|
||||||
|
|
||||||
@ -2528,7 +2528,7 @@ static psa_status_t psa_sign_internal( mbedtls_svc_key_id_t key,
|
|||||||
.core = slot->attr
|
.core = slot->attr
|
||||||
};
|
};
|
||||||
|
|
||||||
if( do_hash )
|
if( input_is_message )
|
||||||
{
|
{
|
||||||
status = psa_driver_wrapper_sign_message(
|
status = psa_driver_wrapper_sign_message(
|
||||||
&attributes, slot->key.data, slot->key.bytes,
|
&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,
|
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,
|
psa_algorithm_t alg,
|
||||||
const uint8_t * input,
|
const uint8_t * input,
|
||||||
size_t input_length,
|
size_t input_length,
|
||||||
@ -2575,13 +2575,13 @@ static psa_status_t psa_verify_internal( mbedtls_svc_key_id_t key,
|
|||||||
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
psa_key_slot_t *slot;
|
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 )
|
if( status != PSA_SUCCESS )
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
status = psa_get_and_lock_key_slot_with_policy(
|
status = psa_get_and_lock_key_slot_with_policy(
|
||||||
key, &slot,
|
key, &slot,
|
||||||
do_hash ? PSA_KEY_USAGE_VERIFY_MESSAGE :
|
input_is_message ? PSA_KEY_USAGE_VERIFY_MESSAGE :
|
||||||
PSA_KEY_USAGE_VERIFY_HASH,
|
PSA_KEY_USAGE_VERIFY_HASH,
|
||||||
alg );
|
alg );
|
||||||
|
|
||||||
@ -2592,7 +2592,7 @@ static psa_status_t psa_verify_internal( mbedtls_svc_key_id_t key,
|
|||||||
.core = slot->attr
|
.core = slot->attr
|
||||||
};
|
};
|
||||||
|
|
||||||
if( do_hash )
|
if( input_is_message )
|
||||||
{
|
{
|
||||||
status = psa_driver_wrapper_verify_message(
|
status = psa_driver_wrapper_verify_message(
|
||||||
&attributes, slot->key.data, slot->key.bytes,
|
&attributes, slot->key.data, slot->key.bytes,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user