@@ -89,6 +89,14 @@ void test_open_other_partition_key(void)
89
89
90
90
/* try to open the key created by the test partition */
91
91
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));
92
100
}
93
101
94
102
void test_create_key_same_id_different_partitions (void )
@@ -158,11 +166,11 @@ void test_create_key_same_id_different_partitions(void)
158
166
TEST_ASSERT_EQUAL (key_usage_local, policy.usage );
159
167
TEST_ASSERT_EQUAL (key_alg, policy.alg );
160
168
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));
163
171
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));
166
174
}
167
175
168
176
void test_use_other_partition_key_manage_key (void )
@@ -235,8 +243,8 @@ void test_use_other_partition_key_manage_key(void)
235
243
/* via test partition - import key data for the key created by the test partition */
236
244
TEST_ASSERT_EQUAL (PSA_SUCCESS, test_partition_crypto_import_key (key_handle, key_type, key_data, sizeof (key_data)));
237
245
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));
240
248
}
241
249
242
250
void test_use_other_partition_key_mac (void )
@@ -266,8 +274,8 @@ void test_use_other_partition_key_mac(void)
266
274
operation = psa_mac_operation_init ();
267
275
TEST_ASSERT_EQUAL (PSA_ERROR_INVALID_HANDLE, psa_mac_verify_setup (&operation, key_handle, key_alg));
268
276
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));
271
279
}
272
280
273
281
void test_use_other_partition_key_cipher (void )
@@ -297,8 +305,8 @@ void test_use_other_partition_key_cipher(void)
297
305
operation = psa_cipher_operation_init ();
298
306
TEST_ASSERT_EQUAL (PSA_ERROR_INVALID_HANDLE, psa_cipher_decrypt_setup (&operation, key_handle, key_alg));
299
307
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));
302
310
}
303
311
304
312
void test_use_other_partition_key_aead (void )
@@ -333,8 +341,8 @@ void test_use_other_partition_key_aead(void)
333
341
cipher_text, sizeof (cipher_text),
334
342
plain_text, sizeof (plain_text), &len));
335
343
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));
338
346
}
339
347
340
348
void test_use_other_partition_key_asymmetric_sign_verify (void )
@@ -366,8 +374,8 @@ void test_use_other_partition_key_asymmetric_sign_verify(void)
366
374
TEST_ASSERT_EQUAL (PSA_ERROR_INVALID_HANDLE, psa_asymmetric_verify (key_handle, key_alg, input, sizeof (input),
367
375
signature, sizeof (signature)));
368
376
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));
371
379
}
372
380
373
381
void test_use_other_partition_key_asymmetric_encrypt_decrypt (void )
@@ -438,8 +446,8 @@ void test_use_other_partition_key_asymmetric_encrypt_decrypt(void)
438
446
encrypted, sizeof (encrypted), NULL , 0 ,
439
447
decrypted, sizeof (decrypted), &len));
440
448
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));
443
451
}
444
452
445
453
void test_use_other_partition_key_derivation_setup (void )
0 commit comments