Commit Graph

25 Commits (80dbb6da15ab5eb348f5d76049dabd03be5bdd67)

Author SHA1 Message Date
Daniele Lacamera 53f1d4e056 F-7060: fill the swap area with erased bytes, not the update flags
The loop wrote the 5-byte 'pBOOT' trailer SWAP_SIZE times, emitting
5x SWAP_SIZE bytes past the 4KB swap region (the file grew 16KB past
the mmap'd device) and leaving the swap filled with 'pBOOT' instead
of the erased 0xFF state real flash has. Use the 0xFF pad loop the
non-WOLF path already uses.
2026-09-23 01:48:54 +02:00
Daniele Lacamera 524397df70 F-5675: fix signed-overflow UB from uint8_t<<24 in serve_update version assembly
Shifting a uint8_t (int-promoted) left by 24 is undefined behaviour per C11
6.5.7p4 when the byte value is >= 0x80. Cast the MSB operand to uint32_t at
both sites (CMD_APP_VER line 391, CMD_HDR_VER line 412).

Note: the report's endian-mismatch claim is incorrect. CMD_APP_VER senders
(app_nrf52.c, app_stm32f4.c, app_stm32wb.c) all transmit version bytes
MSB-first; CMD_HDR_VER is sent LSB-first by uart_send_current_version. The
two decode expressions are intentionally asymmetric and both reconstruct the
correct version value.
2026-06-11 18:53:49 +02:00
Daniele Lacamera 71545e96de F-4339: widen uart-flash-server bounds checks to 64-bit to stop uint32_t wrap
uart_flash_erase/read/write read attacker-controlled address and len as raw
4-byte words from the UART peer and guard the mmap region with
`address + len > FIRMWARE_PARTITION_SIZE + SWAP_SIZE`. The addition is done in
uint32_t, so a large len (e.g. 0xFFFFFFFF) wraps the sum below 0x21000 and the
guard passes, after which the loop walks far past the 0x21000-byte mapping —
SIGSEGV on a 64-bit host, or wrapped writes over the firmware header on 32-bit.

Compute address + len in uint64_t before the comparison so the sum cannot wrap.
Add a pty-driven regression test (test_overflow) and a `make test` target that
sends an ERASE with a wrapping address+len and asserts the server survives.
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
gojimmypi fbd8dcf8a2
Update Copyright year to 2025 2025-10-15 11:33:53 -07:00
Daniele Lacamera fce6149cf8 Update license GPL2 -> GPL3 2024-04-16 16:46:15 +02:00
David Garske b9949b0a0c For the hal_flash API's make the change to uintptr_t to support 64-bit explicit using `ARCH_64BIT` or known 64-bit architectures. 2023-08-07 20:54:18 +02:00
David Garske 7190392245 Simulator fixes and support for using MacOS:
* Added simulator support for Mac.
* Fix for simulator to properly assemble wolfboot.bin + signedtestapp + update + swap.
* Fixes for handling 64-bit assigned mmap virtual addresses. Added hal_flash_write and hal_flash_erase support for 64-bit address using uintptr_t. Enabled if platform is 64-bit and `FORCE_32BIT` is not defined
* Fix simulator conflict with src/libwolfboot.o object in test-app.
* Cleanup test-app linker flags.
2023-08-07 20:54:18 +02: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
David Garske f283929161 Improvements to gap fill. The default gap filling byte is `0xFF`. If using `FLAGS_INVERT=1` uses `0x00`. Can be overridden at build-time using `FILL_BYTE`. Fixes ZD 15356. 2022-12-19 11:38:00 +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
Daniele Lacamera 71cb839a07 uart-flash-server: build own libwolfboot.o 2021-12-15 14:57:57 +01:00
Daniele Lacamera f26dd61e23 Fixed delta updates from external devices (+ test) 2021-10-07 14:32:51 +02:00
Daniele Lacamera aaf780fae9 Added test for delta-update-ext 2021-10-07 14:32:51 +02:00
Daniele Lacamera aba428b243 Changed bitrate for uart_flash tests 2021-08-24 10:00:04 +02:00
David Garske d38de3b432 Update copyright year 2021-07-19 07:50:02 -07:00
Daniele Lacamera 24538d19d9 Relocate temporary key slot to the end of the partition 2020-08-11 15:32:47 +02:00
Daniele Lacamera b2beb49370 Fixed bug in encrypted update, removed swap_counter. 2020-07-15 17:36:38 +02:00
Daniele Lacamera 64134ded1f Minor fixes from code review 2020-06-18 18:43:50 +02:00
Daniele Lacamera c9f8f6a12e Added uart driver for stm32wb 2020-06-16 17:52:50 +02:00
Daniele Lacamera fbf4f727a6 Re-added missing includes in ufserver when compiling on linux 2020-04-07 16:41:38 +02:00
Daniele Lacamera aaa5f962e6 minor changes after code review 2020-04-07 16:39:37 +02:00
David Garske ec1b4b4d95 allow the ufserver to build on Mac 2020-04-07 16:35:20 +02:00
Daniele Lacamera 92e1f632c1 Removed magic numbers for bitrate 2020-04-03 20:24:13 +02:00
Daniele Lacamera 7ffcdca098 External, emulated non-volatile memory over UART 2020-04-03 14:27:42 +02:00