esp_flash_encrypt_region() function
Encrypt-in-place a block of flash sectors
Arguments
src_addr
Source offset in flash. Should be multiple of 4096 bytes.
data_length
Length of data to encrypt in bytes. Will be rounded up to next multiple of 4096 bytes.
Return value
ESP_OK if all operations succeeded, ESP_ERR_FLASH_OP_FAIL if SPI flash fails, ESP_ERR_FLASH_OP_TIMEOUT if flash times out.
Notes
This function resets RTC_WDT between operations with sectors.