Skip to main content

Secure Boot and Code Signing

1 Scope​

Establish a chain of trust from the SoM's immutable boot ROM to the application image: on E1M-AEN the Alif Secure Enclave ROM hands off to MCUboot, which verifies the application's ECDSA-P256 signature against a public key compiled into the bootloader before chaining in. This AN walks the dev-key bench flow and the production-key lifecycle. On E1M-AEN, MCUboot is built single-slot (SB_CONFIG_MCUBOOT_MODE_SINGLE_APP=y): there is no secondary or scratch slot, so there is no A/B swap and no rollback. An image that fails verification is refused, and the module stays in MCUboot until a correctly signed image is written to slot0.

The production lock-down is destructive — blowing the SoM's debug-disable fuse is permanent and cannot be undone, and once a production public key is baked into a fielded bootloader only images signed by the matching private key will boot. Read the Production Key Management section fully before locking down any module that will leave your bench.

Warning:

Do not architect key management around the OPTIGA Trust M secure element. No E1M-AEN module fits a secure element: the OPTIGA Trust M is fitted only on E1M-X V2N and E1M-X V2N-M1. On those two modules the Alp SDK™ v0.17.0 driver is partial: probe, Coprocessor UID and a raw APDU session only, with no typed key generation, key export or signing call and no PSA driver. The production signing key today lives on an air-gapped signing workstation. See Production Key Management.

Table 1 Scope summary
AudienceSecurity engineers shipping fielded firmware that must not be replaced by attackers.
PrerequisitesAn AEN EVK or E1M-AEN module, the SDK checked out, OpenSSL 3.0+, and the MCUboot imgtool that ships with the Zephyr build. For fielded units, an air-gapped signing workstation holding the production key; this AN uses the SDK's dev key only for the bench walk-through.
OutcomeModule's MCUboot bootloader accepts only firmware signed by the trusted key; unsigned or wrong-key firmware is refused at boot.
Time60 minutes (key generation is fast; understanding the implications is the long pole).
Sourcedocs/secure-boot.md and docs/tutorials/10-secure-boot-signing.md in alp-sdk.

2 Step 1 — Generate Signing Keys​

AEN secure boot uses ECDSA-P256 throughout. For the bench, nothing needs generating: zephyr/sysbuild/aen/sysbuild.conf signs with the committed shared development key keys/mcuboot_shared_dev_ecdsa_p256.pem, which the factory MCUboot on Alp Lab pre-provisioned E1M-AEN modules trusts.

Warning:

The shared development key is public and gives no security: anyone can sign images for a module still running the factory MCUboot.

To use your own dev key instead, generate it once with the SDK helper (idempotent — it preserves an existing key):

cd alp-sdk
bash keys/generate_dev_key.sh

Expected output starts with:

Generating ECDSA-P256 dev signing key at <abs>/keys/mcuboot_dev_ecdsa_p256.pem...

The key is written to the .gitignored file keys/mcuboot_dev_ecdsa_p256.pem; never commit it. Then build with -DSB_CONFIG_BOOT_SIGNATURE_KEY_FILE=<abs>/keys/mcuboot_dev_ecdsa_p256.pem and re-provision the module with the MCUboot from that build. The factory MCUboot refuses images signed with this key.

For production, generate the key the same way but on an air-gapped workstation, and keep the private half there. Only the public half travels to the build host, as keys/mcuboot_prod_ecdsa_p256.pub.pem. See Production Key Management below.

Warning:

Treat the production signing key like the master key it is. Losing it means no future firmware can be installed on any device whose bootloader trusts it; leaking it means anyone can install firmware on every such device. Back it up offline, in a safe, before you sign the first production image. The dev key under keys/ is for the bench only.

3 Step 2 — Build and Sign a Firmware Image​

Sysbuild builds the MCUboot bootloader and the application together, and signs the application as part of the build:

west build -b alp_e1m_aen801_m55_he/ae822fa0e5597ls0/rtss_he examples/peripheral-io/hello-world \
--sysbuild \
-- -DSB_CONF_FILE=/abs/path/to/alp-sdk/zephyr/sysbuild/aen/sysbuild.conf

The sysbuild config is a CMake define passed after --, not a west build flag. The path must be absolute: sysbuild resolves a relative SB_CONF_FILE against APP_DIR, not the directory you ran the command from.

(If your board.yaml carries a boot: block, the loader emits the matching overlay at build/alp_sysbuild.conf, which becomes the canonical SB_CONF_FILE path.)

The build produces the bootloader at build/mcuboot/zephyr/zephyr.bin and the signed application at build/zephyr/zephyr.signed.bin (the raw build/zephyr/zephyr.bin is unsigned — don't flash it). The signed image is structurally:

+----------------------------+
| MCUboot image header |
| (0x200 B: version, size) |
+----------------------------+
| firmware (application) |
+----------------------------+
| TLV trailer |
| ECDSA-P256 signature + |
| SHA-256 image hash |
+----------------------------+

On E1M-AEN, west flash refuses MCUboot (sysbuild) builds on every module (alp-sdk2274), and a plain west flash also refuses on pre-provisioned modules (2262).

Warning:

Do not override the refusal with --replace-atoc: it deletes the factory MCUboot ATOC entry and leaves the module unable to boot.

On a module whose MCUboot is already provisioned, write only the signed application to slot0 (0x80010000) over J-Link, following alp-sdk docs/aen-provisioning.md §0.5 Option B. Prefer the scripted path scripts/bench/aen/flash-jlink-mramxip.sh: it pads the image to 16 KiB sector boundaries and proves the write with a fresh read-back. The raw JLinkExe session (device AE822FA0E5597LS0_M55_HE, loadbin build/zephyr/zephyr.signed.bin 0x80010000) has two hazards (alp-sdk2233). It erases the rest of any partially-covered 16 KiB sector to 0xFF. Its verifybin checks J-Link's cache, not MRAM, so confirm the write with a fresh-session read instead. Option B writes the application only: a module without a resident MCUboot will not boot until MCUboot is provisioned with the SETOOLS flow in zephyr/sysbuild/aen/README.md.

MCUboot verifies the ECDSA-P256 signature in the TLV trailer before chaining into the application. On an invalid signature it refuses the image. On E1M-AEN (single-slot MCUboot) there is no previous image to fall back to: the module stays in MCUboot until a correctly signed image is written to slot0.

4 Step 3 — Compile the Production Key into the Bootloader​

There is no public-key-hash fuse to burn on AEN. The trust anchor is the public key compiled into the MCUboot bootloader. The production lifecycle:

  1. Generate the production key pair on an air-gapped workstation. The private half stays on that machine and is never copied to a networked host.
  2. Carry the public half out (USB, or read it off the screen) and commit it as keys/mcuboot_prod_ecdsa_p256.pub.pem. Only the public half leaves the air gap.
  3. Compile the bootloader against the production public key by overriding SB_CONFIG_BOOT_SIGNATURE_KEY_FILE to point at that file when building MCUboot for production firmware.
  4. Sign release images on the air-gapped workstation. Copy the unsigned image in, run imgtool sign against the private key, copy the signed image out.
  5. Lock the module down by blowing the debug-disable fuse (see the per-SoM bring-up doc / QS- guide) so JTAG/SWD can no longer overwrite the bootloader region.

The recommended way to wire this is a top-level boot: block in your project's board.yaml; the loader emits the matching SB_CONFIG_* overlay automatically:

# board.yaml
boot:
method: mcuboot
signing:
algorithm: ecdsa_p256
key_file: keys/mcuboot_prod_ecdsa_p256.pub.pem

Slot and scratch sizes are not board.yaml fields. MCUboot takes its slot geometry from the board device-tree partitions; use the storage: block to declare the project's own partition table. (Alp SDK™ v0.11.0 removed the slots:, scratch_size_kib: and anti_rollback: keys from the boot: block, which rejects unknown keys — a board.yaml still carrying them fails validation.)

Warning:

Once the production key is compiled in and the debug-disable fuse is blown, the module accepts only firmware signed by the corresponding private key, and the lock-down cannot be undone. Test the full signing flow with the dev key on an EVK before committing a production key to any unit that will leave your bench.

5 Step 4 — Verify​

Power-cycle the module. On the UART you should see the MCUboot banner accept the image and hand off to the application:

*** Booting MCUboot v1.x ...
[INF] Starting bootloader
[INF] Image index: 0, Swap type: none
...
[hello] ALP SDK hello-world starting

Then sign with the wrong key and re-flash to confirm rejection:

openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 \
-out /tmp/fake_key.pem

imgtool sign --key /tmp/fake_key.pem --version 0.1.0 \
--header-size 0x200 --align 16 --slot-size 0x2A0000 --pad-header \
build/zephyr/zephyr.bin /tmp/zephyr.fakesigned.bin

Write /tmp/zephyr.fakesigned.bin to slot0 with the same J-Link slot0 write described in Step 2 (not west flash, which refuses on E1M-AEN).

MCUboot output:

*** Booting MCUboot v1.x ...
[INF] Starting bootloader
[INF] Image index: 0, Swap type: none
[ERR] Image in the primary slot is not valid!
[ERR] Unable to find bootable image

MCUboot refuses to chain into the wrongly-signed image and halts. Restore a properly-signed image to recover.

6 Production Key Management​

For production, the bench dev key is not acceptable. Recommended set-up:

Table 2 Production key store
StoreNotes
Air-gapped signing workstation — use this todayThe practical production key store on every current SoM. The private key is generated on and never leaves a permanently disconnected machine; unsigned images are copied in and signed images copied out over removable media. Compromise of the dev key or the build host does not yield production signing power — only physical access to the workstation does. Its weakness is that the key exists as a file, so physical security, disk encryption, and an offline backup carry the whole guarantee.
Per-generation key rotationGenerate the next-generation key pair on the same air-gapped workstation, compile the bootloader with both public keys so either is accepted, roll the new key out via OTA signed by the current key, then retire the old key after one update window (typically 90 days).
OPTIGA Trust M secure element — future workNot usable as a key store today. The part is not fitted on any E1M-AEN module; on E1M-X V2N and E1M-X V2N-M1, which fit it, the v0.17.0 driver is partial (probe, Coprocessor UID and a raw APDU session over Infineon's host library). There are no typed key generation, key export or signing calls and no PSA driver behind <alp/security.h>. Design the product so the key store can migrate later; do not depend on it now.
Note:

The SDK ships examples/v2n/v2n-secure-element-sign and examples/aen/aen-secure-element-sign to verify the probe contract — they confirm the chip ACKs and that the signing entry points cleanly refuse, rather than fabricating a signature. Despite the names, they do not sign anything. docs/tutorials/06-secure-element-sign.md walks the same contract.

7 Troubleshooting​

Table 3 Common failures
SymptomLikely cause / fix
Build complains about the signing-key algorithmAEN secure boot uses ECDSA-P256. Set signing.algorithm: ecdsa_p256 in the board.yaml boot: block (or use the stock sysbuild profile) and a matching key_file.
MCUboot logs Image in the primary slot is not valid!The image was signed with a key the bootloader doesn't trust. Rebuild with the key_file that matches SB_CONFIG_BOOT_SIGNATURE_KEY_FILE, then reflash a properly-signed image.
Module won't boot after compiling a production keyThe bootloader was built against a different public key than the one signing the image. Recovery is reflashing a correctly-signed image — unless the debug-disable fuse is already blown, in which case the unit is unrecoverable.
MCUboot reports the image is too large for the slotThe signed image exceeds the slot size. Trim the firmware — a smaller image is the only in-project remedy. Slot geometry is not settable from board.yaml: MCUboot takes it from the board device-tree partitions, so growing a slot is a change to the board definition in the SDK, not a per-project field. Check build_type: MinSizeRel and drop unused libraries first.
Updated image boots once then revertsNot applicable to E1M-AEN (single-slot MCUboot): there is no swap, no test image and no revert.
OPTIGA calls fail on E1M-AENExpected: no E1M-AEN module fits the OPTIGA Trust M, so optiga_trust_m_init() returns ALP_ERR_NOT_READY (no ACK at 0x30). On E1M-X V2N and E1M-X V2N-M1, which fit it, the v0.17.0 driver is partial (probe, Coprocessor UID, raw APDU session); there are no typed keygen/sign calls, so keep using the air-gapped signing workstation.

8 References​

  • Canonical doc: docs/secure-boot.md, docs/tutorials/10-secure-boot-signing.md, and docs/adr/0006-secure-boot-secure-ota.md in alp-sdk.
  • SDK tooling: keys/generate_dev_key.sh, west build --sysbuild, MCUboot imgtool, west flash.
  • Examples: examples/aen/aen-mcuboot-smoke (MCUboot smoke test), examples/peripheral-io/hello-world.
  • Secure element (probe contract only): docs/tutorials/06-secure-element-sign.md, examples/v2n/v2n-secure-element-sign, examples/aen/aen-secure-element-sign, header <alp/chips/optiga_trust_m.h> (see its @par Driver scope: [PARTIAL]).
  • Companion AN: AN-006 (OTA updates with signed images), AN-007 (mproc mailbox — the M33 firmware must be signed too).
  • Vendor reference: Alif Secure Enclave / Ensemble documentation (AEN); Infineon OPTIGA Trust M Solution Reference Manual; for V2N M33 secure boot see docs/rzv2n-m33-secure-boot.md (Renesas RZ/V2N TF-A BL2 chain).

9 Revision History​

Table 4 Revision History
RevisionChangesDate
0.1
  • Initial draft.
May 2026
0.2
  • Aligned with current alp-sdk: AEN secure boot is MCUboot + ECDSA-P256 (not RSA-PSS/boot-ROM OTP).
  • Replaced the invented west sign/alp-fuse pubkey-hash flow with the real keys/generate_dev_key.sh dev key, sysbuild build, imgtool signing, OPTIGA Trust M production-key lifecycle, and SB_CONFIG_BOOT_SIGNATURE_KEY_FILE.
  • Fixed example path (examples/peripheral-io/hello-world), board target (alp_e1m_evk_aen), MCUboot console output, troubleshooting, references, and canonical-source header.
June 2026
0.3
  • Corrected the key-store story: the OPTIGA Trust M driver is probe-only — it confirms the part ACKs and returns ALP_ERR_NOSUPPORT for product-info, raw APDUs, CalcSign, GenKeyPair and ECDH, so on-chip key generation, export and signing are unavailable today.
  • The air-gapped signing workstation is now presented as the practical key store and the secure-element path as future work, with a warning against architecting product key management around it.
  • Removed a troubleshooting row citing a Kconfig symbol that does not exist.
  • Fixed the Alp SDK repository links (alpDevs → alplabai).
July 2026
0.4
  • Retensed to Alp SDKTM v0.11.0.
  • Replaced --sysbuild-config, a flag that has never existed in any Zephyr — west forwarded it to CMake and the configure died with Unknown argument --sysbuild-config — with -- -DSB_CONF_FILE=<absolute path>, noting that sysbuild resolves a relative path against APP_DIR rather than the cwd.
  • Removed the slots: key from the production board.yaml snippet and rewrote the "image too large for the slot" troubleshooting row, which sent readers to slots.primary.size_kib: v0.11.0 removed slots:, scratch_size_kib: and anti_rollback: from the boot: block, so both the snippet and the suggested remedy now fail schema validation.
  • Slot geometry comes from the board device-tree partitions.
July 2026
0.5
  • Replaced the phantom board target alp_e1m_evk_aen in the Step 2 build command with the real fully-qualified target alp_e1m_aen801_m55_he/ae822fa0e5597ls0/rtss_he (E1M-AEN801 HE, Alif Ensemble E8): the old identifier resolves nowhere in the alp-sdk board tree, so the documented west build failed at board resolution.
July 2026
0.6
  • Re-verified against Alp SDKTM v0.17.0.
  • Scoped the OPTIGA Trust M "not fitted" statements to E1M-AEN801 and E1M-AEN803 (the SDK marks the part assembled: false on those two modules only) instead of every E1M-AEN module.
  • Described the v0.17.0 OPTIGA driver scope (probe, Coprocessor UID, raw APDU session; no typed key generation or signing).
October 2026
0.7
  • Corrected the OPTIGA Trust M fitment: no E1M-AEN module fits a secure element (DS-AEN-001 0.13, secure element removed); the part is fitted only on E1M-X V2N and E1M-X V2N-M1.
  • The warning, the key-store table and the troubleshooting row no longer imply that E1M-AEN modules other than E1M-AEN801 / E1M-AEN803 fit it.
October 2026
0.8
  • Release history: every entry formatted as a bullet list.
October 2026
Questions about this page? Email contact@alplab.ai