Commit graph

408 commits

Author SHA1 Message Date
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
bunnie
75954de8d6 commit the version bump 2024-09-23 01:46:25 +08:00
Chris Pick
b8feb4ec40 Improve USB no backend available message
Provide a more descriptive error message when pyusb can't find a backend
USB library.
2024-07-01 21:32:58 -04:00
bunnie
6516430536 add 0.9.16 to the releases for restores 2024-05-30 18:38:48 +08:00
bunnie
85a6f02c3f bump xous-semver rev
git tags now returns a 9-digit commit rev instead of 8 in some
versions of linux. This causes `u32` parsing of the rev to fail.
handle this.
2024-05-21 04:18:03 +08:00
bunnie
80dbf071be don't map errors so we can see what the underlying problem is 2024-05-21 04:03:45 +08:00
bunnie
63c316f32a fix image creation
1. nonce should be generated from the LSB of the commit hash.
security doesn't come from the nonce, and having the commit hash
in the nonce is helpful for version control of the swap image
(although it doesn't capture "dirty" builds, e.g. builds
made with uncommitted changes).

2. fix IniS regions to not require special alignment. Since the
data is copied (similar to IniE), we don't have to waste space
page-aligning things so that offsets map perfectly between
the image on disk and in RAM.

3. add checks that the loading position of data inside the
swap image matches our expectations. We should have 0x1000
bytes of unencrypted header, then 0x1000 bytes of XArgs + padding,
and then image data should start.

There is a "just so" coincidence in that the image data by
the MiniElf program always lines up at an address > 0x1000, making
space for the XArgs. I actually don't know why this padding is
there, but the "section" doesn't decode to anything we
can parse. Maybe it's some reserved space for OS-specific
loader shenanigans?
2024-05-06 18:49:18 +08:00
bunnie
9499a41739 fix padding computations in ELF file read-in
Not sure how this even worked in the first place....I think we
always just got lucky with the size of .gcc_except_table. However,
something changed in the last rustc update that causes this section
to align to a 256-byte boundary instead of a 4-byte boundary, which
exposes downstream alignment issues.

This patch now captures the actual offset alignment + padding,
which is somewhat complicated by the fact that we throw away
the first section (not sure why??? it doesn't seem to have
a valid name or header, but the first 0x114 bytes are non-existent)
so we have to factor this into all the downstream padding efforts.
2024-05-01 02:19:10 +08:00
bunnie
9ca720f188 add an assert to sanity-check that IniF sections are aligned
There is no hope for success if the alignment of an IniF is not
aligned, since we directly map the data into memory.
2024-05-01 02:18:29 +08:00
bunnie
9d2218488b add jump past signature block
Make the first word in the signature block a jump past the block
this is for the cramium target, where the best memory efficiency
happens if we align the data to the bottom of the memory. This
means that the signature block ends up "in the way" of the boot
process, because the reset vector can only be configured to something
on a 16k-page boundary (e.g., we'd waste 15k of memory without this).

This will require some reworking of the existing code base for
checking signatures down the line.
2024-04-26 18:13:06 +08:00
bunnie
4ace363abc this resolves comments from @xobs' code review 2024-04-09 18:23:09 +08:00
bunnie
400088fb42 add debug file generation for swap 2024-04-08 23:47:54 +08:00
bunnie
d489e14f3a fix nonce generation (offset should be bytes, not pages) 2024-04-07 22:37:22 +08:00
bunnie
3079da3a57 add debug provisions to encryption; limit AAD to 64 bytes 2024-04-07 00:38:34 +08:00
bunnie
7547d7c952 remove aead from dependencies (already part of aes-gcm-siv) 2024-04-06 22:56:03 +08:00
bunnie
d9b29c2d06 move the MAC (i.e. tag) above the variable length AAD field. 2024-04-06 22:55:39 +08:00
bunnie
28d07da7f1 add the flash offset of the swap region in swap args
Each platform interprets this differently.

On Precursor, it's the offset in FLASH of the swap region.

Probably, flags should be added to configure this somehow for each
platform, but still figuring a lot of things out.

The plan is on Cramium for the swap data to always be at 0
in the external SPI, so, we don't store an offset (field is
ignored).
2024-04-05 16:45:24 +08:00
bunnie
2a68ee098f fix main memory patching for swap config on precursor 2024-04-04 19:24:38 +08:00
bunnie
cf32b4edb5 patching routine for memory regions.
ended up not being used because main memory is a special case :P
2024-04-04 19:24:17 +08:00
bunnie
aff3620bdf make argument start/offset visible
so we can patch it up for the swap testing on precursor
2024-04-04 19:23:49 +08:00
bunnie
9c0ac72aae add storage for the swap encryption key
This is set to 0 in the image creator, but the keying ceremony
should set this to something more secure after the device has
been initialized (and likewise, re-encrypt the swap region
to match the new, secure key).
2024-04-04 18:45:16 +08:00
bunnie
39e8184b5d chore: add a comment 2024-04-04 18:45:02 +08:00
bunnie
7facdf5e7d add cryptographic libraries to the image creator manifest 2024-04-04 18:34:23 +08:00
bunnie
932f13b532 rework create-image to put inis objects into the detached swap region 2024-04-04 18:34:00 +08:00
bunnie
e1dbd6726b add the swap_writer module to the library 2024-04-04 18:33:29 +08:00
bunnie
9eebf5dd05 add the swap writer
This will take the buffer that is generated from a xous argument
and encrypts it to the prescribed "detached swap" format.
2024-04-04 18:32:45 +08:00
bunnie
c0484ca607 chore: fix formatting 2024-03-23 12:02:54 +08:00
bunnie
fdbdea5ab0 add swap tag to image creation 2024-03-23 11:59:31 +08:00
bunnie
38f0002294 partial progress on create-image
create-image can now genereate inis sections

still needs to kick out a `swap` argument for the bootloader
so it knows where swap should go.
2024-03-23 11:59:31 +08:00
bunnie
5fb368ae05 partial progress on porting to ring-0.17 2024-02-09 17:18:41 +08:00
bunnie
01cec25388 upgrade API on helper tools
even though they run on the host, old pins inflate the codespace
since they are part of the workspace
2024-02-08 14:21:10 +08:00
bunnie
bf15d7c803
Merge branch 'main' into refactor-sha2 2024-02-01 01:46:31 +08:00
bunnie
74266d378c the binary tools don't need the precursor target 2024-01-31 03:51:07 +08:00
David Kotval
c4d40fbccb fix: don't add *EN* to en-tts locale 2024-01-29 11:54:42 -06:00
bunnie
55d88587a9 upgrade all the subordinate Cargo.toml files to match the patch
looks like about 9 crates will be affected by this. Point them
all to the latest version of the API, and specify the
"precursor" feature (which activates our patch)
2024-01-30 01:43:09 +08:00
David Kotval
859aae94c9 feat: added stub to automatically fill in transaltions
A missing translation will cause a panic in the localization
macro. As a short term solution. The stub function in the
i18n_helper.py just fills anything missing with its English
placeholder. Note: After refactoring the python packing, I intend
to add an "auto machine translate" funciton as well.
2024-01-24 16:39:43 +00:00
bunnie
659796916a chore: cleanup typos in docs, comments 2024-01-15 02:16:43 +08:00
bunnie
00bb37186a forgot to run wycheproof-import 2024-01-15 00:57:32 +08:00
bunnie
e274fa8873 relate perlib to the libs/ directory
perflib was made before we had libs, so put it into its new, proper
home.
2024-01-15 00:52:43 +08:00
bunnie
6891a4a24f fix formatting on perflib 2024-01-15 00:48:59 +08:00
bunnie
0267a56989 format Cargo.tomls
because apparently cargo fmt doesn't format Cargo.toml files???
2024-01-15 00:14:39 +08:00
bunnie
a09fa70bc9 format tools 2024-01-14 23:00:13 +08:00
bunnie
43a1502de8 allow v2 signatures in restoration of backups 2024-01-08 16:21:09 +08:00
bunnie
368db28492 bump precursorupdater version 2024-01-08 15:54:19 +08:00
bunnie
49b3b1f5d0 allow v2 signatures on kernel 2024-01-08 15:50:44 +08:00
bunnie
887f475489 add the requisite dependencies for pre-hash signing to the tools crate 2024-01-05 16:15:16 +08:00
bunnie
d49d46ee0d pre-hash sign the kernel image; normal signing for loader image
The loader image uses the original signing method, because changing
that would require us to modify the gateware ROM, which is a huge
pain in the ass, and doesn't buy us anything.

Thus only the kernel signing uses the pre-hash method.
2024-01-05 16:14:09 +08:00
bunnie
259852c1c6 add a routine to the signer that can do pre-hash images
This requires us to modify our dependencies to have dalek-ed25519
as one of our dependencies.

Which requires another patch in this commit set to implement
sha512 for hosts, since we patch the sha2 crate for all targets
to our local version.
2024-01-05 16:12:55 +08:00
bunnie
fda782663a bump version pins for xous change 2023-12-26 00:13:10 +08:00
bunnie
22cd08dc57 bump version in restore script 2023-12-25 23:06:07 +08:00