audit is now expanded to track one way counters and
summarizes security state
boot0 key indelibility test added as a feature, to be
used in the future for CI
The motivation for this is to make the tester configuration
exactly identical to that used in production. Right now a
"cheater" step is used to set the board type to dabao and
enable boot waiting because in the test environment there
isn't a physical switch anyone can press to invoke that
behavior.
So, in order to get the test environment to work just like
production, the behavior goes from insta-die if no valid
image is found on the next stage, to "wait for new image".
This is slightly less secure of a default, but only slightly
so. Basically the previous scheme required someone to be
physically present to press the "give me a new image" button,
this one causes the system to automatically accept a new image.
I suppose the main downside is this does allow the possibility
of say, a fully remote, automated exploit to be delivered
if an adversary can damage the loader image such that it
doesn't pass signature check and then it will automatically
go into a mode looking for a new image, at which point
an arbitrary image could be potentially loaded (although
because the image would need to be signed, and there is
a trap that destroys secrets if a developer image is
presented, it wouldn't instantly lead to secret disclosure,
but it would be a denial of service).
The flip side is that with the paranoid default, developers
are "confused" by the silent failure of a brand new chip that
has no code loaded in it (because it goes catatonic until
the developer knows to press the load button).
The loader image is protected from writes after boot, so
in theory there isn't a direct path to "spoil" the loader
image and trigger this path, so it's not like we're just
hanging in the wind. It just means that there isn't a
full human-presence requirement as a defense in depth against
a potential denial of service if an adversary could find
a way to spoil the loader image.
If the DoS path is a concern, one option is to configure
the system such that the developer key is revoked. This
would disallow that from being recognized as a valid
image, and would also prevent the DoS from happening,
as it would require the adversary to present a valid,
signed image which presumably they can't as long as
the signing keys are kept safe.
- feature gate some unsafe-debug
- tie akey_id to 0xff which should disable key chaining, which
is not used in our scheme because authentication is not hmac-based,
uses public keys instead
latest rev of the board seems to handle the heat load OK.
board gets a little warm to touch when the system is clocked
at max frequency, but not unpleasantly so.
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.
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.)