Merge branch 'bugfix/esp32_encrypted_flash_write' into 'master'

spi_flash: esp32: fix regression in encrypted flash write

See merge request espressif/esp-idf!9286
This commit is contained in:
Angus Gratton 2020-06-26 14:35:43 +08:00
commit d02edc2bd1

View file

@ -35,15 +35,11 @@ static inline void IRAM_ATTR spi_flash_guard_end(void)
esp_rom_spiflash_result_t IRAM_ATTR spi_flash_write_encrypted_chip(size_t dest_addr, const void *src, size_t size) esp_rom_spiflash_result_t IRAM_ATTR spi_flash_write_encrypted_chip(size_t dest_addr, const void *src, size_t size)
{ {
const uint8_t *ssrc = (const uint8_t *)src; const uint8_t *ssrc = (const uint8_t *)src;
esp_rom_spiflash_result_t rc; esp_rom_spiflash_result_t rc = ESP_ROM_SPIFLASH_RESULT_OK;
assert((dest_addr % 16) == 0); assert((dest_addr % 16) == 0);
assert((size % 16) == 0); assert((size % 16) == 0);
rc = esp_rom_spiflash_unlock();
if (rc != ESP_ROM_SPIFLASH_RESULT_OK) {
return rc;
}
/* esp_rom_spiflash_write_encrypted encrypts data in RAM as it writes, /* esp_rom_spiflash_write_encrypted encrypts data in RAM as it writes,
so copy to a temporary buffer - 32 bytes at a time. so copy to a temporary buffer - 32 bytes at a time.