#Why this matters
Signed firmware and mTLS certificates protect software and network channels, but an attacker holding the physical circuit board can desolder SPI flash, swap bootloader blocks, or observe the processor's power rail during cryptographic operations. If the silicon itself has no hardware Root of Trust, software checks can be patched out before the operating system ever starts.
At the same time, hardware defenses must account for physical physics. Even mathematically sound algorithms like AES-256 or ECDSA can leak key bits through tiny variations in power draw, or fail completely when a precisely timed voltage dip skips a single conditional branch.
#Root of Trust and Secure Boot chain
Secure Boot enforces that every piece of code runs only after its cryptographic signature passes verification. The chain starts at power-on inside mask BootROM, which is fixed in silicon at fabrication and cannot be modified.
- BootROM (immutable)Read public key hash from OTP eFuses
- First-Stage LoaderVerify signature before loading into SRAM
- Bootloader (U-Boot)Verify kernel and device tree signatures
- Kernel & RootfsMount verified filesystem (dm-verity)
During manufacturing, the vendor burns a SHA-256 hash of the root public key into one-time programmable (OTP) eFuses inside the SoC. On boot, the BootROM hashes the public key bundled with the first-stage bootloader, confirms it matches the eFuse digest, and verifies the image signature. If any stage fails verification, execution halts instead of falling back to an unsigned shell.
#TPM 2.0, PCRs and key sealing
While Secure Boot blocks unauthorized code, Measured Boot records what actually booted using a Trusted Platform Module (TPM 2.0). Inside the TPM, Platform Configuration Registers (PCRs) store SHA-256 digests of firmware, configuration data, and boot arguments.
A PCR cannot be overwritten directly; software can only extend it:
PCR_new = SHA256(PCR_old || measurement_digest)Because each extension mixes the previous state with the new measurement, tampering with any early stage changes every subsequent PCR value. Two core capabilities build on this:
- Key sealing: The TPM wraps an mTLS private key or disk encryption key under a policy requiring specific PCR digests (for example,
PCR 0for firmware andPCR 7for Secure Boot state). If an attacker swaps the kernel or alters boot arguments, the PCRs diverge and the TPM refuses to unseal the key. - Remote attestation: A device requests a signed TPM quote over its PCRs using an Attestation Key (AK) and sends the quote plus the event log to a verifier before receiving network credentials.
$ tpm2_pcrread sha256:0,7
sha256:
0 : 0x4A8C1F02E3B90D44A71E8F2C6B5D9031C4E7A2018B3F56D9E2C104A8B7F3E210
7 : 0x91D3C804A2F61B7E50C9D4A1F83B6E2074A5D9C3E18B20F6D4A7C91E3B502847#Side-channel power leaks: SPA and DPA
A processor switching transistors from 0 to 1 draws slightly more current than leaving them unchanged. Measuring voltage drop across a small shunt resistor on the VDD rail lets an analyst observe computation indirectly.
| Attack type | Traces needed | How it works | Primary countermeasures |
|---|---|---|---|
| Simple Power Analysis (SPA) | 1 to few | Reads visible branch patterns (e.g., key-bit if branches in RSA/ECC) |
Constant-time, branchless execution |
| Differential Power Analysis (DPA) | Hundreds to thousands | Correlates power samples with guessed S-box output Hamming weights | Masking intermediates with fresh randomness; hiding |
| Timing side channel | Many remote/local | Measures execution duration differences on secret inputs | Constant-time comparisons and arithmetic |
In SPA, an unhardened modular exponentiation loop executes a multiplication only when the secret key bit is 1, creating two distinct waveform shapes visible to the naked eye. In DPA, even constant-time AES leaks subtly because the Hamming weight of SBox(plaintext_byte ^ key_byte) correlates with current draw at the clock edge writing that byte to a register. By testing all 256 possible subkey byte values across captured traces, the true byte produces the sharpest correlation peak.
#Fault injection and glitching
Instead of passively listening, fault injection actively disrupts the chip to alter control flow. Common physical techniques include momentarily pulling the core power rail low (voltage crowbar glitching), injecting an extra fast clock edge (clock glitching), or pulsing a localized electromagnetic (EM) coil over the die.
Consider a naive C signature check in a bootloader:
/* Vulnerable: a single skipped branch grants unsigned execution */
if (verify_signature(image, len) != 0) {
halt_device();
}
boot_image(image);If a voltage glitch causes the CPU to mis-fetch or skip the conditional jump (BNE) right after verify_signature, execution falls straight into boot_image(image). Hardened boot code assumes any instruction can fault: it uses redundant inverted checks, non-trivial magic return constants (not 0 and 1), random jitter before critical decisions, and hardware brown-out or glitch detectors that reset the core on out-of-range voltage.
#Defending and common mistakes
- Leaving JTAG/SWD unlocked in production: An open debug port lets an attacker halt the CPU after Secure Boot finishes and dump RAM or patch checks directly; fuse debug interfaces closed or require signed debug authentication tokens.
- Unfused or writable key hashes: Storing the root public key in external SPI flash instead of OTP eFuses allows trivial key replacement.
- Incomplete PCR sealing policies: Sealing disk keys only to
PCR 0ignores bootloader config and kernel command-line parameters (init=/bin/sh), letting an attacker gain a root shell while keepingPCR 0valid. - Early-exit secret comparisons: Using
memcmpor returning on the first mismatched byte leaks secrets over timing and power channels; always accumulate XOR differences across the full length.
#Summary
Hardware security anchors system integrity in an immutable BootROM and eFuse Root of Trust, ensuring only verified code runs during Secure Boot. Measured Boot extends cryptographic digests into TPM 2.0 PCRs so secrets remain sealed unless the entire boot chain matches a known-good policy. Because physical access exposes chips to power side channels and voltage or clock glitching, robust embedded designs pair hardware roots of trust with constant-time code, masking, disabled debug ports, and fault-resistant verification logic.