Skip to content

Add compressed firmware images: gzip-compressed A/B slots executed from RAM - #951

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

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

Conversation

@dgarske

@dgarske dgarske commented Oct 26, 2026

Copy link
Copy Markdown
Member

Description

Boots a gzip-compressed, signed image, optionally encrypted at rest. Both A/B slots stay compressed and the selected one is inflated into RAM and executed there, so A/B redundancy costs about half the flash of two uncompressed slots. Rollback is unchanged. Enabled with COMPRESSED_IMAGES=1, reusing the existing src/gzip.c inflater. The signature covers the compressed bytes, so corruption is caught before the decompressor runs.

What it adds

  • src/update_ram.c - manifest TLVs, capacity and overlap checks, inflate to WOLFBOOT_LOAD_ADDRESS
  • src/compress_crypt.c - optional at-rest encryption of both slots: long-lived key, per-slot keystream
  • tools/keytools/sign.c - --compressed and --encrypt-iv-offset; validates an already-gzipped payload rather than compressing
  • Example configs, docs/Compression.md, simulator tests and CI

Fixes in shared code

  • wolfBoot_success() confirmed PART_BOOT unconditionally, so an image booted from the update slot was discarded on the next boot
  • The keytool's manifest auto-grow guard missed a TLV-emitting option, and output naming searched the whole path for the extension
  • DEBUG_UART=1 on TARGET=stm32f4 hung on the first print, because nothing initialized the port

Testing

Validated on a NUCLEO-F439ZI: verify in place, inflate, execute from RAM, A/B selection by version, and fallback from a corrupted slot. Encryption is simulator-only. Simulator tests cover both gzip decoders, ED25519/ECC256 and ChaCha20/AES-128/AES-256.

@dgarske dgarske self-assigned this Oct 26, 2026
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.

1 participant