Secure boot on ESP32-S3: which eFuses burn, and in what order?
A hardened ESP32-S3 burns its security eFuses in a single first boot, Secure Boot's batch before flash encryption's and the download-mode bits before a byte is encrypted, and none of it can be undone, so the upload that starts it waits for a person to type the build's name.

The previous post in this series ended with a footnote I owed you: the device-bound key on the ESP32-S3 depended on an eFuse key that nothing burned yet, so a hardened S3 build could not create a vault at all. That footnote is closed. A host-side provisioning script has existed since 2026-10-25, it went into real silicon on 2026-11-02, and the next day one board booted hardened for the first time. This post is about what that first boot does on a hardware password manager I’m building (not yet released), because on an ESP32 the first hardened boot is the part you can’t take back.
Hardening an ESP32 is not a setting you switch on. It is a sequence of one-way doors. Each eFuse the bootloader burns closes something for good, a few of them close in an order that decides whether the next one can still be closed at all, and two build profiles open two different sets of doors. The build knows exactly which ones it will open before anything reaches the chip. So the last piece of the design is not cryptography: it is making sure the only thing that can start that sequence is a person who meant to.
I’ve kept the evidence labels from the bench. Some things here were observed on a board, with a date. Some I read from code in ESP-IDF 6.0.3 or in the firmware but have not run. One figure is an estimate. And a long list has not been observed by anyone yet: exactly one board, an M5StickS3 in DEVELOPMENT mode, has ever booted hardened, and no RELEASE image has booted anywhere.
TL;DR: the one-way doors of a hardened ESP32-S3
5 key points- With ESP-IDF 6.0.3, a hardened first boot on the ESP32-S3 runs in a fixed order: Secure Boot v2 commits its eFuse batch (public key digest, revoked spare slots,
SECURE_BOOT_EN, JTAG off), then flash encryption generates its key on the chip and commits a second batch, then the flash is encrypted in place, thenSPI_BOOT_CRYPT_CNTis written and the chip resets. - Flash encryption’s download-mode and JTAG bits burn before a single byte is encrypted. The bit that stops further keys from being read-protected,
WR_DIS.RD_DIS, is deferred until the flash encryption key is protected, and that same bit is why the device-binding HMAC key has to be burned by the host before the first hardened boot. - JTAG closes on any hardened boot, DEVELOPMENT included. What DEVELOPMENT leaves open is ROM download mode:
espefuse, ciphertext reads and unlimited encrypted reflashes of images signed with the burned key. RELEASE addsDIS_DOWNLOAD_MANUAL_ENCRYPT, the write protection of the cache-disable group and a saturated counter; Kleidos’s RELEASE build also closes download mode, enables anti-rollback and silences the console. - Kleidos’s
_securebuilds are RELEASE;_secure_devand the bench image are DEVELOPMENT. One board, in DEVELOPMENT, has ever booted hardened; everything RELEASE-specific below is read from code. - Because every step is irreversible and starts with an upload, an agent never starts a
_secureupload: a guard in every_secureenvironment reads the eFuses and then waits for a human to type the environment name at/dev/tty.
Quick glossary (if ESP32 security isn't your background)
- eFuse: a bit burned into the chip once. A 0 can become a 1; a 1 never goes back. Key blocks, counters and on/off switches are all eFuses, and so are the bits that protect other eFuses.
- Write-disable (
WR_DIS) · read-disable (RD_DIS): eFuses that freeze a group of other eFuses, or hide a key block from software. - Secure Boot v2 (SBv2): the ROM and bootloader check an RSA-3072 signature on every image before running it. The chip stores only a SHA-256 digest of the public key.
- Flash encryption (FE): the chip transparently encrypts and decrypts the external flash with a key that software can’t read. On the S3 the cipher is XTS-AES-128.
- ROM download mode: the serial bootloader in the chip’s mask ROM, the one
esptooltalks to when you flash a board. - JTAG: the hardware debug port. With it you can halt the CPU and read memory.
- DEVELOPMENT · RELEASE: the two flash encryption modes of ESP-IDF. DEVELOPMENT keeps the board reflashable over serial; RELEASE does not.
- sdkconfig fragment: a file of
CONFIG_*=ylines that a build environment chains onto its base configuration. - OTA · anti-rollback: over-the-air update, and an eFuse floor that refuses images with a lower security version.
- Agent: here, an AI coding agent working in the firmware repository, with a shell and the build tools.
Why is hardening an ESP32 a sequence of one-way doors?
Most security settings are a line in a config file: you set it, test it, and if it was wrong you unset it. An ESP32’s security settings are eFuses, and an eFuse is a physical fuse in the silicon. Burning one changes a 0 into a 1, and there is no operation that changes it back. Some eFuses hold values (a key block, a counter), some are switches (SECURE_BOOT_EN), and a third kind protects the others: a write-disable bit freezes a group of eFuses so they can no longer change, and a read-disable bit hides a key block from software and from debuggers. The protection is itself a fuse, so it is permanent too.
That has a consequence that changes how you work. You can’t rehearse a burn and then roll it back. The only rehearsal available is reading the code that will do the burning, which is why half of this post cites ESP-IDF source files by name, and why the tables say “read from code” so often.
On a Kleidos ESP32-S3 the doors close at four moments:
- Before the first boot, the host burns the device-binding HMAC key into eFuse block
KEY0, read-protected. - First boot, Secure Boot v2: the bootloader burns the public key digest and Secure Boot’s own protections in one batch.
- First boot, flash encryption: the bootloader generates the flash encryption key on the chip and burns it with flash encryption’s protections in a second batch.
- First boot, enabling encryption: after encrypting the flash in place, the bootloader writes the counter that turns encryption on.
Which extra doors close in steps 2 and 3 depends on the build profile, DEVELOPMENT or RELEASE. The rest of the post goes through each moment, what it burns, and why the order is not negotiable.
What has to be burned before the first hardened boot?
The device-binding key from the previous post. On the ESP32-S3 the per-chip secret is an HMAC computed by the chip’s HMAC peripheral over an eFuse key that software can never read. That key has to exist before the vault does, and it has to be read-protected, so it is burned by the host, not by the firmware, once, before the first hardened boot: scripts/provision_hmac_key.py writes it into KEY0 with the purpose HMAC_UP and read-protects the block. The firmware itself writes no eFuse for binding; it only asks the peripheral for HMACs.
Why before? Because the first hardened boot burns WR_DIS.RD_DIS, and once that bit is set no further key block can be made unreadable. Espressif’s Secure Boot v2 page for the ESP32-S3 says it directly: “After Secure Boot is enabled, further read-protection of eFuse keys is not possible.” A binding key burned after that boot would sit in a block software can read, and a readable device secret is just a pepper with extra steps. The order is the whole point: KEY0 first, then the first hardened boot.
The purpose matters as much as the block. Espressif’s HMAC page lists HMAC_UP as “HMAC generated for software use” and HMAC_DOWN_JTAG as “HMAC used for enabling the soft-disabled JTAG interface”. Kleidos burns only the first. The key on the chip is meant to produce HMACs for the firmware, and nothing on it is meant to reopen the debug port.
What the firmware does with that HMAC is the construction from the last post, unchanged: the key-encryption key is bound to the chip with HKDF-SHA256(ikm = kek, salt = deviceSecret, info = "kleidos-device-bind-v1"), where deviceSecret is the eFuse HMAC on the S3 and a pepper in encrypted NVS on the classic ESP32. The classic chip has no HMAC peripheral, so it has no provisioning step at all.
The upload guard, which gets its own section below, checks this ordering before it lets a _secure image anywhere near an S3. It reads the eFuses and refuses to continue in three cases:
KEY0does not hold the binding key yet.- A hardened boot has already happened: any of
WR_DIS.RD_DIS,SECURE_BOOT_ENorSPI_BOOT_CRYPT_CNTis already set. - Fewer than two free key blocks remain among
KEY1toKEY4. The first boot needs one for the Secure Boot digest and one for the flash encryption key.
What does the first boot burn, and in what order?
Everything else happens in one boot, inside the ESP-IDF second-stage bootloader. The order is in bootloader_utility.c, and it is the same for both modes; what differs is which bits each step includes.
- Before boot: host HMAC_UP key into KEY0, read-protected
- Step 1: Secure Boot v2 digest into KEY1, revoke slots 1 and 2, SECURE_BOOT_EN, JTAG off: commit
- Step 2: flash encryption init XTS key into KEY2 on chip, download cache off, WR_DIS.RD_DIS: commit
- Step 3: encrypt contents bootloader, table, apps, otadata, nvs_keys, vault
- Step 4: enable SPI_BOOT_CRYPT_CNT: 0b001 DEV, 0b111 RELEASE
- Step 5: reset boot again with encryption on
Steps 1 and 2 each commit their eFuse batch before the next step starts. By the time the first byte of flash is encrypted, every protection bit of both features is already burned.
Stripped of logging and error handling, the bootloader’s sequence is short. The numbered comments are mine:
#ifdef CONFIG_SECURE_BOOT_V2_ENABLED
// 1. SB batch, committed inside
err = esp_secure_boot_v2_permanently_enable(image_data);
#endif
#ifdef CONFIG_SECURE_FLASH_ENC_ENABLED
bool flash_encryption_enabled = esp_flash_encrypt_state();
if (!flash_encryption_enabled) {
// 2. FE key + FE batch, committed inside
err = esp_flash_encrypt_init();
}
if (!flash_encryption_enabled) {
// 3. encrypt in place
err = esp_flash_encrypt_contents();
// 4. write SPI_BOOT_CRYPT_CNT
err = esp_flash_encrypt_enable();
}
#endif
if (!flash_encryption_enabled && esp_efuse_is_flash_encryption_enabled()) {
// 5. reboot with encryption active
bootloader_reset();
}Step 1: Secure Boot v2 commits its own batch
esp_secure_boot_v2_permanently_enable() opens an eFuse batch, writes the SHA-256 digest of the RSA-3072 public key into the first free key block, and revokes every digest slot it did not use (unless CONFIG_SECURE_BOOT_ALLOW_UNUSED_DIGEST_SLOTS is set, which Kleidos does not set). The S3 supports up to three keys; Kleidos signs with one, so the digest lands in KEY1 (because KEY0 already holds the HMAC key) and slots 1 and 2 are revoked. Then it calls the chip’s esp_secure_boot_enable_secure_features() and commits the batch.
That routine is where most of the doors are:
DIS_DIRECT_BOOT, so the chip can’t skip the bootloader.- Download mode: disabled entirely if
CONFIG_SECURE_DISABLE_ROM_DL_MODEis set (Kleidos’s RELEASE build), switched to secure download mode ifCONFIG_SECURE_ENABLE_SECURE_ROM_DL_MODEis set, and otherwise left open with a warning in the log. - JTAG:
DIS_USB_JTAG,HARD_DIS_JTAGand every bit ofSOFT_DIS_JTAG, unlessCONFIG_SECURE_BOOT_ALLOW_JTAGis set. SECURE_BOOT_AGGRESSIVE_REVOKE, only if configured (Kleidos’s RELEASE build).SECURE_BOOT_EN.WR_DIS.RD_DIS, but only if flash encryption is already enabled. On a first boot it is not, so this bit waits.
So the Secure Boot eFuses are committed before flash encryption starts. On the S3 they are not burned together with the flash encryption key: CONFIG_SECURE_BOOT_FLASH_ENC_KEYS_BURN_TOGETHER exists for the ESP32-C2, which has a single key block to share, and the S3 does not enable it.
Step 2: flash encryption’s protections burn before anything is encrypted
esp_flash_encrypt_init() opens a second batch, has the chip generate the flash encryption key on the chip and writes it read- and write-protected into the next free block (KEY2, purpose XTS_AES_128_KEY), calls flash encryption’s own secure-features routine, and commits. That is the step people tend to picture happening at the end. It doesn’t: flash encryption’s download-mode and JTAG bits are part of this batch, burned before step 3 touches a single sector.
The S3 routine is worth reading whole, because each #ifndef is a door that DEVELOPMENT and RELEASE treat differently:
esp_err_t esp_flash_encryption_enable_secure_features(void)
{
#ifndef CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC
esp_efuse_write_field_bit(ESP_EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT);
#endif
#ifndef CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE
esp_efuse_write_field_bit(ESP_EFUSE_DIS_DOWNLOAD_DCACHE);
esp_efuse_write_field_bit(ESP_EFUSE_DIS_DOWNLOAD_ICACHE);
#endif
#ifndef CONFIG_SECURE_BOOT_ALLOW_JTAG
esp_efuse_write_field_bit(ESP_EFUSE_HARD_DIS_JTAG);
esp_efuse_write_field_bit(ESP_EFUSE_DIS_USB_JTAG);
#endif
esp_efuse_write_field_bit(ESP_EFUSE_DIS_DIRECT_BOOT);
#if defined(CONFIG_SECURE_BOOT_V2_ENABLED) && !defined(CONFIG_SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS)
// This bit is set when enabling Secure Boot V2, but we can't enable it until this later point in the first boot
// otherwise the Flash Encryption key cannot be read protected
esp_efuse_write_field_bit(ESP_EFUSE_WR_DIS_RD_DIS);
#endif
#ifndef CONFIG_SECURE_FLASH_SKIP_WRITE_PROTECTION_CACHE
// Set write-protection for DIS_ICACHE and DIS_DCACHE to prevent bricking chip in case it will be set accidentally.
esp_efuse_write_field_bit(ESP_EFUSE_WR_DIS_DIS_ICACHE);
#endif
return ESP_OK;
}Two lines in there explain the whole ordering problem. The comment above WR_DIS_RD_DIS is ESP-IDF saying out loud that Secure Boot wants this bit, and that burning it in step 1 would leave the flash encryption key in step 2 readable. So the bit is deferred to the end of step 2, after the key is protected. The device-binding key faces the same bit from the other side: it has to be protected before step 1 even starts, which is why the host burns it first.
JTAG shows up a second time here, too. Both features close it independently, and neither depends on the flash encryption mode. That is the fact most worth remembering from this post, and I come back to it in the DEVELOPMENT vs RELEASE section.
The key size is ESP-IDF’s default, not a Kleidos choice: Kleidos never sets it, and the Kconfig default is SECURE_FLASH_ENCRYPTION_AES128. Espressif’s flash encryption page for the S3 says what that costs in eFuse: “One 256-bit key block for XTS_AES_128”. XTS uses two AES-128 keys, and both fit in one 256-bit block. The page doesn’t state which size is the default; the Kconfig does.
Step 3: the flash is encrypted in place
esp_flash_encrypt_contents() encrypts the bootloader and the partition table, then walks the table: every valid app, otadata and nvs_keys are encrypted unconditionally, and so is any partition that carries the encrypted flag. In Kleidos that flag is on the vault partition, which is the reason the vault has to start erased: the first boot encrypts whatever is in those sectors, in place.
Step 4: one counter turns it on
esp_flash_encrypt_enable() writes exactly one eFuse field, SPI_BOOT_CRYPT_CNT. It is a 3-bit counter, and encryption is on when an odd number of its bits are set (the S3 eFuse table describes it as “Enables flash encryption when 1 or 3 bits are set and disabled otherwise”). The two modes diverge on one line:
#ifdef CONFIG_SECURE_FLASH_ENCRYPTION_MODE_RELEASE
// Go straight to max, permanently enabled
size_t new_flash_crypt_cnt = FLASH_ENC_CNT_MAX - flash_crypt_cnt;
#else
/* Set least significant 0-bit in flash_crypt_cnt */
size_t new_flash_crypt_cnt = 1;
#endif
err = esp_efuse_write_field_cnt(CRYPT_CNT, new_flash_crypt_cnt);DEVELOPMENT sets one bit (0b001). RELEASE sets all three (0b111), so there is no bit left to flip encryption off again. Then step 5 resets the chip, and the next boot runs with transparent decryption.
There’s one more echo of step 1 in the application. At startup, the app requests the download-mode disable again if CONFIG_SECURE_DISABLE_ROM_DL_MODE is set (in efuse/src/esp_efuse_startup.c). In Kleidos the bootloader has already burned it by then, so that call changes nothing.
Which eFuses does a hardened ESP32-S3 end up with?
This is the full list for a Kleidos S3 build, from the ESP-IDF 6.0.3 code and the firmware’s fragments, in two tables: what every hardened boot burns, whatever the mode, and where DEVELOPMENT and RELEASE part ways. The DEVELOPMENT values were checked against a real board (below); the RELEASE values are read from code, because no RELEASE image has ever booted.
| eFuse | What it does, and when it burns |
|---|---|
BLOCK_KEY0, purpose HMAC_UP | Device-binding key, read-protected; burned by the host before the first boot |
BLOCK_KEY1, purpose SECURE_BOOT_DIGEST0 | SHA-256 of the RSA-3072 public key; readable, write-protected; step 1 |
SECURE_BOOT_KEY_REVOKE1, _REVOKE2 | Revoke the two unused digest slots; step 1 |
SECURE_BOOT_EN | Secure Boot on; step 1 |
DIS_DIRECT_BOOT (formerly DIS_LEGACY_SPI_BOOT) | No booting around the bootloader; steps 1 and 2 |
DIS_PAD_JTAG (HARD_DIS_JTAG), DIS_USB_JTAG, SOFT_DIS_JTAG = 0b111 | JTAG closed for good; steps 1 and 2 |
BLOCK_KEY2, purpose XTS_AES_128_KEY | Flash encryption key, generated on the chip, read- and write-protected; step 2 |
DIS_DOWNLOAD_ICACHE, DIS_DOWNLOAD_DCACHE | Download mode can’t read decrypted flash through the cache; step 2 |
WR_DIS.RD_DIS | No further key block can be read-protected; step 2 (deferred from step 1) |
| eFuse | DEV | RELEASE |
|---|---|---|
| DIS_ | No | Burned |
| WR_ | No | Burned |
| SPI_ | Burned | Burned |
| DIS_ | No | Burned |
| SECURE_ | No | Burned |
| SECURE_ | No | Burned |
| ENABLE_ | No | No |
| UART_ | No | No |
DEV is DEVELOPMENT (checked on the bench board); RELEASE is read from code. The three rows marked Kleidos _secure come from Kleidos's own RELEASE configuration rather than from the mode itself.
Three rows deserve a word. The ROM log one is a deliberate gap: turning off the ESP-ROM: banner is itself an eFuse on the S3, so it is irreversible there, and the classic ESP32 has no such eFuse at all. No Kleidos build sets it, and whether one should is still undecided. SECURE_VERSION is written by two different pieces of code, the bootloader when it loads an app and the app when it marks itself valid; Espressif’s OTA anti-rollback section describes both cases and says “The number of bits in the secure_version field is limited to 16 bits.” And the NVS encryption key is missing from both on purpose: Kleidos uses the flash-encryption-based NVS scheme, whose keys live in the nvs_keys partition that flash encryption always encrypts, so NVS encryption costs no eFuse block. The fragment selects that scheme explicitly with CONFIG_NVS_SEC_KEY_PROTECT_USING_FLASH_ENC=y rather than relying on a default.
What the bench board showed
On 2026-11-03, the bench board’s eFuses were read before and after its first hardened boot (observed, DEVELOPMENT, one board):
RD_DISwent from 1 to 5:KEY0(the binding key, already protected) plusKEY2(the new flash encryption key).WR_DISwent from0x00800100to0x03800701.SPI_BOOT_CRYPT_CNTwent from0b000to0b001, andSECURE_BOOT_ENfrom False to True.- Digest slots 1 and 2 were revoked;
DIS_DIRECT_BOOTandDIS_PAD_JTAGwere True;SOFT_DIS_JTAGwas0b111;DIS_DOWNLOAD_ICACHEandDIS_DOWNLOAD_DCACHEwere True. - Untouched, as the DEVELOPMENT column predicts:
DIS_DOWNLOAD_MANUAL_ENCRYPT,DIS_DOWNLOAD_MODE,ENABLE_SECURITY_DOWNLOAD,DIS_USB_SERIAL_JTAG,SECURE_BOOT_AGGRESSIVE_REVOKE,SECURE_VERSION,SECURE_BOOT_KEY_REVOKE0,KEY3toKEY5,WR_DISbit 2 andWR_DIS.SPI_BOOT_CRYPT_CNT.
I’ve left DIS_USB_JTAG out of that list. My records for that unit disagree about whether it was already set before the first hardened boot, so this board can’t tell you which step burned it; the code says both steps would.
The summary stayed the same after the board was reflashed, erased and had its otadata erased. That’s the one-way door seen from the outside: everything that happened afterwards was ordinary flash writes, and none of it touched the eFuses.
DEVELOPMENT or RELEASE: what does each mode leave open?
Here is the most common misreading of ESP32 hardening: that DEVELOPMENT is the “open” mode and RELEASE is the one that closes the debug port. It isn’t. JTAG is closed by any hardened boot, because both Secure Boot and flash encryption burn the JTAG bits unless CONFIG_SECURE_BOOT_ALLOW_JTAG is set, and that option defaults to off and is only even offered in DEVELOPMENT or insecure Secure Boot configurations. Its Kconfig help text puts it plainly: if not set, “the bootloader will permanently disable JTAG (across entire chip) on first boot when either secure boot or flash encryption is enabled.” Kleidos never sets it. The bench board, in DEVELOPMENT, has JTAG closed.
What DEVELOPMENT keeps open is the ROM download mode, and with it the ability to keep developing on a hardened board.
| Door | DEVELOPMENT (_secure_dev, bench image) | RELEASE (_secure) |
|---|---|---|
| JTAG | Closed (both features close it) | Closed |
| ROM download mode | Full: espefuse summary, read-flash (ciphertext), encrypted writes | Closed (DIS_DOWNLOAD_MODE); not secure download mode |
Reflash with encrypted images (esptool write-flash --encrypt) | No limit in the code, as long as the image is signed with the burned key | Impossible over serial; signed OTA only |
| Plaintext reflash | One cycle on the S3 (3-bit counter). Each cycle re-encrypts the vault over its ciphertext and loses it (read from code, not run) | Impossible |
| Read decrypted flash from download mode | No (DIS_DOWNLOAD_ICACHE, DIS_DOWNLOAD_DCACHE) | No |
Write protection of the DIS_ICACHE group | Not burned | Burned |
| ROM boot banner | Visible | Also visible (the ROM log eFuse is not burned) |
| Bootloader log, console, panic output | Open | Silent: no console, silent panic reboot, no bootloader log, plus a shared silence fragment (the production fragment below) |
| Anti-rollback | No | Yes (SECURE_VERSION = 1) |
Full download mode is the DEVELOPMENT default; the bench fragment also sets it explicitly with CONFIG_SECURE_INSECURE_ALLOW_DL_MODE=y. The mechanism behind the rest of the DEVELOPMENT column is two lines of Kconfig. In ESP-IDF 6.0.3, choosing the mode selects the rest:
config SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
bool "Development (NOT SECURE)"
select SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC
config SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC
bool "Leave UART bootloader encryption enabled"
depends on SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
select SECURE_FLASH_SKIP_WRITE_PROTECTION_CACHE if SECURE_FLASH_HAS_WRITE_PROTECTION_CACHESECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT (in Kconfig.projbuild) selects ALLOW_ENC, so DIS_DOWNLOAD_MANUAL_ENCRYPT is skipped; ALLOW_ENC selects SKIP_WRITE_PROTECTION_CACHE, so WR_DIS bit 2 is skipped too. That matches Espressif’s own summary for the S3: in Development the bootloader sets “DIS_DOWNLOAD_ICACHE, DIS_DOWNLOAD_DCACHE, HARD_DIS_JTAG, and DIS_LEGACY_SPI_BOOT”, in Release “all the eFuse bits set under development mode as well as DIS_DOWNLOAD_MANUAL_ENCRYPT”, and in Release “New plaintext images can ONLY be downloaded using the over-the-air (OTA) scheme”.
The plaintext reflash row is where DEVELOPMENT is least forgiving on the S3. A 3-bit counter at 0b001 has exactly one more state change that turns encryption off (0b011) before the last one turns it back on for good. You get one cycle, and the vault does not survive it: the cycle ends by re-encrypting the vault partition in place, over data that is already ciphertext. I have read that path; I have not run it, and I don’t intend to on the only hardened board I have.
Where Espressif’s pages and the 6.0.3 code disagree
Two sentences in Espressif’s documentation don’t match what the 6.0.3 code does on the S3. In both cases I side with the code, because the code is what burns the fuses.
Secure download mode. The S3 security overview says: “In ESP32-S3, Secure UART Download mode gets activated if any of the security features are enabled.” The 6.0.3 Kconfig conditions that default on the flash encryption mode:
config SECURE_ROM_DL_MODE_ENABLED
bool
default y if SOC_SUPPORTS_SECURE_DL_MODE && !SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
choice SECURE_UART_ROM_DL_MODE
bool "UART ROM download mode"
default SECURE_ENABLE_SECURE_ROM_DL_MODE if SECURE_ROM_DL_MODE_ENABLED # NOERROR
default SECURE_INSECURE_ALLOW_DL_MODESo in RELEASE the default is secure download mode, and in DEVELOPMENT the default is full download mode. The bench board, in DEVELOPMENT, agrees with the code: ENABLE_SECURITY_DOWNLOAD was left unburned. Kleidos doesn’t use secure download mode in either case: its RELEASE build replaces that default with CONFIG_SECURE_DISABLE_ROM_DL_MODE=y, which closes download mode entirely rather than restricting it.
Write protection of SPI_BOOT_CRYPT_CNT. The S3 flash encryption page says that in Release the bootloader “also write-protects the SPI_BOOT_CRYPT_CNT eFuse bits.” On the S3, the 6.0.3 code does something else with the same effect. Step 4, shown above, sets the counter straight to 0b111, and the only place it then burns WR_DIS_CRYPT_CNT is inside #if defined(CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_128_DERIVED), which is not the S3. The application’s own check, in the app-side flash_encrypt.c, skips the write protection when the counter is already at its maximum:
if (flash_crypt_cnt == (1<<(CRYPT_CNT[0]->bit_count))-1) {
// If encryption counter is already max, no need to write protect it
// (this distinction is important on ESP32 ECO3 where write-procted FLASH_CRYPT_CNT also write-protects UART_DL_DIS)
} else {
esp_flash_write_protect_crypt_cnt();
}A counter with every bit set can’t change again whether or not it is write-protected, so the result is the same. The mechanism is not the one the page describes, and I would rather describe the one the code uses. None of this is observed: it only happens in RELEASE, and no RELEASE image has booted.
Which Kleidos build opens which doors?
The firmware is built with PlatformIO, and each board has several environments that chain sdkconfig fragments onto a common base. For the M5StickS3, four environments matter here:
| Environment | What it is, and its fragments on top of the base |
|---|---|
sticks3_release | Open release: open partition table, burns nothing, reflashable; JTAG and download mode open Fragments: sdkconfig.silent.defaults |
sticks3_secure | Secure Boot v2 + flash encryption in RELEASE + encrypted NVS + download mode closed + anti-rollback + aggressive revocation; secure partition table; guarded upload Fragments: sdkconfig.release.defaults.opt-in, sdkconfig.secure.prod.opt-in, sdkconfig.silent.defaults |
sticks3_secure_dev | The same in DEVELOPMENT: no download lock, no anti-rollback, no silence fragment. Inherits the _secure build flags (KLEIDOS_RELEASE=1, KLEIDOS_SECURE=1) and adds KLEIDOS_SECURE_DEV=1. Burns eFuses; never distributedFragments: sdkconfig.release.defaults.opt-in |
sticks3_secure_debug | The bench image: a debug console (with a one-iteration KDF) over Secure Boot + DEVELOPMENT, signed with its own bench key. A variant check forbids the production fragment for it Fragments: sdkconfig.release.defaults.opt-in, sdkconfig.secure.bench.opt-in, debug fragments |
The base is the same for all four (sdkconfig.defaults.kleidos_ble, sdkconfig.sticks3, sdkconfig.vault_mmap.defaults). The common hardened fragment is where Secure Boot and flash encryption are switched on, in DEVELOPMENT by default. I’ve removed the line that names the signing key file:
CONFIG_SECURE_FLASH_ENC_ENABLED=y
CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT=y
CONFIG_NVS_ENCRYPTION=y
CONFIG_NVS_SEC_KEY_PROTECT_USING_FLASH_ENC=y
CONFIG_PARTITION_TABLE_OFFSET=0x10000
CONFIG_SECURE_BOOT=y
CONFIG_SECURE_BOOT_V2_ENABLED=y
CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y
CONFIG_SECURE_SIGNED_ON_UPDATE=y
CONFIG_SECURE_BOOT_FLASH_BOOTLOADER_DEFAULT=yThe production fragment is what turns DEVELOPMENT into RELEASE and adds the doors that only _secure opens:
CONFIG_SECURE_FLASH_ENCRYPTION_MODE_RELEASE=y
CONFIG_SECURE_DISABLE_ROM_DL_MODE=y
CONFIG_SECURE_BOOT_ENABLE_AGGRESSIVE_KEY_REVOKE=y
CONFIG_ESP_CONSOLE_NONE=y
CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y
CONFIG_BOOTLOADER_APP_SECURE_VERSION=1And the bench fragment keeps the bench board reflashable on purpose (again without the key file line):
CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT=y
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC=y
CONFIG_SECURE_INSECURE_ALLOW_DL_MODE=yNone of these lines carries a secret. The signing key lives outside the configuration; the fragments only say which file to use. Signing keys are RSA-3072 keys for Secure Boot v2, generated with espsecure generate-signing-key --version 2 --scheme rsa3072 <file>.pem.
The last line of the common fragment is worth a story. Without CONFIG_SECURE_BOOT_FLASH_BOOTLOADER_DEFAULT, PlatformIO does not upload the bootloader in a Secure Boot v2 build. The app goes up, the old unsigned bootloader stays, and the first hardened boot simply never happens. It was missing from the start and was added on 2026-11-02, the day before the first board booted hardened. A door you think you opened and didn’t is its own kind of failure.
Across the fleet there are 13 hardened environments today, all with the secure partition table: _secure and _secure_dev for the StickS3, Cardputer ADV, M5StickC Plus2, CoreS3 SE, T-Deck and Core2 v1.3, plus sticks3_secure_debug. One of the 13 has booted. The three 4 MB boards (M5StickC Plus 1.1, M5StickC Plus SE and M5Stack CoreInk) have _debug, _stress and _release environments but never _secure: Secure Boot plus flash encryption need 8 MB or more here, and those boards update by full reflash, with no OTA. They rely only on the vault’s own encryption from the encrypt-then-MAC post.
Where does the vault sit in a secure partition table?
The hardened builds use their own partition table, because Secure Boot moves things. This is the 8 MB one:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x12000, 0x4000,
nvs_key, data, nvs_keys, 0x16000, 0x1000,
otadata, data, ota, 0x17000, 0x2000,
app0, app, ota_0, 0x20000, 0x2C0000,
app1, app, ota_1, 0x2E0000, 0x2C0000,
littlefs, data, littlefs, 0x5A0000, 0x260000, encrypted| Region | Segment | Size |
|---|---|---|
| Flash | bootloader | 64 KB |
| Flash | table | 8 KB |
| Flash | nvs | 16 KB |
| Flash | nvs_key | 4 KB |
| Flash | otadata | 8 KB |
| Flash | unused | 28 KB |
| Flash | app0 | 2,816 KB |
| Flash | app1 | 2,816 KB |
| Flash | vault (encrypted) | 2,432 KB |
Proportions to scale. The signed bootloader is about 33 KB measured, signature included, which does not fit below 0x8000; the table moves to 0x10000 and NVS to 0x12000.
Each offset has a reason:
- The table is at
0x10000. On the S3 the bootloader starts at0x0, and the signed bootloader measured about 33 KB, its 4 KB signature block included. The usual table offset is0x8000, 32 KB in, so a signed bootloader would overwrite the table. Espressif’s Secure Boot v2 page warns about exactly this: “Enabling Secure Boot and/or flash encryption will increase the size of the bootloader”, which may require moving the partition table offset. - NVS is at
0x12000. The signed table takes 8 KB: 4 KB of table and a 4 KB signature sector,0x10000to0x11FFF. Espressif describes the signature block as one that “starts on a 4 KB aligned boundary and has a flash sector of its own.” - The vault has the
encryptedflag: 2,432 KB, 608 blocks of 4 KB, encrypted in place on the first boot and transparently afterwards. - NVS never has the flag. NVS refuses a partition encrypted that way (
ESP_ERR_NVS_WRONG_ENCRYPTION) and uses its own encryption, keyed fromnvs_key. Espressif’s page says the same from its side: “Thenvspartition cannot be encrypted, because the NVS library is not directly compatible with flash encryption.”
The 16 MB table, used by the CoreS3 SE, T-Deck and Core2 v1.3, has the same first rows, apps of 0x470000 and the encrypted vault at 0x900000 with a size of 0x700000. No board with that table has booted hardened.
The vault’s encrypted flag had a short, honest history. It was set on 2026-11-02, removed on 2026-11-03 until a board could prove it worked, and put back the same day after the bench board booted an image built with it and used the vault. That’s how I’d like every flag in a partition table to arrive.
What does a dump of encrypted flash still show?
No readable filesystem, but not nothing. Flash encryption hides the contents, not the layout. An erased sector reads as 0xFF, and flash encryption never writes to it, so a dump of the vault partition shows which blocks were written and, from the raw 0xFF tails, how much of each, in 128-byte units. After an erase it shows the fill level. That is metadata, not credentials, and it is a limit of flash encryption that kleidos.dev states too: “A copy of the flash still shows which blocks were written.”
The same holds for the ROM banner: a RELEASE board is silent from the bootloader on, but the chip’s own ESP-ROM: line still prints at reset, because the eFuse that would silence it is not burned.
And there’s a cost in time. The first boot has to encrypt the 608 vault sectors in place, which is why the vault must start erased. About half a minute is my estimate, not a measurement: on the only first hardened boot that has happened, no serial port was open to time it.
What changes on the classic ESP32?
Two boards in the fleet are classic ESP32s with a _secure environment: the M5StickC Plus2 (ESP32-PICO-V3-02) and the M5Stack Core2 v1.3 (ESP32-D0WDQ6-V3). Most of the design carries over; the eFuses and the margins don’t.
| Aspect | ESP32-S3 | Classic ESP32 (Plus2, Core2 v1.3) |
|---|---|---|
| Secure Boot v2 support | Yes | Only from silicon revision v3.0; RSA-3072 |
| Public keys | Up to three digests; Kleidos uses one and revokes two | One only, digest in BLK2; no slots to revoke |
| Secure Boot enable bit | SECURE_BOOT_EN | ABS_DONE_1 |
| JTAG | DIS_USB_JTAG, HARD_DIS_JTAG, SOFT_DIS_JTAG | DISABLE_JTAG; the ROM BASIC interpreter is also closed (CONSOLE_DEBUG_DISABLE) |
| Download mode closed | DIS_DOWNLOAD_MODE | UART_DOWNLOAD_DIS, valid only on ESP32 V3 |
| Flash encryption cipher | XTS-AES-128, one 256-bit key block | The chip’s own AES-256 scheme, key tweaked per 32-byte block; FLASH_CRYPT_CONFIG = 0xF |
| Download bits in both modes | DIS_DOWNLOAD_ICACHE, DIS_DOWNLOAD_DCACHE | DISABLE_DL_DECRYPT, DISABLE_DL_CACHE |
| Download bit only in RELEASE | DIS_DOWNLOAD_MANUAL_ENCRYPT | DISABLE_DL_ENCRYPT |
| Encryption counter | SPI_BOOT_CRYPT_CNT, 3 bits: one plaintext cycle in DEVELOPMENT | FLASH_CRYPT_CNT, 7 bits: three plaintext cycles in DEVELOPMENT |
SECURE_VERSION | 16 bits | 32 bits, in BLK3 |
| Device secret | eFuse HMAC (KEY0), provisioned first | Pepper in encrypted NVS; no key step |
| Bootloader offset | 0x0 | 0x1000 |
| Upload guard reads eFuses | Yes | No: only the typed name; a classic bench console is refused |
| Booted hardened | One board, DEVELOPMENT | Never |
The revision requirement is the sharpest edge. Espressif’s Secure Boot v2 page for the ESP32 opens with “This document is about Secure Boot v2, supported on ESP32 (v3.0 onwards)” and adds that “Only one public key can be generated and stored in the chip during manufacturing.” In the build, a fragment, sdkconfig.secure.esp32rev3.opt-in, sets CONFIG_ESP32_REV_MIN_3=y, from which ESP-IDF derives ESP32_REV_MIN_FULL=300, which is the condition for RSA Secure Boot v2 to be offered at all. That fragment has to come before the secure fragment in the chain. Put it after, and the Secure Boot choice resolves to version 1 and the build fails. Either way, an image built for revision 3 does not boot on older silicon, and below revision 3.0 the download-mode menu does not even exist.
The cipher is different, too. Espressif’s classic flash encryption page describes AES-256 where “the key is “tweaked” with the offset address of each 32 byte block of flash”. That 32-byte row has a consequence for the vault: on classic, an encrypted vault requires the filesystem’s write unit not to split a row, and the LittleFS glue in the firmware refuses to build if it would.
The counter is more forgiving. FLASH_CRYPT_CNT has seven bits, so DEVELOPMENT leaves three plaintext reflash cycles where the S3 leaves one; the page says disabling “can only be done three times per chip”. In RELEASE the bootloader sets it to its maximum, and the comment in the app-side code shown earlier explains why the code avoids write-protecting it when it’s already full: on the classic chip, the write protection of FLASH_CRYPT_CNT shares a bit with UART_DOWNLOAD_DIS.
All of this is read from code and documentation. Nothing hardened has ever booted on a classic ESP32 in this project.
What has the bench board proven so far?
One board: the older of my two M5StickS3s, an ESP32-S3-PICO-1 revision v0.2 with 8 MB of flash, the same unit I used for the binding tests. It runs sticks3_secure_debug: Secure Boot v2 with the bench key, flash encryption in DEVELOPMENT, encrypted NVS, binding through KEY0, a debug console and a one-iteration KDF.
What worked on it, observed with ESP-IDF 6.0.3:
- Onboarding, unlocking after a reset and after real deep sleep, a failure counter that persists, a sealed copy round trip and the owner-change wipe.
- Reflashing with encrypted images. Seven writes on 2026-11-03, five of them with a changed image, each booting and keeping the binding; those changed images started on an erased vault. More in the rounds of 2026-11-04 and 2026-11-07. And 25 more on 2026-11-14 with the vault preserved, the vault opened after each write. A vault surviving a changed image is no longer an open question.
- Unlocking at the production count of 175,000 iterations, measured on console images from the line that prints the
PINprompt to the first home-screen frame, after a reset. The table below has the first round (2026-11-03) and the rounds of 2026-11-04 and 2026-11-07, which booted the way a production image boots. The two series come from different builds, so the difference between them is not separated, and I don’t treat either as “the unlock figure”. All of them exceed the ~2 s budget. - Reading the vault through a memory map helps on encrypted flash. In the read-path bench of 2026-11-14, at 250 credentials and 40 two-factor entries, the unlock took 3,020 ms reading the vault the plain way and 1,995 to 2,008 ms through a memory map, measured from the console.
| Credentials, two-factor | 2026-11-03 | 2026-11-04, 2026-11-07 |
|---|---|---|
| 30, 10 | 3,025 to 3,323 ms | 3,060 to 3,371 ms |
| 125, 20 | 3,332 to 3,897 ms | 3,385 to 3,958 ms |
| 250, 40 | 4,255 to 4,261 ms | 4,322 to 4,329 ms |
These are console images with logging on. A _secure image, with no console and no logs, has not been timed.
- A RELEASE image booting, on any board.
- Any hardened boot on a classic ESP32, or on the 16 MB table.
- How long the first boot takes (the half-minute figure is an estimate).
- A power cut during a write on a hardened board.
- An OTA update in this posture.
- A plaintext reflash cycle (read from code: it loses the vault).
- The dial creating the first vault after a wipe, and pairing and typing over Bluetooth, on the hardened board.
- A second board.
Why does an agent never start a _secure upload?
I do a lot of the firmware work with an AI coding agent in the repository. It builds the firmware and runs the test tooling. It does not start a _secure upload, ever. The firmware’s agent instructions say that an agent never initiates a _secure upload; that upload is mine to run. The rule exists because of everything above: every door in this post opens on the first boot after that upload, every one is permanent, and the build already knows which ones it is about to open. There is nothing for judgment to add at that moment, and one wrong environment name is enough to burn the wrong key’s digest into a board for good.
A rule in a text file is a request. So the build enforces it with scripts/secure_upload_guard.py, which PlatformIO loads as a post: script in every environment with _secure in its name; a variant check fails the build if one doesn’t load it.
The only free target is erase, which writes no image and passes without these checks. On a classic ESP32 the port and eFuse gates are skipped, because the guard does not read eFuses there.
| Check | On pass | On failure |
|---|---|---|
| Known upload target | Explicit port | Refuse or abort |
| Explicit port | eFuse preflight | Refuse or abort |
| eFuse preflight | Interactive terminal | Refuse or abort |
| Interactive terminal | Typed name equals env name | Refuse or abort |
| Typed name equals env name | esptool writes the image | Refuse or abort |
The guard covers 14 upload targets: the three named ones plus eleven auxiliary __upload-* targets, by putting itself into $UPLOADCMD. It refuses pio debug and any target it doesn’t know whose name contains “upload”. The only free target is erase, which writes no image and opens no door. On an S3 it reads the eFuses before it asks anything and requires an explicit port, so it is checking the board that is actually plugged in rather than whichever one the tooling guesses. For the bench console image it also checks that it is talking to the expected board and that the digest burned on it is not the production key’s, by comparing Secure Boot digests.
Then it asks. This is the core of it, from the guard itself:
prompt = "Type the environment name '{env}' to confirm:".format(env=env_name)
answer = _read_confirmation(prompt)
if answer is None:
_abort(
"Refusing to flash a *_secure build without an interactive "
"confirmation. Run the upload from an interactive terminal."
)
if answer.strip() != env_name:
_abort("Confirmation did not match. Nothing was flashed.")The confirmation is read from /dev/tty, not from standard input. That one detail is what makes it hold against an agent. An agent runs commands in a non-interactive shell: it can pipe text into a process’s standard input, and it can type the environment name as easily as I can, but it has no controlling terminal to answer from. Without one, _read_confirmation returns None and the upload aborts before esptool runs. Any answer other than the exact name aborts too. The agent isn’t trusted to decide not to flash; it is put in a position where it can’t produce the answer the upload needs.
That’s the thesis of this post in its smallest form. The safe agent is not the careful one. It is the one that cannot open the door.
There are other layers behind the guard:
- After the first boot, the guard has no path at all. Its eFuse preflight rejects a board with
SECURE_BOOT_ENburned, so a hardened board can’t take a second_secureupload through PlatformIO. Andesptoolitself refuses to write below0x8000on such a board unless forced. The bench board, already burned, is reflashed withesptooldirectly, outside the build system, and it is the only board treated that way: those writes open no new door. - The QA flasher that the test tooling uses refuses any environment whose name contains
secure. - On the classic ESP32 the guard can’t read eFuses, so the typed name is the only check, and it refuses a classic bench console outright.
The guard is not a sandbox, and I don’t pretend it is. A process that calls esptool directly never meets it, and nothing in a build script can stop someone with a shell and a USB cable. What it closes is the path a build tool takes, which is the path an agent would take by accident. The written rule covers the rest, and the eFuse preflight makes the most expensive mistake, burning a second key layout onto a board that is already hardened, structurally impossible through PlatformIO.
What is irreversible, and what can still be undone?
Put the whole post side by side and the doors sort into two lists.
- The boot key digest. Only images signed with that key boot. On the S3 slots 1 and 2 are revoked, so no key can be added. Lose the signing key and the board stays on its last image forever.
- Secure Boot itself, and flash encryption beyond the single plaintext cycle DEVELOPMENT leaves on the S3.
- Read-protecting any further key:
KEY3toKEY5can only ever hold readable data. - JTAG, on every hardened variant, in both modes.
- Direct boot, and cache access from download mode.
- In RELEASE also: encryption from download mode, serial reflashing, download mode itself, the write protection of the
DIS_ICACHEgroup, and an anti-rollback floor that only goes up. - The
HMAC_UPkey inKEY0, burned by the host before any of the above.
- The serial console.
- Full download mode:
espefusereads,read-flashof the ciphertext. - Unlimited encrypted reflashes of images signed with the bench key.
- Erasing
otadata, and rewriting the encrypted bootloader when forced. - One plaintext reflash cycle, which loses the vault.
The aggressive revocation in the RELEASE build belongs on the first list with a warning attached. With one key and the other two slots revoked, revoking that key on a failed verification leaves nothing to boot with. Espressif’s Secure Boot v2 page says it in a plain paragraph: “this could also brick the device permanently if all the keys are revoked because of signature verification failure.” The same page presents the feature as strong resistance to physical attacks; that sentence is its price.
What changed since June, and what was wrong from the start?
The first three posts in this series were published in June 2026, against the firmware as it was then. Some of that firmware has changed since, and some of what it did then was wrong. I’d rather separate the two than let the second hide behind the first.
Changed after June (true when written, different now):
_securewas a DEVELOPMENT build in June. On 2026-07-04 it became RELEASE, with download mode closed, anti-rollback, aggressive revocation and a silent console and panic;_secure_devwas created the same day to keep a DEVELOPMENT variant. The shared silence fragment arrived on 2026-08-21.- The device-binding provisioning did not exist: it arrived on 2026-10-25 and was proven on silicon on 2026-11-02.
sticks3_bound_debugdates from 2026-10-25;sticks3_secure_debugand the bench fragment from 2026-11-02. - The secure table changed on 2026-08-19: apps went from
0x300000to0x2C0000, and the vault from0x620000with0x1E0000to0x5A0000with0x260000. - The vault had no
encryptedflag in June; it has had it since 2026-11-03. - The upload guard only asked for the environment name in June. It started reading eFuses on 2026-10-25 and covered all 14 upload targets on 2026-11-02.
- The toolchain moved from ESP-IDF 6.0.1 with Mbed TLS 4.0.0 to 6.0.2 on 2026-07-06, and to 6.0.3 with Mbed TLS 4.1.1 and TF-PSA-Crypto 1.1.1 on 2026-09-22. I chose 6.0.3 over v6.1 because the v6.1 tag (2026-08-27) predates 6.0.3 (2026-09-02) and lacks the July and August fixes 6.0.3 carries.
- An M5Stack Gray had a
_secureenvironment in June; the Gray left the fleet on 2026-07-18.
Wrong from the start (fixed later):
- NVS overlapped the table’s signature. The June secure table put NVS at
0x11000,nvs_keyat0x15000andotadataat0x16000, inside the signature sector of the 8 KB signed table (0x10000to0x11FFF). It was moved to0x12000on 2026-11-02. No_secureimage had ever been flashed, so there was nothing to migrate. - The bootloader was never uploaded.
CONFIG_SECURE_BOOT_FLASH_BOOTLOADER_DEFAULTwas missing, so a Secure Boot v2 build would have left the old bootloader in place and never started its first hardened boot. Added on 2026-11-02. - The cipher was misnamed. The firmware’s June documentation said AES-256-XTS; the S3 actually uses XTS-AES-128, ESP-IDF’s default. Fixed on 2026-10-20. The classic chip uses its own AES-256 scheme, which is not XTS at all.
Neither of the first two reached a board: both were fixed on 2026-11-02, while preparing the first hardened boot, the day before it happened. A burned board is a bad place to find a partition overlap.
The honest costs and limits
- The evidence is one board, in DEVELOPMENT. Everything RELEASE-specific in this post (
DIS_DOWNLOAD_MODE,DIS_DOWNLOAD_MANUAL_ENCRYPT,WR_DISbit 2, the saturated counter, anti-rollback, aggressive revocation, the silent console) is read from code. No RELEASE image has booted. - Nothing hardened has booted on a classic ESP32, and nothing on the 16 MB table.
- Losing the signing key freezes the board. With one digest and two revoked slots there’s no second key to fall back on, and aggressive revocation can turn a bad verification into a brick.
- Anti-rollback blocks nothing yet: the security version is 1 across the fleet until a security release raises it.
- A dump still shows the layout: which vault blocks were written and how full they are.
- The ROM banner stays visible even in RELEASE; silencing it would be another irreversible eFuse on the S3, and the decision is still open.
- The first boot is slow and unmeasured: about half a minute to encrypt the 608 vault sectors is an estimate.
- The 4 MB boards never get Secure Boot or flash encryption; they have the vault’s own encryption and nothing below it.
- Building is always safe, the open
_releasebuilds burn nothing, and a DEVELOPMENT board keeps taking signed, encrypted images with its vault intact, as the 25 writes of 2026-11-14 showed.
Wrap: the build knows which doors it opens
Strip away the fuse names and the design is a sequence that only runs forward. The host burns the binding key while read protection is still possible. The first boot commits Secure Boot’s batch, then flash encryption’s, then encrypts the flash, then flips the counter, and at no point can it step back. DEVELOPMENT and RELEASE close the same core doors, JTAG included, and differ in whether the serial path stays open for signed, encrypted images. None of that is a judgment the device makes at runtime; it is all decided by which fragments the environment chains, before the image exists.
That is what makes the last rule easy to state. If the build already knows every door it will open, the only remaining decision is whether to start, and that decision belongs to someone who can be held to it. So the upload asks for a typed name on a real terminal, and an agent, which has no terminal, simply can’t give it.
The next question at the device’s boundary is the one the not-observed list keeps pointing at: how a signed update gets in once the serial door is shut, and what the board does when one fails halfway. That is the next post.
Frequently asked questions
In what order does an ESP32-S3 burn its security eFuses on the first hardened boot?
In ESP-IDF 6.0.3 the bootloader first enables Secure Boot v2 and commits that eFuse batch (the public key digest, the revoked spare digest slots, SECURE_BOOT_EN, direct boot off and JTAG off). Then it generates the flash encryption key on the chip and commits a second batch with the key and flash encryption's own protections, including the download-mode cache bits. Only then does it encrypt the flash in place, write SPI_BOOT_CRYPT_CNT and reset.
Does DEVELOPMENT mode flash encryption leave JTAG open on ESP32-S3?
No. Secure Boot v2 and flash encryption each burn the JTAG-disable eFuses on the first boot unless CONFIG_SECURE_BOOT_ALLOW_JTAG is set, and that option defaults to off. A DEVELOPMENT board therefore has JTAG closed for good, the same as a RELEASE one. What DEVELOPMENT leaves open is ROM download mode: reading eFuses, reading the ciphertext and writing encrypted images signed with the burned key.
What is the difference between DEVELOPMENT and RELEASE flash encryption on ESP32-S3?
DEVELOPMENT leaves the serial download mode working, so a board can keep taking encrypted images signed with its key, and leaves one plaintext reflash cycle in the 3-bit counter. RELEASE also burns DIS_DOWNLOAD_MANUAL_ENCRYPT and the write protection of the cache-disable group, sets the counter straight to its maximum, and in Kleidos's secure build closes download mode entirely, so new images arrive only through signed OTA updates.
Why must the eFuse HMAC key be burned before the first hardened boot?
The first hardened boot burns WR_DIS.RD_DIS, after which no further eFuse key block can be made unreadable. A device-binding key burned after that point would sit in a readable block, which defeats the reason for putting it in an eFuse. So the host provisions the HMAC_UP key into KEY0, read-protected, before the board ever boots a secure image, and the upload guard refuses to start without it.
Can an ESP32-S3 be reflashed after Secure Boot v2 and flash encryption are enabled?
In DEVELOPMENT, yes: encrypted images signed with the burned key can be written over serial without a limit in the code, and the same bench board took 25 such writes on 2026-11-14 with its vault preserved. In RELEASE the download mode is closed, so the only way in is a signed OTA update. Neither mode can boot an image signed with a different key.
Why does an AI agent never start a _secure upload?
Because every door that upload opens is permanent and the build already knows which ones they are. Each _secure environment loads a guard that reads the eFuses first and then requires the environment name typed at an interactive terminal. An agent has no terminal to answer from, so its upload aborts, and the rule in the firmware's agent instructions says an agent never initiates one.
Further Reading & Resources
- previous post jmrp.io
- a hardware password manager I'm building kleidos.dev
- Secure Boot v2 page for the ESP32-S3 Espressif
- HMAC page Espressif
- bootloader_utility.c GitHub
- esp_secure_boot_v2_permanently_enable() GitHub
- esp_secure_boot_enable_secure_features() GitHub
- esp_flash_encrypt_init() GitHub
- flash encryption page for the S3 Espressif
- esp_flash_encrypt_contents() GitHub
- esp_flash_encrypt_enable() GitHub
- the S3 eFuse table GitHub
- OTA anti-rollback section Espressif
- flash-encryption-based NVS scheme Espressif
- in Kconfig.projbuild GitHub
- S3 security overview Espressif
- in RELEASE the default is secure download mode GitHub
- app-side flash_encrypt.c GitHub
- the encrypt-then-MAC post jmrp.io
- the encrypt-then-MAC post jmrp.io
- kleidos.dev lists among its residual risks kleidos.dev
- kleidos.dev states too kleidos.dev
- Secure Boot v2 page for the ESP32 Espressif
- classic flash encryption page Espressif
- the next post jmrp.io