mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-28 05:51:08 +00:00
Fix for algorithms other than hash-then-sign
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
This commit is contained in:
parent
fc8d0aedd6
commit
9719a8450e
|
@ -3024,11 +3024,12 @@ psa_status_t psa_sign_message_internal(
|
||||||
size_t *signature_length )
|
size_t *signature_length )
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
size_t hash_length;
|
|
||||||
uint8_t hash[PSA_HASH_MAX_SIZE];
|
|
||||||
|
|
||||||
if ( PSA_ALG_IS_HASH_AND_SIGN( alg ) )
|
if ( PSA_ALG_IS_HASH_AND_SIGN( alg ) )
|
||||||
{
|
{
|
||||||
|
size_t hash_length;
|
||||||
|
uint8_t hash[PSA_HASH_MAX_SIZE];
|
||||||
|
|
||||||
status = psa_driver_wrapper_hash_compute(
|
status = psa_driver_wrapper_hash_compute(
|
||||||
PSA_ALG_SIGN_GET_HASH( alg ),
|
PSA_ALG_SIGN_GET_HASH( alg ),
|
||||||
input, input_length,
|
input, input_length,
|
||||||
|
@ -3036,7 +3037,6 @@ psa_status_t psa_sign_message_internal(
|
||||||
|
|
||||||
if( status != PSA_SUCCESS )
|
if( status != PSA_SUCCESS )
|
||||||
return status;
|
return status;
|
||||||
}
|
|
||||||
|
|
||||||
return psa_driver_wrapper_sign_hash(
|
return psa_driver_wrapper_sign_hash(
|
||||||
attributes, key_buffer, key_buffer_size,
|
attributes, key_buffer, key_buffer_size,
|
||||||
|
@ -3044,6 +3044,12 @@ psa_status_t psa_sign_message_internal(
|
||||||
signature, signature_size, signature_length );
|
signature, signature_size, signature_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return psa_driver_wrapper_sign_hash(
|
||||||
|
attributes, key_buffer, key_buffer_size,
|
||||||
|
alg, input, input_length,
|
||||||
|
signature, signature_size, signature_length );
|
||||||
|
}
|
||||||
|
|
||||||
psa_status_t psa_sign_message( mbedtls_svc_key_id_t key,
|
psa_status_t psa_sign_message( mbedtls_svc_key_id_t key,
|
||||||
psa_algorithm_t alg,
|
psa_algorithm_t alg,
|
||||||
const uint8_t * input,
|
const uint8_t * input,
|
||||||
|
@ -3068,11 +3074,12 @@ psa_status_t psa_verify_message_internal(
|
||||||
size_t signature_length )
|
size_t signature_length )
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
size_t hash_length;
|
|
||||||
uint8_t hash[PSA_HASH_MAX_SIZE];
|
|
||||||
|
|
||||||
if ( PSA_ALG_IS_HASH_AND_SIGN( alg ) )
|
if ( PSA_ALG_IS_HASH_AND_SIGN( alg ) )
|
||||||
{
|
{
|
||||||
|
size_t hash_length;
|
||||||
|
uint8_t hash[PSA_HASH_MAX_SIZE];
|
||||||
|
|
||||||
status = psa_driver_wrapper_hash_compute(
|
status = psa_driver_wrapper_hash_compute(
|
||||||
PSA_ALG_SIGN_GET_HASH( alg ),
|
PSA_ALG_SIGN_GET_HASH( alg ),
|
||||||
input, input_length,
|
input, input_length,
|
||||||
|
@ -3080,7 +3087,6 @@ psa_status_t psa_verify_message_internal(
|
||||||
|
|
||||||
if( status != PSA_SUCCESS )
|
if( status != PSA_SUCCESS )
|
||||||
return status;
|
return status;
|
||||||
}
|
|
||||||
|
|
||||||
return psa_driver_wrapper_verify_hash(
|
return psa_driver_wrapper_verify_hash(
|
||||||
attributes, key_buffer, key_buffer_size,
|
attributes, key_buffer, key_buffer_size,
|
||||||
|
@ -3088,6 +3094,12 @@ psa_status_t psa_verify_message_internal(
|
||||||
signature, signature_length );
|
signature, signature_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return psa_driver_wrapper_verify_hash(
|
||||||
|
attributes, key_buffer, key_buffer_size,
|
||||||
|
alg, input, input_length,
|
||||||
|
signature, signature_length );
|
||||||
|
}
|
||||||
|
|
||||||
psa_status_t psa_verify_message( mbedtls_svc_key_id_t key,
|
psa_status_t psa_verify_message( mbedtls_svc_key_id_t key,
|
||||||
psa_algorithm_t alg,
|
psa_algorithm_t alg,
|
||||||
const uint8_t * input,
|
const uint8_t * input,
|
||||||
|
|
Loading…
Reference in a new issue