Commit Graph

11 Commits

Author SHA1 Message Date
Mahavir Jain
5b2e8f2b38 fix(esp_system): reset crypto peripherals before device restart
This change addresses a rare but critical issue observed on certain
ESP32-C3 and ESP32-S3 devices, where secure boot verification
intermittently fails due to improper cleanup of crypto peripherals
during a restart.

Background – Restart Behavior in IDF
------------------------------------
In ESP-IDF, when the device restarts (via `esp_restart()` or due to a
panic/exception), a partial peripheral reset is performed followed by a
CPU reset. However, until now, crypto-related peripherals were not
included in this selective reset sequence.

Problem Scenario
----------------
If a restart occurs while the application is in the middle of a bignum
operation (i.e., using the MPI/Bignum peripheral), the ROM code may
encounter an inconsistent peripheral state during the subsequent boot.
This leads to transient RSA-PSS secure boot verification failures.

Following such a failure, the ROM typically triggers a full-chip reset
via the watchdog timer (WDT). This full reset clears the crypto
peripheral state, allowing secure boot verification to succeed on the
next boot.

Risk with Aggressive Revocation
-------------------------------
If secure boot aggressive revocation is enabled (disabled by default in
IDF), this transient verification failure could mistakenly lead to
revocation of the secure boot digest.

If your product configuration has aggressive revocation enabled,
applying this fix is strongly recommended.

Frequency of Occurrence
-----------------------
The issue is rare and only occurs in corner cases involving
simultaneous use of the MPI peripheral and an immediate CPU reset.

Fix
---
This fix ensures that all crypto peripherals are explicitly reset prior
to any software-triggered restart (including panic scenarios),
guaranteeing a clean peripheral state for the next boot and preventing
incorrect secure boot behavior.
2025-04-16 20:31:44 +08:00
morris
418768ebc7 fix(dma): abort the axi dma gracefully on CPU SW reset 2025-01-10 10:15:36 +08:00
Erhan Kurubas
9cab2c7796 fix(system): avoid unexcpected hp_sys_wdt reset 2024-12-19 11:58:58 +03:00
wuzhenghui
9c195f52a3 fix(esp_system): writeback L1 Dcache before disable L2 if PSRAM used 2024-11-11 14:03:08 +08:00
wuzhenghui
108123d50c fix(esp_system): fix stuck in bootloader_random_enable after lightsleep 2024-07-10 14:22:39 +08:00
harshal.patil
6ec486e351 fix(esp_system): Enable crpyto peripherals related clocks for specific ESP32-P4 ECOs 2024-04-12 14:56:53 +05:30
Cao Sen Miao
6768805d20 fix(uart,usj...): Fix wrong serial number that has been parsed to rom functions,
Closes https://github.com/espressif/esp-idf/issues/12958
2024-01-18 10:51:51 +08:00
Song Ruo Jing
7f2b85b82b feat(clk): add basic clock support for esp32p4
- Support CPU frequency 360MHz
- Support SOC ROOT clock source switch
- Support LP SLOW clock source switch
- Support clock calibration
2023-12-29 00:37:26 +08:00
fl0wl0w
d149c1b26f Use configuration option instead of in components not related to FreeRTOS
Mergeshttps://github.com/espressif/esp-idf/pull/12481
2023-11-28 07:49:20 +00:00
wuzhenghui
04fcfff5e0 fix(esp_system): fix uart clock disabled in driver cause esp_restart stuck 2023-11-27 12:06:07 +08:00
Armando
a336b94527 feat(esp_system): base support on p4 2023-07-25 05:59:10 +00:00