feat(security): add api to check flash is encrypted#67
Conversation
👋 Hello erhankur, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
There was a problem hiding this comment.
Pull request overview
Adds a new security-related API to query whether flash encryption is enabled, exposing it through the public esp-stub-lib/security.h interface and wiring it into target/common implementations.
Changes:
- Add
stub_lib_flash_encryption_is_enabled()public API andstub_target_flash_encryption_is_enabled()internal target hook. - Implement the check via ROM eFuse helper on most targets, with explicit target overrides for ESP32 and ESP8266.
- Export the required ROM symbol alias (
esp_rom_efuse_flash_encryption_enabled) for multiple targets via*.rom.api.ld.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/target/esp8266/src/security.c | Adds ESP8266 implementation returning false for flash encryption enabled check. |
| src/target/esp32/src/security.c | Adds ESP32-specific eFuse register-based implementation. |
| src/target/common/src/security.c | Adds weak default implementation calling ROM eFuse helper. |
| src/target/base/include/target/security.h | Extends internal target security interface with new boolean API. |
| src/security.c | Adds top-level library API forwarding to target implementation. |
| include/esp-stub-lib/security.h | Exposes new public API declaration. |
| example/stub_main.c | Demonstrates/logs flash encryption enabled status in example security routine. |
| src/target/esp32s3/ld/esp32s3.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
| src/target/esp32s2/ld/esp32s2.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
| src/target/esp32p4/ld/esp32p4.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
| src/target/esp32h4/ld/esp32h4.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
| src/target/esp32h21/ld/esp32h21.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
| src/target/esp32h2/ld/esp32h2.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
| src/target/esp32c61/ld/esp32c61.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
| src/target/esp32c6/ld/esp32c6.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
| src/target/esp32c5/ld/esp32c5.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
| src/target/esp32c3/ld/esp32c3.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
| src/target/esp32c2/ld/esp32c2.rom.api.ld | Exports ROM alias for flash encryption enabled helper. |
|
@radimkarnis @Dzarda7 I might be missing efuse related functionality for all targets. PTAL |
b7f8658 to
541164e
Compare
|
LGTM, I would just consider renaming the function as Regarding the eFuse, you will need to add support for eFuse reading and writing? |
541164e to
96e788b
Compare
Good point. Renamed as We have a task to update efuses from jtag. So it will be nice to have it in the stub-lib |
Add a new API to report whether flash encryption is enabled.