1 /*
2  * SPDX-License-Identifier: Apache-2.0
3  *
4  * Copyright (c) 2023 Nordic Semiconductor ASA
5  */
6 
7 #ifndef H_BOOT_SERIAL_ENCRYPTION_
8 #define H_BOOT_SERIAL_ENCRYPTION_
9 #include "bootutil/fault_injection_hardening.h"
10 
11 /**
12  * Validate hash of a primary boot image doing on the fly decryption as well
13  *
14  * @param[in]   fa_p      flash area pointer
15  * @param[in]   hdr       boot image header pointer
16  * @param[in]   buf       buffer which is used for validating data
17  * @param[in]   buf_size  size of input buffer
18  *
19  * @return                FIH_SUCCESS on success, error code otherwise
20  */
21 fih_ret
22 boot_image_validate_encrypted(const struct flash_area *fa_p,
23                               struct image_header *hdr, uint8_t *buf,
24                               uint16_t buf_size);
25 
26 /**
27  * Handle an encrypted firmware in the main flash.
28  * This will decrypt the image inplace
29  */
30 int boot_handle_enc_fw(const struct flash_area *flash_area);
31 
32 #endif
33