Commit graph

10340 commits

Author SHA1 Message Date
bunnie
30b5be7a79 remove superfluous import 2024-04-08 12:39:07 +08:00
bunnie
6ce157b20d add swap handling to minielf 2024-04-08 12:38:42 +08:00
bunnie
63a8b51fe9 gate SDBG behind feature flag 2024-04-08 12:38:02 +08:00
bunnie
2ce579b221 phase 1 changes for swap 2024-04-07 22:37:40 +08:00
bunnie
d489e14f3a fix nonce generation (offset should be bytes, not pages) 2024-04-07 22:37:22 +08:00
bunnie
26efde0a71 track address of the decrypt buffer 2024-04-07 22:36:54 +08:00
bunnie
a478af445d fix IniS arg copying. lay down boilerplate for phase 1 copy
the hard part - the core inner loop of the copy -- is still
to be done.
2024-04-07 19:01:09 +08:00
bunnie
8aa20e65f6 match new API for accessing swap 2024-04-07 19:00:18 +08:00
bunnie
bd54417e44 add routines for shuttling encrypted data to/from swap RAM region
RAM is assumed to be off-chip, and thus the data is encrypted
in the region. We also encrypt it in the Precursor case, even
though it's on-chip, because we want to capture this as a test case
in a known working environment.

Also incorporate some routines to generate the per-boot random
key for swap encryption.
2024-04-07 18:58:54 +08:00
bunnie
c07f33a169 track the current free page in swap ram 2024-04-07 18:58:31 +08:00
bunnie
884b4d372d put rand_chacha into the lockfile 2024-04-07 18:58:11 +08:00
bunnie
417fa16a22 add rand_chacha as a dependency for the loader
this is needed in the cramium-soc case because the raw TRNG
does not have a whitener, it should not be used directly to
generate keys.
2024-04-07 18:57:23 +08:00
bunnie
49f3570d23 make the test-swapper crate kick out NOCOPY data
makes the test case more comprehensive
2024-04-07 18:56:40 +08:00
bunnie
f2a8603e55 merge encrypted swap argument structure into kernel arguments 2024-04-07 14:29:25 +08:00
bunnie
7602ec7670 reflect crc crate 2024-04-07 14:29:05 +08:00
bunnie
999cb320ed add a function to nab the decrypt buffer
HIGHLY unsafe, but saves us a decryption operation as we
interleave between the various states of the loader.
2024-04-07 14:28:31 +08:00
bunnie
35082c4688 add crc handling to loader
for patching the argument structure
2024-04-07 14:28:05 +08:00
bunnie
c53515fc63 coalesce swap hal into boot config object; read initial swap args
this worked, so it validates the encryption/decryption of the swap
at least!
2024-04-07 00:41:18 +08:00
bunnie
f86d63aa41 add tracking for swap-specific data structures in bootconfig 2024-04-07 00:40:33 +08:00
bunnie
c7e1f22cfa fix pointer issue in resolving swap config
also a bunch of latent debug in case we need to muck around again
2024-04-07 00:39:34 +08:00
bunnie
8f94ecaf6c limit AAD to 64 bytes 2024-04-07 00:39:05 +08:00
bunnie
3079da3a57 add debug provisions to encryption; limit AAD to 64 bytes 2024-04-07 00:38:34 +08:00
bunnie
71336ebf3e start to sketch in bits and pieces of the swap HAL
this is far from complete but needed to check in for the
build check to pass
2024-04-06 23:04:03 +08:00
bunnie
4bb7c87646 gate loader todo behind feature flag 2024-04-06 23:01:33 +08:00
bunnie
903b2219db gate loader features behind flag 2024-04-06 23:01:04 +08:00
bunnie
32857a70b0 add platform-dependent drivers for swap
precursor does direct memory mapping
cramium uses a qspi interface
2024-04-06 22:59:43 +08:00
bunnie
dddbc3c163 add aes-gcm-siv dependency to loader 2024-04-06 22:58:20 +08:00
bunnie
e84fd34c9a aead dependency changes in cargo.lock 2024-04-06 22:57:58 +08:00
bunnie
fbce3f774c update cramium soc target to latest svd spec 2024-04-06 22:57:38 +08:00
bunnie
42063c222e add explicit build flags to swap target 2024-04-06 22:56:25 +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
588e7aaf0a add spi memory drivers to udma library
totally untested, but, at least structurally present so we
have a chance that our memory structures and APIs can work.
2024-04-06 22:54:34 +08:00
bunnie
e61fe6c318 Merge branch 'swap-image-loader' of github.com:betrusted-io/xous-core into swap-image-loader 2024-04-06 22:48:35 +08:00
bunnie
8a7010a6c5 add renode configs for swap 2024-04-06 07:47:18 -07:00
bunnie
50fa69a062 fix main memory patching for swap config on precursor 2024-04-06 07:47:18 -07:00
bunnie
8c219f8fb1 patching routine for memory regions.
ended up not being used because main memory is a special case :P
2024-04-06 07:47:18 -07:00
bunnie
b06dd72e7d make argument start/offset visible
so we can patch it up for the swap testing on precursor
2024-04-06 07:47:18 -07:00
bunnie
78cd15e590 the image creator is sensitive to the target for swap configs 2024-04-06 07:47:18 -07:00
bunnie
98d31c5274 fix ram offsets for precursor swap config 2024-04-06 07:47:18 -07:00
bunnie
798566e6d2 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-06 07:47:18 -07:00
bunnie
bac8e4ff4d chore: add a comment 2024-04-06 07:47:18 -07:00
bunnie
b72a949930 absorb new dependencies 2024-04-06 07:47:18 -07:00
bunnie
6dbea466fb add cryptographic libraries to the image creator manifest 2024-04-06 07:47:18 -07:00
bunnie
a662f5edcb rework create-image to put inis objects into the detached swap region 2024-04-06 07:47:18 -07:00
bunnie
eb1cb4a253 add the swap_writer module to the library 2024-04-06 07:47:18 -07:00
bunnie
0aecb4c1d3 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-06 07:47:18 -07:00
bunnie
d8f3fc96d6 specify swap file name 2024-04-06 07:47:18 -07:00
bunnie
8bae95ef72 put placeholders for inis handling, phase 2 2024-04-06 07:47:18 -07:00
bunnie
c354b75d97 put placeholders to handle inis in phase1 2024-04-06 07:47:18 -07:00