nvs_flash: Modify the default NVS initialization API with internal nvs encryption

handling (only when nvs encryption is enabled)
    * NVS Encryption will now be turned on by default with flash encryption
    * Updated the flash encryption example to shocase NVS encryption
    along with information on how to configure and use NVS encryption
    * Updated respective test case
    * Added two partition tables for NVS encryption
     i) Table 1- Single factory app, no OTA, encrypted NVS
     ii) Table 2- Factory app, Two OTA, encrypted NVS
This commit is contained in:
Aditya Patwardhan
2020-12-15 08:31:39 +05:30
committed by bot
parent b77c85c1e1
commit a02be97fda
14 changed files with 164 additions and 9 deletions

View File

@@ -16,6 +16,7 @@
#include "esp_partition.h"
#include "esp_flash_encrypt.h"
#include "esp_efuse_table.h"
#include "nvs_flash.h"
static void example_print_chip_info(void);
static void example_print_flash_encryption_status(void);
@@ -41,6 +42,13 @@ void app_main(void)
example_print_chip_info();
example_print_flash_encryption_status();
example_read_write_flash();
/* Initialize the default NVS partition */
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
}