mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add auto-rekey flow to boot
This commit is contained in:
parent
fa984845ed
commit
421542d9da
3 changed files with 26 additions and 13 deletions
|
|
@ -55,4 +55,5 @@ tts = []
|
|||
# default = ["debugprint"] # "debugprint"
|
||||
dbg-ecupdate = []
|
||||
ditherpunk = []
|
||||
test-rekey = []
|
||||
default = []
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@
|
|||
"zh": "找到了网关软件的更新候选者。\n\n我们应该应用它吗?",
|
||||
"en-tts": "An update candidate for the SoC was found.\n\nShould we apply it?"
|
||||
},
|
||||
"rekey.fail": {
|
||||
"ja": "キーの再生成に失敗しました。再起動して再試行してください。\n理由:",
|
||||
"en": "Rekey operation failed, please reboot and try again.\n Reason: ",
|
||||
"zh": "重新生成密钥操作失败,请重新启动并重试。\n原因:",
|
||||
"en-tts": "Rekey operation failed, please reboot and try again.\nReason: "
|
||||
},
|
||||
"socup.ignore": {
|
||||
"ja": "この更新を無視する",
|
||||
"en": "Ignore this update",
|
||||
|
|
|
|||
|
|
@ -396,15 +396,14 @@ fn wrapped_main() -> ! {
|
|||
Ok(Some(header)) => {
|
||||
match header.op {
|
||||
BackupOp::Restore => {
|
||||
{ /* remove this check once the restore process for this case is complete */
|
||||
let backup_dna = u64::from_le_bytes(header.dna);
|
||||
if backup_dna != llio.soc_dna().unwrap() {
|
||||
log::info!("backup_dna is 0x{:x}", backup_dna);
|
||||
log::info!("reported dna is 0x{:x}", llio.soc_dna().unwrap());
|
||||
panic!("Backups to new devices not yet supported: add DNA re-encryption flow");
|
||||
}
|
||||
let backup_dna = u64::from_le_bytes(header.dna);
|
||||
if backup_dna != llio.soc_dna().unwrap() {
|
||||
log::info!("This will be a two-stage restore because this is to a new device.");
|
||||
log::info!("backup_dna is 0x{:x}", backup_dna);
|
||||
log::info!("reported dna is 0x{:x}", llio.soc_dna().unwrap());
|
||||
}
|
||||
keys.lock().unwrap().do_restore_backup_ux_flow();
|
||||
// if the DNA matches the backup, the backup header is automatically erased.
|
||||
restore_running = true;
|
||||
// set the keyboard layout according to the restore record.
|
||||
let map_deserialize: BackupKeyboardLayout = header.kbd_layout.into();
|
||||
|
|
@ -413,12 +412,19 @@ fn wrapped_main() -> ! {
|
|||
kbd.set_keymap(map).ok();
|
||||
}
|
||||
BackupOp::RestoreDna => {
|
||||
unimplemented!();
|
||||
// need to call a PDDB function that does the DNA upgrade.
|
||||
// this is also the 'churn' function that's been on the to-do list, btw, just called with the same DNA as before.
|
||||
|
||||
// once this step is done & successful, we have to erase the backup block to avoid re-doing this flow
|
||||
keys.lock().unwrap().do_erase_backup();
|
||||
let pddb = pddb::Pddb::new();
|
||||
let backup_dna = u64::from_le_bytes(header.dna);
|
||||
match pddb.rekey_pddb(pddb::PddbRekeyOp::FromDnaFast(backup_dna)) {
|
||||
Ok(_) => {
|
||||
// once this step is done & successful, we have to erase the backup block to avoid re-doing this flow
|
||||
keys.lock().unwrap().do_erase_backup();
|
||||
log::info!("Rekey of PDDB to current device completed successfully")
|
||||
},
|
||||
Err(e) => {
|
||||
modals.show_notification(&format!("{}{:?}", t!("rekey.fail", xous::LANG), e), None).ok();
|
||||
log::error!("Backup was aborted. Reason: {:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
BackupOp::Backup => {
|
||||
// once we have unlocked the PDDB and know our timezone, we'll compare the embedded timestamp to
|
||||
|
|
|
|||
Loading…
Reference in a new issue