Skip to content

Commit 51c795c

Browse files
committed
Revert: flashRead / flashWrite supports encrypted flash
Reading and writing to encrypted flash has to be aligned to 16-bytes. Also NAND way of writing (i.e. flipping 1s to 0s) will not work with spi_flash_write_encrypted. Note: spi_flash_read_encrypted will always try to decrypt data, even if it wasn't encrypted in the first place.
1 parent 9aec057 commit 51c795c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cores/esp32/Esp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,13 @@ bool EspClass::flashEraseSector(uint32_t sector)
202202
return spi_flash_erase_sector(sector) == ESP_OK;
203203
}
204204

205+
// Warning: These functions do not work with encrypted flash
205206
bool EspClass::flashWrite(uint32_t offset, uint32_t *data, size_t size)
206207
{
207-
return spi_flash_write_encrypted(offset, (uint32_t*) data, size) == ESP_OK;
208+
return spi_flash_write(offset, (uint32_t*) data, size) == ESP_OK;
208209
}
209210

210211
bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size)
211212
{
212-
return spi_flash_read_encrypted(offset, (uint32_t*) data, size) == ESP_OK;
213+
return spi_flash_read(offset, (uint32_t*) data, size) == ESP_OK;
213214
}

0 commit comments

Comments
 (0)