mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-06-02 10:43:10 +08:00
Add One-Shot Hash setup test
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
parent
9b545c04f7
commit
edb20865c7
@ -1803,12 +1803,24 @@ void hash_setup( int alg_arg,
|
|||||||
int expected_status_arg )
|
int expected_status_arg )
|
||||||
{
|
{
|
||||||
psa_algorithm_t alg = alg_arg;
|
psa_algorithm_t alg = alg_arg;
|
||||||
|
uint8_t *output = NULL;
|
||||||
|
size_t output_size = 0;
|
||||||
|
size_t output_length = 0;
|
||||||
psa_status_t expected_status = expected_status_arg;
|
psa_status_t expected_status = expected_status_arg;
|
||||||
psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
|
psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
|
||||||
psa_status_t status;
|
psa_status_t status;
|
||||||
|
|
||||||
PSA_ASSERT( psa_crypto_init( ) );
|
PSA_ASSERT( psa_crypto_init( ) );
|
||||||
|
|
||||||
|
/* Hash Setup, one-shot */
|
||||||
|
output_size = PSA_HASH_LENGTH(alg);
|
||||||
|
ASSERT_ALLOC( output, output_size );
|
||||||
|
|
||||||
|
status = psa_hash_compute( alg, NULL, 0,
|
||||||
|
output, output_size, &output_length );
|
||||||
|
TEST_EQUAL( status, expected_status );
|
||||||
|
|
||||||
|
/* Hash Setup, multi-part */
|
||||||
status = psa_hash_setup( &operation, alg );
|
status = psa_hash_setup( &operation, alg );
|
||||||
TEST_EQUAL( status, expected_status );
|
TEST_EQUAL( status, expected_status );
|
||||||
|
|
||||||
@ -1827,6 +1839,7 @@ void hash_setup( int alg_arg,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
mbedtls_free( output );
|
||||||
PSA_DONE( );
|
PSA_DONE( );
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user