wolfBoot Encrypted Firmware Support Added

Storing encrypted firmware updates with wolfBoot

At wolfSSL, we work together with our customers to better understand the real-life scenarios in embedded security.

One of the concerns that we have been addressing the most when it comes to secure boot is the protection of the ‘data at rest’ when the firmware updates are received and stored on unprotected non-volatile memory supports, such as external SPI FLASH devices or other customized forms of storage.

wolfBoot, our fully open source secure bootloader solution for embedded systems, now supports encrypted external partitions, to safely store your firmware updates during the update process. The algorithm used is ChaCha20, implemented via wolfCrypt.

Each update can now be signed-and-encrypted to be distributed on the target, and the application can set a decrypt key at runtime, using wolfBoot API. This support has been recently merged in master branch and it will be included in the next release.

Here is how to enable it:

  1. Compile the bootloader with the option `ENCRYPT=1`
  2. Create a buffer of 44 random Bytes, and store it into a `secret_key` file. This file now contains the key and vector that will be used for the encryption of the firmware image.
  3. Add the extra step `–encrypt secret_key` to the sign tool invocation. This will generate an extra *_signed_and_encrypted.bin image file
  4. Transfer the _signed_and_encrypted image to the target. The system application can still use wolfBoot HAL to access external devices, because encryption is only enabled in bootloader mode.
  5. Set the secret key and vector in the application via the wolfBoot API call `wolfBoot_set_encryption_key()`. The secret key could be e.g. pre-stored in a secure element, or transmitted during the update through a secure channel.
  6. Initiate the update as usual, with `wolfBoot_trigger_update()`, and reboot. wolfBoot will attempt to decrypt and verify the firmware, and initiate the installation if the verification is successful.

The image stored in the UPDATE partition is always encrypted, including the backup copy of the previously running system during the installation. This ensures that reading out the partition would never reveal its content as long as the secret encryption key is kept safe.

The partition encryption support in wolfBoot is an additional protection for data at rest, when the firmware is stored on external devices where it is not possible to activate any effective read-out protection.

For data in motion, as usual, we recommend transferring the updates using TLS 1.3, and always using encrypted communication towards the firmware consumer device.

Contact us at facts@wolfssl.com and ask how we can help design and integrate tailored custom secure boot solutions specific to your embedded systems.