fix(nvs_sec_provider): add option to skip reset when nvs_keys is missing (IDFGH-16597) #17710
+13
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
NVS flash encrytpion rely on nvs_keys partition and it will not work when such partition is missing. In aaf1f86 there was added a check if nvs_keys partition is present with strong enforcement - it will return ESP_FAIL in early startup step, which causes abort() and reset loop of an application.
aaf1f86 change was available since v5.4 and it was not even mentioned in release notes, but it creates a regression which can brick devices. This strong enforcement is blocking ability to develop an application which can operate with NVS encrytpion (based on nvs_keys) and also operate without NVS encryption (when nvs_keys is missing).
Current fix adds a menuconfig option which allow to skip returning ESP_FAIL when partition is missing. Then application can decide in runtime what should be done when it's missing - instead of reset in early startup phase.
Related
Closes #17703
Testing
In general, this "return ESP_FAIL" was not present in earlier versions of nvs_sec_provider and whole component can handle missing nvs_keys partition (there are error logs in such scenarios, which is expected).
I run code with this flag enabled and disabled, with and without nvs_keys partition. All work as expected.
Checklist
Before submitting a Pull Request, please ensure the following: