Skip to content

Commit

Permalink
Merge branch 'bugfix/encrypted_flash_write_safe_addr_v5.1' into 'rele…
Browse files Browse the repository at this point in the history
…ase/v5.1'

fix(spi_flash): check for safe write address in encrypted flash API (v5.1)

See merge request espressif/esp-idf!29205
  • Loading branch information
mahavirj committed Feb 27, 2024
2 parents dcf187f + f1ced53 commit 35713b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/spi_flash/esp_flash_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1130,11 +1130,13 @@ esp_err_t IRAM_ATTR esp_flash_write_encrypted(esp_flash_t *chip, uint32_t addres
#endif //CONFIG_SPI_FLASH_VERIFY_WRITE

esp_err_t err = rom_spiflash_api_funcs->chip_check(&chip);
VERIFY_CHIP_OP(write);
// Flash encryption only support on main flash.
if (chip != esp_flash_default_chip) {
return ESP_ERR_NOT_SUPPORTED;
}
if (err != ESP_OK) return err;
CHECK_WRITE_ADDRESS(chip, address, length);

if (buffer == NULL || address + length > chip->size) {
return ESP_ERR_INVALID_ARG;
}
Expand Down

0 comments on commit 35713b9

Please sign in to comment.