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
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
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
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
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
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
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
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
Michael Cardell Widerkrantz
93a49f50c2
Introduce syscalls to change preloaded app
...
Introduce syscalls:
- TK1_SYSCALL_PRELOAD_STORE
- TK1_SYSCALL_PRELOAD_STORE_FIN
- TK1_SYSCALL_PRELOAD_DELETE
- TK1_SYSCALL_REG_MGMT = 11
Change preload_store_finalize() not to take USS arg. Unused for
preloaded apps.
2025-04-11 09:37:45 +02:00
Mikael Ågren
ac5c2aef86
fw: Add second pre-loaded app slot in flash
2025-04-11 09:37:44 +02:00
Mikael Ågren
1c4d11f49e
fw: When requested, verify app digest before running
2025-04-11 09:37:44 +02:00
Mikael Ågren
e4028d9a86
Handle reset info in reset syscall
...
Disabling debug printouts to get firmware to fit in ROM
2025-04-11 09:37:44 +02:00
Jonas Thörnblad
ba211212f0
Add resetinfo testapp
...
Co-authored-by: Mikael Ågren <mikael@tillitis.se>
Co-authored-by: Michael Cardell Widerkrantz <mc@tillitis.se>
2025-04-11 09:37:43 +02:00
Michael Cardell Widerkrantz
ba9e08fcdb
Add resetinfo handling
...
Decide where to start from with data from resetinfo part of FW_RAM.
Co-authored-by: Jonas Thörnblad <jonas@tillitis.se>
Co-authored-by: Mikael Ågren <mikael@tillitis.se>
2025-04-11 08:43:41 +02:00
Michael Cardell Widerkrantz
76b25bc121
Document state machine
...
Golden path not updated
2025-04-11 08:43:41 +02:00
Michael Cardell Widerkrantz
ab12c201c4
Experiment with new state machine
2025-04-11 08:43:41 +02:00
Michael Cardell Widerkrantz
6ef1b1c659
Experiment with state machine when starting from flash
...
- Move around code to start an app from flash.
- Mark experimental stuff and debug stuff more clearly.
2025-04-11 08:43:40 +02:00