this accommodates the notion of erasing secret keys when
a developer key is detected. Some hackery in the API is
required, because I'm trying to use the same signature
routine for both boot0 and boot1, but coreuser settings
should not be set until boot1.
Boot0 has *no* coreuser settings, whereas boot1 starts
to lay them in - this interferes with key erasure, and
so the nice clean "boot or die" abstraction disappears
because we have to now just check if a key matches a criteria
and then return because we have to handle the environment
dependent case of coreuser settings.
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...
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.
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.
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.
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
have to absorb a version change due to xous-semver change
might as well also update the utra/svd generator dependencies
since that's been held off for a long time now.
main thing in this commit is remembering to activate PWM
mode on DCDC2 for a quieter power supply. the chip draws
so little power that the power-saving regulator hiccups
and has too much ripple.
- add boardtype setting
- work around usb serial tx timeout hangs - not sure why they happen,
but let's not hang the repl on them.
- various cleanup code & comments
- note boot frequency
present a 128MiB FAT32 disk based on a dumped image that was
clean-initialized on a windows machine (windows is the most
picky so it is used as the template maker).
add hooks for emulating sparse reads of file system structures
that are well outside our available memory range.
add hooks for writing uf2 files when valid sectors are encountered.
this basically works, you can whack a uf2 file into the disk
and the update happens.
the problem now is that something breaks in the repl loop
when USB disk traffic happens, this commit gives us a checkpoint
to work against.
in general the public key should come from a trusted block, not
the image itself. The initial prototype of the image was written
for self-checking of boot0; but for other images, the public key
should "chain" from the trusted image (i.e. boot0's key should check
boot1, boot1's key should check baremetal/loader, etc.)
remove things that we don't need in boot0. Boot0 originated from
a much larger, more featureful space and needs to be whittled down
to remove attack surface and space for bugs.
Some further cleanup to do would include:
- hardening the PLL setting. Right now it's done computationally
based on the demanded frequency. But in practice, because the
target frequency is hard-coded, we could just compute the actual PLL value
results and jam them into the register and lose a whole bunch of
code.
Actually I think that's all that needs to be cleaned up off the
top of my head.
The *only* change is to make fiat-crypto a non-optional dependency.
For some reason the .cargo/config.toml only half-activates the
feature, in that in the .rs code files the feature is included
but in the Cargo.toml file the dependency is, for some reason,
not enabled.
Light-fingered changes include:
- debug UART integration for debugging things
- patching the sha2 crate to use hardware acceleration
Most changes are in Cargo.toml, with the exception of the debug.rs
module that was introduced for print-debugging.