diff --git a/services/root-keys/src/implementation.rs b/services/root-keys/src/implementation.rs index 799197177..c75407da0 100644 --- a/services/root-keys/src/implementation.rs +++ b/services/root-keys/src/implementation.rs @@ -1484,7 +1484,7 @@ impl<'a> RootKeys { } _ => 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); } // 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 - 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"); + 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 let gateware_region = self.gateware(); diff --git a/services/root-keys/src/main.rs b/services/root-keys/src/main.rs index 569f5e0e3..b3dabbda8 100644 --- a/services/root-keys/src/main.rs +++ b/services/root-keys/src/main.rs @@ -1264,7 +1264,7 @@ fn main() -> ! { Some(Opcode::CheckGatewareSignature) => msg_blocking_scalar_unpack!(msg, _, _, _, _, { 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"); } else { xous::return_scalar(msg.sender, 0).expect("couldn't send return value");