All the changes here (except one print statement change) are
intended to be feature-gated behind `uf2-spim` in the bootloader.
So, in theory, this should have no boot1 regressions.
The uf2-spim feature is intended for alt-boot and alternate
compiled boot1's and extend the serial-only upload path with
the following features:
1. ability to write SPIM (spi flash memory) using the same
.uf2 files as the USB path
2. requirement of CRC's on blocks
3. a quick test to determine if CRC has been enabled or not
via the `has-crc` command (returns `true` if required, an
error/unknown command message if not).
The CRC makes long/large file uploads reliable, allowing
full device provisioning to happen via serial only, in
cases where USB for whatever reason is not present or available.
this prevents warm boot hold-up in case of latent key press
during wakeup option: for warm boot it's assumed that when
the user presses a key the intention is to wake up and go
to normal operation, not wake up and wait for an update.
- include the toolchain hash for reproduction iff it is
specified
- for the code hash, report *only* the code region, none of
the signature headers. This should match exactly what is
reported by the *_presign.img artifacts.
Adds BAOBIT_COMMIT constant to boot0/boot1 version.rs, allowing
the Guix build channel commit to be embedded in firmware for
reproducibility verification.
- Add --baobit-commit CLI flag to xtask
- Generate BAOBIT_COMMIT in boot version files
- Display in audit command output
- Simplify versioning.rs to always write files
- 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.
the macro will give relevant positional information when the
assert fails, whereas the function always fails in the same place
and we lose that valuable debugging info
The USB engine passes raw pointers around for DMA purposes;
most importantly, it passes *back* raw pointers and lengths.
There's no really good way to check these, and I suspect that
there may be USB protocol exploits that can be used to manipulate
these values. Thus, an assert is added on the touch points where
the raw pointers go to and from the USB hardware to check that,
at the very least, the entire buffer being referenced is strictly
within the USB hardware's memory space.
It occurs to me that the same boot1 code will be on both
die steppings, so adding a piece of code that *should* be
able to detect A0/A1 stepping - assuming the A1 stepping
behaves as intended.
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.
the "audit" command is moved to its own file, as it has
turned into A Thing.
auto-audit now happens on the first few boots to help
verify chip probe infrastructure.
hashes of the boot regions are also printed as a diagnostic
in the audit code.
- 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 allows us to simulate a third party firmware's behavior
so we can test that collateral key states go through the right
set of state transitions in various test cases.
the collateral test is also made more precise and can now
report unititialized/permission denied state
Now that the sensitive keys are provisioned in Xous and not in
boot1, there is no need to have a dependency on the avalanche
generator (and in fact, in practice, it's never used because
the random data that is collected is always collected before
the board type is set to even allow usage of the avalanche generator).
To wit: The only bits that are created using the ring oscillator
are public random identifiers such as the UUID, which are not
security critical pieces of data.
Removing this unused path simplifies the bootloader code.
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.