Commit graph

10340 commits

Author SHA1 Message Date
bunnie
2699a332fe
Merge pull request #819 from sbellem/fix-swap-signing-semver
Fix swap image signing with --git-describe
2026-02-13 20:39:23 +08:00
Sylvain Bellemare
c98f846970
Fix swap image signing with --git-describe
Pass semver from --git-describe to swap image signing code path.

PR #817 added --git-describe and --git-rev support but the swap
image code path in xous-create-image was not updated to use the
semver for signing.

Changes:
- swap_writer.rs: Add semver parameter to encrypt_to()
- xous-create-image.rs: Parse --git-describe and pass to encrypt_to()
- xous-app-uf2.rs: Same changes for consistency
- builder.rs: Pass --git-describe to xous-create-image

Fixes #818
2026-02-13 16:27:21 +09:00
bunnie
7c98a86899
Merge pull request #817 from sbellem/xtask-git-args
Add --git-describe and --git-rev CLI args
2026-02-13 03:03:48 +08:00
Sylvain Bellemare
a052cafb8f
Add --git-describe and --git-rev CLI args
Enable reproducible builds without git state by accepting
version info as CLI arguments:

- --git-describe: version string for signing (e.g., v0.10.0-19-g0d934e1)
- --git-rev: commit hash for swap nonce (last 16 hex chars used)

Renames xtask --gitrev to --git-describe for clarity.
2026-02-13 03:44:37 +09:00
bunnie
4f93657958
Merge pull request #816 from betrusted-io/chores
More cleanup
2026-02-13 02:20:27 +08:00
bunnie
f106d39d03
add die stepping detection code
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.
2026-02-13 02:05:53 +08:00
bunnie
68400551c5 cleanup warnings 2026-02-13 02:05:09 +08:00
bunnie
94e4fc28d8
Merge pull request #813 from betrusted-io/chores
Minor chores
2026-02-12 19:43:25 +08:00
bunnie
3f9381f3db
Merge pull request #815 from sbellem/git-describe-abbrev
Fix git describe abbrev length for reproducibility
2026-02-12 19:42:26 +08:00
Sylvain Bellemare
171e32e834
Fix git describe abbrev length for reproducibility
Signed-off-by: Sylvain Bellemare <sbellem@gmail.com>
2026-02-12 19:30:10 +09:00
bunnie
a8eca714da
Merge pull request #814 from RealityAnomaly/patch-1
Change import from Crypto to Cryptodome for SHA512
2026-02-12 12:56:58 +08:00
Vertex X7-53
e6907cb230
Change import from Crypto to Cryptodome for SHA512
Crypto refers to the deprecated PyCrypto package, and this breaks on Fedora because the SHA512 class doesn't include the truncate argument. Update it to Cryptodome.
2026-02-11 23:25:56 +00:00
bunnie
54894e852b suppress a debug message
this will help improve boot time by some milliseconds
2026-02-12 02:32:45 +08:00
bunnie
0d934e1078 alphabetize the help message in boot1 2026-02-11 14:10:48 +08:00
bunnie
8930579580
Merge pull request #809 from betrusted-io/release-bump
add --gitrev argument to xtask
2026-02-11 01:59:15 +08:00
bunnie
b2ee028fe2
Merge pull request #807 from sbellem/source-date-epoch
xtask: add SOURCE_DATE_EPOCH support
2026-02-11 01:58:25 +08:00
bunnie
4aba11df5f
Merge branch 'main' into source-date-epoch 2026-02-11 01:27:12 +08:00
bunnie
901fc5c8ad
Merge pull request #811 from betrusted-io/boot-hashes
Boot hashes, security fixes
2026-02-11 01:26:35 +08:00
bunnie
cd8ae64dc8
Merge branch 'main' into boot-hashes 2026-02-11 01:18:28 +08:00
bunnie
155c71113e
Merge pull request #812 from betrusted-io/fix-toolchain
make toolchain matching more strict
2026-02-11 01:18:14 +08:00
bunnie
41ea75953d make toolchain matching more strict
this picks a toolchain that matches the actual target we're building
instead of just the first toolchain in the list (which with the addition
of -emc toolchain causes things to break).
2026-02-11 01:02:13 +08:00
bunnie
a2330e8911
add optionality to turn on clock skipping manually
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.
2026-02-10 22:56:14 +08:00
bunnie
272b983760
add clock skipping APIs
also fix a bug where the enable bits for reporting SRAM
parity errors was not set.
2026-02-10 22:55:21 +08:00
bunnie
58d17f1423
refactor the key ordering specification
this makes it much easier to check for errors - and one was found,
the erase coupon was accidentally off by one, and equal to the
master key slot. oops! 🤦
2026-02-10 22:49:17 +08:00
Sylvain Bellemare
5c424fa678
xtask: deterministic builds with SOURCE_DATE_EPOCH
When SOURCE_DATE_EPOCH is set, use it instead of Local::now() for the
embedded build timestamp. This enables deterministic builds via Guix,
Nix, and other reproducible build systems.

See: https://reproducible-builds.org/docs/source-date-epoch/

Design notes:

- Panics on invalid SOURCE_DATE_EPOCH rather than warn-and-fallback,
  because silent fallback would produce non-reproducible output while
  the user expects reproducibility. Build systems should fail loudly
  on misconfiguration.

- Preserves Local::now() fallback when SOURCE_DATE_EPOCH is unset,
  keeping local timezone for developer convenience during debugging.
2026-02-10 23:39:35 +09:00
bunnie
b7db559fd7
Merge pull request #810 from betrusted-io/boot-hashes
Boot hashes
2026-02-10 03:40:44 +08:00
bunnie
8ef78f592f add notes about how bootloader releases will work 2026-02-10 03:31:39 +08:00
bunnie
7588d8bf43
add auto-audit capability; add boot hashes
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.
2026-02-10 03:29:41 +08:00
bunnie
c1b7612e7e
add one-way counter offset for auto-audit
for the first few boots (3 in this case), automatically
print an audit to the console. This is used to verify that
the chip was programmed correctly in chip probe.
2026-02-10 03:28:31 +08:00
bunnie
32f9ae1631 add --gitrev argument to xtask
this allows build systems that lack git state to build an image.
The effective git revision must be correctly computed by the build
system or substituted for everything to work correctly.

Note that completely faking the entry will lead to subtle problems
down the road; for example, a purpose of the revision is to check
which versions are compatible for upgrades against each other
(some upgrade paths require a hop through an older version). Faking
this can bypass the mechanism and then lead to instability down
the road.

However, some build systems (such as guix) strip out the git state,
but the revision can be safely generated in the calling environment
and passed as a variable.
2026-02-09 15:08:55 +08:00
bunnie
fae35dd9f5
Merge pull request #808 from betrusted-io/release-bump
Release bump
2026-02-09 03:50:35 +08:00
bunnie
5c1be83a5f note that release commentary has moved to discord 2026-02-09 03:48:05 +08:00
bunnie
90b1f2f345 cleanup warnings 2026-02-09 02:48:31 +08:00
bunnie
8a2118b8f6 fix bug in root-keys that prevents bbram provisionig from happening
this bug highlights a fairly big weakness in the rkyv-based
serialization in that there is no inherent type checking of
the sender to the receiver. In this case, a typo of just one
character lead to a regression which, probably in an earlier
version of rkyv, was not a problem because the ordering of
elements was different. In this case it lead to incorrect behavior,
which upon debugging lead to panics because we were interpreting
the data incorrectly after it was unpacked.

This is probably an issue to be worried about in the longer-term,
and it leaves me with a lingering question of what attack
surface exists through the deserialization mechanism for
attackers who send malformed buffers as messages.
2026-02-09 02:17:31 +08:00
bunnie
e511e75857 add option to do minor/major rev bumps in publish
decided that changing versions of the underlying crates has
no actual meaning with regards to the release process, so,
leaving this decoupled.
2026-02-08 20:54:54 +08:00
bunnie
bc35c9b014 update release name 2026-02-08 17:04:05 +08:00
bunnie
57340247ae
Merge pull request #806 from betrusted-io/security-ci
Release CI improvements
2026-02-08 13:08:02 +08:00
bunnie
f774522e62
remove testing API that never actually worked
there was a thought to speed up CI testing by introducing a
"cheater" routine that allowed us to re-initialize the keystore.
Turns out this doesn't work because it's not possible to fully
revert a system out of developer mode - because, in my infinite
previous-self wisdom, I realized that this is something someone
might try and there is a one-way counter that logs if the
system has *ever* been in developer mode, and that has no
known bypass.

This means that even if you could repopulate the keystore, it
would be cleared on the next boot by merit of the developer
flag being set.

So - we did it the hard way, every single test we have to
re-image the system from scratch. C'est la vie.

Removing this patch eliminates a code path that could later be
abused for unforeseen ill purposes.
2026-02-08 12:55:10 +08:00
bunnie
c499087d5a
remove redundant prints in loader
the first check should *never* print a message because an attacker
can trigger a glitch off of the UART. this eliminates the diagnostic
print on the first check.
2026-02-08 12:49:50 +08:00
bunnie
0bb693449b
boot0 improvements
- 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.
2026-02-08 12:47:09 +08:00
bunnie
228827c276 update lockfile versions for recent xous version update 2026-02-04 15:58:49 +08:00
bunnie
f9ef3217f0 add test command to overwrite keys 2026-02-04 15:58:20 +08:00
bunnie
c1ae6b2e5f add more dependencies to propagate key-testing flag 2026-02-04 15:57:59 +08:00
bunnie
f6bf8f9bf1 modify pddb size on key testing
this allows for faster reboots through CI cycles as a state
transition from secure->insecure always triggers a PDDB format
2026-02-04 15:57:09 +08:00
bunnie
0aeb9daa37 add a method to force-rewrite keys
This is useful in CI to test various stages of dev-key signed
image vs secret key erase without having to go through a complete
suicide cycle on the chip.

This command is gated behind a feature flag that would only be
invoked for beta testing. I think it's still safe to have even
as a beta-signed feature because the worst you can do with this
is replace existing keys - so it could be used to DoS/brick, but not
leak secrets.
2026-02-04 15:55:34 +08:00
bunnie
0529a10eb8 modify audit to leak information about the erase coupons
this helps verify the erase state by implication of secret keys
2026-02-04 15:54:20 +08:00
bunnie
0ae03c6354
Merge pull request #805 from betrusted-io/antirollback-ci
Add ability to simulate third party images
2026-02-04 03:16:04 +08:00
bunnie
f17b67c16d put the test key into the devkey slot
i feel a little more comfortable with this because there are
checks that *any* key in that slot would be treated as a devkey
and would lead to key erasure. so just in case i messed up
something in the other checks, this would trigger a key erasure.

I think there is no way around signing at least a beta image
containing the third party keys if i truly want to check all
the paths, so trying to isolate what it can do is important.
2026-02-04 03:14:29 +08:00
bunnie
cf267f096c generate actual private keys instead of using random data
by doing this we make this safer by ensuring that the public
keys are valid public keys, allowing us to sign these images
with production keys and not accidentally signing a weak
public key.
2026-02-04 03:07:38 +08:00
bunnie
0caf0bb2d7 add a testing key for third party images
just some fake base64 data to make a unique key that we can
use to "sign" third party images
2026-02-04 02:50:24 +08:00