Add hash test for multipart operation
Test vectors migrated from mbedTLS
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 4a05adf..f66c37b 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -1776,6 +1776,47 @@
/* END_CASE */
/* BEGIN_CASE */
+void hash_multi_part( int alg_arg, data_t *input, data_t *expected_hash )
+{
+ psa_algorithm_t alg = alg_arg;
+ unsigned char actual_hash[PSA_HASH_MAX_SIZE] = { 0 };
+ size_t actual_hash_length;
+ psa_hash_operation_t operation;
+ uint32_t halfway;
+
+ TEST_ASSERT( expected_hash->len == PSA_HASH_SIZE( alg ) );
+ TEST_ASSERT( expected_hash->len <= PSA_HASH_MAX_SIZE );
+
+ TEST_ASSERT( input != NULL );
+ TEST_ASSERT( expected_hash != NULL );
+ TEST_ASSERT( PSA_CRYPTO_TEST_SIZE_T_RANGE( input->len ) );
+ TEST_ASSERT( PSA_CRYPTO_TEST_SIZE_T_RANGE( expected_hash->len ) );
+
+ TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
+
+ TEST_ASSERT( psa_hash_setup( &operation, alg ) == PSA_SUCCESS );
+
+ halfway = input->len / 2;
+ TEST_ASSERT( psa_hash_update( &operation,
+ input->x,
+ halfway ) == PSA_SUCCESS );
+ TEST_ASSERT( psa_hash_update( &operation,
+ input->x + halfway,
+ input->len - halfway ) == PSA_SUCCESS );
+
+ TEST_ASSERT( psa_hash_finish( &operation,
+ actual_hash, sizeof( actual_hash ),
+ &actual_hash_length ) == PSA_SUCCESS );
+
+ ASSERT_COMPARE( expected_hash->x, expected_hash->len,
+ actual_hash, actual_hash_length );
+
+exit:
+ mbedtls_psa_crypto_free( );
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
void mac_verify( int key_type_arg,
data_t *key,
int alg_arg,