Commit graph

10340 commits

Author SHA1 Message Date
bunnie
7743d96e91
Merge branch 'main' into trng-test 2024-06-14 19:17:11 +08:00
bunnie
99cd42f45c
Merge pull request #555 from betrusted-io/new-rust-warnings
clean up warnings in the latest rust
2024-06-14 19:16:05 +08:00
bunnie
0fd6ad7c0e
Merge branch 'main' into new-rust-warnings 2024-06-14 19:14:02 +08:00
bunnie
0036c46ea1 clean up warnings in the latest rust 2024-06-14 19:10:18 +08:00
bunnie
7824874cc8 some tweaks to try and make stalls appear at the right time??? 2024-06-14 18:57:48 +08:00
bunnie
86f22beff5 fix polarity of dtr for sending 2024-06-14 18:41:26 +08:00
bunnie
9cbb37f466 turn off auto trng
we have a console now to start it manually at the right time
2024-06-14 18:21:59 +08:00
bunnie
2a0b18884b local echo on cram target for console 2024-06-14 18:21:42 +08:00
bunnie
0967d686cf turn on debug automatically when going trng - temporary 2024-06-14 18:21:20 +08:00
bunnie
fd1a828561 add debug level handler to usb stack 2024-06-14 16:14:02 +08:00
bunnie
33e43aeb0a add debug level api calls to USB stack 2024-06-14 16:13:43 +08:00
bunnie
87bdd6c197 add log level adjustment command 2024-06-14 16:13:26 +08:00
bunnie
53f8a9f1d6 apply entropy hardening on boot to kernel as well
Shoot for 256 bits minimum entropy in the seed pool, gives us
some safety margin over our required 128.

note that the pool only gets more entropy over time, as every
call to the pool folds more entropy in (roughly 2 bits per call).
2024-06-14 16:12:17 +08:00
bunnie
832d0205c2 expose append zero packet api and rename function to be generic 2024-06-14 16:11:38 +08:00
bunnie
d2c534a3c8 document the entropy compression method
compression helps us reduce the amount of data we have to
shuttle between the hardware interface and the rest of the world.
It takes more samples from the TRNG and represents them in a compressed
form that effectively increases the bits per byte of entropy. It
does not increase the *rate* of entropy generation -- while each
byte has more entropy, the bytes come proportionally slower. However,
this is a reasonable trade-off because kernel space calls to fetch
the entropy feed are expensive, and what this does is effectively
amortize the price of a syscall: the time per syscall is longer,
but you get more entropy out per syscall, thus effectively reducing
the needed overhead to get a certain amount of entropy.
2024-06-14 16:09:01 +08:00
bunnie
eceea1db0b re-introduce the boot delay 2024-06-14 16:08:45 +08:00
bunnie
f91cab4f5d harden swap key generation
trng entropy rate is low, so get a lot of it before using anything
out of the pool.
2024-06-14 16:08:15 +08:00
bunnie
f6fe1143e2 compress sparse TRNG output data 2024-06-14 14:33:11 +08:00
bunnie
562f8bb12e
Merge pull request #554 from betrusted-io/trng-test
TRNG test code for cramium target
2024-06-13 22:25:24 +08:00
bunnie
5fd2ddd32c bump lockfile to reflect new deps for the console 2024-06-13 22:07:17 +08:00
bunnie
af4f096387 quiet down debug 2024-06-13 22:07:08 +08:00
bunnie
27bd7aaa5b no need to make key injection noisy on cramium target
since this is a primary path and not a debug/diagnostic path
2024-06-13 22:06:43 +08:00
bunnie
a8b262af60 change font height based on target for status bar 2024-06-13 22:06:23 +08:00
bunnie
782e94aa65 add mappings for additional fonts in cramium target 2024-06-13 22:06:04 +08:00
bunnie
5f05e15105 add backing storage
this is used to accelerate menu foreground/background as well
as susres
2024-06-13 22:05:20 +08:00
bunnie
b72a00dd2d restore fonts into loader 2024-06-13 22:04:30 +08:00
bunnie
123ff3ed66 add features for cramium target 2024-06-13 22:03:58 +08:00
bunnie
b2a8d0e7f4 add app manifest for cramium target 2024-06-13 22:03:16 +08:00
bunnie
1d01521c38 add repl and status functionality to cram-console 2024-06-13 22:02:47 +08:00
bunnie
d3ad1f11bf reflect changes in lockfile 2024-06-13 16:30:12 +08:00
bunnie
6b107abab5 add cram-console to workspace 2024-06-13 16:29:58 +08:00
bunnie
e5cec6da29 refactor cram-console so that ball is in a separate file 2024-06-13 16:29:43 +08:00
bunnie
d015099c83 more deps cleanup 2024-06-13 16:29:30 +08:00
bunnie
ce1d36782f cleanup target-based deps 2024-06-13 16:18:12 +08:00
bunnie
78d8e05f9a commit API bump 2024-06-13 16:08:41 +08:00
bunnie
5a1c3ca6fe cleanup warnings on the USB driver 2024-06-13 16:08:18 +08:00
bunnie
223e1995ef fix the fix :P 2024-06-13 15:56:37 +08:00
bunnie
242c682a74 cleanup warning that snuck in 2024-06-13 15:54:32 +08:00
bunnie
a360f3ee52 bump xous pins for RawTrng API 2024-06-13 15:49:35 +08:00
bunnie
9bfc4c51f6 add some trng build features 2024-06-13 15:43:42 +08:00
bunnie
76fb67dbe6 add global SFR setup for TRNG proper operation inside loader 2024-06-13 15:43:18 +08:00
bunnie
b24cf4fd8e add guardband code to driver 2024-06-13 15:42:58 +08:00
bunnie
6b9955c30e add raw-trng feature 2024-06-13 15:42:34 +08:00
bunnie
40651a37ea add RawTrng syscall implementation 2024-06-13 15:42:18 +08:00
bunnie
a5322eaa7a add sampling countermeasures to the kernel
this evolves the TRNG state further after reporting any raw samples
for QC to make it harder to reason about the TRNG state after QC.
2024-06-13 15:41:30 +08:00
bunnie
ed2b5ec84d add RawTrng SysCall to Xous API
This SysCall is introduced because not all hardware targets can
afford the luxury of a private TRNG port for the kernel.

In this case, an API is needed to exfiltrate random numbers from
the kernel so we can inspect them and check them for health.

If a TRNG is operating correctly, cherry-picking some values
out of it to QC the operation of the TRNG should be harmless.

Of course, nothing is truly stateless, and there is always a chance
that someone could construct a gadget using this to reduce the
potential state-space of the final random number generator. Therefore,
this API is (a) gated behind a feature flag and (b) any implementation
that plans to expose this should be coded with some countermeasures
to reduce data leakage after sampling.
2024-06-13 15:33:14 +08:00
bunnie
b99b545ef0 add raw test using new syscall 2024-06-13 15:32:51 +08:00
bunnie
34808beb8f remove unused dep 2024-06-13 15:32:34 +08:00
bunnie
3abb68cbdc adjust TRNG parameters to match hw reality 2024-06-13 15:32:06 +08:00
bunnie
82e5594da4 add auto-trng feature to the USB stack
for compact/quick testing of TRNG in a harness
2024-06-13 00:37:07 +08:00