From 3c341d0f8eedcfc4a7273aacfeb9788b8a3bec5f Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 6 Oct 2025 03:49:55 +0800 Subject: [PATCH] handle return codes that include tags --- bao1x-boot/boot1/src/secboot.rs | 6 +++++- loader/src/main.rs | 14 +++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bao1x-boot/boot1/src/secboot.rs b/bao1x-boot/boot1/src/secboot.rs index b3cc66239..1bb383820 100644 --- a/bao1x-boot/boot1/src/secboot.rs +++ b/bao1x-boot/boot1/src/secboot.rs @@ -32,7 +32,11 @@ pub fn boot_or_die() -> ! { true, None, ) { - Ok(k) => crate::println!("**should be unreachable** Booted with key {}", k), + Ok((k, tag)) => crate::println!( + "**should be unreachable** Booted with key {}({})", + k, + core::str::from_utf8(&tag.to_le_bytes()).unwrap_or("invalid tag") + ), Err(e) => crate::println!("Image did not validate: {:?}", e), } crate::println!("No valid loader or baremetal image found. Halting!"); diff --git a/loader/src/main.rs b/loader/src/main.rs index f193db757..6ea402181 100644 --- a/loader/src/main.rs +++ b/loader/src/main.rs @@ -266,7 +266,11 @@ pub unsafe extern "C" fn rust_entry(signed_buffer: *const usize, signature: u32) false, None, ) { - Ok(k) => println!("*** Kernel signature check by key @ {} OK ***", k), + Ok((k, tag)) => println!( + "*** Kernel signature check by key @ {}({}) OK ***", + k, + core::str::from_utf8(&tag.to_le_bytes()).unwrap_or("invalid tag") + ), Err(e) => { println!("Kernel failed signature check. Dying: {:?}", e); bao1x_hal::sigcheck::die_no_std(); @@ -285,8 +289,12 @@ pub unsafe extern "C" fn rust_entry(signed_buffer: *const usize, signature: u32) false, None, ) { - Ok(k) => { - println!("*** Detached app signature check by key @ {} OK ***", k); + Ok((k, tag)) => { + println!( + "*** Detached app signature check by key @ {}({}) OK ***", + k, + core::str::from_utf8(&tag.to_le_bytes()).unwrap_or("invalid tag") + ); true } Err(_e) => {