@@ -89,6 +89,14 @@ void test_open_other_partition_key(void)
8989
9090 /* try to open the key created by the test partition */
9191 TEST_ASSERT_EQUAL (PSA_ERROR_DOES_NOT_EXIST, psa_open_key (PSA_KEY_LIFETIME_PERSISTENT, key_id, &key_handle));
92+
93+ /* via test partition - reopen the key created by the test partition and keep it open */
94+ key_handle = 0 ;
95+ TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_open_persistent_key (key_id, &key_handle));
96+ TEST_ASSERT_NOT_EQUAL (0 , key_handle);
97+
98+ /* via test partition - destroy the key created by the test partition */
99+ TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_destroy_key (key_handle));
92100}
93101
94102void test_create_key_same_id_different_partitions (void )
@@ -158,11 +166,11 @@ void test_create_key_same_id_different_partitions(void)
158166 TEST_ASSERT_EQUAL (key_usage_local, policy.usage );
159167 TEST_ASSERT_EQUAL (key_alg, policy.alg );
160168
161- /* via test partition - close the key created by the test partition */
162- TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_close_key (key_handle_remote));
169+ /* via test partition - destroy the key created by the test partition */
170+ TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_destroy_key (key_handle_remote));
163171
164- /* close the key created by the current partition (NSPE) */
165- TEST_ASSERT_EQUAL (PSA_SUCCESS, psa_close_key (key_handle_local));
172+ /* destroy the key created by the current partition (NSPE) */
173+ TEST_ASSERT_EQUAL (PSA_SUCCESS, psa_destroy_key (key_handle_local));
166174}
167175
168176void test_use_other_partition_key_manage_key (void )
@@ -235,8 +243,8 @@ void test_use_other_partition_key_manage_key(void)
235243 /* via test partition - import key data for the key created by the test partition */
236244 TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_import_key (key_handle, key_type, key_data, sizeof (key_data)));
237245
238- /* via test partition - close the key created by the test partition */
239- TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_close_key (key_handle));
246+ /* via test partition - destroy the key created by the test partition */
247+ TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_destroy_key (key_handle));
240248}
241249
242250void test_use_other_partition_key_mac (void )
@@ -266,8 +274,8 @@ void test_use_other_partition_key_mac(void)
266274 operation = psa_mac_operation_init ();
267275 TEST_ASSERT_EQUAL (PSA_ERROR_INVALID_HANDLE, psa_mac_verify_setup (&operation, key_handle, key_alg));
268276
269- /* via test partition - close the key created by the test partition */
270- TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_close_key (key_handle));
277+ /* via test partition - destroy the key created by the test partition */
278+ TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_destroy_key (key_handle));
271279}
272280
273281void test_use_other_partition_key_cipher (void )
@@ -297,8 +305,8 @@ void test_use_other_partition_key_cipher(void)
297305 operation = psa_cipher_operation_init ();
298306 TEST_ASSERT_EQUAL (PSA_ERROR_INVALID_HANDLE, psa_cipher_decrypt_setup (&operation, key_handle, key_alg));
299307
300- /* via test partition - close the key created by the test partition */
301- TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_close_key (key_handle));
308+ /* via test partition - destroy the key created by the test partition */
309+ TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_destroy_key (key_handle));
302310}
303311
304312void test_use_other_partition_key_aead (void )
@@ -333,8 +341,8 @@ void test_use_other_partition_key_aead(void)
333341 cipher_text, sizeof (cipher_text),
334342 plain_text, sizeof (plain_text), &len));
335343
336- /* via test partition - close the key created by the test partition */
337- TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_close_key (key_handle));
344+ /* via test partition - destroy the key created by the test partition */
345+ TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_destroy_key (key_handle));
338346}
339347
340348void test_use_other_partition_key_asymmetric_sign_verify (void )
@@ -366,8 +374,8 @@ void test_use_other_partition_key_asymmetric_sign_verify(void)
366374 TEST_ASSERT_EQUAL (PSA_ERROR_INVALID_HANDLE, psa_asymmetric_verify (key_handle, key_alg, input, sizeof (input),
367375 signature, sizeof (signature)));
368376
369- /* via test partition - close the key created by the test partition */
370- TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_close_key (key_handle));
377+ /* via test partition - destroy the key created by the test partition */
378+ TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_destroy_key (key_handle));
371379}
372380
373381void test_use_other_partition_key_asymmetric_encrypt_decrypt (void )
@@ -438,8 +446,8 @@ void test_use_other_partition_key_asymmetric_encrypt_decrypt(void)
438446 encrypted, sizeof (encrypted), NULL , 0 ,
439447 decrypted, sizeof (decrypted), &len));
440448
441- /* via test partition - close the key created by the test partition */
442- TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_close_key (key_handle));
449+ /* via test partition - destroy the key created by the test partition */
450+ TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_destroy_key (key_handle));
443451}
444452
445453void test_use_other_partition_key_derivation_setup (void )
0 commit comments