Commit Graph
144 Commits
Author SHA1 Message Date
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
Aditya Patwardhan e26b33cc3a fix(esp_tee): Update linker scripts for apm_hal move to esp_hal_security 2026-01-30 17:12:55 +05:30
Aditya Patwardhan 4d3cfefc2e refactor(esp_hal_security): Updated esp_hal_security build and includes 2026-01-30 17:12:54 +05:30
Laukik Hase a6d39908f7 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-29 11:49:17 +05:30
Laukik Hase f18697b544 refactor(esp_tee): Remove support for ECDSA secp192r1 keys in TEE secure storage 2026-01-29 11:49:16 +05:30
Laukik Hase b470f08c94 refactor(esp_tee): Update TEE attestation tests and examples to use the PSA interface 2026-01-29 11:49:16 +05:30
Laukik Hase 1752290f02 feat(esp_tee): Migrate TEE attestation to the PSA interface 2026-01-29 11:49:15 +05:30
Laukik Hase d826448fd0 ci(esp_tee): Optimize the TEE pytest script 2026-01-29 11:49:15 +05:30
Laukik Hase 304adb120b 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.
2026-01-29 11:49:15 +05:30
Laukik Hase 421246323a feat(esp_tee): Add support for the RISC-V H/W stack guard mechanism 2026-01-29 11:49:14 +05:30
Laukik Hase 39f392f943 feat(esp_tee): Support ECDSA secp384r1 keys in TEE secure storage 2026-01-29 11:49:13 +05:30
Xiao Xufeng 3411286544 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-29 03:28:30 +08:00
Ashish Sharma b02538834c fix: resolves MR comments 2025-12-20 23:02:25 +08:00
Ashish Sharma 5d5ba9d008 fix: migrate PSA SHA driver to be similar to parallel engine port 2025-12-19 11:06:41 +08:00
Ashish Sharma 76287081ea feat: code cleanup 2025-12-19 07:29:43 +08:00
Ashish Sharma 3dea3aae1d fix: fixes coverity reported warnings 2025-12-19 07:29:43 +08:00
Ashish Sharma aa88c81dfb fix(wpa_supplicant): revert changes to dpp_crypto 2025-12-19 07:29:08 +08:00
Ashish Sharma f306dbea84 feat(mbedtls): migrates ESP-TEE with PSA APIs 2025-12-19 07:28:33 +08:00
Ashish Sharma a088d2ccdc feat(mbedtls): fix build errors with PSA migration 2025-12-18 21:18:58 +08:00
Alexey Lapshin 068fefad68 fix(esp_tee): build esp_tee only with CONFIG_LIBC_NEWLIB to reduce size 2025-12-06 00:08:35 +07:00
Jiang Jiang Jian ee4be1af57 Merge branch 'feat/flash_enc_using_key_manager_v6.0' into 'release/v6.0'
Support Flash Encryption using Key Manager (v6.0)

See merge request espressif/esp-idf!43459
2025-11-24 10:35:48 +08:00
harshal.patil 792c93c597 change(mbedtls): Generalize key source union for the hardware ECDSA context 2025-11-20 11:37:07 +05:30
Laukik Hase 01f5050f6f ci(esp_tee): Enable the TEE examples for ESP32-C61 2025-11-20 11:01:29 +05:30
Laukik Hase 46de215007 ci(esp_tee): Enable the TEE test-apps for ESP32-C61 2025-11-19 10:57:43 +05:30
Laukik Hase 65436262d5 feat(esp_tee): Add support for TEE secure storage encryption for ESP32-C61 2025-11-19 10:57:43 +05:30
Laukik Hase 2394e9451d feat(esp_tee): Support for ESP32-C61 - the esp_tee component 2025-11-19 10:57:42 +05:30
Laukik Hase f307e80fe2 feat(esp_tee): Enable MSPI tuning for Flash and PSRAM 2025-11-13 15:38:13 +05:30
Laukik Hase f20351eb3b fix(esp_tee): Use HAL APIs instead of ROM APIs for SPI flash service calls
Currently, REE SPI flash HAL operations are routed as service calls to TEE,
but the TEE implementation incorrectly uses ROM APIs instead of HAL APIs.
This leads to issues and is not the recommended approach.
2025-11-13 15:38:12 +05:30
Mahavir Jain 5ddfb043b9 Merge branch 'fix/add_bootloader_and_partition_table_as_encrypted_flash_targets_v6.0' into 'release/v6.0'
Add Bootloader, Partition Table and ESP-TEE as dependencies for encrypted-flash (v6.0)

See merge request espressif/esp-idf!43033
2025-11-13 09:37:57 +05:30
Laukik Hase 73b6e718f2 ci(esp_tee): Remove incorrect error checks for TEE flash protection tests
- Also fixed coverity issue from TEE secure storage
2025-11-06 17:19:56 +05:30