The bounds check `pos->offset + pos->size > chip_size` can silently
wrap around when both offset and size are large uint32_t values,
bypassing the validation entirely.
Use `pos->size > chip_size - pos->offset` instead, which is safe
because pos->offset <= chip_size is already verified by the first
condition in the same expression.
Found via https://github.com/Eun0us/esp-fuzzer
Additionally, always enable the partition MD5 check if flash encryption is on in
Release mode. This ensures the partition table ciphertext has not been modified
(CVE-2021-27926).
The exception is pre-V3.1 ESP-IDF bootloaders and partition tables, which
don't have support for the MD5 entry.
1. separate rom include files and linkscript to esp_rom
2. modefiy "include rom/xxx.h" to "include esp32/rom/xxx.h"
3. Forward compatible
4. update mqtt
* App access functions are all flash encryption-aware
* Documentation for flash encryption
* Partition read/write is flash aware
* New encrypted write function