Commit graph

10340 commits

Author SHA1 Message Date
bunnie
e1c07cbf0b cleanup some debug output & fix ref link 2025-10-21 04:16:45 +08:00
bunnie
602ef2d8a4
update signing procedure notes 2025-10-21 03:16:21 +08:00
bunnie
3e4b0b6571
Add bao2 signing keys 2025-10-21 02:39:11 +08:00
bunnie
2559ddd02d
stash state on some issues in ACL setup
the key setup seems to work correctly
but the data ACL setting doesn't "stick". The region
could be write-protected by some other element in the
CP/IFR config, need to dig a lot more. For now we need
to move on and crank out something to stick on the alpha
dabao boards...
2025-10-21 02:19:40 +08:00
bunnie
b8e856a15a
loose ends - api caller-side fixups and lockfile changes 2025-10-20 23:40:50 +08:00
bunnie
4affb7e979
add the code for initializing keys & setting up ACLs
this code audits the status of the data/key slots,
initializes them according to the platform, and sets
the permissions on them to prevent read-out later on.

A TRNG routine is built into boot1 now, I think it's
reasonably conservatively coded but more testing/inspection
is always good.
2025-10-20 23:39:04 +08:00
bunnie
1eeaa23516
Realizing that the permission level settings could change
Not locking them down in boot0: allowing them to be set up
in boot1. this is less hermetic, but already I have thought
of a couple of reasons to modify the tables; for example,
the dabao configuraiton if someone wanted to make a secured
version, you might not want PID 3 to be the trusted PID;
or if you wanted to have two different sets of keys for
different purposes, you can use the other permission levels
to separate them.

So, leaving it configurable. for now.
2025-10-20 23:36:34 +08:00
bunnie
2095acfe13
slot manager debug.
add read/write specs as well to the slot definitions.

Not terribly happy with how this all worked out. The subtle
differences between Data and Keys is really irritating.
it's the sort of thing you would say "let's make a trait"
for it but then the two behave just differently enough
that I worry I can't make a trait generic enough to encompass
all the weird stuff that exists in the hardware.

The existing implementation definitely looks like trait
territory, but it currently hides the subtleties around
key/data chaining and secure crypto engine handling of
the two regions as distinct entities. so long as we don't
plan to use those things, traits are a good idea, but
i don't feel like I can reject using the crypto engine
features out of hand this early on just to make the
APIs nice and square.
2025-10-20 23:32:29 +08:00
bunnie
5c60de32ce
debug the slot manager and rram APIs 2025-10-20 23:31:01 +08:00
bunnie
13348bf94a
update lockfile and remove a stale alias
the alias breaks clones on vanilla windows
2025-10-20 02:22:02 +08:00
bunnie
252942ae0b
update baremetal APIs to track latest patches 2025-10-20 02:21:28 +08:00
bunnie
1d5cc0806b
update boot1 to use slotmanager API
also add the hook for setting up/checking all the other slots
2025-10-20 02:20:45 +08:00
bunnie
356ab47c3c
add coreuser table setup to boot0
I think it belongs here, because this "should" be a "baked in"
setting. Maybe I'll regret that, because it really enforces
a hardware one-way door on changing/updating the coreuser maps,
but also, I think it makes it a bit stronger if there is no
easy way to bypass/override that setting.
2025-10-20 02:18:28 +08:00
bunnie
0943b67972
implementation of the ACL APIs and coreuser functionality
'coreuser' is a slightly confusing term from the hardware
system because it's overloaded to mean some conceptually
related items that aren't implementation-wise essentially linked.

coreuser defines both some access protections on the main
array of the RRAM, and also some access protections on key
and data slots.

this patch includes some code that sets up the coreuser
functionality to a very simple scheme where just one PID
is trusted and the rest are not trusted. More complicated
schemes could be introduced with varying levels of trust
and dependencies but I like the analytical simplicity of
two states, so let's start there and complicate only when
absolutely necessary.
2025-10-20 02:15:20 +08:00
bunnie
a64337679f
Add API for defining key/data slots, and initial ranges for the same
Data and key slots are hardware access-controlled areas that
can store sensitive data. Slot definitions come with a "spec"
field that defines what the access controls *should* be,
so that we can check them later.

In practice no user code should be manipulating these, but
there is an initial stage where a totally blank device needs
to be provisioned, hence the focus on correct specification
and checking of state, rather than convenient runtime manipulation
and update of the same.
2025-10-20 02:07:19 +08:00
Jeanie
6d12008a80 adding commands and code related to flashing 2025-10-20 01:29:56 +09:00
Jeanie
38d3c17ee8 file creation and structure for options 2025-10-19 06:11:16 +09:00
bunnie
5f5bf755a5 meant to not check in with the flag activated 2025-10-19 01:24:03 +08:00
bunnie
972450e306
propagate flag changes to crates that can configure it 2025-10-19 01:20:53 +08:00
bunnie
8f208cac4c
refactor debug-print in bao1x-hal
on dabao targets the duart is unavailable, so, it's convenient to
have a uart-based debug option in the HAL. this patch creates a
flag that can allow either target.
2025-10-19 01:19:30 +08:00
bunnie
fe4ef1bc39
refactor rram API
- add range checking to control access to main array or secure
array. This is purely a software enforced check, but it is in
theory backed by hardware gating that is a back stop in case
an adversary can gain arbitrary code access
- rework the rram primitive to return an error type
- add a `std` implementation stub. It is still missing an IRQ
context handler which ensures that all RRAM writes are atomic,
e.g. you can't take an interrupt in the middle of an RRAM
write because it would screw up the buffer staging.
2025-10-19 01:09:58 +08:00
bunnie
951f088625
add coreuser templates
coreuser is the signal that sets the security level of the system
2025-10-19 01:09:15 +08:00
bunnie
39ceef55f3
Add protected-rram module
this lays the foundation for access control, data slots,
key slots, etc.
2025-10-19 01:07:44 +08:00
bunnie
b59bff2223 cleanup/redefine keyslot regions 2025-10-19 01:06:54 +08:00
bunnie
0f2d971c6b beginning of access control tests 2025-10-19 01:06:31 +08:00
bunnie
9b5ef52e9c update clock/voltage mapping in baremetal
baremetal does kick itself up into a higher performance mode
than the bootloader
2025-10-19 01:05:36 +08:00
bunnie
7383bd5356 move boot1 to also use the lower boot frequency
this does not seem to have a large effect on update times and
allows us to operate over more platform configurations absent
specific power-on control code
2025-10-19 01:04:21 +08:00
bunnie
7bd43d6499 change s/n readout API to use the new SlotManager API 2025-10-19 01:03:55 +08:00
bunnie
92a3b05627 reduce boot freq / voltage even lower
this allows boot on extremely "weak" systems where very little
power is available.
2025-10-19 01:02:43 +08:00
bunnie
b864445dff version generators should not be checked in 2025-10-19 01:02:20 +08:00
Yuval Adam
f297c3b2a5 Remove python cache and build artifacts, update .gitignore
Signed-off-by: Yuval Adam <_@yuv.al>
2025-10-17 22:04:14 +02:00
bunnie
a5704d292d
Merge branch 'main' into protected-rram 2025-10-18 01:19:50 +08:00
bunnie
201c143762
Merge pull request #701 from betrusted-io/db-selfstest
Add selftest feature for dabao
2025-10-18 01:19:37 +08:00
bunnie
11a95e13d1 add a small self-test routine to baremetal
when enabled as a feature, runs through all the I/Os available
on a dabao board.

This will be the default firmware loaded on a doabao board.
2025-10-18 01:16:42 +08:00
bunnie
a40bb7c244 other half of the adjustment 2025-10-18 01:16:16 +08:00
bunnie
464d26e7b0 adjust default voltages & freqs to be in-line with validation numbers 2025-10-18 01:15:52 +08:00
bunnie
59c3ca5c7e
Merge branch 'main' into protected-rram 2025-10-16 23:39:35 +08:00
bunnie
36b1868fc4 add ram zeorization to top of boot
this slows down boot a little bit but I think this is a good
idea from a security perspective.
2025-10-16 23:37:35 +08:00
bunnie
07dd14057a
Merge pull request #699 from betrusted-io/dabao-sample
Dabao sample
2025-10-16 23:35:49 +08:00
bunnie
0efcd0af90 clean up a debug print 2025-10-16 23:26:30 +08:00
bunnie
0bd4de961a I think I won't regret putting a semver into the boot0 stage too
Even though boot0 DUART output may be inaccessible, the string
could still be found by looking in the binary and searching
for it.
2025-10-16 23:25:44 +08:00
bunnie
254780b382 add some artifacts for an early sample run
These are a bit rushed but wanted to be able to have some
serialization/tracking in the earliest samples sent to
'alpha-zero' developers.
2025-10-16 23:21:07 +08:00
bunnie
13cd4f14a1
Merge branch 'main' into vault2 2025-10-08 02:59:59 +08:00
bunnie
cafd760bf5
Merge pull request #698 from betrusted-io/bdma-noodling
Bdma noodling
2025-10-08 02:59:47 +08:00
bunnie
426ed8b088
update lockfile resulting from removing unused dependencies 2025-10-08 02:57:50 +08:00
bunnie
d64d717a8e cleanup testing code & improve bio/bdbma test output
reminders to self as to where these things should go...
2025-10-08 02:57:13 +08:00
bunnie
e80a3dadfb cleanup some testing code that should have been eliminated from boot 1
also remove an unused dependency
2025-10-08 02:56:26 +08:00
bunnie
044aedfd40
Merge branch 'main' into vault2 2025-10-08 01:21:12 +08:00
bunnie
1f438ae203
Merge pull request #697 from betrusted-io/missing-docs
helps to save the file
2025-10-08 01:21:01 +08:00
bunnie
a370ed962a helps to save the file 2025-10-08 01:20:31 +08:00