Add Multipart Hash Compare fail tests
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 79235d7..c3bd487 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -1904,15 +1904,39 @@
{
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 */