Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Y��IA))��->!�Pb4k��J�ʬHe���toȡ��K�/��؆��r��fM��D;��|(E
20 changes: 12 additions & 8 deletions components/bootloader_support/src/esp_image_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <soc/cpu.h>
#include <esp_image_format.h>
#include <esp_secure_boot.h>
#define LOG_LOCAL_LEVEL ESP_LOG_ERROR
#include <esp_log.h>
#include <bootloader_flash.h>
#include <bootloader_random.h>
Expand Down Expand Up @@ -166,15 +167,18 @@ goto err;
rewritten the header - rely on esptool.py having verified the bootloader at flashing time, instead.
*/
if (!is_bootloader) {
#ifdef CONFIG_SECURE_BOOT_ENABLED
// secure boot images have a signature appended
err = verify_secure_boot_signature(sha_handle, data);
#else
// No secure boot, but SHA-256 can be appended for basic corruption detection
if (sha_handle != NULL) {
err = verify_simple_hash(sha_handle, data);
//#ifdef CONFIG_SECURE_BOOT_ENABLED
if (esp_secure_boot_enabled()) {
// secure boot images have a signature appended
err = verify_secure_boot_signature(sha_handle, data);
//#else
} else {
// No secure boot, but SHA-256 can be appended for basic corruption detection
if (sha_handle != NULL) {
err = verify_simple_hash(sha_handle, data);
}
}
#endif // CONFIG_SECURE_BOOT_ENABLED
//#endif // CONFIG_SECURE_BOOT_ENABLED
} else { // is_bootloader
// bootloader may still have a sha256 digest handle open
if (sha_handle != NULL) {
Expand Down
7 changes: 6 additions & 1 deletion examples/wifi/scan/sdkconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ CONFIG_BOOTLOADER_VDDSDIO_BOOST=y
#
# Security features
#
CONFIG_SECURE_BOOT_ENABLED=
CONFIG_SECURE_BOOT_ENABLED=y
CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH=
CONFIG_SECURE_BOOTLOADER_REFLASHABLE=y
CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES=y
CONFIG_SECURE_BOOT_SIGNING_KEY="secure_boot_signing_key.pem"
CONFIG_SECURE_BOOT_INSECURE=
CONFIG_FLASH_ENCRYPTION_ENABLED=

#
Expand Down
5 changes: 5 additions & 0 deletions examples/wifi/scan/secure_boot_signing_key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEICMyAIK9+SQEoSM06ju1q2PHfyQf34uN0J6WS0OFwP9OoAoGCCqGSM49
AwEHoUQDQgAEWc/nSUEpKYnULT4h7AVQYjRr6AK5SpzKrEhlgpmjdBBvyKHFBopL
oS+5nNiGlPdym8YYZk3THReXRDv+/3woRQ==
-----END EC PRIVATE KEY-----
1 change: 1 addition & 0 deletions examples/wifi/scan/signature_verification_key.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Y��IA))��->!�Pb4k��J�ʬHe���toȡ��K�/��؆��r��fM��D;��|(E