Lines Matching full:if

54 /* Return true if this is an OTA app partition */
69 if (otadata_partition == NULL) { in read_otadata()
77 if (err != ESP_OK) { in read_otadata()
96 if (esp_image_verify(load_mode, &part_pos, &data) != ESP_OK) { in image_validate()
118 if ((partition == NULL) || (out_handle == NULL)) { in esp_ota_begin()
123 if (partition == NULL) { in esp_ota_begin()
127 if (!is_ota_partition(partition)) { in esp_ota_begin()
132 if (partition == running_partition) { in esp_ota_begin()
138 if (esp_ota_get_state_partition(running_partition, &ota_state_running_part) == ESP_OK) { in esp_ota_begin()
139 if (ota_state_running_part == ESP_OTA_IMG_PENDING_VERIFY) { in esp_ota_begin()
146 if (image_size != OTA_WITH_SEQUENTIAL_WRITES) { in esp_ota_begin()
147 // If input image size is 0 or OTA_SIZE_UNKNOWN, erase entire partition in esp_ota_begin()
148 if ((image_size == 0) || (image_size == OTA_SIZE_UNKNOWN)) { in esp_ota_begin()
154 if (ret != ESP_OK) { in esp_ota_begin()
160 if (new_entry == NULL) { in esp_ota_begin()
179 if (data == NULL) { in esp_ota_write()
186 if (it->handle == handle) { in esp_ota_write()
187 if (it->need_erase) { in esp_ota_write()
193 if ((it->wrote_size % SPI_FLASH_SEC_SIZE) == 0) { in esp_ota_write()
195 } else if (first_sector != last_sector) { in esp_ota_write()
198 if (ret != ESP_OK) { in esp_ota_write()
203if (it->wrote_size == 0 && it->partial_bytes == 0 && size > 0 && data_bytes[0] != ESP_IMAGE_HEADER… in esp_ota_write()
208 if (esp_flash_encryption_enabled()) { in esp_ota_write()
212 /* check if we have partially written data from earlier */ in esp_ota_write()
213 if (it->partial_bytes != 0) { in esp_ota_write()
217 if (it->partial_bytes != 16) { in esp_ota_write()
222 if (ret != ESP_OK) { in esp_ota_write()
232 /* check if we need to save trailing data that we're about to write */ in esp_ota_write()
234 if (it->partial_bytes != 0) { in esp_ota_write()
241 if(ret == ESP_OK){ in esp_ota_write()
248 //if go to here ,means don't find the handle in esp_ota_write()
259 if (data == NULL) { in esp_ota_write_with_offset()
266 if (it->handle == handle) { in esp_ota_write_with_offset()
271 … * Hence, unaligned data(less than 16 bytes) cannot be cached if flash encryption is enabled. in esp_ota_write_with_offset()
273 if (esp_flash_encryption_enabled() && (size % 16)) { in esp_ota_write_with_offset()
278 if (ret == ESP_OK) { in esp_ota_write_with_offset()
294 if (it->handle == handle) { in get_ota_ops_entry()
305 if (it == NULL) { in esp_ota_abort()
318 if (it == NULL) { in esp_ota_end()
324 // esp_ota_end() is only valid if some data was written to this handle in esp_ota_end()
325 if (it->wrote_size == 0) { in esp_ota_end()
330 if (it->partial_bytes > 0) { in esp_ota_end()
331 /* Write out last 16 bytes, if necessary */ in esp_ota_end()
333 if (ret != ESP_OK) { in esp_ota_end()
347 if (esp_image_verify(ESP_IMAGE_VERIFY, &part_pos, &data) != ESP_OK) { in esp_ota_end()
360 if (two_otadata == NULL || sec_id > 1) { in rewrite_ota_seq()
367 if (ret != ESP_OK) { in rewrite_ota_seq()
388 if (otadata_partition == NULL) { in esp_rewrite_ota_data()
393 if (SUB_TYPE_ID(subtype) >= ota_app_count) { in esp_rewrite_ota_data()
401 …//if otadata[0].ota_seq == otadata[1].ota_seq == 0xFFFFFFFF,means ota info partition is in init st… in esp_rewrite_ota_data()
402 …//so it will boot factory application(if there is),if there's no factory application,it will boot … in esp_rewrite_ota_data()
403 …//if otadata[0].ota_seq != 0 and otadata[1].ota_seq != 0,it will choose a max seq ,and get value o… in esp_rewrite_ota_data()
404 …//and boot a subtype (mask 0x0F) value is (max_seq - 1)%max_ota_app_number,so if want switch to ru… in esp_rewrite_ota_data()
405 … //for example, if otadata[0].ota_seq = 4, otadata[1].ota_seq = 5, and there are 8 ota application, in esp_rewrite_ota_data()
406 //current running is (5-1)%8 = 4,running ota[4],so if we want to switch to run ota[7], in esp_rewrite_ota_data()
408 //if A=(B - C)%D in esp_rewrite_ota_data()
414 if (active_otadata != -1) { in esp_rewrite_ota_data()
420 … int next_otadata = (~active_otadata)&1; // if 0 -> will be next 1. and if 1 -> will be next 0. in esp_rewrite_ota_data()
433 if (partition == NULL) { in esp_ota_set_boot_partition()
437 if (image_validate(partition, ESP_IMAGE_VERIFY) != ESP_OK) { in esp_ota_set_boot_partition()
441 // if set boot partition to factory bin ,just format ota info partition in esp_ota_set_boot_partition()
442 if (partition->type == ESP_PARTITION_TYPE_APP) { in esp_ota_set_boot_partition()
443 if (partition->subtype == ESP_PARTITION_SUBTYPE_APP_FACTORY) { in esp_ota_set_boot_partition()
445 if (find_partition != NULL) { in esp_ota_set_boot_partition()
454 if (err != ESP_OK) { in esp_ota_set_boot_partition()
458 if (esp_efuse_check_secure_version(partition_app_desc.secure_version) == false) { in esp_ota_set_boot_partition()
461 if (err != ESP_OK) { in esp_ota_set_boot_partition()
478 // Default to factory if present in find_default_boot_partition()
480 if (result != NULL) { in find_default_boot_partition()
484 // Try first OTA slot if no factory partition in find_default_boot_partition()
487 if (result != NULL) { in find_default_boot_partition()
492 // Test app slot if present in find_default_boot_partition()
494 if (result != NULL) { in find_default_boot_partition()
506 if (otadata_partition == NULL) { in esp_ota_get_boot_partition()
513 if ((bootloader_common_ota_select_invalid(&otadata[0]) && in esp_ota_get_boot_partition()
520 if (active_otadata != -1) { in esp_ota_get_boot_partition()
540 if (curr_partition != NULL) { in esp_ota_get_running_partition()
557 if (p->address <= phys_offs && p->address + p->size > phys_offs) { in esp_ota_get_running_partition()
573 if (start_from == NULL) { in esp_ota_get_next_update_partition()
584 if the current running partition is not OTA.) in esp_ota_get_next_update_partition()
594 if (p == NULL) { in esp_ota_get_next_update_partition()
598 if (default_ota == NULL) { in esp_ota_get_next_update_partition()
600 will be used if nothing else matches */ in esp_ota_get_next_update_partition()
604 if (p == start_from) { in esp_ota_get_next_update_partition()
608 else if (next_is_result) { in esp_ota_get_next_update_partition()
619 if (partition == NULL || app_desc == NULL) { in esp_ota_get_partition_description()
623 if(partition->type != ESP_PARTITION_TYPE_APP) { in esp_ota_get_partition_description()
628 if (err != ESP_OK) { in esp_ota_get_partition_description()
632 if (app_desc->magic_word != ESP_APP_DESC_MAGIC_WORD) { in esp_ota_get_partition_description()
647 // Returns true if the slots have at least one app (except the running app).
651 if (read_otadata(otadata) == NULL) { in esp_ota_check_rollback_is_possible()
656 if (ota_app_count == 0) { in esp_ota_check_rollback_is_possible()
665 if (active_ota == -1) { in esp_ota_check_rollback_is_possible()
672 if (valid_otadata[last_active_ota] == false) { in esp_ota_check_rollback_is_possible()
674 if (partition != NULL) { in esp_ota_check_rollback_is_possible()
675 if(image_validate(partition, ESP_IMAGE_VERIFY_SILENT) == ESP_OK) { in esp_ota_check_rollback_is_possible()
682 if (valid_otadata[last_active_ota] == true) { in esp_ota_check_rollback_is_possible()
685 if (partition != NULL) { in esp_ota_check_rollback_is_possible()
686 if(image_validate(partition, ESP_IMAGE_VERIFY_SILENT) == ESP_OK) { in esp_ota_check_rollback_is_possible()
689 if (esp_ota_get_partition_description(partition, &app_desc) == ESP_OK && in esp_ota_check_rollback_is_possible()
702 // if valid == false - will done rollback with reboot. After reboot will boot previous OTA[x] or Fa…
703 // if valid == true - it confirm that current OTA[x] is workable. Reboot will not happen.
708 if (otadata_partition == NULL) { in esp_ota_current_ota_is_workable()
713 if (active_otadata != -1 && esp_ota_get_app_partition_count() != 0) { in esp_ota_current_ota_is_workable()
714 if (valid == true && otadata[active_otadata].ota_state != ESP_OTA_IMG_VALID) { in esp_ota_current_ota_is_workable()
719 if (err == ESP_OK) { in esp_ota_current_ota_is_workable()
724 } else if (valid == false) { in esp_ota_current_ota_is_workable()
725 if (esp_ota_check_rollback_is_possible() == false) { in esp_ota_current_ota_is_workable()
732 if (err != ESP_OK) { in esp_ota_current_ota_is_workable()
776 if (read_otadata(otadata) == NULL) { in esp_ota_get_last_invalid_partition()
783 if (invalid_otadata != -1 && ota_app_count != 0) { in esp_ota_get_last_invalid_partition()
788 if (invalid_partition != NULL) { in esp_ota_get_last_invalid_partition()
789 if (image_validate(invalid_partition, ESP_IMAGE_VERIFY_SILENT) != ESP_OK) { in esp_ota_get_last_invalid_partition()
801 if (partition == NULL || ota_state == NULL) { in esp_ota_get_state_partition()
805 if (!is_ota_partition(partition)) { in esp_ota_get_state_partition()
811 if (read_otadata(otadata) == NULL || ota_app_count == 0) { in esp_ota_get_state_partition()
819if (ota_slot == req_ota_slot && otadata[i].crc == bootloader_common_ota_select_crc(&otadata[i])) { in esp_ota_get_state_partition()
826 if (not_found) { in esp_ota_get_state_partition()
837 if (ota_data_partition == NULL) { in esp_ota_erase_last_boot_app_partition()
843 if (active_otadata == -1 || ota_app_count == 0) { in esp_ota_erase_last_boot_app_partition()
848if (otadata[inactive_otadata].ota_seq == UINT32_MAX || otadata[inactive_otadata].crc != bootloader… in esp_ota_erase_last_boot_app_partition()
856 if (last_boot_app_partition_from_otadata == NULL) { in esp_ota_erase_last_boot_app_partition()
861 if (running_partition == NULL || last_boot_app_partition_from_otadata == running_partition) { in esp_ota_erase_last_boot_app_partition()
866 if (err != ESP_OK) { in esp_ota_erase_last_boot_app_partition()
872 if (err != ESP_OK) { in esp_ota_erase_last_boot_app_partition()
879 #if SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS > 1 && CONFIG_SECURE_BOOT_V2_ENABLED
882 if (!esp_secure_boot_enabled()) { in esp_ota_revoke_secure_boot_public_key()
887 if (index != SECURE_BOOT_PUBLIC_KEY_INDEX_0 && in esp_ota_revoke_secure_boot_public_key()
896 if (err != ESP_OK || app_digests.num_digests == 0) { in esp_ota_revoke_secure_boot_public_key()
904 if (ret != ESP_OK) { in esp_ota_revoke_secure_boot_public_key()
909 if (trusted_keys.key_digests[index] == NULL) { in esp_ota_revoke_secure_boot_public_key()
916 if (i == index) { in esp_ota_revoke_secure_boot_public_key()
917 continue; // omitting - to find if there is a valid key after revoking this digest in esp_ota_revoke_secure_boot_public_key()
920 if (trusted_keys.key_digests[i] != NULL) { in esp_ota_revoke_secure_boot_public_key()
925 if (!all_zeroes) { in esp_ota_revoke_secure_boot_public_key()
935 if (match == true) { in esp_ota_revoke_secure_boot_public_key()
940if (memcmp(trusted_digests.key_digests[i], app_digests.key_digests[j], ESP_SECURE_BOOT_DIGEST_LEN)… in esp_ota_revoke_secure_boot_public_key()
943 if (err != ESP_OK) { in esp_ota_revoke_secure_boot_public_key()
954 if (match == false) { in esp_ota_revoke_secure_boot_public_key()