Commit Graph

719 Commits

Author SHA1 Message Date
Mahavir Jain
f047237aa5 fix(bootloader_support): check the secure version only for app image
Secure version in the image header is only available for the application
image. However, for certain security workflows, bootloader verifies
itself (own image) and hence the secure version check during that must be
avoided.

Regression introduced in recent commit-id: 3305cb4d

Tested that both secure boot and flash-enc workflows work correctly
with the anti-rollback scenario.
2024-02-20 11:16:56 +02:00
Mahavir Jain
83ec466b26 fix(ota): additional checks for secure version in anti-rollback case
Some additional checks related to secure version of the application in
anti-rollback case have been added to avoid any attempts to boot lower
security version but valid application (e.g., passive partition image).

- Read secure_version under sha256 protection

- First check has been added in the bootloader to ensure correct secure
  version after application verification and loading stage. This check
  happens before setting up the flash cache mapping and handling over
  the final control to application. This check ensures that application
  was not swapped (e.g., to lower security version but valid image) just
  before the load stage in bootloader.

- Second check has been added in the application startup code to ensure
  that currently booting app has higher security version than the one
  programmed in the eFuse for anti-rollback scenario. This will ensure
  that only the legit application boots-up on the device for
  anti-rollback case.
2024-02-15 15:10:28 +02:00
Cao Sen Miao
8f6213c9f2 bugfix(spi_flash): Fix build error when octal flash is enabled,
Closes https://github.com/espressif/esp-idf/issues/12850
2023-12-22 14:11:28 +08:00
Erhan Kurubas
5e88ecfd02 fix(esp_hw_support): re-enable CONFIG_ESP_DEBUG_OCDAWARE functionality 2023-11-24 09:54:18 +00:00
Ivan Grokhotkov
228dbe103f
esp_rom: add USB_OTG "port" number for S2 and S3 2023-11-21 17:33:29 +01:00
wuzhenghui
6ae596c764
fix(esp_hw_support): fix lightsleep current leakage on usb-phy controlled pad 2023-11-16 20:03:30 +08:00
Ivan Grokhotkov
4db9dbb3e8
fix(console): switch USB PHY to OTG when OTG is used for console
On ESP32-S3 with the default efuse settings, USB PHY is connected to
the USB_SERIAL_JTAG peripheral. If USB OTG peripheral is used for the
console, we need to additionally switch the PHY to USB OTG, otherwise
we won't get any output.

Closes https://github.com/espressif/esp-idf/issues/12437
2023-11-16 19:05:26 +08:00
Cao Sen Miao
bb7544e65a fix(ota): Fixed OTA fail on octal flash with 32MB memory,
Closes https://github.com/espressif/esp-idf/issues/11903
2023-11-06 10:49:06 +08:00
Harshit Malpani
c4e6312687
fix(bootloader_support): Fix condition for SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
Fix the condition to verify the image when SECURE_SIGNED_APPS_ECDSA_V2_SCHEME and
SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT are selected.
2023-09-26 13:31:43 +05:30
Mahavir Jain
5e0129c91b fix(secure_ota): secure app verification issue without padding bytes
For the following configuration case:

 - CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
 - CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
 - CONFIG_SECURE_BOOT_ALLOW_SHORT_APP_PARTITION

verification of the application was failing because the externally
padded bytes were not considered in the hash (checksum) process.

This commit fixes the problem by enabling relevant code for secure OTA
without secure boot case.

Closes https://github.com/espressif/esp-idf/issues/11995
2023-08-14 03:29:44 +00:00
Lou Tianhao
7599d07c3f bugfix: remove the workaround implemented in MR 22773 about the lp_timer 2023-07-11 14:53:02 +08:00
Lou Tianhao
2c9a2a76f7 example: bringup light sleep example for esp32h2 2023-07-11 13:58:08 +08:00
Jiang Jiang Jian
8051cb704c Merge branch 'bugfix/fix_bootloader_wrong_spi_freq_print_v5.1' into 'release/v5.1'
bugfix: fix esp32c6 bootloader print wrong spi speed mode (backport v5.1)

See merge request espressif/esp-idf!24460
2023-07-05 12:24:16 +08:00
Marius Vikhammer
1bf26b2def Merge branch 'bugfix/incorrect_time_after_ota_v5.1' into 'release/v5.1'
esp_hw_support: Fix invalid system time if s_esp_rtc_time_us & s_rtc_last_ticks were moved around (v5.1)

See merge request espressif/esp-idf!24408
2023-07-03 20:37:40 +08:00
morris
c44624c056 Merge branch 'feature/esp_rom_update_cpu_freq_v5.1' into 'release/v5.1'
bootloader_support: add missing esp_rom_sys.h to bootloader_flash.c bootloader build (v5.1)

See merge request espressif/esp-idf!24014
2023-07-03 11:38:38 +08:00
wuzhenghui
88289c3fda bugfix: fix bootloader print wrong spi speed mode 2023-06-28 16:12:09 +08:00
KonstantinKondrashov
6d0d2366f7 esp_hw_support: Fix invalid system time if s_esp_rtc_time_us & s_rtc_last_ticks were moved around
The commit fixes the case:
If variables in RTC RAM have been moved around by the linker,
they will be filled with garbage data. Any reset other than OTA would work fine
because the variables would still be initialized from the initial bootup.

So now system time will be valid even after OTA.

Closes https://github.com/espressif/esp-idf/issues/9448
2023-06-26 18:12:30 +08:00
Harshit Malpani
4866e7c6d0
Add ESP32-H2 chip id in esp_chip_id_t enum in esp_app_format.h header file 2023-06-08 10:34:23 +05:30
Almir Okato
4b20d27caf bootloader_support: add missing esp_rom_sys.h to bootloader_flash.c bootloader build
Missing esp_rom_sys.h header could cause declaration issues.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-06-01 10:57:16 +08:00
Jakob Hasse
f4f45345ee esp_hw_support: decrease RNG read frequency on C6 and H2
* The RNG reading frequency of 200 KHz has been too high for
  C6 and H2 since on these chips the RNG output is combined
  with the RTC slow clock which is only 150KHz. Reduced the max
  reading frequency via esp_random() from 200KHz to 62.5KHz,
  which show best results in tests.
  Also updated the bootloader_fill_random() max frequency to the
  same value to be in line, even though it was just 83KHz.
2023-05-31 16:16:25 +00:00
Jiang Jiang Jian
125d00c0f7 Merge branch 'feature/c6_bootloader_rng_v5.1' into 'release/v5.1'
Feature/c6 bootloader rng (v5.1)

See merge request espressif/esp-idf!23896
2023-05-26 15:36:45 +08:00
Jakob Hasse
b0e2f33082
esp_hw_support/bootloader: made ESP32-C6 and ESP32-H2 RNG available 2023-05-24 09:43:21 +05:30
Jakob Hasse
a6cbf68991 compiler: replaced noreturn by __noreturn__ in header files
* noreturn may be replaced by third-party macros,
  rendering it ineffective

* Closes https://github.com/espressif/esp-idf/issues/11339
2023-05-18 12:49:40 +08:00
Marius Vikhammer
63153794c9 build-system: replace ADDITIONAL_MAKE_CLEAN_FILES with ADDITIONAL_CLEAN_FILES
ADDITIONAL_MAKE_CLEAN_FILES is deprecated and only worked with make.
Replaced with the new ADDITIONAL_CLEAN_FILES (CMake 3.15) which also works with ninja.
2023-05-10 09:53:55 +08:00
Marius Vikhammer
3724bf6256 ci: fixed test apps overriding pytest configs 2023-04-27 14:29:06 +08:00
laokaiyao
87328d594f esp32h4: checked all the corner stuffs of the removal 2023-04-26 18:53:12 +08:00
laokaiyao
954a6a2cff esp32h4: removed esp32h4 related codes 2023-04-26 18:53:12 +08:00
laokaiyao
cae47ce37e esp32h4: removed esp32h4 related files 2023-04-26 18:53:12 +08:00
laokaiyao
804a9ea1f6 esp32h4: remove esp32h4 target from peripherals 2023-04-26 18:53:10 +08:00
Xiao Xufeng
5c88e0d801 bootloader: enable super WDT and BOD reset on C2 2023-04-24 11:32:23 +08:00
Xiao Xufeng
c6559a9b64 bootloader: cleanup ana reset config code 2023-04-24 11:32:23 +08:00
Xiao Xufeng
ca3d871a21 bootloader: fixed super watchdog not enabled issue on C3, S3, H4 2023-04-24 11:32:23 +08:00
Xiao Xufeng
113e4dc520 bootloader: removed unavailable rtc features 2023-04-24 11:32:23 +08:00
Michael (XIAO Xufeng)
80315b77a0 bootloader: fix analog reset on C6 and H2 2023-04-24 11:32:23 +08:00
morris
6c19e7b8a7 gdma: avoid manually start/stop when channel is controled by ETM 2023-04-06 10:49:32 +08:00
Song Ruo Jing
5816c47457 spi_flash: Move mspi clock source switch to 64M in 2nd bootloader code from rtc_clk.c to bootloader_flash_config_esp32h2.c 2023-04-04 16:09:47 +08:00
Konstantin Kondrashov
6c5a7da77c Merge branch 'feature/unicore_bootloader_can_run_multicore_app' into 'master'
esp_system: Fix case when multicore app can not be run if bootloader is unicore

Closes IDFGH-9336

See merge request espressif/esp-idf!22664
2023-03-29 21:56:26 +08:00
Mahavir Jain
f22daec784 Merge branch 'feature/secure_set_efuses_to_prevent_brick_chip' into 'master'
security: write-protect DIS_ICAHE and DIS_DCACHE

Closes IDF-5177

See merge request espressif/esp-idf!22640
2023-03-29 11:51:09 +08:00
KonstantinKondrashov
a3232e4a5b bootloader: Adds an option to leave DIS_CACHE writeable 2023-03-29 00:02:25 +08:00
KonstantinKondrashov
723b2e86e5 security: write-protect DIS_ICAHE and DIS_DCACHE
Closes IDF-5177
2023-03-29 00:02:24 +08:00
KonstantinKondrashov
975c138fad esp_system: Do not rely on bootloader cache settings, do cache settings unconditionally at startup app
It makes multicore app runnable by unicore bootloader

Closes https://github.com/espressif/esp-idf/issues/10714
2023-03-28 23:17:16 +08:00
Zim Kalinowski
ee842a1386 Merge branch 'feature/fix_load_efuses_from_flash_when_real_fe_is_on' into 'master'
efuse(virtual mode): Fix load_efuses_from_flash when FE is on

Closes IDFGH-9580

See merge request espressif/esp-idf!22793
2023-03-28 17:32:11 +08:00
KonstantinKondrashov
88ef0d8aeb efuse: Fix load_efuses_from_flash when FE is on
esp_efuse_utility_load_efuses_from_flash() read emul_efuse
as an encrypted partition, but that is not correct,
this partition was never encrypted.
Need to read it as not encrypted partition.

Fxed the case: If FE is already on then EFUSE VIRT mode can work with it.

Closes https://github.com/espressif/esp-idf/issues/10929
2023-03-23 16:20:43 +08:00
KonstantinKondrashov
efbafb873b bootloader_support: Adds API to detect Factory reset has happened
Closes https://github.com/espressif/esp-idf/issues/10753
2023-03-22 02:21:54 +08:00
Zim Kalinowski
7c090d9a42 Merge branch 'bugfix/bootloader-ignored-warnings' into 'master'
bootloader: fix and re-enable no-format warnings

Closes IDF-6789

See merge request espressif/esp-idf!22715
2023-03-16 19:57:58 +08:00
Wan Lei
3b62bf59c4 Merge branch 'bugfix/fix_deep_sleep_crash_when_psram_high_freq' into 'master'
mspi: turn down freq to fix crash when sleep

Closes IDF-6881

See merge request espressif/esp-idf!22491
2023-03-16 14:11:21 +08:00
wanlei
d0c70aa7ac mspi: turn down freq to fix crash when sleep 2023-03-15 11:26:34 +08:00
Armando
bae6680207 mmu: hal function to init, and hal function to unmap all 2023-03-15 10:59:20 +08:00
Armando
929b7717ff system: fixed ram app cannot use mmu correctly issue 2023-03-15 10:59:20 +08:00
Zim Kalinowski
f6453b7938 bootloader: fix and re-enable no-format warnings 2023-03-15 00:28:31 +01:00