Commit Graph

173 Commits

Author SHA1 Message Date
Laukik Hase
4c8ee351b7 ci(esp_tee): Fix tee_cli_app build failure due to heap size overflow 2026-07-28 14:53:35 +08:00
Jiang Jiang Jian
7bcd65c9be Merge branch 'fix/fix_esp_tee_iv_length_check_v6.0' into 'release/v6.0'
feat(esp_tee): ESP-TEE Security Audit fixes (v6.0)

See merge request espressif/esp-idf!50851
2026-07-22 10:37:48 +08:00
Laukik Hase
3fd876dffa feat(esp_tee): Restrict REE access to TEE-owned secure storage keys 2026-07-17 18:15:37 +05:30
Laukik Hase
c0b1a5a71c fix(esp_tee): Miscellaneous optimizations and fixes
Closes https://github.com/espressif/esp-idf/issues/18591
2026-07-17 18:15:37 +05:30
Ashish Sharma
8dc04e5fda fix(esp_tee): ensure hal assert is enabled for tee builds 2026-07-17 18:15:37 +05:30
Ashish Sharma
dc44ca9a86 fix(esp_tee): enforce MMU-map vaddr validity at the REE->TEE boundary 2026-07-17 18:15:36 +05:30
Ashish Sharma
89ba3db529 fix(esp_tee): fixes IV length check for TEE AEAD operations 2026-07-17 18:15:36 +05:30
Ashish Sharma
d85cb8d7cc fix(esp_tee): fix DS-lock leak, intr-matrix OOB, calloc overflow, attestation leak 2026-07-16 18:24:47 +08:00
Laukik Hase
bef71a9724 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-10 10:57:24 +05:30
Ashish Sharma
2c26dfc51b fix(esp_tee): fixes double panic when ESP-TEE panics 2026-07-10 10:32:32 +05:30
Ashish Sharma
dc48cc5059 fix(esp_tee): release SHA held by HMAC after crypto peripheral reset 2026-07-10 10:32:32 +05:30
Mahavir Jain
e038ca923c Merge branch 'fix/esp_tee_buffer_overflow_v6.0' into 'release/v6.0'
fix(esp_tee): fix buffer overflow (v6.0)

See merge request espressif/esp-idf!49303
2026-06-29 11:38:05 +05:30
Mahavir Jain
ce7b803aac Merge branch 'fix/esp_tee_heap_poison_v6.0' into 'release/v6.0'
fix(esp_tee): Prevent TEE from dispatching the REE heap poisoning callback (v6.0)

See merge request espressif/esp-idf!49911
2026-06-29 11:21:31 +05:30
Mahavir Jain
732111f75a Merge branch 'feat/esp_tee_backports_v6.0' into 'release/v6.0'
feat(esp_tee): Feature/fixes backports to `release/v6.0`

See merge request espressif/esp-idf!48486
2026-06-29 11:21:13 +05:30
Laukik Hase
9ce63d8dfa fix(esp_tee): Add additional input validation checks for TEE service calls 2026-06-26 17:59:26 +05:30
Laukik Hase
00cff977c6 fix(esp_tee): Avoid crypto peripherals reset with esp_restart() from REE
- Reset the crypto peripherals during TEE initialization
2026-06-26 15:07:23 +05:30
Laukik Hase
e1bbb70278 fix(esp_tee): Prevent TEE from dispatching the REE heap poisoning callback 2026-06-26 15:07:22 +05:30
Aditya Patwardhan
f82a0593e0 Merge branch 'fix/secure_boot_bootloader_ecdsa_range_gate_v6.0' into 'release/v6.0'
Add ECDSA signature bounds check in bootloader before Secure Boot verify (v6.0)

See merge request espressif/esp-idf!49633
2026-06-19 11:51:09 +05:30
harshal.patil
5ed711bc06 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-18 19:41:56 +05:30
Laukik Hase
e32bf61924 Merge branch 'fix/esp_tee_bbp_v6.0' into 'release/v6.0'
fix(esp_tee): Harden TEE secure services against REE manipulation (v6.0)

See merge request espressif/esp-idf!49369
2026-06-18 12:36:20 +05:30
Laukik Hase
39a4cf5e56 feat(esp_tee): Clear out all sensitive buffers explicitly after TEE crypto operations 2026-06-12 10:04:07 +05:30
Laukik Hase
61b88163be ci(esp_tee): Add test-case for verifying the TEE Secure Storage encryption 2026-06-12 10:04:07 +05:30
Laukik Hase
93466c1fd3 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-06-12 10:04:06 +05:30
Laukik Hase
6bd173b806 ci(esp_tee): Fix TEE test-suite failures with Secure Boot enabled 2026-06-12 10:04:04 +05:30
Laukik Hase
140e1ae1f3 ci(esp_tee): Removed common_components dependency from ESP-TEE test-apps 2026-06-12 10:03:02 +05:30
Aditya Patwardhan
94be07050f 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-10 18:06:48 +05:30
Laukik Hase
6af1af7d99 fix(esp_tee): Harden the TEE secure services against REE manipulation
- `bootloader_flash_execute_command_common`: whitelist the flash command
   opcodes the REE actually uses; reject the rest
- `spi_flash_hal_* services`: a forged `host->driver` could hijack TEE
   control flow since the HAL dispatches through it, so swap
   `host->driver` to a TEE-rodata vtable around each HAL call
- Deny partition table and bootloader writes by default and permit
  bootloader writes only when explicitly enabled via
  `CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED` option
- Protect the TEE-assigned interrupt pin configuration against REE
- Validate nested DS context pointers in start/finish_sign and bound
  the result copy to the SoC max signature size
- Fix the stack usage in service dispatcher argument parsing
2026-06-10 12:06:26 +05:30
harshal.patil
6b8f830991 fix(esp_tee): Reset crypto peripherals before the panic-induced reset 2026-06-09 15:07:55 +05:30
Alexey Lapshin
79cb80979f fix(esp_tee): fix buffer overflow 2026-06-05 12:25:29 +07:00
Xiao Xufeng
475ec39cb4 fix(mspi): fixed possible boot failure in some builds when psram is enabled
A typical scenario is: when XIP on PSRAM enabled, compiler optimization level is Os. Under certain binary layout, boot hangs and backtrace points to `esp_sleep_config_gpio_isolate`.

The root cause is that, during PSRAM initialization, it calls esp_gpio_reserve, which happens to place before the reported function. However, after call, there is no barrier before the clock adjustment in `mspi_timing_enter_low_speed_mode`. The clock gets changed when the cache is still fetching data, resulting in the corrupted data in the end of the cache line.

This commits add spi_flash_disable_cache as a barrier to make sure the cache transactions is finished before the clock switch.
2026-05-15 17:31:37 +08:00
harshal.patil
513efdf89a refactor(mbedtls/test): Move the mbedtls test app to support multiple test apps 2026-05-15 09:28:42 +05:30
Aditya Patwardhan
0e1e1e79aa fix(esp_tee): prevent validation clobbering and deref-before-check
TEE secure-service handlers had two bugs letting REE bypass
pointer-region validation:

1. valid_addr = instead of valid_addr &= in AEAD encrypt/decrypt
   and DS sign handlers, clobbering prior failed checks.
   Impact: REE writes to TEE DRAM via DS signature output, or reads
   TEE DRAM via AEAD output.

2. data->rsa_length dereferenced before data is validated in DS sign
   and DS start_sign handlers.

Fix: use &= for subsequent checks, add early return after initial
data pointer check in DS handlers.
2026-04-30 10:17:53 +05:30
Laukik Hase
440a5d1906 change(esp_tee): Move the internal memory secure service call table to IRAM
- Using PMA, the TEE IRAM is marked as R/X while TEE DRAM is marked as R/W.
  Moving the internal memory secure service call table from DRAM to IRAM
  makes it immutable.
2026-04-17 17:33:11 +05:30
Laukik Hase
7867f4a575 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-08 14:05:28 +05:30
harshal.patil
fe3b5ca898 fix(esp_security): Add more validation checks 2026-03-23 10:46:23 +05:30
harshal.patil
45d5ef45a5 feat(esp_ds): Support using the AES key used by DS peripheral for encrypting params 2026-03-23 10:46:22 +05:30
Laukik Hase
83e2777a3b 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-20 10:54:14 +05:30
Fu Hanxi
98e407ec45 Merge branch 'ci/improve-tests_v6.0' into 'release/v6.0'
tests: change wifi tests expect timeout to 60 (v6.0)

See merge request espressif/esp-idf!46545
2026-03-20 00:57:25 +01:00
harshal.patil
1daa847feb feat(mbedtls/esp_mac): Support Key Manager key using the ESP-HMAC PSA interface 2026-03-18 16:38:24 +05:30
harshal.patil
37a73ff5a4 change(mbedtls/psa_driver_esp_hmac): Use efuse key block instead of efuse block
- Maintains compatibility of the older esp_hmac_ APIs and the PSA driver
2026-03-18 16:38:23 +05:30
Fu Hanxi
84d80dd37d tests: change wifi tests expect timeout to 60
- wifi_router
- wifi_ap
- wifi_high_traffic
2026-03-12 15:59:26 +08:00
Mahavir Jain
ad25b61af6 Merge branch 'fix/externsive_mbedtls_aes_sha_tests_v6.0' into 'release/v6.0'
Re-introduce the extensive mbedtls AES and SHA tests (v6.0)

See merge request espressif/esp-idf!45591
2026-02-12 09:49:09 +05:30
Laukik Hase
68d31180f0 fix(esp_tee): Prevent IV reuse in the TEE secure storage AES-GCM service 2026-02-11 12:29:52 +05:30
harshal.patil
91c3738e81 test(mbedtls): Re-introduce the extensive AES, AES-GCM and the SHA tests
- Also extend the PSRAM encryption test to ESP32-S3
2026-02-03 13:04:32 +05:30
harshal.patil
d495ffb491 feat(esp_tee/tee_sec_storage): Use PSA interface internally 2026-02-02 10:51:31 +05:30
Mahavir Jain
062073a73b Merge branch 'feat/opaque_ecdsa_drivers_v6.0' into 'release/v6.0'
Opaque ECDSA driver (v6.0)

See merge request espressif/esp-idf!45432
2026-02-02 10:49:12 +05:30
Jiang Jiang Jian
31056d5db9 Merge branch 'refactor/spi_flash_private_v6.0' into 'release/v6.0'
refactor(spi_flash): reorganize header files, improve encapsulation and simplify ROM implementation (v6.0)

See merge request espressif/esp-idf!45488
2026-02-02 10:57:34 +08:00
harshal.patil
a9598b3304 feat(esp_tee): Support deterministic ECDSA signatures for ESP-TEE based keys 2026-01-31 10:59:16 +05:30
harshal.patil
5c55790f54 feat(mbedtls/ecdsa): Introduce PSA ECDSA driver 2026-01-31 10:59:11 +05:30
Mahavir Jain
78464dfab7 Merge branch 'refactor/create_esp_hal_security_v6.0' into 'release/v6.0'
refactor: Created esp_hal_security component (v6.0)

See merge request espressif/esp-idf!45349
2026-01-31 10:28:48 +05:30