Michael Cardell Widerkrantz
546ceeba45
docs/fw: Update firmware README
...
- Describe all the new functionality.
- Revise text.
2025-04-11 16:22:00 +02:00
Mikael Ågren
7755716b1e
Format c code
2025-04-11 11:55:04 +02:00
Mikael Ågren
fbd8d9e866
fw: Only allow management app to read app digest and signature from flash
2025-04-11 09:38:06 +02:00
Mikael Ågren
a4ae484a92
testloadapp: Describe commands
2025-04-11 09:38:05 +02:00
Mikael Ågren
801fee2ef0
testloadapp: Print syscall return codes on error
2025-04-11 09:38:05 +02:00
Mikael Ågren
15c80f65ed
fw: Remove SET_LED syscall
...
SET_LED was used during development and no longer needed
2025-04-11 09:38:04 +02:00
Michael Cardell Widerkrantz
a3bdc73efa
fw: Simplify starting management app
...
- In state INITIAL: Register allowed app digest early for the default
case where we start from flash slot 0. Transition to LOAD_FLASH_MGMT.
- Introduce new state FW_STATE_LOAD_FLASH_MGMT which loads an app from
flash slot 0 and registers app as a prospective management app.
- Rely on ordinary verification in state START to actually do the
verification of the prospective management app.
2025-04-11 09:38:04 +02:00
Michael Cardell Widerkrantz
767be4fd43
fw: Change flash 1 and flash 2 to flash 0 and 1
2025-04-11 09:38:04 +02:00
Michael Cardell Widerkrantz
3edc0001e6
fw: Fix splint complaints
...
- Make splint work on current code.
- Check error return values.
- Cast to void when not caring about result.
- Declare internal functions to be static.
2025-04-11 09:38:03 +02:00
Mikael Ågren
8562f08e2c
fw: Check for NULL pointer in copy_name
2025-04-11 09:38:03 +02:00
Mikael Ågren
65e67b604d
fw: Check NULL pointer in main.c
2025-04-11 09:38:02 +02:00
Mikael Ågren
bc8efe03e7
fw: Initialize arrays in partition_table.c
2025-04-11 09:38:02 +02:00
Mikael Ågren
648b0e91c8
fw: Initialize arrays in auth_app.c
2025-04-11 09:38:02 +02:00
Mikael Ågren
76ba5e8ede
fw: Check blake2s_init return value
2025-04-11 09:38:01 +02:00
Mikael Ågren
92a6b70118
reset_test: Use digest of tkey-libs example app when starting from second flash slot
2025-04-11 09:38:01 +02:00
Mikael Ågren
abc1fc8280
fw: Remove leftover debug usage of puts/readselect/read
2025-04-11 09:38:00 +02:00
Mikael Ågren
b865111c0f
fw: Add pointer argument NULL checks
2025-04-11 09:38:00 +02:00
Mikael Ågren
e52b68650f
check fix: Prevent SPI write if tx_buf is or tx_size is 0
...
To avoid NULL pointer access if tx_buf is NULL but tx_size is not 0
2025-04-11 09:37:59 +02:00
Mikael Ågren
c14f8d634a
check fix: Mark argument to debug function as unused
...
The md argument will only be used when compiling with debug_ functions
enabled
2025-04-11 09:37:59 +02:00
Mikael Ågren
fba3b45380
check fix: Remove _ prefix from function names
2025-04-11 09:37:59 +02:00
Michael Cardell Widerkrantz
ab64043318
fw: Rename FIRMWARE_SOURCES, use globbing
...
The symbol is only used for the check targets (with clangd and splint)
and doesn't include all the source files in the firmware. Let's just
use globbing instead.
2025-04-11 09:37:58 +02:00
Michael Cardell Widerkrantz
12764168e6
Remove unused state CDI
2025-04-11 09:37:58 +02:00
Michael Cardell Widerkrantz
3d4f177359
fw: Remove define about size of app in app slot 0
2025-04-11 09:37:57 +02:00
Michael Cardell Widerkrantz
dd641118b8
fw: Use BLAKE2s functions from tkey-libs
...
Instead of using the firmware's own copy of BLAKE2s functions, use the
functions from tkey-libs.
2025-04-11 09:37:57 +02:00
Michael Cardell Widerkrantz
f87a70b87a
Import tag fw-3 of tkey-libs
...
- Use tag fw-3 from https://github.com/tillitis/tkey-libs/
- New tkey-libs also affects testloadapp which means new
allowed_app_digest and new default_partition.bin.
2025-04-11 09:37:57 +02:00
Mikael Ågren
eb02ad16da
Add default partition table
...
Partition table built with `./partition_table/partition_table -o
default_partition.bin --app0 ../fw/testloadapp/testloadapp.bin`
testloadapp.bin built with the tkey-libs blake2s branch, commit
b529a8849f23
2025-04-11 09:37:56 +02:00
Mikael Ågren
16e478a993
fw: Use existing compute_app_digest function when loading from client
2025-04-11 09:37:56 +02:00
Mikael Ågren
06f67f3eec
fw: Remove check CDI TODO
...
The app has started before calculatate_auth_digest is called
2025-04-11 09:37:56 +02:00
Michael Cardell Widerkrantz
98f852b27b
fw: testloadapp: Add reset to client loading
2025-04-11 09:37:55 +02:00
Michael Cardell Widerkrantz
dc9f2c6750
fw: Simplify state machine
...
- Remove state FW_STATE_CDI.
- Add CDI calculation to FW_STATE_START.
- Go directly to FW_STATE_START from both _LOAD_FLASH and _LOADING.
2025-04-11 09:37:55 +02:00
Michael Cardell Widerkrantz
557031aadc
fw: Re-arrange check for free app slot
...
- Check explicitly for free app slot. Remove function call.
- Add checks for slot number overflow to preload_store().
2025-04-11 09:37:55 +02:00
Michael Cardell Widerkrantz
9608c95931
fw: Pass length of next_app_data to syscall reset
2025-04-11 09:37:54 +02:00
Mikael Ågren
6d76bdeafd
fw: Read pre loaded app 0 size from flash
2025-04-11 09:37:54 +02:00
Mikael Ågren
da275acebc
Optionally add size of pre loaded app 0 when generating partition table
2025-04-11 09:37:54 +02:00
Michael Cardell Widerkrantz
8347ae7c8e
fw: Add status syscall for flash status
...
Add a way of reporting invalid partition table copy through a new
syscall for TKey status.
2025-04-11 09:37:53 +02:00
Michael Cardell Widerkrantz
e1d25f6d74
fw: Indicate which partition table used by return value when reading
...
- Return 0: Slot 0 used.
- Return 1: Slot 1 used, indicating slot 0 broken!
2025-04-11 09:37:53 +02:00
Michael Cardell Widerkrantz
2eee630649
fw: Load default partition table image when installing preloaded app
2025-04-11 09:37:53 +02:00
Michael Cardell Widerkrantz
4c29de23dc
Update length and digest of testloadapp
2025-04-11 09:37:52 +02:00
Michael Cardell Widerkrantz
1636b40c71
fw: Implement redundancy of partition table
2025-04-11 09:37:52 +02:00
Michael Cardell Widerkrantz
03625b312d
Remove commented out code about creating partition table
2025-04-11 09:37:51 +02:00
Mikael Ågren
f24c7ea515
fw: Add checksum to partition table
...
Refuse to boot if blake2s digest over the partition table does not match
digest stored on flash
2025-04-11 09:37:51 +02:00
Michael Cardell Widerkrantz
75dd726998
tool: Introduce b2s tool to help compute BLAKE2s digests
2025-04-11 09:37:51 +02:00
Mikael Ågren
caa06dcc4a
testapp: Fix illegal TK1_SYSCALL_RESET call
2025-04-11 09:37:50 +02:00
Mikael Ågren
fba6e04c7f
fw: Only allow sector aligned erase ops
2025-04-11 09:37:50 +02:00
Mikael Ågren
930d204e9f
fw: Remove storage area address and size from partition table
...
Instead we calculate start addresses from area index and use fixed size.
2025-04-11 09:37:50 +02:00
Mikael Ågren
b837eec9e6
fw: Remove TK1_SYSCALL_REG_MGMT
...
Validate preload API access using the fixed, pre-calculated app digest
instead of letting an app register itself as a management app.
2025-04-11 09:37:49 +02:00
Mikael Ågren
715d792d86
fw: Remove pre loaded app auth and status from partition table
2025-04-11 09:37:49 +02:00
Mikael Ågren
f590f423a3
Add tool to inspect partition table dump
2025-04-11 09:37:49 +02:00
Michael Cardell Widerkrantz
29638a99a0
fw: Only allow a specific app to start from first flash
...
Store size and app digest in ROM and compare to what we are booting.
2025-04-11 09:37:48 +02:00
Mikael Ågren
d9a9e22074
testloadapp: Delete any existing preloaded app before installing
2025-04-11 09:37:48 +02:00