Lines Matching full:if

56 #if !defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD)
66 #if defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO) || defined(MCUBOOT_DATA_SHARING)
70 #if (!defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD)) || \
72 #if !defined(__BOOTSIM__)
79 #if MCUBOOT_SWAP_USING_SCRATCH
88 #if (BOOT_IMAGE_NUMBER > 1)
101 #if !defined(__BOOTSIM__)
107 #if BOOT_MAX_ALIGN > 1024
125 if (rc == BOOT_HOOK_REGULAR) in boot_read_image_headers()
129 if (rc != 0) { in boot_read_image_headers()
130 /* If `require_all` is set, fail on any single fail, otherwise in boot_read_image_headers()
131 * if at least the first slot's header was read successfully, in boot_read_image_headers()
136 if (i > 0 && !require_all) { in boot_read_image_headers()
159 #if defined(MCUBOOT_MEASURED_BOOT) || defined(MCUBOOT_DATA_SHARING) in boot_add_shared_data()
166 if (rc != 0) { in boot_add_shared_data()
176 if (rc != 0) { in boot_add_shared_data()
203 #if (BOOT_IMAGE_NUMBER > 1) in fill_rsp()
207 if (!state->img_mask[BOOT_CURR_IMG(state)]) { in fill_rsp()
212 if (BOOT_CURR_IMG(state) >= BOOT_IMAGE_NUMBER) { in fill_rsp()
217 #if defined(MCUBOOT_DIRECT_XIP) || defined(MCUBOOT_RAM_LOAD) in fill_rsp()
239 #if BOOT_IMAGE_NUMBER > 1 in close_all_flash_areas()
240 if (state->img_mask[BOOT_CURR_IMG(state)]) { in close_all_flash_areas()
244 #if MCUBOOT_SWAP_USING_SCRATCH in close_all_flash_areas()
253 #if (BOOT_IMAGE_NUMBER > 1) || \
266 * @retval -1 If ver1 is less than ver2.
267 * @retval 0 If the image version numbers are equal.
268 * @retval 1 If ver1 is greater than ver2.
274 if (ver1->iv_major > ver2->iv_major) { in boot_version_cmp()
277 if (ver1->iv_major < ver2->iv_major) { in boot_version_cmp()
281 if (ver1->iv_minor > ver2->iv_minor) { in boot_version_cmp()
284 if (ver1->iv_minor < ver2->iv_minor) { in boot_version_cmp()
288 if (ver1->iv_revision > ver2->iv_revision) { in boot_version_cmp()
291 if (ver1->iv_revision < ver2->iv_revision) { in boot_version_cmp()
295 #if defined(MCUBOOT_VERSION_CMP_USE_BUILD_NUMBER) in boot_version_cmp()
297 if (ver1->iv_build_num > ver2->iv_build_num) { in boot_version_cmp()
300 if (ver1->iv_build_num < ver2->iv_build_num) { in boot_version_cmp()
309 #if (!defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD)) || \
321 if (flash_area == FLASH_AREA_IMAGE_PRIMARY(BOOT_CURR_IMG(state))) { in boot_initialize_area()
324 } else if (flash_area == FLASH_AREA_IMAGE_SECONDARY(BOOT_CURR_IMG(state))) { in boot_initialize_area()
327 #if MCUBOOT_SWAP_USING_SCRATCH in boot_initialize_area()
328 } else if (flash_area == FLASH_AREA_IMAGE_SCRATCH) { in boot_initialize_area()
342 if (rc != 0) { in boot_initialize_area()
350 #if defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO)
360 if (rc != 0) { in boot_read_sectors_recovery()
365 if (rc != 0) { in boot_read_sectors_recovery()
375 #if (BOOT_IMAGE_NUMBER > 1)
382 * the swap type if necessary.
398 #if !defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD) in boot_verify_slot_dependency()
409 #if !defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD) in boot_verify_slot_dependency()
410 if (rc < 0) { in boot_verify_slot_dependency()
433 if (rc >= 0) { in boot_verify_slot_dependency()
442 #if !defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD)
445 * TLV area are all satisfied and update the related swap type if necessary.
455 if (state->img_mask[BOOT_CURR_IMG(state)]) { in boot_verify_dependencies()
459 if (BOOT_SWAP_TYPE(state) != BOOT_SWAP_TYPE_NONE && in boot_verify_dependencies()
467 if (rc == 0) { in boot_verify_dependencies()
485 #if defined MCUBOOT_RAM_LOAD
491 * Checks the dependency of all the active slots. If an image found with
497 * @return 0 if dependencies are met; nonzero otherwise.
506 if (state->img_mask[BOOT_CURR_IMG(state)]) { in boot_verify_dependencies()
511 if (rc != 0) { in boot_verify_dependencies()
531 * one after another to see if they are all satisfied.
550 if (rc != 0) { in boot_verify_slot_dependencies()
557 if (rc != 0) { in boot_verify_slot_dependencies()
563 if (rc < 0) { in boot_verify_slot_dependencies()
565 } else if (rc > 0) { in boot_verify_slot_dependencies()
570 if (len != sizeof(dep)) { in boot_verify_slot_dependencies()
577 if (rc != 0) { in boot_verify_slot_dependencies()
582 if (dep.image_id >= BOOT_IMAGE_NUMBER) { in boot_verify_slot_dependencies()
587 /* Verify dependency and modify the swap type if not satisfied. */ in boot_verify_slot_dependencies()
589 if (rc != 0) { in boot_verify_slot_dependencies()
602 #if !defined(MCUBOOT_DIRECT_XIP)
607 #if !defined(MCUBOOT_OVERWRITE_ONLY) || defined(MCUBOOT_OVERWRITE_ONLY_FAST)
618 #if (BOOT_IMAGE_NUMBER == 1) in boot_read_image_size()
624 if (rc != 0) { in boot_read_image_size()
631 if (flash_area_read(fap, off, &info, sizeof(info))) { in boot_read_image_size()
637 if (info.it_magic == IMAGE_TLV_PROT_INFO_MAGIC) { in boot_read_image_size()
638 if (protect_tlv_size != info.it_tlv_tot) { in boot_read_image_size()
643 if (flash_area_read(fap, off + info.it_tlv_tot, &info, sizeof(info))) { in boot_read_image_size()
647 } else if (protect_tlv_size != 0) { in boot_read_image_size()
652 if (info.it_magic != IMAGE_TLV_INFO_MAGIC) { in boot_read_image_size()
666 #if !defined(MCUBOOT_RAM_LOAD)
671 #if MCUBOOT_SWAP_USING_SCRATCH in boot_write_sz()
680 #if MCUBOOT_SWAP_USING_SCRATCH in boot_write_sz()
682 if (align > elem_sz) { in boot_write_sz()
705 if (rc != 0) { in boot_read_sectors()
710 if (rc != 0) { in boot_read_sectors()
715 #if MCUBOOT_SWAP_USING_SCRATCH in boot_read_sectors()
717 if (rc != 0) { in boot_read_sectors()
732 #if MCUBOOT_SWAP_SAVE_ENCTLV in boot_status_reset()
780 #if MCUBOOT_SWAP_USING_SCRATCH in boot_write_status()
781 if (bs->use_scratch) { in boot_write_status()
788 #if MCUBOOT_SWAP_USING_SCRATCH in boot_write_status()
793 if (rc != 0) { in boot_write_status()
809 if (rc != 0) { in boot_write_status()
831 #if (BOOT_IMAGE_NUMBER == 1) in boot_image_check()
840 #if defined(MCUBOOT_ENC_IMAGES) && !defined(MCUBOOT_RAM_LOAD) in boot_image_check()
841 if (MUST_DECRYPT(fap, BOOT_CURR_IMG(state), hdr)) { in boot_image_check()
843 if (rc < 0) { in boot_image_check()
846 if (rc == 0 && boot_enc_set_key(BOOT_CURR_ENC(state), 1, bs)) { in boot_image_check()
859 #if !defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD)
870 if (!tmpbuf) { in split_image_check()
872 if (!tmpbuf) { in split_image_check()
879 if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) { in split_image_check()
896 * and class the image as invalid if flags for encryption/compression
907 if (hdr->ih_magic != IMAGE_MAGIC) {
911 if (!boot_u32_safe_add(&size, hdr->ih_img_size, hdr->ih_hdr_size)) {
916 if (!MUST_DECOMPRESS(fap, BOOT_CURR_IMG(state), hdr)) {
918 if (1) {
920 if (!boot_u32_safe_add(&size, size, hdr->ih_protect_tlv_size)) {
925 if (size >= flash_area_get_size(fap)) {
929 #if !defined(MCUBOOT_ENC_IMAGES)
930 if (IS_ENCRYPTED(hdr)) {
934 if ((hdr->ih_flags & IMAGE_F_ENCRYPTED_AES128) &&
941 #if !defined(MCUBOOT_DECOMPRESS_IMAGES)
942 if (IS_COMPRESSED(hdr)) {
946 if ((hdr->ih_flags & IMAGE_F_COMPRESSED_LZMA1) &&
965 if (val != p[i]) {
983 if (rc != 0) {
991 if (!boot_data_is_set_to(erased_val, &hdr->ih_magic, sizeof(hdr->ih_magic))) {
998 #if defined(MCUBOOT_DIRECT_XIP)
1000 * Check if image in slot has been set with specific ROM address to run from
1003 * @returns 0 if IMAGE_F_ROM_FIXED flag is not set;
1004 * 0 if IMAGE_F_ROM_FIXED flag is set and ROM address specified in
1006 * 1 if IMF_F_ROM_FIXED flag is set but ROM address specified in header
1020 if (hdr->ih_flags & IMAGE_F_ROM_FIXED && hdr->ih_load_addr != f_off) {
1026 /* If there is address mismatch, the image is not bootable from this
1039 * FIH_SUCCESS if image was successfully validated
1040 * FIH_NO_BOOTABLE_IMAGE if no bootloable image was found
1055 if (rc != 0) {
1060 if (boot_check_header_erased(state, slot) == 0 ||
1063 #if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE)
1066 * be left behind. It can happen if the image is in the secondary slot
1068 * If during the erase operation, a reset occurs, parts of the slot
1071 * through mcumgr; so we just get rid of the trailer here, if the header
1074 if (slot != BOOT_PRIMARY_SLOT) {
1084 #if defined(MCUBOOT_OVERWRITE_ONLY) && defined(MCUBOOT_DOWNGRADE_PREVENTION)
1085 if (slot != BOOT_PRIMARY_SLOT) {
1086 /* Check if version of secondary slot is sufficient */
1090 if (rc < 0 && boot_check_header_erased(state, BOOT_PRIMARY_SLOT)) {
1101 if (!boot_is_header_valid(hdr, fap, state)) {
1106 if (FIH_EQ(fih_rc, FIH_BOOT_HOOK_REGULAR)) {
1110 if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
1111 if ((slot != BOOT_PRIMARY_SLOT) || ARE_SLOTS_EQUIVALENT()) {
1117 #if !defined(__BOOTSIM__)
1125 #if MCUBOOT_IMAGE_NUMBER > 1 && !defined(MCUBOOT_ENC_IMAGES) && defined(MCUBOOT_VERIFY_IMG_ADDRESS)
1131 if (area_id == FLASH_AREA_IMAGE_SECONDARY(BOOT_CURR_IMG(state))) {
1138 if (rc != 0) {
1143 if (reset_value < pri_fa->fa_off || reset_value> (pri_fa->fa_off + pri_fa->fa_size)) {
1169 * value which resides in the given slot, only if it's greater than the stored
1190 if (rc != 0) {
1196 if (rc != 0) {
1201 if (rc != 0) {
1211 #if !defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD)
1213 * Determines which swap operation to perform, if any. If it is determined
1215 * for validity. If the image in the secondary slot is invalid, it is erased,
1228 if (BOOT_IS_UPGRADE(swap_type)) {
1233 if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
1234 if (FIH_EQ(fih_rc, FIH_NO_BOOTABLE_IMAGE)) {
1262 #if !defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD)
1264 #if defined(MCUBOOT_ENC_IMAGES) || defined(MCUBOOT_SWAP_SAVE_ENCTLV)
1313 * encryption happening, if it is 1 then there is decryption from
1330 if (encrypted_src != encrypted_dst) {
1331 if (encrypted_dst) {
1350 if (sz - bytes_copied > sizeof buf) {
1357 if (rc != 0) {
1362 /* If only copy, then does not matter if header indicates need for
1364 if (!only_copy && IS_ENCRYPTED(hdr)) {
1366 if (abs_off < hdr->ih_hdr_size) {
1368 if (abs_off + chunk_sz > hdr->ih_hdr_size) {
1383 if (blk_sz > 0)
1386 if (abs_off + chunk_sz > tlv_off) {
1388 if (abs_off >= tlv_off) {
1394 if (source_slot == 0) {
1408 if (rc != 0) {
1422 * If a prior copy operation was interrupted by a system reset, this function
1426 * this struct to determine if it is resuming
1433 #if defined(MCUBOOT_OVERWRITE_ONLY) || defined(MCUBOOT_BOOTSTRAP)
1447 #if defined(MCUBOOT_OVERWRITE_ONLY_FAST)
1456 #if defined(MCUBOOT_OVERWRITE_ONLY_FAST)
1481 #if defined(MCUBOOT_OVERWRITE_ONLY_FAST)
1482 if ((size + this_size) >= src_size) {
1492 #if defined(MCUBOOT_OVERWRITE_ONLY_FAST)
1507 if (IS_ENCRYPTED(boot_img_hdr(state, BOOT_SECONDARY_SLOT))) {
1512 if (rc < 0) {
1515 if (rc == 0 && boot_enc_set_key(BOOT_CURR_ENC(state), 1, bs)) {
1524 if (rc != 0) {
1528 #if defined(MCUBOOT_OVERWRITE_ONLY_FAST)
1530 if (rc != 0) {
1537 if (rc != 0) {
1549 if (rc != 0) {
1586 #if !defined(MCUBOOT_OVERWRITE_ONLY)
1588 * Swaps the two images in flash. If a prior copy operation was interrupted
1592 * this struct to determine if it is resuming
1613 /* FIXME: just do this if asked by user? */
1618 if (boot_status_is_reset(bs)) {
1624 if (hdr->ih_magic == IMAGE_MAGIC) {
1630 if (IS_ENCRYPTED(hdr)) {
1635 if (rc == 0) {
1647 if (hdr->ih_magic == IMAGE_MAGIC) {
1654 if (IS_ENCRYPTED(hdr)) {
1659 if (rc == 0) {
1670 if (size > copy_size) {
1677 * If a swap was under way, the swap_size should already be present
1694 if (bs->enckey[slot][i] != 0xff) {
1701 if (i != BOOT_ENC_KEY_SIZE) {
1713 if (boot_status_fails > 0) {
1742 #if defined(MCUBOOT_OVERWRITE_ONLY)
1745 /* Check if the image update was triggered by a bad image in the
1752 if (rc == 0 || FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
1767 if (swap_type == BOOT_SWAP_TYPE_REVERT ||
1770 if (rc != 0) {
1776 if (swap_type == BOOT_SWAP_TYPE_PERM) {
1790 if (rc != 0) {
1798 if (BOOT_IS_UPGRADE(swap_type)) {
1800 if (rc != 0) {
1816 #if !defined(MCUBOOT_OVERWRITE_ONLY)
1834 if (bs->swap_type == BOOT_SWAP_TYPE_REVERT ||
1837 if (rc != 0) {
1842 if (BOOT_IS_UPGRADE(bs->swap_type)) {
1844 if (rc != 0) {
1849 if (BOOT_SWAP_TYPE(state) == BOOT_SWAP_TYPE_PANIC) {
1861 #if (BOOT_IMAGE_NUMBER > 1)
1872 /* In that case if we rebooted in the middle of an image upgrade process, we
1886 * In those cases if it is NONE or REVERT we cannot certainly determine
1889 * swap types cannot be present at the same time. If the swap type of
1897 if (BOOT_CURR_IMG(state) == 0) {
1902 if (!aborted_swap) {
1903 if ((BOOT_SWAP_TYPE(state) == BOOT_SWAP_TYPE_NONE) ||
1911 if (state->swap_type[i] == BOOT_SWAP_TYPE_REVERT) {
1919 * Prepare image to be updated if required.
1921 * Prepare image to be updated if required with completing an image swap
1922 * operation if one was aborted and/or determining the type of the
1936 #if defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO) || defined(MCUBOOT_DATA_SHARING)
1942 if (rc != 0) {
1946 * if there is one.
1949 if (rc == BOOT_EFLASH)
1958 if (rc != 0) {
1959 /* Continue with next image if there is one. */
1966 #if defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO) || defined(MCUBOOT_DATA_SHARING)
1967 /* Fetch information on maximum sizes for later usage, if needed */
1970 if (max_size > 0) {
1976 /* If the current image's slots aren't compatible, no swap is possible.
1979 if (boot_slots_compatible(state)) {
1984 if (rc != 0) {
1987 /* Continue with next image if there is one. */
1993 #if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE)
2001 if (rc != 0 && (BOOT_CURR_IMG(state) != BOOT_PRIMARY_SLOT ||
2004 if (rc != 0) {
2007 /* Continue with next image if there is one. */
2015 /* Determine if we rebooted in the middle of an image swap
2016 * operation. If a partial swap was detected, complete it.
2018 if (!boot_status_is_reset(bs)) {
2020 #if (BOOT_IMAGE_NUMBER > 1)
2046 if (bs->swap_type == BOOT_SWAP_TYPE_NONE) {
2051 if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
2058 #if (BOOT_IMAGE_NUMBER > 1)
2063 if (BOOT_SWAP_TYPE(state) == BOOT_SWAP_TYPE_NONE) {
2066 * offset 0, if interrupted, it might leave a valid header
2074 if (rc == 0 || FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
2080 if (rc == 1 && FIH_EQ(fih_rc, FIH_SUCCESS)) {
2093 /* In that case if slots are not compatible. */
2112 * counter value. It will only be updated if the new security counter is
2121 if (BOOT_SWAP_TYPE(state) == BOOT_SWAP_TYPE_NONE) {
2126 if (rc != 0) {
2146 * swap if slot 1 image has <= version number or < security counter
2155 #if defined(MCUBOOT_DOWNGRADE_PREVENTION) && \
2160 if (MCUBOOT_DOWNGRADE_PREVENTION_SECURITY_COUNTER) {
2161 /* If there was security no counter in slot 0, allow swap */
2165 if (rc != 0) {
2168 /* If there is no security counter in slot 1, or it's lower than
2173 if (rc != 0 || security_counter[0] > security_counter[1]) {
2181 if (rc < 0) {
2208 #if defined(__BOOTSIM__)
2216 #if MCUBOOT_SWAP_USING_SCRATCH
2223 #if (BOOT_IMAGE_NUMBER == 1)
2232 #if BOOT_IMAGE_NUMBER > 1
2233 if (state->img_mask[BOOT_CURR_IMG(state)]) {
2237 #if defined(MCUBOOT_ENC_IMAGES) && (BOOT_IMAGE_NUMBER > 1)
2247 #if !defined(__BOOTSIM__)
2252 #if MCUBOOT_SWAP_USING_SCRATCH
2260 #if MCUBOOT_SWAP_USING_SCRATCH
2273 if (rc != 0) {
2279 #if MCUBOOT_SWAP_USING_SCRATCH
2284 if (rc != 0) {
2290 /* Determine swap type and complete swap if it has been aborted. */
2293 if (BOOT_IS_UPGRADE(BOOT_SWAP_TYPE(state))) {
2298 #if (BOOT_IMAGE_NUMBER > 1)
2299 if (has_upgrade) {
2301 * are all satisfied and update swap type if necessary.
2304 if (rc != 0) {
2324 #if (BOOT_IMAGE_NUMBER > 1)
2325 if (state->img_mask[BOOT_CURR_IMG(state)]) {
2351 if (check_downgrade_prevention(state) != 0) {
2361 if (rc == BOOT_HOOK_REGULAR)
2376 if (rc != 0) {
2386 if (BOOT_SWAP_TYPE(state) == BOOT_SWAP_TYPE_PANIC) {
2401 #if BOOT_IMAGE_NUMBER > 1
2407 if (FIH_EQ(tmp_img_mask, true)) {
2412 if (BOOT_SWAP_TYPE(state) != BOOT_SWAP_TYPE_NONE) {
2422 if (rc != 0) {
2438 if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS) ||
2445 /* Even if we're not re-validating the primary slot, we could be booting
2449 if (BOOT_IMG(state, BOOT_PRIMARY_SLOT).hdr.ih_magic != IMAGE_MAGIC) {
2460 if (rc != 0) {
2466 if (rc != 0) {
2474 * If this is not the case, at least one iteration of the loop
2477 if(FIH_NOT_EQ(fih_cnt, BOOT_IMAGE_NUMBER)) {
2490 #if defined(MCUBOOT_ENC_IMAGES) || defined(MCUBOOT_SWAP_SAVE_ENCTLV)
2511 if (sectors == NULL) {
2528 if (rc != 0) {
2534 if (rc != 0) {
2547 if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
2561 if (rc) {
2586 #if BOOT_IMAGE_NUMBER > 1
2587 if (state->img_mask[BOOT_CURR_IMG(state)]) {
2601 if (rc != 0) {
2610 if (boot_is_header_valid(hdr, BOOT_IMG_AREA(state, slot), state)) {
2634 * @return NO_ACTIVE_SLOT if no available slot found, number of
2645 if (state->slot_usage[BOOT_CURR_IMG(state)].slot_available[slot]) {
2646 if (candidate_slot == NO_ACTIVE_SLOT) {
2652 if (rc == 1) {
2679 #if BOOT_IMAGE_NUMBER > 1
2680 if (state->img_mask[BOOT_CURR_IMG(state)]) {
2694 #if defined(MCUBOOT_DIRECT_XIP) && defined(MCUBOOT_DIRECT_XIP_REVERT)
2697 * to run. Erases the image if it was selected but its execution failed,
2698 * otherwise marks it as selected if it has not been before.
2725 if (active_swap_state->magic != BOOT_MAGIC_GOOD ||
2741 if (active_swap_state->copy_done != BOOT_FLAG_SET) {
2742 if (active_swap_state->copy_done == BOOT_FLAG_BAD) {
2753 if (rc != 0) {
2770 #if !defined(IMAGE_EXECUTABLE_RAM_START) || !defined(IMAGE_EXECUTABLE_RAM_SIZE)
2799 if (rc != 0) {
2810 if (img_dst < exec_ram_start) {
2814 if (!boot_u32_safe_add(&img_end_addr, img_dst, img_sz)) {
2818 if (img_end_addr > (exec_ram_start + exec_ram_size)) {
2867 if (rc != 0){
2875 if (rc != 0) {
2880 if (rc < 0) {
2884 /* if rc > 0 then the key has already been loaded */
2885 if (rc == 0 && boot_enc_set_key(BOOT_CURR_ENC(state), slot, &bs)) {
2891 if (src_sz - bytes_copied > max_sz) {
2901 if (bytes_copied + chunk_sz > tlv_off) {
2939 #if (BOOT_IMAGE_NUMBER == 1)
2946 if (rc != 0) {
2952 if (rc != 0) {
2962 #if (BOOT_IMAGE_NUMBER > 1)
2964 * Checks if two memory regions (A and B) are overlap or not.
2971 * @return true if there is overlap; false otherwise.
2977 if (start_b > end_a) {
2979 } else if (start_b >= start_a) {
2981 } else if (end_b > start_a) {
2989 * Checks if the image we want to load to memory overlap with an already
2994 * @return 0 if there is no overlap; nonzero otherwise.
3013 if (state->slot_usage[i].active_slot == NO_ACTIVE_SLOT
3023 if (do_regions_overlap(start_a, end_a, start_b, end_b)) {
3052 if (hdr->ih_flags & IMAGE_F_RAM_LOAD) {
3057 if (rc != 0) {
3065 if (rc != 0) {
3070 #if (BOOT_IMAGE_NUMBER > 1)
3072 if (rc != 0) {
3079 /* decrypt image if encrypted and copy it to RAM */
3080 if (IS_ENCRYPTED(hdr)) {
3091 if (rc != 0) {
3097 /* Only images that support IMAGE_F_RAM_LOAD are allowed if
3103 if (rc != 0) {
3157 if (rc == 0) {
3184 * means that a valid image found or already loaded. If no slot is
3189 if (active_slot != NO_ACTIVE_SLOT){
3195 if (active_slot == NO_ACTIVE_SLOT) {
3204 #if BOOT_IMAGE_NUMBER > 1
3205 if (state->img_mask[BOOT_CURR_IMG(state)]) {
3212 if (rc != 0) {
3221 if (rc != 0) {
3237 if (rc != 0 ) {
3247 if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
3281 #if defined(MCUBOOT_DIRECT_XIP) && defined(MCUBOOT_DIRECT_XIP_REVERT)
3283 * security counter can be increased only after reboot, if the image
3287 if (state->slot_usage[BOOT_CURR_IMG(state)].swap_state.image_ok == BOOT_FLAG_SET) {
3292 if (rc != 0) {
3296 #if defined(MCUBOOT_DIRECT_XIP) && defined(MCUBOOT_DIRECT_XIP_REVERT)
3315 if (rc != 0) {
3319 #if (BOOT_IMAGE_NUMBER > 1)
3323 if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
3328 #if (BOOT_IMAGE_NUMBER > 1)
3330 if (rc != 0) {
3343 #if BOOT_IMAGE_NUMBER > 1
3344 if (state->img_mask[BOOT_CURR_IMG(state)]) {
3349 if (rc != 0) {
3355 if (rc != 0) {
3371 if (rc != 0) {
3414 if (image_id >= BOOT_IMAGE_NUMBER) {
3418 #if BOOT_IMAGE_NUMBER > 1
3431 * @param state The state that should be cleared. If the value
3437 if (state != NULL) {
3444 #if defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO)
3466 #if MCUBOOT_SWAP_USING_SCRATCH
3478 if (rc != 0) {
3483 #if MCUBOOT_SWAP_USING_SCRATCH
3488 if (rc != 0) {
3496 if (rc == 0) {
3499 if (max_size > 0) {
3512 #if defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO) || defined(MCUBOOT_DATA_SHARING)
3518 #if defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO)
3522 if (image_max_sizes[i].calculated == true) {
3529 if (i == BOOT_IMAGE_NUMBER) {