esptool write-flash should --encrypt when CONFIG_SECURE_FLASH_ENC_ENABLED #3452
Unanswered
rtyle
asked this question in
Component enhancements
Replies: 1 comment
-
|
🏷️ I've automatically added the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Component name
esp32
Link to component documentation on our website
https://esphome.io/components/esp32/
Describe the enhancement
I have secrets that my device needs to know at runtime. I would like these secrets to be protected, at rest, with flash encryption.
https://docs.espressif.com/projects/esp-idf/en/stable/esp32/security/flash-encryption.html
An esphome
esp32component with aframeworkofesp-idfandsdkconfig_optionsthat includeCONFIG_SECURE_FLASH_ENCRYPTION_AES256: "y"is what aprojectneeds for encrypted flash.esphome run project.yamlwill properly useesptooltowrite-flash, and reset the device over USB.The flash will have been written unencrypted.
The second stage bootloader will
Unfortunately, any subsequent
esphome run project.yaml(oresphome upload project.yaml) will fail as it will result in unencrypted images being written to flash when the first stage bootloader expects encrypted images.The first stage bootloader will go into an infinite loop complaining forever - something like
The
projectcan be resurrected by flashing the whole firmware.factory.bin image with the--encryptoption.Which version of ESPHome has the issue?
2025.11.0-dev
What type of installation are you using?
pip
What platform are you using?
ESP32
Component causing the issue
esp32 esp-idf
YAML Config
Anything in the logs that might be useful for us?
partitions.csv
Additional information
I made the following change in my esphome fork to fix the problem that I am having right now.
Unfortunately, this change would perform an --encrypt write-flash on the very first flash.
Hopefully, this would be ignored on a device that is not yet set up for encryption but I do not know.
I am already past that point with my device.
Use cases
I have developed an SMTP component that can send email through smtp.gmail.com.
To do so requires creating a Google account with an application password and sharing that with my esphome device.
Even though I created a dedicated Google account for this purpose, I want to protect the account credentials written to flash by encryption.
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions