A connected microcontroller may execute firmware for:
- motor control,
- sensing,
- communications,
- industrial automation,
- IoT.
If an attacker can replace that firmware, almost every other security mechanism can be bypassed.
Secure boot addresses this problem.
Its purpose is simple:
run only firmware that the device is authorized to trust.
Fundamentals and Technology Overview
What Is Secure Boot?
Secure boot is a startup process that authenticates software before execution.
A typical chain is:
Boot ROM → Bootloader → Application Firmware
Each stage verifies the next stage.
Firmware Authentication
Firmware authentication verifies that the software came from an approved signer.
This commonly uses:
- digital signatures,
- public-key cryptography.
Integrity vs Authenticity
Integrity
Confirms firmware has not changed.
Authenticity
Confirms the firmware was signed by an approved authority.
A cryptographic hash provides integrity information.
A digital signature adds authentication.
Root Public Key
The device needs a trusted public key or trust anchor.
It may be stored in:
- ROM,
- OTP,
- secure element,
- protected Flash.
Boot ROM
Boot ROM is useful because it is:
- immutable after manufacturing.
This makes it a strong first verification stage.
Secure Boot Flow
A simplified flow is:
- reset,
- boot ROM starts,
- firmware header is read,
- hash is calculated,
- digital signature is verified,
- version policy is checked,
- firmware runs only if valid.
Digital Signatures
Common signature systems include:
- ECDSA,
- RSA.
Newer devices are beginning to incorporate:
- post-quantum signature verification.
Hashing
Hash algorithms such as SHA-256 produce a fixed-size digest of firmware.
Any firmware modification changes the hash.
Encryption vs Authentication
Firmware encryption hides the code.
Firmware authentication proves:
- integrity,
- origin.
A secure system may use both.
Secure Firmware Install
Manufacturing also creates security risk.
A contract manufacturer may have access to:
- firmware binaries,
- programming infrastructure.
ST's Secure Firmware Install mechanism protects firmware confidentiality and authenticity during programming into STM32 devices.
Secure Firmware Update
A device should authenticate every field update.
Never assume an update is trusted simply because it arrived through:
- HTTPS,
- USB,
- local network.
The image itself should be cryptographically verified.
Safety, Security, and Reliability
OTA Update Flow
A secure OTA process may:
- download candidate firmware,
- verify signature,
- verify version,
- write inactive bank,
- boot test,
- commit,
- roll back if necessary.
Dual-Bank Flash
Dual-bank memory allows:
- old firmware in one bank,
- new firmware in another.
This improves update resilience.
Rollback Protection
An attacker may install a legitimate but old vulnerable image.
Anti-rollback mechanisms compare:
- version number,
- monotonic counter.
Key Revocation
If a signing key is compromised, the product needs a way to stop trusting it.
Recovery Mode
Secure recovery should also be authenticated.
An unsecured recovery loader can become a bypass around secure boot.
Debug Lock
A secure boot design is weakened if attackers can use debug interfaces to:
- rewrite firmware,
- read secrets.
Production devices should control:
- JTAG,
- SWD.
ST STM32 Security
ST's current MCU security guidance covers:
- firmware IP protection,
- private data protection,
- communication security.
Secure firmware install is designed to provide:
- confidentiality,
- authentication,
- integrity
during programming.
Microchip Secure Boot
Microchip security devices and controllers support features such as:
- immutable root of trust,
- secure boot,
- secure updates,
- rollback protection.
Secure Boot and TrustZone
TrustZone protects runtime domains.
Secure boot establishes that the trusted software loaded into those domains is authentic.
These technologies complement each other.
External Flash Boot
Systems booting firmware from external SPI/QSPI Flash face additional risk because the memory is physically accessible.
A root-of-trust controller can verify external firmware before the main SoC executes it.
Firmware Confidentiality
Encryption may be important when firmware contains:
- proprietary algorithms,
- AI models,
- customer IP.
Implementation, Testing, and Optimization
Authentication Metadata
A secure image may include:
- version,
- image length,
- algorithm ID,
- signature,
- hash.
The metadata itself must be protected from tampering.
Manufacturing Key Management
Signing keys should remain in:
- HSM,
- controlled signing service.
Never embed the private signing key into factory programming software.
Development vs Production Keys
Use separate keys for:
- development,
- production.
Production devices should not trust test keys.
Boot Time
Cryptographic verification adds startup latency.
Hardware crypto accelerators can reduce this cost.
Fail-Safe Behavior
If verification fails, the device should:
- reject image,
- enter secure recovery,
- never execute untrusted code.
Common Mistake: Hash Without Signature
A stored hash is useless if an attacker can replace both:
- firmware,
- expected hash.
Common Mistake: No Anti-Rollback
Signed old firmware can still be dangerous.
Common Mistake: Unsecured Recovery Loader
Recovery must follow the same trust rules.
Common Mistake: Leaving Debug Open
Debug access can defeat firmware protection.
Common Mistake: Keys in Source Code
Private keys should never exist in application source or firmware images.
Design Workflow
- Select immutable trust anchor.
- Generate production signing keys.
- Implement image format.
- Verify hash and signature.
- Add version policy.
- Add rollback protection.
- Protect debug.
- Implement secure updates.
- Implement authenticated recovery.
- Test fault and power-loss cases.
Conclusion
Secure boot is the process that prevents an embedded device from executing unauthorized firmware.
The strongest implementations combine:
- immutable root of trust,
- digital signatures,
- rollback protection,
- key revocation,
- authenticated updates,
- secure recovery.
The key principle is:
every executable image should be authenticated before trust is extended to it.