Add testing valid attributes after aborting an invalid input in iop key generation
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
diff --git a/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function b/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function
index 4cd4eae..9dc68b5 100644
--- a/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function
+++ b/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function
@@ -10146,9 +10146,21 @@
PSA_ASSERT(psa_generate_key_iop_abort(&operation));
+#if defined(MBEDTLS_ECP_RESTARTABLE)
+ /* In case the expected status is a failure test a valid input will succeed after abort */
+ if (expected_status != PSA_SUCCESS) {
+ memset(&attributes, 0, sizeof(attributes));
+ psa_set_key_type(&attributes, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
+ psa_set_key_bits(&attributes, 256);
+ psa_set_key_usage_flags(&attributes,
+ PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_SIGN_HASH |
+ PSA_KEY_USAGE_VERIFY_HASH);
+ psa_set_key_algorithm(&attributes, PSA_ALG_ECDSA_ANY);
+ }
/* Test that after calling abort operation is reset to it's fresh state */
status = psa_generate_key_iop_setup(&operation, &attributes);
- TEST_EQUAL(status, expected_status);
+ TEST_EQUAL(status, PSA_SUCCESS);
+#endif
exit:
psa_generate_key_iop_abort(&operation);