commit before merging main stuff

want to capture in the libstd improvements before we get too much
version drift
This commit is contained in:
bunnie 2021-08-03 16:54:42 +08:00
parent 07bf3478fa
commit 01d6c61bb6
4 changed files with 19 additions and 2 deletions

1
Cargo.lock generated
View file

@ -1640,6 +1640,7 @@ dependencies = [
"rand_core 0.5.1",
"rkyv 0.4.3",
"sha2",
"spinor",
"susres",
"ticktimer-server",
"trng",

View file

@ -13,6 +13,7 @@ xous-names = { path = "../xous-names" }
log = "0.4"
susres = {path = "../susres"}
trng = {path= "../trng"}
spinor = {path="../spinor"}
xous-ipc = {path = "../../xous-ipc"}
num-derive = {version = "0.3", default-features = false}

View file

@ -109,6 +109,7 @@ pub(crate) struct RootKeys {
trng: trng::Trng,
gam: gam::Gam, // for raising UX elements directly
gfx: graphics_server::Gfx, // for reading out font planes for signing verification
spinor: spinor::Spinor,
}
impl RootKeys {
@ -160,6 +161,9 @@ impl RootKeys {
xous::MemoryFlags::R | xous::MemoryFlags::W,
).expect("couldn't map sensitive data page");
let spinor = spinor::Spinor::new(&xns).expect("couldn't connect to spinor server");
spinor.register_soc_token().expect("couldn't register rootkeys as the one authorized writer to the gateware update area!");
let keys = RootKeys {
keyrom: CSR::new(keyrom.as_mut_ptr() as *mut u32),
gateware,
@ -175,6 +179,7 @@ impl RootKeys {
trng: trng::Trng::new(&xns).expect("couldn't connect to TRNG server"),
gam: gam::Gam::new(&xns).expect("couldn't connect to GAM"),
gfx: graphics_server::Gfx::new(&xns).expect("couldn't connect to gfx"),
spinor
};
keys
@ -512,6 +517,12 @@ impl RootKeys {
log::info!("Self public key: {:x?}", keypair.public.to_bytes());
self.debug_staging();
}
// Because we're initializing keys for the *first* time, make a backup copy of the bitstream to
// the staging area. Note that if we're doing an update, the update target would already be
// in the staging area, so this step should be skipped.
self.make_gateware_backup(60, 70, progress_modal, progress_action);
// compute the keyrom patch set for the bitstream
// at this point the KEYROM as replicated in sensitive_slice should have all its assets in place
patch::should_patch(42);
@ -521,6 +532,10 @@ impl RootKeys {
true
}
fn make_gateware_backup(&mut self, prog_start: u32, prog_end: u32, progress_modal: &mut Modal, progress_action: &mut Slider) {
}
#[cfg(feature = "hazardous-debug")]
fn debug_staging(&self) {
self.debug_print_key(KeyRomLocs::FPGA_KEY as usize, 256, "FPGA key: ");

View file

@ -536,10 +536,10 @@ fn xmain() -> ! {
Here is the list of servers allowed to access, and why:
- shellchat (for testing ONLY, remove once done)
- suspend/resume (for suspend locking/unlocking calls)
- keystore
- PDDB (not yet written)
- keystore (not yet written)
*/
let spinor_sid = xns.register_name(api::SERVER_NAME_SPINOR, Some(2)).expect("can't register server");
let spinor_sid = xns.register_name(api::SERVER_NAME_SPINOR, Some(3)).expect("can't register server");
log::trace!("registered with NS -- {:?}", spinor_sid);
let handler_conn = xous::connect(spinor_sid).expect("couldn't create interrupt handler callback connection");