Commit Graph

62 Commits (6db7de6a752786625d6300bb26af296894cc0577)

Author SHA1 Message Date
David Garske 6db7de6a75 Support for the Nordic nRF5340 (application and network cores):
* Added nRF5340 driver support for Clock, Internal Flash (NVMC), GPIO, SPU, OTP, UART, SPI, QSPI and IPC.
* Added support for updating the network core (Sign using "--id 2")
* Cleanup the nRF52 port
* Improved external QSPI and internal Flash tests and logging.
* Improved internal printf support for formatter length.
2024-10-11 10:29:59 +02:00
Marco Oliverio 0f8f30d6b8
Merge pull request #457 from danielinux/otp-regressions
Fix build OTP options
2024-06-26 12:07:02 +02:00
David Garske a92c1b9ad9 STM32U5 cache support. Including cache invalidate on `nvm_select_fresh_sector`. ZD 18210 2024-06-25 18:12:47 +02:00
Daniele Lacamera 391e8d05d8 Fix build OTP options
- ARMORED option is not needed in otp_primer
- do not attempt to compile otp_primer if the option is not declared
2024-06-18 15:00:54 +02:00
Daniele Lacamera fce6149cf8 Update license GPL2 -> GPL3 2024-04-16 16:46:15 +02:00
Daniele Lacamera 92f630ad3c Added "cc" clobbers 2024-04-11 12:39:12 +02:00
Daniele Lacamera d73341112d Anti-glitch armor: Added clobbers to assembly 2024-04-10 09:59:14 +02:00
David Garske 5ecd2f749d Cleaned up TLV example and simulator output. Moved `wolfBoot_find_header` to the public header. 2024-03-08 12:15:23 -08:00
David Garske 83283c6cf7 Fixes for NXP T1024 and booting Integrity OS:
* Fixed PPC spin table based on ePAPR 1.1.
* Added flattened device tree (FDT) support. Setting required FDT fields per ePAPR 1.1.
* Added Frame Manager microcode upload.
* Fixed CPLD and setting QE clock.
* Added support for setting logical device numbers and updated device tree.
* Fixed QUICC Engine base address (was incorrect, should be 0x140000).
* Fixed "cpu-release-addr" to use 64-bit value.
* Added secondary cached boot page.
* Added L2 cache support to multi-core.
* Added flattened device tree parser tool for testing (`make fdt-parser` and `tools/fdt-parser/fdt-parser`).
* Added checks for FDT header.
* Added automated test case for NXP T1024 FDT.
2024-01-17 14:16:15 +01:00
John Bland 6c2a37bdea remove complicated key saving process and instead
leave the encryption key for wolfBoot_success to erase.
FINAL_SWAP was also stopping the case where the partition was put into testing before the update sector status flags could be erased. now, don't erase the update sector flags. instead put the update partition in IMG_STATE_FINAL_FLAGS state before putting the boot partition in IMG_STATE_TESTING. Then only erase the update sector flags on wolfBoot_update_trigger. under this scheme, the sector flags are intact if the power failed before we could set IMG_STATE_TESTING but are wiped if we do need to swap over after after wolfBoot_success fails to be called
2023-10-13 14:30:04 +02:00
John Bland 00a9572b94 change the final steps of wolfBoot_update into
repeatable steps so that power failure wont erase the encryption key and wont cause skipping the testing phase of boot. this is done by marking the update partition as final swap when erasing the final sector and backing up the key in boot sector 0 after swaping the real boot sector 0 to swap. then when a power failure occurs the encryption key will be available in either boot sector 0 or the normal location. the intermediate phase also prevents skipping the testing phase since the last sector, which holds the boot state, is erased and then set repeatably, since the final swap state is set on the update partition
2023-10-13 14:30:04 +02:00
David Garske b3e2fb9ddd NXP T1024 wolfBoot support:
* Added DDR4 w/ECC.
* Added L2 and L2 CPC SRAM support
* Added platform SRAM 160KB support
* Added support for core timers (timebase) and platform clock.
* Added IFC driver with erase/write
* Added stage 1 loader to relocate wolfBoot to DDR
* Added CPLD, QUICC, FMAN and MP drivers
* Added eSPI driver for TPM.
* Added hal_early_init instead of calling ddr_init directly.
* Fixes for device tree (DTB) loading with update_ram and PPC boot.
* Fixes for relocating CCSRBAR to upper.
* Fixes for interrupt offsets.
2023-10-06 15:28:16 +02:00
David Garske 490286be7d Support for sealing/unseal a secret based on an externally signed PCR policy.
* Added new `WOLFBOOT_TPM_SEAL` and `WOLFBOOT_TPM_SEAL_NV_BASE` config options.
* Added new `tools/tpm/policy_create` tool for assisting with creation of a policy digest. The sign keytool `--policy=file` signs the policy.
* Added new `WOLFBOOT_TPM_VERIFY` option to enable offloading of the asymmetric verification to the TPM. By default wolfCrypt will be used.
* Added example seal/unseal to update_flash for ARCH_SIM.
* Renamed `WOLFBOOT_TPM_KEYSTORE_NV_INDEX` to `WOLFBOOT_TPM_KEYSTORE_NV_BASE` to support multiple public keys.
* Refactored most TPM code into tpm.c.
* Refactored the keystore ROT to use new `wolfBoot_check_rot` API.
* Refactored the sign keytool to have a sign_digest function to allow signing firmware and policy for sealing/unsealing.
* Fix for make distclean && make using the wrong key tools.
2023-09-12 12:26:48 +02:00
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
Hideki Miyazaki 5ed7390c40 reorganize folders under IDE/Renesas 2023-06-10 08:53:32 +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
David Garske 69ca95eb94 Adds `factory_wstage1.bin` option to include first stage loader. Fix test-app verbose issue. 2023-04-21 16:41:00 +02:00
John Bland 3fbc99d36e wolfTPM pubkey storage with policy based access restriction
this update uses the tpm to retreive the public key used to validate the image that will boot and restricts access to that key by tpm policy. when the image is updated it's signature is used to extend the PCR and when the image is loaded it's signature must match what was sealed in order to get the public key from the tpm. enabling this option is done by setting WOLFBOOT_TPM_KEYSTORE in .config
2023-04-11 11:46:21 -04:00
Daniele Lacamera 0b06efd347 Added unit test for encrypted external flash 2023-03-14 08:57:14 +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
Lealem Amedie 18bfcecd6b wolfBoot cmake support 2022-12-07 13:00:10 -08:00
David Garske 3c2c26bf3a Fixes for IAR. Switch to new `src/keystore.c` for keys. Fixes for building keytools in Visual Studio. 2022-07-26 09:34:53 +02:00
Daniele Lacamera 93dd53ac0f Fixed support for raspberry-pi 2022-07-21 20:18:34 +02:00
Daniele Lacamera 513163a77b Added "ARMORED" check for part id flags mask 2022-07-19 15:32:28 +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 7b7282e74d Added comment as suggested by reviewer. 2022-03-17 12:10:57 +01:00
Daniele Lacamera 986855ce0a Review's feedback 2022-03-17 11:53:49 +01:00
Daniele Lacamera 4527347173 Error if attempting to build ARMORED on not-arm-gcc 2022-03-17 10:48:49 +01:00
Daniele Lacamera 73fe84c55c Fixed version check armor, add no-downgrade tests 2022-03-16 11:19:05 +01:00
Daniele Lacamera 0684245187 Added canary vars around signature_ok flag, improved checks 2022-03-15 12:36:24 +01:00
Daniele Lacamera 0665eeff67 Reverted 'return -1' fix; removed _update() optim. 2022-03-14 18:14:50 +01:00
Daniele Lacamera a72715caa3 Improved "return -1" in version check 2022-03-14 17:58:43 +01:00
Daniele Lacamera 028d184b17 Added armored image version, improve armor 2022-03-14 17:45:47 +01:00
Daniele Lacamera 32ecb5c3b6 Added pre-boot sanity check 2022-03-14 16:04:11 +01:00
Daniele Lacamera 75fb9f70e3 Fixed ECC with no armor 2022-03-14 15:22:04 +01:00
Daniele Lacamera 9ac4a6d365 Armored signature verification back-end 2022-03-14 15:12:36 +01:00
Daniele Lacamera 5a15fe1138 Added armored panic() function form arm cortex-m 2022-03-14 13:06:13 +01:00
David Garske d38de3b432 Update copyright year 2021-07-19 07:50:02 -07:00
Daniele Lacamera 4e27d9197f Added compile-time option to invert FLAGS logic (FLAGS_INVERT=1) 2020-11-03 11:05:14 +01:00
Daniele Lacamera 72eb2c205b Relocate sector flags in FLAGS_HOME mode to a constant location 2020-10-16 10:29:19 +02:00
Daniele Lacamera 53bf4d04db Encrypt: API design 2020-06-16 17:50:55 +02:00
Daniele Lacamera 1d24d326b1 Experimental: chacha20 encryption for external partitions 2020-06-16 17:50:55 +02:00
Daniele Lacamera aa3fb3fab0 Changed set|get_sector_flag argument to uint16_t
On some platforms with very small sector size this index could overflow
2020-05-29 08:19:18 +02:00
David Garske e7446c570f Fixes for Device Tree (DTS) handling. Updated documentation. 2020-03-06 15:33:41 -08:00
David Garske 2867025ae5 Fixes for handling U-Boot image and DTS. Moved the Xilinx SDK project target settings into target.h. 2020-03-05 15:39:22 -08:00
David Garske c0b534edd7 wolfBoot Aarch64 support (Xilinx Zynq and Raspberry Pi):
* Added Aarch64 boot/startup support
* Added configuration templates for Raspberry Pi 3 and Xilinx ZynqMP UltraScale+
* Added Xilinx Zynq QSPI bare-metal Driver
* Added `NO_XIP` option for full `ext_flash_*` API on all partitions
* Added Xilinx SDK Project Template
* Added support for DTS image partitions
* Added wolfBoot signing tool in Native C (`tools/keytools/sign.c`).
* Added libwolfboot functions `int wolfBoot_fallback_is_possible(void);` and `int wolfBoot_dualboot_candidate(void);`
* Performance improvement to only hash application firmware image once
2020-03-04 12:04:46 -08:00