mirror of https://github.com/ARMmbed/mbed-os.git
parent
51b76350d9
commit
cae1ebf33d
|
@ -92,3 +92,16 @@ psa_its_status_t psa_its_remove(psa_its_uid_t uid)
|
|||
|
||||
return psa_its_remove_impl(PSA_ITS_EMUL_PID, uid);
|
||||
}
|
||||
|
||||
extern "C" psa_its_status_t psa_its_reset()
|
||||
{
|
||||
// KVStore initiation:
|
||||
// - In EMUL (non-secure single core) we do it here since we don't have another context to do it inside.
|
||||
// - Repeating calls has no effect
|
||||
int kv_status = kv_init_storage_config();
|
||||
if (kv_status != MBED_SUCCESS) {
|
||||
return PSA_ITS_ERROR_STORAGE_FAILURE;
|
||||
}
|
||||
|
||||
return psa_its_reset_impl();
|
||||
}
|
||||
|
|
|
@ -307,6 +307,16 @@ psa_its_status_t psa_its_remove_impl(int32_t pid, psa_its_uid_t uid)
|
|||
return convert_status(status);
|
||||
}
|
||||
|
||||
psa_its_status_t psa_its_reset_impl()
|
||||
{
|
||||
if (!kvstore) {
|
||||
its_init();
|
||||
}
|
||||
|
||||
int status = kvstore->reset();
|
||||
return convert_status(status);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -33,6 +33,7 @@ psa_its_status_t psa_its_set_impl(int32_t pid, psa_its_uid_t uid, uint32_t data_
|
|||
psa_its_status_t psa_its_get_impl(int32_t pid, psa_its_uid_t uid, uint32_t data_offset, uint32_t data_length, void *p_data);
|
||||
psa_its_status_t psa_its_get_info_impl(int32_t pid, psa_its_uid_t uid, struct psa_its_info_t *p_info);
|
||||
psa_its_status_t psa_its_remove_impl(int32_t pid, psa_its_uid_t uid);
|
||||
psa_its_status_t psa_its_reset_impl();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -114,3 +114,19 @@ psa_its_status_t psa_its_remove(psa_its_uid_t uid)
|
|||
psa_close(conn);
|
||||
return status;
|
||||
}
|
||||
|
||||
psa_its_status_t psa_its_reset()
|
||||
{
|
||||
psa_handle_t conn = psa_connect(PSA_ITS_RESET, 1);
|
||||
if (conn <= PSA_NULL_HANDLE) {
|
||||
return PSA_ITS_ERROR_STORAGE_FAILURE;
|
||||
}
|
||||
|
||||
psa_status_t status = psa_call(conn, NULL, 0, NULL, 0);
|
||||
if (status == PSA_DROP_CONNECTION) {
|
||||
status = PSA_ITS_ERROR_STORAGE_FAILURE;
|
||||
}
|
||||
|
||||
psa_close(conn);
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -135,6 +135,12 @@ static psa_status_t storage_remove(psa_msg_t *msg)
|
|||
return psa_its_remove_impl(psa_identity(msg->handle), key);
|
||||
}
|
||||
|
||||
static psa_status_t storage_reset(psa_msg_t *msg)
|
||||
{
|
||||
(void)msg;
|
||||
return psa_its_reset_impl();
|
||||
}
|
||||
|
||||
static void message_handler(psa_msg_t *msg, SignalHandler handler)
|
||||
{
|
||||
psa_status_t status = PSA_SUCCESS;
|
||||
|
@ -187,6 +193,10 @@ void pits_entry(void *ptr)
|
|||
psa_get(PSA_ITS_REMOVE_MSK, &msg);
|
||||
message_handler(&msg, storage_remove);
|
||||
}
|
||||
if ((signals & PSA_ITS_RESET_MSK) != 0) {
|
||||
psa_get(PSA_ITS_RESET_MSK, &msg);
|
||||
message_handler(&msg, storage_reset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,14 @@
|
|||
"non_secure_clients": true,
|
||||
"minor_version": 1,
|
||||
"minor_policy": "RELAXED"
|
||||
},
|
||||
{
|
||||
"name": "PSA_ITS_RESET",
|
||||
"identifier": "0x00011A04",
|
||||
"signal": "PSA_ITS_RESET_MSK",
|
||||
"non_secure_clients": false,
|
||||
"minor_version": 1,
|
||||
"minor_policy": "RELAXED"
|
||||
}
|
||||
],
|
||||
"source_files": [
|
||||
|
|
Loading…
Reference in New Issue