Add {sign/verify}_hash_abort_internal
Ensure that num_ops is cleared when manual abort is called, but obviously not
when an operation just completes, and test this.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 6860f7f..21965cf 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -6522,6 +6522,9 @@
PSA_ASSERT(psa_sign_hash_abort(&operation));
+ num_ops = psa_sign_hash_get_num_ops(&operation);
+ TEST_ASSERT(num_ops == 0);
+
exit:
/*
@@ -6657,6 +6660,9 @@
PSA_ASSERT(psa_sign_hash_abort(&operation));
+ num_ops = psa_sign_hash_get_num_ops(&operation);
+ TEST_ASSERT(num_ops == 0);
+
/* The value of *signature_length is unspecified on error, but
* whatever it is, it should be less than signature_size, so that
* if the caller tries to read *signature_length bytes without
@@ -6969,6 +6975,9 @@
PSA_ASSERT(psa_verify_hash_abort(&operation));
+ num_ops = psa_verify_hash_get_num_ops(&operation);
+ TEST_ASSERT(num_ops == 0);
+
exit:
psa_reset_key_attributes(&attributes);
psa_destroy_key(key);
@@ -7084,6 +7093,9 @@
PSA_ASSERT(psa_verify_hash_abort(&operation));
+ num_ops = psa_verify_hash_get_num_ops(&operation);
+ TEST_ASSERT(num_ops == 0);
+
exit:
psa_reset_key_attributes(&attributes);
psa_destroy_key(key);