Commit Graph

84 Commits

Author SHA1 Message Date
Daniel Jobson
a9436c092b
Implement preload_store 2024-09-23 15:42:24 +02:00
Daniel Jobson
632bd33b9b
Temporarily override the blake2s trampoline 2024-09-23 15:42:24 +02:00
Daniel Jobson
b602de145c
Wip syscall function.
PoC of how a syscall could look like.
2024-09-23 15:42:24 +02:00
Daniel Jobson
f62930984d
WIP app storage calls 2024-09-23 15:42:23 +02:00
Daniel Jobson
4770f18137
preload_add: only allow mgmt app to store or delete 2024-09-23 15:42:23 +02:00
Daniel Jobson
0669df4c27
WIP management app 2024-09-23 15:42:23 +02:00
Daniel Jobson
30f5d359ea
fw: remove address-of operator (&) where it is not needed
- `digest` is an array and hence the address of the first element is
  returned.
- This will keep it more consistent with the rest of the code base.
- Fixed misspelled comment.
2024-09-23 15:42:23 +02:00
Daniel Jobson
26045bfcd1
fw: use bool as return type for memeq 2024-09-23 15:42:23 +02:00
Daniel Jobson
80a155a1c2
Include authentication of preloaded app 2024-09-23 15:42:23 +02:00
Daniel Jobson
0abfdf592b
fw: break out trng and xorwow to rng.[ch] 2024-09-23 15:42:23 +02:00
Daniel Jobson
54b8b1cc4e
fw: Break out htif functions for qemu to separate files 2024-09-23 15:42:18 +02:00
Daniel Jobson
0bec032db3
temp commit: Expose write functions to make development easier 2024-09-23 15:37:14 +02:00
Daniel Jobson
534ac06e86
Add fw state and fw cmd to trigger a start of a preloaded app 2024-09-23 15:37:14 +02:00
Daniel Jobson
b52e57d4ea
WIP auth app 2024-09-23 15:37:14 +02:00
Daniel Jobson
af7df7c9e8
WIP preload_app 2024-09-23 15:37:13 +02:00
Daniel Jobson
c3baad9a23
WIP partition table 2024-09-23 15:37:13 +02:00
Daniel Jobson
a5c2d05cb1
Import spi.[ch] and flash.[ch] 2024-09-23 15:37:13 +02:00
Daniel Jobson
2246dbfa45
fw: Create compute_app_digest() function 2024-09-23 15:37:13 +02:00
Daniel Jobson
698b2796ee
Remove types.h in favor of standard libs such as stdint, stddef 2024-09-23 15:37:13 +02:00
Daniel Jobson
81950ef7b2
fw: remove warning of missing prototypes when building with QEMU console
enabled.
2024-09-19 16:52:04 +02:00
Daniel Jobson
613316f53e
fw: simplify how to enable QEMU debug in firmware.
- Remove the define `NOCONSOLE`, add define `QEMU_CONSOLE`
- Inverse the use of it, add the define to have QEMU debug output in fw.
- Add a make target `qemu_firmware.elf` which builds the firmware with
  QEMU console enabled.

Co-authored-by: Mikael Ågren <mikael@tillitis.se>
2024-09-19 16:51:55 +02:00
Joachim Strömbergson
53c5e70795
FPGA: Update names for RAM randomization API
Update:
- README
- testbench
- Symbolic names and variables in fw
- registers
- port name and wires
- Update fpga and fw digests

Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2024-07-10 13:45:26 +02:00
dehanj
b4c525695a
Remove redundant RAM address and data scrambling
The RAM address and data scrambling API was called twice, once before filling
RAM with random values, and once after. Since moving to a significantly
better PRNG (xorwow) this is now deemed unnecessary. See issue #225.

This changes both FPGA and firmware hashes.
2024-06-13 12:54:47 +02:00
Joachim Strömbergson
92712a11bf
fw: zeroise FW-RAM instead of RAM
Modify the loop to zeroise the FW-RAM instead of the
RAM. RAM is filled with random data at the start of main().

Changes firmware and bitstream digests.

Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2024-06-12 18:11:10 +02:00
Joachim Strömbergson
eade3e11c5
Fill RAM with random data using xorwow.
xorwow provides significantly better random data, compared to previously
used function. Making it harder to predict what data RAM is filled with.
It adds a startup time of approx 80 ms, but can be compensated with
optimising other parts of the startup routine.

This changes both firmware and fpga hashes.

Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2024-06-11 11:15:00 +02:00
dehanj
4bd249816a
fw: Remove unused header includes 2024-03-26 13:09:06 +01:00
dehanj
3a6a60ff26
fw: Protect zeroisation against compiler optimisation.
The memset() responsible for the zeroisation of the secure_ctx under
the compute_cdi() function in FW's main.c, was optimised away by the
compiler. Instead of using memset(), secure_wipe() is introduced
which uses a volatile keyword to prevent the compiler to try to
optimise it. Secure_wipe() is now used on all locations handling
removal of sensitive data.
2024-03-26 13:09:01 +01:00
Michael Cardell Widerkrantz
09c1f3f549
Silence splint somewhat
The only real changes are some unitialized variables and that we now
make explicit that we don't care about the return value from memset().
2024-03-22 11:03:13 +01:00
Michael Cardell Widerkrantz
4d4db70590
fw: Change ASLR name in MMIO
Use _RAM_ADDR_RAND instead of _RAM_ASLR since this is not OS-level
ASLR we're talking about. It's address randomization as seen from
outside of the CPU, not from the process running inside it. Ordinary
ASLR is visible from the CPU.
2024-03-19 14:36:31 +01:00
Michael Cardell Widerkrantz
e085d0ebd0
Add void to function signatures meant to be used without args 2024-03-19 08:41:39 +01:00
Michael Cardell Widerkrantz
e2bd38c540
fw: Remove unusued forever_redflash()
Since we now use assert() and feed the CPU an unimplemented
instruction we have no need for this.
2024-03-18 16:19:59 +01:00
dehanj
9d36acde08
FW: Force the CPU to hang on errors 2024-03-14 15:48:10 +01:00
Joachim Strömbergson
6d0a761e65
Make memeq function side channel silent
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:23 +02:00
Michael Cardell Widerkrantz
c126199a41
fw: UDS not byte-readable
Since UDS is not byte-readable we copy it by word to local_uds. Now
UDS lives for a short while in local_uds on the stack in FW_RAM and in
the internal buffer of the blake2s context (also in FW_RAM) but is
very soon overwritten.
2023-03-27 16:24:02 +02:00
Michael Cardell Widerkrantz
cefb6ca9c1
fw: Change max frame size to 128 bytes 2023-03-27 10:58:16 +02:00
Michael Cardell Widerkrantz
c443ef8a3e
fw: clang-tidy and splint: New make target: check
Add clang-tidy and splint static analytics check. For now, we use only
the cert-* warnings on clang-tidy and run splint with a lot of flags
to allow more things.

Changes to silence these analytics:

- Stop returning stuff from our debug print functions. We don't check
  them anyway and we don't have any way of detecting transmission
  failure.

- Declare more things static that isn't used outside of a file.

- Change types to be more consistent, typically to size_t or
  something or to uint32_t.
2023-03-22 11:05:32 +01:00
Michael Cardell Widerkrantz
f622937918
fw: Don't use reserved or reserved-looking names 2023-03-22 11:05:26 +01:00
Michael Cardell Widerkrantz
9488f0633d
fw: Hide *led in led.c 2023-03-16 14:26:20 +01:00
Michael Cardell Widerkrantz
8665031bb4
fw/testfw: Simplify hexdump 2023-03-16 14:26:13 +01:00
Michael Cardell Widerkrantz
7ce1d9fe06
fw: Remove forgotten hexdump 2023-03-16 14:03:11 +01:00
Michael Cardell Widerkrantz
1f10c8e2db
fw: Initialize automatic variables 2023-03-16 13:51:24 +01:00
Michael Cardell Widerkrantz
226bcbaed1
fw: Update comments 2023-03-16 13:30:56 +01:00
Michael Cardell Widerkrantz
00d806df10
fw: Rename variable rnd to rnd_sleep to indicate what it's for 2023-03-16 13:17:42 +01:00
Michael Cardell Widerkrantz
cd2dc55371
fw: Add function declaration for static functions 2023-03-14 11:31:48 +01:00
Michael Cardell Widerkrantz
0a1e1db40e
fw: Init stack pointer to end of fw_ram 2023-03-14 11:31:48 +01:00
Daniel Lublin
2b9bfc0eff
Consistently set any new state and do break out of case/default
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 11:31:48 +01:00
Michael Cardell Widerkrantz
f9960de506
fw: Re-introduce print_hw_version() - simplify namever handling 2023-03-14 11:31:48 +01:00
Michael Cardell Widerkrantz
78eb472ac9
fw: Go to state fail on bad command lengths 2023-03-14 11:31:48 +01:00
Michael Cardell Widerkrantz
ebf8a11ed0
fw: Move all variable declaration to first in scope 2023-03-14 11:31:48 +01:00
Michael Cardell Widerkrantz
9c766794db
fw: Move scramble RAM to own function 2023-03-14 11:31:47 +01:00