Ensure ops are tested on successful 'fail' tests

Make sure the number of ops is tested in the interruptible failure tests,
should they get through the interruptible loop part.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
Paul Elliott 2023-01-20 17:29:41 +00:00
parent edfc883568
commit 334d726d40

View file

@ -6642,13 +6642,8 @@ void sign_hash_fail_interruptible(int key_type_arg, data_t *key_data,
num_completes++;
/* If the psa_sign_hash_start() failed, psa_sign_hash_complete()
* should also fail with bad state. */
if (expected_start_status != PSA_SUCCESS) {
TEST_EQUAL(actual_status, PSA_ERROR_BAD_STATE);
} else if (actual_status != PSA_OPERATION_INCOMPLETE) {
TEST_EQUAL(actual_status, expected_complete_status);
} else {
if (actual_status == PSA_SUCCESS ||
actual_status == PSA_OPERATION_INCOMPLETE) {
num_ops = psa_sign_hash_get_num_ops(&operation);
TEST_ASSERT(num_ops > num_ops_prior);
@ -6656,6 +6651,14 @@ void sign_hash_fail_interruptible(int key_type_arg, data_t *key_data,
}
} while (actual_status == PSA_OPERATION_INCOMPLETE);
/* If the psa_sign_hash_start() failed, psa_sign_hash_complete()
* should also fail with bad state. */
if (expected_start_status != PSA_SUCCESS) {
TEST_EQUAL(actual_status, PSA_ERROR_BAD_STATE);
} else if (actual_status != PSA_OPERATION_INCOMPLETE) {
TEST_EQUAL(actual_status, expected_complete_status);
}
PSA_ASSERT(psa_sign_hash_abort(&operation));
num_ops = psa_sign_hash_get_num_ops(&operation);
@ -7067,13 +7070,8 @@ void verify_hash_fail_interruptible(int key_type_arg, data_t *key_data,
num_completes++;
/* If the psa_verify_hash_start() failed,
* psa_verify_hash_complete() should also fail with bad state.*/
if (expected_start_status != PSA_SUCCESS) {
TEST_EQUAL(actual_status, PSA_ERROR_BAD_STATE);
} else if (actual_status != PSA_OPERATION_INCOMPLETE) {
TEST_EQUAL(actual_status, expected_complete_status);
} else {
if (actual_status == PSA_SUCCESS ||
actual_status == PSA_OPERATION_INCOMPLETE) {
num_ops = psa_verify_hash_get_num_ops(&operation);
TEST_ASSERT(num_ops > num_ops_prior);
@ -7081,6 +7079,14 @@ void verify_hash_fail_interruptible(int key_type_arg, data_t *key_data,
}
} while (actual_status == PSA_OPERATION_INCOMPLETE);
/* If the psa_verify_hash_start() failed,
* psa_verify_hash_complete() should also fail with bad state.*/
if (expected_start_status != PSA_SUCCESS) {
TEST_EQUAL(actual_status, PSA_ERROR_BAD_STATE);
} else if (actual_status != PSA_OPERATION_INCOMPLETE) {
TEST_EQUAL(actual_status, expected_complete_status);
}
TEST_LE_U(min_completes, num_completes);
TEST_LE_U(num_completes, max_completes);