1 /* 2 * Copyright (c) 2018-2020, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #ifndef __PS_ENCRYPTED_OBJECT_H__ 9 #define __PS_ENCRYPTED_OBJECT_H__ 10 11 #include <stdint.h> 12 #include "ps_object_defs.h" 13 #include "psa/protected_storage.h" 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 /** 20 * \brief Reads object referenced by the object File ID. 21 * 22 * \param[in] fid File ID 23 * \param[out] obj Pointer to the object structure to fill in 24 * 25 * \return Returns error code specified in \ref psa_status_t 26 */ 27 psa_status_t ps_encrypted_object_read(uint32_t fid, 28 struct ps_object_t *obj); 29 30 /** 31 * \brief Creates and writes a new encrypted object based on the given 32 * ps_object_t structure data. 33 * 34 * \param[in] fid File ID 35 * \param[in,out] obj Pointer to the object structure to write. 36 * 37 * Note: The function will use obj to store the encrypted data before write it 38 * into the flash to reduce the memory requirements and the number of 39 * internal copies. So, this object will contain the encrypted object 40 * stored in the flash. 41 * 42 * \return Returns error code specified in \ref psa_status_t 43 */ 44 psa_status_t ps_encrypted_object_write(uint32_t fid, 45 struct ps_object_t *obj); 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #endif /* __PS_ENCRYPTED_OBJECT_H__ */ 52