Merge branch 'backups' into main

This commit is contained in:
bunnie 2022-07-14 19:27:18 +08:00
commit a5bcc50007
4 changed files with 10 additions and 1 deletions

1
Cargo.lock generated
View file

@ -2891,6 +2891,7 @@ dependencies = [
"ticktimer-server",
"trng",
"tts-frontend",
"usb-device-xous",
"utralib",
"xous",
"xous-ipc 0.9.7",

View file

@ -48,6 +48,7 @@ tts-frontend = {path="../tts"}
# aes-gcm-siv = {version = "0.11.0-pre", default-features = false, features = ["alloc"]}
aes-gcm-siv = {git="https://github.com/RustCrypto/AEADs.git", branch="master"}
subtle = {version = "2.4.1", default-features = false}
usb-device-xous = {path="../usb-device-xous"}
# private keys
#sha2 = {version = "0.9.5", default-features = false, features = []}

View file

@ -1278,6 +1278,10 @@ fn main() -> ! {
}),
Some(Opcode::TryNoKeySocUpdate) => msg_blocking_scalar_unpack!(msg, _, _, _, _, {
if keys.try_nokey_soc_update(&mut rootkeys_modal, main_cid) {
// this will unblock the status thread, but also pop up our reboot flow
send_message(main_cid,
xous::Message::new_scalar(Opcode::UxTryReboot.to_usize().unwrap(), 0, 0, 0, 0)
).expect("couldn't initiate dialog box");
xous::return_scalar(msg.sender, 1).unwrap();
} else {
xous::return_scalar(msg.sender, 0).unwrap();
@ -1377,6 +1381,9 @@ fn main() -> ! {
// this final statement has a take/unwrap to set backup_header back to None
match keys.write_backup(backup_header.take().unwrap(), backup_ct) {
Ok(_) => {
let usbd = usb_device_xous::UsbHid::new();
usbd.switch_to_core(usb_device_xous::UsbDeviceType::Debug).unwrap();
usbd.debug_usb(Some(false)).unwrap();
modals.show_notification(t!("rootkeys.backup_staged", xous::LANG), Some("https://github.com/betrusted-io/betrusted-wiki/wiki/Backups")).ok();
}
Err(_) => {

View file

@ -473,7 +473,7 @@ fn wrapped_main() -> ! {
});
if let Some(staged) = staged_sv {
let soc = llio.soc_gitrev().expect("error querying SoC gitrev; this is fatal");
if staged > soc {
if (staged > soc) && !soc_updated { // if the soc was updated, we should reboot before we try this
if keys.lock().unwrap().prompt_for_update() {
// prompt to apply the update
modals.add_list_item(t!("rootkeys.gwup.yes", xous::LANG)).expect("couldn't build radio item list");