Commit Graph

647 Commits

Author SHA1 Message Date
harshal.patil
1bf5d48df5
fix(bootloader_support): Fix encrypt image instead of the partition feature not being enabled 2024-08-06 13:46:10 +05:30
Omar Chebib
1e8b9f8b9c fix(bootloader): add legacy retained memory CRC calculation
* Closes https://github.com/espressif/esp-idf/issues/12849

In former versions of ESP-IDF, the user custom memory data in the retained memory
was taken into account during the CRC calculation. This was changed in a later
commit, the custom memory was ignored, therefore this can seen as a breaking change.
This commit gives the possibility to choose between the former (legacy) or
new way of calculating the CRC.
2024-03-11 11:03:06 +08:00
Xiao Xufeng
31201cc947 doc(spi_flash): hide unsupported optional features 2024-03-03 23:11:43 +08:00
Xiao Xufeng
c32a56fe3b spi_flash: fixed issue that enabling HPM-DC by default may cause app unable to restart 2024-03-03 23:11:43 +08:00
Mahavir Jain
68c450df47 Merge branch 'feature/conservative_key_revocation_in_secure_boot_v5.0' into 'release/v5.0'
feat: Add API to verify the bootloader and application image before revoking... (v5.0)

See merge request espressif/esp-idf!28490
2024-02-22 17:15:24 +08:00
Mahavir Jain
534e3ad1fa Merge branch 'bugfix/ota_anti_rollback_checks_2_v5.0' into 'release/v5.0'
feat(bootloader_support): Read secure_version under sha256 protection (v5.0)

See merge request espressif/esp-idf!29061
2024-02-22 17:13:17 +08:00
Mahavir Jain
1620858985 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:18:28 +02:00
Mahavir Jain
f2743707b8 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:14:51 +02:00
harshal.patil
8176a0341e
feat(bootloader_support): Encrypt only the app image instead of the whole partition
Currently, when flash encryption is enabled, the whole partition gets encrypted.
This can be optimised by encrypting only the app image instead of encrypting the whole partition.

Closes https://github.com/espressif/esp-idf/issues/12576
2024-01-17 14:06:49 +05:30
harshal.patil
c3facf79da
fix(bootloader_support): Fix image_length calculation when secure boot v1 is enabled
Fixed the value of the image_length field of the image metadata populated by esp_image_verfiy()
to include the size of the signature sector when Secure Boot V1 is enabled.
2024-01-17 14:06:48 +05:30
Harshit Malpani
e713b3cbb5
feat: Add API to verify the bootloader and app image
Added an API to verify the bootloader and app image before revoking the key in Secure Boot V2.
This will help in preventing the device to be bricked if the bootloader/application cannot be
verified by any other keys in efuse
2024-01-16 11:57:06 +05:30
Cao Sen Miao
99ed0a2dcd bugfix(spi_flash): Fix build error when octal flash is enabled,
Closes https://github.com/espressif/esp-idf/issues/12850
2023-12-22 19:10:04 +08:00
wuzhenghui
ead822e6ee
fix(esp_hw_support): fix lightsleep current leakage on usb-phy controlled pad 2023-11-23 10:21:02 +08:00
Jiang Jiang Jian
c0dd50a35b Merge branch 'bugfix/esp32s3_usb_otg_console_without_efuse_v5.0' into 'release/v5.0'
fix(console): switch USB PHY to OTG when OTG is used for console (v5.0)

See merge request espressif/esp-idf!27135
2023-11-22 17:31:10 +08:00
Erhan Kurubas
5f1d3790cc fix(esp_hw_support): re-enable CONFIG_ESP_DEBUG_OCDAWARE functionality 2023-11-22 03:05:34 +00:00
Ivan Grokhotkov
c29f14e7b2 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-22 03:04:13 +00:00
Cao Sen Miao
f5e80b68c7 fix(ota): Fixed OTA fail on octal flash with 32MB memory,
Closes https://github.com/espressif/esp-idf/issues/11903
2023-11-01 12:27:16 +08:00
Harshit Malpani
3ea86d53b1
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:58 +05:30
Jiang Jiang Jian
46f5638847 Merge branch 'bugfix/incorrect_time_after_ota_v5.0' into 'release/v5.0'
esp_hw_support: Fix invalid system time if s_esp_rtc_time_us & s_rtc_last_ticks were moved around (v5.0)

See merge request espressif/esp-idf!24410
2023-08-23 16:34:43 +08:00
Jiang Jiang Jian
f9816801a9 Merge branch 'bugfix/secure_ota_without_padding_v5.0' into 'release/v5.0'
fix(secure_ota): secure app verification issue without padding bytes (v5.0)

See merge request espressif/esp-idf!25213
2023-08-21 10:42:05 +08:00
Mahavir Jain
52c9c342bd
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-04 12:25:20 +05:30
Ivan Grokhotkov
82e8d78b3b
esp_rom: add USB_OTG "port" number for S2 and S3 2023-07-18 18:15:37 +02:00
KonstantinKondrashov
031af815da 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-07-13 18:30:26 +08:00
Jiang Jiang Jian
c82d9ca887 Merge branch 'bugfix/bod_glitch_reset_c6_v5.0' into 'release/v5.0'
bootloader: fix BOD and glitch reset on C6 and H2 (v5.0)

See merge request espressif/esp-idf!23407
2023-06-13 10:25:47 +08:00
Jakob Hasse
fa099f23f3 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-30 13:21:17 +08:00
KonstantinKondrashov
861a5fb863 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-05-11 05:55:32 +00:00
Marius Vikhammer
b7ad0e0ad1 Merge branch 'bugfix/make_clean_files_v5.0' into 'release/v5.0'
build-system: replace ADDITIONAL_MAKE_CLEAN_FILES with ADDITIONAL_CLEAN_FILES (v5.0)

See merge request espressif/esp-idf!23662
2023-05-11 10:39:58 +08:00
Marius Vikhammer
124a43e9ec 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:56:15 +08:00
Xiao Xufeng
8227ca97bd bootloader: enable super WDT and BOD reset on C2 2023-04-24 11:44:53 +08:00
Xiao Xufeng
6ce4fd9eab bootloader: cleanup ana reset config code 2023-04-24 11:44:53 +08:00
Xiao Xufeng
d43934f32d bootloader: fixed super watchdog not enabled issue on C3, S3, H4 2023-04-24 11:44:52 +08:00
Xiao Xufeng
1392cce5e1 bootloader: removed unavailable rtc features 2023-04-24 11:44:52 +08:00
KonstantinKondrashov
76291d0095 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-29 14:58:50 +08:00
KonstantinKondrashov
e8fcb93d0f bootloader_support(esp32c2): Fix esp_secure_boot_cfg_verify_release_mode API
When FE and SB keys are set then:
- 128 low bits are read protected
- 128 hi bits are readable
2023-01-24 18:21:37 +08:00
KonstantinKondrashov
1cb0472520 bootloader_support(esp32c2): Fix WR_DIS_RD_DIS burn for secure boot key
SB key is left readable, the corresponding bit in RD_DIS is unset.
We set write-protection for RD_DIS to ensure that the SB key is always readable.
2023-01-23 21:35:31 +08:00
KonstantinKondrashov
5d37e26d35 security: Adds new APIs to check that all eFuse security features are enabled correctly 2023-01-23 21:02:55 +08:00
Jiang Jiang Jian
96db537020 Merge branch 'feature/apply_new_version_logic_v5.0' into 'release/v5.0'
all: Apply new version logic (major * 100 + minor) (v5.0)

See merge request espressif/esp-idf!20941
2023-01-12 16:18:23 +08:00
KonstantinKondrashov
df9e24a8ca bootloader_support: Fix iram_loader_seg overflow for ESP32-S2 when -O0 2023-01-06 02:00:52 +08:00
KonstantinKondrashov
823024c10c all: Apply new version logic (major * 100 + minor) 2023-01-06 02:00:52 +08:00
Omar Chebib
0714847552 C/Cxx: unify static assertions with the macro ESP_STATIC_ASSERT
Closes https://github.com/espressif/esp-idf/issues/9938
2022-12-19 15:06:15 +01:00
Aditya Patwardhan
04cdc55efc esp_flash_encrypt: If it is supported then Enable secure download mode in release mode instead of disabling it completely. 2022-12-08 10:28:30 +05:30
Jiang Jiang Jian
67f1ff7fa1 Merge branch 'feature/gd_e_hpm_support_v5.0' into 'release/v5.0'
spi_flash: Add GD25QxxE and ZBit flash HPM(120M) support(backport v5.0)

See merge request espressif/esp-idf!20240
2022-12-08 11:52:21 +08:00
Zim Kalinowski
9af06d112c Merge branch 'bugfix/rtc_retain_mem_always_erased_v5.0' into 'release/v5.0'
Bootloader: retained memory can now be kept after reboot when custom data enabled (backport v5.0)

See merge request espressif/esp-idf!21232
2022-12-05 16:38:08 +08:00
Mahavir Jain
76657faec3 Merge branch 'fix/secure_boot_v2_fix_warning_message_v5.0' into 'release/v5.0'
Fix/secure boot v2 fix warning message (v5.0)

See merge request espressif/esp-idf!21274
2022-12-05 12:21:31 +08:00
Ivan Grokhotkov
bdf2153a88 Merge branch 'bugfix/esp32s3_rom_has_ets_printf_issue_v5.0' into 'release/v5.0'
esp_rom: fix esp32s3 rom ets_printf bug (backport to v5.0)

See merge request espressif/esp-idf!20798
2022-12-02 19:28:14 +08:00
Armando
c60257e862 bootloader: fix bootloader_sha256_flash_contents mmap issue 2022-12-01 21:46:24 +08:00
Aditya Patwardhan
5dbfe4d502 secure_boot_v2: Fix warning message 2022-11-25 18:34:10 +05:30
Omar Chebib
62ad5c2258 Bootloader: retained memory can now be kept after reboot when custom data enabled
User's custom data are not taken into account during the CRC calculation anymore.
Which means taht the retained mem structure is not systematically erased
on each reboot anymore.
2022-11-24 17:35:55 +08:00
jiangguangming
8b0d0cbf5d esp_rom: remove ESP_ROM_SUPPORT_MULTIPLE_UART 2022-11-11 10:07:14 +08:00
jiangguangming
7472018f06 esp_rom: fix esp32s3 rom ets_printf bug 2022-11-11 10:04:00 +08:00