1 /*
2  * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 
9 #include "flash_fs/its_flash_fs.h"
10 #include "flash/its_flash.h"
11 #include "its_utils.h"
12 #include "psa_manifest/pid.h"
13 #include "tfm_hal_its.h"
14 #include "tfm_hal_ps.h"
15 #include "tfm_internal_trusted_storage.h"
16 #include "tfm_its_defs.h"
17 
18 /**
19  * \brief Perform encryption/decryption of the buffer using the
20  *        tfm_hal_its APIs
21  *
22  * \param[in]   finfo         Pointer to \ref its_flash_fs_file_info_t
23  * \param[in]   fid           File identifier
24  * \param[in]   fid_size      File identifier size in bytes
25  * \param[in]   input         Input buffer
26  * \param[in]   input_size    Input size in bytes
27  * \param[out]  output        Output buffer
28  * \param[in]   output_size   Output size in bytes
29  * \param[in]   is_encrypt    Set the operation type (encryption/decryption)
30  *
31  * \return PSA_SUCCESS on successful operation or a valid PSA error code
32  *
33  */
34 psa_status_t tfm_its_crypt_file(struct its_flash_fs_file_info_t *finfo,
35                                 uint8_t *fid,
36                                 const size_t fid_size,
37                                 const uint8_t *input,
38                                 const size_t input_size,
39                                 uint8_t *output,
40                                 const size_t output_size,
41                                 const bool is_encrypt);
42 
43