Mbed OS Reference
Loading...
Searching...
No Matches
psa_crypto_its.h File Reference

Interface of trusted storage that crypto is built on. More...

#include <stddef.h>
#include <stdint.h>
#include <psa/crypto_types.h>
#include <psa/crypto_values.h>

Go to the source code of this file.

Data Structures

struct  psa_storage_info_t
 A container for metadata associated with a specific uid. More...
 

Macros

#define PSA_STORAGE_FLAG_NONE   0
 No flags to pass. More...
 
#define PSA_STORAGE_FLAG_WRITE_ONCE   (1 << 0)
 The data associated with the uid will not be able to be modified or deleted. More...
 
#define PSA_STORAGE_SUPPORT_SET_EXTENDED   (1 << 0)
 Flag indicating that psa_ps_create and psa_ps_set_extended are supported. More...
 
#define PSA_ERROR_INVALID_SIGNATURE   ((psa_status_t)-149)
 PSA storage specific error codes. More...
 
#define PSA_ITS_API_VERSION_MAJOR   1
 The major version number of the PSA ITS API. More...
 
#define PSA_ITS_API_VERSION_MINOR   1
 The minor version number of the PSA ITS API. More...
 

Typedefs

typedef uint32_t psa_storage_create_flags_t
 Flags used when creating a data entry. More...
 
typedef uint64_t psa_storage_uid_t
 A type for UIDs used for identifying data. More...
 

Functions

psa_status_t psa_its_set (psa_storage_uid_t uid, uint32_t data_length, const void *p_data, psa_storage_create_flags_t create_flags)
 create a new or modify an existing uid/value pair More...
 
psa_status_t psa_its_get (psa_storage_uid_t uid, uint32_t data_offset, uint32_t data_length, void *p_data, size_t *p_data_length)
 Retrieve the value associated with a provided uid. More...
 
psa_status_t psa_its_get_info (psa_storage_uid_t uid, struct psa_storage_info_t *p_info)
 Retrieve the metadata about the provided uid. More...
 
psa_status_t psa_its_remove (psa_storage_uid_t uid)
 Remove the provided key and its associated data from the storage. More...
 

Detailed Description

Interface of trusted storage that crypto is built on.

Definition in file psa_crypto_its.h.

Macro Definition Documentation

◆ PSA_STORAGE_FLAG_NONE

#define PSA_STORAGE_FLAG_NONE   0

No flags to pass.

Definition at line 42 of file psa_crypto_its.h.

◆ PSA_STORAGE_FLAG_WRITE_ONCE

#define PSA_STORAGE_FLAG_WRITE_ONCE   (1 << 0)

The data associated with the uid will not be able to be modified or deleted.

Intended to be used to set bits in psa_storage_create_flags_t

Definition at line 43 of file psa_crypto_its.h.

◆ PSA_STORAGE_SUPPORT_SET_EXTENDED

#define PSA_STORAGE_SUPPORT_SET_EXTENDED   (1 << 0)

Flag indicating that psa_ps_create and psa_ps_set_extended are supported.

Definition at line 55 of file psa_crypto_its.h.

◆ PSA_ERROR_INVALID_SIGNATURE

#define PSA_ERROR_INVALID_SIGNATURE   ((psa_status_t)-149)

PSA storage specific error codes.

Definition at line 59 of file psa_crypto_its.h.

◆ PSA_ITS_API_VERSION_MAJOR

#define PSA_ITS_API_VERSION_MAJOR   1

The major version number of the PSA ITS API.

It will be incremented on significant updates that may include breaking changes

Definition at line 62 of file psa_crypto_its.h.

◆ PSA_ITS_API_VERSION_MINOR

#define PSA_ITS_API_VERSION_MINOR   1

The minor version number of the PSA ITS API.

It will be incremented in small updates that are unlikely to include breaking changes

Definition at line 63 of file psa_crypto_its.h.

Typedef Documentation

◆ psa_storage_create_flags_t

typedef uint32_t psa_storage_create_flags_t

Flags used when creating a data entry.

Definition at line 36 of file psa_crypto_its.h.

◆ psa_storage_uid_t

typedef uint64_t psa_storage_uid_t

A type for UIDs used for identifying data.

Definition at line 40 of file psa_crypto_its.h.

Function Documentation

◆ psa_its_set()

psa_status_t psa_its_set ( psa_storage_uid_t  uid,
uint32_t  data_length,
const void *  p_data,
psa_storage_create_flags_t  create_flags 
)

create a new or modify an existing uid/value pair

Parameters
[in]uidthe identifier for the data
[in]data_lengthThe size in bytes of the data in p_data
[in]p_dataA buffer containing the 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_WRITE_ONCE_FLAG
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

◆ psa_its_get()

psa_status_t psa_its_get ( psa_storage_uid_t  uid,
uint32_t  data_offset,
uint32_t  data_length,
void *  p_data,
size_t *  p_data_length 
)

Retrieve the value associated with a provided uid.

Parameters
[in]uidThe uid value
[in]data_offsetThe starting offset of the data requested
[in]data_lengththe amount of data requested (and the minimum allocated size of the p_data buffer)
[out]p_dataThe buffer where the data will be placed upon successful completion
[out]p_data_lengthThe amount of data returned in the p_data buffer
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_data, p_data_length) is invalid. For example is NULL or references memory the caller cannot access. In addition, this can also happen if an invalid offset was provided.

◆ psa_its_get_info()

psa_status_t psa_its_get_info ( psa_storage_uid_t  uid,
struct psa_storage_info_t p_info 
)

Retrieve the metadata about the provided uid.

Parameters
[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

◆ psa_its_remove()

psa_status_t psa_its_remove ( psa_storage_uid_t  uid)

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

Parameters
[in]uidThe uid value
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 key value was not found in the storage
PSA_ERROR_NOT_PERMITTEDThe operation failed because the provided key value was created with PSA_STORAGE_WRITE_ONCE_FLAG
PSA_ERROR_STORAGE_FAILUREThe operation failed because the physical storage has failed (Fatal error)