From 294fe8238c81e2ee4378b69d43f4c622b54e1f6a Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Fri, 22 Jan 2021 15:33:39 +0530 Subject: [PATCH] Revert "esp_partition: disable encrypted reads/writes if flash encryption is disabled" This reverts commit bf35ef1ce7b7db30d499d4058d6a4f39ba467fca. It has been noticed that there are scenarios where even though firmware is not enabled with flash encryption config feature, it should be able to write to encrypted partitions. This revert adds the feature back which was removed around v4.0 timelines, and same change will be backported to all releases (upto v4.0) for consistency. --- components/spi_flash/partition.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/components/spi_flash/partition.c b/components/spi_flash/partition.c index 4457d63360..718e326aa0 100644 --- a/components/spi_flash/partition.c +++ b/components/spi_flash/partition.c @@ -349,7 +349,6 @@ esp_err_t esp_partition_read(const esp_partition_t* partition, return spi_flash_read(partition->address + src_offset, dst, size); #endif // CONFIG_SPI_FLASH_USE_LEGACY_IMPL } else { -#if CONFIG_SECURE_FLASH_ENC_ENABLED if (partition->flash_chip != esp_flash_default_chip) { return ESP_ERR_NOT_SUPPORTED; } @@ -367,9 +366,6 @@ esp_err_t esp_partition_read(const esp_partition_t* partition, memcpy(dst, buf, size); spi_flash_munmap(handle); return ESP_OK; -#else - return ESP_ERR_NOT_SUPPORTED; -#endif // CONFIG_SECURE_FLASH_ENC_ENABLED } } @@ -391,14 +387,10 @@ esp_err_t esp_partition_write(const esp_partition_t* partition, return spi_flash_write(dst_offset, src, size); #endif // CONFIG_SPI_FLASH_USE_LEGACY_IMPL } else { -#if CONFIG_SECURE_FLASH_ENC_ENABLED if (partition->flash_chip != esp_flash_default_chip) { return ESP_ERR_NOT_SUPPORTED; } return spi_flash_write_encrypted(dst_offset, src, size); -#else - return ESP_ERR_NOT_SUPPORTED; -#endif // CONFIG_SECURE_FLASH_ENC_ENABLED } }