Commit Graph

3392 Commits (18b525f53c8f7057bfa139df0aea28ce08a59399)

Author SHA1 Message Date
David Garske 18b525f53c efi: sign the x86_64_efi reference kernel with an authenticated HDR_CMDLINE 2026-08-10 21:03:50 +02:00
David Garske 4a16dce4f8 efi: authenticate the kernel command line via a signed HDR_CMDLINE manifest TLV 2026-08-10 21:03:50 +02:00
David Garske 9d50c1a6de aarch64_efi: fix open_kernel_image error return; expand kernel cmdline security docs 2026-08-10 21:03:50 +02:00
David Garske 811c9d049a aarch64_efi: measure kernel into firmware TPM via EFI_TCG2 2026-08-10 21:03:50 +02:00
David Garske 34941079e1 Add aarch64_efi target: wolfBoot as an AArch64 UEFI application 2026-08-10 21:03:50 +02:00
Marco Oliverio 0dfad2dbc1 hal: pic32cz: uart_deinit out from clock_restore block, nop asm volatile 2026-08-06 15:31:25 +02:00
Marco Oliverio 955b07cc0b mc: pic32cz: better state reset before boot 2026-08-06 15:31:25 +02:00
Marco Oliverio c46c3278a4 arch.mk: add default HSM microchip folder (../) 2026-08-06 15:31:25 +02:00
Aidan Garske db0801b9b4 Add wolfCOSE DICE attestation 2026-08-06 09:44:52 +02:00
David Garske 9232a95033
Merge pull request #844 from danielinux/armored-hardening
[ARMORED] Improve hardening against multi-glitch corner cases
2026-08-05 12:16:14 -07:00
Daniele Lacamera 31f0168afc ARMORED: harden digest comparison against instruction skips 2026-08-05 20:13:44 +02:00
Mattia Moffa 817289ed2c
Merge pull request #842 from danielinux/fenrir-fixes-2026-08-04
Fenrir fixes 2026 08 04
2026-08-04 17:29:40 +02:00
Daniele Lacamera 35a23bf0ef F-6875: pkcs11: zeroize NSC bounce buffers before freeing them
The PKCS#11 non-secure-callable veneers deep-copy every NS attribute
value and every mechanism parameter into secure-world heap. On key
import (C_CreateObject/C_UnwrapKey/C_CopyObject/C_SetAttributeValue
carrying CKA_VALUE or the RSA private components) and on password-based
derivation (CKM_PKCS5_PBKD2 pPassword) those bounce buffers hold
plaintext secrets, but nsc_tmpl_free() and nsc_mech_free() released them
with a bare XFREE(), leaving the material in the freed secure heap block
until something else happens to overwrite it.

Scrub each block with wc_ForceZero() before releasing it. The template
values use the prepare-time snapshot length, since wolfPKCS11 rewrites
work[].ulValueLen on the C_GetAttributeValue path; nsc_alloc() now
records the length of each mechanism allocation for the same reason.

Adds unit-pkcs11-nsc-zeroize, which drives C_CreateObject_nsc_call and
C_DeriveKey_nsc_call over a secure-heap stand-in that is never cleared,
and fails if the imported key or the PBKDF2 password survives the free.
2026-08-04 08:26:17 +02:00
Daniele Lacamera dfdcf7eeb5 F-7053: sign: propagate make_header() failure to the exit status
main() called make_header()/make_hybrid_header() and discarded their
return value. Both are wrappers around make_header_ex(), which returns
-1 on every "goto failure" path (image file not openable, header malloc
failure, firmware version out of range, certificate chain errors,
signing and output write errors). Since ret is initialized to 0 and is
only reassigned by the optional base_diff() delta step, a signing run
that produced no output image still terminated with status 0, so
Makefile recipes and CI treated the failure as success and moved on
with a missing or stale *_v<ver>_signed.bin. This was also asymmetric
with the key loading path just above, which exits on failure.

Capture the return value of both header helpers, skip the delta step
when header generation failed, and let main() return it.

Add tools/unit-tests/unit-sign-header-failure, covering the exit status
of both the plain and the hybrid signing path when the input image
cannot be opened.
2026-08-04 08:16:53 +02:00
Daniele Lacamera 675a927fa2 F-7054: sign: fail when the hybrid secondary key cannot be loaded
main() checked load_key() for the primary key but not for the hybrid
secondary key, and load_key() left *pubkey/*pubkey_sz untouched (or
dangling, after the ED25519/ED448 free(*pubkey)) on its failure paths.

With a missing or undecodable secondary key file the sign tool therefore
either silently emitted a manifest with no secondary public key hashed,
dereferenced a freed pubkey buffer and double-freed it, or crashed on the
uninitialized pubkey_sz2 stack value.

Clear *pubkey/*pubkey_sz on every load_key() failure path, initialize
pubkey_sz2, and exit(1) when the secondary key fails to load.

Add tools/unit-tests/unit-sign-hybrid-keyload, covering the missing-file
and decode-failure contracts of load_key() plus the end-to-end exit
status of the sign tool.
2026-08-04 08:13:36 +02:00
Daniele Lacamera 0e53cac36c F-7065: tpm: snapshot NS length in wolfBoot_tpm2_read_cert veneer
wolfBoot_tpm2_read_cert() is a cmse_nonsecure_entry veneer. It dereferenced
the caller-supplied 'certSz' to bound-check 'cert' with
cmse_check_address_range(), then passed the same non-secure pointer to
wolfTPM2_NVReadCert(), which re-reads '*len' as the destination capacity
before copying the NV data (lib/wolfTPM/src/tpm2_wrap.c:7221). The length was
therefore fetched twice from non-secure memory with no snapshot in between,
so a racing non-secure agent could present a small capacity to pass the CMSE
check and enlarge it before wolfTPM's own check, making the secure world write
the certificate past the validated range and into adjacent Secure SRAM.

Single-fetch the capacity into a secure local before validating, hand wolfTPM
the local, and copy the result back, matching ns_outlen_begin() in
src/pkcs11_callable.c and the rsp_capacity handling in src/wolfhsm_callable.c
and src/fwtpm_callable.c.

Add unit-tpm-nsc-cert, which drives the veneer through a CMSE stub that models
Secure SRAM immediately after the validated non-secure buffer and a wolfTPM
stub that enlarges the non-secure length word in the race window. The
out-of-bounds write test fails before this fix and passes after it.
2026-08-04 08:07:18 +02:00
Daniele Lacamera 307c2e8548 F-7389: arm_tee: reject Secure .base in zero-length PSA iovecs
arm_tee_psa_call() only ran cmse_check_address_range() on descriptors
whose .len was non-zero, so a non-secure caller could pass an outvec of
{Secure address, 0} and skip attribution checking entirely. Several
dispatch handlers write a fixed-size object through out_vec[0].base
without consulting out_vec[0].len (ARM_TEE_PS_GET_SUPPORT,
ARM_TEE_CRYPTO_OPEN_KEY/IMPORT_KEY/GENERATE_KEY and
GET_KEY_ATTRIBUTES), which turned that into an arbitrary write into
Secure memory from the non-secure world.

Check every non-NULL .base with at least one byte regardless of the
declared length, and require the handlers that write a fixed-size object
to be given a large enough output descriptor.

Adds unit tests covering the zero-length Secure outvec and the
PS_GET_SUPPORT length check; the CMSE stub is now a test-provided
function so it can model a Secure region.
2026-08-04 07:02:53 +02:00
David Garske 64a6ef420d test-app: run wolfCrypt test/benchmark on PolarFire SoC MPFS250 2026-08-03 12:27:22 +02:00
David Garske 5f40400e57 PolarFire SoC: address PR review
- wolfBoot_fit_memcpy: return int so a failed PDMA copy propagates instead
  of being swallowed. The weak default (memcpy) returns 0; the MPFS250 PDMA
  override returns -1 if any chunk's mpfs_pdma_memcpy() fails. Callers now
  fail closed: fit_load_image_inner returns NULL (kernel load then panics
  via update_disk.c), the update_disk DTS copy panics, and hal_dts_fixup
  returns an error on a failed L2->DDR copy-back.
- options.mk: gate -DSTACK_SIZE_PER_HART behind RISC-V arch (RISCV/RISCV64).
  The macro is only consumed by the RISC-V startup asm and the mpfs250-m.ld
  sed token, so it is no longer emitted for PPC/ARM/other targets. The
  unconditional default (?= 0) is kept because the linker sed always needs
  a value to substitute.
2026-08-03 12:27:22 +02:00
David Garske 6b3612f4b9 RISC-V: minimal SBI runtime; PolarFire SoC boots 4-CPU SMP Yocto Linux 2026-08-03 12:27:22 +02:00
David Garske e718eed709 PolarFire SoC: LPDDR4 DDR init for MPFS250T Video Kit (M-Mode) 2026-08-03 12:27:22 +02:00
David Garske 0a8ad18e51
Merge pull request #840 from bigbrett/update-wolfhsm
update wolfHSM
2026-07-31 10:20:01 -07:00
Brett Nicholas 1382120fe9 update wolfssl 2026-07-31 08:37:56 -06:00
Brett Nicholas 20f653d821 update wolfhsm 2026-07-31 08:37:50 -06:00
Mattia Moffa 20e61b06a8 Remove obvious/redundant comments 2026-07-31 16:00:14 +02:00
Mattia Moffa 6da07ffc3d Add support for ARM Compiler for Embedded on stm32u5 2026-07-31 16:00:14 +02:00
Mattia Moffa 6b8702dd63 Add uart driver for stm32u5 2026-07-31 16:00:14 +02:00
Mattia Moffa 4efc00a806 Remove NAND info from Targets.md 2026-07-31 14:33:56 +02:00
Mattia Moffa 459ec8a7d6 Fix warnings for test-app crypto test 2026-07-31 14:33:56 +02:00
Mattia Moffa 812397109d Update wolfssl submodule
This port requires wolfssl/wolfssl#10733
2026-07-31 14:33:56 +02:00
Mattia Moffa d943538906 Add failure diagnostics example on MAX32666 2026-07-31 14:33:56 +02:00
Mattia Moffa 3468e965e7 Add MAX32666 CI 2026-07-31 14:33:56 +02:00
Mattia Moffa 357734d691 Fixes for old Maxim SDK 2026-07-31 14:33:56 +02:00
Mattia Moffa d750f46723 Fix issues found by Copilot 2026-07-31 14:33:56 +02:00
Mattia Moffa 3e3dd95a32 Restore to previous bump allocator
Reclaim is no longer needed with streaming SHA implementation in
wolfSSL.
2026-07-31 14:33:56 +02:00
Mattia Moffa bb6aa35d02 Don't define WOLFSSL_HAVE_SP_ECC under SP_MATH_ALL (fixes CI) 2026-07-31 14:33:56 +02:00
Mattia Moffa 190de90224 Clean up build flag usage, use trng healthtest in test-app 2026-07-31 14:33:56 +02:00
Mattia Moffa 6862d57dea Support older Maxim SDK ("LPSDK") 2026-07-31 14:33:56 +02:00
Mattia Moffa cadd3dfe1a Use bank-relative offsets instead of addresses in FLC registers 2026-07-31 14:33:56 +02:00
Mattia Moffa 60b9e87413 SHA256 acceleration for bootloader 2026-07-31 14:33:56 +02:00
Mattia Moffa f5f54c294e Implementation of test-app crypto test 2026-07-31 14:33:56 +02:00
Mattia Moffa bcda09e4ed Fix UART; support FTHR2 board 2026-07-31 14:33:56 +02:00
David Garske 9d9305eebb Support for MAX32666 2026-07-31 14:33:56 +02:00
David Garske 4e1dd615cd
Merge pull request #837 from bigbrett/tc3-se-mode
TC3: expose DFLASH mode as option
2026-07-30 13:42:12 -07:00
Mattia Moffa 640d017610 Check key len for truncation; add unit test 2026-07-30 15:38:11 +02:00
Mattia Moffa e6c87d86a9 Add --custom-tlv-pubkey-der option to signing tool
Allows extracting a public key from a DER file and adding it in the same
format as the keystore:

- `X||Y` for ECC
- Raw for Ed25519/Ed448
- Public key DER for RSA
2026-07-30 15:38:11 +02:00
David Garske b871ec3f62 update_ram: relocate uImage payload to ih_load under RAMBOOT 2026-07-30 15:36:51 +02:00
David Garske 40e732e57c ci: build Renesas RX example configs 2026-07-30 15:32:31 +02:00
David Garske d073ae4ddb watchdog: add generic feed hook and RX driver 2026-07-30 15:32:31 +02:00
David Garske eaa39be9e4 renesas-rx: fix build for GCC RX 8.3/14.2 2026-07-30 15:32:31 +02:00