Commit graph

10340 commits

Author SHA1 Message Date
bunnie
9ff8ab0caa gate off trngav in dabao builds targeting trng characetrization 2025-11-24 18:28:23 +08:00
bunnie
d30d889774 add rtc hardware drivers and service 2025-11-24 18:28:00 +08:00
bunnie
cd8a312b8d switch on the xtal32 source for the rtc in baosec mode, in the loader 2025-11-24 18:27:04 +08:00
bunnie
87b3bbba4d add RTC initialization
a random offset is added to the base RTC value to obscure how
long the device has been in continuous use for
2025-11-24 18:26:36 +08:00
bunnie
d116509a5a
Merge pull request #740 from betrusted-io/sec-ci
Ci improvements
2025-11-23 18:18:05 +08:00
bunnie
8a60f771af add a tailored command to setup baosec boards in boot1
this simplifies CI a bit instead of having to bounce over
to a baremetal image to set things up.
2025-11-23 18:05:48 +08:00
bunnie
9a1cd5429d turn off console printing to USB when USB is shut down 2025-11-23 18:05:28 +08:00
bunnie
428845777b
Merge pull request #739 from betrusted-io/sec-ci
initialize backup register region
2025-11-23 09:12:14 +08:00
bunnie
31d0a6c691 use the opportunity to introduce a little jitter in the reboot timing 2025-11-23 09:05:03 +08:00
bunnie
47428f40ff add backup register initialization
this will cause a "double boot" of boot0 on the very first
power-up
2025-11-23 08:49:50 +08:00
bunnie
960ba350cb add bu_mem locations
these failed to extract automatically from the RTL
2025-11-23 08:48:24 +08:00
bunnie
95c8046111 add backup region abstractions
these persist through a sleep cycle
2025-11-23 08:47:43 +08:00
bunnie
d531330514
Merge pull request #738 from betrusted-io/sec-ci
fix boot0 write test & ensure pins are setup in baremetal
2025-11-22 22:46:30 +08:00
bunnie
0b03a183ea fix boot0 write test & ensure pins are setup in baremetal 2025-11-22 22:29:11 +08:00
bunnie
04031a2315
Merge pull request #737 from betrusted-io/sec-ci
More fixes for security CI environment
2025-11-22 13:50:39 +08:00
bunnie
d124d60577 ensure that baremetal on baosec sets up USB pin; pass through redteam flag 2025-11-22 13:43:41 +08:00
bunnie
f502270b60 remove force-dabao default for altboot1 2025-11-22 13:43:20 +08:00
bunnie
4a4b5f182d fix product description & serial number in baremetal 2025-11-22 00:53:27 +08:00
bunnie
c7a94a7899
Merge pull request #736 from betrusted-io/sec-ci
Security CI configs
2025-11-21 01:31:53 +08:00
bunnie
5bf4a6416a add configurations for security testing 2025-11-21 00:58:23 +08:00
bunnie
4f2d1215bc add deliberately misordered keystore config
for validating keystore hw protection
2025-11-21 00:58:05 +08:00
bunnie
31d8cf4e00
Merge branch 'main' into vault2-progress 2025-11-20 23:39:33 +08:00
bunnie
4b4ec33964
Merge pull request #735 from betrusted-io/bootwait-state
add ability to directly set bootwait
2025-11-19 17:22:16 +08:00
bunnie
dc710b3498 add ability to directly set bootwait
instead of having to read and then figure out which state we're in
2025-11-19 17:07:39 +08:00
bunnie
2a026e0368
Merge pull request #734 from betrusted-io/more-fixes
fix test escape
2025-11-19 14:53:22 +08:00
bunnie
d616befca7 fix test escape 2025-11-19 14:43:30 +08:00
bunnie
b1be9e6d3e
Merge pull request #733 from betrusted-io/more-fixes
More CI fixes
2025-11-19 14:12:02 +08:00
bunnie
49dcc7aaa2 add CI telemetry for keystore init 2025-11-19 14:00:59 +08:00
bunnie
3893bc78a7 add more annotations & set bootwait on setting board type
bootwait allows automation to load the swap image after the
board type is set correctly

breaks the paradox that you can't init swap on a blank chip
because it doesn't know it has swap
2025-11-19 14:00:08 +08:00
bunnie
b587f63279 emit CI diagnostic on kernel sigfail 2025-11-19 13:54:53 +08:00
bunnie
e8529e1e43 add missing dep 2025-11-19 13:10:45 +08:00
bunnie
5a012be146 add baremetal routine to erase the external swap
needed for renewing boards in testing
2025-11-19 13:09:14 +08:00
bunnie
b63b82cca0 improve README 2025-11-19 13:09:02 +08:00
bunnie
09cecfc899
Merge pull request #732 from betrusted-io/minor-fixes
Minor fixes
2025-11-19 00:06:17 +08:00
bunnie
90362b2604 fix hosted mode 2025-11-18 23:59:17 +08:00
bunnie
a208d59690
deny boot to any developer-key signed kernel/detached-app/swap images
Secret keys can't be erased after boot1 exits because the protection
bits are hardened from modification after that point.

thus it is not possible for the loader to switch the device
into developer mode.

Thus the only way to enter developer mode is through a dev-mode
signed loader. A system that has never been put into developer
mode will refuse to run any developer-mode xous kernel, app, swap
images.

Once a system has been exposed to a dev-mode signed loader,
the boot1 will flip the developer mode bit and erase the secret
keys.

Later on, if a production loader is replaced, it doesn't matter
that a production loader is loading dev-mode signed successors
because the secret keys are already erased.

Note that in all cases, the key revocations take precedence
so if the developer key is revoked, these cases should never
even be encountered.
2025-11-18 23:33:33 +08:00
bunnie
22f44f82b9
add debug telemetry to the keystore
this is constructed in a way such that

1. it's gated off in production builds
2. if it was accidentally gated on, there is some security impact
but not a significant loss of security

We do need the telemetry so that during CI we can confirm that things
are actually working. I think the risk of being too buttoned-up
and then accidentally doing something like accidentally never
initializing keys and leaving them all zero is greater than the
risk of accidental partial leakage of information due to a procedural
mix-up in the image signing ceremony.
2025-11-18 23:20:31 +08:00
bunnie
145c2e37b2 raise visibility of the erase value 2025-11-18 23:19:28 +08:00
bunnie
ad116b5af6 reduce leakage during hazardous-debug
in theory, no production images should be signed that have this
feature enabled. But, reducing the amount of leakage just in
case an accident happens and this flag is somehow slipped
into a signed production image.
2025-11-18 22:46:20 +08:00
bunnie
0723306085 update docstring 2025-11-18 22:40:36 +08:00
bunnie
fdb613cfb3 fix corner case on non-word aligned buffers 2025-11-18 22:40:09 +08:00
bunnie
c98865d2e3 update dependencies 2025-11-18 19:36:11 +08:00
bunnie
69b77f3072 allow gen2 to use the seeded trng fill 2025-11-18 19:35:59 +08:00
bunnie
0942858bbc add test cases for trng 2025-11-18 19:35:48 +08:00
bunnie
4f39532471 clean up filling API
previous implementation was full of too many special cases

also add a version that allows us to fill using a seeded CSPRNG
for better performance on bulk fills
2025-11-18 19:34:57 +08:00
bunnie
d45330e65d improve the bdma test
this makes the output of the bdma test a bit more compact, and
adds some features to help CI automation to pick out failures
to help validate if fixes are durable
2025-11-18 18:11:49 +08:00
bunnie
b64cff6f86
Merge pull request #731 from betrusted-io/fix-fonts
fix broken font rendering in rust 1.91
2025-11-18 00:32:40 +08:00
bunnie
4477af6058 fix broken font rendering in rust 1.91
Rust 1.91 (or perhaps, more accurately llvm?) changed how link
ordering works.

Previously, modules would be linked in the order they were referenced
(e.g. pub mod b; pub mod a; would result in b being at a lower address
than a in the resulting binary).

However, apparently, this has changed and now someone in their
infinite wisdom decided that modules should be alphabetized before
linking.

I'm really not sure why the arbitrary ordering of the human alphabet
is superior to any other system, and also, if you really wanted
things alphabetized, you could just alphabetize them in your
reference order.

Previously the fonts were laid out in a way that tried to minimize
cache thrashing by co-locating certain sets of fonts together.

Now they are just sprayed around through the arbitrary and not
terribly useful permutation funtion of the english alphabet.

Rant off.

This changes the specification of the fonts in the code generator
to be in alphabetical order, making the screen once again legible.
2025-11-18 00:18:55 +08:00
bunnie
ba52e75ab7
Merge pull request #730 from betrusted-io/ci-coverage
Cover bao1x targets in CI
2025-11-17 17:46:50 +08:00
bunnie
122707cd15 extend CI coverage to include pull requests targeting main 2025-11-17 17:37:10 +08:00