diff --git a/api-tests/dev_apis/crypto/test_c071/test_c071.c b/api-tests/dev_apis/crypto/test_c071/test_c071.c index 87892602..baeb79d7 100644 --- a/api-tests/dev_apis/crypto/test_c071/test_c071.c +++ b/api-tests/dev_apis/crypto/test_c071/test_c071.c @@ -121,12 +121,14 @@ int32_t psa_pake_set_user_test(caller_security_t caller __UNUSED) &operation); TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8)); - /* Expect a bad state when psa_pake_set_user is called on aborted inactive operation object */ - status = val->crypto_function(VAL_CRYPTO_PAKE_SET_USER, - &operation, - check1[i].user_id, - check1[i].user_id_len); - TEST_ASSERT_EQUAL(status, PSA_ERROR_BAD_STATE, TEST_CHECKPOINT_NUM(9)); + /* Expect a bad state when psa_pake_set_user is called on aborted inactive operation object */ + if (check1[i].expected_status == PSA_SUCCESS) { + status = val->crypto_function(VAL_CRYPTO_PAKE_SET_USER, + &operation, + check1[i].user_id, + check1[i].user_id_len); + TEST_ASSERT_EQUAL(status, PSA_ERROR_BAD_STATE, TEST_CHECKPOINT_NUM(9)); + } } return VAL_STATUS_SUCCESS; diff --git a/api-tests/dev_apis/crypto/test_c072/test_c072.c b/api-tests/dev_apis/crypto/test_c072/test_c072.c index 52ffacf5..a276b15c 100644 --- a/api-tests/dev_apis/crypto/test_c072/test_c072.c +++ b/api-tests/dev_apis/crypto/test_c072/test_c072.c @@ -129,12 +129,14 @@ int32_t psa_pake_set_peer_test(caller_security_t caller __UNUSED) &operation); TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9)); - /* Expect a bad state when psa_pake_set_peer is called on aborted inactive operation object */ - status = val->crypto_function(VAL_CRYPTO_PAKE_SET_PEER, - &operation, - check1[i].peer_id, - check1[i].peer_id_len); - TEST_ASSERT_EQUAL(status, PSA_ERROR_BAD_STATE, TEST_CHECKPOINT_NUM(10)); + /* Expect a bad state when psa_pake_set_peer is called on aborted inactive operation object */ + if (check1[i].expected_status == PSA_SUCCESS) { + status = val->crypto_function(VAL_CRYPTO_PAKE_SET_PEER, + &operation, + check1[i].peer_id, + check1[i].peer_id_len); + TEST_ASSERT_EQUAL(status, PSA_ERROR_BAD_STATE, TEST_CHECKPOINT_NUM(10)); + } } return VAL_STATUS_SUCCESS; } diff --git a/api-tests/dev_apis/crypto/test_c073/test_c073.c b/api-tests/dev_apis/crypto/test_c073/test_c073.c index 51f26700..44030902 100644 --- a/api-tests/dev_apis/crypto/test_c073/test_c073.c +++ b/api-tests/dev_apis/crypto/test_c073/test_c073.c @@ -136,12 +136,14 @@ int32_t psa_pake_set_context_test(caller_security_t caller __UNUSED) &operation); TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10)); - /* Expect a bad state if psa_pake_set_context is called on aborted inactive operation object */ - status = val->crypto_function(VAL_CRYPTO_PAKE_SET_CONTEXT, - &operation, - check1[i].context, - check1[i].context_len); - TEST_ASSERT_EQUAL(status, PSA_ERROR_BAD_STATE, TEST_CHECKPOINT_NUM(11)); + /* Expect a bad state if psa_pake_set_context is called on aborted inactive operation object */ + if (check1[i].expected_status == PSA_SUCCESS) { + status = val->crypto_function(VAL_CRYPTO_PAKE_SET_CONTEXT, + &operation, + check1[i].context, + check1[i].context_len); + TEST_ASSERT_EQUAL(status, PSA_ERROR_BAD_STATE, TEST_CHECKPOINT_NUM(11)); + } } return VAL_STATUS_SUCCESS; } diff --git a/api-tests/dev_apis/crypto/test_c074/test_c074.c b/api-tests/dev_apis/crypto/test_c074/test_c074.c index 4453e9ef..3a63b594 100644 --- a/api-tests/dev_apis/crypto/test_c074/test_c074.c +++ b/api-tests/dev_apis/crypto/test_c074/test_c074.c @@ -391,7 +391,7 @@ int32_t psa_pake_output_test(caller_security_t caller __UNUSED) } - if (PSA_ALG_JPAKE(PSA_ALG_SHA_256)) + if (PSA_ALG_IS_JPAKE (check1[i].alg)) { /* Abort the PAKE operation object */ status = val->crypto_function(VAL_CRYPTO_PAKE_ABORT, &user); diff --git a/api-tests/dev_apis/crypto/test_c076/test_c076.c b/api-tests/dev_apis/crypto/test_c076/test_c076.c index 71f4a010..036cc22e 100644 --- a/api-tests/dev_apis/crypto/test_c076/test_c076.c +++ b/api-tests/dev_apis/crypto/test_c076/test_c076.c @@ -105,6 +105,10 @@ int32_t psa_pake_abort_test(caller_security_t caller __UNUSED) &operation); TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(6)); + /* Destroy the key */ + status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key); + TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7)); + } return VAL_STATUS_SUCCESS; } diff --git a/api-tests/dev_apis/crypto/test_c077/test_c077.c b/api-tests/dev_apis/crypto/test_c077/test_c077.c index aaffab69..82ccad48 100644 --- a/api-tests/dev_apis/crypto/test_c077/test_c077.c +++ b/api-tests/dev_apis/crypto/test_c077/test_c077.c @@ -472,6 +472,12 @@ int32_t psa_pake_get_shared_key_test(caller_security_t caller __UNUSED) TEST_ASSERT_DUAL(status, check1[i].expected_status[0], check1[i].expected_status[1], TEST_CHECKPOINT_NUM(12)); + if (status == PSA_SUCCESS) { + /* Destroy the key */ + status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, shared_key); + TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(14)); + } + status = val->crypto_function(VAL_CRYPTO_PAKE_GET_SHARED_KEY, &server, &attributes, &shared_key); TEST_ASSERT_DUAL(status, check1[i].expected_status[0],