TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_internal_trusted_storage.c File Reference
Include dependency graph for tfm_internal_trusted_storage.c:

Go to the source code of this file.

Macros

#define ITS_BUF_SIZE   ITS_MAX_ASSET_SIZE
 

Functions

psa_status_t tfm_its_init (void)
 Initializes the internal trusted storage system. More...
 
psa_status_t tfm_its_set (int32_t client_id, psa_storage_uid_t uid, size_t data_length, psa_storage_create_flags_t create_flags)
 Create a new, or modify an existing, uid/value pair. More...
 
psa_status_t tfm_its_get (int32_t client_id, psa_storage_uid_t uid, size_t data_offset, size_t data_size, size_t *p_data_length)
 Retrieve data associated with a provided UID. More...
 
psa_status_t tfm_its_get_info (int32_t client_id, psa_storage_uid_t uid, struct psa_storage_info_t *p_info)
 Retrieve the metadata about the provided uid. More...
 
psa_status_t tfm_its_remove (int32_t client_id, psa_storage_uid_t uid)
 Remove the provided uid and its associated data from the storage. More...
 

Macro Definition Documentation

#define ITS_BUF_SIZE   ITS_MAX_ASSET_SIZE

Definition at line 22 of file tfm_internal_trusted_storage.c.

Function Documentation

psa_status_t tfm_its_get ( int32_t  client_id,
psa_storage_uid_t  uid,
size_t  data_offset,
size_t  data_size,
size_t *  p_data_length 
)

Retrieve data associated with a provided UID.

Retrieves up to data_size bytes of the data associated with uid, starting at data_offset bytes from the beginning of the data. Upon successful completion, the data will be placed in the p_data buffer, which must be at least data_size bytes in size. The length of the data returned will be in p_data_length. If data_size is 0, the contents of p_data_length will be set to zero.

Parameters
[in]client_idIdentifier of the asset's owner (client)
[in]uidThe uid value
[in]data_offsetThe starting offset of the data requested
[in]data_sizeThe amount of data requested
[out]p_data_lengthOn success, this will contain size of the data placed in p_data.
Returns
A status indicating the success/failure of the operation
Return values
PSA_SUCCESSThe operation completed successfully
PSA_ERROR_DOES_NOT_EXISTThe operation failed because the provided uid value was not found in the storage
PSA_ERROR_STORAGE_FAILUREThe operation failed because the physical storage has failed (Fatal error)
PSA_ERROR_INVALID_ARGUMENTThe operation failed because one of the provided arguments (p_data, p_data_length) is invalid, for example is NULL or references memory the caller cannot access. In addition, this can also happen if data_offset is larger than the size of the data associated with uid.

Definition at line 202 of file tfm_internal_trusted_storage.c.

Here is the call graph for this function:

Here is the caller graph for this function:

psa_status_t tfm_its_get_info ( int32_t  client_id,
psa_storage_uid_t  uid,
struct psa_storage_info_t p_info 
)

Retrieve the metadata about the provided uid.

Retrieves the metadata stored for a given uid as a psa_storage_info_t structure.

Parameters
[in]client_idIdentifier of the asset's owner (client)
[in]uidThe uid value
[out]p_infoA pointer to the psa_storage_info_t struct that will be populated with the metadata
Returns
A status indicating the success/failure of the operation
Return values
PSA_SUCCESSThe operation completed successfully
PSA_ERROR_DOES_NOT_EXISTThe operation failed because the provided uid value was not found in the storage
PSA_ERROR_STORAGE_FAILUREThe operation failed because the physical storage has failed (Fatal error)
PSA_ERROR_INVALID_ARGUMENTThe operation failed because one of the provided pointers(p_info) is invalid, for example is NULL or references memory the caller cannot access

Definition at line 272 of file tfm_internal_trusted_storage.c.

Here is the call graph for this function:

Here is the caller graph for this function:

psa_status_t tfm_its_init ( void  )

Initializes the internal trusted storage system.

Returns
A status indicating the success/failure of the operation as specified in psa_status_t
Return values
PSA_SUCCESSThe operation completed successfully
PSA_ERROR_STORAGE_FAILUREThe operation failed because the storage system initialization has failed (fatal error)
PSA_ERROR_GENERIC_ERRORThe operation failed because of an unspecified internal failure

Definition at line 58 of file tfm_internal_trusted_storage.c.

Here is the call graph for this function:

Here is the caller graph for this function:

psa_status_t tfm_its_remove ( int32_t  client_id,
psa_storage_uid_t  uid 
)

Remove the provided uid and its associated data from the storage.

Deletes the data from internal storage.

Parameters
[in]client_idIdentifier of the asset's owner (client)
[in]uidThe uid value
Returns
A status indicating the success/failure of the operation
Return values
PSA_SUCCESSThe operation completed successfully
PSA_ERROR_INVALID_ARGUMENTThe operation failed because one or more of the given arguments were invalid (null pointer, wrong flags and so on)
PSA_ERROR_DOES_NOT_EXISTThe operation failed because the provided uid value was not found in the storage
PSA_ERROR_NOT_PERMITTEDThe operation failed because the provided uid value was created with PSA_STORAGE_FLAG_WRITE_ONCE
PSA_ERROR_STORAGE_FAILUREThe operation failed because the physical storage has failed (Fatal error)

Definition at line 300 of file tfm_internal_trusted_storage.c.

Here is the call graph for this function:

Here is the caller graph for this function:

psa_status_t tfm_its_set ( int32_t  client_id,
psa_storage_uid_t  uid,
size_t  data_length,
psa_storage_create_flags_t  create_flags 
)

Create a new, or modify an existing, uid/value pair.

Stores data in the internal storage.

Parameters
[in]client_idIdentifier of the asset's owner (client)
[in]uidThe identifier for the data
[in]data_lengthThe size in bytes of the data in p_data
[in]create_flagsThe flags that the data will be stored with
Returns
A status indicating the success/failure of the operation
Return values
PSA_SUCCESSThe operation completed successfully
PSA_ERROR_NOT_PERMITTEDThe operation failed because the provided uid value was already created with PSA_STORAGE_FLAG_WRITE_ONCE
PSA_ERROR_NOT_SUPPORTEDThe operation failed because one or more of the flags provided in create_flags is not supported or is not valid
PSA_ERROR_INSUFFICIENT_STORAGEThe operation failed because there was insufficient space on the storage medium
PSA_ERROR_STORAGE_FAILUREThe operation failed because the physical storage has failed (Fatal error)
PSA_ERROR_INVALID_ARGUMENTThe operation failed because one of the provided pointers (p_data) is invalid, for example is NULL or references memory the caller cannot access

Definition at line 128 of file tfm_internal_trusted_storage.c.

Here is the call graph for this function:

Here is the caller graph for this function: