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
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.
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.
Turns out we *can* check this at run-time. I thought originally
once the chip was sealed these became hidden. I was wrong.
So, this means we can actually test to confirm that production
was done correctly and in fact the CM7 and debug ports are sealed
off.
this adds that test.
The info region is a region of RRAM that is used to configure
the chip - boot security, what CPUs can run, access control
lists, etc. There's no secrets in here, but it's very helpful
to inspect for audits and correctness of configuration, so
a routine is added to print it in boot1.
It is not clear if I can get the factory to burn the serial number
(wafer lot, ID, x/y location) into the location I want it to be.
So, I am allowing this to be updated by the firmware on boot,
thus necessitating the permissions to be writeable for the serial
number field.
Furthermore, if there is any error in initializing the chip's
identity in the factory, right now the chip goes into a mode
where it has crashed and can't run diagnostic code. Write errors
in this stage are thus turned into .ok() instead of .unwrap()
because we want to allow the chip to go through the whole flow
and then diagnose any issues later on.