espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
12.56k stars 7.02k forks source link

Fatfs partition Flash Encryption. (IDFGH-12677) #13668

Open hussainhadi673 opened 3 weeks ago

hussainhadi673 commented 3 weeks ago

I have this partition table:

# Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x603F00, nvs_key, data, nvs_keys,0x64F000,0x1000, storage, data, fatfs, 0x650000,0x990000,encrypt coredump, data, coredump,0xFE0000,0x10000,

Now I have turned on the flash encryption (Development Mode) and upon the first boot my app0 and storage is encrypted. Now my question is that at the time of first boot my fatfs is empty, and in my software I store some data in Fatfs on run-time, how will this new data stored on fatfs will get encrypted ? every time I change data in fatfs, how does flash encryption caters this ?

rrtandler commented 1 week ago

Hi hussainhadi673, The fatfs component uses esp_partition component to read / write data to the "storage" parttition. These r/w functions are observing the encrypted flag of the partition table and if ESP32 flash encryption is active, the data is encrypted during the write operation and decrypted during read operations. This happens transparently for the user of fatfs component API.