I understand that flash allows bits to go from 1->0, then we can reset a 4k page back all at once from 0->1
Yet esp-idf allows just 32bit writes to an encrypted partition.
https://docs.espressif.com/projects/esp ... ypt-config
> AES-256 operates on 16 byte blocks of data. The flash encryption
engine encrypts and decrypts data in 32 byte blocks, two AES blocks in series.
Understanding encryption, it's fairly random how those 32 bits end up in value.
Can I
A) Expect that writing to the same 32 bits will result in corrupted data? (because no transparent page 0->1)
B) Expect that if any bits need to go from 0->1 that the whole 4k page will be transparently backed up, erased, then re-written correctly as long as the power doesn't go out
C) Expect that if any bits need to go from 0->1 that the whole 4k page will be transparently backed up, erased, then re-written correctly in some magical atomic fashion immune to power outage? (haha)
And if A) rewriting the same bits can result in corruption, how does the FS leave all bits at 1* until encryption is necessary? Just don't touch the other bits other than the 32 bits in question? (would be technically fine as long as I know)
Thanks a bunch for anyone who just happens to know the answer.
Transparent FS Encryption "Rewrite" Data Clarification
Re: Transparent FS Encryption "Rewrite" Data Clarification
A. Yes
B. With flash and partition apis you need to do this yourself. With NVS and fatfs it is handled by the implementation.
C. See below
https://docs.espressif.com/projects/esp ... flash.html
B. With flash and partition apis you need to do this yourself. With NVS and fatfs it is handled by the implementation.
C. See below
https://docs.espressif.com/projects/esp ... flash.html
https://docs.espressif.com/projects/esp ... lling.htmlThe library does try to recover from conditions when flash memory is in an inconsistent state. In particular, one should be able to power off the device at any point and time and then power it back on. This should not result in loss of data, except for the new key-value pair if it was being written at the moment of powering off.
Safety mode. The data is first saved to flash memory, and after the sector is erased, the data is saved back. If a device is powered off, the data can be recovered as soon as the device boots up.
Re: Transparent FS Encryption "Rewrite" Data Clarification
Thanks Wifive!
Do you happen to know, does the spiflash for fatfs refer to the onboard SPI flash (I assume a particular partition) within the WROOM32 module? Or does it refer ONLY to offboard spiflash (just like offboard sdcard)?
Do you happen to know, does the spiflash for fatfs refer to the onboard SPI flash (I assume a particular partition) within the WROOM32 module? Or does it refer ONLY to offboard spiflash (just like offboard sdcard)?
Re: Transparent FS Encryption "Rewrite" Data Clarification
Yes, internal/onboard. The encryption only works with internal flash. In esp-idf 4.x you can use filesystems on external flash but there is no encryption.
Re: Transparent FS Encryption "Rewrite" Data Clarification
Thanks WiFive!