- improve bollards to include "die" jumps where appropriate
- cleanup warnings in unsafe-dev feature
- panic handler calls die repeatedly
- upgrade jump api
the original stub for illegal instruction handling advances
the program counter - this was copypasta from the kernel
irq routine, where this behavior is needed to handle syscalls.
However, this behavior is contra-indicated for the purpose
of dying on a bollard - you don't want to skip past the
bollard for any reason.
this is off by default, because it doesn't seem to be entirely
stable. For now, the default configuration when it is turned on,
only activates it for the PKE block. When the CPU block clock
skipping is enabled, instability is occasionally observed.
- rcrr register multiply-written on boot to glitch harden
the register. I only realize now that the top-line ECO had
an asterisk on it which means that setting the register is
still critical
- correctness comparison of boot1 keys to IFR copy introduced
this is yet another check to prevent tampering with the key block.
this will at least give us a hint as to why a boot1 failed to
boot. It does hand an attacker some information, but we also
need information to debug e.g. RMA and field failures.
this allows us to refer to it in boot1 if we eventually decide
it's useful to do it there.
however, as a matter of policy, boot1 checks loader signatures
against *boot1*'s public key block - so if the loader is to be
signed with a different key, boot1 needs to be updated.
removing prints in boot0 gives less handle for glitchers to time
off of. Also makes debugging chips harder, but I think the boot0
is starting to get stable enough that this is OK?
also removed the frac-PLL setting because it's broken. this causes
the PLL in the boot0 to be subtly different from boot1, and I
think I like it - it makes the timing of glitches between the
two phases different.
this should erase the secret keys if the boot1 pubkeys don't match
this enables OEM-signed boot1 images. the policy is that all OEM
images signed by baochip are considered to be untrusted, and thus
loading them onto a device would wipe any secret keys, making
them less useful for extracting secrets.
There are 2048 keys and about 500 keys are used by baochip,
so there are still plenty of keyslots available for OEMs to
use to implement their own version of security.
non-paranoid mode responses happen through IRQs (recall that
paranoid mode is a hair-trigger hardware reset with no
exceptions). This patch installs the IRQ handlers in boot0
and boot1.
- boot0 in particular now even has an IRQ handler. Previously,
it didn't have the IRQ facility configured, because there was no need
for one.
- boot0 sets up the sensors, and the IRQs
- boot1 merely continues with boot0's settings, but re-installing
the trap handler to be its own and double-checking some
register settings.
An old testing IRQ handler stub for keyboard presses was also removed,
as it can never be triggered as that IRQ is never set up.
this is the final part of the developer mode bit hardening.
If an adversary manages to increment the developer mode
bit, the next reboot they have to contend with active counter-
measures that would attempt to erase the secrets due to
the developer mode bit being set.
As noted in the top of the commit set, previously, without
this, the attacker would have the luxury of being able to
flip the bit and try many times to bypass the developer
mode check.
this patch uses the previously modified APIs and implements
a multi-pass check on signatures in the case that paranoid
mode is turned on. This may effectively double the boot time but
it also reduces the chance of a successful glitch attack
on signature validation by a multiple of the glitch
success probability.
this also updates other API calls and implements the
XOR-on-target-address code.
- harden the check that the boot0 public keys match those in the
data array
- security mesh setup
- insertion of random delays & bollards
- upgrade API on signature verification to allow for random delays
during the signature check
- paranoid mode entry is implemented here. The main outcome of
paranoid mode is that when activated, the system will automatically
reset anytime a voltage glitch is detected.
- clean up PLL mode setting. For boot0, the mode is fixed & hardened
to 175MHz CPU operation, running off the PLL, under the theory that
running at this speed makes glitch attacks harder as the cycle time
is now 5.71ns, and simply disturbing the XTAL clock doesn't cause
the PLL to straight-up stop.
- some hardening to ensure that we are actually in PLL mode, and
that the switch to PLL mode wasn't glitched over
- setup rram security bits immediately
- setup coreuser mapping immediately
- check boot0 pubkey region against data slots, and note if
issues are found (and erase keys)
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.
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.
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.