Yes, technically, it is sure not the same.
And no, logically, it should be the same since we should get a container filled with 0xFF irrespective encrypted/unencrypted flash is used.
Life-case example: I'm fiddling with partition-tables at the moment. For some unknown reason Espressif bootloader fails/stalls in a cycled SW_RST upon accessing a partition-table NOT FILLED with trailing 0xFF's (no matter the vaild content and MD5). Also, the
esp_partition_xxx functions abort and reboot esp32 in these conditions.
// Also, some bootloader gets crashed when "something sha256" signatures do not match another "something something whatsoever".... Okay, back to story.
Once again, the partition tables are VALID and MD5 is perfect! Why should Espressif want those shitless kilos of trailing 0xFF?!!!
Anyways, to have everything operate correctly the partition-table is first filled in memory with 0xFF and then gets populated over with records and only after that gets written to flash.
We all know that flash should be erased prior to writing hence
esp_flash_erase_regions gets into play.
Also, we know that NAND flash is written by means of zeroing.
Bingo! Further optimisation allows to get rid of the
memset(flash, 0xFF, size) call since the erased flash is already filled with 0xFF's.
Afterwards we get down to coding our major super-mega-firmware functionality happilly forgetting about this stuff.
Later on we decide to go for encryption and ... everything gets screwed because of that crap. Wtf?!
Thanks it's not a long way after the partition-table experiments so backwards tracking was quite fast.... But... This shouldn't 've happened at all!
So:
(1) Why stick to 0xFF in the meaningless part of PT ?!
(2) Why not come up with a universal
esp_flash_erase_regions() that works reliably under either encryption mode?!
(3) Why not document all this stuff properly before esp32 community gets into trouble ?!
It ain't any rocket science to have all this done properly!
Resume: I keep saying this is a bug rather than a feature.