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
Mikael Ågren
ff472b0c1f
WIP: verify pre loaded app 2
2025-04-11 09:37:48 +02:00
Mikael Ågren
76b7ba7d73
testloadapp: Use blake2s from tkey-libs
2025-04-11 09:37:47 +02:00
Mikael Ågren
ea6b755699
Add tool to create a flash image containing a preloaded app at slot 0
2025-04-11 09:37:47 +02:00
Mikael Ågren
12916f9736
Do not hardcode preloaded app 1 size
...
Hardcoding it causes preload_check_valid_app and therefore preload_store
to assume there already is an app installed. Causing the
TK1_SYSCALL_PRELOAD_STORE syscall to fail.
2025-04-11 09:37:47 +02:00
Mikael Ågren
04d54c9396
Add QEMU_SYSCALL to enable Qemu syscalls
...
Enable Qemu syscall handling by defining QEMU_SYSCALL instead of
QEMU_DEBUG. That way we can select either or.
2025-04-11 09:37:46 +02:00
Michael Cardell Widerkrantz
7cd1f03933
Add start of test app for installing and verifying flash app
...
Currently needs LIBDIR set to tkey-libs with blake2s().
2025-04-11 09:37:46 +02:00
Mikael Ågren
099fe46e1f
Do note delete or corrupt preloaded app 0 when storing preloaded app 1
2025-04-11 09:37:46 +02:00
Mikael Ågren
90da452f80
Delete app digest and signature when preloaded app is deleted
2025-04-11 09:37:45 +02:00
Mikael Ågren
9018ae5b33
Store app digest and signature for each app slot
2025-04-11 09:37:45 +02:00