From 2fb72be487b55a34b465f391d67b9e581e7d9882 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sat, 4 Oct 2025 18:53:13 +0800 Subject: [PATCH] update signature check api in boot0/boot1 pass `None` for the spim field as these are direct RRAM checks. --- bao1x-boot/boot0/src/main.rs | 5 +++++ bao1x-boot/boot0/src/repl.rs | 12 ++++++++++-- bao1x-boot/boot1/src/secboot.rs | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/bao1x-boot/boot0/src/main.rs b/bao1x-boot/boot0/src/main.rs index b306ac113..bb49c0f74 100644 --- a/bao1x-boot/boot0/src/main.rs +++ b/bao1x-boot/boot0/src/main.rs @@ -84,6 +84,7 @@ pub unsafe extern "C" fn rust_entry() -> ! { bao1x_api::BOOT0_REVOCATION_OFFSET, &[FunctionCode::Boot0 as u32], // only boot0 is allowed for boot0 false, + None, ) .is_ok() { @@ -100,6 +101,7 @@ pub unsafe extern "C" fn rust_entry() -> ! { bao1x_api::BOOT0_REVOCATION_OFFSET, &allowed_functions, true, + None, ) .ok(); bao1x_hal::sigcheck::validate_image( @@ -108,6 +110,7 @@ pub unsafe extern "C" fn rust_entry() -> ! { bao1x_api::BOOT0_REVOCATION_OFFSET, &allowed_functions, true, + None, ) .ok(); } @@ -119,6 +122,7 @@ pub unsafe extern "C" fn rust_entry() -> ! { bao1x_api::BOOT0_REVOCATION_OFFSET, &allowed_functions, true, + None, ) .ok(); bao1x_hal::sigcheck::validate_image( @@ -127,6 +131,7 @@ pub unsafe extern "C" fn rust_entry() -> ! { bao1x_api::BOOT0_REVOCATION_OFFSET, &allowed_functions, true, + None, ) .ok(); } diff --git a/bao1x-boot/boot0/src/repl.rs b/bao1x-boot/boot0/src/repl.rs index 3ac34b083..5d6261005 100644 --- a/bao1x-boot/boot0/src/repl.rs +++ b/bao1x-boot/boot0/src/repl.rs @@ -134,8 +134,12 @@ impl Repl { crate::println!(""); } "check" => match bao1x_hal::sigcheck::validate_image( - crate::FLASH_BASE as *const u32, + bao1x_api::BOOT0_START as *const u32, + bao1x_api::BOOT0_START as *const u32, bao1x_api::BOOT0_REVOCATION_OFFSET, + &[FunctionCode::Boot0 as u32], // only boot0 is allowed for boot0 + false, + None, ) { Ok(key_number) => crate::println!("sigcheck passed on key {}", key_number), Err(e) => crate::println!("sigcheck failed: {}", e), @@ -159,8 +163,12 @@ impl Repl { break; } bao1x_hal::sigcheck::validate_image( - crate::FLASH_BASE as *const u32, + bao1x_api::BOOT0_START as *const u32, + bao1x_api::BOOT0_START as *const u32, bao1x_api::BOOT0_REVOCATION_OFFSET, + &[FunctionCode::Boot0 as u32], // only boot0 is allowed for boot0 + false, + None, ) .ok(); count += 1; diff --git a/bao1x-boot/boot1/src/secboot.rs b/bao1x-boot/boot1/src/secboot.rs index 13e11f3b4..b3cc66239 100644 --- a/bao1x-boot/boot1/src/secboot.rs +++ b/bao1x-boot/boot1/src/secboot.rs @@ -30,6 +30,7 @@ pub fn boot_or_die() -> ! { bao1x_api::BOOT1_REVOCATION_OFFSET, &ALLOWED_FUNCTIONS, true, + None, ) { Ok(k) => crate::println!("**should be unreachable** Booted with key {}", k), Err(e) => crate::println!("Image did not validate: {:?}", e),