TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ps_encrypted_object.c File Reference
#include "ps_encrypted_object.h"
#include <stddef.h>
#include "crypto/ps_crypto_interface.h"
#include "psa/internal_trusted_storage.h"
#include "tfm_memory_utils.h"
#include "ps_object_defs.h"
#include "ps_utils.h"
Include dependency graph for ps_encrypted_object.c:

Go to the source code of this file.

Macros

#define PS_ENCRYPT_SIZE(plaintext_size)   ((plaintext_size) + PS_OBJECT_HEADER_SIZE - sizeof(union ps_crypto_t))
 
#define PS_OBJECT_START_POSITION   0
 
#define PS_MAX_ENCRYPTED_OBJ_SIZE   PS_ENCRYPT_SIZE(PS_MAX_OBJECT_DATA_SIZE)
 
#define PS_CRYPTO_BUF_LEN   (PS_MAX_ENCRYPTED_OBJ_SIZE + PS_TAG_LEN_BYTES)
 

Functions

psa_status_t ps_encrypted_object_read (uint32_t fid, struct ps_object_t *obj)
 Reads object referenced by the object File ID. More...
 
psa_status_t ps_encrypted_object_write (uint32_t fid, struct ps_object_t *obj)
 Creates and writes a new encrypted object based on the given ps_object_t structure data. More...
 

Macro Definition Documentation

#define PS_CRYPTO_BUF_LEN   (PS_MAX_ENCRYPTED_OBJ_SIZE + PS_TAG_LEN_BYTES)

Definition at line 31 of file ps_encrypted_object.c.

#define PS_ENCRYPT_SIZE (   plaintext_size)    ((plaintext_size) + PS_OBJECT_HEADER_SIZE - sizeof(union ps_crypto_t))

Definition at line 19 of file ps_encrypted_object.c.

#define PS_MAX_ENCRYPTED_OBJ_SIZE   PS_ENCRYPT_SIZE(PS_MAX_OBJECT_DATA_SIZE)

Definition at line 26 of file ps_encrypted_object.c.

#define PS_OBJECT_START_POSITION   0

Definition at line 22 of file ps_encrypted_object.c.

Function Documentation

psa_status_t ps_encrypted_object_read ( uint32_t  fid,
struct ps_object_t obj 
)

Reads object referenced by the object File ID.

Parameters
[in]fidFile ID
[out]objPointer to the object structure to fill in
Returns
Returns error code specified in psa_status_t

Definition at line 135 of file ps_encrypted_object.c.

Here is the call graph for this function:

Here is the caller graph for this function:

psa_status_t ps_encrypted_object_write ( uint32_t  fid,
struct ps_object_t obj 
)

Creates and writes a new encrypted object based on the given ps_object_t structure data.

Parameters
[in]fidFile ID
[in,out]objPointer to the object structure to write.

Note: The function will use obj to store the encrypted data before write it into the flash to reduce the memory requirements and the number of internal copies. So, this object will contain the encrypted object stored in the flash.

Returns
Returns error code specified in psa_status_t

Definition at line 162 of file ps_encrypted_object.c.

Here is the call graph for this function:

Here is the caller graph for this function: