How Does Secure Boot Work? The Chain of Trust Explained

Secure boot makes a device run only software signed by its owner. Immutable code in the chip's boot ROM, the root of trust, checks a digital signature on the first bootloader before running it; that bootloader checks the next stage the same way, and so on up to the application. Each link vouches for the next, so a chain of trust runs from silicon to software, and a modified stage fails its check and does not run.

Before you start

This is defensive knowledge, for building and testing your own hardware or hardware you are authorized to test. It explains mechanisms and defenses with references to published research. It does not give step-by-step attacks on products or systems you don't own.

What you'll learn

  • Hashes and signatures, briefly
  • The root of trust and why it must be immutable
  • How each stage verifies the next
  • Where the public key lives, and why only its hash is stored
  • Rollback protection, and measured boot vs verified boot

The building blocks

A hash function such as SHA-256 maps an image of any size to a fixed 32-byte digest; changing any bit changes the digest unpredictably. A digital signature is made with a private key over that digest and checked with the matching public key. The vendor keeps the private key offline and signs each release; the device holds only what it needs to check.

ItemSize
SHA-256 digest32 bytes
ECDSA P-256 signature64 bytes
RSA-3072 signature384 bytes

The root of trust

The first check has to be done by code that cannot itself be changed, or an attacker would simply replace the checker. That is the boot ROM, masked into the silicon, together with a value written once into one-time-programmable fuses (eFuses or OTP). Storing a full public key in fuses is expensive, so chips usually store the hash of the public key: the bootloader carries its own public key, and the ROM accepts it only if its hash matches the fused value.

The chain, step by step

  • Power on: the CPU starts in the boot ROM.
  • The ROM loads the second-stage bootloader and its signature block, which contains the public key and a signature.
  • The ROM hashes that public key and compares it with the digest in the fuses. A mismatch stops the boot.
  • The ROM verifies the bootloader's signature with that key. A failure stops the boot.
  • The bootloader verifies the application image the same way, then jumps to it.
The chain of trustThe immutable boot ROM checks the bootloader's key against a digest in eFuses and verifies its signature; the bootloader then verifies the application.Boot ROMimmutableBootloader2nd stageApplicationeFuseskey digestverifyverify
Each stage verifies the next before running it; the fused key digest anchors the chain in silicon.

A real example: ESP32 Secure Boot v2

Espressif's ESP32 documents exactly this scheme. The first-stage ROM bootloader verifies the second-stage bootloader's RSA-PSS signature before running it, and the second-stage bootloader verifies the application's signature. Each signature block contains the RSA-3072 public key, and a digest of that public key is stored in eFuse. If you build the CAN bus project on an ESP32 and enable secure boot, this is the chain that protects it.

Rollback protection

A valid signature is not enough if an old, correctly signed image has a known vulnerability: an attacker could reinstall it. Rollback protection stores a minimum security version in monotonic counters (often fuses that can only be burned, never cleared); each image carries a version, and the bootloader refuses anything older than the counter.

Verified boot vs measured boot

Verified boot, described above, refuses to run unsigned code. Measured boot runs whatever is there but records a hash of each stage in tamper-resistant registers, such as a TPM's platform configuration registers, so a remote server can check later exactly what booted (remote attestation). PCs typically use both.

Common mistakes

  • Leaving the debug port (JTAG) open, which bypasses the chain entirely.
  • Enabling signature checks without encrypting flash when the firmware itself is secret. Signing gives integrity, not confidentiality.
  • Losing the private signing key, or keeping it on a build server.
  • Forgetting rollback protection.
  • Treating secure boot as protection after boot. It checks what starts, not what happens at run time.

Check your understanding

  • Q1. Why must the first verifier be in ROM? Answer: if it could be modified, an attacker would replace the checker along with the code it checks.
  • Q2. Why store a hash of the public key in fuses rather than the key? Answer: fuse bits are scarce; a 32-byte digest is enough to recognize the right key, which the image itself carries.
  • Q3. What does rollback protection stop? Answer: reinstalling an older, correctly signed image that has a known vulnerability.

The series

Related

Sources

Last verified

The ESP32 Secure Boot v2 details were checked against Espressif's documentation on 16 November 2026; the sizes are computed in the site's tests (lib/batch9Numbers.test.js).