tests: driver wrappers: Specialize hash multi-part test on setup only
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/tests/suites/test_suite_psa_crypto_driver_wrappers.data b/tests/suites/test_suite_psa_crypto_driver_wrappers.data
index 0e62d18..cc892de 100644
--- a/tests/suites/test_suite_psa_crypto_driver_wrappers.data
+++ b/tests/suites/test_suite_psa_crypto_driver_wrappers.data
@@ -283,20 +283,20 @@
Hash compute: SHA-256, INSUFFICIENT_MEMORY
hash_compute:PSA_ALG_SHA_256:"b0bd69":"4096804221093ddccfbf46831490ea63e9e99414858f8d75ff7f642c7ca61803":PSA_ERROR_INSUFFICIENT_MEMORY:PSA_ERROR_INSUFFICIENT_MEMORY
-Hash multi-part: SHA-256, computed by the driver
+Hash multi-part setup: SHA-256, computed by the driver
depends_on:MBEDTLS_PSA_ACCEL_ALG_SHA_256
-hash_multipart:PSA_ALG_SHA_256:"b0bd69":"4096804221093ddccfbf46831490ea63e9e99414858f8d75ff7f642c7ca61803":PSA_SUCCESS:PSA_SUCCESS
+hash_multipart_setup:PSA_ALG_SHA_256:"b0bd69":"4096804221093ddccfbf46831490ea63e9e99414858f8d75ff7f642c7ca61803":PSA_SUCCESS:PSA_SUCCESS
-Hash multi-part: SHA-256, fallback
+Hash multi-part setup: SHA-256, fallback
depends_on:MBEDTLS_PSA_BUILTIN_ALG_SHA_256
-hash_multipart:PSA_ALG_SHA_256:"b0bd69":"4096804221093ddccfbf46831490ea63e9e99414858f8d75ff7f642c7ca61803":PSA_ERROR_NOT_SUPPORTED:PSA_SUCCESS
+hash_multipart_setup:PSA_ALG_SHA_256:"b0bd69":"4096804221093ddccfbf46831490ea63e9e99414858f8d75ff7f642c7ca61803":PSA_ERROR_NOT_SUPPORTED:PSA_SUCCESS
-Hash multi-part: SHA-256, no fallback
+Hash multi-part setup: SHA-256, no fallback
depends_on:!MBEDTLS_PSA_BUILTIN_ALG_SHA_256
-hash_multipart:PSA_ALG_SHA_256:"b0bd69":"4096804221093ddccfbf46831490ea63e9e99414858f8d75ff7f642c7ca61803":PSA_ERROR_NOT_SUPPORTED:PSA_ERROR_NOT_SUPPORTED
+hash_multipart_setup:PSA_ALG_SHA_256:"b0bd69":"4096804221093ddccfbf46831490ea63e9e99414858f8d75ff7f642c7ca61803":PSA_ERROR_NOT_SUPPORTED:PSA_ERROR_NOT_SUPPORTED
-Hash multi-part: SHA-256, INSUFFICIENT_MEMORY
-hash_compute:PSA_ALG_SHA_256:"b0bd69":"4096804221093ddccfbf46831490ea63e9e99414858f8d75ff7f642c7ca61803":PSA_ERROR_INSUFFICIENT_MEMORY:PSA_ERROR_INSUFFICIENT_MEMORY
+Hash multi-part setup: SHA-256, INSUFFICIENT_MEMORY
+hash_multipart_setup:PSA_ALG_SHA_256:"b0bd69":"4096804221093ddccfbf46831490ea63e9e99414858f8d75ff7f642c7ca61803":PSA_ERROR_INSUFFICIENT_MEMORY:PSA_ERROR_INSUFFICIENT_MEMORY
Hash clone: SHA-256, clone successful
depends_on:MBEDTLS_PSA_ACCEL_ALG_SHA_256
diff --git a/tests/suites/test_suite_psa_crypto_driver_wrappers.function b/tests/suites/test_suite_psa_crypto_driver_wrappers.function
index 3547b1d..b2a5b4d 100644
--- a/tests/suites/test_suite_psa_crypto_driver_wrappers.function
+++ b/tests/suites/test_suite_psa_crypto_driver_wrappers.function
@@ -1104,10 +1104,10 @@
/* END_CASE */
/* BEGIN_CASE */
-void hash_multipart( int alg_arg,
- data_t *input, data_t *hash,
- int forced_status_arg,
- int expected_status_arg )
+void hash_multipart_setup( int alg_arg,
+ data_t *input, data_t *hash,
+ int forced_status_arg,
+ int expected_status_arg )
{
psa_algorithm_t alg = alg_arg;
psa_status_t forced_status = forced_status_arg;
@@ -1121,9 +1121,6 @@
PSA_ASSERT( psa_crypto_init( ) );
- /*
- * Case 1: Force the driver return status for setup.
- */
mbedtls_test_driver_hash_hooks.forced_status = forced_status;
TEST_EQUAL( psa_hash_setup( &operation, alg ), expected_status );
TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 1 );
@@ -1146,56 +1143,6 @@
ASSERT_COMPARE( output, output_length, hash->x, hash->len );
}
- /*
- * Case 2: Force the driver return status for update.
- */
- mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
- PSA_ASSERT( psa_hash_setup( &operation, alg ) );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 1 );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS );
-
- mbedtls_test_driver_hash_hooks.forced_status = forced_status;
- TEST_EQUAL( psa_hash_update( &operation, input->x, input->len ),
- forced_status );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits,
- forced_status != PSA_SUCCESS ? 3 : 2 );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, forced_status );
-
- if( forced_status == PSA_SUCCESS )
- {
- PSA_ASSERT( psa_hash_finish( &operation,
- output, PSA_HASH_LENGTH( alg ),
- &output_length ) );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 4 );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, forced_status );
-
- ASSERT_COMPARE( output, output_length, hash->x, hash->len );
- }
-
- /*
- * Case 3: Force the driver return status for finish.
- */
- mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
- PSA_ASSERT( psa_hash_setup( &operation, alg ) );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 1 );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS );
-
- PSA_ASSERT( psa_hash_update( &operation, input->x, input->len ) );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 2 );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS );
-
- mbedtls_test_driver_hash_hooks.forced_status = forced_status;
- TEST_EQUAL( psa_hash_finish( &operation,
- output, PSA_HASH_LENGTH( alg ),
- &output_length ), forced_status );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 4 );
- TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, forced_status );
-
- if( forced_status == PSA_SUCCESS )
- {
- ASSERT_COMPARE( output, output_length, hash->x, hash->len );
- }
-
exit:
psa_hash_abort( &operation );
mbedtls_free( output );