Commit Graph

35 Commits (2fdc99f323f1663a5cd551c032bdf7e9b34b2a09)

Author SHA1 Message Date
Daniele Lacamera 63b58c5491 F-4647: bound strlen to ATA_SECURITY_PASSWORD_LEN in passphrase path
security_command_passphrase used strlen(passphrase) on a 32-byte binary
buffer from TPM unsealing that carries no null-terminator guarantee,
causing an OOB stack read whenever none of the 32 key bytes is zero.

Replace strlen with strnlen(passphrase, ATA_SECURITY_PASSWORD_LEN) using
a new constant (32, matching the ATA-8 ACS password field size) defined
in ata.h.  Also add a size check in sata_unlock_disk after
sata_get_unlock_secret so a short or malformed unseal result is rejected
before reaching the ATA command path.
2026-06-10 21:01:17 +02:00
Daniele Lacamera 286581cf18 F-5093: fix OOB memset in x86_paging_setup_ptp and non-looping panic
Three related defects:
- panic() halted with a single hlt instruction (no loop), so any
  resumable interrupt (LAPIC timer via iretq) caused it to return,
  allowing callers to continue executing.  Add while(1) and declare
  __attribute__((noreturn)) in both definition and header.
- x86_paging_setup_ptp guarded with == WOLFBOOT_PTP_NUM instead of >=,
  so if the counter ever exceeded that value (after a panic() return)
  the guard was permanently bypassed.
- The ptp pointer was computed before the bounds check, creating an
  out-of-bounds pointer for one-past-end indices; move the assignment
  to after the guard so no invalid pointer is ever formed.

Add unit-x86-paging-oob test that sets page_table_page_used to
WOLFBOOT_PTP_NUM and verifies that every subsequent call to
x86_paging_setup_ptp triggers panic (via longjmp stub) rather than
silently proceeding with an out-of-bounds memset.
2026-06-10 21:01:16 +02:00
Daniele Lacamera 776378ca78 Preparing release v2.8.0 + update copyright 2026-04-16 13:11:56 +02:00
David Garske 963cdadeaf Peer review fixes 2025-12-24 18:31:55 +01:00
David Garske e055585942 Support for Microchip PolarFire SoC (MPFS250) 2025-12-24 18:31:55 +01:00
gojimmypi fbd8dcf8a2
Update Copyright year to 2025 2025-10-15 11:33:53 -07:00
Marco Oliverio 1276e152b6 gpt: fix spelling error 2024-12-19 20:12:16 +01:00
Marco Oliverio 834a712350 fsp: move TempRamInitExit and later APIs in stage2
To avoid using Flash memory after TempRamInitExit. This protects against
malicious modification/injection of the flash after Cache-As-RAM is
disabled.
2024-12-19 20:12:16 +01:00
Marco Oliverio dab560549a fsp: refactor out common fsp routines 2024-12-19 20:12:16 +01:00
Marco Oliverio b8a81de965 x86: add wrapper to run 32bit code in 64bit long mode 2024-12-19 20:12:16 +01:00
Marco Oliverio 6358153372 x86: add support for gdt table in C 2024-12-19 20:12:16 +01:00
Marco Oliverio 7a72bc719b ata: support master password in ata_security_erase_unit() 2024-04-29 09:53:49 +02:00
Marco Oliverio 85d6437433 ata: enable to compare against master password 2024-04-29 09:53:49 +02:00
Marco Oliverio 992bb4c13d ata: support aync ATA command operation
only one operation at the time at driver level is allowed.
2024-04-29 09:53:49 +02:00
Marco Oliverio e90ddcaadc ata: add missing prototypes 2024-04-29 09:53:49 +02:00
Marco Oliverio 2d67742be9 x86: ahci: make freeze optional in sata_unlock_disk 2024-04-29 09:53:49 +02:00
Marco Oliverio 4bbe43e222 x86: support cpu exceptions 2024-04-29 09:53:49 +02:00
Marco Oliverio e7a626223a gpt: support partition label 2024-04-24 17:07:35 +02:00
Marco Oliverio 7247d1184b x86: sata: separate sata_unlock_disk() as a separate operation 2024-04-24 10:50:50 +02:00
Daniele Lacamera fce6149cf8 Update license GPL2 -> GPL3 2024-04-16 16:46:15 +02:00
Marco Oliverio b49ecbec86 fsp: improve debugging 2023-10-02 15:20:39 +02:00
Marco Oliverio 133479f212 fsp: defer SATA init in wolfBoot_start
In hal_init() TPM is not ready yet. SATA inti code needs TPM to unlock disk when
using TPM sealed secret based disk locking.
2023-09-28 13:12:26 +02:00
Marco Oliverio f4411f2fe4 x86: fsp: add more debugging 2023-09-19 10:12:59 +00:00
Daniele Lacamera 87f97c111c Addressed reviewer's comments 2023-09-05 10:31:09 +02:00
Daniele Lacamera 75444cf93b Support for ATA Security feature set 2023-09-04 18:05:37 +02:00
Marco Oliverio aaf0071ece mptable: use stdint for field. add __packed__ attribute 2023-08-25 18:43:50 +02:00
Marco Oliverio d01c08b451 mptable: use sipmler irq table. compute mp_float checksum at runtime 2023-08-25 18:43:50 +02:00
Marco Oliverio c4ec5eef35 x86: support Intel FSP (TigerLake and QEMU) 2023-07-24 18:12:32 +00:00
Marco Oliverio 93b7281d12 x86: support MMU paging on x86 architecture 2023-07-24 18:12:14 +00:00
Marco Oliverio 30af6f617c x86: support Linux boot protocol for 32bit x86 architecture 2023-07-24 18:12:14 +00:00
Marco Oliverio bb93ce95d7 x86: MPTABLE: support multi processor table
BIOS uses this table to communiate IRQ routing and CPUs number to the OS.
2023-07-24 18:12:14 +00:00
Daniele Lacamera 5d6662af35 x86: GPT: support GUID Partition Table
support parsing the table and reading/writing to/from a partition.

Signed-off-by: Marco Oliverio <marco@wolfssl.com>
2023-07-24 18:12:14 +00:00
Daniele Lacamera dbf913deb0 x86: ATA: support ATA commands
support ATA commands to read, write and identify a SATA disk.

Signed-off-by: Marco Oliverio <marco@wolfssl.com>
2023-07-24 18:12:14 +00:00
Daniele Lacamera 8ed6dd3281 x86: AHCI: support AHCI
supports querying the ports, detecting the disk and configuring FIS areas.

Signed-off-by: Marco Oliverio <marco@wolfssl.com>
2023-07-24 18:12:14 +00:00
Marco Oliverio 1e754ca8f5 x86: common I/O, MMIO and misc architecture specific functions 2023-07-24 18:12:13 +00:00