mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fix multithreaded gateware verification at boot
This commit is contained in:
parent
cf3ed935e7
commit
4b175df36b
2 changed files with 17 additions and 17 deletions
|
|
@ -70,7 +70,7 @@
|
||||||
"en-audio": "Committing signatures. This may take a while, don't reset or sleep the device."
|
"en-audio": "Committing signatures. This may take a while, don't reset or sleep the device."
|
||||||
},
|
},
|
||||||
"rootkeys.init.finished": {
|
"rootkeys.init.finished": {
|
||||||
"en": "Preparing to reboot...\n\n",
|
"en": "Preparing to reboot...\n\n\n",
|
||||||
"zh": "准备重启...\n\n",
|
"zh": "准备重启...\n\n",
|
||||||
"en-audio": "Preparing to reboot."
|
"en-audio": "Preparing to reboot."
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -187,27 +187,27 @@ fn xmain() -> ! {
|
||||||
if !debug_locked {
|
if !debug_locked {
|
||||||
sec_notes.lock().unwrap().insert("secnote.usb_unlock".to_string(), t!("secnote.usb_unlock", xous::LANG).to_string());
|
sec_notes.lock().unwrap().insert("secnote.usb_unlock".to_string(), t!("secnote.usb_unlock", xous::LANG).to_string());
|
||||||
}
|
}
|
||||||
let keys = root_keys::RootKeys::new(&xns).expect("couldn't connect to root_keys to query initialization state");
|
let keys = Arc::new(Mutex::new(root_keys::RootKeys::new(&xns).expect("couldn't connect to root_keys to query initialization state")));
|
||||||
if !keys.is_initialized().unwrap() {
|
if !keys.lock().unwrap().is_initialized().unwrap() {
|
||||||
sec_notes.lock().unwrap().insert("secnotes.no_keys".to_string(), t!("secnote.no_keys", xous::LANG).to_string());
|
sec_notes.lock().unwrap().insert("secnotes.no_keys".to_string(), t!("secnote.no_keys", xous::LANG).to_string());
|
||||||
} else {
|
} else {
|
||||||
log::info!("checking gateware signature...");
|
log::info!("checking gateware signature...");
|
||||||
let sigstate = keys.check_gateware_signature().expect("couldn't issue gateware check call");
|
|
||||||
thread::spawn({
|
thread::spawn({
|
||||||
let clone = Arc::clone(&sec_notes);
|
let clone = Arc::clone(&sec_notes);
|
||||||
|
let keys = Arc::clone(&keys);
|
||||||
move || {
|
move || {
|
||||||
if let Some(pass) = sigstate {
|
if let Some(pass) = keys.lock().unwrap().check_gateware_signature().expect("couldn't issue gateware check call") {
|
||||||
if !pass {
|
if !pass {
|
||||||
|
let mut sn = clone.lock().unwrap();
|
||||||
|
sn.insert("secnotes.gateware_fail".to_string(), t!("secnote.gateware_fail", xous::LANG).to_string());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
let mut sn = clone.lock().unwrap();
|
let mut sn = clone.lock().unwrap();
|
||||||
sn.insert("secnotes.gateware_fail".to_string(), t!("secnote.gateware_fail", xous::LANG).to_string());
|
sn.insert("secnotes.state_fail".to_string(), t!("secnote.state_fail", xous::LANG).to_string());
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
let mut sn = clone.lock().unwrap();
|
|
||||||
sn.insert("secnotes.state_fail".to_string(), t!("secnote.state_fail", xous::LANG).to_string());
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
let mut stats_phase: usize = 0;
|
let mut stats_phase: usize = 0;
|
||||||
|
|
||||||
|
|
@ -232,15 +232,15 @@ fn xmain() -> ! {
|
||||||
log::debug!("starting main menu thread");
|
log::debug!("starting main menu thread");
|
||||||
let keys_init;
|
let keys_init;
|
||||||
let keys_op;
|
let keys_op;
|
||||||
if keys.is_initialized().unwrap() {
|
if keys.lock().unwrap().is_initialized().unwrap() {
|
||||||
keys_init = 1;
|
keys_init = 1;
|
||||||
keys_op = keys.get_update_gateware_op();
|
keys_op = keys.lock().unwrap().get_update_gateware_op();
|
||||||
} else {
|
} else {
|
||||||
keys_init = 0;
|
keys_init = 0;
|
||||||
keys_op = keys.get_try_init_keys_op();
|
keys_op = keys.lock().unwrap().get_try_init_keys_op();
|
||||||
}
|
}
|
||||||
let sign_op = keys.get_try_selfsign_op();
|
let sign_op = keys.lock().unwrap().get_try_selfsign_op();
|
||||||
xous::create_thread_4(main_menu_thread, keys_init, keys.conn() as usize, keys_op as usize, sign_op as usize)
|
xous::create_thread_4(main_menu_thread, keys_init, keys.lock().unwrap().conn() as usize, keys_op as usize, sign_op as usize)
|
||||||
.expect("couldn't create menu thread");
|
.expect("couldn't create menu thread");
|
||||||
|
|
||||||
info!("|status: starting main loop");
|
info!("|status: starting main loop");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue