fix(spi_flash): Fix flash encryption write verify,

Closes https://github.com/espressif/esp-idf/issues/15380
This commit is contained in:
C.S.M
2025-02-27 15:20:20 +08:00
parent 4f968c3fc5
commit add27dfbd3
3 changed files with 24 additions and 0 deletions

View File

@@ -1378,11 +1378,31 @@ esp_err_t esp_flash_write_encrypted(esp_flash_t *chip, uint32_t address, const v
COUNTER_ADD_BYTES(write, encrypt_byte);
#if CONFIG_SPI_FLASH_VERIFY_WRITE
if (lock_once == true) {
err = s_encryption_write_unlock(chip);
if (err != ESP_OK) {
bus_acquired = false;
//Error happens, we end flash operation. Re-enable cache and flush it
goto restore_cache;
}
bus_acquired = false;
}
err = s_verify_write(chip, row_addr, encrypt_byte, (uint32_t *)encrypt_buf, is_encrypted);
if (err != ESP_OK) {
//Error happens, we end flash operation. Re-enable cache and flush it
goto restore_cache;
}
if (lock_once == true) {
err = s_encryption_write_lock(chip);
if (err != ESP_OK) {
bus_acquired = false;
//Error happens, we end flash operation. Re-enable cache and flush it
goto restore_cache;
}
bus_acquired = true;
}
#endif //CONFIG_SPI_FLASH_VERIFY_WRITE
}