TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_protected_storage.c File Reference
#include "tfm_protected_storage.h"
#include "ps_object_system.h"
#include "tfm_ps_defs.h"
Include dependency graph for tfm_protected_storage.c:

Go to the source code of this file.

Functions

psa_status_t tfm_ps_init (void)
 Initializes the protected storage system. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
uint32_t tfm_ps_get_support (void)
 Gets a bitmask with flags set for all of the optional features supported by the implementation. More...
 

Function Documentation

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.

Parameters
[in]client_idIdentifier of the asset's owner (client)
[in]uidUnique identifier for the data
[in]data_offsetThe offset within the data associated with the uid to start retrieving data
[in]data_sizeThe amount of data to read (and the minimum allocated size of the p_data buffer)
[out]p_data_lengthThe pointer to the size of the data retrieved upon success.
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_INVALID_ARGUMENTThe operation failed because one or more of the given arguments were invalid (null pointer, etc.)
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_GENERIC_ERRORThe operation failed because of an unspecified internal failure
PSA_ERROR_DATA_CORRUPTThe operation failed because the data associated with the UID was corrupt
PSA_ERROR_INVALID_SIGNATUREThe operation failed because the data associated with the UID failed authentication

Definition at line 67 of file tfm_protected_storage.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]client_idIdentifier of the asset's owner (client)
[in]uidUnique identifier for the data
[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 as specified in psa_status_t
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, etc.)
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_GENERIC_ERRORThe operation failed because of an unspecified internal failure
PSA_ERROR_DATA_CORRUPTThe operation failed because the data associated with the UID was corrupt
PSA_ERROR_INVALID_SIGNATUREThe operation failed because the data associated with the UID failed authentication

Definition at line 83 of file tfm_protected_storage.c.

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t tfm_ps_get_support ( void  )

Gets a bitmask with flags set for all of the optional features supported by the implementation.

Returns
Bitmask value which contains all the bits set for all the optional features supported by the implementation

Definition at line 118 of file tfm_protected_storage.c.

Here is the caller graph for this function:

psa_status_t tfm_ps_init ( void  )

Initializes the protected 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 12 of file tfm_protected_storage.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]client_idIdentifier of the asset's owner (client)
[in]uidUnique identifier for the data to be removed
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_INVALID_ARGUMENTThe operation failed because one or more of the given arguments were invalid (null pointer, etc.)
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)
PSA_ERROR_GENERIC_ERRORThe operation failed because of an unspecified internal failure

Definition at line 95 of file tfm_protected_storage.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]client_idIdentifier of the asset's owner (client)
[in]uidUnique identifier for the data
[in]data_lengthThe size in bytes of the data in p_data
[in]create_flagsThe flags indicating the properties of the data
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_NOT_PERMITTEDThe operation failed because the provided uid value was already created with PSA_STORAGE_FLAG_WRITE_ONCE
PSA_ERROR_INVALID_ARGUMENTThe operation failed because one or more of the given arguments were invalid (null pointer, etc.)
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_GENERIC_ERRORThe operation failed because of an unspecified internal failure.

Definition at line 46 of file tfm_protected_storage.c.

Here is the call graph for this function:

Here is the caller graph for this function: