Skip to content

Add ML-DSA signed, AES-256 encrypted image boot from QSPI and SD for Versal VMK180 - #999

Open
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:versal_pq_enc
Open

dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:versal_pq_enc

Conversation

@dgarske

@dgarske dgarske commented Nov 22, 2026

Copy link
Copy Markdown
Member

Adds ML-DSA-87 signed, AES-256 encrypted image boot for the AMD Versal VMK180 from QSPI (two fixed slots) and SD (A/B slots).

  • wolfBoot_ram_decrypt() stages ciphertext from external flash that is not memory mapped
  • New wolfBoot_success_part() to confirm an image booted from the update partition
  • New opt-in DUALBOOT_ROLLBACK_UNCONFIRMED=1 for the RAM loader
  • Versal: even-length dual-parallel QSPI write chunks, larger EL2 stack, wolfboot,boot-part property
  • CI builds both variants from the existing Versal configs with make arguments

Tested on a VMK180: update, tampered image rejected, unconfirmed image rolled back. The platform supplies the encryption key; no key ships in wolfBoot.

@dgarske dgarske self-assigned this Nov 22, 2026
Copilot AI balanced review requested due to automatic review settings November 22, 2026 17:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The fallback path erases the unconfirmed image before FIT/DTB validation completes, so a later validation failure can trigger a panic and prevent recovery on reset.

4 open issues
What changed in this PR

Adds ML-DSA-87 signed, AES-256 encrypted image boot for Versal VMK180 using fixed QSPI slots or SD A/B slots, extending wolfBoot’s RAM loading and boot-confirmation support.

Changes:

  • Stages encrypted external-flash images in RAM for decryption and verification.
  • Adds partition-specific confirmation and optional rollback of unconfirmed RAM-boot images.
  • Updates Versal QSPI writes, stack sizing, device-tree metadata, documentation, tests, and CI builds.
File Description
tools/​unit-tests/​unit-versal-qspi-dma.c Tests single-device and striped QSPI write chunks.
tools/​unit-tests/​unit-update-ram.c Tests slot reporting, confirmation, and rollback.
tools/​unit-tests/​unit-update-ram-enc.c Tests short reads and unaligned encrypted payloads.
tools/​unit-tests/​unit-update-flash.c Supplies an encryption-cache test buffer.
tools/​unit-tests/​Makefile Adds test variants and QSPI write instrumentation.
src/​update_ram.c Tracks the boot slot and integrates staging and rollback cleanup.
src/​update_flash_hwswap.c Rejects the RAM-only rollback option.
src/​libwolfboot.c Implements slot confirmation, deferred erase, and ciphertext staging.
options.mk Exposes rollback and encryption-cache settings.
include/​wolfboot/​wolfboot.h Declares confirmation and rollback APIs.
include/​image.h Selects raw flash access for RAM decryption.
include/​fdt.h Declares the RAM boot-slot accessor.
hal/​versal.ld Enlarges the EL2 stack for ML-DSA verification.
hal/​versal.c Adjusts striped writes and adds key hooks and slot metadata.
docs/​Targets.md Documents encrypted Versal builds and platform key provisioning.
docs/​compile.md Explains optional unconfirmed-image rollback.
docs/​API.md Documents slot confirmation and encrypted-image version queries.
.gitignore Ignores new test executables.
.github/​workflows/​test-configs.yml Adds encrypted ML-DSA QSPI and SD build jobs.

Review effort: Balanced

Comment thread src/update_ram.c
#if defined(WOLFBOOT_DUALBOOT) && defined(WOLFBOOT_FIXED_PARTITIONS)
ramboot_part = active;
#ifdef WOLFBOOT_DUALBOOT_ROLLBACK_UNCONFIRMED
wolfBoot_dualboot_erase_rejected(active);
Comment thread hal/versal.c
if (ret != 0) {
wolfBoot_printf("FDT: Failed to set wolfboot,boot-part (%d)\n",
ret);
return ret;
Comment thread options.mk
Comment on lines +1132 to +1133
ifeq ($(DUALBOOT_ROLLBACK_UNCONFIRMED),1)
CFLAGS+=-D"WOLFBOOT_DUALBOOT_ROLLBACK_UNCONFIRMED"
Comment thread src/update_ram.c
Comment on lines +379 to +381
#ifdef WOLFBOOT_RAM_DECRYPT_EXT
os_image.not_ext = 1;
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants