Commit graph

306 commits

Author SHA1 Message Date
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
bunnie
f494da21cc absorb new xous-ipc version 2024-09-23 22:05:50 +08:00
bunnie
75954de8d6 commit the version bump 2024-09-23 01:46:25 +08:00
bunnie
4c7c9312c1 change xous-ipc api to 0.10.0 2024-09-23 00:24:48 +08:00
bunnie
4eb504bb43 more typecast cleanup 2024-09-22 18:51:06 +08:00
bunnie
f2fbc7fafd regex search/replace instances of xous_ipc::String to String
more regex results
2024-09-22 14:19:32 +08:00
bunnie
311154e231 absorb version bump 2024-06-27 00:26:12 +08:00
bunnie
a360f3ee52 bump xous pins for RawTrng API 2024-06-13 15:49:35 +08:00
bunnie
35e7cf3a5b bump xous dep revs 2024-05-29 02:07:06 +08:00
bunnie
9e66c1bee2 commit the version bump 2024-05-07 01:03:05 +08:00
bunnie
d6b33159a5 stage version pin bump 2024-04-01 15:46:26 +08:00
bunnie
05a7c4ca7e use auto-release of accelerator hardware 2024-03-28 16:15:29 +08:00
bunnie
4eab8a35b5 don't try to release hardware in hosted mode 2024-03-25 08:08:06 +08:00
bunnie
1cc0a7121b Point curve25519 patch to the github version 2024-03-25 07:08:27 +08:00
bunnie
f5fdcf7d5b lock rootkeys into a particular version of the dalek crates + cooperative release of hw accelerator
the cooperative release is THE problem that we need to discuss.
2024-03-11 18:18:37 +08:00
David Kotval
8eb0a26d51 fix: don't break tls
Due to our patch of ring@0.16.0, we must be careful
that none of the transitive deps of the tls packages
try to use a newer ring.
2024-02-08 12:47:45 -06:00
bunnie
7c944fb4db upgrade zeroize to latest API level 2024-02-08 14:02:58 +08:00
bunnie
a68d0513e3 upgrade blowfish so we can retire the old cipher API
the pin was holding back another package
2024-02-08 13:59:26 +08:00
bunnie
df7c31a7df clean up warnings in dummy implementations 2024-02-08 13:10:08 +08:00
David Kotval
e619803114 fix: don't break hosted mode 2024-02-07 13:56:02 -06:00
bunnie
6de48e90f3 fix formatting problem 2024-02-08 00:49:00 +08:00
bunnie
315d9b96d4 Merge branch 'main' into dalek_to_v4 2024-02-07 22:52:24 +08:00
bunnie
5636e07eb8 Upgrade Ed25519 to latest version; fix zeroize derive. 2024-02-07 22:41:57 +08:00
bunnie
699004e7b0 bump xous pins 2024-02-06 14:49:10 +08:00
David Kotval
a70832b3ce wip: dumping deps to get curve25519 to 4.1.1 2024-02-04 14:12:36 -06:00
bunnie
40423f9448 fix hosted and renode modes 2024-02-01 01:42:18 +08:00
bunnie
0c7be94c22 re-introduce "wait for hardware" hashes for "big hashes" 2024-02-01 00:52:21 +08:00
bunnie
31efca3e9c add fixme notes for where the Scalar was decomposed due to hash api incompatibility 2024-01-31 04:16:05 +08:00
bunnie
4c99f6da3d patch over rootkeys issues with the new hash
- new api incantations
- KeyInit trait demotion into individual functions
- decomposition of Scalar derivations because the hasher
API changes and is no longer directly passable into Scalar
(this should probably get reverted if/when curve25519/ed25519
is bumped in API later...)
- notes about areas that should be hardware accelerated but are not
2024-01-31 04:12:54 +08:00
bunnie
cc2c11f84c revise API on backups routine to use 0.10 2024-01-31 04:08:06 +08: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
bunnie
659796916a chore: cleanup typos in docs, comments 2024-01-15 02:16:43 +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
da954783ee format services/root-keys
formatted some pretty big blocks of either autogenerated
or copy/pasted blobs used for emulation.

I think I'll let the formatting stand because the autogen
code is "never" going to change (i.e. they are physical constants
tied to the properties of the hardware) or the pasted blobs
have no real meaning beyond the blob itself so if they were
regenerated it'd be another copypasta with format.
2024-01-14 22:38:46 +08:00
bunnie
0c657cffcd cleanup a hosted mode warning 2024-01-08 02:24:05 +08:00
bunnie
055231cb5a extract loader hash from environment
also fix region alignment bug and version code bug.

tested, now works.
2024-01-08 01:44:17 +08:00
bunnie
b87dde9208 add new signature version code to api 2024-01-08 01:44:01 +08:00
bunnie
10154b8372 add some comments and an assert to check consistency 2024-01-05 16:47:31 +08:00
bunnie
61686007c7 modify the signing routine to work with an unmapped kernel region
Now, we finally get to addressing the root cause of #472.

We can't map all of kernel memory anymore, because exclusivity of
ownership of pages is now properly enforced. This means that XIP
images, which run directly out of FLASH, map their code region of
FLASH into their processes. This disallows measurement of their
code spaces by the rootkeys crate; previously we had mapped all
of code space and could measure everyone's code but it also means
we had a double-ownership.

Having resolved that single-ownership is cleaner, we now have
a scheme where the loader, which sees all of the kernel anyways,
computes a hash and signature check of the kernel at boot time,
and pashes the unsigned hash on to the environment variables of Xous
(environment variables pending @xobs commits).

This commit fixes up all the kernel signing routines to work with
a now disjoint kernel memory space. In particular, the key signing
routine needs access to three parts of the FLASH region devoted
to storing `xous.img` (which is loosely and imprecisely referred
to as "kernel memory"; this does lead to confusion thinking that
we're referring to the RAM devoted to the kernel, but for this
discussion we are talking about the window of FLASH where `xous.img`
is written, along with other metadata related to it):

- the first page, where the signature is stored
- the end of the kernel, where the kernel length check is stored
- the end of the entire flash window, where the backup records
are stored

The first page is fairly self-explanatory, this is the signature,
some version information, and an unprotected length hint for the
kernel.

Because the length hint in the signature record is unprotected,
we have to repeat it at the end of the kernel data and include
it in the signed region. Thus, there is a window of memory
that is 2 pages large that captures the dynamically varying
(dynamically varying as in build-to-build this offset changes so
it can't be a `const`) location of the length data. 2 pages
are mapped because the region of interest can fall across a
page boundary, so we map the potential lower page and upper
page that captures the length field (although in most cases
the upper page is not used, it is harmless to map it pre-emptively).
A mask is provided so that we can use the previous compuattions
for offsets and just mask it to compute the offest within this
window.

The end of the flash window, the last page, contains the backup
records. This is a set of metadata that records information
about PDDB backups including the checksums of the regions and
encrypted access keys.

This patch attempts to find all accesses to kernel space and
bin them into their respective regions, while adjust their offsets.

Testing will require us to check signing, updating, and backups --
all aspects of the machine lifecycle are impacted!
2024-01-05 16:31:19 +08:00
bunnie
c73df68e15 add sha512-digest wrapper class
this is a trait wrapper that allows us to take pre-hash as
a `[u8]` and wrap it into a thing that hase a finalize() method
and the requisite traits to satisfy Rust, allowing us to pass
our loader-generated, environment-variable-passed hash into
an otherwise unawares cryptography crate.

mea culpa.
2024-01-05 16:29:41 +08:00
bunnie
8ec08c9c76 fix rust v1.75.0 warnings that are probably benign
a lot of re-import warnings have cropped up. While I appreciate
their studiousness on this, the problem is that removing some
of these exports in the API crate could mean that future users
who want access to some API features that aren't used in this
configuration are now unaccessible.

I think it's not a huge problem at the moment, just spam-cleaning
the warnings because there are too many to deal with carefully
at the moment.
2024-01-04 19:15:28 +08:00
bunnie
fda782663a bump version pins for xous change 2023-12-26 00:13:10 +08:00
bunnie
fa3f349a0a bump pins as xous-rs has changed 2023-12-01 21:20:01 +08:00
bunnie
6ab88117f6 bump xous-api-log version & fix version pins 2023-10-31 20:07:28 +08:00
bunnie
d63b5912b1 absorb new xous-rs version 2023-10-10 16:50:00 +08:00
bunnie
83256257e1 bump xous-rs crate to absorb Send derives on Messages
this is necessary for the smoltcp port
2023-10-03 20:54:14 +08:00
bunnie
478a612c02 commit version bump 2023-09-12 16:25:10 +08:00
Sean Cross
5dfad296ae xous: mark MemoryRange::as_slice and friends as unsafe
Mark `MemoryRange::as_slice()` and `MemoryRange::as_slice_mut()` as
unsafe.

This is due to the fact that not all representable types can be cast to
an arbitrary value. For example, if Process A sends random values to
Process B, then Process B casts the memory to a slice of `bool`, then
any values that are not 0 or 1 are undefined.

Because these functions can leak UB into the program, they are marked as
unsafe.

This patch adds `unsafe {}` blocks to all instances where this function
is called. Additionally, all instances have been checked to verify that
they do not cast to any invalid types -- most use `u8` or `u32`.

Additionally, the long-deprecated `MemoryRange::from_parts()` call was
removed, since that causes UB without being marked as unsafe.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-09-12 10:07:38 +08:00
bunnie
0931e02400 clarify reboot after bbram helper runs 2023-08-11 17:10:47 +08:00
bunnie
53469a68d0 publish package updates, sync to release tag 2023-08-08 14:35:49 +08:00