mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fix dangling method invocation
complicated thing is complicated
This commit is contained in:
parent
802decb55a
commit
0cc2e46b02
2 changed files with 9 additions and 3 deletions
|
|
@ -1484,7 +1484,7 @@ impl<'a> RootKeys {
|
||||||
}
|
}
|
||||||
_ => PublicKey::from_bytes(&self.read_key_256(KeyRomLocs::SELFSIGN_PUBKEY)).expect("public key was not valid")
|
_ => PublicKey::from_bytes(&self.read_key_256(KeyRomLocs::SELFSIGN_PUBKEY)).expect("public key was not valid")
|
||||||
};
|
};
|
||||||
if !self.verify_gateware_self_signature(&pubkey) {
|
if !self.verify_gateware_self_signature(Some(&pubkey)) {
|
||||||
return Err(RootkeyResult::IntegrityError);
|
return Err(RootkeyResult::IntegrityError);
|
||||||
}
|
}
|
||||||
// as a sanity check, check the kernel self signature
|
// as a sanity check, check the kernel self signature
|
||||||
|
|
@ -2271,8 +2271,14 @@ impl<'a> RootKeys {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is a fast check on the gateware meant to be called on boot just to confirm that we're using a self-signed gateware
|
/// This is a fast check on the gateware meant to be called on boot just to confirm that we're using a self-signed gateware
|
||||||
pub fn verify_gateware_self_signature(&mut self, pubkey: &PublicKey) -> bool {
|
pub fn verify_gateware_self_signature(&mut self, maybe_pubkey: Option<&PublicKey>) -> bool {
|
||||||
log::info!("verifying gateware self signature");
|
log::info!("verifying gateware self signature");
|
||||||
|
let local_pk = PublicKey::from_bytes(&self.read_key_256(KeyRomLocs::SELFSIGN_PUBKEY)).expect("public key was not valid");
|
||||||
|
let pubkey = if let Some(pk) = maybe_pubkey {
|
||||||
|
pk
|
||||||
|
} else {
|
||||||
|
&local_pk
|
||||||
|
};
|
||||||
// read the public key directly out of the keyrom
|
// read the public key directly out of the keyrom
|
||||||
let gateware_region = self.gateware();
|
let gateware_region = self.gateware();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1264,7 +1264,7 @@ fn main() -> ! {
|
||||||
|
|
||||||
Some(Opcode::CheckGatewareSignature) => msg_blocking_scalar_unpack!(msg, _, _, _, _, {
|
Some(Opcode::CheckGatewareSignature) => msg_blocking_scalar_unpack!(msg, _, _, _, _, {
|
||||||
if keys.is_initialized() {
|
if keys.is_initialized() {
|
||||||
if keys.verify_gateware_self_signature() {
|
if keys.verify_gateware_self_signature(None) {
|
||||||
xous::return_scalar(msg.sender, 1).expect("couldn't send return value");
|
xous::return_scalar(msg.sender, 1).expect("couldn't send return value");
|
||||||
} else {
|
} else {
|
||||||
xous::return_scalar(msg.sender, 0).expect("couldn't send return value");
|
xous::return_scalar(msg.sender, 0).expect("couldn't send return value");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue