nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches

◆ psa_ps_set_extended()

psa_status_t psa_ps_set_extended ( psa_storage_uid_t  uid,
size_t  data_offset,
size_t  data_length,
const void *  p_data 
)

#include <include/protected_storage.h>

Sets partial data into an asset.

Before calling this function, the storage must have been reserved with a call to psa_ps_create. It can also be used to overwrite data in an asset that was created with a call to psa_ps_set. Calling this function with data_length = 0 is permitted, which will make no change to the stored data.This function can overwrite existing data and/or extend it up to the capacity for the uid specified in psa_ps_create, but cannot create gaps.

That is, it has preconditions:

  • data_offset <= size
  • data_offset + data_length <= capacity and postconditions:
  • size = max(size, data_offset + data_length)
  • capacity unchanged.
Parameters
[in]uidThe uid value
[in]data_offsetOffset within the asset to start the write
[in]data_lengthThe size in bytes of the data in p_data to write
[in]p_dataPointer to a buffer which contains the data to write
Returns
A status indicating the success/failure of the operation
Return values
PSA_SUCCESSThe asset exists, the input parameters are correct and the data is correctly written in the physical storage.
PSA_ERROR_STORAGE_FAILUREThe data was not written correctly in the physical storage
PSA_ERROR_INVALID_ARGUMENTThe operation failed because one or more of the preconditions listed above regarding data_offset, size, or data_length was violated.
PSA_ERROR_DOES_NOT_EXISTThe specified uid was not found
PSA_ERROR_NOT_SUPPORTEDThe implementation of the API does not support this function
PSA_ERROR_GENERIC_ERRORThe operation failed due to an unspecified error
PSA_ERROR_DATA_CORRUPTThe operation failed because the existing data has been corrupted.
PSA_ERROR_INVALID_SIGNATUREThe operation failed because the existing data failed authentication (MAC check failed).
PSA_ERROR_NOT_PERMITTEDThe operation failed because it was attempted on an asset which was written with the flag PSA_STORAGE_FLAG_WRITE_ONCE