Skip to content

Commit b739549

Browse files
authored
Merge pull request #41 from danielinux/wolfboot-1.11-update
Updated manual to wolfBoot-1.11
2 parents c2927e7 + 312ff10 commit b739549

File tree

3 files changed

+65
-10
lines changed

3 files changed

+65
-10
lines changed

wolfBoot/src/chapter02.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ For more details, see the section [Remote External flash memory support via UART
170170

171171
#### Encryption support for external partitions
172172

173-
When update and swap partitions are mapped to an external device using `EXT_FLASH=1`, either in combination with `SPI_FLASH`, `UART_FLASH`, or any custom external mapping, it is possible to enable ChaCha20 encryption when accessing those partition from the bootloader. The update images must be pre-encrypted at the source using the key tools, and wolfBoot should be instructed to use a temporary ChaCha20 symmetric key to access the content of the updates.
173+
When update and swap partitions are mapped to an external device using `EXT_FLASH=1`, either in combination with `SPI_FLASH`, `UART_FLASH`, or any custom external mapping, it is possible to enable ChaCha20, Aes128 or Aes256 encryption when accessing those partition from the bootloader. The update images must be pre-encrypted at the source using the key tools, and wolfBoot should be instructed to use a temporary ChaCha20 symmetric key to access the content of the updates.
174174

175175
For more details about this optional feature, please refer to the [Encrypted external partitions](chapter06.md#encrypted-external-partitions) section.
176176

@@ -221,3 +221,9 @@ LC_ALL=
221221

222222
Then run the normal `make` steps.
223223

224+
### Enabling mitigations against glitches and fault injections
225+
226+
One type of attacks against secure boot mechanisms consists in skipping the execution of authentication and validation steps by injecting faults into the CPU through forced voltage or clock anomalies, or electromagnetic interferences at close range.
227+
228+
Extra protection from specific attacks aimed to skip CPU instructions can be enabled using `ARMOR=1`. This feature is currently only available for ARM Cortex-M targets.
229+

wolfBoot/src/chapter03.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -869,22 +869,25 @@ the monitor command sequence below:
869869

870870
## NXP iMX-RT
871871

872-
NXP RT1060/1062 (RT1060-EVK)
872+
NXP RT1060/1062 and RT1050
873873

874874
The NXP iMX-RT1060 is a Cortex-M7 with a DCP coprocessor for SHA256 acceleration.
875875
Example configuration for this target is provided in `/config/examples/imx-rt1060.config`.
876876

877877
### Building wolfBoot
878878

879879
MCUXpresso SDK is required by wolfBoot to access device drivers on this platform.
880-
A package can be obtained from the [MCUXpresso SDK Builder](https://mcuxpresso.nxp.com/en/welcome), by selecting `EVK-MIMXRT1060` as target, and keeping the default choice of components.
880+
A package can be obtained from the [MCUXpresso SDK Builder](https://mcuxpresso.nxp.com/en/welcome), by selecting a target and keeping the default choice of components.
881881

882-
Set the `MCUXPRESSO` configuration variable to the path where the SDK package is extracted, then build wolfBoot normally by running `make`.
882+
* For the RT1060 use `EVKB-IMXRT1060`. See configuration example in `config/examples/imx-rt1060.config`.
883+
* For the RT1050 use `EVKB-IMXRT1050`. See configuration example in `config/examples/imx-rt1050.config`.
883884

884-
wolfBoot support for iMX-RT1060 has been tested using MCUXpresso SDK version 2.8.2.
885+
Set the wolfBoot `MCUXPRESSO` configuration variable to the path where the SDK package is extracted, then build wolfBoot normally by running `make`.
886+
887+
wolfBoot support for iMX-RT1060/iMX-RT1050 has been tested using MCUXpresso SDK version 2.11.1.
885888

886889
DCP support (hardware acceleration for SHA256 operations) can be enabled by using PKA=1 in the configuration file.
887-
Firmware can be directly uploaded to the target by copying `factory.bin` to the virtual USB drive associated to the device (RT1060-EVK).
890+
Firmware can be directly uploaded to the target by copying `factory.bin` to the virtual USB drive associated to the device.
888891

889892

890893
## NXP Kinetis

wolfBoot/src/chapter06.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,24 @@ can be used to set a temporary encryption key for the external partition, or era
418418

419419
Moreover, using `libwolfboot` to access the external flash with wolfboot hal from the application will not use encryption. This way the received update, already encrypted at origin, can be stored in the external memory unchanged, and retrieved in its encrypted format, e.g. to verify that the transfer has been successful before reboot.
420420

421-
### Symmetric encryption algorithm
421+
### Symmetric encryption algorithms
422422

423-
The algorithm currently used to encrypt and decrypt data in external partitions is Chacha20-256.
423+
Encryption can be enabled in wolfBoot using `ENCRYPT=1`.
424+
425+
The default algorithm used to encrypt and decrypt data in external partitions is Chacha20-256.
426+
AES-128 and AES-256 options are also available and can be selected using `ENCRYPT_WITH_AES128=1` or `ENCRYPT_WITH_AES256=1`
427+
428+
### Chacha20-256
429+
430+
431+
When ChaCha20 is selected:
424432

425433
- The `key` provided to `wolfBoot_set_encrypt_key()` must be exactly 32 Bytes long.
426434
- The `nonce` argument must be a 96-bit (12 Bytes) randomly generated buffer, to be used as IV for encryption and decryption.
427435

428-
### Example usage
429436

430-
#### Signing and encrypting the update bundle
437+
#### Example usage with ChaCha20-256
438+
431439

432440
The `sign.py` tool can sign and encrypt the image with a single command. The encryption secret is provided in a binary file that should contain a concatenation of a 32B ChaCha-256 key and a 12B nonce.
433441

@@ -453,6 +461,44 @@ secret file:
453461

454462
which will produce as output the file `test-app/image_v24_signed_and_encrypted.bin`, that can be transferred to the target's external device.
455463

464+
### AES-CTR
465+
466+
467+
AES is used in CTR mode. When AES is selected:
468+
- The `key` provided to `wolfBoot_set_encrypt_key()` must be 16 Bytes (AES128) or 32 Bytes (AES256) long.
469+
- The `nonce` argument is a 128-bit (16 Byyes) randomly generated buffer, used as initial counter for encryption and decryption.
470+
471+
472+
#### Example usage with AES-256
473+
474+
475+
In case of AES-256, the encryption secret is provided in a binary file that should contain a concatenation of
476+
a 32B key and a 16B IV.
477+
478+
In the examples provided, the test application uses the following parameters:
479+
480+
```
481+
key = "0123456789abcdef0123456789abcdef"
482+
iv = "0123456789abcdef"
483+
```
484+
485+
So it is easy to prepare the encryption secret in the test scripts or from the command line using:
486+
487+
```
488+
echo -n "0123456789abcdef0123456789abcdef0123456789abcdef" > enc_key.der
489+
```
490+
491+
The `sign.py` script can now be invoked to produce a signed+encrypted image, by using the extra argument `--encrypt` followed by the
492+
secret file. To select AES-256, use the `--aes256` option.
493+
494+
```
495+
./tools/keytools/sign.py --aes256 --encrypt enc_key.der test-app/image.bin ecc256.der 24
496+
497+
```
498+
499+
which will produce as output the file `test-app/image_v24_signed_and_encrypted.bin`, that can be transferred to the target's external device.
500+
501+
456502

457503
### API usage in the application
458504

0 commit comments

Comments
 (0)