Add One-Shot Hash setup test
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
parent
9b545c04f7
commit
edb20865c7
1 changed files with 13 additions and 0 deletions
|
@ -1803,12 +1803,24 @@ void hash_setup( int alg_arg,
|
|||
int expected_status_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_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
|
||||
psa_status_t status;
|
||||
|
||||
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 );
|
||||
TEST_EQUAL( status, expected_status );
|
||||
|
||||
|
@ -1827,6 +1839,7 @@ void hash_setup( int alg_arg,
|
|||
#endif
|
||||
|
||||
exit:
|
||||
mbedtls_free( output );
|
||||
PSA_DONE( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
|
Loading…
Reference in a new issue