1 /* 2 * Copyright (c) 2019-2021, Arm Limited. All rights reserved. 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 #include "tfm_sp_log.h" 18 19 /** 20 * \brief Perform encryption/decryption of the buffer using the 21 * tfm_hal_its APIs 22 * 23 * \param[in] finfo Pointer to \ref its_flash_fs_file_info_t 24 * \param[in] fid File identifier 25 * \param[in] fid_size File identifier size in bytes 26 * \param[in] input Input buffer 27 * \param[in] input_size Input size in bytes 28 * \param[out] output Output buffer 29 * \param[in] output_size Output size in bytes 30 * \param[in] is_encrypt Set the operation type (encryption/decryption) 31 * 32 * \return PSA_SUCCESS on successful operation or a valid PSA error code 33 * 34 */ 35 psa_status_t tfm_its_crypt_file(struct its_flash_fs_file_info_t *finfo, 36 uint8_t *fid, 37 const size_t fid_size, 38 const uint8_t *input, 39 const size_t input_size, 40 uint8_t *output, 41 const size_t output_size, 42 const bool is_encrypt); 43 44