20 #include "flash_layout.h"
31 static bool ps_is_init =
false;
68 if ((in_len != 3) || (out_len != 0)) {
80 p_data = (
void *)in_vec[1].base;
81 data_length = in_vec[1].
len;
96 return tfm_ps_set(client_id, uid, data_length, create_flags);
102 uint32_t data_offset;
107 size_t *p_data_length;
113 if ((in_len != 2) || (out_len != 1)) {
125 if (in_vec[1].len !=
sizeof(data_offset)) {
130 data_offset = *(uint32_t *)in_vec[1].base;
132 p_data = (
void *)out_vec[0].base;
133 data_size = out_vec[0].
len;
134 p_data_length = &out_vec[0].
len;
142 return tfm_ps_get(client_id, uid, data_offset, data_size, p_data_length);
158 if ((in_len != 1) || (out_len != 1)) {
218 uint32_t *support_flags;
226 if ((in_len != 0) || (out_len != 1)) {
231 if (out_vec[0].len !=
sizeof(*support_flags)) {
236 support_flags = (uint32_t *)out_vec[0].base;
262 num =
psa_read(msg.handle, 0, &uid, msg.in_size[0]);
263 if (num != msg.in_size[0]) {
267 num =
psa_read(msg.handle, 2, &create_flags, msg.in_size[2]);
268 if (num != msg.in_size[2]) {
272 return tfm_ps_set(client_id, uid, msg.in_size[1], create_flags);
278 uint32_t data_offset;
280 size_t p_data_length;
283 msg.in_size[1] !=
sizeof(uint32_t)) {
288 num =
psa_read(msg.handle, 0, &uid, msg.in_size[0]);
289 if (num != msg.in_size[0]) {
293 num =
psa_read(msg.handle, 1, &data_offset, msg.in_size[1]);
294 if (num != msg.in_size[1]) {
298 return tfm_ps_get(msg.client_id, uid, data_offset, msg.out_size[0],
316 num =
psa_read(msg.handle, 0, &uid, msg.in_size[0]);
317 if (num != msg.in_size[0]) {
324 psa_write(msg.handle, 0, &info, msg.out_size[0]);
339 num =
psa_read(msg.handle, 0, &uid, msg.in_size[0]);
340 if (num != msg.in_size[0]) {
350 uint32_t support_flags;
352 out_size = msg.out_size[0];
353 if (out_size !=
sizeof(support_flags)) {
359 psa_write(msg.handle, 0, &support_flags, out_size);
367 static void tfm_abort(
void)
373 static void ps_signal_handle(
psa_signal_t signal, ps_func_t pfn)
377 status =
psa_get(signal, &msg);
407 ps_signal_handle(TFM_PS_SET_SIGNAL, tfm_ps_set_ipc);
409 ps_signal_handle(TFM_PS_GET_SIGNAL, tfm_ps_get_ipc);
411 ps_signal_handle(TFM_PS_GET_INFO_SIGNAL, tfm_ps_get_info_ipc);
413 ps_signal_handle(TFM_PS_REMOVE_SIGNAL, tfm_ps_remove_ipc);
415 ps_signal_handle(TFM_PS_GET_SUPPORT_SIGNAL,
416 tfm_ps_get_support_ipc);
435 num =
psa_read(msg.handle, 1, out_data, size);
psa_status_t tfm_ps_get_support_req(psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len)
Handles the get support request.
psa_status_t tfm_ps_req_mngr_init(void)
#define TFM_PS_SET_SIGNAL
psa_status_t tfm_ps_remove_req(psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len)
Handles the remove request.
uint32_t tfm_ps_get_support(void)
Gets a bitmask with flags set for all of the optional features supported by the implementation.
#define TFM_PS_GET_INFO_SIGNAL
size_t psa_read(psa_handle_t msg_handle, uint32_t invec_idx, void *buffer, size_t num_bytes)
Read a message parameter or part of a message parameter from a client input vector.
#define PSA_ERROR_GENERIC_ERROR
#define PSA_IPC_DISCONNECT
psa_status_t ps_req_mngr_read_asset_data(uint8_t *out_data, uint32_t size)
Writes the asset data of a client iovec onto an output buffer.
#define TFM_PS_GET_SUPPORT_SIGNAL
#define TFM_PS_GET_SIGNAL
#define PSA_ERROR_PROGRAMMER_ERROR
psa_status_t tfm_ps_get(int32_t client_id, psa_storage_uid_t uid, uint32_t data_offset, uint32_t data_size, size_t *p_data_length)
Gets the asset data for the provided uid.
void ps_req_mngr_write_asset_data(const uint8_t *in_data, uint32_t size)
Takes an input buffer containing asset data and writes its contents to the client iovec...
psa_status_t tfm_ps_get_req(psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len)
Handles the get request.
int32_t tfm_core_get_caller_client_id(int32_t *caller_client_id)
void psa_write(psa_handle_t msg_handle, uint32_t outvec_idx, const void *buffer, size_t num_bytes)
Write a message response to a client output vector.
psa_status_t tfm_ps_init(void)
Initializes the protected storage system.
void psa_reply(psa_handle_t msg_handle, psa_status_t status)
Complete handling of a specific message and unblock the client.
psa_signal_t psa_wait(psa_signal_t signal_mask, uint32_t timeout)
Return the Secure Partition interrupt signals that have been asserted from a subset of signals provid...
#define TFM_PS_REMOVE_SIGNAL
__STATIC_INLINE void * tfm_memcpy(void *dest, const void *src, size_t num)
psa_status_t tfm_ps_set(int32_t client_id, psa_storage_uid_t uid, uint32_t data_length, psa_storage_create_flags_t create_flags)
Creates a new or modifies an existing asset.
psa_status_t tfm_ps_get_info(int32_t client_id, psa_storage_uid_t uid, struct psa_storage_info_t *p_info)
Gets the metadata for the provided uid.
uint64_t psa_storage_uid_t
psa_status_t tfm_ps_set_req(psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len)
Handles the set request.
psa_status_t tfm_ps_get_info_req(psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len)
Handles the get info request.
uint32_t psa_storage_create_flags_t
psa_status_t tfm_ps_remove(int32_t client_id, psa_storage_uid_t uid)
Removes the provided uid and its associated data from storage.
psa_status_t psa_get(psa_signal_t signal, psa_msg_t *msg)
Retrieve the message which corresponds to a given RoT Service signal and remove the message from the ...
int32_t psa_status_t
Function return status.