Commit Graph

452 Commits

Author SHA1 Message Date
sonika.rathi
3ad5251819 fix(nvs_flash): delete temporary NVSPartition after erase 2026-07-17 10:57:27 +02:00
Aditya Patwardhan
970b54962f fix(nvs_flash): zeroize XTS contexts when encrypted partition is destroyed
NVSEncryptedPartition held two XTS_CONTEXT members (mEctxt, mDctxt) for
encryption / decryption. Their AES round keys are derived from the NVS
encryption key (HMAC-derived or plaintext from nvs_keys partition) and
therefore are sensitive secrets.

The destructor was empty, so when the NVS encrypted partition object
was destroyed -- on nvs_flash_deinit_partition(), on initialization
errors, and on any other teardown path -- the XTS round keys were left
in DRAM until the freed object's memory happened to be overwritten by
a later allocation. A subsequent stack/heap leak primitive would
recover the AES key from those bytes.

Fix:
* Initialize both XTS contexts in the constructor so the destructor's
  free path is always safe (previously xts_init was only called in
  init(); destruction before init() would have run xts_free on an
  uninitialized struct).
* Provide a real destructor that calls XTS_FUNC(xts_free) on both
  contexts, which performs mbedtls_platform_zeroize / esp_aes_xts free
  semantics on the underlying AES contexts.
2026-07-16 10:34:01 +05:30
radek.tandler
daf4796ef6 fix(nvs_flash): fixed cleanup after nvs_set_blob failed on ESP_ERR_NVS_NOT_ENOUGH_SPACE
- fixed identification of blob parts to be cleaned by using right starting chunk index
  - improved localisation of blobs for cases where some of pages get reclaimed
  - created host test cases covering the edge cases above
2026-07-14 16:42:55 +02:00
Jiang Jiang Jian
ec50de41d2 Merge branch 'bugfix/nvs-blockdev-skip-nvs-ram-test_v6.0' into 'release/v6.0'
fix(nvs_flash): skip SPIRAM heap test on non-spiram configs (v6.0)

See merge request espressif/esp-idf!48784
2026-06-29 15:31:29 +08:00
Jiang Guang Ming
dd28e303d5 fix(mbedtls): support ROM mbedTLS crypto in bootloader 2026-05-25 10:08:25 +08:00
Jiang Guang Ming
6eb7f181a2 feat(mbedtls): enable ROM mbedTLS pytest with esp32c2 rev2.0 2026-05-25 10:07:47 +08:00
sonika.rathi
71c7fb3f79 fix(nvs_flash): scope NVS unity tests to correct CI configs 2026-05-21 08:49:07 +02:00
radek.tandler
407f74a67f feat(nvs_flash): Added option enabling verification of flash erase operation 2026-03-24 07:23:12 +01:00
radek.tandler
a3e65eb7f8 feat(nvs_flash): Added purging of erased items at namespace level
- Added new option NVS_READWRITE_PURGE for nvs_open. All update and erase operations of
    the handle are wiping out the content erased items on top of just marking them erased.
  - Added new API call nvs_purge_all allowing to wipe out the existing erased items
    of the handle.
2026-03-23 10:39:38 +01:00
igor.udot
e2a8bbe639 ci: update build-test-rules to use common_components 2026-03-20 15:53:26 +08:00
Chen Jichang
04df934c05 refactor(flash_enc): move esp_flash_encryption_enabled() to efuse component 2026-03-06 18:14:22 +08:00
harshal.patil
9253fbadbc fix(nvs_flash): Use h/w accelerated AES-ECB for XTS-AES operations 2026-02-11 15:40:10 +05:30
radek.tandler
42b0ade42d fix(nvs_flash): Fixed order of page state change to allow recovery 2026-01-21 14:12:28 +01:00
Ashish Sharma
b02538834c fix: resolves MR comments 2025-12-20 23:02:25 +08:00
Ashish Sharma
88346ccec5 fix: revert back to using mbedtls sha implementation for espcoredump 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
b0da66f7e1 feat(bt): migrate mbedtls to PSA APIs 2025-12-18 21:18:58 +08:00
Ashish Sharma
b4fea9cccc feat(lwip): migrate to to PSA API interface 2025-12-18 21:18:58 +08:00
radek.tandler
b27ada2f43 refactor(nvs_flash): NVS Host tests cleaned-up and test cases commented
- Host test were refactored to allow for BDL and non-BDL NVS implementation
- Introduceed `NVSPartitionTestHelper` class replacing `PartitionEmulationFixture`
- Refactored all tests to use `NVSPartitionTestHelper` instead of legacy emulation fixture
- Removed legacy `PartitionEmulationFixture` and `PartitionEmulationFixture2` classes
- Removed `TEMPORARILY_DISABLED` macro usage by reducing partition size in applicable tests
- Enhanced test coverage and readability with comments and validation steps for each TC
- Added utility functions for partition stats tracking, file loading, and erase count check
2025-12-03 11:06:08 +01:00
radek.tandler
45c642e6d1 feat(nvs_flash): Added support for Block Data Layer storage provider
- BDL provider can be enabled vor NVS in the menuconfig option NVS_BDL_STACK
- Hierarchy of Partition class tree was adjusted and all operations were documented
- Class Partition is now derived from intrusive_list_node and ExceptionlessAllocable
- Class NVSPartition implements only the dual support for esp_partition and BDL
- Class NVSEncryptedPartition implements only encryption related extensions
2025-12-03 11:06:08 +01:00
Radek Tandler
207199a2bb Merge branch 'refactor/nvs_header_cleanup' into 'master'
Cleanup of NVS copyright notices, header pragma once and NVS related constants

See merge request espressif/esp-idf!42353
2025-10-02 15:08:45 +02:00
radek.tandler
801091c079 refactor(nvs_flash): NVS constants were consolidated
- Constant definitions depending on spi_flash were added to nvs_constants
2025-10-02 12:39:37 +02:00
radek.tandler
a11c30a3e3 refactor(nvs_flash): Adjusted copyright notices and header file pragma once 2025-10-02 12:35:50 +02:00
radek.tandler
1c6e2d2f88 fix(nvs_flash): Parsing NVS partition containing non ASCII keys 2025-10-02 05:59:14 +02:00
Laukik Hase
f565fc2481 change(nvs_flash): Add a private dependency of the nvs_sec_provider component
- Closes https://github.com/espressif/esp-idf/issues/17256
2025-09-19 10:17:46 +05:30
Laukik Hase
f60bcaaa4d feat(nvs_flash): Added an API to deregister the NVS security scheme context 2025-09-19 10:17:45 +05:30
radek.tandler
96f4f78054 ci(nvs_flash): Enabled nvs_host_test in ci 2025-09-16 20:45:25 +02:00
radek.tandler
ccb455fc63 fix(nvs_flash): Fixed host test case when legacy compatibility mode is enabled 2025-09-16 20:45:25 +02:00
radek.tandler
0f5c963a03 fix(nvs_flash): Host test adopted to the new clang initializer rules 2025-09-16 20:45:08 +02:00
radek.tandler
233a76e808 fix(nvs_flash): Fixed overwrite of V1 BLOB when legacy compatibility mode is in place 2025-09-15 16:16:28 +02:00
Alexey Lapshin
9281e78381 change(esp_libc): rename newlib component to esp_libc 2025-09-09 22:00:44 +08:00
Marek Fiala
9d35d63651 feat(cmake): Update minimum cmake version to 3.22 (whole repository) 2025-08-19 14:44:32 +02:00
Marius Vikhammer
bf84ab652a change(test_utils): moved test_utils component to tools/test_apps/components/ 2025-07-21 14:05:50 +08:00
Sudeep Mohanty
c8f68c72a7 Merge branch 'feat/remove_global_cmake_vars' into 'master'
change(esptool_py): Make esptool_py component idempotent in the build

Closes IDF-13073

See merge request espressif/esp-idf!39589
2025-07-17 17:13:49 +02:00
Sudeep Mohanty
ef4d6462e2 refactor(esptool_py): Move flash target creation to project level and add utility functions
This commit refactors the esptool_py component to provide utility
functions for flash target management instead of creating the targets
directly. Flash target creation is now moved to the project level in
build.cmake file when idf_build_executable() runs.

The following changes were done in this commit:
- Added __esptool_py_setup_tools(), __esptool_py_setup_estool_py_args()
  and __ensure_esptool_py_setup() functions to centralize esptool_py
  setup.
- Added __esptool_py_setup_main_flash_target() which is called by
  idf_build_executable() to create the flash targets.
- Updated esptool_py_flash_target(), esptool_py_custom_target() to
  accept an optional FILENAME_PREFIX argument to enable creation of
  build artifacts based on custom names.
- Create placeholder flash targets early in the build process when
  idf_build_process() is called for components to add dependencies on
  these targets.
- Moved app-flash target creation from esptool_py/CMakeLists.txt to
  build.cmake.
- Added function description to esptool_py functions.
2025-07-10 11:26:28 +02:00
Sudeep Mohanty
30083e07be refactor(esptool_py): Re-evalute dependencies of esptool_py
This commit establishes the foundation for making the esptool_py
component idempotent.

The following changes are made in this commit:

- Removes unnecessary dependency of esp_wifi component on esptool_py.
- Add missing esptool_py dependencies to components which directly use
  esptool_py specific functions or variables but do not declare a public
  or private dependency.
2025-07-10 11:26:28 +02:00
Fu Hanxi
a5257dcc39 ci: apply idf-ci pytest plugin
Removed

- target markers. Now must use target as parametrization in esp-idf
- host test markers. Now will be automatically added with linux target and qemu marker
2025-07-09 10:33:28 +02:00
Fu Hanxi
fc4b2fbc28 Merge branch 'ci/disable-plugin-idf_ci' into 'master'
ci: disable idf-ci plugin

See merge request espressif/esp-idf!39600
2025-06-04 12:12:18 +02:00
Fu Hanxi
87a5aedb85 ci: disable idf-ci plugin
this plugin will be re-enabled with compatible code in !38755
2025-06-03 08:37:56 +02:00
radek.tandler
c23c21f3c0 refactor(nvs_flash): Improved Blob performance
The findItem method was improved to use a hash list in RAM when searching for BLOB data chunks

The findItem method was extended with a parameter that returns the position of an item on the page,
if it is found

The algorithm for matching existing variable-length data (such as strings and BLOBs) with
new values was enhanced by comparing the CRC32 of the data chunks before reading the data from flash
2025-06-02 16:01:40 +02:00
Laukik Hase
033397b877 fix(esp_tee): Add standard newlib function stubs to resolve build warnings
- Disable C++ exceptions for TEE build to reduce flash footprint
2025-05-04 18:03:30 +05:30
Laukik Hase
c9f7bcd452 feat(esp_tee): Support the nvs_flash for the ESP-TEE build 2025-05-04 18:03:28 +05:30
Adam Múdry
71921a450f feat: Add NVS generator check test for CRC of non-ASCII strings 2025-04-23 05:10:29 +02:00
Radek Tandler
0b8f661c08 Merge branch 'bugfix/storage_nvs_key_overwrite' into 'master'
fix(nvs): fixed erasing of old values if new data type is not the same

Closes IDFGH-14832

See merge request espressif/esp-idf!37888
2025-04-10 20:01:35 +08:00
radek.tandler
d9bc77e422 fix(nvs): fixed erasing of old values if new data type is not the same
Closes https://github.com/espressif/esp-idf/issues/15559
2025-04-10 10:55:51 +02:00
Chen Ji Chang
c3a3cc8657 Merge branch 'feat/h4_enable_ci_build' into 'master'
feat(esp32h4): enable ESP32H4 ci build

Closes IDF-12332

See merge request espressif/esp-idf!37921
2025-03-31 23:49:48 +08:00
Peter Macko
4a1ea4b725 5.5: Update ubuntu base image for esp-env-v5.5 to 24.04, with fixed pipelines 2025-03-31 20:11:57 +08:00
Martin Vychodil
decbd36008 Merge branch 'contrib/github_pr_15656' into 'master'
fix(nvs_flash): removed usage of 'using namepsace std' in a header file (GitHub PR)

Closes IDFGH-14947

See merge request espressif/esp-idf!38086
2025-03-28 22:02:19 +08:00
Tomáš Rohlínek
be6e24370f fix(storage/nvf_flash): fixup additions from PR 2025-03-28 12:57:33 +01:00
Chen Jichang
c34b4eb882 feat(esp32h4): enable ESP32H4 ci build 2025-03-28 14:41:28 +08:00