150 Commits

Author SHA1 Message Date
Mahavir Jain 96194f19a6 Merge branch 'fix/esp-tee-validation-clobber-and-deref-before-check' into 'master'
fix(esp_tee): prevent validation clobbering and deref-before-check in secure services

See merge request espressif/esp-idf!47589
2026-04-21 11:17:31 +05:30
Aditya Patwardhan 2de0ed6a2b 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-14 14:41:59 +05:30
Laukik Hase 764626a1b7 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-13 12:43:26 +05:30
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
harshal.patil 398d9ea9cd fix(esp_security): Add more validation checks 2026-03-20 11:15:23 +05:30
harshal.patil 0db717b9ec feat(esp_ds): Support using the AES key used by DS peripheral for encrypting params 2026-03-20 11:15:23 +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
harshal.patil 8036017951 feat(mbedtls/esp_mac): Support Key Manager key using the ESP-HMAC PSA interface 2026-03-03 18:40:31 +05:30
harshal.patil 163e0974b3 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-03 18:36:18 +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
harshal.patil 0c8fbdcc83 feat(esp_tee/tee_sec_storage): Use PSA interface internally 2026-01-31 13:30:58 +05:30
Mahavir Jain 14f0185000 Merge branch 'fix/tee_apm_hal_linker_placement' into 'master'
fix(esp_tee): Fix incorrect path of APM HAL in the TEE linker scripts

See merge request espressif/esp-idf!45459
2026-01-29 09:48:59 +05:30
Michael (XIAO Xufeng) 5984b29af5 Merge branch 'refactor/spi_flash_private' into 'master'
refactor(spi_flash): reorganize header files, improve encapsulation and simplify ROM implementation

See merge request espressif/esp-idf!44347
2026-01-28 17:39:51 +08:00
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
Mahavir Jain e79f840bb7 Merge branch 'fix/tee_sb_attest_crash' into 'master'
fix(esp_tee): Fix TEE attestation stack protection fault with secure boot enabled

See merge request espressif/esp-idf!45272
2026-01-23 11:38:52 +05:30
Xiao Xufeng 8dbf23630a refactor(spi_flash): reorganize header files and improve API encapsulation
This commit reorganizes SPI flash header files to better reflect their
visibility and intended usage:

1. Rename `esp_flash_port/` to `esp_flash_chips/`:
   - Better reflects that these headers are for chip driver implementations
   - All chip driver headers moved to `esp_flash_chips/` directory
   - Added README.md explaining semi-public nature of these headers

2. Move internal headers to `esp_private/`:
   - `esp_flash_internal.h` -> `esp_private/esp_flash_internal.h`
   - `memspi_host_driver.h` -> `esp_private/memspi_host_driver.h`

3. Move chip driver related headers to `esp_flash_chips/`:
   - `esp_private/esp_flash_types.h` -> `esp_flash_chips/esp_flash_types.h`
   - `spi_flash/spi_flash_defs.h` -> `esp_flash_chips/spi_flash_defs.h`
   - `spi_flash_override.h` -> `esp_flash_chips/spi_flash_override.h`
   - All `spi_flash_chip_*.h` headers moved to `esp_flash_chips/`

4. Code improvements:
   - Remove unused includes (e.g., `spi_flash_override.h` from `cache_utils.c`)
   - Use public API `esp_flash_get_size()` instead of direct member access
   - Add `esp_flash_is_quad_mode` to linker.lf for IRAM placement

5. Documentation updates:
   - Add README.md in `esp_flash_chips/` explaining semi-public headers
   - Update programming guide with warnings about internal headers
   - Update both English and Chinese documentation

6. Update all references across the codebase:
   - Update includes in `spi_flash` component
   - Update `bootloader_support`, `app_update`, `esp_tee`, `espcoredump`
   - Update example projects

Breaking changes:
- Headers moved to new locations require include path updates
- `custom_flash_driver` example temporarily disabled until external
  components are updated
2026-01-23 03:38:54 +08:00
Aditya Patwardhan eb4a871eca refactor(esp_hal_security): Updated esp_hal_security build and includes 2026-01-21 10:02:44 +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 89f555d698 feat(esp_tee): Migrate TEE attestation to the PSA interface 2026-01-16 12:28:57 +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
Alexey Lapshin 676ae296ff fix(esp_tee): build esp_tee only with CONFIG_LIBC_NEWLIB to reduce size 2025-12-03 13:31:42 +07:00
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 f533502324 feat(esp_tee): Add support for TEE secure storage encryption 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