Rename and retype hash test driver context structure
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
753f973f87
commit
0f8ffa806b
4 changed files with 26 additions and 26 deletions
|
@ -92,11 +92,9 @@ typedef struct
|
|||
*/
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
|
||||
typedef struct {
|
||||
mbedtls_psa_hash_operation_t operation;
|
||||
} mbedtls_transparent_test_driver_hash_operation_t;
|
||||
typedef mbedtls_psa_hash_operation_t mbedtls_transparent_test_driver_hash_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT { MBEDTLS_PSA_HASH_OPERATION_INIT }
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT MBEDTLS_PSA_HASH_OPERATION_INIT
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef union {
|
|||
unsigned dummy; /* Make sure this structure is always non-empty */
|
||||
mbedtls_psa_hash_operation_t mbedtls_ctx;
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_transparent_test_driver_hash_operation_t test_ctx;
|
||||
mbedtls_transparent_test_driver_hash_operation_t test_driver_ctx;
|
||||
#endif
|
||||
} psa_driver_hash_context_t;
|
||||
|
||||
|
|
|
@ -1086,8 +1086,8 @@ psa_status_t psa_driver_wrapper_hash_compute(
|
|||
|
||||
/* Try accelerators first */
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST) && defined(MBEDTLS_PSA_ACCEL_HASH)
|
||||
status = mbedtls_transparent_test_driver_hash_compute( alg, input, input_length,
|
||||
hash, hash_size, hash_length );
|
||||
status = mbedtls_transparent_test_driver_hash_compute(
|
||||
alg, input, input_length, hash, hash_size, hash_length );
|
||||
if( status != PSA_ERROR_NOT_SUPPORTED )
|
||||
return( status );
|
||||
#endif
|
||||
|
@ -1118,7 +1118,8 @@ psa_status_t psa_driver_wrapper_hash_setup(
|
|||
|
||||
/* Try setup on accelerators first */
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST) && defined(MBEDTLS_PSA_ACCEL_HASH)
|
||||
status = mbedtls_transparent_test_driver_hash_setup( &operation->ctx.test_ctx, alg );
|
||||
status = mbedtls_transparent_test_driver_hash_setup(
|
||||
&operation->ctx.test_driver_ctx, alg );
|
||||
if( status == PSA_SUCCESS )
|
||||
operation->id = PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID;
|
||||
|
||||
|
@ -1151,8 +1152,9 @@ psa_status_t psa_driver_wrapper_hash_clone(
|
|||
#if defined(PSA_CRYPTO_DRIVER_TEST) && defined(MBEDTLS_PSA_ACCEL_HASH)
|
||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||
target_operation->id = PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID;
|
||||
return( mbedtls_transparent_test_driver_hash_clone( &source_operation->ctx.test_ctx,
|
||||
&target_operation->ctx.test_ctx ) );
|
||||
return( mbedtls_transparent_test_driver_hash_clone(
|
||||
&source_operation->ctx.test_driver_ctx,
|
||||
&target_operation->ctx.test_driver_ctx ) );
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_HASH)
|
||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||
|
@ -1176,8 +1178,9 @@ psa_status_t psa_driver_wrapper_hash_update(
|
|||
{
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST) && defined(MBEDTLS_PSA_ACCEL_HASH)
|
||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||
return( mbedtls_transparent_test_driver_hash_update( &operation->ctx.test_ctx,
|
||||
input, input_length ) );
|
||||
return( mbedtls_transparent_test_driver_hash_update(
|
||||
&operation->ctx.test_driver_ctx,
|
||||
input, input_length ) );
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_HASH)
|
||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||
|
@ -1202,8 +1205,9 @@ psa_status_t psa_driver_wrapper_hash_finish(
|
|||
{
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST) && defined(MBEDTLS_PSA_ACCEL_HASH)
|
||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||
return( mbedtls_transparent_test_driver_hash_finish( &operation->ctx.test_ctx,
|
||||
hash, hash_size, hash_length ) );
|
||||
return( mbedtls_transparent_test_driver_hash_finish(
|
||||
&operation->ctx.test_driver_ctx,
|
||||
hash, hash_size, hash_length ) );
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_HASH)
|
||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||
|
@ -1227,7 +1231,8 @@ psa_status_t psa_driver_wrapper_hash_abort(
|
|||
{
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST) && defined(MBEDTLS_PSA_ACCEL_HASH)
|
||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||
return( mbedtls_transparent_test_driver_hash_abort( &operation->ctx.test_ctx ) );
|
||||
return( mbedtls_transparent_test_driver_hash_abort(
|
||||
&operation->ctx.test_driver_ctx ) );
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_HASH)
|
||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||
|
|
|
@ -670,7 +670,7 @@ psa_status_t mbedtls_transparent_test_driver_hash_setup(
|
|||
psa_algorithm_t alg )
|
||||
{
|
||||
if( is_hash_accelerated( alg ) == PSA_SUCCESS )
|
||||
return( hash_setup( &operation->operation, alg ) );
|
||||
return( hash_setup( operation, alg ) );
|
||||
else
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
@ -679,9 +679,8 @@ psa_status_t mbedtls_transparent_test_driver_hash_clone(
|
|||
const mbedtls_transparent_test_driver_hash_operation_t *source_operation,
|
||||
mbedtls_transparent_test_driver_hash_operation_t *target_operation )
|
||||
{
|
||||
if( is_hash_accelerated( source_operation->operation.alg ) == PSA_SUCCESS )
|
||||
return( hash_clone( &source_operation->operation,
|
||||
&target_operation->operation ) );
|
||||
if( is_hash_accelerated( source_operation->alg ) == PSA_SUCCESS )
|
||||
return( hash_clone( source_operation, target_operation ) );
|
||||
else
|
||||
return( PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
|
@ -691,9 +690,8 @@ psa_status_t mbedtls_transparent_test_driver_hash_update(
|
|||
const uint8_t *input,
|
||||
size_t input_length )
|
||||
{
|
||||
if( is_hash_accelerated( operation->operation.alg ) == PSA_SUCCESS )
|
||||
return( hash_update( &operation->operation,
|
||||
input, input_length ) );
|
||||
if( is_hash_accelerated( operation->alg ) == PSA_SUCCESS )
|
||||
return( hash_update( operation, input, input_length ) );
|
||||
else
|
||||
return( PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
|
@ -704,9 +702,8 @@ psa_status_t mbedtls_transparent_test_driver_hash_finish(
|
|||
size_t hash_size,
|
||||
size_t *hash_length )
|
||||
{
|
||||
if( is_hash_accelerated( operation->operation.alg ) == PSA_SUCCESS )
|
||||
return( hash_finish( &operation->operation,
|
||||
hash, hash_size, hash_length ) );
|
||||
if( is_hash_accelerated( operation->alg ) == PSA_SUCCESS )
|
||||
return( hash_finish( operation, hash, hash_size, hash_length ) );
|
||||
else
|
||||
return( PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
|
@ -714,7 +711,7 @@ psa_status_t mbedtls_transparent_test_driver_hash_finish(
|
|||
psa_status_t mbedtls_transparent_test_driver_hash_abort(
|
||||
mbedtls_transparent_test_driver_hash_operation_t *operation )
|
||||
{
|
||||
return( hash_abort( &operation->operation ) );
|
||||
return( hash_abort( operation ) );
|
||||
}
|
||||
|
||||
#endif /* INCLUDE_HASH_TEST_DRIVER */
|
||||
|
|
Loading…
Reference in a new issue