mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-26 04:31:07 +00:00
psa: hash: Fix is_hash_accelerated signature
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
e93095fe6b
commit
56c9a9457a
|
@ -583,48 +583,48 @@ psa_status_t mbedtls_psa_hash_abort(
|
||||||
*/
|
*/
|
||||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||||
|
|
||||||
psa_status_t is_hash_accelerated( psa_algorithm_t alg )
|
static int is_hash_accelerated( psa_algorithm_t alg )
|
||||||
{
|
{
|
||||||
switch( alg )
|
switch( alg )
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD2)
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD2)
|
||||||
case PSA_ALG_MD2:
|
case PSA_ALG_MD2:
|
||||||
return( PSA_SUCCESS );
|
return( 1 );
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD4)
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD4)
|
||||||
case PSA_ALG_MD4:
|
case PSA_ALG_MD4:
|
||||||
return( PSA_SUCCESS );
|
return( 1 );
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
|
||||||
case PSA_ALG_MD5:
|
case PSA_ALG_MD5:
|
||||||
return( PSA_SUCCESS );
|
return( 1 );
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
|
||||||
case PSA_ALG_RIPEMD160:
|
case PSA_ALG_RIPEMD160:
|
||||||
return( PSA_SUCCESS );
|
return( 1 );
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
|
||||||
case PSA_ALG_SHA_1:
|
case PSA_ALG_SHA_1:
|
||||||
return( PSA_SUCCESS );
|
return( 1 );
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
|
||||||
case PSA_ALG_SHA_224:
|
case PSA_ALG_SHA_224:
|
||||||
return( PSA_SUCCESS );
|
return( 1 );
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
|
||||||
case PSA_ALG_SHA_256:
|
case PSA_ALG_SHA_256:
|
||||||
return( PSA_SUCCESS );
|
return( 1 );
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
|
||||||
case PSA_ALG_SHA_384:
|
case PSA_ALG_SHA_384:
|
||||||
return( PSA_SUCCESS );
|
return( 1 );
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
|
||||||
case PSA_ALG_SHA_512:
|
case PSA_ALG_SHA_512:
|
||||||
return( PSA_SUCCESS );
|
return( 1 );
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return( PSA_ERROR_NOT_SUPPORTED );
|
return( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,7 +636,7 @@ psa_status_t mbedtls_transparent_test_driver_hash_compute(
|
||||||
size_t hash_size,
|
size_t hash_size,
|
||||||
size_t *hash_length)
|
size_t *hash_length)
|
||||||
{
|
{
|
||||||
if( is_hash_accelerated( alg ) == PSA_SUCCESS )
|
if( is_hash_accelerated( alg ) )
|
||||||
return( hash_compute( alg, input, input_length,
|
return( hash_compute( alg, input, input_length,
|
||||||
hash, hash_size, hash_length ) );
|
hash, hash_size, hash_length ) );
|
||||||
else
|
else
|
||||||
|
@ -647,7 +647,7 @@ psa_status_t mbedtls_transparent_test_driver_hash_setup(
|
||||||
mbedtls_transparent_test_driver_hash_operation_t *operation,
|
mbedtls_transparent_test_driver_hash_operation_t *operation,
|
||||||
psa_algorithm_t alg )
|
psa_algorithm_t alg )
|
||||||
{
|
{
|
||||||
if( is_hash_accelerated( alg ) == PSA_SUCCESS )
|
if( is_hash_accelerated( alg ) )
|
||||||
return( hash_setup( operation, alg ) );
|
return( hash_setup( operation, alg ) );
|
||||||
else
|
else
|
||||||
return( PSA_ERROR_NOT_SUPPORTED );
|
return( PSA_ERROR_NOT_SUPPORTED );
|
||||||
|
@ -657,7 +657,7 @@ psa_status_t mbedtls_transparent_test_driver_hash_clone(
|
||||||
const mbedtls_transparent_test_driver_hash_operation_t *source_operation,
|
const mbedtls_transparent_test_driver_hash_operation_t *source_operation,
|
||||||
mbedtls_transparent_test_driver_hash_operation_t *target_operation )
|
mbedtls_transparent_test_driver_hash_operation_t *target_operation )
|
||||||
{
|
{
|
||||||
if( is_hash_accelerated( source_operation->alg ) == PSA_SUCCESS )
|
if( is_hash_accelerated( source_operation->alg ) )
|
||||||
return( hash_clone( source_operation, target_operation ) );
|
return( hash_clone( source_operation, target_operation ) );
|
||||||
else
|
else
|
||||||
return( PSA_ERROR_BAD_STATE );
|
return( PSA_ERROR_BAD_STATE );
|
||||||
|
@ -668,7 +668,7 @@ psa_status_t mbedtls_transparent_test_driver_hash_update(
|
||||||
const uint8_t *input,
|
const uint8_t *input,
|
||||||
size_t input_length )
|
size_t input_length )
|
||||||
{
|
{
|
||||||
if( is_hash_accelerated( operation->alg ) == PSA_SUCCESS )
|
if( is_hash_accelerated( operation->alg ) )
|
||||||
return( hash_update( operation, input, input_length ) );
|
return( hash_update( operation, input, input_length ) );
|
||||||
else
|
else
|
||||||
return( PSA_ERROR_BAD_STATE );
|
return( PSA_ERROR_BAD_STATE );
|
||||||
|
@ -680,7 +680,7 @@ psa_status_t mbedtls_transparent_test_driver_hash_finish(
|
||||||
size_t hash_size,
|
size_t hash_size,
|
||||||
size_t *hash_length )
|
size_t *hash_length )
|
||||||
{
|
{
|
||||||
if( is_hash_accelerated( operation->alg ) == PSA_SUCCESS )
|
if( is_hash_accelerated( operation->alg ) )
|
||||||
return( hash_finish( operation, hash, hash_size, hash_length ) );
|
return( hash_finish( operation, hash, hash_size, hash_length ) );
|
||||||
else
|
else
|
||||||
return( PSA_ERROR_BAD_STATE );
|
return( PSA_ERROR_BAD_STATE );
|
||||||
|
|
Loading…
Reference in a new issue