Commit Graph

98 Commits

Author SHA1 Message Date
Laukik Hase
acb7d996b0 fix(esp_tee): Validate the stack pointer at the privilege switch boundary 2026-07-23 11:29:55 +05:30
harshal.patil
e32395652b ci(esp_tee): Fix tee_cli_app build failure due to heap overflow 2026-07-17 10:53:32 +05:30
Laukik Hase
710d964505 feat(esp_tee): Restrict REE access to TEE-owned secure storage keys 2026-07-15 09:56:26 +05:30
morris
651d6a283f refactor(esp_common): centralize ALIGN_UP/ALIGN_DOWN into esp_macros.h
Remove ~50 duplicate local definitions of ALIGN_UP/ALIGN_DOWN/ALIGN_UP_BY/
ALIGN_DOWN_BY across the codebase and replace them with canonical
ESP_ALIGN_UP/ESP_ALIGN_DOWN from esp_macros.h.
2026-07-06 13:36:06 +08:00
Laukik Hase
e7261f57f5 ci(esp_tee): Fix tee_cli_app build failure due to heap size overflow
- Also fix the `unused variable` warning while builing the PSA
  AES tests with `tee_test_fw` app
2026-07-02 15:14:42 +05:30
Michael (XIAO Xufeng)
c1b218b640 Merge branch 'fix/mmap_cache_flash_wr' into 'master'
fix(mmap): fixed mmap read data wrong when flash being erased/written and cache not disabled

Closes IDFGH-14084

See merge request espressif/esp-idf!29804
2026-06-29 11:44:10 +08:00
harshal.patil
6b417e9d47 fix(esp_common/esp_fault): make ESP_FAULT_ASSERT survive optimization
ESP_FAULT_ASSERT(C) was silently deleted by the optimizer when C is a cached
flag/status already proven by a preceding `if (!C) return/goto`: the compiler
folds C to a constant and drops all three checks, removing the fault-injection
protection with no warning.
2026-06-17 16:45:29 +05:30
Xiao Xufeng
789ce684c9 fix(mmap): fixed some API read wrong data via mmap when flash being erased/written while XIP on PSRAM
Before:

The cache won't be disabled when XIP on psram. But during flash
erasing/programming, read data will be courrupt.

When XIP in psram is enabled, the image is not mapped to the cache so
usually there will be no flash access. The only way to read from flash
is via the driver or use mmap. The driver has protection during erasing,
while th mmap region not.

Now:

Mmap APIs provide a flag to make mmap->unmap region mutually exclusive
to flash erase/programming when XIP from psram. SPI Flash write APIs
will benefit from this. When the flag is used, no concurrent access to
mapped region will happen while writing; otherwise the cache will be
disable to avoid data corruption.

Most ESP-IDF APIs calls mmap with this flag. As for users calling
mmap-like APIs directly, they can choose whether to enable this by a
flag.

Closes https://github.com/espressif/esp-idf/issues/14897
2026-06-16 01:00:43 +08:00
Aditya Patwardhan
67e10e2b56 change(secure_boot): mark ECDSA based Secure Boot V2 as insecure on affected SoCs
ECDSA based Secure Boot V2 is not functional for certain input vectors on
ESP32-C5/C61/H2/P4 and on the preview targets ESP32-H4/H21. RSA based Secure
Boot V2 is the recommended scheme where the SoC supports it. This issue will be
fixed in a future hardware ECO revision; more details will be shared through the
hardware errata document.

A new hidden Kconfig option SECURE_BOOT_V2_ECDSA_INSECURE marks the affected
mass-production SoCs (ESP32-C5/C61/H2/P4). On these SoCs, when hardware Secure
Boot V2 is enabled, the ECDSA (V2) signing scheme is no longer offered by
default; it must be turned on explicitly via SECURE_BOOT_V2_FORCE_ENABLE_ECDSA
under "Allow potentially insecure options" (CONFIG_SECURE_BOOT_INSECURE). App
signing without hardware Secure Boot is not affected. Note that ESP32-C61 has no
RSA based Secure Boot V2, so it has no Secure Boot scheme enabled by default.

The preview targets ESP32-H4 and ESP32-H21 mark ECDSA Secure Boot V2 as not
supported in their SoC capabilities instead of using the option above. As
ESP32-H4 has no other Secure Boot V2 scheme, Secure Boot is disabled entirely on
it; ESP32-H21 retains RSA based Secure Boot V2.

The security documentation keeps the ECDSA Secure Boot V2 content visible and
adds a warning describing the limitation (including that ECDSA Secure Boot V2 on
ESP32-C61 is not recommended for production). CI apps that exercise ECDSA Secure
Boot V2 on the affected SoCs set CONFIG_SECURE_BOOT_V2_FORCE_ENABLE_ECDSA
accordingly.
2026-06-09 16:55:57 +05:30
Laukik Hase
8abc7269d1 ci(esp_tee): Add fuzzing tests for verifying service call behaviour 2026-05-26 13:13:45 +05:30
harshal.patil
4821f331fe refactor(mbedtls/test): Move the mbedtls test app to support multiple test apps 2026-05-15 09:09:15 +05:30
Laukik Hase
51ac92e737 ci(esp_tee): Add test-case for verifying the TEE Secure Storage encryption 2026-05-11 16:56:57 +05:30
Laukik Hase
4f3f1dff5a feat(esp_tee): Add some required fields in the attestation token
- Chip ID from the ROM
- Device MAC address from eFuse BLK1
- Device Optional Unique ID from eFuse BLK2
2026-05-11 16:29:19 +05:30
Guillaume Souchere
a56354e9ab feat(heap): move TLSF ROM patches and related files from esp_rom to heap
The TLSF ROM patch code (rom_patch_tlsf.c, rom_patch_multi_heap.c),
their headers, and the per-target *.rom.heap.ld linker scripts are
semantically owned by the heap component, not esp_rom. Move them
accordingly:

- components/esp_rom/patches/esp_rom_tlsf.c
  → components/heap/rom_patches/rom_patch_tlsf.c
- components/esp_rom/patches/esp_rom_multi_heap.c
  → components/heap/rom_patches/rom_patch_multi_heap.c
- components/esp_rom/include/esp_rom_tlsf.h
  → components/heap/rom_patches/include/rom_patch_tlsf.h
- components/esp_rom/include/esp_rom_multi_heap.h
  → components/heap/rom_patches/include/rom_patch_multi_heap.h
- components/esp_rom/<target>/ld/<target>.rom.heap.ld (×8)
  → components/heap/port/<target>/ld/<target>.rom.heap.ld

Update heap/CMakeLists.txt to:
- use target_linker_script() directly for *.rom.heap.ld
- guard post-registration ROM patch setup with NOT BOOTLOADER_BUILD
- drop stale CONFIG_HEAP_TLSF_CHECK_PATCH symbol reference
- drop esp_rom_include_multi_heap_patch from TLSF_CHECK_PATCH guard

Remove the corresponding entries from esp_rom/CMakeLists.txt.
2026-04-23 12:21:31 +02:00
Laukik Hase
145ba4c42d fix(esp_tee): Add missing input validation checks for TEE service calls
- MULTI_HEAP_ASSERT for TEE now aborts on failure, instead of ignoring the condition
- Prevent potential TEE OTA write bounds overflow
2026-04-07 10:05:06 +05:30
Laukik Hase
fc67c01995 ci(esp_tee): Fix TEE test-suite failures with Secure Boot enabled 2026-03-30 13:56:35 +05:30
Laukik Hase
250d757bb9 feat(esp_tee): Miscellaneous fixes and improvements
- Fix intermittent TEE stack underflow test failures
- Fix out-of-bounds access Coverity report from the attestation
  component
- Add appropriate checks and asserts for TEE flash memory regions'
  sizes
2026-03-16 10:46:11 +05:30
Laukik Hase
3593995a43 refactor(esp_tee): Remove leftover references to the secure storage AES-GCM IV 2026-02-14 16:19:57 +05:30
Laukik Hase
c0523c7771 ci(esp_tee): Removed common_components dependency from ESP-TEE test-apps 2026-02-10 13:52:30 +05:30
Laukik Hase
85e66d726d fix(esp_tee): Prevent IV reuse in the TEE secure storage AES-GCM service 2026-02-05 14:53:21 +05:30
harshal.patil
2bc49effb4 test(mbedtls): Re-introduce the extensive AES, AES-GCM and the SHA tests
- Also extend the PSRAM encryption test to ESP32-S3
2026-02-02 16:58:01 +05:30
Laukik Hase
b6c54be94f fix(esp_tee): Fix incorrect path of APM HAL in the TEE linker scripts 2026-01-28 10:12:48 +05:30
Laukik Hase
31b113b649 fix(esp_tee): Fix TEE attestation stack protection fault with secure boot enabled
- Increased the TEE stack when secure boot is enabled
- Also, generate a build error when the generated TEE binary image size is
  greater than the TEE partition size
2026-01-20 16:40:03 +05:30
harshal.patil
acb71bc858 feat(esp_tee): Support deterministic ECDSA signatures for ESP-TEE based keys 2026-01-19 09:14:37 +05:30
harshal.patil
e9ea55bea2 feat(mbedtls/ecdsa): Introduce PSA ECDSA driver 2026-01-19 09:14:37 +05:30
Mahavir Jain
2948a46371 Merge branch 'refactor/tee_sec_stg_remove_r192' into 'master'
refactor(esp_tee): Remove support for ECDSA `secp192r1` keys in TEE secure storage

See merge request espressif/esp-idf!45118
2026-01-18 18:24:04 +05:30
Laukik Hase
85681d7586 refactor(esp_tee): Remove support for ECDSA secp192r1 keys in TEE secure storage 2026-01-16 17:53:16 +05:30
Laukik Hase
169f40658d refactor(esp_tee): Update TEE attestation tests and examples to use the PSA interface 2026-01-16 12:28:58 +05:30
Laukik Hase
66ed9d2b4b ci(esp_tee): Optimize the TEE pytest script 2026-01-12 18:29:44 +05:30
Michael (XIAO Xufeng)
c299c0b749 Merge branch 'refactor/remove_idf_test_component' into 'master'
refactor: Remove idf_test component

Closes IDF-12578

See merge request espressif/esp-idf!43733
2026-01-06 16:20:20 +08:00
Laukik Hase
b15334600d Merge branch 'refactor/esp_tee_picolibc' into 'master'
refactor(esp_tee): Adopt `Picolibc` as the default LibC for ESP-TEE build

See merge request espressif/esp-idf!44050
2026-01-02 10:38:47 +05:30
Xiao Xufeng
73735f3e87 test: merge chip-specific performance data headers 2026-01-01 02:35:58 +08:00
Li Shuai
6e9885f7e6 Merge branch 'bugfix/idfgh-16634' into 'master'
remove the configurable constraint for sleep memory usage optimization option

Closes IDFGH-16634 and IDF-13780

See merge request espressif/esp-idf!42882
2025-12-31 12:57:50 +08:00
Laukik Hase
406ca9aa92 ci(esp_tee): Enable the tee_cli_app test-app for ESP32-H2
- Also set the RX burst size correctly for AES/SHA DMA operations
  with ESP-TEE
- Fix the compile-time minimum chip revision check for patching
  the `ets_delay_us` API
2025-12-30 16:03:43 +05:30
Laukik Hase
0964024484 refactor(esp_tee): Adopt Picolibc as the default LibC for ESP-TEE build
- Also fixed an issue where NewLib ROM APIs, when called from TEE, were
  using the syscall table located in the REE SRAM. This could be abused
  as an attack vector to invoke illegal functions from the TEE.
  To prevent this, the syscall table is now switched to the TEE-specific
  copy during every M-U mode transition.
2025-12-30 16:03:41 +05:30
Ashish Sharma
a9927b82b7 fix: fixes coverity reported warnings 2025-12-30 09:31:49 +05:30
Ashish Sharma
e7e31d5d39 feat: migrates esp_tee to PSA APIs 2025-12-30 09:31:49 +05:30
Li Shuai
053e62dde9 fix(esp_tee): fix cpu lockup reset issue caused by REE stack underflow test case 2025-12-30 11:47:49 +08:00
armando
513f424769 ci(tee): c5 c61 mspi mmu can tell addr error 2025-12-26 01:04:45 +00:00
Laukik Hase
f6b8795435 ci(esp_tee): Sync the build manifest file and test scripts for ESP-TEE examples 2025-12-08 18:26:03 +05:30
Mahavir Jain
81c961a656 Merge branch 'refactor/esp_tee_soc_cap' into 'master'
feat(esp_tee): Mark ESP32-H2 as a supported target for ESP-TEE

See merge request espressif/esp-idf!43434
2025-12-08 14:11:15 +05:30
Laukik Hase
90d6394911 feat(esp_tee): Support ECDSA secp384r1 keys in TEE secure storage 2025-12-04 11:16:29 +05:30
Laukik Hase
c88f9c3be1 feat(esp_tee): Mark ESP32-H2 as a supported target for ESP-TEE 2025-11-25 10:13:31 +05:30
Laukik Hase
7c24682643 feat(esp_tee): Add support for the RISC-V H/W stack guard mechanism 2025-11-24 18:49:06 +05:30
harshal.patil
dac0bbfcc2 change(mbedtls): Generalize key source union for the hardware ECDSA context 2025-11-17 12:34:09 +05:30
Laukik Hase
b6a51f0ff6 ci(esp_tee): Enable the TEE examples for ESP32-C61 2025-11-12 12:48:26 +05:30
Laukik Hase
5b80a58953 ci(esp_tee): Enable the TEE test-apps for ESP32-C61 2025-11-07 14:54:16 +05:30
Laukik Hase
bbdd1499f1 feat(esp_tee): Support for ESP32-C61 - the esp_tee component 2025-11-07 14:54:11 +05:30
Laukik Hase
e27e0eb6a7 ci(esp_tee): Remove incorrect error checks for TEE flash protection tests
- Also fixed coverity issue from TEE secure storage
2025-11-06 12:22:36 +05:30
Laukik Hase
052f380262 ci(esp_tee): Re-enable the TEE test-apps for ESP32-C5 2025-11-04 11:33:51 +05:30