Commit Graph

94 Commits (51fcb61cd201f78d33bcd79ace2d5acaa99cf71b)

Author SHA1 Message Date
David Garske db15f9b0f1 Further NXP P1021 fixes and improvements:
* Added ELF32 and ELF64 loader support (config `ELF=1` or build option `WOLFBOOT_ELF`).
* Add ELF support to `update_ram.c` loader.
* Add support for loading entire flash image to RAM when `EXT_FLASH=1` and `NO_XIP=1` (or `WOLFBOOT_USE_RAMBOOT`).
* Added QUICC Engine support to load microcode and enable.
* Add multiple core support for NXP P1021.
* Fixes to resolve first stage boot ROM relocation.
  - Implemented temporary workaround to resolve stack traps.
* Added PPC GOT relocation support.
* Fix for the PPC `isr_empty` handler address.
* Fix to allow stack to use DDR by having assembly setup DDR TLB. After relocating wolfBoot use stack on DDR.
* Cleanup wolfBoot output.
  - Only remove extra .bin/.elf created unless `make distclean` is used.
  - Don't output the key grep test (only check result).
  - Adjust build order (first stage, wolfboot, test app, key, sign test app and factory).
  - Fix to make sure linker script is rebuilt before objects.

Sample NXP P1021 Output:

```
Relocating BOOT ROM to DDR
Loading wolfBoot to DDR
Jumping to full wolfBoot
wolfBoot HAL Init
Flash Init: Ret 0, ID 0x76207620
QE: Length 63732, Count 1
QE: uploading 'Microcode for P1021 r1.0' version 0.0.1
QE: Traps 0
MP: Starting core 2 (spin table 0xFFFFF240)
Versions: Boot 1, Update 0
Trying Boot partition at 0x200000
Loading header 512 bytes to 0x1DFFFE00
Loading image 3170724 bytes to 0x1E000000
Image size 3170724
Firmware Valid
Loading elf at 0x1E000000
Found valid elf32 (big endian)
Booting at 0x6000
```
2023-07-05 17:03:57 +02:00
David Garske a56e2252c1 Revert the TPM based key store (root of trust). This feature is not ready for next release. 2023-07-04 08:36:41 +02:00
Dimitri Papadopoulos be037ca04d Fix typos found by codespell 2023-07-04 07:43:02 +02:00
Hideki Miyazaki 170bb9a585 Support Renesas RA6M4 with SCE use 2023-05-17 14:15:18 +02:00
Daniele Lacamera c897362031 NVM_FLASH_WRITEONCE Fixed wrong partition erase
When using NVM_FLASH_WRITEONCE, before writing to the active trailer sector,
we check that the sector has been previously erased. This check was
erasing the wrong partition trailer, leaving the system without a
trailer for a few lines of code, but potentially vulnerable to
powerfailure events.
2023-05-16 09:33:48 +02:00
David Garske 0b7603f7bf
Merge pull request #303 from jpbland1/preseal
add script for preseal a public key to tpm
2023-05-05 15:02:55 -07:00
John Bland bf3ebee8bb use correct digest when getting unsealing the pubkey
add deinit call when wolfboot exits so the TPM doesn't have a hanging session
2023-05-05 16:27:22 -04:00
David Garske ef35f473c9
Merge pull request #296 from jpbland1/tpm-root-trust
wolfTPM pubkey storage with policy based access restriction
2023-05-04 15:09:06 -07:00
John Bland eb30566bba add encryption key unsealing from the tpm
make the config/examples/stm32f4-tpm-keystore.config config use ecc256
2023-04-24 13:23:09 -04:00
Daniele Lacamera 48496c3568 Fix bug in get_trailer_at() 2023-04-13 19:17:21 +02:00
billphipps 27c079b04c Correct spacing. 2023-03-23 06:04:35 +01:00
billphipps 310efc468c Update to check if the initial bytes are erased, then no update is
present.
2023-03-23 06:04:35 +01:00
Daniele Lacamera 96bf93838f Allow NVM_FLASH_WRITEONCE code to run in 64bit sim 2023-03-21 18:03:38 +01:00
Daniele Lacamera c36819ad0b Run 4 unit tests made out of unit-extflash.c
- clear text test of ext_flash_check r/w/erase
- Aes128
- Aes256
- ChaCha
2023-03-14 08:57:15 +01:00
Daniele Lacamera e9ad9e3080 Fixes to encrypted updates functions
- use correct buffer size for the NONCE
- ext_flash_encrypt_write: do not encrypt when writing to last sector of
  update partition
2023-03-14 08:57:15 +01:00
Daniele Lacamera 0b06efd347 Added unit test for encrypted external flash 2023-03-14 08:57:14 +01:00
Daniele Lacamera b401dae331 Fix NVM_FLASH_WRITEONCE redundancy
Address of non-selected block to erase was shifted by one block
2023-03-13 10:37:48 +01:00
Daniele Lacamera 2f2a6d416d Support encrypted images in MMU targets 2023-03-09 16:31:29 +01:00
Daniele Lacamera d4cd79e678 Fixed cosmetics after code reviews 2023-01-27 08:35:08 +01:00
Daniele Lacamera 42822cd1d8 Fix build error 2023-01-26 18:46:51 +01:00
Daniele Lacamera b48b35a498 Fixed selection of the cached sector before write 2023-01-26 18:31:36 +01:00
Daniele Lacamera 6e61b54a20 Fix compile errors with ENCRYPT=1 2023-01-26 14:32:55 +01:00
Daniele Lacamera e04a35bbdb Fix compile errors 2023-01-26 14:23:45 +01:00
Daniele Lacamera 3d517cfe8c NVM_FLASH_WRITEONCE refactoring
- Using two sectors to keep partition/sector flags
- Keep two redundant set of flags, update one at a time
- Erase is done when the sector is old
- Flags update is faster because Erase is done in advance
- Accessing trailer information (including encryption keys) is done by
  selecting the newest information

Tested via renode, using nrf52 with NVM_FLASH_WRITEONCE flag on.
2023-01-26 09:22:48 +01:00
David Garske da6d364f1e Fixes for encrypt/decrypt with unaligned address. Fix issue with byte count result on Mac. Cleanups for uart-flash-server. 2022-12-16 17:50:02 +01:00
David Garske 2fc899254f Cleanups for NXP T2080 DEOS support:
* Expanded the NXP QorIQ T2080 documentation in `docs/Targets.md`.
* T2080 fixes for boot code placement and generation of .bin.
* T2080 UART driver cleanup.
* Improve bin-assemble fill speed and report items added.
* Make portability fixes to enable building in `mingw32-make`.
* Cleanup the `docs/Targets.md` sections and links.
* Cleanup execute bits on code files.
2022-12-06 06:20:48 +01:00
Daniele Lacamera de686b5760 Make variables volatile in get_blob_* functions
Compiler optimizations will cause some values to be optimized out, when
reading parameters from the flash.

Using 'volatile' in these functions results in values being correctly
updated.

This should fix the issue reported in #249.
2022-11-28 16:16:15 +01:00
Daniele Lacamera a6fdec3901 self-encrypt prototype; tested on stm32l0 2022-09-21 18:49:52 +02:00
Daniele Lacamera f0dd38d73b Fixed XMEMCPY symbol in test applications 2022-07-22 17:38:34 +02:00
Daniele Lacamera c27dd729ab Add define for MEMCPY & friends when compiling app in WOLFTPM mode 2022-07-22 09:31:11 +02:00
Daniele Lacamera ec88e96037 Fixed regression compiling test-app 2022-07-21 21:05:13 +02:00
Daniele Lacamera 93dd53ac0f Fixed support for raspberry-pi 2022-07-21 20:18:34 +02:00
Marco Oliverio 5c13a526bd libwolfboot.c: abide compilers on 64bit architectures 2022-07-12 10:13:10 +02:00
David Garske 9c59244726 Make sure the cipher global is zero initialized (since it is not a static, the compiler may not zero initialize). 2022-06-02 09:12:30 +02:00
David Garske f63c323677 Cleanups and restore a few changes. 2022-05-20 08:06:07 +02:00
David Garske 6068a8047c wolfBoot improvements (from elms):
* Add `WOLFBOOT_DUALBOOT` for dynamic fallback
* Refactor header field parsing
* Cleanup compiler warnings and logic extra check
* Option to leave out partition based functions
* Add `WOLFBOOT_FIXED_PARTITIONS` enable using partition enum and related functions
* Wrap all delta update references
* Update raspberry documentation
* EFI refactoring
* Add `keytools_check` target
* Add "library" target
2022-05-20 08:06:07 +02:00
Daniele Lacamera 61275ec9dd Update Chacha ENCRYPT_BLOCK_SIZE to match IV ctr 2022-02-07 16:35:25 +01:00
Marco Oliverio b7026a5b1c update: don't set IV on SWAP based on SWAP address.
New update logic when using encrypted external flash:

- an update sector is copied to swap. No decryption and re-encryption is done in
this step. This is important, because the swap address never changes and
otherwise the data will be encrypted, one sector at the time, with the same
IV. It's also a performance improvement.

- a boot sector is copied to update. In this step the boot sector is encrypted

- the swap sector is copied into boot. In this step the swap sector is decrypted

This commit moves the set_iv logic into wolfBoot_copy_sector to account for
this.
2022-02-07 15:03:08 +01:00
Marco Oliverio 0f9613837a libwolfboot: make crypto_*() functions public 2022-02-07 15:03:08 +01:00
Marco Oliverio fbef9e8a98 wolfboot: lib: fix wrong range check 2022-02-07 15:03:08 +01:00
Daniele Lacamera 644d83309e Fixed AES iv calculation (all test-enc passing) 2022-02-07 13:29:15 +01:00
Daniele Lacamera 2e88167554 AES-CTR: Use entire block range for IV setting 2022-02-07 10:20:58 +01:00
Daniele Lacamera 43a5a38629 Fixes to AES-CTR encryption after testing 2022-01-31 16:46:09 +01:00
Daniele Lacamera 5551666e08 Draft: added AES encryption support 2022-01-28 20:26:59 +01:00
Marco Oliverio a187442455 support booting EFI application on x86_64 architecture
Co-authored-by: Daniele Lacamera <daniele@wolfssl.com>
2021-11-30 18:43:50 +01:00
Daniele Lacamera f26dd61e23 Fixed delta updates from external devices (+ test) 2021-10-07 14:32:51 +02:00
Daniele Lacamera 922c17f1cc Draft: integrate delta updates with external flash support 2021-10-07 14:32:48 +02:00
Elms da353cfe2e TMS570LC43xx: allow overwriting `PART_BOOT_ENDFLAGS` 2021-10-07 01:45:18 -07:00
Elms aaa8438f3f TMS570LC43xx: Fix status updates via NVM_FLASH_WRITEONCE 2021-10-07 01:45:18 -07:00
Elms d302c633c2 TMS570LC43xx: flash updates and init stack pointer
- cleanup warnings and rework exceptions to be more robust
 - CORTEX R5: Initialization of stack pointer
 - updates to F021 flash from testing
 - sync options for command line build with IDE
2021-10-07 01:45:18 -07:00