Add Multipart Hash Compare fail tests
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
parent
161ec5c368
commit
55a1be1f48
1 changed files with 24 additions and 0 deletions
|
@ -1904,15 +1904,39 @@ void hash_compare_fail( int alg_arg, data_t *input,
|
|||
{
|
||||
psa_algorithm_t alg = alg_arg;
|
||||
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 Compare, one-shot */
|
||||
status = psa_hash_compare( alg, input->x, input->len,
|
||||
reference_hash->x, reference_hash->len );
|
||||
TEST_EQUAL( status, expected_status );
|
||||
|
||||
/* Hash Compare, multi-part */
|
||||
status = psa_hash_setup( &operation, alg );
|
||||
if( status == PSA_SUCCESS )
|
||||
{
|
||||
status = psa_hash_update( &operation, input->x, input->len );
|
||||
if( status == PSA_SUCCESS )
|
||||
{
|
||||
status = psa_hash_verify( &operation, reference_hash->x,
|
||||
reference_hash->len );
|
||||
TEST_EQUAL( status, expected_status );
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST_EQUAL( status, expected_status );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST_EQUAL( status, expected_status );
|
||||
}
|
||||
|
||||
exit:
|
||||
PSA_ASSERT( psa_hash_abort( &operation ) );
|
||||
PSA_DONE( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
|
Loading…
Reference in a new issue