From aa39a5cfb16b36fae48f31f85bc988d8b3da64cc Mon Sep 17 00:00:00 2001 From: odudex Date: Wed, 11 Nov 2026 15:58:19 -0300 Subject: [PATCH 01/20] feat(security): enable Secure Boot from Settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A sdkconfig.secure bootloader no longer burns secure boot on its first boot (bootloader_components/secure_boot_opt_in). Settings → Security → Secure Boot does it, after checking that the running app is signed by one of the three embedded key digests and the flashed bootloader by all of them. `just sbtest-flash` runs the whole flow on virtual eFuses with test keys. --- .gitignore | 1 + .justfile | 34 ++ .../secure_boot_opt_in/CMakeLists.txt | 17 + .../secure_boot_opt_in/secure_boot_opt_in.c | 17 + main/CMakeLists.txt | 6 +- main/core/sb_digests.cmake | 37 +++ main/core/sbv2.c | 138 ++++++++ main/core/sbv2.h | 29 ++ main/core/secure_boot.c | 272 ++++++++++++++++ main/core/secure_boot.h | 58 ++++ main/core/test/.gitignore | 1 + main/core/test/Makefile | 16 +- main/core/test/fixtures/sbv2_key_digests.bin | Bin 0 -> 96 bytes main/core/test/fixtures/sbv2_signed.bin | Bin 0 -> 12288 bytes main/core/test/test_sbv2.c | 120 +++++++ main/pages/login/secure_boot_page.c | 299 ++++++++++++++++++ main/pages/login/secure_boot_page.h | 11 + main/pages/login/security_settings.c | 18 +- scripts/format.sh | 1 + sdkconfig.sbtest | 3 + sdkconfig.secure | 9 + simulator/CMakeLists.txt | 6 + .../platform/esp_idf_stubs/secure_boot_sim.c | 83 +++++ 23 files changed, 1170 insertions(+), 6 deletions(-) create mode 100644 bootloader_components/secure_boot_opt_in/CMakeLists.txt create mode 100644 bootloader_components/secure_boot_opt_in/secure_boot_opt_in.c create mode 100644 main/core/sb_digests.cmake create mode 100644 main/core/sbv2.c create mode 100644 main/core/sbv2.h create mode 100644 main/core/secure_boot.c create mode 100644 main/core/secure_boot.h create mode 100644 main/core/test/fixtures/sbv2_key_digests.bin create mode 100644 main/core/test/fixtures/sbv2_signed.bin create mode 100644 main/core/test/test_sbv2.c create mode 100644 main/pages/login/secure_boot_page.c create mode 100644 main/pages/login/secure_boot_page.h create mode 100644 sdkconfig.sbtest create mode 100644 sdkconfig.secure create mode 100644 simulator/platform/esp_idf_stubs/secure_boot_sim.c diff --git a/.gitignore b/.gitignore index 13a6d661..a48e932c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ build_wave_35/ build_pbkdf2_*/ build_scanprof_*/ build_release_*/ +build_sbtest_*/ build_wave_4b/ build_wave_43/ build_wave_5/ diff --git a/.justfile b/.justfile index 2699d5b9..9e5cadd3 100644 --- a/.justfile +++ b/.justfile @@ -46,6 +46,39 @@ flash-release board="wave_4b": (build-release board) command -v idf.py >/dev/null || . $IDF_PATH/export.sh idf.py -B build_release_{{board}} -D SDKCONFIG=build_release_{{board}}/sdkconfig flash +# Secure boot dry run: a sdkconfig.secure build with virtual eFuses (sdkconfig.sbtest), so the +# Settings lockdown burns a RAM copy that is gone after the restart. Signed with test keys: +# dev_signing_key.pem signs the app, it and two throwaway keys sign the bootloader, and their +# digests replace the release ones. Run on a board that already has a PIN. +sbtest-build board="wave_4b": (_check_board board) + #!/usr/bin/env sh + set -e + command -v idf.py >/dev/null || . $IDF_PATH/export.sh + dir=build_sbtest_{{board}} + mkdir -p $dir/keys $dir/digests + [ -f dev_signing_key.pem ] || python -m espsecure generate-signing-key --version 2 --scheme rsa3072 dev_signing_key.pem + cp dev_signing_key.pem $dir/keys/key0.pem + for n in 1 2; do + [ -f $dir/keys/key$n.pem ] || python -m espsecure generate-signing-key --version 2 --scheme rsa3072 $dir/keys/key$n.pem + done + for n in 0 1 2; do + python -m espsecure digest-sbv2-public-key --keyfile $dir/keys/key$n.pem -o $dir/digests/kern-sb-digest$n.bin + done + rm -f $dir/sdkconfig + idf.py -B $dir -D SDKCONFIG=$dir/sdkconfig -D "SDKCONFIG_DEFAULTS=$(just _defaults {{board}});sdkconfig.secure;sdkconfig.sbtest" -D KERN_SB_DIGEST_DIR=$PWD/$dir/digests build + python -m espsecure sign-data --version 2 --keyfile $dir/keys/key1.pem --append-signatures -o $dir/bootloader-2sig.bin $dir/bootloader/bootloader.bin + python -m espsecure sign-data --version 2 --keyfile $dir/keys/key2.pem --append-signatures -o $dir/bootloader-sbtest.bin $dir/bootloader-2sig.bin + +# idf.py leaves the bootloader out when secure boot is configured, so esptool writes it. +# `just flash ` puts the normal firmware back. +sbtest-flash board="wave_4b": (sbtest-build board) + #!/usr/bin/env sh + set -e + command -v idf.py >/dev/null || . $IDF_PATH/export.sh + dir=build_sbtest_{{board}} + idf.py -B $dir -D SDKCONFIG=$dir/sdkconfig flash + python -m esptool --chip esp32p4 write-flash 0x2000 $dir/bootloader-sbtest.bin + monitor board="wave_4b": (_check_board board) #!/usr/bin/env sh command -v idf.py >/dev/null || . $IDF_PATH/export.sh @@ -87,6 +120,7 @@ clean: rm -fRd build_pbkdf2_* rm -fRd build_scanprof_* rm -fRd build_release_* + rm -fRd build_sbtest_* rm -f sdkconfig rm -fRd compile_commands.json rm -fRd .cache/ diff --git a/bootloader_components/secure_boot_opt_in/CMakeLists.txt b/bootloader_components/secure_boot_opt_in/CMakeLists.txt new file mode 100644 index 00000000..a6aa14a1 --- /dev/null +++ b/bootloader_components/secure_boot_opt_in/CMakeLists.txt @@ -0,0 +1,17 @@ +# A stock CONFIG_SECURE_BOOT bootloader burns secure boot on its first boot, +# from the digests of its own signature blocks. Kern burns it from the app +# instead, once the user opts in (main/core/secure_boot.c), so this component +# keeps the bootloader from touching eFuses until SECURE_BOOT_EN is set. +set(srcs "") +if(CONFIG_SECURE_BOOT_V2_ENABLED) + list(APPEND srcs "secure_boot_opt_in.c") +endif() + +idf_component_register(SRCS ${srcs} + PRIV_REQUIRES bootloader_support efuse log) + +if(CONFIG_SECURE_BOOT_V2_ENABLED) + target_link_libraries(${COMPONENT_LIB} INTERFACE + "-Wl,--wrap=esp_secure_boot_v2_permanently_enable" + "-u __wrap_esp_secure_boot_v2_permanently_enable") +endif() diff --git a/bootloader_components/secure_boot_opt_in/secure_boot_opt_in.c b/bootloader_components/secure_boot_opt_in/secure_boot_opt_in.c new file mode 100644 index 00000000..5e3ef7bf --- /dev/null +++ b/bootloader_components/secure_boot_opt_in/secure_boot_opt_in.c @@ -0,0 +1,17 @@ +#include "esp_log.h" +#include "esp_secure_boot.h" + +esp_err_t __real_esp_secure_boot_v2_permanently_enable( + const esp_image_metadata_t *image_data); + +/* Called on every boot before the app loads. The app has already been + * verified against its own keys (or the burned digests once they exist); only + * the first-boot burn is skipped. */ +esp_err_t __wrap_esp_secure_boot_v2_permanently_enable( + const esp_image_metadata_t *image_data) { + if (!esp_secure_boot_enabled()) { + ESP_LOGI("secure_boot", "Off until enabled in Settings"); + return ESP_OK; + } + return __real_esp_secure_boot_v2_permanently_enable(image_data); +} diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 8f0266c2..364a6616 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -45,7 +45,7 @@ idf_component_register( crowpanel wave_7b p4_pico libwally-core cUR sd_card bbqr deflate_codec video spiffs nvs_flash efuse esp_hw_support esp_app_format mbedtls bip138 esp_driver_ppa app_update bootloader_support secure_memory bsp_common - bus_timeout + bus_timeout spi_flash ) # Ignoring a warn_unused_result return is a build error, not a warning. The @@ -54,6 +54,10 @@ idf_component_register( target_compile_options(${COMPONENT_LIB} PRIVATE -Werror=unused-result -Werror=vla) +include(${CMAKE_CURRENT_LIST_DIR}/core/sb_digests.cmake) +kern_generate_sb_digests(${CMAKE_CURRENT_BINARY_DIR}/generated) +target_include_directories(${COMPONENT_LIB} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/generated) + if(DEFINED FONT_POLICY_WIDTH AND DEFINED FONT_POLICY_HEIGHT) find_program(PYTHON3_EXECUTABLE python3 REQUIRED) execute_process( diff --git a/main/core/sb_digests.cmake b/main/core/sb_digests.cmake new file mode 100644 index 00000000..341a3fc7 --- /dev/null +++ b/main/core/sb_digests.cmake @@ -0,0 +1,37 @@ +# Writes kern_sb_digests.h from the published Secure Boot key digests in +# kern_secure_boot/. A build signed with other keys replaces those three files +# (espsecure digest-sbv2-public-key), or passes -DKERN_SB_DIGEST_DIR. +if(NOT KERN_SB_DIGEST_DIR) + set(KERN_SB_DIGEST_DIR ${CMAKE_CURRENT_LIST_DIR}/../../kern_secure_boot) +endif() + +function(kern_generate_sb_digests out_dir) + set(rows "") + foreach(i 0 1 2) + set(bin ${KERN_SB_DIGEST_DIR}/kern-sb-digest${i}.bin) + file(READ ${bin} hex HEX) + string(LENGTH "${hex}" hex_len) + if(NOT hex_len EQUAL 64) + message(FATAL_ERROR "${bin} must hold a 32-byte digest") + endif() + string(REGEX REPLACE "(..)" "0x\\1, " bytes "${hex}") + string(APPEND rows " {${bytes}},\n") + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${bin}) + endforeach() + + set(header ${out_dir}/kern_sb_digests.h) + set(content "/* Generated by main/core/sb_digests.cmake from kern_secure_boot/ */ +#pragma once +#include + +static const uint8_t KERN_SB_DIGESTS[3][32] = { +${rows}}; +") + set(old "") + if(EXISTS ${header}) + file(READ ${header} old) + endif() + if(NOT old STREQUAL content) + file(WRITE ${header} "${content}") + endif() +endfunction() diff --git a/main/core/sbv2.c b/main/core/sbv2.c new file mode 100644 index 00000000..b0ad9081 --- /dev/null +++ b/main/core/sbv2.c @@ -0,0 +1,138 @@ +#include "sbv2.h" +#include +#include + +/* ets_secure_boot_sig_block_t, RSA scheme (esp_rom secure_boot.h) */ +#define BLOCK_SIZE 1216 +#define NUM_BLOCKS 3 +#define MAGIC 0xE7 +#define VERSION_RSA 0x02 +#define RSA_LEN 384 +#define OFF_IMAGE_DIGEST 4 +#define OFF_KEY 36 /* ets_rsa_pubkey_t: n[384], e, rinv[384], mdash */ +#define KEY_LEN 776 +#define OFF_E (OFF_KEY + RSA_LEN) +#define OFF_SIGNATURE (OFF_KEY + KEY_LEN) +#define OFF_CRC (OFF_SIGNATURE + RSA_LEN) + +/* CRC-32 as zlib computes it (espsecure) and esp_rom_crc32_le(0, ...) checks */ +static uint32_t crc32_le(const uint8_t *p, size_t n) { + uint32_t crc = 0xFFFFFFFF; + while (n--) { + crc ^= *p++; + for (int k = 0; k < 8; k++) + crc = (crc >> 1) ^ (0xEDB88320 & (0 - (crc & 1))); + } + return ~crc; +} + +static uint32_t read_le32(const uint8_t *p) { + return (uint32_t)p[0] | (uint32_t)p[1] << 8 | (uint32_t)p[2] << 16 | + (uint32_t)p[3] << 24; +} + +static size_t der_len(uint8_t *out, size_t len) { + if (len < 0x80) { + out[0] = (uint8_t)len; + return 1; + } + if (len < 0x100) { + out[0] = 0x81; + out[1] = (uint8_t)len; + return 2; + } + out[0] = 0x82; + out[1] = (uint8_t)(len >> 8); + out[2] = (uint8_t)len; + return 3; +} + +/* Big-endian unsigned integer as a DER INTEGER */ +static size_t der_uint(uint8_t *out, const uint8_t *be, size_t len) { + while (len > 1 && be[0] == 0) { + be++; + len--; + } + bool pad = be[0] & 0x80; + size_t n = 0; + out[n++] = 0x02; + n += der_len(out + n, len + pad); + if (pad) + out[n++] = 0; + memcpy(out + n, be, len); + return n + len; +} + +/* PKCS#1 RSAPublicKey from the block's little-endian modulus and exponent */ +static size_t rsa_public_key_der(const uint8_t *block, uint8_t *out) { + uint8_t n_be[RSA_LEN]; + for (size_t i = 0; i < RSA_LEN; i++) + n_be[i] = block[OFF_KEY + RSA_LEN - 1 - i]; + uint32_t e = read_le32(block + OFF_E); + uint8_t e_be[4] = {(uint8_t)(e >> 24), (uint8_t)(e >> 16), (uint8_t)(e >> 8), + (uint8_t)e}; + + uint8_t body[RSA_LEN + 16]; + size_t body_len = der_uint(body, n_be, RSA_LEN); + body_len += der_uint(body + body_len, e_be, sizeof(e_be)); + + size_t n = 0; + out[n++] = 0x30; + n += der_len(out + n, body_len); + memcpy(out + n, body, body_len); + return n + body_len; +} + +static bool rsa_pss_verify(const uint8_t *block, + const uint8_t image_digest[SBV2_DIGEST_LEN]) { + uint8_t der[RSA_LEN + 32]; + size_t der_size = rsa_public_key_der(block, der); + + uint8_t sig_be[RSA_LEN]; + for (size_t i = 0; i < RSA_LEN; i++) + sig_be[i] = block[OFF_SIGNATURE + RSA_LEN - 1 - i]; + + psa_key_attributes_t attr = PSA_KEY_ATTRIBUTES_INIT; + psa_set_key_usage_flags(&attr, PSA_KEY_USAGE_VERIFY_HASH); + psa_set_key_algorithm(&attr, PSA_ALG_RSA_PSS(PSA_ALG_SHA_256)); + psa_set_key_type(&attr, PSA_KEY_TYPE_RSA_PUBLIC_KEY); + + psa_key_id_t key = 0; + bool ok = psa_import_key(&attr, der, der_size, &key) == PSA_SUCCESS && + psa_verify_hash(key, PSA_ALG_RSA_PSS(PSA_ALG_SHA_256), image_digest, + SBV2_DIGEST_LEN, sig_be, RSA_LEN) == PSA_SUCCESS; + if (key) + psa_destroy_key(key); + psa_reset_key_attributes(&attr); + return ok; +} + +size_t sbv2_sector_offset(size_t image_len) { + return (image_len + SBV2_SECTOR_SIZE - 1) & ~(size_t)(SBV2_SECTOR_SIZE - 1); +} + +bool sbv2_signed_by(const uint8_t sector[SBV2_SECTOR_SIZE], + const uint8_t image_digest[SBV2_DIGEST_LEN], + const uint8_t key_digest[SBV2_DIGEST_LEN]) { + if (psa_crypto_init() != PSA_SUCCESS) + return false; + + for (size_t i = 0; i < NUM_BLOCKS; i++) { + const uint8_t *block = sector + i * BLOCK_SIZE; + if (block[0] != MAGIC || block[1] != VERSION_RSA || + read_le32(block + OFF_CRC) != crc32_le(block, OFF_CRC) || + memcmp(block + OFF_IMAGE_DIGEST, image_digest, SBV2_DIGEST_LEN) != 0) + continue; + + uint8_t digest[SBV2_DIGEST_LEN]; + size_t digest_len = 0; + if (psa_hash_compute(PSA_ALG_SHA_256, block + OFF_KEY, KEY_LEN, digest, + sizeof(digest), &digest_len) != PSA_SUCCESS || + memcmp(digest, key_digest, SBV2_DIGEST_LEN) != 0) + continue; + + if (rsa_pss_verify(block, image_digest)) + return true; + } + return false; +} diff --git a/main/core/sbv2.h b/main/core/sbv2.h new file mode 100644 index 00000000..bf3a1085 --- /dev/null +++ b/main/core/sbv2.h @@ -0,0 +1,29 @@ +/* + * Secure Boot v2 (RSA-3072) signature sector checks against a chosen key + * digest, independent of eFuse state: lets the firmware confirm an image will + * pass the ROM's boot check before that digest is burned. + */ + +#ifndef SBV2_H +#define SBV2_H + +#include "../utils/attributes.h" +#include +#include +#include + +#define SBV2_SECTOR_SIZE 4096 +#define SBV2_DIGEST_LEN 32 + +/* Offset of the signature sector that follows an image of image_len bytes */ +size_t sbv2_sector_offset(size_t image_len); + +/* True if a block in the signature sector covers image_digest, carries the + * public key whose Secure Boot digest is key_digest, and its RSA-PSS + * signature verifies. */ +KERN_WARN_UNUSED_RESULT bool +sbv2_signed_by(const uint8_t sector[SBV2_SECTOR_SIZE], + const uint8_t image_digest[SBV2_DIGEST_LEN], + const uint8_t key_digest[SBV2_DIGEST_LEN]); + +#endif // SBV2_H diff --git a/main/core/secure_boot.c b/main/core/secure_boot.c new file mode 100644 index 00000000..38aab768 --- /dev/null +++ b/main/core/secure_boot.c @@ -0,0 +1,272 @@ +#include "secure_boot.h" +#include "kern_sb_digests.h" +#include "nvs_secure.h" +#include "pin.h" +#include "sbv2.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char *TAG = "SECURE_BOOT"; + +#define BOOTLOADER_OFFSET CONFIG_BOOTLOADER_OFFSET_IN_FLASH +#define BOOTLOADER_MAX_SIZE (CONFIG_PARTITION_TABLE_OFFSET - BOOTLOADER_OFFSET) + +typedef enum { SLOT_EMPTY, SLOT_MATCH, SLOT_OTHER } slot_t; + +static const esp_efuse_purpose_t DIGEST_PURPOSE[SECURE_BOOT_KEY_COUNT] = { + ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST0, + ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST1, + ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST2, +}; + +/* Through the eFuse API, not esp_secure_boot_enabled(), so virtual eFuses + * (sdkconfig.sbtest) see their own writes */ +static bool sb_enabled(void) { + return esp_efuse_read_field_bit(ESP_EFUSE_SECURE_BOOT_EN); +} + +static slot_t read_slot(unsigned i) { + esp_efuse_block_t blk = EFUSE_BLK_KEY0 + i; + if (esp_efuse_get_digest_revoke(i)) + return SLOT_OTHER; + if (esp_efuse_key_block_unused(blk)) + return SLOT_EMPTY; + uint8_t burned[SECURE_BOOT_DIGEST_LEN]; + if (esp_efuse_get_key_purpose(blk) != DIGEST_PURPOSE[i] || + esp_efuse_get_key_dis_read(blk) || + esp_efuse_read_block(blk, burned, 0, 8 * sizeof(burned)) != ESP_OK || + memcmp(burned, KERN_SB_DIGESTS[i], sizeof(burned)) != 0) + return SLOT_OTHER; + return SLOT_MATCH; +} + +/* KEY4 and KEY5 can only be read-protected while RD_DIS is writable */ +static bool pin_keys_sealed(void) { + return pin_is_configured() && pin_efuse_check() == PIN_EFUSE_PROVISIONED && + nvs_secure_key_check() == NVS_SECURE_KEY_PROVISIONED && + esp_efuse_get_key_dis_read(EFUSE_BLK_KEY4) && + esp_efuse_get_key_dis_read(EFUSE_BLK_KEY5); +} + +static bool hardened(void) { + size_t soft_jtag = 0; + return esp_efuse_read_field_cnt(ESP_EFUSE_SOFT_DIS_JTAG, &soft_jtag) == + ESP_OK && + soft_jtag == ESP_EFUSE_SOFT_DIS_JTAG[0]->bit_count && + esp_efuse_read_field_bit(ESP_EFUSE_DIS_DIRECT_BOOT) && + esp_efuse_read_field_bit(ESP_EFUSE_DIS_PAD_JTAG) && + esp_efuse_read_field_bit(ESP_EFUSE_DIS_USB_JTAG) && + (esp_efuse_read_field_bit(ESP_EFUSE_ENABLE_SECURITY_DOWNLOAD) || + esp_efuse_read_field_bit(ESP_EFUSE_DIS_DOWNLOAD_MODE)) && + esp_efuse_read_field_bit(ESP_EFUSE_WR_DIS_RD_DIS); +} + +static esp_err_t flash_read(uint32_t addr, void *buf, size_t len) { + if (esp_efuse_is_flash_encryption_enabled()) + return esp_flash_read_encrypted(NULL, addr, buf, len); + return esp_flash_read(NULL, buf, addr, len); +} + +/* signed[i]: the image at addr carries a valid signature by embedded key i, + * hashed the way the ROM hashes it (up to the 4 KiB-aligned signature + * sector). An unparsable or unsigned image just leaves every entry false. */ +static esp_err_t image_signers(uint32_t addr, uint32_t max_size, + bool signed_by[SECURE_BOOT_KEY_COUNT]) { + memset(signed_by, 0, SECURE_BOOT_KEY_COUNT * sizeof(signed_by[0])); + esp_image_metadata_t md = {0}; + esp_partition_pos_t pos = {.offset = addr, .size = max_size}; + if (esp_image_get_metadata(&pos, &md) != ESP_OK) + return ESP_OK; + size_t sector = sbv2_sector_offset(md.image_len); + if (sector + SBV2_SECTOR_SIZE > max_size) + return ESP_OK; + + uint8_t *buf = malloc(SBV2_SECTOR_SIZE); + if (!buf || psa_crypto_init() != PSA_SUCCESS) { + free(buf); + return ESP_ERR_NO_MEM; + } + esp_err_t err = ESP_FAIL; + uint8_t digest[SBV2_DIGEST_LEN]; + size_t digest_len = 0; + psa_hash_operation_t op = PSA_HASH_OPERATION_INIT; + if (psa_hash_setup(&op, PSA_ALG_SHA_256) != PSA_SUCCESS) + goto out; + for (size_t off = 0; off < sector; off += SBV2_SECTOR_SIZE) { + if (flash_read(addr + off, buf, SBV2_SECTOR_SIZE) != ESP_OK || + psa_hash_update(&op, buf, SBV2_SECTOR_SIZE) != PSA_SUCCESS) + goto out; + } + if (psa_hash_finish(&op, digest, sizeof(digest), &digest_len) != + PSA_SUCCESS || + flash_read(addr + sector, buf, SBV2_SECTOR_SIZE) != ESP_OK) + goto out; + for (unsigned i = 0; i < SECURE_BOOT_KEY_COUNT; i++) + signed_by[i] = sbv2_signed_by(buf, digest, KERN_SB_DIGESTS[i]); + err = ESP_OK; +out: + psa_hash_abort(&op); + free(buf); + return err; +} + +#define FAIL(code, ...) \ + do { \ + ESP_LOGW(TAG, __VA_ARGS__); \ + if (first == SECURE_BOOT_READY) \ + first = (code); \ + } while (0) + +/* Every check runs so the log lists all problems; the first one is returned */ +static secure_boot_check_t check_ready(bool slot_in_use) { + secure_boot_check_t first = SECURE_BOOT_READY; +#ifndef CONFIG_SECURE_BOOT + FAIL(SECURE_BOOT_ERR_BUILD, + "built without CONFIG_SECURE_BOOT: its bootloader does not verify " + "apps"); +#endif + if (!pin_keys_sealed()) + FAIL(SECURE_BOOT_ERR_PIN, "PIN not set up, or KEY4/KEY5 not sealed"); + if (slot_in_use) + FAIL(SECURE_BOOT_ERR_KEY_SLOTS, "KEY0-KEY2 hold other data or a revoke"); + + bool app[SECURE_BOOT_KEY_COUNT], boot[SECURE_BOOT_KEY_COUNT]; + const esp_partition_t *running = esp_ota_get_running_partition(); + if (!running || + image_signers(running->address, running->size, app) != ESP_OK || + image_signers(BOOTLOADER_OFFSET, BOOTLOADER_MAX_SIZE, boot) != ESP_OK) { + FAIL(SECURE_BOOT_ERR_READ, "could not read the firmware images"); + return first; + } + if (!app[0] && !app[1] && !app[2]) + FAIL(SECURE_BOOT_ERR_APP, "running app not signed by a release key"); + for (unsigned i = 0; i < SECURE_BOOT_KEY_COUNT; i++) + if (!boot[i]) + FAIL(SECURE_BOOT_ERR_BOOTLOADER, "bootloader not signed by key %u", i); + return first; +} + +#undef FAIL + +static void evaluate(secure_boot_status_t *out, + slot_t slots[SECURE_BOOT_KEY_COUNT]) { + memset(out, 0, sizeof(*out)); + memcpy(out->digests, KERN_SB_DIGESTS, sizeof(out->digests)); + for (unsigned i = 0; i < SECURE_BOOT_KEY_COUNT; i++) + out->revoked[i] = esp_efuse_get_digest_revoke(i); + + if (sb_enabled()) { + for (unsigned i = 0; i < SECURE_BOOT_KEY_COUNT; i++) { + esp_efuse_block_t blk; + if (!esp_efuse_find_purpose(DIGEST_PURPOSE[i], &blk) || + esp_efuse_read_block(blk, out->digests[i], 0, + 8 * SECURE_BOOT_DIGEST_LEN) != ESP_OK) + memset(out->digests[i], 0, SECURE_BOOT_DIGEST_LEN); + } + out->state = hardened() ? SECURE_BOOT_ON : SECURE_BOOT_INCOMPLETE; + return; + } + + bool matched = false, in_use = false; + for (unsigned i = 0; i < SECURE_BOOT_KEY_COUNT; i++) { + slots[i] = read_slot(i); + matched |= slots[i] == SLOT_MATCH; + in_use |= slots[i] == SLOT_OTHER; + } + out->state = matched ? SECURE_BOOT_PARTIAL : SECURE_BOOT_OFF; + out->check = check_ready(in_use); +} + +void secure_boot_read_status(secure_boot_status_t *out) { + slot_t slots[SECURE_BOOT_KEY_COUNT]; + evaluate(out, slots); +} + +static esp_err_t burn_digests(const slot_t slots[SECURE_BOOT_KEY_COUNT]) { + esp_efuse_batch_write_begin(); + for (unsigned i = 0; i < SECURE_BOOT_KEY_COUNT; i++) { + if (slots[i] != SLOT_EMPTY) + continue; + esp_err_t err = + esp_efuse_write_key(EFUSE_BLK_KEY0 + i, DIGEST_PURPOSE[i], + KERN_SB_DIGESTS[i], SECURE_BOOT_DIGEST_LEN); + if (err != ESP_OK) { + esp_efuse_batch_write_cancel(); + return err; + } + } + return esp_efuse_batch_write_commit(); +} + +/* One BLK0 commit. Each write is a no-op when the bit is already burned, so + * an interrupted run can be repeated. */ +static esp_err_t burn_lockdown(void) { + size_t soft_jtag = 0; + size_t soft_jtag_bits = ESP_EFUSE_SOFT_DIS_JTAG[0]->bit_count; + esp_err_t err = esp_efuse_read_field_cnt(ESP_EFUSE_SOFT_DIS_JTAG, &soft_jtag); + if (err != ESP_OK) + return err; + + esp_efuse_batch_write_begin(); + err = esp_efuse_write_field_bit(ESP_EFUSE_DIS_DIRECT_BOOT); + if (err == ESP_OK) + err = esp_efuse_write_field_bit(ESP_EFUSE_DIS_PAD_JTAG); + if (err == ESP_OK) + err = esp_efuse_write_field_bit(ESP_EFUSE_DIS_USB_JTAG); + if (err == ESP_OK && soft_jtag < soft_jtag_bits) + err = esp_efuse_write_field_cnt(ESP_EFUSE_SOFT_DIS_JTAG, + soft_jtag_bits - soft_jtag); + if (err == ESP_OK) + err = esp_efuse_enable_rom_secure_download_mode(); + if (err == ESP_OK) + err = esp_efuse_write_field_bit(ESP_EFUSE_SECURE_BOOT_EN); + if (err == ESP_OK) + err = esp_efuse_write_field_bit(ESP_EFUSE_WR_DIS_RD_DIS); + if (err != ESP_OK) { + esp_efuse_batch_write_cancel(); + return err; + } + return esp_efuse_batch_write_commit(); +} + +esp_err_t secure_boot_enable(void) { + secure_boot_status_t status; + slot_t slots[SECURE_BOOT_KEY_COUNT]; + evaluate(&status, slots); + if (status.state == SECURE_BOOT_ON) + return ESP_OK; + if (status.check != SECURE_BOOT_READY) + return ESP_ERR_INVALID_STATE; + + if (status.state != SECURE_BOOT_INCOMPLETE) { + ESP_LOGI(TAG, "Burning release key digests"); + esp_err_t err = burn_digests(slots); + if (err != ESP_OK) { + ESP_LOGE(TAG, "Digest burn failed: %s", esp_err_to_name(err)); + return err; + } + /* SECURE_BOOT_EN without all three digests in place would brick */ + for (unsigned i = 0; i < SECURE_BOOT_KEY_COUNT; i++) { + if (read_slot(i) != SLOT_MATCH) { + ESP_LOGE(TAG, "KEY%u does not read back digest %u", i, i); + return ESP_FAIL; + } + } + } + + ESP_LOGI(TAG, "Burning hardening set and SECURE_BOOT_EN"); + esp_err_t err = burn_lockdown(); + if (err != ESP_OK) { + ESP_LOGE(TAG, "Lockdown burn failed: %s", esp_err_to_name(err)); + return err; + } + return sb_enabled() && hardened() ? ESP_OK : ESP_FAIL; +} diff --git a/main/core/secure_boot.h b/main/core/secure_boot.h new file mode 100644 index 00000000..33b4164a --- /dev/null +++ b/main/core/secure_boot.h @@ -0,0 +1,58 @@ +/* + * On-device Secure Boot v2 activation (security-plan Phase 6). + * + * Burns the three embedded release-key digests into eFuse KEY0-KEY2, the + * hardening set the stock bootloader burns alongside secure boot, then + * SECURE_BOOT_EN and the RD_DIS write-protect. Refuses unless the running + * firmware and the flashed bootloader would both pass the ROM's check under + * those digests afterwards, and the read-protected PIN keys (KEY4, KEY5) are + * already sealed. See docs/secure-boot.md section 5a. + * + * UI-free. Both entry points block (the status check hashes the running + * firmware): run them on a worker task. + */ + +#ifndef SECURE_BOOT_H +#define SECURE_BOOT_H + +#include "../utils/attributes.h" +#include +#include +#include + +#define SECURE_BOOT_KEY_COUNT 3 +#define SECURE_BOOT_DIGEST_LEN 32 + +typedef enum { + SECURE_BOOT_OFF, + SECURE_BOOT_PARTIAL, /* digests burned, SECURE_BOOT_EN not yet */ + SECURE_BOOT_INCOMPLETE, /* SECURE_BOOT_EN burned, hardening missing */ + SECURE_BOOT_ON, +} secure_boot_state_t; + +/* Why OFF or PARTIAL cannot proceed, in the order they are reported */ +typedef enum { + SECURE_BOOT_READY, + SECURE_BOOT_ERR_BUILD, /* firmware not built for secure boot */ + SECURE_BOOT_ERR_PIN, /* no PIN, or KEY4/KEY5 not sealed */ + SECURE_BOOT_ERR_KEY_SLOTS, /* KEY0-KEY2 hold other data, or revoked */ + SECURE_BOOT_ERR_APP, /* running firmware not signed by a key */ + SECURE_BOOT_ERR_BOOTLOADER, /* bootloader not signed by every key */ + SECURE_BOOT_ERR_READ, /* flash read failed */ +} secure_boot_check_t; + +typedef struct { + secure_boot_state_t state; + secure_boot_check_t check; + /* Burned digests once SECURE_BOOT_EN is set, the embedded ones before */ + uint8_t digests[SECURE_BOOT_KEY_COUNT][SECURE_BOOT_DIGEST_LEN]; + bool revoked[SECURE_BOOT_KEY_COUNT]; +} secure_boot_status_t; + +void secure_boot_read_status(secure_boot_status_t *out); + +/* Re-runs every check, then burns what is missing. Irreversible; restart + * afterwards. */ +KERN_WARN_UNUSED_RESULT esp_err_t secure_boot_enable(void); + +#endif // SECURE_BOOT_H diff --git a/main/core/test/.gitignore b/main/core/test/.gitignore index c5602c81..9dd6a4cf 100644 --- a/main/core/test/.gitignore +++ b/main/core/test/.gitignore @@ -41,6 +41,7 @@ test_seedqr test_mnemonic_words test_descriptor_branch test_self_test +test_sbv2 fuzz_psbt fuzz_descriptor fuzz_text diff --git a/main/core/test/Makefile b/main/core/test/Makefile index 6720b878..71d1aab9 100644 --- a/main/core/test/Makefile +++ b/main/core/test/Makefile @@ -189,6 +189,10 @@ DESCRIPTOR_TEXT_SRC = ../descriptor_text.c ../descriptor_text.h SRCS_MESSAGE_SIGN = test_message_sign.c TARGET_MESSAGE_SIGN = test_message_sign +SRCS_SBV2 = test_sbv2.c +TARGET_SBV2 = test_sbv2 +SBV2_SRC = ../sbv2.c ../sbv2.h + SRCS_SELF_TEST = test_self_test.c TARGET_SELF_TEST = test_self_test SELF_TEST_SRC = ../self_test.c ../self_test.h ../crypto_init.c ../crypto_init.h \ @@ -212,7 +216,7 @@ SRCS_MULTISIG_SETUP = test_multisig_setup.c TARGET_MULTISIG_SETUP = test_multisig_setup MULTISIG_SETUP_SRC = ../multisig_setup.c ../multisig_setup.h -all: $(TARGET_DERIV) $(TARGET_SS_PARSE) $(TARGET_SS_WHITELISTED) $(TARGET_SS_REGEN) $(TARGET_PSB) $(TARGET_REG_MATCH) $(TARGET_REG_PARSE) $(TARGET_PSBT_CLASSIFY) $(TARGET_MS_POLICY) $(TARGET_BIP322) $(TARGET_ESTIMATED_ENTROPY) $(TARGET_UTF8) $(TARGET_PIN_ATTEMPT) $(TARGET_KEF) $(TARGET_PSBT_PARSE) $(TARGET_FW_UPDATE) $(TARGET_DESC_VALIDATOR) $(TARGET_STORAGE) $(TARGET_KEY) $(TARGET_CRYPTO_UTILS) $(TARGET_PBKDF2) $(TARGET_BIP138_KEYS) $(TARGET_BIP138_BACKUP) $(TARGET_MULTISIG_SETUP) $(TARGET_ADDRESS_MATCH) $(TARGET_DESCRIPTOR_TEXT) $(TARGET_MESSAGE_SIGN) $(TARGET_WALLY_DESCRIPTOR) $(TARGET_SEEDQR) $(TARGET_MNEMONIC_WORDS) $(TARGET_DESCRIPTOR_BRANCH) $(TARGET_SELF_TEST) +all: $(TARGET_DERIV) $(TARGET_SS_PARSE) $(TARGET_SS_WHITELISTED) $(TARGET_SS_REGEN) $(TARGET_PSB) $(TARGET_REG_MATCH) $(TARGET_REG_PARSE) $(TARGET_PSBT_CLASSIFY) $(TARGET_MS_POLICY) $(TARGET_BIP322) $(TARGET_ESTIMATED_ENTROPY) $(TARGET_UTF8) $(TARGET_PIN_ATTEMPT) $(TARGET_KEF) $(TARGET_PSBT_PARSE) $(TARGET_FW_UPDATE) $(TARGET_DESC_VALIDATOR) $(TARGET_STORAGE) $(TARGET_KEY) $(TARGET_CRYPTO_UTILS) $(TARGET_PBKDF2) $(TARGET_BIP138_KEYS) $(TARGET_BIP138_BACKUP) $(TARGET_MULTISIG_SETUP) $(TARGET_ADDRESS_MATCH) $(TARGET_DESCRIPTOR_TEXT) $(TARGET_MESSAGE_SIGN) $(TARGET_WALLY_DESCRIPTOR) $(TARGET_SEEDQR) $(TARGET_MNEMONIC_WORDS) $(TARGET_DESCRIPTOR_BRANCH) $(TARGET_SELF_TEST) $(TARGET_SBV2) $(LIBWALLY): $(WALLY_SRC) $(WALLY_DEPS) $(WALLY_DIR)/kern_wally.c $(WALLY_DIR)/kern_wally.h $(ROOT)/components/secure_memory/secret_alloc.c $(ROOT)/components/secure_memory/include/secure_memory.h Makefile $(CC) $(CFLAGS) $(WALLY_CFLAGS) -c -o combined.o $< @@ -220,7 +224,7 @@ $(LIBWALLY): $(WALLY_SRC) $(WALLY_DEPS) $(WALLY_DIR)/kern_wally.c $(WALLY_DIR)/k $(CC) $(CFLAGS) -I$(ROOT)/components/secure_memory/include -c -o secret_alloc.o $(ROOT)/components/secure_memory/secret_alloc.c ar rcs $@ combined.o kern_wally.o secret_alloc.o -$(TARGET_DERIV) $(TARGET_SS_PARSE) $(TARGET_SS_WHITELISTED) $(TARGET_SS_REGEN) $(TARGET_PSB) $(TARGET_REG_MATCH) $(TARGET_REG_PARSE) $(TARGET_PSBT_CLASSIFY) $(TARGET_MS_POLICY) $(TARGET_BIP322) $(TARGET_ESTIMATED_ENTROPY) $(TARGET_UTF8) $(TARGET_PIN_ATTEMPT) $(TARGET_KEF) $(TARGET_PSBT_PARSE) $(TARGET_FW_UPDATE) $(TARGET_DESC_VALIDATOR) $(TARGET_STORAGE) $(TARGET_KEY) $(TARGET_CRYPTO_UTILS) $(TARGET_PBKDF2) $(TARGET_BIP138_KEYS) $(TARGET_BIP138_BACKUP) $(TARGET_MULTISIG_SETUP) $(TARGET_ADDRESS_MATCH) $(TARGET_DESCRIPTOR_TEXT) $(TARGET_MESSAGE_SIGN) $(TARGET_WALLY_DESCRIPTOR) $(TARGET_SEEDQR) $(TARGET_MNEMONIC_WORDS) $(TARGET_DESCRIPTOR_BRANCH) $(TARGET_SELF_TEST) $(PSBT_KEY_OBJ) $(STORAGE_OBJ) $(PBKDF2_OBJ) $(CRYPTO_INIT_LIB): $(COMMON_H) +$(TARGET_DERIV) $(TARGET_SS_PARSE) $(TARGET_SS_WHITELISTED) $(TARGET_SS_REGEN) $(TARGET_PSB) $(TARGET_REG_MATCH) $(TARGET_REG_PARSE) $(TARGET_PSBT_CLASSIFY) $(TARGET_MS_POLICY) $(TARGET_BIP322) $(TARGET_ESTIMATED_ENTROPY) $(TARGET_UTF8) $(TARGET_PIN_ATTEMPT) $(TARGET_KEF) $(TARGET_PSBT_PARSE) $(TARGET_FW_UPDATE) $(TARGET_DESC_VALIDATOR) $(TARGET_STORAGE) $(TARGET_KEY) $(TARGET_CRYPTO_UTILS) $(TARGET_PBKDF2) $(TARGET_BIP138_KEYS) $(TARGET_BIP138_BACKUP) $(TARGET_MULTISIG_SETUP) $(TARGET_ADDRESS_MATCH) $(TARGET_DESCRIPTOR_TEXT) $(TARGET_MESSAGE_SIGN) $(TARGET_WALLY_DESCRIPTOR) $(TARGET_SEEDQR) $(TARGET_MNEMONIC_WORDS) $(TARGET_DESCRIPTOR_BRANCH) $(TARGET_SELF_TEST) $(TARGET_SBV2) $(PSBT_KEY_OBJ) $(STORAGE_OBJ) $(PBKDF2_OBJ) $(CRYPTO_INIT_LIB): $(COMMON_H) $(TARGET_DERIV): $(SRCS_DERIV) $(BIP32_PATH_SRC) $(CC) $(CFLAGS) $(TEST_INCS) -o $@ $(SRCS_DERIV) ../bip32_path.c @@ -338,6 +342,9 @@ $(TARGET_MESSAGE_SIGN): $(SRCS_MESSAGE_SIGN) ../message_sign.c ../message_sign.h $(CC) $(CFLAGS) $(KEF_INCS) -o $@ $(SRCS_MESSAGE_SIGN) ../message_sign.c ../crypto_init.c ../secp_hardening.c ../key.c ../bip32_path.c ../script_templates.c \ ../crypto_utils.c ../entropy_pool.c stubs/esp_hw_stub.c $(HOST_PBKDF2) $(LIBWALLY) -lmbedcrypto +$(TARGET_SBV2): $(SRCS_SBV2) $(SBV2_SRC) fixtures/sbv2_signed.bin fixtures/sbv2_key_digests.bin + $(CC) $(CFLAGS) -I$(ROOT)/main -o $@ $(SRCS_SBV2) ../sbv2.c -lmbedcrypto -lz + $(TARGET_SELF_TEST): $(SRCS_SELF_TEST) $(SELF_TEST_SRC) $(LIBWALLY) $(CC) $(CFLAGS) $(KEF_INCS) -o $@ $(SRCS_SELF_TEST) ../self_test.c ../crypto_init.c \ ../secp_hardening.c ../message_sign.c ../dice_mnemonic.c ../descriptor_parse.c \ @@ -395,7 +402,7 @@ fuzz: $(FUZZ_TARGETS) ./fuzz_descriptor -n $(FUZZ_ITERATIONS) $(FUZZ_DIR)/corpus/text ./fuzz_text -n $(FUZZ_ITERATIONS) $(FUZZ_DIR)/corpus/text -run: $(TARGET_DERIV) $(TARGET_SS_PARSE) $(TARGET_SS_WHITELISTED) $(TARGET_SS_REGEN) $(TARGET_PSB) $(TARGET_REG_MATCH) $(TARGET_REG_PARSE) $(TARGET_PSBT_CLASSIFY) $(TARGET_MS_POLICY) $(TARGET_BIP322) $(TARGET_ESTIMATED_ENTROPY) $(TARGET_UTF8) $(TARGET_PIN_ATTEMPT) $(TARGET_KEF) $(TARGET_PSBT_PARSE) $(TARGET_FW_UPDATE) $(TARGET_DESC_VALIDATOR) $(TARGET_STORAGE) $(TARGET_KEY) $(TARGET_CRYPTO_UTILS) $(TARGET_PBKDF2) $(TARGET_BIP138_KEYS) $(TARGET_BIP138_BACKUP) $(TARGET_MULTISIG_SETUP) $(TARGET_ADDRESS_MATCH) $(TARGET_DESCRIPTOR_TEXT) $(TARGET_MESSAGE_SIGN) $(TARGET_WALLY_DESCRIPTOR) $(TARGET_SEEDQR) $(TARGET_MNEMONIC_WORDS) $(TARGET_DESCRIPTOR_BRANCH) $(TARGET_SELF_TEST) +run: $(TARGET_DERIV) $(TARGET_SS_PARSE) $(TARGET_SS_WHITELISTED) $(TARGET_SS_REGEN) $(TARGET_PSB) $(TARGET_REG_MATCH) $(TARGET_REG_PARSE) $(TARGET_PSBT_CLASSIFY) $(TARGET_MS_POLICY) $(TARGET_BIP322) $(TARGET_ESTIMATED_ENTROPY) $(TARGET_UTF8) $(TARGET_PIN_ATTEMPT) $(TARGET_KEF) $(TARGET_PSBT_PARSE) $(TARGET_FW_UPDATE) $(TARGET_DESC_VALIDATOR) $(TARGET_STORAGE) $(TARGET_KEY) $(TARGET_CRYPTO_UTILS) $(TARGET_PBKDF2) $(TARGET_BIP138_KEYS) $(TARGET_BIP138_BACKUP) $(TARGET_MULTISIG_SETUP) $(TARGET_ADDRESS_MATCH) $(TARGET_DESCRIPTOR_TEXT) $(TARGET_MESSAGE_SIGN) $(TARGET_WALLY_DESCRIPTOR) $(TARGET_SEEDQR) $(TARGET_MNEMONIC_WORDS) $(TARGET_DESCRIPTOR_BRANCH) $(TARGET_SELF_TEST) $(TARGET_SBV2) ./$(TARGET_DERIV) ./$(TARGET_SS_PARSE) ./$(TARGET_SS_WHITELISTED) @@ -428,8 +435,9 @@ run: $(TARGET_DERIV) $(TARGET_SS_PARSE) $(TARGET_SS_WHITELISTED) $(TARGET_SS_REG ./$(TARGET_MNEMONIC_WORDS) ./$(TARGET_DESCRIPTOR_BRANCH) ./$(TARGET_SELF_TEST) + ./$(TARGET_SBV2) clean: - rm -f $(TARGET_DERIV) $(TARGET_SS_PARSE) $(TARGET_SS_WHITELISTED) $(TARGET_SS_REGEN) $(TARGET_PSB) $(TARGET_REG_MATCH) $(TARGET_REG_PARSE) $(TARGET_PSBT_CLASSIFY) $(TARGET_MS_POLICY) $(TARGET_BIP322) $(TARGET_ESTIMATED_ENTROPY) $(TARGET_UTF8) $(TARGET_PIN_ATTEMPT) $(TARGET_KEF) $(TARGET_PSBT_PARSE) $(TARGET_FW_UPDATE) $(TARGET_DESC_VALIDATOR) $(TARGET_STORAGE) $(TARGET_KEY) $(TARGET_CRYPTO_UTILS) $(TARGET_PBKDF2) $(TARGET_BIP138_KEYS) $(TARGET_BIP138_BACKUP) $(TARGET_MULTISIG_SETUP) $(TARGET_ADDRESS_MATCH) $(TARGET_DESCRIPTOR_TEXT) $(TARGET_MESSAGE_SIGN) $(TARGET_WALLY_DESCRIPTOR) $(TARGET_SEEDQR) $(TARGET_MNEMONIC_WORDS) $(TARGET_DESCRIPTOR_BRANCH) $(TARGET_SELF_TEST) $(FUZZ_TARGETS) $(LIBWALLY) combined.o kern_wally.o secret_alloc.o $(PSBT_KEY_OBJ) $(STORAGE_OBJ) $(PBKDF2_OBJ) $(CRYPTO_INIT_LIB) $(CRYPTO_INIT_OBJS) + rm -f $(TARGET_DERIV) $(TARGET_SS_PARSE) $(TARGET_SS_WHITELISTED) $(TARGET_SS_REGEN) $(TARGET_PSB) $(TARGET_REG_MATCH) $(TARGET_REG_PARSE) $(TARGET_PSBT_CLASSIFY) $(TARGET_MS_POLICY) $(TARGET_BIP322) $(TARGET_ESTIMATED_ENTROPY) $(TARGET_UTF8) $(TARGET_PIN_ATTEMPT) $(TARGET_KEF) $(TARGET_PSBT_PARSE) $(TARGET_FW_UPDATE) $(TARGET_DESC_VALIDATOR) $(TARGET_STORAGE) $(TARGET_KEY) $(TARGET_CRYPTO_UTILS) $(TARGET_PBKDF2) $(TARGET_BIP138_KEYS) $(TARGET_BIP138_BACKUP) $(TARGET_MULTISIG_SETUP) $(TARGET_ADDRESS_MATCH) $(TARGET_DESCRIPTOR_TEXT) $(TARGET_MESSAGE_SIGN) $(TARGET_WALLY_DESCRIPTOR) $(TARGET_SEEDQR) $(TARGET_MNEMONIC_WORDS) $(TARGET_DESCRIPTOR_BRANCH) $(TARGET_SELF_TEST) $(TARGET_SBV2) $(FUZZ_TARGETS) $(LIBWALLY) combined.o kern_wally.o secret_alloc.o $(PSBT_KEY_OBJ) $(STORAGE_OBJ) $(PBKDF2_OBJ) $(CRYPTO_INIT_LIB) $(CRYPTO_INIT_OBJS) .PHONY: all run clean fuzz diff --git a/main/core/test/fixtures/sbv2_key_digests.bin b/main/core/test/fixtures/sbv2_key_digests.bin new file mode 100644 index 0000000000000000000000000000000000000000..a34b64408638948587e604ef862bab257ad8f5b0 GIT binary patch literal 96 zcmV-m0H6PD+CS{=(a75OMx+Ap%UE=P- zetC3Yv6I%)!C_quEH^Ag9>LnoH%;4cLI85+sVyjB(|9(uelRlvCgId7{-LIl&fxpV CkuKf< literal 0 HcmV?d00001 diff --git a/main/core/test/fixtures/sbv2_signed.bin b/main/core/test/fixtures/sbv2_signed.bin new file mode 100644 index 0000000000000000000000000000000000000000..1056af1ce966343351070be2ee80a8b7b3e4a155 GIT binary patch literal 12288 zcmeI$={wYI8wYS(8QCSKVVD@Z$P%&>+1IQY>&U)u8T&d2_e6F=G{soTR`z|TXi~zE z?y@(wtYhdop11e$ym;O`&#T|{2VBST`&`%WyuRm2eT5awD|k~@NmI|%+To#3a7276 zChyscn#Q)?kq@5jU3hksafQhIh_`K$Vt&VlidU%#yq z56-CQSU7nE#AOsUbWN=6UA==)aVdZ0mQ>;zT6>1y&n*1Cv3q=RiQy{bhOnfZik5-7 zt&_W7XjJ0ktb($ab+m#nv{p_l-_{S^T-Re@a2ibd8%| zR7yeZo{@!}i)X;2nBh{tKhXaG{U6Z(0{uTQ{{ZGc|A+b4A7B9jfB+x>2mk_r03ZMe00MvjAn-pH zSfiq#P~BD92JupSLe??4Lh(uF3_DVnGa`A>{3!Eq%?!oZ?>&+lO0dVmaagefYmT9G z5${8ul^dS011v`UxH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k8qMX=bzhal@P#%2y+^UkiV(>>c$_%ZlIS(oA$xHArVkT5I(jPReg?TolzjB{CfJ zs`97-R$W7Mdp%?R-9#N<@wR9&uU5VI$G_{BXcRHMQujfD_=5nWlN!YY(i}C+6$~MV z2+c~gRqn;S?BZm?kMm8SigUE?*hL%KMkr<67M~4wf^Z?yMxQCOO3>CRSQmWukKo`E z*HB>gj2Lw~k+Y#$+rzbF)3w%IvSo!U(_a*J)f2Yy%Ok|52Lsy)OFPk z^V&z391l9p_6fFmak+$$Q_;T>-O{|#mCw5qfE#&k9Wrs4(W7R-Jixv}HL^=V=g>ya z@#pL#pG(FiJ?s1(jj8a|YaSxPupvu+!SGhCdz5B_Ki@n}MaoHXPSbz8y#B(^ed_b_ zLYQ`z*QT&G7Zwut3~uLO(99^eY$bx3OeO7+4O|V5kwJL6emBt9PyVbigB!)pAu!nD zfb!A(Ilp$1JD?$WwCT8cmO^R=^^+!f)ziF7@@bf-CkLTJ(`fp#za_AemwoIK9!;nF z>(vgmXfxWx9pxiKXOfK=v1qB7 sH;X#IjH=YlE*zK3;==Yhbh)3C_6HybeAJ?Vir?%Bd23JIr2#M1fe62Cm5;uAq*x@Y`?q_ml%`D-l)80v*G%nVbZeNR3(q* z?wpsqG42On&bBlQoEPbt&31L_E{mUJquKH88XIX}$H58pm^o8h{95?Z^BjML+ZYC4)=J#$_( yM|x%$tOTNq8e8=9pOUH!@4k3uGi) +#include +#include +#include +#include + +#define IMAGE_LEN 5000 +#define FIXTURE_LEN (8192 + SBV2_SECTOR_SIZE) +#define BLOCK_SIZE 1216 +#define OFF_SIGNATURE 812 +#define OFF_CRC 1196 + +static int tests_run = 0; +static int tests_failed = 0; + +static void check(const char *name, bool ok) { + tests_run++; + if (!ok) + tests_failed++; + printf("Testing: %s... %s\n", name, ok ? "PASS" : "FAIL"); +} + +static size_t read_file(const char *path, uint8_t *buf, size_t len) { + FILE *f = fopen(path, "rb"); + if (!f) + return 0; + size_t n = fread(buf, 1, len, f); + fclose(f); + return n; +} + +static void image_digest(const uint8_t *image, uint8_t out[32]) { + size_t len = 0; + psa_hash_compute(PSA_ALG_SHA_256, image, sbv2_sector_offset(IMAGE_LEN), out, + 32, &len); +} + +static void fix_crc(uint8_t *block) { + uint32_t crc = (uint32_t)crc32(0, block, OFF_CRC); + for (int i = 0; i < 4; i++) + block[OFF_CRC + i] = (uint8_t)(crc >> (8 * i)); +} + +int main(void) { + static uint8_t image[FIXTURE_LEN], work[FIXTURE_LEN]; + uint8_t keys[3][32], digest[32]; + + if (psa_crypto_init() != PSA_SUCCESS || + read_file("fixtures/sbv2_signed.bin", image, sizeof(image)) != + FIXTURE_LEN || + read_file("fixtures/sbv2_key_digests.bin", keys[0], sizeof(keys)) != + sizeof(keys)) { + printf("Missing fixtures\n"); + return 1; + } + const uint8_t *sector = image + sbv2_sector_offset(IMAGE_LEN); + image_digest(image, digest); + + check("sector offset pads to 4 KiB", sbv2_sector_offset(IMAGE_LEN) == 8192 && + sbv2_sector_offset(8192) == 8192 && + sbv2_sector_offset(1) == 4096); + check("first signer verifies", sbv2_signed_by(sector, digest, keys[0])); + check("second signer verifies", sbv2_signed_by(sector, digest, keys[1])); + check("key that did not sign is rejected", + !sbv2_signed_by(sector, digest, keys[2])); + + memcpy(work, image, sizeof(work)); + work[100] ^= 1; + uint8_t tampered[32]; + image_digest(work, tampered); + check("modified image is rejected", + !sbv2_signed_by(sector, tampered, keys[0])); + + uint8_t *block0 = work + sbv2_sector_offset(IMAGE_LEN); + memcpy(work, image, sizeof(work)); + block0[OFF_SIGNATURE + 10] ^= 1; + fix_crc(block0); + check("forged signature with valid CRC is rejected", + !sbv2_signed_by(block0, digest, keys[0])); + check("other block still verifies after a forgery", + sbv2_signed_by(block0, digest, keys[1])); + + memcpy(work, image, sizeof(work)); + block0[2] ^= 1; /* reserved: covered by the CRC only */ + check("bad CRC is rejected", !sbv2_signed_by(block0, digest, keys[0])); + fix_crc(block0); + check("CRC is what rejected it", sbv2_signed_by(block0, digest, keys[0])); + + memcpy(work, image, sizeof(work)); + memcpy(block0, block0 + BLOCK_SIZE, BLOCK_SIZE); + memset(block0 + BLOCK_SIZE, 0xFF, BLOCK_SIZE); + check("block position does not matter", + sbv2_signed_by(block0, digest, keys[1]) && + !sbv2_signed_by(block0, digest, keys[0])); + + memcpy(work, image, sizeof(work)); + block0[1] = 0x03; + fix_crc(block0); + check("non-RSA block version is rejected", + !sbv2_signed_by(block0, digest, keys[0])); + + printf("\n%d/%d tests passed\n", tests_run - tests_failed, tests_run); + return tests_failed ? 1 : 0; +} diff --git a/main/pages/login/secure_boot_page.c b/main/pages/login/secure_boot_page.c new file mode 100644 index 00000000..1f888b73 --- /dev/null +++ b/main/pages/login/secure_boot_page.c @@ -0,0 +1,299 @@ +/* + * Secure Boot page: shows whether this device only starts release-signed + * firmware and, once every check in core/secure_boot passes, burns the + * lockdown behind a warning and the PIN. The status check and the burn run on + * a worker task; an LVGL timer polls for completion. + */ + +#include "secure_boot_page.h" +#include "../../core/secure_boot.h" +#include "../../project.h" +#include "../../ui/dialog.h" +#include "../../ui/input_helpers.h" +#include "../../ui/theme_widgets.h" +#include "../../utils/session_cleanup.h" +#include "../../utils/worker_task.h" +#include "../pin/pin_page.h" +#include +#include + +#define TASK_STACK_SIZE 16384 + +static void (*return_callback)(void) = NULL; +static lv_obj_t *screen = NULL; +static lv_obj_t *body = NULL; +static lv_obj_t *progress = NULL; +static lv_timer_t *poll_timer = NULL; +static bool pin_open; + +static secure_boot_status_t status; +static esp_err_t enable_result; +static volatile bool done; +static bool running; +static bool enabling; + +static void start_task(bool enable); + +static void read_work(void) { secure_boot_read_status(&status); } + +static void enable_work(void) { enable_result = secure_boot_enable(); } + +static lv_obj_t *text(const char *msg, bool secondary) { + lv_obj_t *label = theme_create_label(body, msg, secondary); + lv_obj_set_width(label, LV_PCT(100)); + lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP); + return label; +} + +static void heading(const char *msg, lv_color_t color) { + lv_obj_set_style_text_color(text(msg, false), color, 0); +} + +static void add_digests(void) { + for (unsigned i = 0; i < SECURE_BOOT_KEY_COUNT; i++) { + char hex[SECURE_BOOT_DIGEST_LEN * 2 + SECURE_BOOT_DIGEST_LEN / 4 + 1]; + size_t n = 0; + for (unsigned b = 0; b < SECURE_BOOT_DIGEST_LEN; b++) { + if (b && b % 4 == 0) + hex[n++] = ' '; + n += snprintf(hex + n, sizeof(hex) - n, "%02x", status.digests[i][b]); + } + char title[24]; + snprintf(title, sizeof(title), "Key %u%s", i + 1, + status.revoked[i] ? " (revoked)" : ""); + text(title, true); + lv_obj_set_style_text_font(text(hex, false), theme_font_small(), 0); + } +} + +static const char *blocked_reason(secure_boot_check_t check) { + switch (check) { + case SECURE_BOOT_ERR_BUILD: + return "This firmware build cannot enable secure boot. Install a release " + "that supports it."; + case SECURE_BOOT_ERR_PIN: + return "Set up a PIN first."; + case SECURE_BOOT_ERR_KEY_SLOTS: + return "The eFuse key slots secure boot needs are already used on this " + "device."; + case SECURE_BOOT_ERR_APP: + return "The running firmware is not signed by a release key. Install an " + "official release first."; + case SECURE_BOOT_ERR_BOOTLOADER: + return "The bootloader is not signed by every release key. Flash a " + "release with the USB web flasher first."; + case SECURE_BOOT_ERR_READ: + return "Could not read the firmware from flash."; + default: + return ""; + } +} + +static void confirm_cb(bool confirmed, void *user_data); + +static void action_cb(lv_event_t *e) { + (void)e; + dialog_show_danger_confirm("Lock this device to release-signed firmware?\n\n" + "This burns eFuses and cannot be undone.", + confirm_cb, NULL, DIALOG_STYLE_FULLSCREEN); +} + +static void add_action(const char *label) { + lv_obj_t *btn = theme_create_button(body, label, true); + lv_obj_set_style_margin_top(btn, theme_default_padding(), 0); + lv_obj_add_event_cb(btn, action_cb, LV_EVENT_CLICKED, NULL); +} + +static void render(void) { + lv_obj_clean(body); + bool ready = status.check == SECURE_BOOT_READY; + + switch (status.state) { + case SECURE_BOOT_ON: + heading("Enabled", good_color()); + text("Only firmware signed by one of these keys starts on this device.", + true); + add_digests(); + return; + case SECURE_BOOT_INCOMPLETE: + heading("Enabled, setup unfinished", error_color()); + text("Secure boot is on, but some of the protections that go with it " + "are not set yet.", + true); + add_action("Finish Setup"); + return; + case SECURE_BOOT_PARTIAL: + heading("Partially set up", error_color()); + text("The release keys are already burned, but secure boot is not on.", + true); + break; + case SECURE_BOOT_OFF: + heading("Not enabled", secondary_color()); + text("Locks this device to firmware signed by the " PROJECT_NAME + " release keys:\n" + "- Unsigned firmware will not start, from SD card or USB\n" + "- JTAG debugging is turned off\n" + "This is permanent.", + true); + break; + } + + if (!ready) { + lv_obj_set_style_text_color(text(blocked_reason(status.check), false), + error_color(), 0); + return; + } + text("Compare these keys with the ones published with the release:", true); + add_digests(); + add_action(status.state == SECURE_BOOT_PARTIAL ? "Finish Setup" + : "Enable Secure Boot"); +} + +static void restart_cb(void *user_data) { + (void)user_data; + esp_restart(); +} + +static void poll_cb(lv_timer_t *timer) { + (void)timer; + if (!done) + return; + worker_task_wait(); + running = false; + lv_timer_del(poll_timer); + poll_timer = NULL; + if (progress) { + lv_obj_del(progress); + progress = NULL; + } + + if (!enabling) { + render(); + return; + } + enabling = false; + if (enable_result == ESP_OK) { + dialog_show_info("Secure Boot", "Secure boot is enabled.\nRestarting...", + restart_cb, NULL, DIALOG_STYLE_FULLSCREEN); + return; + } + dialog_show_error_timeout("Secure boot could not be enabled.", NULL, 0); + start_task(false); +} + +static void start_task(bool enable) { + if (running || !body) + return; + enabling = enable; + if (enable) { + progress = dialog_show_progress("Secure Boot", + "Burning eFuses...\nDo not power off", + DIALOG_STYLE_FULLSCREEN); + } else { + lv_obj_clean(body); + text("Checking firmware signatures...", true); + } + + done = false; + if (!worker_task_start(enable ? "sb_enable" : "sb_status", TASK_STACK_SIZE, + enable ? enable_work : read_work, &done)) { + if (progress) { + lv_obj_del(progress); + progress = NULL; + } + enabling = false; + dialog_show_error_timeout("Could not start the task", NULL, 0); + return; + } + running = true; + poll_timer = lv_timer_create(poll_cb, 100, NULL); +} + +static void pin_verified_cb(void) { + pin_page_destroy(); + pin_open = false; + secure_boot_page_show(); + start_task(true); +} + +static void pin_cancel_cb(void) { + pin_page_destroy(); + pin_open = false; + secure_boot_page_show(); +} + +static void confirm_cb(bool confirmed, void *user_data) { + (void)user_data; + if (!confirmed) + return; + secure_boot_page_hide(); + pin_open = true; + pin_page_create(lv_screen_active(), PIN_PAGE_UNLOCK, pin_verified_cb, + pin_cancel_cb); +} + +static void back_cb(lv_event_t *e) { + (void)e; + if (!running && return_callback) + return_callback(); +} + +void secure_boot_page_create(lv_obj_t *parent, void (*return_cb)(void)) { + session_cleanup_register(secure_boot_page_destroy); + return_callback = return_cb; + + screen = theme_create_page_container(parent); + ui_create_back_button(screen, back_cb); + theme_create_page_title(screen, "Secure Boot"); + + int32_t top_h = theme_corner_button_height() + theme_default_padding(); + body = theme_create_page_container(screen); + lv_obj_set_size(body, LV_PCT(100), theme_screen_height() - top_h); + lv_obj_align(body, LV_ALIGN_BOTTOM_MID, 0, 0); + lv_obj_set_style_pad_all(body, theme_default_padding(), 0); + lv_obj_set_style_pad_gap(body, theme_small_padding(), 0); + lv_obj_set_flex_flow(body, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(body, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, + LV_FLEX_ALIGN_CENTER); + lv_obj_add_flag(body, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_scrollbar_mode(body, LV_SCROLLBAR_MODE_AUTO); + + start_task(false); +} + +void secure_boot_page_show(void) { + if (screen) + lv_obj_clear_flag(screen, LV_OBJ_FLAG_HIDDEN); +} + +void secure_boot_page_hide(void) { + if (screen) + lv_obj_add_flag(screen, LV_OBJ_FLAG_HIDDEN); +} + +void secure_boot_page_destroy(void) { + session_cleanup_unregister(secure_boot_page_destroy); + if (running) { + worker_task_wait(); + running = false; + } + enabling = false; + if (poll_timer) { + lv_timer_del(poll_timer); + poll_timer = NULL; + } + if (progress) { + lv_obj_del(progress); + progress = NULL; + } + if (pin_open) { + pin_page_destroy(); + pin_open = false; + } + if (screen) { + lv_obj_del(screen); + screen = NULL; + } + body = NULL; + return_callback = NULL; +} diff --git a/main/pages/login/secure_boot_page.h b/main/pages/login/secure_boot_page.h new file mode 100644 index 00000000..f0f4a480 --- /dev/null +++ b/main/pages/login/secure_boot_page.h @@ -0,0 +1,11 @@ +#ifndef SECURE_BOOT_PAGE_H +#define SECURE_BOOT_PAGE_H + +#include + +void secure_boot_page_create(lv_obj_t *parent, void (*return_cb)(void)); +void secure_boot_page_show(void); +void secure_boot_page_hide(void); +void secure_boot_page_destroy(void); + +#endif // SECURE_BOOT_PAGE_H diff --git a/main/pages/login/security_settings.c b/main/pages/login/security_settings.c index f582b052..6dfaedd5 100644 --- a/main/pages/login/security_settings.c +++ b/main/pages/login/security_settings.c @@ -1,4 +1,4 @@ -// Security Settings Page - PIN management and session timeout +// Security Settings Page - PIN management, session timeout and secure boot #include "security_settings.h" #include "../../core/pin.h" @@ -10,6 +10,7 @@ #include "../../utils/session_cleanup.h" #include "../pin/pin_page.h" #include "../pin/pin_settings.h" +#include "secure_boot_page.h" #include // -- Top-level security menu -- @@ -102,6 +103,19 @@ static void destroy_timeout_page(void) { } } +// ── Secure boot ── + +static void secure_boot_return(void) { + secure_boot_page_destroy(); + ui_menu_show(security_menu); +} + +static void secure_boot_cb(void) { + ui_menu_hide(security_menu); + secure_boot_page_create(lv_screen_active(), secure_boot_return); + secure_boot_page_show(); +} + // ── Menu ── static void security_back_cb(void) { @@ -121,6 +135,7 @@ static void rebuild_menu(void) { ui_menu_add_entry(security_menu, "Set Up PIN", setup_pin_cb); } ui_menu_add_entry(security_menu, "Session Timeout", show_timeout_page); + ui_menu_add_entry(security_menu, "Secure Boot", secure_boot_cb); } // ── Public lifecycle ── @@ -147,6 +162,7 @@ void security_settings_page_hide(void) { void security_settings_page_destroy(void) { session_cleanup_unregister(security_settings_page_destroy); pin_settings_page_destroy(); + secure_boot_page_destroy(); destroy_timeout_page(); if (security_menu) { ui_menu_destroy(security_menu); diff --git a/scripts/format.sh b/scripts/format.sh index 2065925b..490c068c 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -37,6 +37,7 @@ fi DIRS=( "$REPO_ROOT/main" + "$REPO_ROOT/bootloader_components" "$REPO_ROOT/components/secure_memory" "$REPO_ROOT/components/bbqr" "$REPO_ROOT/components/bip138" diff --git a/sdkconfig.sbtest b/sdkconfig.sbtest new file mode 100644 index 00000000..9dc58c56 --- /dev/null +++ b/sdkconfig.sbtest @@ -0,0 +1,3 @@ +# Secure boot dry run (`just sbtest-build`): eFuse writes go to a RAM copy and +# vanish on reboot, so the Settings lockdown can run end to end on a real board. +CONFIG_EFUSE_VIRTUAL=y diff --git a/sdkconfig.secure b/sdkconfig.secure new file mode 100644 index 00000000..72878298 --- /dev/null +++ b/sdkconfig.secure @@ -0,0 +1,9 @@ +# Secure boot capable build: the bootloader verifies every app at boot once +# secure boot is enabled. It never enables it by itself +# (bootloader_components/secure_boot_opt_in); the app does, from Settings. +CONFIG_SECURE_BOOT=y +CONFIG_SECURE_BOOT_V2_ENABLED=y +CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y +# The default, secure download mode, would be burned by every app at startup. +# The Settings lockdown burns it together with SECURE_BOOT_EN. +CONFIG_SECURE_INSECURE_ALLOW_DL_MODE=y diff --git a/simulator/CMakeLists.txt b/simulator/CMakeLists.txt index b0d36d45..0c45b5b1 100644 --- a/simulator/CMakeLists.txt +++ b/simulator/CMakeLists.txt @@ -137,6 +137,7 @@ set(STUB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/platform/esp_idf_stubs/efuse_hmac_sim.c ${CMAKE_CURRENT_SOURCE_DIR}/platform/esp_idf_stubs/freertos_sim.c ${CMAKE_CURRENT_SOURCE_DIR}/platform/esp_idf_stubs/fw_update_sim.c + ${CMAKE_CURRENT_SOURCE_DIR}/platform/esp_idf_stubs/secure_boot_sim.c ) # --- Application utilities --- @@ -277,6 +278,7 @@ set(APP_PAGE_SOURCES ${APP_PAGES_DIR}/login/login_scan.c ${APP_PAGES_DIR}/login/login_settings.c ${APP_PAGES_DIR}/login/security_settings.c + ${APP_PAGES_DIR}/login/secure_boot_page.c ${APP_PAGES_DIR}/login/about.c # Load mnemonic ${APP_PAGES_DIR}/load_mnemonic/load_menu.c @@ -388,6 +390,9 @@ add_executable(kern_simulator ${BIP138_SOURCES} ) +include(${CMAKE_CURRENT_SOURCE_DIR}/../main/core/sb_digests.cmake) +kern_generate_sb_digests(${CMAKE_CURRENT_BINARY_DIR}/generated) + # Include paths — order matters: simulator headers shadow ESP-IDF target_include_directories(kern_simulator PRIVATE # Simulator stubs (highest priority — shadow ESP-IDF headers) @@ -400,6 +405,7 @@ target_include_directories(kern_simulator PRIVATE ${MBEDTLS_INCLUDE_DIR} # Application source tree ${CMAKE_CURRENT_SOURCE_DIR}/../main # ui/theme.h, core/, utils/, pages/ + ${CMAKE_CURRENT_BINARY_DIR}/generated # kern_sb_digests.h # Component headers (for kef.c -> deflate_codec, cUR, k_quirc, video) ${CMAKE_CURRENT_SOURCE_DIR}/../components ${CMAKE_CURRENT_SOURCE_DIR}/../components/bbqr/src diff --git a/simulator/platform/esp_idf_stubs/secure_boot_sim.c b/simulator/platform/esp_idf_stubs/secure_boot_sim.c new file mode 100644 index 00000000..17782399 --- /dev/null +++ b/simulator/platform/esp_idf_stubs/secure_boot_sim.c @@ -0,0 +1,83 @@ +/* Simulator stand-in for core/secure_boot.c: no eFuses or signed images on + * the desktop. Starts off and ready once a PIN is set; a finished lockdown + * persists in /secure_boot.sim, which `just sim-reset` removes. + * + * KERN_SIM_SECURE_BOOT previews the other screens: + * ready ready without a PIN + * build | pin | slots | app | bootloader | read blocked, with that reason + * partial | incomplete interrupted lockdown + * fail the burn reports failure + */ + +#include "../../../main/core/secure_boot.h" +#include "../../../main/core/pin.h" +#include "kern_sb_digests.h" +#include "sim_nvs.h" +#include +#include +#include +#include + +static const char *mode(void) { + const char *m = getenv("KERN_SIM_SECURE_BOOT"); + return m ? m : ""; +} + +static void state_path(char *buf, size_t n) { + snprintf(buf, n, "%s/secure_boot.sim", sim_nvs_get_data_dir()); +} + +static bool locked(void) { + char path[512]; + state_path(path, sizeof(path)); + return access(path, F_OK) == 0; +} + +void secure_boot_read_status(secure_boot_status_t *out) { + static const struct { + const char *name; + secure_boot_check_t check; + } blocked[] = { + {"build", SECURE_BOOT_ERR_BUILD}, + {"pin", SECURE_BOOT_ERR_PIN}, + {"slots", SECURE_BOOT_ERR_KEY_SLOTS}, + {"app", SECURE_BOOT_ERR_APP}, + {"bootloader", SECURE_BOOT_ERR_BOOTLOADER}, + {"read", SECURE_BOOT_ERR_READ}, + }; + + memset(out, 0, sizeof(*out)); + memcpy(out->digests, KERN_SB_DIGESTS, sizeof(out->digests)); + usleep(300 * 1000); /* the device hashes the running firmware */ + + if (locked()) { + out->state = SECURE_BOOT_ON; + return; + } + if (strcmp(mode(), "incomplete") == 0) { + out->state = SECURE_BOOT_INCOMPLETE; + return; + } + out->state = + strcmp(mode(), "partial") == 0 ? SECURE_BOOT_PARTIAL : SECURE_BOOT_OFF; + out->check = pin_is_configured() || strcmp(mode(), "ready") == 0 + ? SECURE_BOOT_READY + : SECURE_BOOT_ERR_PIN; + for (size_t i = 0; i < sizeof(blocked) / sizeof(blocked[0]); i++) + if (strcmp(mode(), blocked[i].name) == 0) + out->check = blocked[i].check; +} + +esp_err_t secure_boot_enable(void) { + usleep(1000 * 1000); + if (strcmp(mode(), "fail") == 0) + return ESP_FAIL; + char path[512]; + state_path(path, sizeof(path)); + FILE *f = fopen(path, "w"); + if (!f) + return ESP_FAIL; + fputs("on\n", f); + fclose(f); + return ESP_OK; +} From 9052d5951ad3ce299c894676ca2b9d4a2802856c Mon Sep 17 00:00:00 2001 From: odudex Date: Wed, 11 Nov 2026 15:58:19 -0300 Subject: [PATCH 02/20] docs(security): drop flash encryption, describe the Settings lockdown and the frozen bootloader --- docs/secure-boot.md | 508 +++++++++++++++++++------------------ docs/security-plan.md | 193 +++++++------- kern_secure_boot/README.md | 54 ++-- 3 files changed, 386 insertions(+), 369 deletions(-) diff --git a/docs/secure-boot.md b/docs/secure-boot.md index 6c5ee694..c680d347 100644 --- a/docs/secure-boot.md +++ b/docs/secure-boot.md @@ -71,9 +71,7 @@ The ESP32-P4 provides six eFuse key blocks (BLOCK_KEY0–KEY5). Secure Boot v2 s | KEY1 (BLOCK_KEY1) | Secure Boot Digest 1 — first rotation/backup key | Available for rotation #1 | | KEY2 (BLOCK_KEY2) | Secure Boot Digest 2 — second rotation/backup key | Available for rotation #2 | -KEY3 holds the flash-encryption key (Phase 5), KEY4 the NVS-encryption HMAC (Phase 3), and KEY5 the anti-phishing HMAC (Phase 2). All six blocks are allocated. Because **all three secure-boot digest slots are populated**, there is no free digest slot for an attacker to inject a rogue signing key. - -> **Flash-encryption interaction:** With three digest slots consuming KEY0–KEY2, only one key block (KEY3) is left for flash encryption. XTS-AES-256 normally needs two blocks. Kern keeps 256-bit strength by deploying the flash-encryption key through the ESP32-P4 **Key Manager** (Kconfig choice `SECURE_FLASH_ENCRYPTION_KEY_SOURCE`, option `..._KEY_MGR`), which stores the key outside the shared eFuse blocks. If the Key Manager path is not used, fall back to **XTS-AES-128** in KEY3 (single block). This is a Phase 5 decision — see [security-plan.md](security-plan.md). +KEY4 holds the NVS-encryption HMAC (Phase 3) and KEY5 the anti-phishing HMAC (Phase 2). KEY3 is unused: Kern does not use flash encryption (see [security-plan.md](security-plan.md#phase-5-flash-encryption-dropped)). Because **all three secure-boot digest slots are populated**, there is no free digest slot for an attacker to inject a rogue signing key. ### Revocation @@ -92,8 +90,9 @@ Once a revocation bit is set, the ROM bootloader will no longer accept signature Setting the `SECURE_BOOT_EN` eFuse bit permanently enables secure boot. From that moment: - Only firmware signed with a key whose digest matches a non-revoked eFuse slot will boot. -- Serial flashing of unsigned firmware is blocked (UART download mode is restricted). -- The device can only be updated via signed images (SD card OTA, in place since Phase 4). +- Unsigned firmware written over serial no longer starts, and ROM download mode is restricted to secure download mode (no flash readout). +- The device can only be updated with signed images: the app over SD card (in place since Phase 4), or a signed release over USB. +- The second-stage bootloader on the device stays as it is. SD updates never write it, and replacing it over USB needs another bootloader signed by a non-revoked key. This is why Kern ships a **frozen bootloader** ([Section 4a](#4a-the-frozen-bootloader)). --- @@ -197,6 +196,7 @@ kern-sb-key2-pub.pem # Public key 2 (rotation #2) kern-sb-digest0.bin # SHA-256 digest of key 0 (32 bytes, for eFuse) kern-sb-digest1.bin # SHA-256 digest of key 1 (32 bytes, for eFuse) kern-sb-digest2.bin # SHA-256 digest of key 2 (32 bytes, for eFuse) +bootloaders/ # Frozen bootloaders and their manifest (Section 4a) SHA256SUMS # Checksums of all release artifacts SHA256SUMS.sig # GPG or SSH signature of SHA256SUMS ``` @@ -221,6 +221,8 @@ sha256sum \ kern-sb-digest0.bin \ kern-sb-digest1.bin \ kern-sb-digest2.bin \ + bootloaders/BOOTLOADERS \ + bootloaders/*/bootloader-signed.bin \ > SHA256SUMS # Sign the checksums file with GPG @@ -240,61 +242,9 @@ sha256sum -c SHA256SUMS The public key digests (SHA-256 of the public keys) are not secret — they are derived from the public keys and are safe to distribute. Kern embeds them directly in the firmware binary so that devices can activate secure boot without requiring external files. -**Generated header:** - -A build-time script generates a header from the configured public keys: - -```bash -# scripts/generate_sb_digests.h.py -# Reads public key PEM files and outputs a C header with digest constants. -# Usage: python scripts/generate_sb_digests.h.py \ -# kern-sb-key0-pub.pem kern-sb-key1-pub.pem kern-sb-key2-pub.pem \ -# > components/secure_boot/include/kern_sb_digests.h -``` - -The generated header contains: - -```c -// kern_sb_digests.h — AUTO-GENERATED, DO NOT EDIT -// Rebuild with: just generate-sb-digests - -#pragma once -#include - -// SHA-256 of kern-sb-key0-pub.pem (primary) -static const uint8_t KERN_SB_DIGEST0[32] = { - 0xa1, 0xb2, 0xc3, 0xd4, /* ... 32 bytes total ... */ -}; - -// SHA-256 of kern-sb-key1-pub.pem (rotation #1) -static const uint8_t KERN_SB_DIGEST1[32] = { - 0xe5, 0xf6, 0x07, 0x18, /* ... 32 bytes total ... */ -}; - -// SHA-256 of kern-sb-key2-pub.pem (rotation #2) -static const uint8_t KERN_SB_DIGEST2[32] = { - 0x29, 0x3a, 0x4b, 0x5c, /* ... 32 bytes total ... */ -}; - -// Number of developer digest slots -#define KERN_SB_DEVELOPER_DIGEST_COUNT 3 -``` - -Note that the eFuse digest is a 32-byte SHA-256 regardless of the signature scheme, so the embedded-digest and on-device lockdown mechanics are identical whether the keys are RSA-3072 or ECDSA. - -**Build integration:** +**Embedded at build time:** `main/core/sb_digests.cmake` reads `kern_secure_boot/kern-sb-digest{0,1,2}.bin` when CMake configures the build and writes `kern_sb_digests.h` (`KERN_SB_DIGESTS[3][32]`) into the build tree. Only the `.bin` files are checked in, and `SHA256SUMS.sig` already covers them, so the firmware cannot drift from the published digests. Each file must equal `espsecure digest-sbv2-public-key` of the matching public key. -```bash -# Justfile target -generate-sb-digests: - python scripts/generate_sb_digests.h.py \ - kern-sb-key0-pub.pem kern-sb-key1-pub.pem kern-sb-key2-pub.pem \ - > components/secure_boot/include/kern_sb_digests.h -``` - -The generated header is checked into the repository. It changes only when the signing keys change (which should be extremely rare — ideally never after the initial key ceremony). CI can verify that the header matches the public keys in the repo. - -**Self-sovereign builds:** Users building from source with their own keys run `just generate-sb-digests` with their own public key files. The header is regenerated with their digests, and the firmware-driven lockdown menu (Section 5a) will burn those instead. +**Self-sovereign builds:** replace the three `.bin` files with the digests of your own public keys (`espsecure digest-sbv2-public-key --keyfile my-keyN-pub.pem -o kern_secure_boot/kern-sb-digestN.bin`) and rebuild; the lockdown menu (Section 5a) then checks the app and bootloader against those keys and burns those digests instead. See Section 5b for the bootloader such a build needs. ### 3e. Key Ceremony Checklist @@ -346,106 +296,170 @@ Signed by: ___________________________ (date: ____-__-__) ## 4. Developer Workflow -### 4a. Signing Firmware +### 4a. The Frozen Bootloader -When `CONFIG_SECURE_BOOT=y` and the signing key path is configured in sdkconfig, the ESP-IDF build system automatically signs the bootloader and app images with the configured key. +A locked device keeps the bootloader it was locked with. SD updates only write the app slot, and after lockdown the ROM accepts a bootloader only if a non-revoked key signed it. That bootloader also has to carry signatures from **all three** keys, or a later revocation could leave it with none that count (Section 6), and the lockdown menu refuses anything less (Section 5a). -> **Sign the bootloader with all three keys.** The second-stage bootloader is frozen at initial flash — it is never updated by OTA. To survive key rotations, it must carry a signature from every key whose digest will remain valid after future revocations. Sign the bootloader with key0, key1, **and** key2 (appended signatures). The app only needs the current key, because a rotated app can be re-signed and re-deployed via SD card OTA. +Signing a bootloader with all three keys means taking keys 1 and 2 out of cold storage. Doing that for every release would defeat the reason they are cold. So the bootloader is built, signed once in a key ceremony, and committed; every release after that ships those same bytes. Only the app is built and signed per release, with key 0. -**Manual signing** (for air-gapped workflows where the build machine doesn't have the key): +> **Status:** the bootloader component (`bootloader_components/secure_boot_opt_in`), the `sdkconfig.secure` overlay and the dry run exist. The staging recipe, the freeze script, the release-script changes, the CI checks and the web flasher changes described below are planned and not implemented yet. No bootloader has been frozen. -```bash -# Sign the app image with the current primary key -espsecure sign-data \ - --version 2 \ - --keyfile kern-sb-key0.pem \ - --output kern-signed.bin \ - build/kern.bin +**Variants.** The bootloader does not depend on the display, touch or camera, so most boards share one. Two settings split it: the chip revision range (v1.x and v3.x need different builds, and the v3 bootloader runs a different CPU clock) and the flash mode (wave_35 uses DIO, the rest QIO). That gives four: -# Sign the bootloader with ALL three keys (append each signature) -espsecure sign-data \ - --version 2 \ - --keyfile kern-sb-key0.pem \ - --output bl-tmp0.bin \ - build/bootloader/bootloader.bin -espsecure sign-data \ - --version 2 \ - --keyfile kern-sb-key1.pem \ - --append-signatures \ - --output bl-tmp1.bin \ - bl-tmp0.bin -espsecure sign-data \ - --version 2 \ - --keyfile kern-sb-key2.pem \ - --append-signatures \ - --output bootloader-signed.bin \ - bl-tmp1.bin -``` +| Variant | Boards | +|---------|--------| +| `v1-qio` | wave_4b, wave_5, wave_43, wave_7b, crowpanel, p4_pico | +| `v1-dio` | wave_35 | +| `v3-qio` | the `_v3` builds of the `v1-qio` boards | +| `v3-dio` | wave_35_v3 | -**Verify a signature:** +Measured so far: the release bootloaders of wave_4b, wave_5 and crowpanel are byte-identical, and wave_35's differs. The other rows follow from the board configs and get confirmed when the staging recipe builds every board and groups them by hash. A new board joins an existing variant when its unsigned bootloader matches; otherwise it needs a freeze of its own. -```bash -espsecure verify-signature \ - --version 2 \ - --keyfile kern-sb-key0-pub.pem \ - kern-signed.bin +**What a freeze fixes.** These are properties of the bootloader, so on a locked device they change only through a new freeze and a USB reflash: + +- The ESP-IDF version the bootloader is built from, and its bugs. +- `secure_boot_opt_in`, which keeps the bootloader from enabling secure boot by itself (Section 5a). +- Anti-rollback: the boot-time refusal of an older app is bootloader code (Section 7). +- The log level and other `sdkconfig.release` settings that reach the bootloader. +- The partition table offset and the bootloader's size limit (56 KB). + +Each freeze gets a number in `CONFIG_BOOTLOADER_PROJECT_VER` (`sdkconfig.secure`), which lands in the bootloader's description block. The app can read it (`esp_ota_get_bootloader_description()`), so the Secure Boot page and bug reports can say which freeze a device runs. + +**Compatibility rule.** Every release must boot on every frozen bootloader still in the field. An app-side change that needs a newer bootloader is a breaking change for locked devices and needs a re-freeze plus a USB reflash by the user. + +**Where it lives.** + +``` +kern_secure_boot/bootloaders/ + BOOTLOADERS # manifest + v1-qio/bootloader-signed.bin + v1-dio/bootloader-signed.bin + v3-qio/bootloader-signed.bin + v3-dio/bootloader-signed.bin ``` -### 4b. Dev vs. Production Builds +`BOOTLOADERS` has one line per variant: freeze number, git tag, ESP-IDF version, the boards it serves, and the SHA-256 of the unsigned image. `SHA256SUMS` covers the manifest and the binaries, so the existing `SHA256SUMS.sig` vouches for them together with the public keys. -Maintain two sdkconfig profiles: +**Anyone can check it.** A secure build writes `bootloader/bootloader-unsigned.bin`, and that file comes out identical across build directories. Building the freeze tag with the manifest's ESP-IDF version must reproduce every byte of the frozen image up to its signature sector, and `espsecure verify-signature` checks the sector against each public key. -| Profile | Secure Boot | Serial Flash | Use Case | -|---------|-------------|-------------|----------| -| `sdkconfig.defaults` | Disabled | Works | Daily development, debugging | -| `sdkconfig.defaults` + `sdkconfig.secure` | Enabled | Blocked after lockdown | Production releases | +**The freeze.** -**Development build** (default): +1. On the build machine, at the commit to freeze: `just bootloader-stage` builds only the bootloader (`sdkconfig.release` + `sdkconfig.secure`) for every board, groups the unsigned images by hash, and stages one per variant with a draft manifest. +2. On the air-gapped signing machine, with all three private keys: `scripts/freeze_bootloader.sh` signs each staged image with key 0, appends key 1 and key 2, verifies the result against the three published public keys, and writes the manifest hashes. By hand that is: ```bash -idf.py build -# or -just build +espsecure sign-data --version 2 --keyfile kern-sb-key0.pem \ + --output bl-1sig.bin bootloader-unsigned.bin +espsecure sign-data --version 2 --keyfile kern-sb-key1.pem --append-signatures \ + --output bl-2sig.bin bl-1sig.bin +espsecure sign-data --version 2 --keyfile kern-sb-key2.pem --append-signatures \ + --output bootloader-signed.bin bl-2sig.bin + +for n in 0 1 2; do + espsecure verify-signature --version 2 \ + --keyfile kern-sb-key${n}-pub.pem bootloader-signed.bin +done ``` -**Production build** (with secure boot overlay): +3. Back on the build machine: copy the result into `kern_secure_boot/bootloaders/`, regenerate `SHA256SUMS`, sign it with GPG, commit, and tag the commit `bootloader-`. + +Fill this in at each freeze and keep it with the key ceremony record (Section 3e): -```bash -idf.py -D "SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.secure" build ``` +=== Kern Bootloader Freeze === -The `sdkconfig.secure` overlay is defined in [Section 8](#8-sdkconfigsecure-overlay). +Date: ____-__-__ +Freeze number: ____ (CONFIG_BOOTLOADER_PROJECT_VER) +Git commit/tag: ___________________________ +ESP-IDF version: ___________________________ +Anti-rollback: on / off -### 4c. CI Pipeline +Before the ceremony: + [ ] Dry run passed on this commit (Section 8) + [ ] An image from this commit was locked for real on a sacrificial board + [ ] That board took an SD update and a USB reflash after the lock -**Recommended approach: CI builds unsigned, developer signs locally.** +Per variant (unsigned SHA-256, first 16 hex): + v1-qio ________________ [ ] key0 [ ] key1 [ ] key2 [ ] verified + v1-dio ________________ [ ] key0 [ ] key1 [ ] key2 [ ] verified + v3-qio ________________ [ ] key0 [ ] key1 [ ] key2 [ ] verified + v3-dio ________________ [ ] key0 [ ] key1 [ ] key2 [ ] verified -This keeps private keys off any networked machine. +After: + [ ] Keys 1 and 2 returned to cold storage + [ ] SHA256SUMS regenerated and signed + [ ] Committed and tagged bootloader- +Signed by: ___________________________ ``` -CI Pipeline: - 1. Build firmware (no signing key configured) - 2. Upload unsigned .bin as build artifact - 3. Verify build reproducibility (optional) -Developer (air-gapped): - 4. Download unsigned .bin - 5. Sign with espsecure sign-data (bootloader with all 3 keys, app with primary) - 6. Verify signature with public key - 7. Upload signed .bin to GitHub Release -``` +**Re-freeze.** Reasons to do it again: a bootloader bug or security fix, turning anti-rollback on, a new chip revision or flash mode, or an ESP-IDF update whose apps no longer boot on the old bootloader. A re-freeze is the same ceremony with the next number and whichever keys are not revoked. It reaches a device only when its owner reflashes over USB; devices that never do keep the old bootloader, which is why the compatibility rule above holds for as long as an old freeze is in use. + +### 4b. Signing a Release -**CI verification** (runs on every build, uses public key only): +Per release, only the app is signed, and only with key 0. `scripts/release.sh` builds every board with `sdkconfig.release` + `sdkconfig.secure`; `scripts/sign_release.sh` runs on the air-gapped machine: ```bash -# CI can verify that a release binary was signed correctly +espsecure sign-data \ + --version 2 \ + --keyfile kern-sb-key0.pem \ + --output firmware-signed.bin \ + kern-unsigned.bin + espsecure verify-signature \ --version 2 \ --keyfile kern-sb-key0-pub.pem \ - kern-signed.bin + firmware-signed.bin +``` + +The bootloader in each release zip is the frozen one for that board's variant, not the one the release build produced: + +- `release.sh` picks the variant from the generated sdkconfig (chip revision range and flash mode) and packages `kern_secure_boot/bootloaders//bootloader-signed.bin`. +- It compares the freshly built `bootloader-unsigned.bin` with the frozen image and warns when they differ. A difference means the bootloader sources, their config or ESP-IDF moved since the freeze. The release still ships the frozen one; the warning is the prompt to ask whether a re-freeze is due. +- `sign_release.sh` refuses to package a bootloader that does not verify against all three public keys. It needs no private key for that. + +Before publishing, boot the new app on each frozen variant, and install it over SD on the locked reference board. + +**Installing a lockable release.** The frozen bootloader reaches a device only over USB, with the web flasher or `esptool`. A device that was installed from an earlier release and kept up to date over SD still has its old bootloader, which does not verify apps at boot; the lockdown menu says so and refuses. One USB install of a release zip fixes that. It does not erase the device: the release image leaves NVS and storage alone. + +**USB flashing a locked device.** Secure download mode still writes flash; it refuses to read it. So a locked device can take a new signed app or a newer frozen bootloader over USB. Two things have to hold in the flasher: + +- It must write the bootloader unmodified. Rewriting the flash mode, frequency or size in the image header changes the signed bytes and the ROM then rejects the bootloader, so the flasher uses `keep` for all three. +- It must work without the commands secure download mode removes (register reads, the flasher stub). The web flasher's chip-revision read fails there, so it has to tolerate that and ask which chip revision the board has. + +### 4c. Build Profiles + +| Build | Overlays | Bootloader | Use | +|-------|----------|-----------|-----| +| `just build ` | board defaults | Plain. Never verifies apps, cannot be locked | Daily development | +| `just build-release ` | + `sdkconfig.release` | Plain | Release log and panic settings, for reproducing release behaviour | +| `scripts/release.sh` | + `sdkconfig.release` + `sdkconfig.secure` | Frozen, from `kern_secure_boot/bootloaders/` | Published releases | +| `just sbtest-flash ` | + `sdkconfig.secure` + `sdkconfig.sbtest` | Test-key signed, virtual eFuses | Dry run of the lockdown (Section 8) | + +`sdkconfig.secure` is described in [Section 8](#8-sdkconfigsecure-overlay). Development builds stay without it: `idf.py flash` skips the bootloader when secure boot is configured, and a secure-boot bootloader has no place on a board that is reflashed all day. + +### 4d. CI Pipeline + +CI builds and never signs; private keys stay off every networked machine. + +``` +CI: + 1. Build firmware for every board + 2. Check the frozen bootloaders (below) + +Developer (air-gapped): + 3. Sign each app with key 0 (scripts/sign_release.sh) + 4. Verify signatures with the public keys + 5. Publish the signed release ``` -**Alternative: CI signing with GitHub encrypted secrets.** The signing key is stored as a GitHub encrypted secret and used during CI builds. This is more convenient but increases the attack surface — a compromised CI pipeline or GitHub account could sign malicious firmware. Not recommended for a security-critical project like a signing device. +Checks on the frozen bootloaders, none of which needs a secret: + +- Every `bootloader-signed.bin` verifies against all three public keys, and the image before its signature sector hashes to the manifest value. +- When CI's ESP-IDF version equals the manifest's, the bootloader built from the freeze tag matches the frozen one byte for byte. This is what ties the committed binaries to source. +- On every build with `sdkconfig.secure`, a mismatch between the built and the frozen bootloader is reported, as in `release.sh`. + +Signing in CI with a key held as a repository secret would be more convenient and is not an option here: a compromised pipeline or account could then sign firmware. --- @@ -461,7 +475,8 @@ The developer's public key digests are embedded in the firmware binary (see [Sec **Prerequisites:** -- Device running signed Kern firmware (flashed via serial before lockdown). +- A PIN is set up (it seals KEY4 and KEY5, which must be read-protected before secure boot). +- The device was installed **over USB** from a release that ships the frozen bootloader (Section 4a). SD updates do not replace the bootloader, so a device that only ever updated over SD since an older release needs one USB install first. - The user has verified the release artifacts with GPG before flashing: ```bash @@ -471,17 +486,19 @@ sha256sum -c SHA256SUMS **Steps:** -1. Flash the signed firmware via serial (last time serial will work): +1. Install the release over USB, with the web flasher or with `esptool` from the unpacked release zip: ```bash -esptool --chip esp32p4 write-flash \ - 0x2000 bootloader-signed.bin \ - 0x20000 kern-signed.bin +esptool --chip esp32p4 write-flash --flash-mode keep --flash-freq keep --flash-size keep \ + 0x2000 bootloader.bin \ + 0x10000 partition-table.bin \ + 0x1e000 ota_data_initial.bin \ + 0x20000 firmware-signed.bin ``` -> The ESP32-P4 second-stage bootloader lives at flash offset **0x2000** — not 0x0 or 0x1000 as on older chips. `0x20000` is the app slot (`ota_0` after the Phase 3 partition migration; previously `factory`). A blank chip additionally needs the partition table at `0x8000` and `ota_data_initial.bin` at the `otadata` offset. +> The ESP32-P4 second-stage bootloader lives at flash offset **0x2000** — not 0x0 or 0x1000 as on older chips. `bootloader.bin` in a release zip is the frozen, triple-signed bootloader for that board. The `keep` options matter: letting esptool rewrite the header would change the signed bytes. -2. Boot into Kern and navigate to **Settings → Secure Boot → Lock with Developer Keys**. +2. Boot into Kern and navigate to **Settings → Security → Secure Boot** (the pre-login Settings). 3. The device displays: - The hex representation of Digest 0, Digest 1, and Digest 2 (from the embedded constants). - A warning that this action is **irreversible**. @@ -491,11 +508,11 @@ esptool --chip esp32p4 write-flash \ - Verifies that `SECURE_BOOT_EN` is not already set. - Verifies that KEY0, KEY1, and KEY2 eFuse blocks are empty — or already contain exactly the three embedded digests, in which case it offers to **resume** an interrupted lockdown (see power-cut note below). - Verifies the running app carries a valid signature **and** that the signing key's digest matches one of the embedded digests — a valid signature from a non-matching key would still brick on reboot. - - Verifies the bootloader image in flash (offset 0x2000): every embedded digest must be covered by one of its appended signatures, because the bootloader can never be re-signed after lockdown. + - Verifies the bootloader image in flash (offset 0x2000): each of the three embedded keys must have a valid signature on it. This is a cryptographic check against the embedded keys, not a comparison of displayed hashes, and it is what ties the device to the frozen bootloader: a bootloader signed by fewer keys, by other keys, or built without secure boot support is refused. - Writes `KERN_SB_DIGEST0` to `BLOCK_KEY0` with purpose `SECURE_BOOT_DIGEST0`. - Writes `KERN_SB_DIGEST1` to `BLOCK_KEY1` with purpose `SECURE_BOOT_DIGEST1`. - Writes `KERN_SB_DIGEST2` to `BLOCK_KEY2` with purpose `SECURE_BOOT_DIGEST2`. - - Burns the hardening eFuses the stock bootloader would burn alongside secure boot: `DIS_DIRECT_BOOT`, the JTAG-disable set (`DIS_PAD_JTAG`, `DIS_USB_JTAG`, `SOFT_DIS_JTAG`), and secure ROM download mode (full download-mode disable is deferred to Phase 7). + - Burns the hardening eFuses the stock bootloader would burn alongside secure boot: `DIS_DIRECT_BOOT`, the JTAG-disable set (`DIS_PAD_JTAG`, `DIS_USB_JTAG`, `SOFT_DIS_JTAG`), and secure ROM download mode. - Burns the `SECURE_BOOT_EN` eFuse bit. - Write-protects `RD_DIS` — otherwise an attacker could later *read-protect* a digest block, blinding the ROM verifier: a permanent brick. - Displays confirmation with the final eFuse state. @@ -503,64 +520,22 @@ esptool --chip esp32p4 write-flash \ **Implementation notes:** -The lockdown function should follow this sequence: - -```c -#include "esp_efuse.h" -#include "esp_efuse_table.h" -#include "esp_secure_boot.h" -#include "kern_sb_digests.h" - -esp_err_t kern_secure_boot_lockdown(void) { - // 1. Pre-flight checks - // - SECURE_BOOT_EN not already set - // - KEY0/KEY1/KEY2 empty, or holding exactly the embedded digests (resume path) - // - Running app: signature verifies AND its public-key digest matches an - // embedded digest — esp_secure_boot_verify_rsa_signature_block(). - // (The generic esp_secure_boot_verify_signature_block() was removed in - // ESP-IDF 6.0 — use the RSA-specific variant.) - // - Bootloader image at 0x2000: every embedded digest covered by one of its - // appended signatures (it can never be re-signed after lockdown) - - // 2. Burn digests (batch so a power cut can't leave a half-written set); - // skipped when resuming an interrupted lockdown that already burned them - esp_efuse_batch_write_begin(); - esp_efuse_write_key(EFUSE_BLK_KEY0, - ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST0, KERN_SB_DIGEST0, 32); - esp_efuse_write_key(EFUSE_BLK_KEY1, - ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST1, KERN_SB_DIGEST1, 32); - esp_efuse_write_key(EFUSE_BLK_KEY2, - ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST2, KERN_SB_DIGEST2, 32); - esp_efuse_batch_write_commit(); - - // 3. Hardening eFuses — mirror esp_secure_boot_enable_secure_features() - // (esp-idf: components/bootloader_support/src/esp32p4/secure_boot_secure_features.c). - // The stock bootloader burns these when *it* enables secure boot; a custom - // lockdown flow that skips them leaves JTAG and serial flash readout wide open. - esp_efuse_write_field_bit(ESP_EFUSE_DIS_DIRECT_BOOT); - esp_efuse_write_field_bit(ESP_EFUSE_DIS_PAD_JTAG); - esp_efuse_write_field_bit(ESP_EFUSE_DIS_USB_JTAG); - esp_efuse_write_field_cnt(ESP_EFUSE_SOFT_DIS_JTAG, ESP_EFUSE_SOFT_DIS_JTAG[0]->bit_count); - esp_efuse_enable_rom_secure_download_mode(); // full disable deferred to Phase 7 - - // 4. Enable secure boot — POINT OF NO RETURN - esp_efuse_write_field_bit(ESP_EFUSE_SECURE_BOOT_EN); - - // 5. Block post-hoc read-protection of the digest blocks (RD_DIS on a digest - // block would blind the ROM verifier — a permanent brick vector) - esp_efuse_write_field_bit(ESP_EFUSE_WR_DIS_RD_DIS); - - return ESP_OK; -} -``` +`main/core/secure_boot.c` implements the checks and burns; `main/pages/login/secure_boot_page.c` is the menu. The page shows one of four states: not enabled, partially set up (digests burned, `SECURE_BOOT_EN` clear), enabled with the hardening set incomplete, or enabled with the burned digests. When a check fails it names the first one. The burn runs in two eFuse commits, so a power cut can never leave `SECURE_BOOT_EN` set without its digests: + +1. The empty digest slots (`esp_efuse_write_key`, batched), then a read-back of all three against the embedded digests. Anything but an exact match stops here. +2. One BLK0 commit: `DIS_DIRECT_BOOT`, `DIS_PAD_JTAG`, `DIS_USB_JTAG`, `SOFT_DIS_JTAG` up to all three bits, secure download mode, `SECURE_BOOT_EN`, and the `RD_DIS` write-protect. Each write is a no-op on a bit that is already burned, so the step can be repeated. + +The signature checks use `main/core/sbv2.c`, not IDF's verifier: before lockdown IDF trusts the running app's own keys, so it cannot say whether each *embedded* key signed an image. `sbv2.c` checks a signature sector block by block against a chosen digest (magic, RSA scheme, CRC, image digest, key digest, RSA-PSS), over the image hashed up to its 4 KiB-aligned signature sector as the ROM does; `main/core/test/test_sbv2.c` runs it against espsecure-signed fixtures. -> **Why secure download mode, not full disable:** Profile A has no flash encryption, so leaving ROM download mode fully open would allow flash readout over serial. Secure download mode blocks read commands while keeping *signed* serial re-flash available as a recovery path. Disabling download mode entirely is a Phase 7 (Profile B) decision. +> **The bootloader waits for the menu.** After lockdown the second-stage bootloader must verify every app against the eFuse digests, and IDF only compiles that check with `CONFIG_SECURE_BOOT=y`. A stock `CONFIG_SECURE_BOOT=y` bootloader, however, calls `esp_secure_boot_v2_permanently_enable()` on every boot, and on a chip without `SECURE_BOOT_EN` it burns the digests of its own signature blocks and the hardening set by itself: flashing it would *be* the lockdown, with no PIN, no warning, and possibly before KEY4/KEY5 are sealed. `bootloader_components/secure_boot_opt_in` links that call to a wrapper (`--wrap`) that returns without touching eFuses while `SECURE_BOOT_EN` is clear and runs the stock code once it is set (which then returns at once). Every bootloader-side eFuse write sits behind that one function. Until secure boot is on, the bootloader still checks each app against the app's own signature, so an unsigned image will not boot even then. A bootloader built without `CONFIG_SECURE_BOOT` would pass the ROM after lockdown but boot any app, so the menu refuses on firmware built without it, and a freeze must only ever sign bootloaders built with it (Section 4a). + +> **Why secure download mode, not full disable:** flash is not encrypted, so an open ROM download mode would allow flash readout over serial. Secure download mode refuses read commands and keeps USB reflashing of *signed* images, which is the recovery path and the only way to replace a frozen bootloader. Kern does not plan to disable download mode entirely. **Power-cut resume:** the digest batch and `SECURE_BOOT_EN` are separate eFuse writes. A power cut between them leaves KEY0–KEY2 occupied with secure boot still off. The menu must detect this state (all three blocks match the embedded digests, `SECURE_BOOT_EN` clear) and offer to *complete* the lockdown — a plain "blocks not empty → refuse" guard would make lockdown permanently uncompletable on such a device. The menu system must enforce: -- PIN entry before showing the lockdown option. +- PIN entry before anything is burned (status and digests show without it). - Display of all three digest hex values for visual verification. - An explicit confirmation prompt warning of irreversibility. - Verification that the running app **and** the flashed bootloader are signed by keys matching the embedded digests before proceeding (a device that locks down with a mismatched or unsigned image will brick on next boot). @@ -583,10 +558,9 @@ For advanced users who prefer command-line tools, or for development/testing: gpg --verify SHA256SUMS.sig SHA256SUMS sha256sum -c SHA256SUMS -# 2. Flash the signed firmware via serial (last time serial will work) -esptool --chip esp32p4 write-flash \ - 0x2000 bootloader-signed.bin \ - 0x20000 kern-signed.bin +# 2. Install the release over USB as in step 1 of the on-device method. +# The bootloader must be the frozen one: after step 5 the ROM rejects +# any bootloader these keys did not sign. # 3. Burn the three signing key digests into KEY0, KEY1, KEY2 espefuse --chip esp32p4 burn-key \ @@ -613,26 +587,45 @@ After step 5, only firmware signed with `kern-sb-key0.pem`, `kern-sb-key1.pem`, ### 5b. User Builds from Source (Self-Sovereign) -The user generates their own signing keys, builds firmware from source with `sdkconfig.secure`, and burns their own digests. They take full responsibility for key management and firmware signing. +The user generates their own signing keys, replaces the embedded digests, and builds, signs and flashes both the app and the bootloader. They take full responsibility for key management and firmware signing. The frozen bootloaders in `kern_secure_boot/bootloaders/` are of no use here: they carry the developer's signatures, and the lockdown menu of a build with other digests refuses them. ```bash # Generate own keys for n in 0 1 2; do espsecure generate-signing-key --version 2 --scheme rsa3072 my-key${n}.pem - espsecure extract-public-key --keyfile my-key${n}.pem my-key${n}-pub.pem done -# Generate the embedded digest header from the public keys -just generate-sb-digests \ - MY_KEY0_PUB=my-key0-pub.pem \ - MY_KEY1_PUB=my-key1-pub.pem \ - MY_KEY2_PUB=my-key2-pub.pem +# Replace the embedded digests with your own +for n in 0 1 2; do + espsecure digest-sbv2-public-key --keyfile my-key${n}.pem \ + -o kern_secure_boot/kern-sb-digest${n}.bin +done + +# Build with secure boot support (wave_4b shown) +idf.py -B build_secure -D SDKCONFIG=build_secure/sdkconfig \ + -D "SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.defaults.wave_4b;sdkconfig.release;sdkconfig.secure" build + +# Sign the app with key 0 +espsecure sign-data --version 2 --keyfile my-key0.pem \ + -o firmware-signed.bin build_secure/kern-unsigned.bin + +# Sign the bootloader with all three keys +espsecure sign-data --version 2 --keyfile my-key0.pem \ + -o bl-1sig.bin build_secure/bootloader/bootloader-unsigned.bin +espsecure sign-data --version 2 --keyfile my-key1.pem --append-signatures \ + -o bl-2sig.bin bl-1sig.bin +espsecure sign-data --version 2 --keyfile my-key2.pem --append-signatures \ + -o bootloader-signed.bin bl-2sig.bin -# Build with secure boot (configure key path in sdkconfig.secure) -idf.py -D "SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.secure" build +# Flash +esptool --chip esp32p4 write-flash --flash-mode keep --flash-freq keep --flash-size keep \ + 0x2000 bootloader-signed.bin \ + 0x10000 build_secure/partition_table/partition-table.bin \ + 0x1e000 build_secure/ota_data_initial.bin \ + 0x20000 firmware-signed.bin ``` -After flashing, the user can activate secure boot via the on-device menu (**Settings → Secure Boot → Lock with Developer Keys**). The menu will display the user's own digests (since the header was regenerated from their keys). The flow is identical to 5a — the firmware doesn't distinguish between "developer" and "user" digests; it burns whatever is embedded. +After flashing, the user activates secure boot from the on-device menu (**Settings → Security → Secure Boot**). The flow is the one in 5a: the firmware does not distinguish "developer" from "user" keys. It checks the running app and the flashed bootloader against whatever the three `.bin` files held at build time, shows those digests, and burns them. That bootloader is this user's own frozen bootloader: keep the signed file, since later app builds have to keep booting on it, and replacing it means signing a new one with the same keys. Alternatively, the user can burn digests manually with `espefuse` as described in the 5a alternative method, using their own digest `.bin` files. @@ -659,6 +652,8 @@ espefuse --chip esp32p4 burn-key \ espefuse --chip esp32p4 burn-efuse SECURE_BOOT_EN ``` +> The bootloader needs a valid signature from a burned, non-revoked key at all times. The published frozen bootloader is signed by the three developer keys only, so with one developer slot it survives only while that slot is not revoked; a user who wants independence from that signs their own bootloader with their own keys as in 5b. + > If any digest slot is intentionally left **empty**, revoke it before enabling secure boot (`espefuse burn-efuse SECURE_BOOT_KEY_REVOKE2`), so an attacker with physical access cannot later burn their own digest into the free slot. > **Future work:** An advanced lockdown menu option could allow the user to load one custom digest from SD card and burn it alongside the embedded developer digests. This would support the hybrid scenario without requiring `espefuse`. @@ -705,7 +700,8 @@ Second rotation (if ever needed): repeat with KEY1 -> KEY2, then **Constraints:** - Revocation is irreversible. Once `SECURE_BOOT_KEY_REVOKE0` is burned, KEY0 is permanently rejected. -- The **bootloader must have been signed with the successor key at initial flash** (Section 4a). Because the bootloader is frozen and never updated by OTA, revoking a key that the bootloader was *not* signed with will not brick it, but revoking the only key the bootloader *was* signed with will. Signing the bootloader with all three keys up front avoids this entirely. +- The **bootloader on the device must already carry the successor key's signature** (Section 4a). SD updates never replace it, so revoking the only key it was signed with bricks the device. The frozen bootloader carries all three signatures for exactly this reason, and the lockdown menu refuses a bootloader that does not. +- A bootloader frozen after a revocation is signed with the remaining keys only. It still boots on devices that have not revoked yet. - The transitional firmware **must** be installed on all devices before revoking the outgoing key. Devices that miss the update and still run outgoing-key-only firmware will be bricked after revocation (on the next full boot verification). - Three slots allow two rotations. After both are spent, only KEY2 remains and no further rotation is possible. @@ -722,6 +718,10 @@ Anti-rollback prevents downgrading to older firmware versions that may contain k - If the image's security version is lower than the eFuse counter, boot is rejected. - After successful boot, the eFuse counter is updated to match the image's security version (burning additional bits — irreversible). +### It Is Part of the Frozen Bootloader + +The boot-time check is bootloader code, compiled in by `CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK`. A bootloader frozen without it never refuses an older signed app at boot, whatever the app is built with; the app-side check on SD updates would still run, but writing an older signed release over USB would get past them. Turning it on later means a re-freeze and a USB reflash on every device that wants it. So the on/off decision has to be made before the first freeze (Section 4a). + ### Partition Layout Requirement Anti-rollback assumes an **OTA-only** partition table — two `ota_app` slots and no `factory` (stated in ESP-IDF's `bootloader_utility.c`). A factory image is frozen at flash time with security version 0, so the first eFuse counter increment would make it unbootable. Kern's Phase 3 partition migration drops the factory partition accordingly; the fallback role moves to the *previous OTA slot*, which is why the SD update flow must self-test and call `esp_ota_mark_app_valid_cancel_rollback()` after every update (see [security-plan.md Phase 4](security-plan.md#phase-4--air-gapped-sd-card-updates)). @@ -759,58 +759,43 @@ Example: ## 8. sdkconfig.secure Overlay -This file is applied on top of `sdkconfig.defaults` for production builds: - -```bash -idf.py -D "SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.secure" build -``` - -**Contents of `sdkconfig.secure`:** +`sdkconfig.secure` turns a build into one that can be locked from Settings. It is applied on top of the board defaults (and `sdkconfig.release` for releases): ```ini -# ============================================================ -# Kern Secure Boot Configuration Overlay -# Apply with: idf.py -D "SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.secure" build -# ============================================================ - -# --- Secure Boot v2 (RSA-3072; ECDSA is non-functional on ESP32-P4) --- CONFIG_SECURE_BOOT=y CONFIG_SECURE_BOOT_V2_ENABLED=y CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y -CONFIG_SECURE_BOOT_SIGNING_KEY="kern-sb-key0.pem" - -# Leave aggressive key revocation OFF — revoking a good key on a single -# failed verification would be a bricking hazard for a wallet. -# CONFIG_SECURE_BOOT_ENABLE_AGGRESSIVE_KEY_REVOKE is not set - -# --- Anti-Rollback --- -CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y -CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y -CONFIG_BOOTLOADER_APP_SECURE_VERSION=0 +CONFIG_SECURE_INSECURE_ALLOW_DL_MODE=y ``` -> **Verify every symbol landed.** A plain rebuild can keep stale values — remove `build_/sdkconfig` and grep the generated `sdkconfig` to confirm `CONFIG_SECURE_BOOT`, `CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME`, and the anti-rollback options are set as expected before trusting the overlay. +- `CONFIG_SECURE_INSECURE_ALLOW_DL_MODE` is not an opening: with `CONFIG_SECURE_BOOT` the default download-mode choice is secure download mode, which every app burns at startup (`esp_efuse_startup.c`), locked or not. The Settings lockdown burns it together with `SECURE_BOOT_EN` instead. +- The hardening options IDF ties to `CONFIG_SECURE_BOOT` (JTAG, `RD_DIS`, unused-slot revokes) only act inside `esp_secure_boot_v2_permanently_enable()`, which `secure_boot_opt_in` defers until secure boot is on, and then returns early; the app burns that set itself. +- `CONFIG_SECURE_BOOT_V2_ENABLED` selects `CONFIG_ESPTOOLPY_NO_STUB`, so `idf.py flash` runs without the stub and leaves the bootloader out; write it with esptool at `0x2000`. +- Anti-rollback (`CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK`) is not in this overlay yet: it burns `SECURE_VERSION` by itself whenever a newer app is confirmed, so it gets its own decision (Section 7). That decision is due before the first freeze, because the bootloader half of it cannot be added afterwards without a re-freeze. +- Aggressive key revocation stays off: revoking a good key on a single failed verification would be a bricking hazard for a wallet. +- Signing: builds sign with `dev_signing_key.pem`. Releases re-sign the app offline with key 0 and ship the frozen bootloader instead of the built one (Sections 4a, 4b). +- `CONFIG_BOOTLOADER_PROJECT_VER` will carry the freeze number once the first freeze is prepared. -> **Note:** The `CONFIG_SECURE_BOOT_SIGNING_KEY` path is relative to the project root and is only used for the build-system's automatic signing. For air-gapped signing workflows where the key is not on the build machine, remove this line and sign manually with `espsecure sign-data` after building (bootloader with all three keys — see Section 4a). +> **Verify every symbol landed.** A plain rebuild can keep stale values. Remove `build_/sdkconfig` and grep the generated `sdkconfig` before trusting the overlay. ---- +### Dry run with virtual eFuses + +`just sbtest-flash ` builds with `sdkconfig.secure` plus `sdkconfig.sbtest` (`CONFIG_EFUSE_VIRTUAL=y`), signs with test keys (`dev_signing_key.pem` plus two throwaway keys in `build_sbtest_/keys`, whose digests replace the release ones), and flashes it. Every eFuse write in this build goes to a RAM copy of the real eFuses, so the whole Settings flow runs on real hardware and leaves nothing behind after the restart. The board needs a PIN set up with a normal build first: virtual KEY4/KEY5 would not reach the HMAC peripheral. Expect `secure_boot: Off until enabled in Settings` in the bootloader log. `just flash ` restores the normal firmware. What it cannot show is the ROM and bootloader enforcing the real digests after `SECURE_BOOT_EN`; that takes a board you are prepared to lock. ## 9. eFuse Burn Order Summary -eFuses must be burned in a specific order. The critical rule: **every read-protected key (NVS-HMAC KEY4, flash-encryption XTS key) must be burned before `SECURE_BOOT_EN`** — enabling secure boot write-protects `RD_DIS`, after which no other key block can be read-protected. This is why NVS encryption (Phase 3) and flash encryption (Phase 5) precede secure boot (Phase 6) in the plan. See [security-plan.md](security-plan.md#the-hard-constraint-read-protected-keys-before-secure-boot). +eFuses must be burned in a specific order. The critical rule: **the read-protected keys (KEY5, KEY4) must be burned before `SECURE_BOOT_EN`** — enabling secure boot write-protects `RD_DIS`, after which no key block can be read-protected. Both are burned during PIN setup, and the lockdown menu refuses to run until they are sealed. See [security-plan.md](security-plan.md#the-hard-constraint-read-protected-keys-before-secure-boot). -| Order | Command | eFuse | Reversible? | Phase | Notes | -|-------|---------|-------|-------------|-------|-------| -| 1 | `burn-key BLOCK_KEY5 ... HMAC_UP` | KEY5 | **No** | Phase 2 | Anti-phishing HMAC (already done if Phase 2 complete) | -| 2 | `burn-key BLOCK_KEY4 ... HMAC_UP` | KEY4 | **No** | Phase 3 | NVS-encryption HMAC — read-protected; must precede secure boot | -| 3 | Flash-encryption key (Key Manager, or `burn-key BLOCK_KEY3 ... XTS_AES_128_KEY`) | KEY3 / Key Manager | **No** | Phase 5 | XTS-AES-256 via Key Manager (preferred) or XTS-AES-128 in KEY3; read-protected, must precede secure boot | -| 4 | `burn-key BLOCK_KEY0 ... SECURE_BOOT_DIGEST0` | KEY0 | **No** | Phase 6 | Primary secure boot digest | -| 5 | `burn-key BLOCK_KEY1 ... SECURE_BOOT_DIGEST1` | KEY1 | **No** | Phase 6 | Rotation #1 secure boot digest | -| 6 | `burn-key BLOCK_KEY2 ... SECURE_BOOT_DIGEST2` | KEY2 | **No** | Phase 6 | Rotation #2 secure boot digest | -| 7 | `burn-efuse SECURE_BOOT_EN` (+ hardening set) | Control | **No** | Phase 6 | **Enables secure boot permanently.** Burned together with `DIS_DIRECT_BOOT`, the JTAG-disable set, secure download mode, then the `RD_DIS` write-protect | -| 8 | Flash-encryption release mode + secure/disabled serial download | Control | **No** | Phase 7 | Release lockdown — permanently disables plaintext serial flashing | +| Order | Command | eFuse | Phase | Notes | +|-------|---------|-------|-------|-------| +| 1 | `burn-key BLOCK_KEY5 ... HMAC_UP` | KEY5 | Phase 2 | Anti-phishing HMAC, read-protected. Done by PIN setup | +| 2 | `burn-key BLOCK_KEY4 ... HMAC_UP` | KEY4 | Phase 3 | NVS-encryption HMAC, read-protected. Done by PIN setup | +| 3 | `burn-key BLOCK_KEY0 ... SECURE_BOOT_DIGEST0` | KEY0 | Phase 6 | Primary secure boot digest | +| 4 | `burn-key BLOCK_KEY1 ... SECURE_BOOT_DIGEST1` | KEY1 | Phase 6 | Rotation #1 secure boot digest | +| 5 | `burn-key BLOCK_KEY2 ... SECURE_BOOT_DIGEST2` | KEY2 | Phase 6 | Rotation #2 secure boot digest | +| 6 | `burn-efuse SECURE_BOOT_EN` (+ hardening set) | Control | Phase 6 | **Enables secure boot permanently.** Burned together with `DIS_DIRECT_BOOT`, the JTAG-disable set, secure download mode, then the `RD_DIS` write-protect | -> **Every eFuse burn is irreversible.** Double-check the digest files and key purposes before confirming. Use `espefuse summary` to inspect current eFuse state before and after each burn. Because all three secure-boot digest slots are used, there is no unused digest slot to revoke — but if you ever leave one empty (e.g. a custom hybrid layout), revoke it before enabling secure boot. For **Profile A** (on-device: PIN/NVS encryption + secure boot, no flash encryption) rows 3 and 8 are skipped, and the whole sequence — including the KEY4 (NVS) burn in row 2 — runs from on-device flows. +> **Every eFuse burn is irreversible.** Use `espefuse summary` to inspect the eFuse state before and after. The whole sequence runs from on-device flows: rows 1–2 during PIN setup, rows 3–6 from the Secure Boot menu. If you ever leave a digest slot empty (a custom hybrid layout), revoke it before enabling secure boot. --- @@ -822,15 +807,34 @@ Complete these steps on a **development board** before any production device. - [ ] Build production firmware with `sdkconfig.secure` overlay - [ ] Confirm the generated `sdkconfig` has `CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y` (not ECDSA) -- [ ] Verify the signed image: `espsecure verify-signature --version 2 --keyfile kern-sb-key0-pub.pem kern-signed.bin` +- [ ] Verify the signed image: `espsecure verify-signature --version 2 --keyfile kern-sb-key0-pub.pem firmware-signed.bin` - [ ] Confirm the bootloader carries all three signatures (key0/key1/key2) -- [ ] Flash signed bootloader and app via serial — confirm device boots normally +- [ ] Flash the bootloader and app over USB — confirm the device boots normally and the bootloader logs `Off until enabled in Settings` +- [ ] `espefuse summary` after several boots — nothing burned by the bootloader or the app - [ ] Read eFuse state: `espefuse summary` — verify KEY0/KEY1/KEY2 are empty -- [ ] Verify embedded digests match published digests: navigate to **Settings → Secure Boot** and compare displayed hex against release notes +- [ ] Verify embedded digests match published digests: navigate to **Settings → Security → Secure Boot** and compare displayed hex against release notes + +### Frozen Bootloader (before each freeze, and its release gate) + +- [ ] Every board's unsigned release bootloader falls into one of the expected variants +- [ ] Two builds of the same commit in different directories give the same `bootloader-unsigned.bin` +- [ ] Each frozen image verifies against all three public keys and matches its manifest hash +- [ ] A release zip contains the frozen bootloader for its board, byte for byte +- [ ] A device installed from a pre-freeze release and updated over SD is refused by the lockdown menu with the bootloader message; one USB install of the release zip clears it +- [ ] Each new release boots on every frozen variant still in the field +- [ ] On a locked board: a later release installs over SD and boots +- [ ] On a locked board: the web flasher writes a signed release zip (secure download mode) and the device boots +- [ ] On a locked board: a bootloader with a modified header, or signed by other keys, is rejected by the ROM, and re-flashing the frozen one recovers the device + +### Dry Run (virtual eFuses) + +- [ ] `just sbtest-flash ` on a board with a PIN; the bootloader logs `Off until enabled in Settings` and `espefuse summary` shows nothing new +- [ ] Settings → Security → Secure Boot shows the test-key fingerprints and offers Enable +- [ ] Enable, confirm, enter the PIN: the burn and read-back succeed, the device restarts, real eFuses unchanged ### On-Device Lockdown (Primary Path) -- [ ] Navigate to **Settings → Secure Boot → Lock with Developer Keys** +- [ ] Navigate to **Settings → Security → Secure Boot** - [ ] Verify all three digest hex values are displayed correctly on screen - [ ] Verify PIN is required before proceeding - [ ] Verify warning about irreversibility is shown @@ -871,7 +875,7 @@ Complete these steps on a **development board** before any production device. - [ ] Dual-sign firmware with key0 + key1, install, confirm boot - [ ] Burn `SECURE_BOOT_KEY_REVOKE0`, confirm key0-only firmware no longer boots -- [ ] Confirm key1-signed firmware still boots (bootloader was signed with key1) +- [ ] Confirm key1-signed firmware still boots (the frozen bootloader carries key1's signature) ### Anti-Rollback (eFuse-enforced from this phase; SD update path exists since Phase 4) @@ -904,10 +908,14 @@ If all copies of a signing key are lost: - If the device only has that key's digest un-revoked, it becomes un-updatable. - **Mitigation**: Always maintain redundant backups (Section 3b) and burn three digests (KEY0 + KEY1 + KEY2), so a lost or compromised primary can be rotated out. +### A Flaw in the Frozen Bootloader + +The frozen bootloader is the one piece of Kern's code an SD update cannot fix. A bug in it stays on every locked device until its owner reflashes a re-frozen bootloader over USB. It is therefore kept small (stock ESP-IDF plus the `secure_boot_opt_in` wrapper), validated on a board that is really locked before the freeze, and reproducible from a tagged commit so that others can review exactly what was signed. + ### Supply Chain Attacks - A compromised build environment could inject malicious code before signing. -- **Mitigation**: Build on a trusted, air-gapped machine. Reproducible builds (future work) would allow independent verification. +- **Mitigation**: Build on a trusted, air-gapped machine. The frozen bootloader is reproducible from its tag today (Section 4a); reproducible app builds (future work) would extend that to every release. - Pre-flashed devices from untrusted sources could have attacker digests burned. - **Mitigation**: Users should verify eFuse state with `espefuse summary` before trusting a pre-flashed device, or flash and lock down the device themselves. @@ -917,12 +925,13 @@ Secure boot alone does not protect against all threats: | Threat | Requires | |--------|----------| -| Flash content extraction | Flash Encryption (Phase 5) | | NVS data readout (PIN hash) | NVS Encryption (Phase 3) | | Firmware downgrade | Anti-Rollback (this phase) + SD card updates (Phase 4) | -| JTAG/debug access | Flash Encryption (Phase 5) — locks JTAG automatically | +| JTAG/debug access | Burned off by the lockdown itself | +| Flash readout by desoldering | Not covered: flash is not encrypted. Nothing secret is stored there in plaintext (PIN hash under NVS encryption, mnemonics as KEF); saved plaintext descriptors are a privacy exposure | +| PSRAM probing on a running device | Not covered: secrets stay in internal RAM, working buffers do not | -Secure boot provides firmware integrity. For full device security, all phases through Phase 7 (release lockdown) are needed. +Secure boot provides firmware integrity and is the last lockdown step. The uncovered rows are accepted risks, listed in [security-plan.md](security-plan.md#accepted-residual-risks). ### Anti-Phishing Synergy @@ -933,7 +942,6 @@ With secure boot enabled, the anti-phishing words (Phase 2) become a strong tamp ## 12. References - [ESP-IDF Secure Boot v2 Documentation (ESP32-P4)](https://docs.espressif.com/projects/esp-idf/en/v6.1/esp32p4/security/secure-boot-v2.html) — includes the ECDSA "not functional on ESP32-P4" advisory -- [ESP-IDF Flash Encryption (ESP32-P4)](https://docs.espressif.com/projects/esp-idf/en/v6.1/esp32p4/security/flash-encryption.html) — Key Manager vs eFuse key source, XTS-AES-128/256 - [ESP-IDF Anti-Rollback](https://docs.espressif.com/projects/esp-idf/en/v6.1/esp32p4/api-reference/system/ota.html#anti-rollback) - [ESP-IDF 6.0 Security Migration Guide](https://docs.espressif.com/projects/esp-idf/en/v6.0.2/esp32/migration-guides/release-6.x/6.0/security.html) — removed/renamed APIs, NISTP192 deprecation - [espefuse Reference](https://docs.espressif.com/projects/esptool/en/latest/esp32p4/espefuse/) diff --git a/docs/security-plan.md b/docs/security-plan.md index 9d0f454f..2bee9278 100644 --- a/docs/security-plan.md +++ b/docs/security-plan.md @@ -14,33 +14,33 @@ This is a research plan. It documents the hardening approaches Kern explores on | Threat | Attack vector | Mitigation | |--------|--------------|------------| | Firmware tampering | Malicious flash via UART/JTAG | **Secure Boot + JTAG lockdown** | -| Flash readout | Physical extraction of flash chip | **Flash Encryption** | +| Flash readout | Physical extraction of flash chip | **Nothing secret is stored in plaintext: NVS encryption (PIN hash), KEF (mnemonics); the firmware is public. Flash encryption is not used ([Phase 5](#phase-5-flash-encryption-dropped))** | | Evil maid / stolen device | Physical access while powered off | **PIN + encrypted storage** | | Device swap / evil maid | Replace device with lookalike | **Anti-phishing words (eFuse HMAC)** | | Evil maid tampering | "Evil maid" tamper device | **Anti-phishing words + secure boot** | | Shoulder surfing/theft at rest | Backup QR codes or stored data | **KEF encrypted backups** | | Firmware downgrade | Flash older vulnerable version | **Anti-rollback (eFuse counter)** | | Firmware downgrade via SD | Load older vulnerable firmware via update | **Anti-rollback (eFuse counter)** | -| No update path after lockdown | Serial flash disabled in release mode | **Air-gapped SD card updates** | -| RAM snooping via PSRAM | Probing external PSRAM bus | **Secrets allocated in internal SRAM (0c); PSRAM encryption (Phase 5) for working buffers** | +| Updates after lockdown | Only signed images boot | **Air-gapped SD card updates; signed releases over USB** | +| RAM snooping via PSRAM | Probing external PSRAM bus | **Secrets allocated in internal SRAM (0c); working buffers in PSRAM are an accepted risk (see below)** | | Cold boot / remanence | Reading RAM after power-off | **Secure memory wiping + session teardown (0c)** | | PIN-counter rewind | Snapshot/restore of external flash to reset failure counter | **Residual risk: PIN entropy is the backstop (see below)** | | Fault injection | Voltage/EM glitching of boot or PIN checks | **Residual risk: not a secure element (see below)** | ### Accepted Residual Risks -The ESP32-P4 is not a secure element; two physical attacks remain open by construction and are accepted with mitigations rather than eliminated: +The ESP32-P4 is not a secure element, and Kern does not encrypt flash or PSRAM. These exposures remain and are accepted with mitigations rather than eliminated: -- **NVS replay (PIN-counter rewind).** XTS encryption provides confidentiality, not integrity or freshness. The flash is an external chip: an attacker who can rewrite it can snapshot the encrypted `nvs` partition, spend N−1 PIN attempts, restore the snapshot, and repeat, resetting the failure counter and exponential backoff indefinitely, even with NVS encryption, flash encryption, and secure boot all enabled. Wipe-after-N-failures and backoff therefore only hold against attackers who cannot rewrite flash. The backstop is PIN entropy: the device-bound PBKDF2 salt (eFuse KEY5) forces every guess through this specific chip, so a long PIN stays strong even against counter rewind. +- **NVS replay (PIN-counter rewind).** XTS encryption provides confidentiality, not integrity or freshness. The flash is an external chip: an attacker who can rewrite it can snapshot the encrypted `nvs` partition, spend N−1 PIN attempts, restore the snapshot, and repeat, resetting the failure counter and exponential backoff indefinitely, even with NVS encryption and secure boot enabled. Wipe-after-N-failures and backoff therefore only hold against attackers who cannot rewrite flash. The backstop is PIN entropy: the device-bound PBKDF2 salt (eFuse KEY5) forces every guess through this specific chip, so a long PIN stays strong even against counter rewind. - **Fault injection / glitching.** Voltage and EM glitching have a public history on earlier ESP32 generations; the ESP32-P4 has no proven resistance and no anti-glitch hardware guarantees. Mitigations that limit the payoff: mnemonics exist only in RAM (session-only) or KEF-encrypted at rest, and the PIN itself is never stored, only its PBKDF2 hash. -- **Plaintext SPIFFS residue.** Flash encryption never covers the `storage` partition (SPIFFS is incompatible with encrypted partitions, see [Cross-Phase Security Dependencies](#cross-phase-security-dependencies)). Mnemonics are always stored as KEF envelopes, but descriptors saved unencrypted (`.txt`), file names/sizes, and KEF header metadata (version, iterations, user-chosen label) remain readable via physical flash extraction even after full Phase 7 lockdown. This leaks xpubs and wallet structure: a privacy exposure, not key material. +- **Plaintext flash.** A physical flash dump yields the firmware (public), the encrypted `nvs` partition, and the `storage` partition. Mnemonics in `storage` are always KEF envelopes, but descriptors saved unencrypted (`.txt`), file names and sizes, and KEF header metadata (version, iterations, user-chosen label) are readable. This leaks xpubs and wallet structure: a privacy exposure, not key material. Flash encryption would not have covered `storage` either (SPIFFS is incompatible with it). +- **Plaintext PSRAM.** Secrets are kept in internal SRAM (0c), but working buffers that can carry secret-bearing data (compression state, QR/cUR payloads, camera and display frames, including SeedQR display and scan moments) may sit in external PSRAM while the device is powered and unlocked. Reading them takes probing the PSRAM bus of a running, unlocked device. Session teardown wipes them. ## ESP32-P4 Security Hardware Summary ### Usable for Kern - **Secure Boot v2**: **RSA-3072 (RSA-PSS)**, up to 3 key digest slots in eFuse. Kern burns all 3 (KEY0/1/2) to allow two key rotations. **ECDSA is not used**: ECDSA-based Secure Boot v2 is non-functional on ESP32-P4 silicon (chip errata; would require `CONFIG_SECURE_BOOT_INSECURE`). RSA-3072 is also the faster verifier here (~14.8 ms vs ~61.1 ms). See [secure-boot.md](secure-boot.md). -- **Flash Encryption**: XTS-AES-128/256, auto-encrypts PSRAM too. The **Key Manager** could hold the XTS key outside the shared eFuse key blocks (Kconfig choice `SECURE_FLASH_ENCRYPTION_KEY_SOURCE`, option `..._KEY_MGR`), but IDF gates that option on ESP32-P4 silicon ≥ v3 (`depends on !(IDF_TARGET_ESP32P4 && ESP32P4_SELECTS_REV_LESS_V3)`); fielded Kern boards measured v1.0 (wave_4b) and v1.3 (wave_43), so Kern uses **XTS-AES-128 in eFuse KEY3** instead; see the key-block note below. -- **NVS Encryption**: HMAC-based key derivation from eFuse (no separate key partition needed); independent of flash encryption +- **NVS Encryption**: HMAC-based key derivation from eFuse (no separate key partition needed) - **RSA/MPI + Digital Signature peripherals**: hardware-accelerated RSA; used by Secure Boot v2 RSA-3072 verification at boot - **HMAC peripheral**: computes HMAC-SHA256 using eFuse keys without exposing them to software; used for anti-phishing word derivation (`esp_hmac_calculate()` with `HMAC_KEY5` purpose) and NVS key derivation (KEY4) - **AES/SHA hardware accelerators**: transparent via mbedTLS for AES and one-shot hashing. Not for iterated hashing: mbedTLS takes the shared SHA/AES crypto mutex, enables the bus clock and pulses the peripheral reset around every hash update crossing a block, roughly 6800 cycles of setup around 1150 cycles of work. PBKDF2 therefore drives the accelerator directly (`main/core/pbkdf2.c`), holding it across batches of iterations and reloading precomputed HMAC ipad/opad midstates: measured 12.2x on wave_4b, taking a 100k-iteration KEF or PIN derivation from 8.07 s to 0.66 s @@ -48,6 +48,9 @@ The ESP32-P4 is not a secure element; two physical attacks remain open by constr - **Anti-rollback**: security version counter in eFuse - **JTAG/UART lockdown**: automatic only when the *stock bootloader* enables the security features; Kern's on-device lockdown flow must burn the same eFuse set itself (JTAG-disable set, download-mode restriction; see [secure-boot.md §5a](secure-boot.md#5-user-scenarios)) +### Available but not used +- **Flash Encryption** (XTS-AES, also encrypts PSRAM): dropped, see [Phase 5](#phase-5-flash-encryption-dropped). + ### NOT usable for Bitcoin - **ECDSA peripheral**: P-192/P-256 only, **secp256k1 not supported**. All Bitcoin signing uses software libsecp256k1 via libwally-core. (Separate from the ECDSA *secure-boot verification* defect noted above: that is a boot-ROM issue, this is about the signing curve.) - **Digital Signature peripheral**: RSA-based, no Bitcoin application. (Still used indirectly: it is the RSA engine behind Secure Boot v2.) @@ -62,15 +65,11 @@ The ESP32-P4 is not a secure element; two physical attacks remain open by constr | KEY0 (BLK4) | Secure Boot Digest 0 (primary) | Phase 6 | | KEY1 (BLK5) | Secure Boot Digest 1 (rotation #1) | Phase 6 | | KEY2 (BLK6) | Secure Boot Digest 2 (rotation #2) | Phase 6 | -| KEY3 (BLK7) | Flash Encryption XTS-AES key *as planned* — the bootloader actually takes KEY0 (see note) | Phase 5 | +| KEY3 (BLK7) | Unused | — | | KEY4 (BLK8) | HMAC for NVS encryption (HMAC_UP) | Phase 3 | | KEY5 (BLK9) | HMAC for anti-phishing words (HMAC_UP) | Phase 2 | -All 6 key blocks allocated. Kern spends **three** blocks on secure-boot digests (KEY0–KEY2) so it can rotate a compromised key twice instead of once. Because all three digest *slots* are populated, no free slot remains for an attacker to inject a rogue signing key. Both HMAC keys (KEY4, KEY5) use the `HMAC_UP` purpose: software can request HMAC computations but never reads the raw key material. - -**Flash-encryption note (decided July 2026):** With three digest slots taking KEY0–KEY2, only one key block (KEY3) is left, but XTS-AES-256 needs two. The hoped-for escape, deploying the key through the ESP32-P4 **Key Manager**, outside the eFuse blocks, turned out to be revision-gated: `SECURE_FLASH_ENCRYPTION_KEY_SOURCE_KEY_MGR` depends on `!(IDF_TARGET_ESP32P4 && ESP32P4_SELECTS_REV_LESS_V3)` (IDF 6.x), i.e. it is only offered to builds that mandate chip revision ≥ v3.0. Fielded boards measured **v1.0 (wave_4b) and v1.3 (wave_43)**, so raising the revision floor would drop existing hardware. **Plan of record: XTS-AES-128 in KEY3**, a single block, generated by the FE bootloader from TRNG on first boot and read-protected at burn time; the key never exists outside the chip. If the minimum supported revision ever moves to v3, the KM + XTS-AES-256 path can be revisited (leaving KEY3 spare). Beware: Kconfig **silently falls back** to the eFuse key source when the KM dependency is unmet, so any key-source change has to be verified in the generated sdkconfig. - -**Correction (measured August 2026):** the allocation above is what Kern *intended*; the bootloader does not honour it. Left to generate its own key it takes the **first free block**, which with KEY4/KEY5 already burned is **KEY0** — a secure-boot digest slot. Observed on the wave_4b test board: `KEY_PURPOSE_0 = XTS_AES_128_KEY`, read-protected, KEY3 untouched. A Profile B device provisioned this way would have two digest slots left (one rotation, not two), and the empty third slot is exactly the free slot the three-digest design exists to deny an attacker. Putting the key in KEY3 as planned means generating it on the host and pre-burning it before first FE boot, which gives up the "key never exists outside the chip" property. Unresolved; it must be settled before any device is provisioned, since neither choice can be revised afterwards. See [Phase 5b](#5b-enable-flash-encryption-development-mode-blocked--no-enablement-path-is-documented-for-now). +Kern spends **three** blocks on secure-boot digests (KEY0–KEY2) so it can rotate a compromised key twice instead of once. Because all three digest *slots* are populated, no free slot remains for an attacker to inject a rogue signing key. Both HMAC keys (KEY4, KEY5) use the `HMAC_UP` purpose: software can request HMAC computations but never reads the raw key material. KEY3 was reserved for the flash-encryption key and stays empty; after lockdown only signed firmware runs and secure download mode gives no eFuse access, so nothing can burn it. ## Partition Table @@ -104,7 +103,7 @@ storage data spiffs 0xC20000 0x3E0000 (~3.9M) **Why factory is dropped**: ESP-IDF's anti-rollback (Phase 6) assumes an OTA-only table; `bootloader_utility.c` states it outright: "When CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK is enabled factory partition should not be in partition table, only two ota_app are there." A factory image is frozen at flash time with security version 0, so the first eFuse counter increment would make it unbootable: the "known-good fallback" guarantee silently dies. The fallback role moves to the *previous OTA slot*: the SD update flow must self-test and call `esp_ota_mark_app_valid_cancel_rollback()`, otherwise the bootloader rolls back (see Phase 4). With empty `otadata`, the bootloader boots `ota_0` directly, which is where serial flashing writes the app. -**Why the migration happens at Phase 3**: a partition table can only be rewritten over serial (OTA never touches it) and it is frozen for the life of the device once secure boot (Phase 6) restricts serial to signed images and release lockdown (Phase 7) disables serial entirely. Phase 3 already forces the one disruptive event for alpha testers (NVS wipe + fresh PIN + KEY4 burn), so the table migration rides the same re-flash instead of adding a second one. +**Why the migration happens at Phase 3**: a partition table can only be rewritten over serial (OTA never touches it) and it should be treated as frozen once secure boot (Phase 6) is on: apps built for one layout cannot run on another, and SD updates can never move it. Phase 3 already forces the one disruptive event for alpha testers (NVS wipe + fresh PIN + KEY4 burn), so the table migration rides the same re-flash instead of adding a second one. **Layout choices**: @@ -114,9 +113,9 @@ storage data spiffs 0xC20000 0x3E0000 (~3.9M) - NVS grows 24KB → 84KB, filling the space up to `ota_0` exactly. More pages improve wear-leveling for the failure-counter write on every PIN attempt. Note that old NVS content **survives** the resize: NVS pages are self-contained 4K units, so the old pages parse fine inside the larger partition, and flashing never writes the `nvs` region. A pre-existing plaintext PIN is therefore still present after the update, handled by the firmware-side migration in 3a. - `phy_init` is dropped: the ESP32-P4 has no radio, no `CONFIG_ESP_PHY*` option is set, and the partition was never read. -### Bootloader-headroom revision (pre-Phase 5, July 2026): current layout +### Bootloader-headroom revision (July 2026): current layout -The Phase 3 layout kept the partition table at the default offset 0x8000, capping the bootloader at 24KB. The plain bootloader had grown to within 320 bytes of that cap, and the Phase 5 flash-encryption bootloader (~36KB), let alone the Phase 6 secure-boot one, does not fit. Since the table is frozen for the life of the device once Phase 6 restricts serial to signed images, the offset was moved to **0x10000** before any Profile B device exists: +The Phase 3 layout kept the partition table at the default offset 0x8000, capping the bootloader at 24KB. The plain bootloader had grown to within 320 bytes of that cap, and the Phase 6 secure-boot bootloader (~44KB) does not fit. The offset was moved to **0x10000** before any device was locked: ``` # Name Type SubType Offset Size (Human) @@ -127,26 +126,22 @@ ota_1 app ota_1 0x620000 0x600000 (6M) storage data spiffs 0xC20000 0x3E0000 (~3.9M) ``` -- `CONFIG_PARTITION_TABLE_OFFSET=0x10000` (in `sdkconfig.defaults`): the bootloader slot grows 24KB → 56KB, with headroom for the secure-boot bootloader beyond the FE one. +- `CONFIG_PARTITION_TABLE_OFFSET=0x10000` (in `sdkconfig.defaults`): the bootloader slot grows 24KB → 56KB. - The shift is absorbed entirely by `nvs` (moved to 0x11000, shrunk 84KB → 52KB, still ample for the PIN hash and settings); `otadata`, both app slots, and `storage` keep their exact offsets, so OTA app images and SPIFFS contents survive. - Cost for already-flashed devices: one serial re-flash plus an NVS wipe (PIN/settings re-setup); apps and `storage` are untouched. -- This is a single global move for **all boards and profiles**, not an FE-only override: `CONFIG_PARTITION_TABLE_OFFSET` is compiled into the app, so a per-profile table offset would fork the firmware artifacts: an app built for one offset cannot run on a device whose table sits elsewhere, and a mixed fleet would invite bricking mismatches through the SD update path. +- This is a single global move for **all boards**: `CONFIG_PARTITION_TABLE_OFFSET` is compiled into the app, so an app built for one offset cannot run on a device whose table sits elsewhere, and a mixed fleet would invite bricking mismatches through the SD update path. ## Phase Ordering Rationale -The lockdown phases are ordered so that the **roadmap order is also the safe, irreversible eFuse burn order**; there is no separate "burn order" to track. Every read-protected key (KEY5, KEY4, the flash-encryption key) is burned in Phases 2, 3 and 5, all *before* secure boot (Phase 6) write-protects `RD_DIS`; Phase 4 (SD updates) burns nothing: +The phases are ordered so that the **roadmap order is also the safe eFuse burn order**. The read-protected keys (KEY5, KEY4) are burned in Phases 2 and 3, *before* secure boot (Phase 6) write-protects `RD_DIS`; Phase 4 burns nothing. Phases 5 and 7 were dropped (see [Phase 5](#phase-5-flash-encryption-dropped)); the numbers are kept so existing references stay valid. 1. **Phase 2 (PIN + anti-phishing)**: pure software except one eFuse burn: KEY5 (anti-phishing HMAC), read-protected at burn time, provisioned during first PIN setup. -2. **Phase 3 (NVS encryption)**: coupled to PIN setup, on-device. Burns KEY4 and encrypts the `nvs` partition so the PIN hash is stored at rest. Independent of flash encryption; KEY4 is read-protected here, before secure boot. Phase 3 also carries the one-time **partition-table migration** (factory dropped for anti-rollback, see [Partition Table](#partition-table)): the last cheap moment for it, since a partition table can only change over serial and is frozen once Phase 6 locks the device. - -3. **Phase 4 (SD updates) before any irreversible step**: signature verification does **not** require secure boot: `SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT` makes the OTA path verify Secure Boot v2 RSA-3072 signatures against the public keys embedded in the running app: pure software, no eFuse burns, fully reversible. Implementing it first field-proves the only post-lockdown update channel while serial recovery still exists, and pulls the signing-key ceremony forward (the same keys become the Phase 6 eFuse digests). - -4. **Phase 5 (flash encryption + FE key) before Phase 6 (secure boot)**: enabling secure boot write-protects `RD_DIS`, after which no other key block can be read-protected. So the flash-encryption XTS key must be burned in Phase 5. Flash encryption runs in **development mode** here; it is serial-provisioned (Profile B). Development mode does *not* buy a serial re-flash path on ESP32-P4 (see 5b): what it keeps is a single one-shot `SPI_BOOT_CRYPT_CNT` disable, after which the Phase 4 SD path is the only way to update the device. +2. **Phase 3 (NVS encryption)**: coupled to PIN setup, on-device. Burns KEY4 and encrypts the `nvs` partition so the PIN hash is protected at rest. Phase 3 also carried the one-time **partition-table migration** (factory dropped for anti-rollback, see [Partition Table](#partition-table)). -5. **Phase 6 (secure boot) before Phase 7 (release lockdown)**: secure boot upgrades the Phase 4 signature check from update-time-only to boot-time enforcement and arms eFuse anti-rollback. Release lockdown permanently disables serial flashing, so the Phase 4 validation suite must be re-run and pass under secure boot before Phase 7. +3. **Phase 4 (SD updates) before any irreversible step**: signature verification does **not** require secure boot: `SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT` makes the OTA path verify Secure Boot v2 RSA-3072 signatures against the public keys embedded in the running app: pure software, no eFuse burns, fully reversible. Implementing it first field-proves the main post-lockdown update channel while unrestricted serial flashing still exists, and pulls the signing-key ceremony forward (the same keys become the Phase 6 eFuse digests). -6. **Phase 7 (release lockdown) last**: the only irreversible-and-*unrecoverable* step: flash-encryption release mode + disabling serial download. Everything before it is recoverable (development mode allows re-flashing over serial). +4. **Phase 6 (secure boot) last**: it upgrades the Phase 4 signature check from update-time-only to boot-time enforcement, disables JTAG, restricts the ROM to secure download mode, and can arm eFuse anti-rollback. It is the final lockdown step. A locked device still updates over SD and can be reflashed with a signed release over USB. ### Cross-Phase Security Dependencies @@ -155,48 +150,28 @@ Some features only reach their full security guarantee when combined with later | Feature (Phase) | Depends on | Gap until dependency is met | |-----------------|------------|----------------------------| | Anti-phishing words (2) | Secure Boot (6) | Anti-phishing detects a *different chip* (eFuse mismatch), but an attacker who controls the firmware can bypass the check entirely: malicious firmware on the *same chip* can fake the words or exfiltrate the PIN. Secure boot closes this by ensuring only signed firmware runs. | -| Anti-phishing words (2) | Flash Encryption (5) | Without flash encryption, an attacker with physical access can read the firmware binary and app partitions and clone them to another board. Flash encryption makes those unreadable. (The PIN hash and split position live in `nvs`, which is protected by NVS encryption, Phase 3, not by flash encryption.) | | PIN hash in NVS (2) | NVS Encryption (3) | The PBKDF2 hash is stored in NVS. Until NVS encryption, physical flash extraction exposes it to offline brute-force (limited by 100k PBKDF2 iterations and the device-bound salt, but still a risk for weak PINs). NVS encryption removes this vector and, being coupled to PIN setup, is the default for any PIN user. | -| PIN hash in NVS (2) | NVS Encryption (3), **not** Flash Encryption (5) | Common misconception: flash encryption does **not** encrypt the `nvs` partition; ESP-IDF excludes it because NVS's wear-levelled writes are incompatible with the block cipher. NVS encryption (Phase 3) is what protects the PIN hash at rest, independent of flash encryption. | -| KEF storage on SPIFFS (1) | **not** Flash Encryption (5) | Same misconception for the `storage` partition: flash encryption never covers it; ESP-IDF's SPIFFS driver is incompatible with encrypted partitions (SPIFFS progressively programs NOR bits in already-written pages, which XTS's write-once 16-byte blocks cannot express), and `storage` carries no `encrypted` flag. KEF (Phase 1) is the at-rest protection for mnemonics/descriptors there, independent of flash encryption. | | NVS encryption (3) | Secure Boot (6) | `HMAC_UP` computations are software-invokable: until secure boot, attacker firmware on the *same chip* can drive the HMAC peripheral to derive the NVS keys and decrypt a dumped `nvs` partition (PIN hash included). Without the chip, the keys stay out of reach either way. | | Wipe-after-N-failures (2) | Secure Boot (6) | Custom firmware could reset the failure counter or skip the wipe check. Secure boot prevents running unauthorized firmware. | | SD card OTA (4) | Secure Boot (6) | The OTA path already verifies Secure Boot v2 RSA-3072 signatures via `SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT`, trusting the public keys embedded in the running app, but nothing verifies firmware at *boot*, so an attacker with serial access can still flash unsigned firmware directly. Secure boot closes the serial path and upgrades the software downgrade check to the eFuse anti-rollback counter. | -| Session timeout (2) | Flash Encryption (5) | Timeout tears down every secret owner and scrubs camera/display buffers (0c), but working buffers that may hold secret-bearing data (compression state, QR/cUR payloads, frames) still live unencrypted in PSRAM until Phase 5. | - -**In summary**: Phase 2 provides strong *usability-layer* security (PIN gating, anti-phishing UX, auto-wipe), and Phase 3 encrypts the PIN hash at rest by default, but tamper-detection guarantees are only as strong as firmware integrity. Secure boot (Phase 6) and flash encryption (Phase 5) are what turn anti-phishing from "detects accidental device swaps" into "cryptographically proves device authenticity". - -## Enablement Mechanics & Deployment Profiles - -The lockdown phases (3–7) are sequenced so the roadmap order **is** the safe eFuse burn order. What still needs spelling out is *how* each feature activates, which determines whether it can be a tools-free on-device action or needs serial provisioning, and the one hardware constraint that fixes the order. - -### Deployment profiles - -Not every user wants the full lockdown. Two supported profiles: -- **Profile A: On-device (tools-free).** PIN + anti-phishing (Phase 2), **NVS encryption** (Phase 3), and **Secure Boot** (Phase 6), all driven from on-device flows, with no serial tools. The read-protected keys (KEY5, KEY4) are burned during PIN setup, before secure boot locks `RD_DIS`. This protects firmware integrity, the PIN hash at rest, and clone detection: the fully self-sovereign path. It omits flash encryption (which needs serial) and release lockdown. -- **Profile B: Fully locked (serial-provisioned).** Profile A **plus** Flash Encryption (Phase 5) and Release Lockdown (Phase 7). Because flash encryption cannot be a UI toggle (below), this profile adds a one-time serial provisioning step while serial still works. +**In summary**: Phase 2 provides strong *usability-layer* security (PIN gating, anti-phishing UX, auto-wipe), and Phase 3 encrypts the PIN hash at rest by default, but tamper-detection guarantees are only as strong as firmware integrity. Secure boot (Phase 6) is what turns anti-phishing from "detects accidental device swaps" into "cryptographically proves device authenticity". A flash dump cloned onto another board already fails the anti-phishing check, since the words come from that chip's KEY5. -### On-device vs. serial activation +## Enablement Mechanics -| Feature | How it activates | Self-transforms flash? | Brick risk | -|---------|------------------|------------------------|------------| -| NVS Encryption (3) | **On-device, coupled to PIN setup**: app burns KEY4, then `nvs_flash_secure_init()`; the new PIN hash is written into encrypted NVS | No, the `nvs` partition is erased and re-initialized encrypted | Low: recoverable; worst case NVS re-init → PIN re-setup. Device still boots | -| SD card updates (4) | **Build config only**: signed-app verification on update (`SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT`); no eFuse touched, reversible | No, writes only to the inactive OTA slot | Low: a failed update stays on the current slot; rollback confirm guards a broken image | -| Secure Boot (6) | **On-device UI**: app burns the three digests, the hardening set (JTAG disable, `DIS_DIRECT_BOOT`, secure download mode), `SECURE_BOOT_EN`, and write-protects `RD_DIS`; already-signed images stay valid | No | Only if lockdown runs while firmware that is unsigned (or signed with keys not matching the digests) is on flash (guarded in Phase 6) | -| Flash Encryption (5) | **Serial only**: enabled by the *bootloader* on first boot; requires a bootloader built with `CONFIG_SECURE_FLASH_ENC_ENABLED`, flashed over serial | **Yes**, the bootloader encrypts bootloader + app + `encrypted` partitions *in place* on first boot (up to ~1 min) | Real: power loss during the first-boot pass corrupts flash. Development-mode recovery is a **one-shot eFuse disable** (`SPI_BOOT_CRYPT_CNT` to an even bit count), not a re-flash — serial re-flash of an encrypted ESP32-P4 does not work at all (see 5b). Release mode (Phase 7) removes even that | +There is one deployment path, and every step of it runs on the device. The only tool involved is the USB install that puts Kern on the device in the first place. -**Consequence:** the tools-free on-device flows cover NVS encryption and secure boot (all of Profile A). Flash encryption **cannot** be a UI toggle: there is no supported API for a running app to enable flash encryption over a non-FE bootloader, and forcing the eFuse would brick. Profile B therefore adds serial provisioning. +| Feature | How it activates | Brick risk | +|---------|------------------|------------| +| NVS Encryption (3) | **On-device, coupled to PIN setup**: app burns KEY4, then `nvs_flash_secure_init()`; the new PIN hash is written into encrypted NVS | Low: worst case NVS re-init → PIN re-setup. Device still boots | +| SD card updates (4) | **Build config only**: signed-app verification on update (`SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT`); no eFuse touched | Low: a failed update stays on the current slot; rollback confirm guards a broken image | +| Secure Boot (6) | **On-device menu**: app burns the three digests, the hardening set (JTAG disable, `DIS_DIRECT_BOOT`, secure download mode), `SECURE_BOOT_EN`, and write-protects `RD_DIS`. Needs the frozen bootloader (Phase 6d) on flash, which only a USB install of a lockable release puts there | Only if lockdown runs while an app or bootloader that is unsigned (or signed with other keys) is on flash; the menu verifies both against the embedded keys first | ### The hard constraint: read-protected keys before secure boot -Per Espressif's security-features workflow, **Flash Encryption must be enabled before Secure Boot**, which is why Phase 5 precedes Phase 6. Enabling secure boot **write-protects `RD_DIS`** (so the secure-boot digests stay readable for the ROM to verify). Once `RD_DIS` is write-protected, read-protection can **no longer be set on any other key block**, including the flash-encryption XTS key and the NVS-encryption HMAC key. A key left software-readable defeats its own purpose. +Enabling secure boot **write-protects `RD_DIS`** (so the secure-boot digests stay readable for the ROM to verify). After that, read-protection can no longer be set on any key block. A key left software-readable defeats its own purpose. -**Rule: every read-protected key is burned *and* read-protected before `SECURE_BOOT_EN` is set in Phase 6.** The phase order guarantees this: - -- KEY5 (anti-phishing HMAC): Phase 2, during PIN setup. -- KEY4 (NVS HMAC): Phase 3, during PIN setup. -- Flash-encryption XTS key: Phase 5, KEY3 (XTS-AES-128): generated by the FE bootloader on first boot and read-protected at burn time. (The Key Manager path that would have kept KEY3 spare requires ≥ v3 silicon; see the eFuse key-block note.) +**Rule: KEY5 (anti-phishing HMAC, Phase 2) and KEY4 (NVS HMAC, Phase 3) are burned and read-protected before `SECURE_BOOT_EN` is set.** Both happen during PIN setup, and the Secure Boot menu refuses to proceed unless a PIN is configured and both keys are sealed. ## Implementation Phases @@ -220,7 +195,7 @@ Rules for any code that touches mnemonics, private keys, passphrases, PINs or KE - **Producers stop first.** Camera and display buffers are wiped only after their DMA writers stop. Workers suspend on completion and are joined and deleted by the UI thread so their stacks are wiped synchronously, never left to the idle task. - **Inputs.** Secret textareas are cleared with `ui_secure_clear_textarea()`; setting an empty string alone leaves LVGL copies behind. -Accepted until Phase 5: a live secret can be observed while in use, and compression state, cUR buffers, camera and display pixels (SeedQR display and scan moments) and NVS cipher contexts keep default placement, which may be PSRAM. Cleanup shortens retention; it does not protect live data. +Accepted: a live secret can be observed while in use, and compression state, cUR buffers, camera and display pixels (SeedQR display and scan moments) and NVS cipher contexts keep default placement, which may be PSRAM. Cleanup shortens retention; it does not protect live data. Accepted until libwally signs from a caller's key: `wally_psbt_sign` copies each input's signing key into a default-heap `ext_key` (wiped on release). Wrapping the call in the secret allocator would place the whole PSBT in internal RAM and make large PSBTs fail. @@ -284,7 +259,7 @@ Open: validate PSRAM write-back and power-off remanence on hardware; move zlib, ### Phase 3: NVS Encryption + Partition Migration (coupled to PIN setup) -**On-device, no serial tools: part of Profile A.** NVS encryption protects the PIN hash (and settings) at rest. It is independent of flash encryption: its keys derive from an eFuse HMAC key (KEY4), not from anything in flash, so a flash dump yields only ciphertext. Its only ordering constraint is that KEY4 must be burned before secure boot (Phase 6) write-protects `RD_DIS`, which is naturally satisfied since this phase runs during PIN setup (right after Phase 2). +**On-device, no serial tools.** NVS encryption protects the PIN hash (and settings) at rest. Its keys derive from an eFuse HMAC key (KEY4), not from anything in flash, so a flash dump yields only ciphertext. Its only ordering constraint is that KEY4 must be burned before secure boot (Phase 6) write-protects `RD_DIS`, which is naturally satisfied since this phase runs during PIN setup (right after Phase 2). **Why couple it to the PIN:** enabling NVS encryption erases and re-initializes the `nvs` partition, which would wipe an existing PIN hash. Doing it *as part of setting the PIN* removes that chicken-and-egg: KEY4 is burned and NVS is re-initialized encrypted *before* the new PIN hash is written, so the hash lands directly in encrypted storage. It also makes at-rest protection the **default** for any PIN user (rather than an optional late step), and mirrors the anti-phishing self-provisioning (KEY5, Phase 2b). @@ -323,12 +298,11 @@ CONFIG_NVS_SEC_HMAC_EFUSE_KEY_ID=4 # BLOCK_KEY4 #### 3d. Notes - **All-or-nothing:** unlike anti-phishing (which falls back to a deterministic salt if the HMAC peripheral is unavailable), NVS encryption has no plaintext fallback: once KEY4 is burned and NVS is encrypted, that is permanent. The same rule applies at setup time: if provisioning fails or KEY4 is unusable, PIN setup is aborted without writing a hash; a PIN hash is never stored in plaintext NVS. -- **Independent of flash encryption:** flash encryption (Phase 5) deliberately leaves `nvs` unencrypted anyway (NVS's wear-levelled writes are incompatible with the block cipher), so NVS encryption is the mechanism that protects the PIN hash at rest whether or not flash encryption is used. - Anti-phishing words are unaffected (KEY5 is permanent and independent of KEY4). ### Phase 4: Air-Gapped SD Card Updates -**Deliberately before secure boot.** ESP-IDF's *signed-app verification without secure boot* (`CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT` + `CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT`, RSA scheme) makes the OTA path perform full Secure Boot v2 RSA-3072 signature verification, trusting the public keys embedded in the *currently running* app's signature block. No eFuses are burned and nothing is irreversible: serial recovery stays available while the update path is developed and field-proven, which is exactly the guarantee Phase 7 needs before it disables serial forever. The signing format is identical to secure boot's: when Phase 6 burns the key digests, the same keys and the same OTA code carry over unchanged; the eFuse burn just upgrades update-time verification to boot-time enforcement. +**Deliberately before secure boot.** ESP-IDF's *signed-app verification without secure boot* (`CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT` + `CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT`, RSA scheme) makes the OTA path perform full Secure Boot v2 RSA-3072 signature verification, trusting the public keys embedded in the *currently running* app's signature block. No eFuses are burned and nothing is irreversible: unrestricted serial flashing stays available while the update path is developed and field-proven. The signing format is identical to secure boot's: when Phase 6 burns the key digests, the same keys and the same OTA code carry over unchanged; the eFuse burn just upgrades update-time verification to boot-time enforcement. **Scope of the guarantee:** until Phase 6, signature checking protects the *SD update path only*; an attacker with serial access can still flash arbitrary firmware (the status quo today, nothing regresses). See [Cross-Phase Security Dependencies](#cross-phase-security-dependencies). @@ -367,64 +341,55 @@ CONFIG_NVS_SEC_HMAC_EFUSE_KEY_ID=4 # BLOCK_KEY4 - Test rollback confirm: power-cycle a freshly updated device *before* it calls `esp_ota_mark_app_valid_cancel_rollback()` → verify it returns to the previous slot - Test downgrade rejection: older `secure_version` → rejected in pre-flight, OTA slot untouched - Test unsigned, wrong-key, and corrupted images → rejected in pre-flight, OTA slot untouched -- **Re-run this entire suite after Phase 6 (secure boot + eFuse anti-rollback): all tests must pass again before Phase 7 release lockdown** - -### Phase 5: Flash Encryption (development mode) + FE Key Provisioning - -**Profile B only; serial-provisioned.** Precedes secure boot (Phase 6) so the flash-encryption key is read-protected before `RD_DIS` locks. Flash encryption runs in **development mode** here: a single one-shot `SPI_BOOT_CRYPT_CNT` disable stays available (serial *re-flash* does not, see 5b); the irreversible serial-disable is deferred to Phase 7. See [Enablement Mechanics & Deployment Profiles](#enablement-mechanics--deployment-profiles). - -**Irreversible eFuse commitment: practice on a dev board first.** - -#### 5a. Flash-encryption key provisioning ✅ (decided July 2026) -- **XTS-AES-128, bootloader-generated**: the FE bootloader generates the key from TRNG on first boot and burns it read-protected; the key never exists outside the chip, so there is no host-side key ceremony and nothing to back up or leak. -- **The block is KEY0, not KEY3** (measured on the wave_4b test board, August 2026): the bootloader takes the *first free* key block, and with KEY4/KEY5 already spent on HMAC that is KEY0 — not the KEY3 this plan had allocated. On a Profile B device that consumes a secure-boot digest slot, leaving KEY1/KEY2: two digests and one rotation instead of three and two. Landing the key in KEY3 instead would mean generating it on the host and pre-burning it before first FE boot, trading away the "key never leaves the chip" property above. This has to be settled before any Profile B device is provisioned; it cannot be changed afterwards. -- The preferred **Key Manager + XTS-AES-256** path is not available on current silicon: the Kconfig option is gated on chip revision ≥ v3.0 (see the eFuse key-block note), and fielded boards measured v1.0/v1.3. The KM questions from earlier drafts (what dev-mode recovery looks like without a host-known key, whether KM lifts the `RD_DIS` ordering constraint) are moot unless the revision floor is ever raised. -- KEY4 (NVS, Phase 3) and KEY5 (anti-phishing, Phase 2) are already burned; KEY3 is the last read-protected burn before Phase 6 locks `RD_DIS`. +- **Re-run this entire suite on a locked device (Phase 6): all tests must pass again before the first lockable release** -#### 5b. Enable flash encryption (development mode): **blocked — no enablement path is documented for now** +### Phase 5: Flash Encryption (dropped) -**Status (August 2026).** Phase 5 had one blocker; it has been cleared and replaced by a harder one. Until the second is resolved, Kern **deliberately documents no procedure for enabling flash encryption**: the overlay and flashing recipes live on an unmerged branch and are intentionally not described here, because every route to an encrypted ESP32-P4 currently ends in a device that cannot be re-flashed over serial. +**Dropped November 2026. Kern does not use flash encryption, and no other phase depends on it.** -*Cleared — PSRAM/DMA (IDF 6.0.x).* The first on-device attempt (July 2026) encrypted and booted the bootloader fine, but the app WDT-bootlooped ~1 s into the splash with no frame ever displayed (DSI underrun blue). Cause: flash encryption set the MMU "sensitive" bit on **every PSRAM page** (`mmu_ll_write_entry`, anti-FI assert, no opt-out in 6.0.x), routing cache traffic through the XTS engine while DMA masters — DSI framebuffer refresh, camera/ISP — reached PSRAM outside that path. Same signature upstream: [esp-idf#17708](https://github.com/espressif/esp-idf/issues/17708), [#17701](https://github.com/espressif/esp-idf/issues/17701), [#18427](https://github.com/espressif/esp-idf/issues/18427). IDF 6.1 provides the opt-out (`CONFIG_SPIRAM_ENC_EXEMPT`: an unencrypted carve-out at the top of PSRAM, reachable via `MALLOC_CAP_SPIRAM_NO_ENC`), and **esp_lvgl_adapter 0.6.4** allocates its draw buffers from it automatically whenever flash encryption is enabled. The camera side does **not**: esp_video only gained that behaviour in 2.4.0, and Kern is held at 2.3.x because 2.4+ drags in an esp_ipa blob built for a RISC-V B extension this core lacks (see the CHANGELOG). Camera and ISP buffers would therefore still land in encrypted PSRAM, so a future attempt needs that pin lifted first. Two further caveats stay attached to this fix: IDF's own DSI driver still allocates the DPI panel framebuffer with plain `MALLOC_CAP_SPIRAM` (`esp_lcd_panel_dpi.c`, v6.1 and master, no external-buffer API), so the ~1 MB buffer the display engine reads every frame would remain encrypted and it is **untested** whether that alone reproduces the wedge; and anything placed in the carve-out is plaintext in PSRAM at rest, which for Kern means display and camera frames, including SeedQR display and scan moments — a narrowing of the PSRAM-encryption guarantee that has to be accepted explicitly when Phase 5 is revisited. +What it was: XTS-AES encryption of the bootloader and app partitions, and of PSRAM, with a key generated inside the chip. It had to be enabled over serial, before secure boot. -*New — download-mode encryption is broken on ESP32-P4.* Manual encryption over the serial download path encrypts under a **per-session key rather than the eFuse XTS key**, so it writes ciphertext the ROM cannot decrypt: boot dies with `use legacy efuse key` followed by an endless `invalid header: 0x…`. Measured on the wave_4b test board (rev v1.0, development mode, `DIS_DOWNLOAD_MANUAL_ENCRYPT=0`, `FORCE_USE_KEY_MANAGER_KEY=0`, `KM_HUK_GEN_STATE=0`): two runs of the documented re-flash command, writing a bootloader binary that was built once and never rebuilt to the same offset, produced **different ciphertext**. XTS-AES is address-tweaked and deterministic, so the key differed between download sessions. The ROM's own `use legacy efuse key` message says the boot path uses the eFuse key; the download path appears to use a HUK-derived Key Manager key that nothing configures to match. ESP-IDF's flash-encryption guide presents that command as *the* development-mode re-flash method for exactly this eFuse state, so the documentation is wrong for this target. To be reported upstream. +Why it was dropped: -Consequences for the plan: +- **It protects little here.** It never covers `nvs` or `storage`, which have their own encryption (NVS encryption, KEF). The firmware is public. A flash clone on another chip already fails the anti-phishing check. Firmware integrity is secure boot's job. The one real gain is PSRAM encryption, and the camera and display buffers would have to be exempted from it, leaving SeedQR frames in plaintext anyway. +- **An encrypted ESP32-P4 cannot be reflashed over USB.** Download-mode encryption uses a per-session key instead of the eFuse key and writes ciphertext the ROM cannot decrypt (measured on a wave_4b, rev v1.0, August 2026; ESP-IDF documents the command as working). The only recovery is a once-per-chip `SPI_BOOT_CRYPT_CNT` disable. +- **It takes a secure-boot key slot.** The bootloader puts its key in the first free block, KEY0, leaving two digests and one rotation. The alternative is generating the key off-chip. The Key Manager path that avoids both needs chip revision v3. +- **It does not run cleanly with the display and camera.** DMA peripherals need an unencrypted PSRAM carve-out (`CONFIG_SPIRAM_ENC_EXEMPT`, IDF 6.1). The camera side needs esp_video 2.4, which Kern cannot use, and the DSI framebuffer has no hook for it at all. +- **It doubles the release work.** It needs its own frozen bootloaders (Phase 6d), serial provisioning with a power-loss brick window, and a second device profile to test and support. -- **An encrypted ESP32-P4 has no serial update path at all.** Manual encryption is broken as above, and a plaintext re-flash is not rescued either: `esp_flash_encrypt_check_and_update()` only encrypts flash contents while `SPI_BOOT_CRYPT_CNT` is still even, so once encryption is on the bootloader never re-encrypts plaintext content. The Phase 4 SD/OTA channel becomes the **only** update path the moment Phase 5 completes — earlier than this plan assumed, since it counted on serial recovery remaining through Phase 6. OTA writes go through `esp_partition` and are encrypted at runtime, after the bootloader has pointed the Key Manager at the eFuse key, so they should be unaffected — **unverified on an encrypted device, and a prerequisite for any future attempt.** -- **Recovery costs the chip's one and only disable.** The test wave_4b was revived by flashing plaintext and burning `SPI_BOOT_CRYPT_CNT` from `0b001` to `0b011` (an even bit count disables decryption). ESP-IDF allows this **once per chip** on non-ESP32 targets. That board now runs plaintext on IDF 6.1 with display and camera confirmed working; its XTS key stays burned and read-protected in KEY0, one FE re-enable remains, and no further disable does. -- **FE provisioning is therefore one-way in practice.** Any device that gets flash encryption must be treated as final from that moment: no serial re-flash, one recovery, and once that recovery is spent, none. +What dropping it costs: working buffers in PSRAM stay plaintext while the device is powered and unlocked (see [Accepted Residual Risks](#accepted-residual-risks)). The choice is final for a locked device: flash encryption cannot be enabled after secure boot. -Before Phase 5 can be revisited, four things need to be true: an upstream fix or a confirmed workaround for download-mode encryption; OTA/SD updates verified on an encrypted device; the DSI framebuffer question settled (does it need the carve-out, and if so how, given the driver offers no hook); and the plaintext-frames-in-PSRAM narrowing accepted in the threat model. +What is left over: -- Partition-table prerequisite done: the 0x10000 table offset gives the ~36KB FE bootloader room in its 56KB slot (see [Partition Table](#partition-table)). -- PSRAM encryption is enabled automatically and protects runtime key material in external RAM — except whatever is placed in the `SPIRAM_ENC_EXEMPT` carve-out the DMA fix requires, which is plaintext at rest (see the status note above). -- The `storage` (SPIFFS) partition stays **plaintext**: SPIFFS does not support flash encryption, so the first-boot pass skips it (no `encrypted` flag). Mnemonics there are always KEF envelopes, so nothing key-critical depends on this; see [Cross-Phase Security Dependencies](#cross-phase-security-dependencies) and [Accepted Residual Risks](#accepted-residual-risks). -- Verify encrypted flash contents are unreadable via physical extraction. +- The `feat/flash-encryption-61` branch (overlay and recipes) is kept for reference and not maintained. +- The wave_4b used for the tests has a flash-encryption key in KEY0 and its one disable spent. The Secure Boot menu will refuse it (KEY0 is taken), so the lockdown tests need another board. +- The 0x10000 partition-table offset, chosen partly for the larger flash-encryption bootloader, stays. ### Phase 6: Secure Boot -**Irreversible eFuse commitment: practice on a dev board first.** All read-protected keys (KEY4, KEY5, and the flash-encryption key) were burned in Phases 2–5, so it is safe for secure boot to write-protect `RD_DIS` here. For the full mechanics, key ceremony, rotation, and on-device lockdown flow, see [secure-boot.md](secure-boot.md). +**Irreversible eFuse commitment: practice on a dev board first.** The read-protected keys (KEY4, KEY5) were burned during PIN setup (Phases 2–3), so it is safe for secure boot to write-protect `RD_DIS` here. This is the last lockdown step in the plan. For the full mechanics, key ceremony, rotation, and on-device lockdown flow, see [secure-boot.md](secure-boot.md). #### 6a. Key management - The three RSA-3072 signing keys already exist and are in active use, generated with full ceremony in Phase 4b, releases signed with the primary since then - Burn digests into KEY0 (primary), KEY1 (rotation #1), and KEY2 (rotation #2) -- Sign the **bootloader with all three keys** (it is frozen at flash time and must survive rotations); the app is signed with the current primary key +- The app is signed with the current primary key at every release. The **bootloader is signed with all three keys, once**, and then frozen (see [6d](#6d-frozen-bootloader)): it cannot be replaced by an SD update and must survive rotations, and signing it per release would pull keys 1 and 2 out of cold storage every time - Document eFuse programming workflow and recovery procedures #### 6b. Build system integration -- `sdkconfig.secure` overlay with secure boot + anti-rollback config (`CONFIG_SECURE_BOOT=y`, `CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y`): replaces the Phase 4 signed-on-update-only config +- `sdkconfig.secure` overlay (`CONFIG_SECURE_BOOT=y`, `CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y`, `CONFIG_SECURE_INSECURE_ALLOW_DL_MODE=y` so that no app burns secure download mode at startup): replaces the Phase 4 signed-on-update-only config. Done; anti-rollback is not in it yet (6c) +- `bootloader_components/secure_boot_opt_in`: a stock `CONFIG_SECURE_BOOT` bootloader enables secure boot by itself on first boot, burning the digests of whatever signed it. The component wraps that call so the bootloader verifies apps once secure boot is on but never turns it on; the Settings menu does. Done, with a virtual-eFuse dry run (`just sbtest-flash`); not yet run on hardware +- Releases build with `sdkconfig.release` + `sdkconfig.secure` and ship the frozen bootloader, not the built one (6d) - Leave `CONFIG_SECURE_BOOT_ENABLE_AGGRESSIVE_KEY_REVOKE` **off**: revoking a good key on one failed verification is a bricking hazard for a wallet -- CI pipeline: build unsigned, developer signs images offline as part of release -- **Reproducible builds are a prerequisite for the first signed release**: with CI building unsigned and the developer signing offline, users can only verify that a signed release matches the source if they can reproduce the unsigned image bit-for-bit. Pin toolchain/IDF versions and document the build recipe. +- CI pipeline: build unsigned, developer signs the app offline as part of release; CI checks the frozen bootloaders against the public keys and, when its ESP-IDF version matches, against a rebuild from the freeze tag +- **Reproducible builds are a prerequisite for the first signed release**: with CI building unsigned and the developer signing offline, users can only verify that a signed release matches the source if they can reproduce the unsigned image bit-for-bit. Pin toolchain/IDF versions and document the build recipe. The bootloader already meets this: its unsigned image is identical across build directories, which is what lets anyone check a frozen bootloader against its tag. - Keep development builds unsigned (separate sdkconfig) - Anti-rollback counter enabled (`CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK`): firmware carries a monotonic security version enforced from eFuse; it **backs** the Phase 4 software downgrade check rather than replacing it (see [6c](#6c-anti-rollback-efuse-security-version) for the full plan) - Note ESP-IDF 6.0 API renames: `esp_secure_boot_verify_signature_block()` removed (use `esp_secure_boot_verify_rsa_signature_block()`); `esp_flash_encryption_enabled()` deprecated (use `esp_efuse_is_flash_encryption_enabled()`) -- Re-run the Phase 4d validation suite under secure boot before Phase 7 +- Re-run the Phase 4d validation suite on a locked device before the first lockable release #### 6c. Anti-rollback (eFuse security version) -**Planned July 2026, to be implemented together with 6a/6b; nothing here lands on master before the secure-boot overlay exists.** Anti-rollback is what stops an attacker (or a careless user) from installing a genuinely signed *older* Kern release to reopen a fixed vulnerability. Until it is on, a downgrade is refused only by our own pre-flight check running inside the firmware being replaced, which an attacker with serial access simply flashes over. +**Planned July 2026; nothing here lands on master before the secure-boot overlay exists. The on/off decision is due before the first bootloader freeze (6d):** the boot-time refusal of an older app is bootloader code, so a bootloader frozen without anti-rollback can only gain it through a re-freeze and a USB reflash of each device. Anti-rollback is what stops an attacker (or a careless user) from installing a genuinely signed *older* Kern release to reopen a fixed vulnerability. Until it is on, a downgrade is refused only by our own pre-flight check running inside the firmware being replaced, which an attacker with serial access simply flashes over. ##### What already exists @@ -474,7 +439,7 @@ Two tiers, in this order. **(a) Emulated, no permanent burns.** `CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE=y` selects `EFUSE_VIRTUAL` + `EFUSE_VIRTUAL_KEEP_IN_FLASH` and needs a partition entry `emul_efuse, data, efuse, , 0x2000`. Two warnings: it virtualizes **all** eFuse operations, so PIN provisioning (KEY4/KEY5), flash encryption, and secure boot all become fake on that build; and it requires its own partition CSV, so it is not the frozen production table. Bench-only, never signed, never handed to a user. -**(b) Real burns on the flash-encryption test mule** (the wave_4b already committed in Phase 5). Each test bump permanently spends one of its 16 bits: acceptable on the mule, never on a user device. +**(b) Real burns on the board sacrificed for the lockdown tests** (6d). Each test bump permanently spends one of its 16 bits: acceptable on the mule, never on a user device. The matrix, in order: @@ -486,21 +451,41 @@ The matrix, in order: 6. Rollback still works between equal versions: OTA 1 → 1′, fail the self-confirm, verify the device returns to the previous slot. 7. After a confirmed bump, verify the previous slot is no longer a rollback target, the expected loss of the safety net, documented here so it is a decision and not a surprise. -Re-run this matrix as part of the Phase 4d suite under secure boot before Phase 7 lockdown. +Re-run this matrix as part of the Phase 4d suite on a locked device. + +#### 6d. Frozen bootloader + +**Decided November 2026.** After lockdown the bootloader on a device is fixed: SD updates write only the app slot, and the ROM accepts a replacement only if a non-revoked key signed it. It also needs all three signatures so that no rotation can strand it, and the lockdown menu verifies exactly that against the embedded keys before burning anything. Producing three signatures per release is not acceptable (keys 1 and 2 are cold), so the bootloader is signed once and reused. Full procedure in [secure-boot.md §4a](secure-boot.md#4a-the-frozen-bootloader). + +- **Four variants, not one per board.** The bootloader is independent of display, touch and camera. It splits on chip revision range (v1.x / v3.x) and flash mode (wave_35 is DIO, the rest QIO). Measured: wave_4b, wave_5 and crowpanel release bootloaders are byte-identical; wave_35 differs. The staging step confirms the rest. +- **Stored in the repository**: `kern_secure_boot/bootloaders//bootloader-signed.bin` plus a `BOOTLOADERS` manifest (freeze number, git tag, ESP-IDF version, boards, unsigned SHA-256), covered by the existing `SHA256SUMS.sig`. +- **Freeze ceremony** (rare, air-gapped, all three keys): stage the unsigned bootloaders from a tagged commit, sign each with keys 0, 1 and 2, verify against the published public keys, commit, tag `bootloader-`. `CONFIG_BOOTLOADER_PROJECT_VER` carries N. +- **Each release** (key 0 only): `release.sh` packages the frozen bootloader for the board's variant and warns when the freshly built one differs; `sign_release.sh` refuses a bootloader that does not verify against all three public keys. +- **Compatibility rule**: every release must boot on every frozen bootloader still in the field. A change that breaks this is a re-freeze, and reaches a locked device only through a USB reflash by its owner. +- **Fixed by a freeze**: the ESP-IDF version of the bootloader, the opt-in wrapper, anti-rollback on or off (6c), bootloader log level. +- **Existing devices** got their bootloader from an earlier release and SD updates never changed it. They need one USB install of a lockable release; it preserves NVS and storage. The menu detects the old bootloader and says so. +- **Web flasher**: must write the bootloader without rewriting its header (`keep` for flash mode, frequency and size) and must work in secure download mode, so a locked device can still take a signed release over USB. +- **Self-built firmware** follows the same model with the user's keys: replace the three digest files, sign their own bootloader with their three keys, and the menu checks against those. + +Order of work: + +1. Tooling that needs no private key: `just bootloader-stage`, the manifest, `scripts/freeze_bootloader.sh`, the `release.sh` / `sign_release.sh` changes, the CI checks, the web flasher changes. +2. Hardware: the virtual-eFuse dry run, then a real lockdown on a sacrificial board, followed by an SD update and a USB reflash on it. +3. The anti-rollback decision (6c). +4. The freeze ceremony. +5. The first lockable release. -### Phase 7: Release Lockdown +### Phase 7: Release Lockdown (dropped) -**The point of no return, and only after the Phase 4 SD update path has been re-validated under secure boot (Phase 6).** This is the last unrecoverable step, but no longer the only one: on ESP32-P4, Phase 5 already ends serial re-flash (see 5b), leaving a single one-shot `SPI_BOOT_CRYPT_CNT` disable as the whole of "recovery" from that point on. Phase 7 removes that too. +**Dropped with Phase 5.** It had three parts: -- Switch flash encryption from development to **release mode**: write-protects `SPI_BOOT_CRYPT_CNT` and burns `DIS_DOWNLOAD_MANUAL_ENCRYPT`; flashing plaintext firmware over serial is no longer possible. -- Restrict UART ROM download to **secure download mode** (or disable it), and confirm JTAG is locked down. (Secure download mode is already burned by the Phase 6 lockdown flow; Phase 7 optionally disables download mode entirely.) -- Runtime APIs exist for all of this, `esp_flash_encryption_set_release_mode()` and `esp_efuse_disable_rom_download_mode()` (disable download mode *before* release mode, per the API docs), so Phase 7 can be an **on-device menu action** for Profile B devices, mirroring the Phase 6 lockdown flow. -- After this, the device is fully locked: firmware updates only via signed SD card OTA (Phase 4). -- Verify: unsigned/plaintext serial flash is rejected; SD OTA still works; a power-loss during an SD update still boots the previous slot. +- Flash-encryption release mode: gone with flash encryption. +- Secure download mode and JTAG disable: burned by the Phase 6 lockdown. +- Disabling ROM download mode entirely: not planned. Secure download mode already refuses flash readout, and unsigned code does not boot. A full disable would add little and would remove USB recovery and the only way to replace a frozen bootloader. ### Phase 8 (Future): TEE / World Controller - Investigate ESP32-P4 World Controller / PMS maturity in ESP-IDF - Goal: signing operations in World0 (secure), UI in World1 (non-secure) - Most complex and least mature; watch Espressif's ESP-TEE progress -- Pragmatic measures (secure_memzero, PSRAM encryption, session-only keys) provide good coverage meanwhile +- Pragmatic measures (secure_memzero, secrets in internal SRAM, session-only keys) provide good coverage meanwhile diff --git a/kern_secure_boot/README.md b/kern_secure_boot/README.md index 6d0c3c93..094c911c 100644 --- a/kern_secure_boot/README.md +++ b/kern_secure_boot/README.md @@ -2,7 +2,7 @@ This folder holds the **public** key material for Kern's Secure Boot v2 (**RSA-3072 / RSA-PSS**). These files are safe to distribute — they contain no private key material. -> **No keys are published yet.** The placeholder keys that previously lived here were never used for a real release and have been removed. The authentic public keys and digests below will be added — and this README's expected-digest values filled in — as part of the first signed release, following the key ceremony in [docs/secure-boot.md](../docs/secure-boot.md#3e-key-ceremony-checklist). Do not trust any keys in this folder until they arrive with a matching `SHA256SUMS.sig` from the developer's published GPG/SSH key. +The firmware build reads the three digest files from this folder and embeds them, so they are what the on-device Secure Boot menu checks against and burns. Verify `SHA256SUMS.sig` against the developer's published GPG key before trusting anything here (see [Verifying These Files](#verifying-these-files)). ## Why RSA-3072 (not ECDSA) @@ -10,9 +10,17 @@ ECDSA-based Secure Boot v2 is **not functional on ESP32-P4 silicon** (chip errat ## Three keys, two rotations -Kern burns **three** signing-key digests into eFuse (KEY0/KEY1/KEY2), so a compromised or lost key can be rotated out up to twice. Released firmware is normally signed with the primary key only; the second-stage bootloader is signed with all three keys so it survives future rotations. +Kern burns **three** signing-key digests into eFuse (KEY0/KEY1/KEY2), so a compromised or lost key can be rotated out up to twice. Released firmware is signed with the primary key only. Keys 1 and 2 stay in cold storage. -## Contents (once published) +## The frozen bootloader + +A device with secure boot enabled keeps its second-stage bootloader: SD updates never write it, and the chip accepts a replacement only if a non-revoked key signed it. To survive any future rotation the bootloader must carry signatures from all three keys. It is therefore built and signed with all three once, in a key ceremony, and committed here; every release ships those same bytes instead of a freshly built bootloader. A new one is produced only when the bootloader itself has to change, through the same ceremony. + +The bootloader does not depend on the display or camera, so boards share it. There is one per chip revision range and flash mode, listed in `bootloaders/BOOTLOADERS` with the git tag and ESP-IDF version it was built from and the SHA-256 of its unsigned image. Building that tag reproduces the image byte for byte up to the signature sector. + +> **Not published yet.** No bootloader has been frozen, so current releases cannot enable secure boot. `bootloaders/` arrives with the first release that can. Procedure: [docs/secure-boot.md §4a](../docs/secure-boot.md#4a-the-frozen-bootloader). + +## Contents | File | Description | |------|-------------| @@ -22,17 +30,19 @@ Kern burns **three** signing-key digests into eFuse (KEY0/KEY1/KEY2), so a compr | `kern-sb-digest0.bin` | SHA-256 digest of public key 0 (32 bytes, burned into eFuse KEY0) | | `kern-sb-digest1.bin` | SHA-256 digest of public key 1 (32 bytes, burned into eFuse KEY1) | | `kern-sb-digest2.bin` | SHA-256 digest of public key 2 (32 bytes, burned into eFuse KEY2) | +| `bootloaders/BOOTLOADERS` | Manifest of the frozen bootloaders (not published yet) | +| `bootloaders//bootloader-signed.bin` | Frozen bootloader, signed by all three keys (not published yet) | | `SHA256SUMS` | SHA-256 checksums of all files above | | `SHA256SUMS.sig` | GPG detached signature of `SHA256SUMS` | ## Expected Digest Values -These are the hex representations of the digest files. When activating secure boot on-device via **Settings > Secure Boot > Lock with Developer Keys**, the device displays these values for visual verification. +These are the hex representations of the digest files. When activating secure boot on-device via **Settings > Security > Secure Boot**, the device displays these values for visual verification. ``` -Digest 0: -Digest 1: -Digest 2: +Digest 0: 2c812b5806eb81730e29364b874ded9b14de275d6bbfa66a4dc5e60146dfe264 +Digest 1: 808a94e9537be0b506ecf7fb02c3c82cab3c21922af7d5212088c035940a78b9 +Digest 2: 71b3a7ba22a4fb8289ee1286bae66a0b1674c3bb679a800118309514138de609 ``` Compare the digests shown on screen against the values above (and against those published in the release notes) before confirming the lockdown. @@ -55,20 +65,34 @@ You can also compute the hex representation of the `.bin` digest files to compar for n in 0 1 2; do xxd -p kern-sb-digest${n}.bin | tr -d '\n' && echo; done ``` +Once the frozen bootloaders are published, each can be checked against the three public keys (`espsecure` comes with `esptool`): + +```bash +for n in 0 1 2; do + espsecure verify-signature --version 2 \ + --keyfile kern-sb-key${n}-pub.pem bootloaders/v1-qio/bootloader-signed.bin +done +``` + ## On-Device Secure Boot Activation -When you navigate to **Settings > Secure Boot > Lock with Developer Keys**, the device will: +The device must have been installed **over USB** from a release that ships the frozen bootloader. A device installed from an older release and updated over SD since then still has its old bootloader; one USB install of a current release zip replaces it and keeps the device's data. + +**Settings → Security → Secure Boot** then: -1. Display the hex values of Digest 0, Digest 1, and Digest 2 (from constants embedded in the firmware). -2. Show a warning that this action is **irreversible** (eFuses are permanently burned). -3. Require PIN entry to proceed. -4. Verify that the running firmware **and** the flashed bootloader are signed with keys matching the embedded digests (a mismatch would brick the device on reboot). -5. Burn the three digests into eFuse KEY0/KEY1/KEY2 along with the standard hardening eFuses (direct-boot disable, JTAG disable, secure download mode), set the `SECURE_BOOT_EN` bit, and write-protect `RD_DIS` — the same set the stock ESP-IDF bootloader burns when it enables secure boot. +1. Shows the three key digests embedded in the firmware. +2. Checks, before offering anything, that the PIN keys are sealed, that the running app is signed by one of the three keys, and that the bootloader on flash is signed by **all three**. These are signature verifications against the embedded keys. If one fails, the page names it and offers no way to proceed. +3. Warns that the action is **irreversible** and asks for the PIN. +4. Burns the three digests into eFuse KEY0/KEY1/KEY2, reads them back, then burns the hardening eFuses (direct-boot disable, JTAG disable, secure download mode), `SECURE_BOOT_EN`, and the `RD_DIS` write-protect. -**Before confirming**, verify that the digests shown on screen match the values in this README and in the release notes. This ensures the firmware you are running contains the authentic developer keys. +**Before confirming**, compare the digests on screen with the values in this README and in the release notes. The device checks the images against the keys its firmware embeds; this comparison is what tells you that firmware embeds the authentic ones. After lockdown, only firmware signed with one of the corresponding private keys will boot on the device. +## Your Own Keys + +To lock a device to keys you control, replace the three `kern-sb-digestN.bin` files with the digests of your own public keys, build, and sign the app and the bootloader yourself (the bootloader with all three of your keys). The menu then checks and burns your digests. The frozen bootloaders here are signed by the developer keys and will be refused by such a build. Steps: [docs/secure-boot.md §5b](../docs/secure-boot.md#5b-user-builds-from-source-self-sovereign). + ## More Information -See [docs/secure-boot.md](../docs/secure-boot.md) for the full secure boot guide, including key rotation, anti-rollback, manual lockdown via `espefuse`, and self-sovereign builds with your own keys. +See [docs/secure-boot.md](../docs/secure-boot.md) for the full secure boot guide, including the frozen bootloader, key rotation, anti-rollback, and manual lockdown via `espefuse`. From ea018ebf904b4415a021c87375e60b6e9cebd55e Mon Sep 17 00:00:00 2001 From: odudex Date: Fri, 13 Nov 2026 16:33:37 -0300 Subject: [PATCH 03/20] fix(security): keep the idle watchdog subscribed during secure boot checks --- main/pages/login/secure_boot_page.c | 4 ++-- main/utils/worker_task.c | 23 +++++++++++++++++++---- main/utils/worker_task.h | 8 ++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/main/pages/login/secure_boot_page.c b/main/pages/login/secure_boot_page.c index 1f888b73..2b7abfef 100644 --- a/main/pages/login/secure_boot_page.c +++ b/main/pages/login/secure_boot_page.c @@ -195,8 +195,8 @@ static void start_task(bool enable) { } done = false; - if (!worker_task_start(enable ? "sb_enable" : "sb_status", TASK_STACK_SIZE, - enable ? enable_work : read_work, &done)) { + if (!worker_task_start_io(enable ? "sb_enable" : "sb_status", TASK_STACK_SIZE, + enable ? enable_work : read_work, &done)) { if (progress) { lv_obj_del(progress); progress = NULL; diff --git a/main/utils/worker_task.c b/main/utils/worker_task.c index d1d63bf7..8ba70baa 100644 --- a/main/utils/worker_task.c +++ b/main/utils/worker_task.c @@ -11,6 +11,7 @@ typedef struct { worker_task_fn_t fn; volatile bool *done_flag; + bool starves_core; } worker_ctx_t; static worker_ctx_t worker_ctx; @@ -21,11 +22,14 @@ static void worker_trampoline(void *arg) { (void)arg; TaskHandle_t idle = xTaskGetIdleTaskHandleForCore(WORKER_TASK_CORE); - esp_task_wdt_delete(idle); + bool starves_core = worker_ctx.starves_core; + if (starves_core) + esp_task_wdt_delete(idle); worker_ctx.fn(); - esp_task_wdt_add(idle); + if (starves_core) + esp_task_wdt_add(idle); *worker_ctx.done_flag = true; __atomic_store_n(&worker_running, false, __ATOMIC_RELEASE); // The UI joins and deletes this task with its owned stack. Self-deletion @@ -43,8 +47,8 @@ void worker_task_wait(void) { } } -bool worker_task_start(const char *name, uint32_t stack_bytes, - worker_task_fn_t fn, volatile bool *done_flag) { +static bool start(const char *name, uint32_t stack_bytes, worker_task_fn_t fn, + volatile bool *done_flag, bool starves_core) { if (!fn || !done_flag) return false; @@ -59,6 +63,7 @@ bool worker_task_start(const char *name, uint32_t stack_bytes, worker_ctx.fn = fn; worker_ctx.done_flag = done_flag; + worker_ctx.starves_core = starves_core; bool started = xTaskCreatePinnedToCoreWithCaps( worker_trampoline, name, stack_bytes, NULL, @@ -68,3 +73,13 @@ bool worker_task_start(const char *name, uint32_t stack_bytes, __atomic_store_n(&worker_running, false, __ATOMIC_RELEASE); return started; } + +bool worker_task_start(const char *name, uint32_t stack_bytes, + worker_task_fn_t fn, volatile bool *done_flag) { + return start(name, stack_bytes, fn, done_flag, true); +} + +bool worker_task_start_io(const char *name, uint32_t stack_bytes, + worker_task_fn_t fn, volatile bool *done_flag) { + return start(name, stack_bytes, fn, done_flag, false); +} diff --git a/main/utils/worker_task.h b/main/utils/worker_task.h index ff2a7eaa..28ebc82b 100644 --- a/main/utils/worker_task.h +++ b/main/utils/worker_task.h @@ -40,4 +40,12 @@ KERN_WARN_UNUSED_RESULT bool worker_task_start(const char *name, worker_task_fn_t fn, volatile bool *done_flag); +/* Same, for short work that waits on I/O. The idle task runs during those + * waits, so it stays subscribed: unsubscribed, its watchdog hook logs an + * error on every tick. */ +KERN_WARN_UNUSED_RESULT bool worker_task_start_io(const char *name, + uint32_t stack_bytes, + worker_task_fn_t fn, + volatile bool *done_flag); + #endif /* WORKER_TASK_H */ From 36aa06619fa31d1bbcee82ef12deba8d6b0bff38 Mon Sep 17 00:00:00 2001 From: odudex Date: Fri, 13 Nov 2026 16:33:37 -0300 Subject: [PATCH 04/20] fix(ui): label the button "Restart" after lockdown and firmware update --- main/pages/login/secure_boot_page.c | 4 ++-- main/pages/settings/firmware_update.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main/pages/login/secure_boot_page.c b/main/pages/login/secure_boot_page.c index 2b7abfef..90424045 100644 --- a/main/pages/login/secure_boot_page.c +++ b/main/pages/login/secure_boot_page.c @@ -173,8 +173,8 @@ static void poll_cb(lv_timer_t *timer) { } enabling = false; if (enable_result == ESP_OK) { - dialog_show_info("Secure Boot", "Secure boot is enabled.\nRestarting...", - restart_cb, NULL, DIALOG_STYLE_FULLSCREEN); + dialog_show_acknowledge("Secure Boot", "Secure boot is enabled.", "Restart", + restart_cb, NULL, DIALOG_STYLE_FULLSCREEN); return; } dialog_show_error_timeout("Secure boot could not be enabled.", NULL, 0); diff --git a/main/pages/settings/firmware_update.c b/main/pages/settings/firmware_update.c index 244aaf27..dbc420c7 100644 --- a/main/pages/settings/firmware_update.c +++ b/main/pages/settings/firmware_update.c @@ -151,8 +151,8 @@ static void poll_timer_cb(lv_timer_t *timer) { dialog_show_error_timeout(task_err, NULL, 0); return; } - dialog_show_info("Firmware Update", "Update installed.\nRestarting...", - restart_cb, NULL, DIALOG_STYLE_FULLSCREEN); + dialog_show_acknowledge("Firmware Update", "Update installed.", "Restart", + restart_cb, NULL, DIALOG_STYLE_FULLSCREEN); } static void start_task(TaskFunction_t fn, const char *name) { From e8e95b4f9c276e66257214a2169f4e331519e870 Mon Sep 17 00:00:00 2001 From: odudex Date: Fri, 13 Nov 2026 17:02:12 -0300 Subject: [PATCH 05/20] feat(build): add build-secure recipe for a lockable release image --- .gitignore | 1 + .justfile | 11 +++++++++++ docs/secure-boot.md | 1 + 3 files changed, 13 insertions(+) diff --git a/.gitignore b/.gitignore index a48e932c..6de1c3db 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ build_pbkdf2_*/ build_scanprof_*/ build_release_*/ build_sbtest_*/ +build_secure_*/ build_wave_4b/ build_wave_43/ build_wave_5/ diff --git a/.justfile b/.justfile index 9e5cadd3..919e7561 100644 --- a/.justfile +++ b/.justfile @@ -46,6 +46,16 @@ flash-release board="wave_4b": (build-release board) command -v idf.py >/dev/null || . $IDF_PATH/export.sh idf.py -B build_release_{{board}} -D SDKCONFIG=build_release_{{board}}/sdkconfig flash +# Lockable release image (sdkconfig.release + sdkconfig.secure, published key digests) in build_secure_/. +# The build signs with dev_signing_key.pem; the files to sign with the release keys are +# kern-unsigned.bin (key 0) and bootloader/bootloader-unsigned.bin (keys 0, 1 and 2). +build-secure board="wave_4b": (_check_board board) + #!/usr/bin/env sh + set -e + command -v idf.py >/dev/null || . $IDF_PATH/export.sh + rm -f build_secure_{{board}}/sdkconfig + idf.py -B build_secure_{{board}} -D SDKCONFIG=build_secure_{{board}}/sdkconfig -D "SDKCONFIG_DEFAULTS=$(just _defaults {{board}});sdkconfig.release;sdkconfig.secure" build + # Secure boot dry run: a sdkconfig.secure build with virtual eFuses (sdkconfig.sbtest), so the # Settings lockdown burns a RAM copy that is gone after the restart. Signed with test keys: # dev_signing_key.pem signs the app, it and two throwaway keys sign the bootloader, and their @@ -121,6 +131,7 @@ clean: rm -fRd build_scanprof_* rm -fRd build_release_* rm -fRd build_sbtest_* + rm -fRd build_secure_* rm -f sdkconfig rm -fRd compile_commands.json rm -fRd .cache/ diff --git a/docs/secure-boot.md b/docs/secure-boot.md index c680d347..73a54061 100644 --- a/docs/secure-boot.md +++ b/docs/secure-boot.md @@ -433,6 +433,7 @@ Before publishing, boot the new app on each frozen variant, and install it over |-------|----------|-----------|-----| | `just build ` | board defaults | Plain. Never verifies apps, cannot be locked | Daily development | | `just build-release ` | + `sdkconfig.release` | Plain | Release log and panic settings, for reproducing release behaviour | +| `just build-secure ` | + `sdkconfig.release` + `sdkconfig.secure` | Built here, dev-key signed; `bootloader/bootloader-unsigned.bin` is the image a freeze signs | One board's lockable image, for a freeze or a lockdown test | | `scripts/release.sh` | + `sdkconfig.release` + `sdkconfig.secure` | Frozen, from `kern_secure_boot/bootloaders/` | Published releases | | `just sbtest-flash ` | + `sdkconfig.secure` + `sdkconfig.sbtest` | Test-key signed, virtual eFuses | Dry run of the lockdown (Section 8) | From 0d2e3db8f063812a619c50c6ba7c38d9905de003 Mon Sep 17 00:00:00 2001 From: odudex Date: Fri, 13 Nov 2026 17:02:12 -0300 Subject: [PATCH 06/20] feat(security): turn on anti-rollback in the secure overlay --- docs/secure-boot.md | 11 +++++++---- docs/security-plan.md | 10 +++++----- sdkconfig.secure | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/docs/secure-boot.md b/docs/secure-boot.md index 73a54061..c1b21a16 100644 --- a/docs/secure-boot.md +++ b/docs/secure-boot.md @@ -729,15 +729,15 @@ Anti-rollback assumes an **OTA-only** partition table — two `ota_app` slots an ### Configuration -In `sdkconfig.secure`: +In `sdkconfig.secure` (`CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y`, which it depends on, is in `sdkconfig.defaults`): ``` -CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y CONFIG_BOOTLOADER_APP_SECURE_VERSION=0 +CONFIG_BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD=16 ``` -The security version starts at 0 and is stored in `sdkconfig.secure` as `CONFIG_BOOTLOADER_APP_SECURE_VERSION`. The size of the eFuse counter (and therefore the maximum number of increments) is set by `CONFIG_BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD` — size it generously, since every increment is permanent. +The security version starts at 0, which burns nothing, and is stored in `sdkconfig.secure` as `CONFIG_BOOTLOADER_APP_SECURE_VERSION`. `CONFIG_BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD` is the size of the eFuse counter and therefore the number of increments a device gets: 16, the whole field on ESP32-P4. It must never change afterwards, because it is how every build reads the bits already burned. ### When to Increment @@ -767,12 +767,15 @@ CONFIG_SECURE_BOOT=y CONFIG_SECURE_BOOT_V2_ENABLED=y CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y CONFIG_SECURE_INSECURE_ALLOW_DL_MODE=y +CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y +CONFIG_BOOTLOADER_APP_SECURE_VERSION=0 +CONFIG_BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD=16 ``` - `CONFIG_SECURE_INSECURE_ALLOW_DL_MODE` is not an opening: with `CONFIG_SECURE_BOOT` the default download-mode choice is secure download mode, which every app burns at startup (`esp_efuse_startup.c`), locked or not. The Settings lockdown burns it together with `SECURE_BOOT_EN` instead. - The hardening options IDF ties to `CONFIG_SECURE_BOOT` (JTAG, `RD_DIS`, unused-slot revokes) only act inside `esp_secure_boot_v2_permanently_enable()`, which `secure_boot_opt_in` defers until secure boot is on, and then returns early; the app burns that set itself. - `CONFIG_SECURE_BOOT_V2_ENABLED` selects `CONFIG_ESPTOOLPY_NO_STUB`, so `idf.py flash` runs without the stub and leaves the bootloader out; write it with esptool at `0x2000`. -- Anti-rollback (`CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK`) is not in this overlay yet: it burns `SECURE_VERSION` by itself whenever a newer app is confirmed, so it gets its own decision (Section 7). That decision is due before the first freeze, because the bootloader half of it cannot be added afterwards without a re-freeze. +- Anti-rollback (`CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK`) is on, at security version 0 (Section 7). It burns `SECURE_VERSION` by itself whenever an app with a higher security version is confirmed, and version 0 burns nothing. It was turned on before the first freeze because the bootloader half of it cannot be added afterwards without a re-freeze. - Aggressive key revocation stays off: revoking a good key on a single failed verification would be a bricking hazard for a wallet. - Signing: builds sign with `dev_signing_key.pem`. Releases re-sign the app offline with key 0 and ship the frozen bootloader instead of the built one (Sections 4a, 4b). - `CONFIG_BOOTLOADER_PROJECT_VER` will carry the freeze number once the first freeze is prepared. diff --git a/docs/security-plan.md b/docs/security-plan.md index 2bee9278..669e9b93 100644 --- a/docs/security-plan.md +++ b/docs/security-plan.md @@ -376,7 +376,7 @@ What is left over: - Document eFuse programming workflow and recovery procedures #### 6b. Build system integration -- `sdkconfig.secure` overlay (`CONFIG_SECURE_BOOT=y`, `CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y`, `CONFIG_SECURE_INSECURE_ALLOW_DL_MODE=y` so that no app burns secure download mode at startup): replaces the Phase 4 signed-on-update-only config. Done; anti-rollback is not in it yet (6c) +- `sdkconfig.secure` overlay (`CONFIG_SECURE_BOOT=y`, `CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y`, `CONFIG_SECURE_INSECURE_ALLOW_DL_MODE=y` so that no app burns secure download mode at startup): replaces the Phase 4 signed-on-update-only config. Done, with anti-rollback on at security version 0 (6c) - `bootloader_components/secure_boot_opt_in`: a stock `CONFIG_SECURE_BOOT` bootloader enables secure boot by itself on first boot, burning the digests of whatever signed it. The component wraps that call so the bootloader verifies apps once secure boot is on but never turns it on; the Settings menu does. Done, with a virtual-eFuse dry run (`just sbtest-flash`); not yet run on hardware - Releases build with `sdkconfig.release` + `sdkconfig.secure` and ship the frozen bootloader, not the built one (6d) - Leave `CONFIG_SECURE_BOOT_ENABLE_AGGRESSIVE_KEY_REVOKE` **off**: revoking a good key on one failed verification is a bricking hazard for a wallet @@ -389,14 +389,14 @@ What is left over: #### 6c. Anti-rollback (eFuse security version) -**Planned July 2026; nothing here lands on master before the secure-boot overlay exists. The on/off decision is due before the first bootloader freeze (6d):** the boot-time refusal of an older app is bootloader code, so a bootloader frozen without anti-rollback can only gain it through a re-freeze and a USB reflash of each device. Anti-rollback is what stops an attacker (or a careless user) from installing a genuinely signed *older* Kern release to reopen a fixed vulnerability. Until it is on, a downgrade is refused only by our own pre-flight check running inside the firmware being replaced, which an attacker with serial access simply flashes over. +**Decided November 2026: on, in the secure-boot overlay at security version 0, ahead of the first bootloader freeze (6d).** The boot-time refusal of an older app is bootloader code, so a bootloader frozen without anti-rollback could only gain it through a re-freeze and a USB reflash of each device, and the older bootloader would stay valid for as long as its keys are. Anti-rollback is what stops an attacker (or a careless user) from installing a genuinely signed *older* Kern release to reopen a fixed vulnerability. On a device without it, a downgrade is refused only by our own pre-flight check running inside the firmware being replaced, which an attacker with serial access simply flashes over. ##### What already exists - `CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y` (`sdkconfig.defaults`): the Kconfig dependency of `BOOTLOADER_APP_ANTI_ROLLBACK` is already satisfied. - OTA-only partition table, no `factory`: the layout anti-rollback requires (see [Partition Table](#partition-table)); this was settled in Phase 3. - `core/fw_update.c` rejects an image whose `secure_version` is below the running app's, with the user-visible error "Older security version rejected", and calls `esp_ota_mark_app_valid_cancel_rollback()` after a successful update, the self-confirm that makes the previous slot a valid fallback. -- Nothing on the eFuse side: `CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK` is unset, so `CONFIG_BOOTLOADER_APP_SECURE_VERSION` is invisible to Kconfig and `esp_app_desc.c` compiles `.secure_version = 0` into every build. **The Phase 4 software check is therefore a no-op today**, comparing 0 against 0, and only becomes meaningful once the overlay below sets a non-zero version. +- Development builds leave `CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK` unset, so `CONFIG_BOOTLOADER_APP_SECURE_VERSION` is invisible to Kconfig and `esp_app_desc.c` compiles `.secure_version = 0` into them. Builds with the overlay below set it, also to 0. **The Phase 4 software check is therefore a no-op today**, comparing 0 against 0, and only becomes meaningful with the first bump. ##### The eFuse field is a 16-shot budget @@ -423,7 +423,7 @@ Three sites, all worth knowing before the first burn: ##### Implementation, in the secure-boot overlay -All of it belongs in `sdkconfig.secure` alongside 6b, never in `sdkconfig.defaults`: a `CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y` on master would start burning counters on every device that flashes a master build: +In `sdkconfig.secure` since November 2026. All of it belongs there alongside 6b, never in `sdkconfig.defaults`: a `CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y` on master would start burning counters on every device that flashes a master build: ``` CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y @@ -471,7 +471,7 @@ Order of work: 1. Tooling that needs no private key: `just bootloader-stage`, the manifest, `scripts/freeze_bootloader.sh`, the `release.sh` / `sign_release.sh` changes, the CI checks, the web flasher changes. 2. Hardware: the virtual-eFuse dry run, then a real lockdown on a sacrificial board, followed by an SD update and a USB reflash on it. -3. The anti-rollback decision (6c). +3. The anti-rollback decision (6c). Taken: on. 4. The freeze ceremony. 5. The first lockable release. diff --git a/sdkconfig.secure b/sdkconfig.secure index 72878298..17b6bcb8 100644 --- a/sdkconfig.secure +++ b/sdkconfig.secure @@ -7,3 +7,8 @@ CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y # The default, secure download mode, would be burned by every app at startup. # The Settings lockdown burns it together with SECURE_BOOT_EN. CONFIG_SECURE_INSECURE_ALLOW_DL_MODE=y +# Anti-rollback: the bootloader refuses an app whose security version is below the eFuse counter. Version 0 burns nothing. +# The counter is 16 unary bits, 16 bumps for the life of a device: raise the version only for a security fix, and never change the field size. +CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y +CONFIG_BOOTLOADER_APP_SECURE_VERSION=0 +CONFIG_BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD=16 From fd80901fd3273483cc3b4f745a1fb40d1310ec10 Mon Sep 17 00:00:00 2001 From: odudex Date: Sun, 15 Nov 2026 18:24:02 -0300 Subject: [PATCH 07/20] feat(security): show the eFuse security version on the Secure Boot page --- main/core/secure_boot.c | 10 ++++++++++ main/core/secure_boot.h | 2 ++ main/pages/login/secure_boot_page.c | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/main/core/secure_boot.c b/main/core/secure_boot.c index 38aab768..578c8440 100644 --- a/main/core/secure_boot.c +++ b/main/core/secure_boot.c @@ -156,10 +156,20 @@ static secure_boot_check_t check_ready(bool slot_in_use) { #undef FAIL +/* The whole field: esp_efuse_read_secure_version() reads only as many bits + * as this build's anti-rollback config names. */ +static uint8_t read_security_version(void) { + uint32_t bits = 0; + esp_efuse_read_field_blob(ESP_EFUSE_SECURE_VERSION, &bits, + esp_efuse_get_field_size(ESP_EFUSE_SECURE_VERSION)); + return __builtin_popcount(bits); +} + static void evaluate(secure_boot_status_t *out, slot_t slots[SECURE_BOOT_KEY_COUNT]) { memset(out, 0, sizeof(*out)); memcpy(out->digests, KERN_SB_DIGESTS, sizeof(out->digests)); + out->security_version = read_security_version(); for (unsigned i = 0; i < SECURE_BOOT_KEY_COUNT; i++) out->revoked[i] = esp_efuse_get_digest_revoke(i); diff --git a/main/core/secure_boot.h b/main/core/secure_boot.h index 33b4164a..9f408f24 100644 --- a/main/core/secure_boot.h +++ b/main/core/secure_boot.h @@ -47,6 +47,8 @@ typedef struct { /* Burned digests once SECURE_BOOT_EN is set, the embedded ones before */ uint8_t digests[SECURE_BOOT_KEY_COUNT][SECURE_BOOT_DIGEST_LEN]; bool revoked[SECURE_BOOT_KEY_COUNT]; + /* eFuse anti-rollback counter: firmware below it does not start */ + uint8_t security_version; } secure_boot_status_t; void secure_boot_read_status(secure_boot_status_t *out); diff --git a/main/pages/login/secure_boot_page.c b/main/pages/login/secure_boot_page.c index 90424045..f87b8fcd 100644 --- a/main/pages/login/secure_boot_page.c +++ b/main/pages/login/secure_boot_page.c @@ -66,6 +66,14 @@ static void add_digests(void) { } } +static void add_security_version(void) { + char msg[80]; + snprintf(msg, sizeof(msg), + "Security version %u. Firmware with a lower one will not start.", + status.security_version); + lv_obj_set_style_margin_top(text(msg, true), theme_default_padding(), 0); +} + static const char *blocked_reason(secure_boot_check_t check) { switch (check) { case SECURE_BOOT_ERR_BUILD: @@ -114,6 +122,7 @@ static void render(void) { text("Only firmware signed by one of these keys starts on this device.", true); add_digests(); + add_security_version(); return; case SECURE_BOOT_INCOMPLETE: heading("Enabled, setup unfinished", error_color()); From fffe0cbec860cd9e72d30036c7a2f19022f6d4b2 Mon Sep 17 00:00:00 2001 From: odudex Date: Sun, 15 Nov 2026 18:24:02 -0300 Subject: [PATCH 08/20] docs(security): check a locked device without espefuse Secure download mode refuses espefuse, so the post-lock checks use esptool get-security-info and the Secure Boot page, and the manual lockdown burns ENABLE_SECURITY_DOWNLOAD last. --- docs/secure-boot.md | 32 ++++++++++++++++++++++---------- docs/security-plan.md | 2 +- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/docs/secure-boot.md b/docs/secure-boot.md index c1b21a16..41524de2 100644 --- a/docs/secure-boot.md +++ b/docs/secure-boot.md @@ -570,18 +570,26 @@ espefuse --chip esp32p4 burn-key \ BLOCK_KEY2 kern-sb-digest2.bin SECURE_BOOT_DIGEST2 # 4. Burn the hardening eFuses the stock bootloader would burn alongside -# secure boot (JTAG off, direct boot off, secure download mode) +# secure boot (JTAG off, direct boot off). Secure download mode is +# step 7. espefuse --chip esp32p4 burn-efuse DIS_DIRECT_BOOT 1 espefuse --chip esp32p4 burn-efuse DIS_PAD_JTAG 1 espefuse --chip esp32p4 burn-efuse DIS_USB_JTAG 1 espefuse --chip esp32p4 burn-efuse SOFT_DIS_JTAG 7 -espefuse --chip esp32p4 burn-efuse ENABLE_SECURITY_DOWNLOAD 1 # 5. Enable secure boot — POINT OF NO RETURN espefuse --chip esp32p4 burn-efuse SECURE_BOOT_EN # 6. Prevent post-hoc read-protection of the digest blocks espefuse --chip esp32p4 write-protect-efuse RD_DIS + +# 7. Secure download mode, LAST: espefuse needs register reads, and the +# ROM refuses them from the next reset on, so no espefuse command +# works after this one. +espefuse --chip esp32p4 burn-efuse ENABLE_SECURITY_DOWNLOAD 1 + +# 8. Check what is still readable +esptool --chip esp32p4 --no-stub get-security-info ``` After step 5, only firmware signed with `kern-sb-key0.pem`, `kern-sb-key1.pem`, or `kern-sb-key2.pem` will boot on this device. @@ -648,8 +656,9 @@ espefuse --chip esp32p4 burn-key \ BLOCK_KEY1 my-digest0.bin SECURE_BOOT_DIGEST1 \ BLOCK_KEY2 my-digest1.bin SECURE_BOOT_DIGEST2 -# Burn the hardening eFuses (step 4 of the 5a manual method), then enable -# secure boot and write-protect RD_DIS as in steps 5-6 there +# Then steps 4-7 of the 5a manual method, in that order: the hardening +# eFuses, SECURE_BOOT_EN, the RD_DIS write-protect, and secure download +# mode last espefuse --chip esp32p4 burn-efuse SECURE_BOOT_EN ``` @@ -799,7 +808,7 @@ eFuses must be burned in a specific order. The critical rule: **the read-protect | 5 | `burn-key BLOCK_KEY2 ... SECURE_BOOT_DIGEST2` | KEY2 | Phase 6 | Rotation #2 secure boot digest | | 6 | `burn-efuse SECURE_BOOT_EN` (+ hardening set) | Control | Phase 6 | **Enables secure boot permanently.** Burned together with `DIS_DIRECT_BOOT`, the JTAG-disable set, secure download mode, then the `RD_DIS` write-protect | -> **Every eFuse burn is irreversible.** Use `espefuse summary` to inspect the eFuse state before and after. The whole sequence runs from on-device flows: rows 1–2 during PIN setup, rows 3–6 from the Secure Boot menu. If you ever leave a digest slot empty (a custom hybrid layout), revoke it before enabling secure boot. +> **Every eFuse burn is irreversible.** Use `espefuse summary` to inspect the eFuse state before the lockdown. Afterwards secure download mode refuses it, and what is left is `esptool --no-stub get-security-info` and the Secure Boot page (Section 10). The whole sequence runs from on-device flows: rows 1–2 during PIN setup, rows 3–6 from the Secure Boot menu. If you ever leave a digest slot empty (a custom hybrid layout), revoke it before enabling secure boot. --- @@ -843,10 +852,11 @@ Complete these steps on a **development board** before any production device. - [ ] Verify PIN is required before proceeding - [ ] Verify warning about irreversibility is shown - [ ] Confirm lockdown — device writes three digests, burns the hardening set, and burns `SECURE_BOOT_EN` -- [ ] Read eFuse state: `espefuse summary` — verify KEY0/KEY1/KEY2 are programmed and `SECURE_BOOT_EN` is set -- [ ] Verify hardening eFuses: `DIS_DIRECT_BOOT`, `DIS_PAD_JTAG`, `DIS_USB_JTAG`, `SOFT_DIS_JTAG`, `ENABLE_SECURITY_DOWNLOAD` set, and `RD_DIS` write-protected +- [ ] Device restarts and boots normally; the ROM prints `Valid secure boot key blocks: 0 1 2` and `RSA-PSS secure boot verification succeeded` +- [ ] `espefuse summary` is now refused (`not supported in Secure Download Mode`): the host can no longer read eFuses +- [ ] `esptool --no-stub get-security-info` — `Secure Boot: Enabled`, chip in Secure Download Mode, `JTAG: Permanently Disabled`, KEY0/KEY1/KEY2 hold `SECURE_BOOT_DIGEST0/1/2`, flags `0xc5` (secure boot, secure download mode, both JTAG disables, no key revoked) +- [ ] The Secure Boot page shows **Enabled** with the three burned digests and the security version, not "Enabled, setup unfinished": it is the only check left for `DIS_DIRECT_BOOT`, `DIS_USB_JTAG`, the `RD_DIS` write-protect and the anti-rollback counter, which the host cannot read any more - [ ] Attempt JTAG attach — **must fail** -- [ ] Device reboots and boots normally with signed firmware ### On-Device Lockdown — Guard Rails @@ -863,6 +873,7 @@ Complete these steps on a **development board** before any production device. - [ ] Read eFuse state: `espefuse summary` — verify KEY0/KEY1/KEY2 are programmed - [ ] Device still boots (secure boot not yet enabled, so unsigned firmware also works) - [ ] `espefuse burn-efuse SECURE_BOOT_EN` +- [ ] Hardening set burned with `ENABLE_SECURITY_DOWNLOAD` last: every `espefuse` command after it is refused - [ ] Device boots with signed firmware — **confirm normal operation** ### Post-Lockdown Verification @@ -885,7 +896,8 @@ Complete these steps on a **development board** before any production device. - [ ] Install firmware with security version 1 - [ ] Attempt to install firmware with security version 0 via SD card — **must be rejected** -- [ ] `espefuse summary` — verify security version counter shows 1 +- [ ] Counter is 1: the Secure Boot page of a locked device shows `Security version 1`; on an unlocked board `espefuse summary` shows `SECURE_VERSION` +- [ ] Write the security version 0 firmware over USB — the bootloader **must refuse it** (`No bootable app partitions`), and writing version 1 back must recover the device ### Recovery @@ -921,7 +933,7 @@ The frozen bootloader is the one piece of Kern's code an SD update cannot fix. A - A compromised build environment could inject malicious code before signing. - **Mitigation**: Build on a trusted, air-gapped machine. The frozen bootloader is reproducible from its tag today (Section 4a); reproducible app builds (future work) would extend that to every release. - Pre-flashed devices from untrusted sources could have attacker digests burned. -- **Mitigation**: Users should verify eFuse state with `espefuse summary` before trusting a pre-flashed device, or flash and lock down the device themselves. +- **Mitigation**: Lock the device yourself. `espefuse summary` shows the eFuse state of a device that is not locked yet. A locked one cannot be read that way: `esptool --no-stub get-security-info` shows which key slots hold digests but not their values, so install the official release over USB and compare the digests on its Secure Boot page with the published ones. ### Cross-Phase Dependencies diff --git a/docs/security-plan.md b/docs/security-plan.md index 669e9b93..8c7cf787 100644 --- a/docs/security-plan.md +++ b/docs/security-plan.md @@ -419,7 +419,7 @@ Three sites, all worth knowing before the first burn: - The bootloader refuses any slot below the eFuse value (`check_anti_rollback()`, wrapped in an `ESP_FAULT_ASSERT` anti-FI double read). - Downgrade becomes physically impossible **for the developer too**: no debug path, no serial escape. Keep a never-bumped unit for reproducing old-version bug reports. - **Never run `espefuse write_protect_efuse SECURE_VERSION`.** `WR_DIS.SECURE_VERSION` (BLK0 bit 18) would freeze the counter and disable every future bump. Nothing in the secure-boot flow burns it; this is a manual footgun only. -- Visibility: the bootloader logs `Secure version (from eFuse) = N` on every boot, and `espefuse.py summary` shows `SECURE_VERSION`. +- Visibility: a bootloader that logs at INFO prints `Secure version (from eFuse) = N` on every boot, and `espefuse summary` shows `SECURE_VERSION` on a device that is not locked. A locked release device offers neither: its bootloader logs at WARN and secure download mode refuses `espefuse`. There the Secure Boot page shows the counter. ##### Implementation, in the secure-boot overlay From 9e050da8e8bc9a993b72fffee2c9948b2d5bb810 Mon Sep 17 00:00:00 2001 From: odudex Date: Sun, 15 Nov 2026 18:24:02 -0300 Subject: [PATCH 09/20] feat(build): stage, sign and import frozen bootloaders --- .justfile | 13 ++- docs/secure-boot.md | 12 +-- docs/security-plan.md | 2 +- scripts/bootloader_import.sh | 85 +++++++++++++++++ scripts/bootloader_stage.sh | 141 +++++++++++++++++++++++++++++ scripts/freeze_bootloader.sh | 171 +++++++++++++++++++++++++++++++++++ 6 files changed, 415 insertions(+), 9 deletions(-) create mode 100755 scripts/bootloader_import.sh create mode 100755 scripts/bootloader_stage.sh create mode 100755 scripts/freeze_bootloader.sh diff --git a/.justfile b/.justfile index 919e7561..4ce670a4 100644 --- a/.justfile +++ b/.justfile @@ -49,12 +49,21 @@ flash-release board="wave_4b": (build-release board) # Lockable release image (sdkconfig.release + sdkconfig.secure, published key digests) in build_secure_/. # The build signs with dev_signing_key.pem; the files to sign with the release keys are # kern-unsigned.bin (key 0) and bootloader/bootloader-unsigned.bin (keys 0, 1 and 2). -build-secure board="wave_4b": (_check_board board) +build-secure board="wave_4b" target="build": (_check_board board) #!/usr/bin/env sh set -e command -v idf.py >/dev/null || . $IDF_PATH/export.sh rm -f build_secure_{{board}}/sdkconfig - idf.py -B build_secure_{{board}} -D SDKCONFIG=build_secure_{{board}}/sdkconfig -D "SDKCONFIG_DEFAULTS=$(just _defaults {{board}});sdkconfig.release;sdkconfig.secure" build + idf.py -B build_secure_{{board}} -D SDKCONFIG=build_secure_{{board}}/sdkconfig -D "SDKCONFIG_DEFAULTS=$(just _defaults {{board}});sdkconfig.release;sdkconfig.secure" {{target}} + +# Build every board's secure bootloader and stage one unsigned image per variant in release/bootloader-/ +# for scripts/freeze_bootloader.sh, which signs them with the three release keys on the air-gapped PC. +bootloader-stage: + ./scripts/bootloader_stage.sh + +# Verify a signed release/bootloader-/ folder and copy it into kern_secure_boot/bootloaders/ +bootloader-import dir: + ./scripts/bootloader_import.sh {{dir}} # Secure boot dry run: a sdkconfig.secure build with virtual eFuses (sdkconfig.sbtest), so the # Settings lockdown burns a RAM copy that is gone after the restart. Signed with test keys: diff --git a/docs/secure-boot.md b/docs/secure-boot.md index 41524de2..30937f4c 100644 --- a/docs/secure-boot.md +++ b/docs/secure-boot.md @@ -302,7 +302,7 @@ A locked device keeps the bootloader it was locked with. SD updates only write t Signing a bootloader with all three keys means taking keys 1 and 2 out of cold storage. Doing that for every release would defeat the reason they are cold. So the bootloader is built, signed once in a key ceremony, and committed; every release after that ships those same bytes. Only the app is built and signed per release, with key 0. -> **Status:** the bootloader component (`bootloader_components/secure_boot_opt_in`), the `sdkconfig.secure` overlay and the dry run exist. The staging recipe, the freeze script, the release-script changes, the CI checks and the web flasher changes described below are planned and not implemented yet. No bootloader has been frozen. +> **Status:** the bootloader component (`bootloader_components/secure_boot_opt_in`), the `sdkconfig.secure` overlay, the dry run and the freeze tooling (`just bootloader-stage`, `scripts/freeze_bootloader.sh`, `just bootloader-import`) exist. The release-script changes, the CI checks and the web flasher changes described below are planned and not implemented yet. No frozen bootloader is published yet. **Variants.** The bootloader does not depend on the display, touch or camera, so most boards share one. Two settings split it: the chip revision range (v1.x and v3.x need different builds, and the v3 bootloader runs a different CPU clock) and the flash mode (wave_35 uses DIO, the rest QIO). That gives four: @@ -338,14 +338,14 @@ kern_secure_boot/bootloaders/ v3-dio/bootloader-signed.bin ``` -`BOOTLOADERS` has one line per variant: freeze number, git tag, ESP-IDF version, the boards it serves, and the SHA-256 of the unsigned image. `SHA256SUMS` covers the manifest and the binaries, so the existing `SHA256SUMS.sig` vouches for them together with the public keys. +`BOOTLOADERS` has one line per variant: freeze number, git tag and commit, ESP-IDF version, the SHA-256 of the unsigned image, and the boards it serves. `SHA256SUMS` covers the manifest and the binaries, so the existing `SHA256SUMS.sig` vouches for them together with the public keys. -**Anyone can check it.** A secure build writes `bootloader/bootloader-unsigned.bin`, and that file comes out identical across build directories. Building the freeze tag with the manifest's ESP-IDF version must reproduce every byte of the frozen image up to its signature sector, and `espsecure verify-signature` checks the sector against each public key. +**Anyone can check it.** A secure build writes `bootloader/bootloader-unsigned.bin`, and that file comes out identical across build directories. Building the freeze tag with the manifest's ESP-IDF version must reproduce every byte of the frozen image up to its signature sector, and `espsecure verify-signature` checks the sector against each public key. `bash scripts/freeze_bootloader.sh --verify kern_secure_boot/bootloaders kern_secure_boot` runs both checks on every published variant, without any private key. **The freeze.** -1. On the build machine, at the commit to freeze: `just bootloader-stage` builds only the bootloader (`sdkconfig.release` + `sdkconfig.secure`) for every board, groups the unsigned images by hash, and stages one per variant with a draft manifest. -2. On the air-gapped signing machine, with all three private keys: `scripts/freeze_bootloader.sh` signs each staged image with key 0, appends key 1 and key 2, verifies the result against the three published public keys, and writes the manifest hashes. By hand that is: +1. On the build machine, at the commit to freeze: `just bootloader-stage` builds only the bootloader (`sdkconfig.release` + `sdkconfig.secure`) for every board, groups the unsigned images into variants, and stages one per variant in `release/bootloader-/` with the manifest, the public keys and `freeze_bootloader.sh`. It stops if two boards of one variant build different bootloaders. A variant whose frozen image still matches the build is staged with that signature and is not signed again: a signature cannot be reproduced, and devices are locked with those bytes. +2. On the air-gapped signing machine, from that folder, with all three private keys: `bash freeze_bootloader.sh `. It checks each private key against its published digest, so a key in the wrong position stops the run, checks each unsigned image against the manifest, signs it with key 0, appends key 1 and key 2, and verifies the result against the three public keys. By hand that is: ```bash espsecure sign-data --version 2 --keyfile kern-sb-key0.pem \ @@ -361,7 +361,7 @@ for n in 0 1 2; do done ``` -3. Back on the build machine: copy the result into `kern_secure_boot/bootloaders/`, regenerate `SHA256SUMS`, sign it with GPG, commit, and tag the commit `bootloader-`. +3. Back on the build machine: `just bootloader-import release/bootloader-` verifies the folder against the public keys in `kern_secure_boot/` and copies the signed images and their manifest lines into `kern_secure_boot/bootloaders/`. It refuses to replace a frozen image with different bytes under the same freeze number. Then regenerate `SHA256SUMS`, sign it with GPG, commit, and tag the manifest's commit `bootloader-`; the recipe prints those commands. Fill this in at each freeze and keep it with the key ceremony record (Section 3e): diff --git a/docs/security-plan.md b/docs/security-plan.md index 8c7cf787..0cce9b00 100644 --- a/docs/security-plan.md +++ b/docs/security-plan.md @@ -469,7 +469,7 @@ Re-run this matrix as part of the Phase 4d suite on a locked device. Order of work: -1. Tooling that needs no private key: `just bootloader-stage`, the manifest, `scripts/freeze_bootloader.sh`, the `release.sh` / `sign_release.sh` changes, the CI checks, the web flasher changes. +1. Tooling that needs no private key: `just bootloader-stage`, the manifest, `scripts/freeze_bootloader.sh` and `just bootloader-import` (done), then the `release.sh` / `sign_release.sh` changes, the CI checks, the web flasher changes. 2. Hardware: the virtual-eFuse dry run, then a real lockdown on a sacrificial board, followed by an SD update and a USB reflash on it. 3. The anti-rollback decision (6c). Taken: on. 4. The freeze ceremony. diff --git a/scripts/bootloader_import.sh b/scripts/bootloader_import.sh new file mode 100755 index 00000000..4e842078 --- /dev/null +++ b/scripts/bootloader_import.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# Kern bootloader freeze, step 3 of 3 — runs on the build machine. +# +# Verifies a release/bootloader- folder that came back from the air-gapped +# signing PC against the public keys in kern_secure_boot/ (not the copies in +# the folder), then copies each signed bootloader and its manifest line into +# kern_secure_boot/bootloaders/. Needs no private key. +# +# Usage: bootloader_import.sh (or: just bootloader-import ) +# +# A frozen bootloader is never replaced by different bytes under the same +# freeze number. SHA256SUMS, its GPG signature, the commit and the +# bootloader- tag are left to the developer; the commands are printed. + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +KERN_SB_DIR="${KERN_SB_DIR:-$REPO_ROOT/kern_secure_boot}" +DIR="$1" + +if [ -z "$DIR" ] || [ ! -f "$DIR/BOOTLOADERS" ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +# espsecure comes with ESP-IDF here (matches justfile) +command -v espsecure >/dev/null || source "${IDF_PATH:-$HOME/esp/esp-idf}/export.sh" >/dev/null 2>&1 + +bash "$SCRIPT_DIR/freeze_bootloader.sh" --verify "$DIR" "$KERN_SB_DIR" + +python3 - "$DIR" "$KERN_SB_DIR/bootloaders" <<'EOF' +import os, shutil, sys + +src, dest = sys.argv[1:3] +HEADER = ("# Frozen bootloaders, one line per variant (docs/secure-boot.md, section 4a)\n" + "# variant freeze tag commit esp-idf unsigned-sha256 boards\n") + +def read(path): + lines = {} + if os.path.exists(path): + for line in open(path): + if line.strip() and not line.startswith("#"): + lines[line.split()[0]] = line.rstrip("\n") + return lines + +frozen, staged = read(os.path.join(dest, "BOOTLOADERS")), read(os.path.join(src, "BOOTLOADERS")) +imported, pending, tags = [], [], set() +for variant, line in sorted(staged.items()): + signed = os.path.join(src, variant, "bootloader-signed.bin") + if not os.path.exists(signed): + pending.append(variant) + continue + target = os.path.join(dest, variant, "bootloader-signed.bin") + if os.path.exists(target) and open(target, "rb").read() != open(signed, "rb").read(): + same_freeze = variant not in frozen or frozen[variant].split()[1] == line.split()[1] + if same_freeze: + sys.exit(f"Error: {variant} is already frozen with other bytes under this freeze number. " + "Devices may be locked with it; nothing was imported.") + imported.append((variant, signed, target, line)) + +for variant, signed, target, line in imported: + os.makedirs(os.path.dirname(target), exist_ok=True) + shutil.copy(signed, target) + frozen[variant] = line + tags.add((line.split()[2], line.split()[3])) + print(f" {variant}: imported") +for variant in pending: + print(f" {variant}: NOT signed, not imported") + +if imported: + with open(os.path.join(dest, "BOOTLOADERS"), "w") as f: + f.write(HEADER + "\n".join(frozen[v] for v in sorted(frozen)) + "\n") +if pending: + print("\nSign the rest with freeze_bootloader.sh on the air-gapped PC, then import this folder again.") +elif imported: + print(f"\nFrozen bootloaders are in {dest}. Left to do by hand:") + print(" cd kern_secure_boot") + print(" sha256sum kern-sb-key?-pub.pem kern-sb-digest?.bin bootloaders/BOOTLOADERS " + "bootloaders/*/bootloader-signed.bin > SHA256SUMS") + print(" gpg --detach-sign --armor -o SHA256SUMS.sig SHA256SUMS") + print(" git add . && git commit") + for tag, commit in sorted(tags): + print(f" git tag {tag} {commit}") +EOF diff --git a/scripts/bootloader_stage.sh b/scripts/bootloader_stage.sh new file mode 100755 index 00000000..4a8d90e5 --- /dev/null +++ b/scripts/bootloader_stage.sh @@ -0,0 +1,141 @@ +#!/bin/bash +# Kern bootloader freeze, step 1 of 3 — runs on the build machine. +# +# Builds the secure-boot bootloader (sdkconfig.release + sdkconfig.secure) for +# every device, groups the unsigned images into variants (chip revision range +# and flash mode) and stages one per variant in release/bootloader-/, with +# the BOOTLOADERS manifest, the public keys and freeze_bootloader.sh. N is +# CONFIG_BOOTLOADER_PROJECT_VER. +# +# A variant whose frozen image in kern_secure_boot/bootloaders/ still matches +# the build is staged with that signature and is not signed again. +# +# Move the folder to the air-gapped signing PC, run freeze_bootloader.sh there, +# then bring it back and run `just bootloader-import release/bootloader-`. +# +# The tree must be committed: a frozen bootloader has to be reproducible from +# the commit the manifest names. ALLOW_DIRTY=1 skips that for a trial run. + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +KERN_SB_DIR="${KERN_SB_DIR:-$REPO_ROOT/kern_secure_boot}" +BOARDS="wave_4b wave_35 wave_5 wave_43 crowpanel wave_7b p4_pico" +# Each board twice: ESP32-P4 chip revision v1.x, then v3.x (_v3) +DEVICES="$BOARDS $(printf '%s_v3 ' $BOARDS)" + +cd "$REPO_ROOT" + +if [ -n "$(git status --porcelain)" ] && [ -z "$ALLOW_DIRTY" ]; then + echo "Error: uncommitted changes. Commit first, or set ALLOW_DIRTY=1 for a trial run." >&2 + exit 1 +fi +COMMIT="$(git rev-parse HEAD)" + +command -v idf.py >/dev/null || source "${IDF_PATH:-$HOME/esp/esp-idf}/export.sh" + +BUILT="$(mktemp)" +trap 'rm -f "$BUILT"' EXIT + +for DEVICE in $DEVICES; do + echo "========================================" + echo "Building the bootloader for ${DEVICE}..." + echo "========================================" + just build-secure "$DEVICE" bootloader + + BUILD_DIR="build_secure_${DEVICE}" + CONFIG="$BUILD_DIR/sdkconfig" + if grep -q '^CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y' "$CONFIG"; then REV=v1; else REV=v3; fi + if grep -q '^CONFIG_ESPTOOLPY_FLASHMODE_QIO=y' "$CONFIG"; then + MODE=qio + elif grep -q '^CONFIG_ESPTOOLPY_FLASHMODE_DIO=y' "$CONFIG"; then + MODE=dio + else + echo "Error: ${DEVICE} uses a flash mode with no bootloader variant" >&2 + exit 1 + fi + FREEZE="$(sed -n 's/^CONFIG_BOOTLOADER_PROJECT_VER=//p' "$CONFIG")" + IDF_VER="$(python3 -c 'import json, sys; print(json.load(open(sys.argv[1]))["git_revision"])' "$BUILD_DIR/project_description.json")" + SHA="$(sha256sum "$BUILD_DIR/bootloader/bootloader-unsigned.bin" | cut -d' ' -f1)" + echo "$REV-$MODE $DEVICE $FREEZE $IDF_VER $SHA" >> "$BUILT" +done + +python3 - "$BUILT" "$REPO_ROOT" "$KERN_SB_DIR" "$COMMIT" "$SCRIPT_DIR/freeze_bootloader.sh" <<'EOF' +import os, shutil, sys + +built, repo, sb_dir, commit, freeze_script = sys.argv[1:6] +SECTOR = 4096 + +variants = {} +for line in open(built): + variant, device, freeze, idf_ver, sha = line.split() + v = variants.setdefault(variant, {"freeze": freeze, "idf": idf_ver, "sha": sha, "devices": []}) + if (v["freeze"], v["idf"], v["sha"]) != (freeze, idf_ver, sha): + sys.exit(f"Error: {device} builds a different {variant} bootloader than {v['devices'][0]} " + f"({sha[:16]} against {v['sha'][:16]}): it needs a variant of its own") + v["devices"].append(device) + +freezes = {v["freeze"] for v in variants.values()} +if len(freezes) != 1: + sys.exit(f"Error: boards disagree on CONFIG_BOOTLOADER_PROJECT_VER: {sorted(freezes)}") +freeze = freezes.pop() + +frozen_manifest = {} +manifest_path = os.path.join(sb_dir, "bootloaders", "BOOTLOADERS") +if os.path.exists(manifest_path): + for line in open(manifest_path): + if line.strip() and not line.startswith("#"): + frozen_manifest[line.split()[0]] = line.rstrip("\n") + +out = os.path.join(repo, "release", f"bootloader-{freeze}") +if os.path.exists(out): + sys.exit(f"Error: {out} already exists. Import it (just bootloader-import) or remove it: " + "it may hold signatures that cannot be made again.") + +lines, to_sign = [], [] +for variant in sorted(variants): + v = variants[variant] + unsigned = os.path.join(repo, f"build_secure_{v['devices'][0]}", "bootloader", "bootloader-unsigned.bin") + line = f"{variant} {freeze} bootloader-{freeze} {commit} {v['idf']} {v['sha']} {','.join(v['devices'])}" + frozen = os.path.join(sb_dir, "bootloaders", variant, "bootloader-signed.bin") + keep = False + if os.path.exists(frozen): + u = open(unsigned, "rb").read() + keep = open(frozen, "rb").read()[:-SECTOR] == u + b"\xff" * (-len(u) % SECTOR) + if not keep and (variant not in frozen_manifest or frozen_manifest[variant].split()[1] == freeze): + sys.exit(f"Error: the {variant} bootloader built here differs from the frozen one. " + "To freeze a new one, raise CONFIG_BOOTLOADER_PROJECT_VER in sdkconfig.secure.") + os.makedirs(os.path.join(out, variant)) + shutil.copy(unsigned, os.path.join(out, variant, "bootloader-unsigned.bin")) + if keep: + shutil.copy(frozen, os.path.join(out, variant, "bootloader-signed.bin")) + # The commit and boards of the original freeze stay unless this build widens them + if variant in frozen_manifest and frozen_manifest[variant].split()[5] == v["sha"]: + old = frozen_manifest[variant].split() + line = " ".join(old[:6] + [",".join(v["devices"])]) + else: + to_sign.append(variant) + lines.append(line) + +with open(os.path.join(out, "BOOTLOADERS"), "w") as f: + f.write("# Frozen bootloaders, one line per variant (docs/secure-boot.md, section 4a)\n") + f.write("# variant freeze tag commit esp-idf unsigned-sha256 boards\n") + f.write("\n".join(lines) + "\n") +for n in range(3): + for name in (f"kern-sb-key{n}-pub.pem", f"kern-sb-digest{n}.bin"): + shutil.copy(os.path.join(sb_dir, name), out) +shutil.copy(freeze_script, out) + +print("========================================") +print(f"Bootloader freeze {freeze} staged in {out}") +for line in lines: + variant, _, _, _, idf_ver, sha, boards = line.split() + state = "to sign" if variant in to_sign else "already frozen, signature kept" + print(f" {variant} {sha[:16]} {state} ({boards})") +print() +if to_sign: + print("On the air-gapped PC, from that folder:") + print(" bash freeze_bootloader.sh ") +print(f"Then: just bootloader-import release/bootloader-{freeze}") +EOF diff --git a/scripts/freeze_bootloader.sh b/scripts/freeze_bootloader.sh new file mode 100755 index 00000000..4240f2ca --- /dev/null +++ b/scripts/freeze_bootloader.sh @@ -0,0 +1,171 @@ +#!/bin/bash +# Kern bootloader freeze, step 2 of 3 — runs on the AIR-GAPPED signing PC. +# +# For each bootloader variant staged by bootloader_stage.sh, this script: +# 1. checks the unsigned image against the SHA-256 in the BOOTLOADERS manifest +# 2. signs it with the three Secure Boot v2 RSA-3072 keys (key 0, then keys 1 +# and 2 appended), unless the variant already carries its frozen signature +# 3. verifies the result against the three public keys in the folder +# +# Usage (from inside the release/bootloader- folder on the SD card): +# +# bash freeze_bootloader.sh [folder] +# +# folder defaults to the directory this script sits in. Each private key is +# checked against its published digest before anything is signed, so a key in +# the wrong position stops the run. +# +# Without private keys it only verifies, which is what bootloader_import.sh and +# anyone checking the published bootloaders use: +# +# bash freeze_bootloader.sh --verify [folder] [public-key-folder] +# +# Requirements: bash, python3, sha256sum and the esptool pip package (provides +# espsecure; python3 -m espsecure is used if the CLI is not on PATH). +# +# Input per variant: /bootloader-unsigned.bin +# Output per variant: /bootloader-signed.bin +# +# A signature cannot be reproduced: signing the same image again gives different +# bytes. A variant that already has bootloader-signed.bin is never signed again. + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SECTOR=4096 + +if [ "$1" = "--verify" ]; then + VERIFY_ONLY=1 + DIR="${2:-$SCRIPT_DIR}" + PUB_DIR="${3:-$DIR}" +else + VERIFY_ONLY= + KEYS=("$1" "$2" "$3") + DIR="${4:-$SCRIPT_DIR}" + PUB_DIR="$DIR" + for n in 0 1 2; do + if [ -z "${KEYS[$n]}" ] || [ ! -f "${KEYS[$n]}" ]; then + echo "Usage: $0 [folder]" >&2 + echo " $0 --verify [folder] [public-key-folder]" >&2 + echo "Error: signing key $n not found: '${KEYS[$n]}'" >&2 + exit 1 + fi + done +fi + +MANIFEST="$DIR/BOOTLOADERS" +if [ ! -f "$MANIFEST" ]; then + echo "Error: no BOOTLOADERS manifest in $DIR" >&2 + exit 1 +fi + +if command -v espsecure >/dev/null 2>&1; then + ESPSECURE="espsecure" +elif python3 -c "import espsecure" >/dev/null 2>&1; then + ESPSECURE="python3 -m espsecure" +else + echo "Error: espsecure not found. Install esptool (pip install esptool)." >&2 + exit 1 +fi + +TMP="$(mktemp -d)" +trap 'rm -rf "$TMP"' EXIT + +if [ -z "$VERIFY_ONLY" ]; then + for n in 0 1 2; do + $ESPSECURE digest-sbv2-public-key --keyfile "${KEYS[$n]}" \ + --output "$TMP/digest$n.bin" >/dev/null + if ! cmp -s "$TMP/digest$n.bin" "$PUB_DIR/kern-sb-digest$n.bin"; then + echo "Error: '${KEYS[$n]}' is not key $n (kern-sb-digest$n.bin differs)" >&2 + exit 1 + fi + done + echo "The three private keys match the published digests" +fi + +# The signed image is the unsigned one padded to a sector, then the signature +# sector. Without the unsigned file, the manifest hash stands in for it. +check_body() { + python3 - "$1" "$2" "$3" "$SECTOR" <<'EOF' +import hashlib, os, sys +signed, unsigned, want, sector = sys.argv[1], sys.argv[2], sys.argv[3], int(sys.argv[4]) +s = open(signed, "rb").read() +if len(s) % sector or len(s) < 2 * sector: + sys.exit("signed image is not a whole number of sectors") +body = s[:-sector] +if os.path.exists(unsigned): + u = open(unsigned, "rb").read() + ok = body == u + b"\xff" * (-len(u) % sector) +else: + n, ok = len(body), False + while True: + if hashlib.sha256(body[:n]).hexdigest() == want: + ok = True + break + if len(body) - n >= sector - 1 or body[n - 1] != 0xFF: + break + n -= 1 +sys.exit(0 if ok else "signed image does not hold the manifest's unsigned image") +EOF +} + +# Every input is checked before the first signature is made +while read -r VARIANT FREEZE TAG COMMIT IDF_VER SHA BOARDS; do + case "$VARIANT" in '' | '#'*) continue ;; esac + UNSIGNED="$DIR/$VARIANT/bootloader-unsigned.bin" + if [ -f "$UNSIGNED" ]; then + HAVE="$(sha256sum "$UNSIGNED" | cut -d' ' -f1)" + if [ "$HAVE" != "$SHA" ]; then + echo "Error: $UNSIGNED is $HAVE, the manifest says $SHA" >&2 + exit 1 + fi + elif [ -z "$VERIFY_ONLY" ] && [ ! -f "$DIR/$VARIANT/bootloader-signed.bin" ]; then + echo "Error: $UNSIGNED is missing" >&2 + exit 1 + fi +done < "$MANIFEST" + +SIGNED=0 +PENDING=0 +while read -r VARIANT FREEZE TAG COMMIT IDF_VER SHA BOARDS; do + case "$VARIANT" in '' | '#'*) continue ;; esac + UNSIGNED="$DIR/$VARIANT/bootloader-unsigned.bin" + OUT="$DIR/$VARIANT/bootloader-signed.bin" + + if [ -f "$OUT" ]; then + STATE="${VERIFY_ONLY:+signed}" + STATE="${STATE:-already signed, left as it is}" + elif [ -n "$VERIFY_ONLY" ]; then + echo "── $VARIANT: not signed yet ──" + PENDING=$((PENDING + 1)) + continue + else + echo "── $VARIANT (freeze $FREEZE, $BOARDS): signing ${SHA:0:16} ──" + $ESPSECURE sign-data --version 2 --keyfile "${KEYS[0]}" \ + --output "$TMP/1sig.bin" "$UNSIGNED" >/dev/null + $ESPSECURE sign-data --version 2 --keyfile "${KEYS[1]}" --append-signatures \ + --output "$TMP/2sig.bin" "$TMP/1sig.bin" >/dev/null + $ESPSECURE sign-data --version 2 --keyfile "${KEYS[2]}" --append-signatures \ + --output "$TMP/3sig.bin" "$TMP/2sig.bin" >/dev/null + cp "$TMP/3sig.bin" "$OUT" + STATE="signed" + fi + + check_body "$OUT" "$UNSIGNED" "$SHA" + for n in 0 1 2; do + if ! $ESPSECURE verify-signature --version 2 \ + --keyfile "$PUB_DIR/kern-sb-key$n-pub.pem" "$OUT" >/dev/null 2>&1; then + echo "Error: $OUT is not signed by key $n" >&2 + exit 1 + fi + done + echo "── $VARIANT: $STATE, verified against keys 0, 1 and 2 ($(sha256sum "$OUT" | cut -c1-16)) ──" + SIGNED=$((SIGNED + 1)) +done < "$MANIFEST" + +echo +echo "$SIGNED variant(s) signed and verified, $PENDING not signed" +if [ -z "$VERIFY_ONLY" ]; then + echo "Next: take the folder back to the build machine and run" + echo " just bootloader-import " +fi From 0ca5fdac07f30405982d8e7acc87aa4c5c0ea0a9 Mon Sep 17 00:00:00 2001 From: odudex Date: Sun, 15 Nov 2026 19:02:42 -0300 Subject: [PATCH 10/20] feat(build): write and GPG-sign SHA256SUMS in the bootloader freeze --- docs/secure-boot.md | 4 +-- scripts/bootloader_import.sh | 58 ++++++++++++++++++++++++++---------- scripts/freeze_bootloader.sh | 40 +++++++++++++++++++++---- 3 files changed, 80 insertions(+), 22 deletions(-) diff --git a/docs/secure-boot.md b/docs/secure-boot.md index 30937f4c..89777b0d 100644 --- a/docs/secure-boot.md +++ b/docs/secure-boot.md @@ -345,7 +345,7 @@ kern_secure_boot/bootloaders/ **The freeze.** 1. On the build machine, at the commit to freeze: `just bootloader-stage` builds only the bootloader (`sdkconfig.release` + `sdkconfig.secure`) for every board, groups the unsigned images into variants, and stages one per variant in `release/bootloader-/` with the manifest, the public keys and `freeze_bootloader.sh`. It stops if two boards of one variant build different bootloaders. A variant whose frozen image still matches the build is staged with that signature and is not signed again: a signature cannot be reproduced, and devices are locked with those bytes. -2. On the air-gapped signing machine, from that folder, with all three private keys: `bash freeze_bootloader.sh `. It checks each private key against its published digest, so a key in the wrong position stops the run, checks each unsigned image against the manifest, signs it with key 0, appends key 1 and key 2, and verifies the result against the three public keys. By hand that is: +2. On the air-gapped signing machine, from that folder, with all three private keys: `bash freeze_bootloader.sh `. It checks each private key against its published digest, so a key in the wrong position stops the run, checks each unsigned image against the manifest, signs it with key 0, appends key 1 and key 2, and verifies the result against the three public keys. It then writes `SHA256SUMS` for `kern_secure_boot/` and signs it with GPG, so the GPG key can stay on that machine too. By hand the signing is: ```bash espsecure sign-data --version 2 --keyfile kern-sb-key0.pem \ @@ -361,7 +361,7 @@ for n in 0 1 2; do done ``` -3. Back on the build machine: `just bootloader-import release/bootloader-` verifies the folder against the public keys in `kern_secure_boot/` and copies the signed images and their manifest lines into `kern_secure_boot/bootloaders/`. It refuses to replace a frozen image with different bytes under the same freeze number. Then regenerate `SHA256SUMS`, sign it with GPG, commit, and tag the manifest's commit `bootloader-`; the recipe prints those commands. +3. Back on the build machine: `just bootloader-import release/bootloader-` verifies the folder against the public keys in `kern_secure_boot/` and copies the signed images and their manifest lines into `kern_secure_boot/bootloaders/`. It refuses to replace a frozen image with different bytes under the same freeze number. It installs the folder's `SHA256SUMS` and `SHA256SUMS.sig` once every listed hash matches the result and GPG verifies the signature. Then commit, and tag the manifest's commit `bootloader-`; the recipe prints those commands. Fill this in at each freeze and keep it with the key ceremony record (Section 3e): diff --git a/scripts/bootloader_import.sh b/scripts/bootloader_import.sh index 4e842078..acffe101 100755 --- a/scripts/bootloader_import.sh +++ b/scripts/bootloader_import.sh @@ -4,13 +4,15 @@ # Verifies a release/bootloader- folder that came back from the air-gapped # signing PC against the public keys in kern_secure_boot/ (not the copies in # the folder), then copies each signed bootloader and its manifest line into -# kern_secure_boot/bootloaders/. Needs no private key. +# kern_secure_boot/bootloaders/. The folder's SHA256SUMS and GPG signature +# replace the ones in kern_secure_boot/ once they check out against the +# result. Needs no private key. # # Usage: bootloader_import.sh (or: just bootloader-import ) # # A frozen bootloader is never replaced by different bytes under the same -# freeze number. SHA256SUMS, its GPG signature, the commit and the -# bootloader- tag are left to the developer; the commands are printed. +# freeze number. The commit and the bootloader- tag are left to the +# developer; the commands are printed. set -e @@ -29,10 +31,11 @@ command -v espsecure >/dev/null || source "${IDF_PATH:-$HOME/esp/esp-idf}/export bash "$SCRIPT_DIR/freeze_bootloader.sh" --verify "$DIR" "$KERN_SB_DIR" -python3 - "$DIR" "$KERN_SB_DIR/bootloaders" <<'EOF' -import os, shutil, sys +python3 - "$DIR" "$KERN_SB_DIR" <<'EOF' +import glob, hashlib, os, shutil, subprocess, sys -src, dest = sys.argv[1:3] +src, sb_dir = os.path.abspath(sys.argv[1]), os.path.abspath(sys.argv[2]) +dest = os.path.join(sb_dir, "bootloaders") HEADER = ("# Frozen bootloaders, one line per variant (docs/secure-boot.md, section 4a)\n" "# variant freeze tag commit esp-idf unsigned-sha256 boards\n") @@ -73,13 +76,38 @@ if imported: f.write(HEADER + "\n".join(frozen[v] for v in sorted(frozen)) + "\n") if pending: print("\nSign the rest with freeze_bootloader.sh on the air-gapped PC, then import this folder again.") -elif imported: - print(f"\nFrozen bootloaders are in {dest}. Left to do by hand:") - print(" cd kern_secure_boot") - print(" sha256sum kern-sb-key?-pub.pem kern-sb-digest?.bin bootloaders/BOOTLOADERS " - "bootloaders/*/bootloader-signed.bin > SHA256SUMS") - print(" gpg --detach-sign --armor -o SHA256SUMS.sig SHA256SUMS") - print(" git add . && git commit") - for tag, commit in sorted(tags): - print(f" git tag {tag} {commit}") + sys.exit(0) +if not imported: + sys.exit(0) + +# SHA256SUMS must describe kern_secure_boot/ exactly as it is now +sums, sig = os.path.join(src, "SHA256SUMS"), os.path.join(src, "SHA256SUMS.sig") +by_hand = [] +if os.path.exists(sums) and os.path.exists(sig): + listed = dict(reversed(line.split(maxsplit=1)) for line in open(sums).read().splitlines() if line) + os.chdir(sb_dir) + expected = set(glob.glob("kern-sb-key?-pub.pem") + glob.glob("kern-sb-digest?.bin") + + glob.glob("bootloaders/*/bootloader-signed.bin") + ["bootloaders/BOOTLOADERS"]) + if set(listed) != expected: + sys.exit(f"Error: SHA256SUMS lists other files than kern_secure_boot/ holds: " + f"{sorted(set(listed) ^ expected)}. It was not installed.") + for path, want in listed.items(): + if hashlib.sha256(open(path, "rb").read()).hexdigest() != want: + sys.exit(f"Error: {path} does not match SHA256SUMS. It was not installed.") + if subprocess.run(["gpg", "--verify", sig, sums], capture_output=True).returncode != 0: + sys.exit("Error: gpg does not verify SHA256SUMS.sig. It was not installed.") + shutil.copy(sums, "SHA256SUMS") + shutil.copy(sig, "SHA256SUMS.sig") + print(" SHA256SUMS and its GPG signature: verified and installed") +else: + by_hand = ["cd kern_secure_boot", + "sha256sum kern-sb-key?-pub.pem kern-sb-digest?.bin bootloaders/BOOTLOADERS " + "bootloaders/*/bootloader-signed.bin > SHA256SUMS", + "gpg --detach-sign --armor -o SHA256SUMS.sig SHA256SUMS"] + +print(f"\nFrozen bootloaders are in {dest}. Left to do by hand:") +for line in by_hand + ["git add kern_secure_boot && git commit"]: + print(f" {line}") +for tag, commit in sorted(tags): + print(f" git tag {tag} {commit}") EOF diff --git a/scripts/freeze_bootloader.sh b/scripts/freeze_bootloader.sh index 4240f2ca..9f665ac4 100755 --- a/scripts/freeze_bootloader.sh +++ b/scripts/freeze_bootloader.sh @@ -6,6 +6,9 @@ # 2. signs it with the three Secure Boot v2 RSA-3072 keys (key 0, then keys 1 # and 2 appended), unless the variant already carries its frozen signature # 3. verifies the result against the three public keys in the folder +# and finally writes SHA256SUMS for kern_secure_boot/ (public keys, manifest +# and signed bootloaders, under the paths they have there) and signs it with +# GPG. KERN_GPG_KEY picks a key other than the default one. # # Usage (from inside the release/bootloader- folder on the SD card): # @@ -20,11 +23,12 @@ # # bash freeze_bootloader.sh --verify [folder] [public-key-folder] # -# Requirements: bash, python3, sha256sum and the esptool pip package (provides -# espsecure; python3 -m espsecure is used if the CLI is not on PATH). +# Requirements: bash, python3, sha256sum, gpg and the esptool pip package +# (provides espsecure; python3 -m espsecure is used if the CLI is not on PATH). # # Input per variant: /bootloader-unsigned.bin # Output per variant: /bootloader-signed.bin +# Plus: SHA256SUMS, SHA256SUMS.sig # # A signature cannot be reproduced: signing the same image again gives different # bytes. A variant that already has bootloader-signed.bin is never signed again. @@ -165,7 +169,33 @@ done < "$MANIFEST" echo echo "$SIGNED variant(s) signed and verified, $PENDING not signed" -if [ -z "$VERIFY_ONLY" ]; then - echo "Next: take the folder back to the build machine and run" - echo " just bootloader-import " +[ -z "$VERIFY_ONLY" ] || exit 0 + +sum_line() { + printf '%s %s\n' "$(sha256sum "$1" | cut -d' ' -f1)" "$2" +} +{ + for n in 0 1 2; do sum_line "$DIR/kern-sb-key$n-pub.pem" "kern-sb-key$n-pub.pem"; done + for n in 0 1 2; do sum_line "$DIR/kern-sb-digest$n.bin" "kern-sb-digest$n.bin"; done + sum_line "$MANIFEST" "bootloaders/BOOTLOADERS" + while read -r VARIANT REST; do + case "$VARIANT" in '' | '#'*) continue ;; esac + sum_line "$DIR/$VARIANT/bootloader-signed.bin" "bootloaders/$VARIANT/bootloader-signed.bin" + done < "$MANIFEST" +} > "$TMP/SHA256SUMS" + +# An unchanged, already signed SHA256SUMS is left alone +if ! cmp -s "$TMP/SHA256SUMS" "$DIR/SHA256SUMS" || [ ! -f "$DIR/SHA256SUMS.sig" ]; then + cp "$TMP/SHA256SUMS" "$DIR/SHA256SUMS" + rm -f "$DIR/SHA256SUMS.sig" + echo "── SHA256SUMS written, signing it with GPG ──" + if ! command -v gpg >/dev/null 2>&1 || + ! gpg ${KERN_GPG_KEY:+--local-user "$KERN_GPG_KEY"} --detach-sign --armor \ + --output "$DIR/SHA256SUMS.sig" "$DIR/SHA256SUMS"; then + echo "SHA256SUMS is NOT signed. The bootloaders are; sign it by hand with:" >&2 + echo " gpg --detach-sign --armor -o SHA256SUMS.sig SHA256SUMS" >&2 + fi fi + +echo "Next: take the folder back to the build machine and run" +echo " just bootloader-import " From 65eff9371f665c7447d3cff21092e29035d59e8a Mon Sep 17 00:00:00 2001 From: odudex Date: Sun, 15 Nov 2026 19:18:53 -0300 Subject: [PATCH 11/20] docs(secure-boot): describe frozen bootloader 1 in the key README --- kern_secure_boot/README.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/kern_secure_boot/README.md b/kern_secure_boot/README.md index 094c911c..5d034022 100644 --- a/kern_secure_boot/README.md +++ b/kern_secure_boot/README.md @@ -18,7 +18,16 @@ A device with secure boot enabled keeps its second-stage bootloader: SD updates The bootloader does not depend on the display or camera, so boards share it. There is one per chip revision range and flash mode, listed in `bootloaders/BOOTLOADERS` with the git tag and ESP-IDF version it was built from and the SHA-256 of its unsigned image. Building that tag reproduces the image byte for byte up to the signature sector. -> **Not published yet.** No bootloader has been frozen, so current releases cannot enable secure boot. `bootloaders/` arrives with the first release that can. Procedure: [docs/secure-boot.md §4a](../docs/secure-boot.md#4a-the-frozen-bootloader). +**Freeze 1** is published here, built from the tag `bootloader-1` with ESP-IDF v6.1.1: + +| Variant | Chip revision | Flash mode | Boards | +|---------|---------------|------------|--------| +| `v1-qio` | v0.x / v1.x | QIO | wave_4b, wave_5, wave_43, wave_7b, crowpanel, p4_pico | +| `v1-dio` | v0.x / v1.x | DIO | wave_35 | +| `v3-qio` | v3.x | QIO | the `_v3` builds of the `v1-qio` boards | +| `v3-dio` | v3.x | DIO | wave_35_v3 | + +A release can enable secure boot when its zip carries one of these as `bootloader.bin`. Releases up to v0.0.21 ship a plain bootloader and cannot. Procedure: [docs/secure-boot.md §4a](../docs/secure-boot.md#4a-the-frozen-bootloader). ## Contents @@ -30,8 +39,8 @@ The bootloader does not depend on the display or camera, so boards share it. The | `kern-sb-digest0.bin` | SHA-256 digest of public key 0 (32 bytes, burned into eFuse KEY0) | | `kern-sb-digest1.bin` | SHA-256 digest of public key 1 (32 bytes, burned into eFuse KEY1) | | `kern-sb-digest2.bin` | SHA-256 digest of public key 2 (32 bytes, burned into eFuse KEY2) | -| `bootloaders/BOOTLOADERS` | Manifest of the frozen bootloaders (not published yet) | -| `bootloaders//bootloader-signed.bin` | Frozen bootloader, signed by all three keys (not published yet) | +| `bootloaders/BOOTLOADERS` | Manifest of the frozen bootloaders | +| `bootloaders//bootloader-signed.bin` | Frozen bootloader, signed by all three keys | | `SHA256SUMS` | SHA-256 checksums of all files above | | `SHA256SUMS.sig` | GPG detached signature of `SHA256SUMS` | @@ -65,7 +74,7 @@ You can also compute the hex representation of the `.bin` digest files to compar for n in 0 1 2; do xxd -p kern-sb-digest${n}.bin | tr -d '\n' && echo; done ``` -Once the frozen bootloaders are published, each can be checked against the three public keys (`espsecure` comes with `esptool`): +Each frozen bootloader can be checked against the three public keys (`espsecure` comes with `esptool`): ```bash for n in 0 1 2; do @@ -74,6 +83,12 @@ for n in 0 1 2; do done ``` +From the repository root, one command checks every variant against the three keys and against the unsigned hash in the manifest: + +```bash +bash scripts/freeze_bootloader.sh --verify kern_secure_boot/bootloaders kern_secure_boot +``` + ## On-Device Secure Boot Activation The device must have been installed **over USB** from a release that ships the frozen bootloader. A device installed from an older release and updated over SD since then still has its old bootloader; one USB install of a current release zip replaces it and keeps the device's data. From 8525243bb778c535ca7f32f724e7bbe71a3ed2a2 Mon Sep 17 00:00:00 2001 From: odudex Date: Sun, 15 Nov 2026 19:18:53 -0300 Subject: [PATCH 12/20] feat(build): ship the frozen bootloaders in releases --- .justfile | 3 ++- README.md | 2 +- docs/secure-boot.md | 6 ++--- docs/security-plan.md | 2 +- scripts/bootloader_stage.sh | 12 ++------- scripts/bootloader_variant.sh | 25 ++++++++++++++++++ scripts/release.sh | 49 ++++++++++++++++++++++++++++++++--- scripts/sign_release.sh | 18 +++++++++++++ 8 files changed, 97 insertions(+), 20 deletions(-) create mode 100755 scripts/bootloader_variant.sh diff --git a/.justfile b/.justfile index 4ce670a4..84760de5 100644 --- a/.justfile +++ b/.justfile @@ -33,7 +33,8 @@ flash board="wave_4b": (_check_board board) idf.py -B build_{{board}} -D SDKCONFIG=build_{{board}}/sdkconfig -D "SDKCONFIG_DEFAULTS=$(just _defaults {{board}})" flash # The sdkconfig is regenerated every time so overlay edits always land. -# Release image (sdkconfig.release overlay) in build_release_/, as scripts/release.sh builds it +# Release log and panic settings (sdkconfig.release overlay) with a plain bootloader, in build_release_/. +# scripts/release.sh builds with build-secure. build-release board="wave_4b": (_check_board board) #!/usr/bin/env sh set -e diff --git a/README.md b/README.md index 09f70ac9..bda828bc 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ just clean # Wipe all build_ dirs + sdkconfig ESP32-P4 chip revision v3.x needs its own image: ESP-IDF builds for either v0.x/v1.x or v3.x silicon, never both. Append `_v3` to any board (`just build wave_43_v3`, `just flash wave_43_v3`) to build with the `sdkconfig.rev3` overlay into `build__v3/`. The web flasher reads the chip revision on connect and picks the matching build. -Published releases are built with `just build-release ` (what `scripts/release.sh` runs for every board), which adds the `sdkconfig.release` overlay into `build_release_/`: WARN-level logs, a silent reboot on panic instead of a register and stack dump, and silent assertions. Use it to reproduce a release image; `just build` is the development configuration. +Published releases are built by `scripts/release.sh`, which runs `just build-secure ` for every board, into `build_secure_/`. That adds two overlays: `sdkconfig.release` (WARN-level logs, a silent reboot on panic instead of a register and stack dump, silent assertions) and `sdkconfig.secure` (a bootloader that verifies the app, the Secure Boot menu, anti-rollback). The release zip carries the frozen bootloader from `kern_secure_boot/bootloaders/`, not the one that build produces. `just build-release ` applies only the release overlay and keeps a plain bootloader, to reproduce release logging and panic behaviour on a development board; `just build` is the development configuration. Or using `idf.py` directly: diff --git a/docs/secure-boot.md b/docs/secure-boot.md index 89777b0d..207efc5a 100644 --- a/docs/secure-boot.md +++ b/docs/secure-boot.md @@ -302,7 +302,7 @@ A locked device keeps the bootloader it was locked with. SD updates only write t Signing a bootloader with all three keys means taking keys 1 and 2 out of cold storage. Doing that for every release would defeat the reason they are cold. So the bootloader is built, signed once in a key ceremony, and committed; every release after that ships those same bytes. Only the app is built and signed per release, with key 0. -> **Status:** the bootloader component (`bootloader_components/secure_boot_opt_in`), the `sdkconfig.secure` overlay, the dry run and the freeze tooling (`just bootloader-stage`, `scripts/freeze_bootloader.sh`, `just bootloader-import`) exist. The release-script changes, the CI checks and the web flasher changes described below are planned and not implemented yet. No frozen bootloader is published yet. +> **Status:** the bootloader component (`bootloader_components/secure_boot_opt_in`), the `sdkconfig.secure` overlay, the dry run, the freeze tooling (`just bootloader-stage`, `scripts/freeze_bootloader.sh`, `just bootloader-import`) and the release-script changes exist, and freeze 1 is published for all four variants (tag `bootloader-1`). The CI checks and the web flasher changes described below are planned and not implemented yet. **Variants.** The bootloader does not depend on the display, touch or camera, so most boards share one. Two settings split it: the chip revision range (v1.x and v3.x need different builds, and the v3 bootloader runs a different CPU clock) and the flash mode (wave_35 uses DIO, the rest QIO). That gives four: @@ -414,9 +414,9 @@ espsecure verify-signature \ The bootloader in each release zip is the frozen one for that board's variant, not the one the release build produced: -- `release.sh` picks the variant from the generated sdkconfig (chip revision range and flash mode) and packages `kern_secure_boot/bootloaders//bootloader-signed.bin`. +- `release.sh` first verifies every frozen bootloader against the three public keys. It then picks each board's variant from the generated sdkconfig (chip revision range and flash mode) and packages `kern_secure_boot/bootloaders//bootloader-signed.bin`, and stops if a board has no frozen bootloader. - It compares the freshly built `bootloader-unsigned.bin` with the frozen image and warns when they differ. A difference means the bootloader sources, their config or ESP-IDF moved since the freeze. The release still ships the frozen one; the warning is the prompt to ask whether a re-freeze is due. -- `sign_release.sh` refuses to package a bootloader that does not verify against all three public keys. It needs no private key for that. +- `sign_release.sh` refuses to package a bootloader that does not verify against all three public keys, which travel in the release folder, and checks every device before it signs anything. It needs no private key for that. Before publishing, boot the new app on each frozen variant, and install it over SD on the locked reference board. diff --git a/docs/security-plan.md b/docs/security-plan.md index 0cce9b00..76022cf1 100644 --- a/docs/security-plan.md +++ b/docs/security-plan.md @@ -469,7 +469,7 @@ Re-run this matrix as part of the Phase 4d suite on a locked device. Order of work: -1. Tooling that needs no private key: `just bootloader-stage`, the manifest, `scripts/freeze_bootloader.sh` and `just bootloader-import` (done), then the `release.sh` / `sign_release.sh` changes, the CI checks, the web flasher changes. +1. Tooling that needs no private key: `just bootloader-stage`, the manifest, `scripts/freeze_bootloader.sh`, `just bootloader-import` and the `release.sh` / `sign_release.sh` changes (done), then the CI checks and the web flasher changes. 2. Hardware: the virtual-eFuse dry run, then a real lockdown on a sacrificial board, followed by an SD update and a USB reflash on it. 3. The anti-rollback decision (6c). Taken: on. 4. The freeze ceremony. diff --git a/scripts/bootloader_stage.sh b/scripts/bootloader_stage.sh index 4a8d90e5..0646e96d 100755 --- a/scripts/bootloader_stage.sh +++ b/scripts/bootloader_stage.sh @@ -46,19 +46,11 @@ for DEVICE in $DEVICES; do BUILD_DIR="build_secure_${DEVICE}" CONFIG="$BUILD_DIR/sdkconfig" - if grep -q '^CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y' "$CONFIG"; then REV=v1; else REV=v3; fi - if grep -q '^CONFIG_ESPTOOLPY_FLASHMODE_QIO=y' "$CONFIG"; then - MODE=qio - elif grep -q '^CONFIG_ESPTOOLPY_FLASHMODE_DIO=y' "$CONFIG"; then - MODE=dio - else - echo "Error: ${DEVICE} uses a flash mode with no bootloader variant" >&2 - exit 1 - fi + VARIANT="$("$SCRIPT_DIR/bootloader_variant.sh" "$CONFIG")" FREEZE="$(sed -n 's/^CONFIG_BOOTLOADER_PROJECT_VER=//p' "$CONFIG")" IDF_VER="$(python3 -c 'import json, sys; print(json.load(open(sys.argv[1]))["git_revision"])' "$BUILD_DIR/project_description.json")" SHA="$(sha256sum "$BUILD_DIR/bootloader/bootloader-unsigned.bin" | cut -d' ' -f1)" - echo "$REV-$MODE $DEVICE $FREEZE $IDF_VER $SHA" >> "$BUILT" + echo "$VARIANT $DEVICE $FREEZE $IDF_VER $SHA" >> "$BUILT" done python3 - "$BUILT" "$REPO_ROOT" "$KERN_SB_DIR" "$COMMIT" "$SCRIPT_DIR/freeze_bootloader.sh" <<'EOF' diff --git a/scripts/bootloader_variant.sh b/scripts/bootloader_variant.sh new file mode 100755 index 00000000..570075aa --- /dev/null +++ b/scripts/bootloader_variant.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Prints the bootloader variant a build belongs to, from its generated +# sdkconfig: chip revision range (v1 / v3) and flash mode (qio / dio). Boards +# of one variant share one frozen bootloader (docs/secure-boot.md, section 4a). +# +# Usage: bootloader_variant.sh /sdkconfig + +set -e + +CONFIG="$1" +if [ ! -f "$CONFIG" ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +if grep -q '^CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y' "$CONFIG"; then REV=v1; else REV=v3; fi +if grep -q '^CONFIG_ESPTOOLPY_FLASHMODE_QIO=y' "$CONFIG"; then + MODE=qio +elif grep -q '^CONFIG_ESPTOOLPY_FLASHMODE_DIO=y' "$CONFIG"; then + MODE=dio +else + echo "Error: $CONFIG uses a flash mode with no bootloader variant" >&2 + exit 1 +fi +echo "$REV-$MODE" diff --git a/scripts/release.sh b/scripts/release.sh index 0e84ae7a..d07dcd7b 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,8 +1,20 @@ #!/bin/bash set -e +# Kern release build — runs on the build machine. +# +# Builds every device with sdkconfig.release + sdkconfig.secure and stages, per +# device, the unsigned app and the FROZEN bootloader of its variant from +# kern_secure_boot/bootloaders/, not the bootloader this build produced: a +# device with secure boot enabled only accepts those bytes, and they carry +# signatures that are made once per freeze (docs/secure-boot.md, section 4a). +# +# Move release/v/ to the air-gapped signing PC and run sign_release.sh +# there: it signs each app with key 0 and packs the zips. + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +KERN_SB_DIR="${KERN_SB_DIR:-$REPO_ROOT/kern_secure_boot}" BOARDS="wave_4b wave_35 wave_5 wave_43 crowpanel wave_7b p4_pico" # Each board twice: ESP32-P4 chip revision v1.x, then v3.x (_v3) DEVICES="$BOARDS $(printf '%s_v3 ' $BOARDS)" @@ -29,22 +41,42 @@ mkdir -p "$RELEASE_DIR" cd "$REPO_ROOT" +# Every frozen bootloader must still verify against the three public keys +MANIFEST="$KERN_SB_DIR/bootloaders/BOOTLOADERS" +bash "$SCRIPT_DIR/freeze_bootloader.sh" --verify "$KERN_SB_DIR/bootloaders" "$KERN_SB_DIR" +echo + +DRIFTED="" + for DEVICE in $DEVICES; do echo "========================================" echo "Building for ${DEVICE}..." echo "========================================" # Delegate to justfile so the SDKCONFIG/build-dir layout stays in one place - just build-release "$DEVICE" + just build-secure "$DEVICE" - BUILD_DIR="$REPO_ROOT/build_release_${DEVICE}" + BUILD_DIR="$REPO_ROOT/build_secure_${DEVICE}" DEVICE_DIR="$RELEASE_DIR/${DEVICE}" mkdir -p "$DEVICE_DIR" + VARIANT="$("$SCRIPT_DIR/bootloader_variant.sh" "$BUILD_DIR/sdkconfig")" + FROZEN="$KERN_SB_DIR/bootloaders/$VARIANT/bootloader-signed.bin" + FROZEN_SHA="$(awk -v v="$VARIANT" '$1 == v { print $6 }' "$MANIFEST")" + if [ ! -f "$FROZEN" ] || [ -z "$FROZEN_SHA" ]; then + echo "Error: no frozen bootloader for ${DEVICE} (variant ${VARIANT}). Freeze one first: just bootloader-stage" >&2 + exit 1 + fi + # The release ships the frozen bootloader either way. A different build + # output means its sources, config or ESP-IDF moved since the freeze. + if [ "$(sha256sum "$BUILD_DIR/bootloader/bootloader-unsigned.bin" | cut -d' ' -f1)" != "$FROZEN_SHA" ]; then + DRIFTED="$DRIFTED $DEVICE($VARIANT)" + fi + # Stage the raw parts per device. The final artifacts (signed app, # NVS-preserving Intel HEX, zip) are produced by sign_release.sh on the # air-gapped signing PC — nothing packaged here would survive signing. - cp "$BUILD_DIR/bootloader/bootloader.bin" "$DEVICE_DIR/" + cp "$FROZEN" "$DEVICE_DIR/bootloader.bin" cp "$BUILD_DIR/partition_table/partition-table.bin" "$DEVICE_DIR/" cp "$BUILD_DIR/ota_data_initial.bin" "$DEVICE_DIR/" cp "$BUILD_DIR/kern-unsigned.bin" "$DEVICE_DIR/firmware.bin" @@ -54,11 +86,20 @@ for DEVICE in $DEVICES; do done # Ship version + signing script with the release folder so the whole folder -# can be moved to the air-gapped signing PC via SD card +# can be moved to the air-gapped signing PC via SD card. The public keys let +# sign_release.sh check the bootloaders it packs. echo "$VERSION" > "$RELEASE_DIR/VERSION" cp "$SCRIPT_DIR/sign_release.sh" "$RELEASE_DIR/" +cp "$KERN_SB_DIR"/kern-sb-key?-pub.pem "$RELEASE_DIR/" echo "========================================" echo "Release v${VERSION} complete!" echo "Files in ${RELEASE_DIR}:" ls -lh "$RELEASE_DIR" + +if [ -n "$DRIFTED" ]; then + echo + echo "WARNING: the bootloader built here differs from the frozen one for:$DRIFTED" + echo "The release ships the frozen bootloader. Check that this app still boots on it," + echo "and whether the change calls for a re-freeze (docs/secure-boot.md, section 4a)." +fi diff --git a/scripts/sign_release.sh b/scripts/sign_release.sh index a268c172..3f5a0139 100755 --- a/scripts/sign_release.sh +++ b/scripts/sign_release.sh @@ -2,6 +2,8 @@ # Kern release signing + packaging — runs on the AIR-GAPPED signing PC. # # For each device staged by release.sh, this script: +# 0. checks that the staged bootloader is a frozen one, signed by all three +# Secure Boot keys (public keys only), before anything is signed # 1. signs the app image with the Secure Boot v2 RSA-3072 primary key (key0) # and verifies the signature # 2. regenerates the single-file Intel HEX embedding the SIGNED app (sparse: @@ -23,6 +25,7 @@ # # Input per device: /{bootloader,partition-table,ota_data_initial, # firmware}.bin +# Plus: kern-sb-key{0,1,2}-pub.pem # Output per device: /firmware-signed.bin (also the SD-update file) # /kern-v.hex (serial install, signed app) # kern--v.zip (publishable bundle) @@ -74,6 +77,21 @@ OFF_PARTITION_TABLE=0x10000 OFF_OTADATA=0x1e000 OFF_APP=0x20000 +# A device with secure boot enabled only accepts a bootloader its keys signed, +# and all three so a key rotation cannot strand it. A zip with any other +# bootloader could not be locked, or would stop a locked device from booting. +for UNSIGNED in "$RELEASE_DIR"/*/firmware.bin; do + [ -f "$UNSIGNED" ] || continue + BOOTLOADER="$(dirname "$UNSIGNED")/bootloader.bin" + for n in 0 1 2; do + if ! $ESPSECURE verify-signature --version 2 \ + --keyfile "$RELEASE_DIR/kern-sb-key$n-pub.pem" "$BOOTLOADER" >/dev/null 2>&1; then + echo "Error: $BOOTLOADER is not signed by key $n. Nothing was signed." >&2 + exit 1 + fi + done +done + FOUND=0 ZIPS=() From 8f28dbe31e0ca18c1e2ec270826ed7af570be505 Mon Sep 17 00:00:00 2001 From: odudex Date: Mon, 16 Nov 2026 15:30:24 -0300 Subject: [PATCH 13/20] chore: bump version to 0.0.22 --- CHANGELOG.md | 16 ++++++++++++++++ version.txt | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68564951..6497b347 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [0.0.22] - 2026-11-16 + +### Added +- Secure Boot can be enabled from Settings > Security > Secure Boot. It locks the device to firmware signed by the three release keys: unsigned firmware no longer starts from SD card or USB, JTAG is turned off and the ROM goes to secure download mode. The page shows the three key digests to compare with the published ones and offers the step only when a PIN is set, the running firmware is signed by a release key and the bootloader by all three. It is permanent +- Releases ship a frozen bootloader, signed once by all three keys and published in `kern_secure_boot/bootloaders/` (freeze 1, tag `bootloader-1`). A device needs one USB install of this release to get it; devices updated over SD keep their old bootloader and the Secure Boot page says so +- Anti-rollback: the bootloader refuses firmware whose security version is below the device's eFuse counter. This release is security version 0, which burns nothing; the Secure Boot page shows the counter once secure boot is on + +### Changed +- Release images log at WARN level and reboot silently on a panic instead of printing registers and stack memory +- The dialog after a firmware update has a Restart button instead of announcing the restart above an OK button +- Built on ESP-IDF 6.1.1 +- Updated libwally (1.6.1), cUR, k_quirc and bip138 + +### Fixed +- Simulator builds on macOS: SDL2 is found through its CMake package and libwally's secret wipe uses memset_s + ## [0.0.21] - 2026-11-05 ### Added diff --git a/version.txt b/version.txt index 236c7ad0..818944f5 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.21 +0.0.22 From b940f9f03d2157215ab77db0ac133aa7689c253d Mon Sep 17 00:00:00 2001 From: odudex Date: Mon, 16 Nov 2026 17:44:45 -0300 Subject: [PATCH 14/20] chore(secure-boot): publish frozen bootloader 1 --- kern_secure_boot/SHA256SUMS | 11 ++++++++--- kern_secure_boot/SHA256SUMS.sig | Bin 119 -> 228 bytes kern_secure_boot/bootloaders/BOOTLOADERS | 6 ++++++ .../bootloaders/v1-dio/bootloader-signed.bin | Bin 0 -> 40960 bytes .../bootloaders/v1-qio/bootloader-signed.bin | Bin 0 -> 40960 bytes .../bootloaders/v3-dio/bootloader-signed.bin | Bin 0 -> 40960 bytes .../bootloaders/v3-qio/bootloader-signed.bin | Bin 0 -> 40960 bytes 7 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 kern_secure_boot/bootloaders/BOOTLOADERS create mode 100644 kern_secure_boot/bootloaders/v1-dio/bootloader-signed.bin create mode 100644 kern_secure_boot/bootloaders/v1-qio/bootloader-signed.bin create mode 100644 kern_secure_boot/bootloaders/v3-dio/bootloader-signed.bin create mode 100644 kern_secure_boot/bootloaders/v3-qio/bootloader-signed.bin diff --git a/kern_secure_boot/SHA256SUMS b/kern_secure_boot/SHA256SUMS index 98552d04..bf4ca58e 100644 --- a/kern_secure_boot/SHA256SUMS +++ b/kern_secure_boot/SHA256SUMS @@ -1,6 +1,11 @@ -f926b4e8f435f622e069fb0efb0ad29c661ba77a2cfc0aaf320733cad4888424 kern-sb-digest0.bin -4c816a397a53adf76bc16c32663ade38d54f9d53abadd8e409aa5a4e84bd5ade kern-sb-digest1.bin -d342b752ee09b82e46da4bfcadbe02cef7533ed59a4f466167ab94418c914ef0 kern-sb-digest2.bin 71227f3237be0dc58595403bb3bb613916bff84e44428288b9f2f661040923ee kern-sb-key0-pub.pem 26b4fc304062a3985f4d3249a621e217cd705fef57d907a874b2ce0b2c6936f9 kern-sb-key1-pub.pem 80845220e653ac21961bee663220bf0cab9202a1dd1b1daf52dda463a0ce4ac6 kern-sb-key2-pub.pem +f926b4e8f435f622e069fb0efb0ad29c661ba77a2cfc0aaf320733cad4888424 kern-sb-digest0.bin +4c816a397a53adf76bc16c32663ade38d54f9d53abadd8e409aa5a4e84bd5ade kern-sb-digest1.bin +d342b752ee09b82e46da4bfcadbe02cef7533ed59a4f466167ab94418c914ef0 kern-sb-digest2.bin +922fc0365695a44f71c7ef7f27cd1ec5b1e80c1d53bb5438a8a83d80d55bb8a7 bootloaders/BOOTLOADERS +63314bf20615f26e24705d86504d8dbb50348f509e82ecc9223259b915baab92 bootloaders/v1-dio/bootloader-signed.bin +31caa68d156fa9607c57f5224eddcea5a260682aac4954040b6d79ecde7d26cb bootloaders/v1-qio/bootloader-signed.bin +b6711bf0017a4cfd6d233e985eeee67129052d1b46a8ff6c4e2bbcf755344aeb bootloaders/v3-dio/bootloader-signed.bin +641cb7b13ce636207c913e45b189fcd687a4edd7844a940d6c498dfa8e61affb bootloaders/v3-qio/bootloader-signed.bin diff --git a/kern_secure_boot/SHA256SUMS.sig b/kern_secure_boot/SHA256SUMS.sig index a581bd02027c65c497beb5e829ca542a131851ed..f312241f003e769d396a5e518d7f842b939198ac 100644 GIT binary patch literal 228 zcmZvXIdg(Q7(n~|74{AzDpv}NZx0v5*{rw=nhrT8BIqC)nDFa8id1>!tKKt=Cz$a- zOeB|+eZU1M9kG`-5IXys0X~L+%_P_n(WtB&He@fBW=WCwZa$dc!!SFx6VWLU3+rygv3jyCZHwbZ)5MLDHt3rH3h?|A@mJt6_ zi2qlJ+l9D8h<_I12SQAi@$^cC*h7fDgjgxW!-RN*5RVdKl@N~=;_*T}QHUoC@l!(l z2O)l1h&4hSDa5mdc&-q~2yv_sCuXi)k+LQsIT3iQQ;iQ?ojpMnm^nigg=wnQiK)q1 zFR36^wJI$!Gj&{+Dk&vPm6EDjn~;%}l9iH{>IUNpIMUW7W~@$Fo2govmX@_TEn!t+ zhAJ~FfqCWMVD~!Q=<3%5j=I&aPJGC_H3?bFODb&gzpZzEnkp$HF;O*d-Xh>}a$=?` zAtOe7+FF(Q}j%oNNW@N?}whH)JKM#;2xby_Axgtm66ydg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SvToN=5H=*oR0OuDnv!6_3y#_` n@`mqOLIw+P7ys9aMO62^cmq6tyU+PRll>R2=bxtk4=C_I_j^>z literal 0 HcmV?d00001 diff --git a/kern_secure_boot/bootloaders/v1-qio/bootloader-signed.bin b/kern_secure_boot/bootloaders/v1-qio/bootloader-signed.bin new file mode 100644 index 0000000000000000000000000000000000000000..b8cf4b92fa865e4cdcc641ee5c6ce5a743e599ac GIT binary patch literal 40960 zcmbq+3s@9K5^(Qhc3A`gM?~-RGJ>FTN))1ddI>JV?g~C21|_~CI07M2-uSo+Ulx}E zK@rWWV4@c^iAL^{7>I7-MOl!Cq9PjKXAFu+OfI*mD8Uo?t7c~11#@@#|9`))>6z~8 z>gww1>gww5;f_oi*}UmqC{ ze+;;zqVGr65Qg*)uf7+#7=q$eNZCa+APynM^`bCXcrKCu3>Cinxr|m!`)< zB?)m!E8?N9Oaak~HCU`qIT0n3A=W8!0xA@M9qVwQt4|Yn>Q<~7_mp=l<1*RT8Eo=@ ztanZdlaL-C&&-}Z4|tpypTWeX$1`!OfZ(`gE8?G_)1iGUSH`7|;Rzgv=vS;6E4H&g zPx$_3QW6p};xn1o<1(1l>2ay4@yikJU;pDL`5!+=z6kXQOkS~uugS(%kgg<_S++Ja zo*9#zlKFa4aw5a`5A@3G@#*o?#sV?_1(&T`*pw_mAmZ1s@$t(un3ZvBKt7!Nlns47 zo_#YTYo*AJ046kU1)H@ZE)yyPMy+9ZnZPG!;*gaQ&t?Jdk;6#)>wR#(;*gnXQdNQBPg zIfQxr%j@FU%#`%C3<#H9UkF3A4=-(SneiE!zXa?k2a(YseL;}M zKAnyozADhxA7gx%gD^VMphXs-5?r00lo`J?B{Pm6(kZF&>3q)zAd{Gvc-i9n&Y`aW zcxh5{LW-Rs&=Y@(=T$7QGczTH$ygb;Vg)m1Wm0m|N)TG#<@`9wz!A}RO#Hu$eVw5B zGE~-+tVXZ?oybS#UPXwiCCr8v1 zu@ zX7p*#(^^oTY+87{Z4%(83qcTtN1Hn3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l<*O?FEmEqX zw}|quoaB5O-t4zD8R`hx*^+HA4tv0I*v%rpAz4NR?SG?#^x`gj|7AzYfgn-mNdG0) z!55d@#OB1mr)b{VD*2@$2y=%krx3rJt?^8zbbVqN@lH#{K~pvxkvnD>mX{A&I~HzJ zt{*+^{bY|qReP*_i>U_X%$|5V^>XKHrX!&l(u@0WXP3{%s zjPEhNRdX*m)vhk-k4K0mfABGJY0`^5?^f$nyXUpF#&h?5{Hwp5Zl)vIf9-(&so?)r G0{;WS_`XK~ literal 0 HcmV?d00001 diff --git a/kern_secure_boot/bootloaders/v3-dio/bootloader-signed.bin b/kern_secure_boot/bootloaders/v3-dio/bootloader-signed.bin new file mode 100644 index 0000000000000000000000000000000000000000..30f2e6b6d83d433c2203c78c5b23b1b7cb3b3936 GIT binary patch literal 40960 zcmbq+3tUr2_VDC!6M|5JS44Mldj&yZl`5&GV#OdNSMUL)DD}01S3p{ow~zfV+hDk0 zP>LEAY;}vaYURIeEvcs4T}wb7N)@TAg05|`lv20b4Jt^nAm5pLZ%n{;x8L{0-!S*i zoH=vm%$YN1&dglzNW?MLs)sTEMhJ~YXsW1G1W!n$S^Hzm^Aiw?#V-&x&kCLqJOgL_ z|NYwj_+!j12pCH{#9s@~-$MK^;kg^)9^v^1hzEpc^y-f>QV1Lc6hcGr`%uXHNQnO? z#8x4$6XNqid{Ky7g!rluy9jvQgjgxWV}y8|5c>!*CB&12c#05D72@ea{Hzc^C&bSS zu||j^g?NDwFB0NdA&wW~mxOqg5GM-pIw4*!#2bV-Lx^*Pc&iX&o+W2ztV!FLl$s2T z)KXLYH{=FV{@I~a6i%ZyByUR1Sx-SKwJtq5d(-3`DkUw4O4~$bBxU8K<)o!=a)NOM z9O;{rvo<7UWK(O?({nbYC#_4)qOx<6m{)!#Z(UMO5@eyZN$V&KP9?2dmzA8IO=Tr* z!bCaK^kQ=A#^g;ol>a(v`d0tx&uyK?M?lZ!qz!57LV*|*wRrJT;BjhlHkFi>OeJjwf|J&6NPdD&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4r`RaZpnsdTj=QB|aG)yAKe(0IpT*;H z=DR38g~ePN~-lTVbgWm;%8qJ9`G;UEL20pt_u8r@GFA@?rL~y%XznyiFqZKTen4~ z%ho6@QX_-O%tAY$*g_^eAkS2@?G?NVN+Cx7}#xO)JHC~Il2 zg6S!(K~(KfvtpM}(|A-==&M}S2K&RhjrK&Td^Ig z6qhsGxc_AA7Uh+NDT3RzR8wMrLRr@(9|OZk3sIkUmVJ}nwnV`!wo*N+rlqCNZwle> zRLrMNTKY(OopvQe()yb;V5vA}6%0+Aw9So=R#~{bppzCJ_br}#myX=8e|@G_jlH!j zeJJnA-be_)qHc}xIrDJZ+i7Zk&Zex`JKK`YdcwiOc?DaG`>DY5a{+Q8zTTq_7WMx)MrJ)VqY1sUPVTVJ*+`vd?Lz zDzw=$ayX5iL($DXKva)BG<95b!>4Dt(!@11b?qVOJ=Vrl#9*VdM8z&vHM$|Q9WEn` zUGKOL4pEf&t*c_M86{%4=>(tlNT1@=i|f%ib>w91;AsyGYK(TjyWMr7tEi`f)pB5u z;`hg=jdxRs-k6CcZjqz1=JL?2fKT}r`UTX{L%H8f3Dc3alC5g^* zAMYGoJXL@2;wNmo@U-bzu}#)M+4w%@$rvF4cXLrIj9B=&yDE|g7+%yRdvZC$`?Z=% zh6=1?E9TQ5DN+gUtoSiTjNUS9V*% zT~^)XR=nj?*lmEdH%uX!?OgCr|o|MXCfxlQ5(gCxqG zVMr^P|C?Z-xz6{Bj;bURm;DPL%$K80Eiv{h*5<`?qdjd+?an!>2WLmUNLFQv7xRRv z3=a^VX{F_%4Yv+_ fZBNko>`p*S&CRs2O!-gz`mc9z|1|J_9fAJ=BfK~Y literal 0 HcmV?d00001 diff --git a/kern_secure_boot/bootloaders/v3-qio/bootloader-signed.bin b/kern_secure_boot/bootloaders/v3-qio/bootloader-signed.bin new file mode 100644 index 0000000000000000000000000000000000000000..0bcfc9a629d689bfdb1af3fbd6f3248179d597b3 GIT binary patch literal 40960 zcmbq*3tUr2_VDC!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jf7ix~y2z=Iv`_9CcjWciO6J+{d1@JDa1}fTm%2`Qw`c__V6!gqoEv z*2~U~7)5`{tS*vMN5$R{c#cUYgbG{76yis8(!R86g?qp@3QNOaSE>iIR!1sgSR&52VO|Q8U$2WY-c-g1& z&)7s8IDBo8A)l0XH5?iFjUy-OoCtk8vAZ>(DxONG-nK&J&M*OTWj%;R?x3{EVXYN??c5*T3vc zcTkDno9tY-8EoXP|5hMXRXt4d!AKO-vhpTXE$tXi>nm!lv2RA%9h_@#+2tFqG|qBJ z{6V%At#ry#{7t*@r{_t6#;?D&oyZ%S#1jby`oof$U%GG>^ErY{#Z=e6b>1{+Thxii zK9Y0iwvN(z_R;Sft-glgQ2ouAdmOhTdu2w5$hp;Xrl&3`1(YV4T+q0`gWxl9_$soM zS#-s!?4y3_mrk0BHlD*OUsoCj`k$~0nbwD@6n_x|!)kj@|hkRQ=~v z_)}vE@5iIUc<_fi9_$`gY|t~=p%-1c-{?xxbQ|A?qj3ryJn~{{UZHw6Cf&dZe9x&Q zn#Toq3o}sySR)R@bA-9oGa6LBtJSk&aObr}wIZ!NK2mKL_wrq@y>I;$wqDrkv&8Fm zceMpI3Y9%93Q+5pUt--Iul7!KVpvkR)o0H5)cjQt;ia7y!?=iLx?Pq&EX>C0q8=8Q z@@+UX^~?d@2-^M5dF1SC62cj?)I8Xuh($K$M!7&=Q5QMhX`~{9rRQMhIX}&3GbH~* a{G>zs<{hyk>|1|r@2>c6Fka1@K literal 0 HcmV?d00001 From 5f4a8e51ab65218ac5c0b6b9790e6900564cf64a Mon Sep 17 00:00:00 2001 From: odudex Date: Mon, 16 Nov 2026 18:40:40 -0300 Subject: [PATCH 15/20] docs(security): give the flash size when flashing a locked device In secure download mode esptool cannot detect the flash size, and with --flash-size keep the ROM refuses writes past 2 MB, which the app reaches. --- docs/secure-boot.md | 3 ++- docs/security-plan.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/secure-boot.md b/docs/secure-boot.md index 207efc5a..9dfa3e6a 100644 --- a/docs/secure-boot.md +++ b/docs/secure-boot.md @@ -424,7 +424,8 @@ Before publishing, boot the new app on each frozen variant, and install it over **USB flashing a locked device.** Secure download mode still writes flash; it refuses to read it. So a locked device can take a new signed app or a newer frozen bootloader over USB. Two things have to hold in the flasher: -- It must write the bootloader unmodified. Rewriting the flash mode, frequency or size in the image header changes the signed bytes and the ROM then rejects the bootloader, so the flasher uses `keep` for all three. +- It must write the bootloader unmodified. Rewriting the flash mode, frequency or size in the image header changes the signed bytes and the ROM then rejects the bootloader. esptool leaves image headers alone once it sees secure boot or secure download mode ("Security features enabled, so not changing any flash settings"); any other flasher has to do the same. +- It must tell the ROM the flash size. Secure download mode cannot detect it, and with esptool's `--flash-size keep` the ROM then refuses any write that reaches past 2 MB ("Failed to enter flash download mode", result `0106`), which the app does. So on a locked device: `esptool --chip esp32p4 --no-stub write-flash --flash-mode keep --flash-freq keep --flash-size 16MB 0x2000 bootloader.bin 0x10000 partition-table.bin 0x1e000 ota_data_initial.bin 0x20000 firmware-signed.bin`. The write runs without the stub at about 80 kbit/s (over three minutes for the app) and is not read back, so the boot log is the check: `RSA-PSS secure boot verification succeeded`. - It must work without the commands secure download mode removes (register reads, the flasher stub). The web flasher's chip-revision read fails there, so it has to tolerate that and ask which chip revision the board has. ### 4c. Build Profiles diff --git a/docs/security-plan.md b/docs/security-plan.md index 76022cf1..7a88da80 100644 --- a/docs/security-plan.md +++ b/docs/security-plan.md @@ -464,7 +464,7 @@ Re-run this matrix as part of the Phase 4d suite on a locked device. - **Compatibility rule**: every release must boot on every frozen bootloader still in the field. A change that breaks this is a re-freeze, and reaches a locked device only through a USB reflash by its owner. - **Fixed by a freeze**: the ESP-IDF version of the bootloader, the opt-in wrapper, anti-rollback on or off (6c), bootloader log level. - **Existing devices** got their bootloader from an earlier release and SD updates never changed it. They need one USB install of a lockable release; it preserves NVS and storage. The menu detects the old bootloader and says so. -- **Web flasher**: must write the bootloader without rewriting its header (`keep` for flash mode, frequency and size) and must work in secure download mode, so a locked device can still take a signed release over USB. +- **Web flasher**: must write the bootloader without rewriting its header and must work in secure download mode, so a locked device can still take a signed release over USB. There the flash size has to be given explicitly (16MB): the ROM cannot detect it and otherwise refuses writes past 2 MB. - **Self-built firmware** follows the same model with the user's keys: replace the three digest files, sign their own bootloader with their three keys, and the menu checks against those. Order of work: From 7cc9b2c88545948ded4243714fee2a74b26d17d1 Mon Sep 17 00:00:00 2001 From: odudex Date: Tue, 17 Nov 2026 11:04:31 -0300 Subject: [PATCH 16/20] feat(flasher): flash devices that have secure boot enabled In secure download mode the ROM takes flash data uncompressed, in 1 KiB blocks, and needs the flash size set; register reads and the stub are unavailable. Image headers are no longer rewritten on any device, so a signed bootloader lands as built. --- site/flash/index.html | 122 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 112 insertions(+), 10 deletions(-) diff --git a/site/flash/index.html b/site/flash/index.html index ecd287a5..a05d652b 100644 --- a/site/flash/index.html +++ b/site/flash/index.html @@ -77,6 +77,7 @@ transition: all 0.15s; } .tab.active { border-color: var(--accent); color: var(--accent); background: rgba(249,115,22,0.08); } + .tab:disabled { opacity: 0.4; cursor: not-allowed; } label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.4rem; } select { @@ -156,6 +157,12 @@

    Web Flasher

    Please use Google Chrome or Microsoft Edge version 89 or later. + +