22
22
23
23
#if defined(ATCA_HAL_I2C )
24
24
#include "psa/crypto.h"
25
+ #include "psa/lifecycle.h"
25
26
#include "atecc608a_se.h"
26
27
#include "atecc608a_utils.h"
27
28
#include "atca_helpers.h"
28
29
#include "atecc508a_config_dev.h"
29
- #include "psa_crypto_storage.h"
30
30
/** This macro checks if the result of an `expression` is equal to an
31
31
* `expected` value and sets a `status` variable of type `psa_status_t` to
32
32
* `PSA_SUCCESS`. If they are not equal, the `status` is set to
76
76
"the slot now behaves according to the policies set by the associated\n"\
77
77
"configuration zone’s values. [y/n]: "
78
78
79
- static void psa_purge_keys (void )
80
- {
81
- psa_key_id_t id ;
82
- printf ("Clearing persistent key data\n" );
83
- /* Clear slots 0-15 of persistent storage. These numbers are equal to
84
- * physical slots available on the device. */
85
- for (id = 0 ; id < 16 ; id ++ ) {
86
- psa_destroy_persistent_key (id );
87
- }
88
- /* Purge the transaction file. */
89
- psa_crypto_stop_transaction ();
90
- }
91
-
92
79
/* Data used by tests */
93
80
psa_key_slot_number_t atecc608a_private_key_slot = 1 ;
94
81
psa_key_slot_number_t atecc608a_public_key_slot = 9 ;
@@ -370,7 +357,7 @@ psa_status_t run_tests()
370
357
psa_key_attributes_t private_key_attributes = PSA_KEY_ATTRIBUTES_INIT ;
371
358
psa_key_handle_t private_handle ;
372
359
373
- psa_purge_keys ( );
360
+ mbed_psa_reboot_and_request_new_security_state ( PSA_LIFECYCLE_ASSEMBLY_AND_TEST );
374
361
375
362
setup_key_attributes (& public_key_attributes ,
376
363
atecc608a_public_key_slot , 0 );
@@ -391,7 +378,7 @@ psa_status_t run_tests()
391
378
392
379
/* Purge, so that we can test driver behaviour with a key that is registered,
393
380
* not generated. */
394
- psa_purge_keys ( );
381
+ mbed_psa_reboot_and_request_new_security_state ( PSA_LIFECYCLE_ASSEMBLY_AND_TEST );
395
382
ASSERT_SUCCESS_PSA (mbedtls_psa_register_se_key (& private_key_attributes ));
396
383
397
384
ASSERT_SUCCESS_PSA (test_export_import (& private_handle ,
@@ -604,7 +591,7 @@ int main(void)
604
591
bool exit_application = false;
605
592
606
593
print_device_info ();
607
- psa_destroy_se_persistent_data ( PSA_ATECC608A_LIFETIME );
594
+ mbed_psa_reboot_and_request_new_security_state ( PSA_LIFECYCLE_ASSEMBLY_AND_TEST );
608
595
ASSERT_SUCCESS_PSA (psa_register_se_driver (PSA_ATECC608A_LIFETIME , & atecc608a_drv_info ));
609
596
610
597
ASSERT_SUCCESS_PSA (psa_crypto_init ());
0 commit comments