Skip to content

Commit

Permalink
[ESP32] Initialize the KVS partition when nvs encryption is enabled (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamdp authored and pull[bot] committed Sep 20, 2023
1 parent 5bb439f commit 1610608
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/platform/ESP32/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ CHIP_ERROR ConfigurationManagerImpl::Init()
err = MapConfigError(esp_err);
SuccessOrExit(err);
}

esp_err = nvs_flash_secure_init_partition(CHIP_DEVICE_CONFIG_CHIP_KVS_NAMESPACE_PARTITION, &cfg);
if (esp_err == ESP_ERR_NVS_NO_FREE_PAGES || esp_err == ESP_ERR_NVS_NEW_VERSION_FOUND)
{
ChipLogError(DeviceLayer, "Failed to initialize NVS partition %s err:0x%02x",
CHIP_DEVICE_CONFIG_CHIP_KVS_NAMESPACE_PARTITION, esp_err);
err = MapConfigError(esp_err);
SuccessOrExit(err);
}
#else
// Initialize the nvs partitions,
// nvs_flash_init_partition() will initialize the partition only if it is not already initialized.
Expand Down

0 comments on commit 1610608

Please sign in to comment.