mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
commit before merging main stuff
want to capture in the libstd improvements before we get too much version drift
This commit is contained in:
parent
07bf3478fa
commit
01d6c61bb6
4 changed files with 19 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -1640,6 +1640,7 @@ dependencies = [
|
||||||
"rand_core 0.5.1",
|
"rand_core 0.5.1",
|
||||||
"rkyv 0.4.3",
|
"rkyv 0.4.3",
|
||||||
"sha2",
|
"sha2",
|
||||||
|
"spinor",
|
||||||
"susres",
|
"susres",
|
||||||
"ticktimer-server",
|
"ticktimer-server",
|
||||||
"trng",
|
"trng",
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ xous-names = { path = "../xous-names" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
susres = {path = "../susres"}
|
susres = {path = "../susres"}
|
||||||
trng = {path= "../trng"}
|
trng = {path= "../trng"}
|
||||||
|
spinor = {path="../spinor"}
|
||||||
|
|
||||||
xous-ipc = {path = "../../xous-ipc"}
|
xous-ipc = {path = "../../xous-ipc"}
|
||||||
num-derive = {version = "0.3", default-features = false}
|
num-derive = {version = "0.3", default-features = false}
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ pub(crate) struct RootKeys {
|
||||||
trng: trng::Trng,
|
trng: trng::Trng,
|
||||||
gam: gam::Gam, // for raising UX elements directly
|
gam: gam::Gam, // for raising UX elements directly
|
||||||
gfx: graphics_server::Gfx, // for reading out font planes for signing verification
|
gfx: graphics_server::Gfx, // for reading out font planes for signing verification
|
||||||
|
spinor: spinor::Spinor,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RootKeys {
|
impl RootKeys {
|
||||||
|
|
@ -160,6 +161,9 @@ impl RootKeys {
|
||||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||||
).expect("couldn't map sensitive data page");
|
).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 {
|
let keys = RootKeys {
|
||||||
keyrom: CSR::new(keyrom.as_mut_ptr() as *mut u32),
|
keyrom: CSR::new(keyrom.as_mut_ptr() as *mut u32),
|
||||||
gateware,
|
gateware,
|
||||||
|
|
@ -175,6 +179,7 @@ impl RootKeys {
|
||||||
trng: trng::Trng::new(&xns).expect("couldn't connect to TRNG server"),
|
trng: trng::Trng::new(&xns).expect("couldn't connect to TRNG server"),
|
||||||
gam: gam::Gam::new(&xns).expect("couldn't connect to GAM"),
|
gam: gam::Gam::new(&xns).expect("couldn't connect to GAM"),
|
||||||
gfx: graphics_server::Gfx::new(&xns).expect("couldn't connect to gfx"),
|
gfx: graphics_server::Gfx::new(&xns).expect("couldn't connect to gfx"),
|
||||||
|
spinor
|
||||||
};
|
};
|
||||||
|
|
||||||
keys
|
keys
|
||||||
|
|
@ -512,6 +517,12 @@ impl RootKeys {
|
||||||
log::info!("Self public key: {:x?}", keypair.public.to_bytes());
|
log::info!("Self public key: {:x?}", keypair.public.to_bytes());
|
||||||
self.debug_staging();
|
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
|
// 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
|
// at this point the KEYROM as replicated in sensitive_slice should have all its assets in place
|
||||||
patch::should_patch(42);
|
patch::should_patch(42);
|
||||||
|
|
@ -521,6 +532,10 @@ impl RootKeys {
|
||||||
true
|
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")]
|
#[cfg(feature = "hazardous-debug")]
|
||||||
fn debug_staging(&self) {
|
fn debug_staging(&self) {
|
||||||
self.debug_print_key(KeyRomLocs::FPGA_KEY as usize, 256, "FPGA key: ");
|
self.debug_print_key(KeyRomLocs::FPGA_KEY as usize, 256, "FPGA key: ");
|
||||||
|
|
|
||||||
|
|
@ -536,10 +536,10 @@ fn xmain() -> ! {
|
||||||
Here is the list of servers allowed to access, and why:
|
Here is the list of servers allowed to access, and why:
|
||||||
- shellchat (for testing ONLY, remove once done)
|
- shellchat (for testing ONLY, remove once done)
|
||||||
- suspend/resume (for suspend locking/unlocking calls)
|
- suspend/resume (for suspend locking/unlocking calls)
|
||||||
|
- keystore
|
||||||
- PDDB (not yet written)
|
- 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);
|
log::trace!("registered with NS -- {:?}", spinor_sid);
|
||||||
|
|
||||||
let handler_conn = xous::connect(spinor_sid).expect("couldn't create interrupt handler callback connection");
|
let handler_conn = xous::connect(spinor_sid).expect("couldn't create interrupt handler callback connection");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue