update signature check api in boot0/boot1

pass `None` for the spim field as these are direct RRAM checks.
This commit is contained in:
bunnie 2025-10-04 18:53:13 +08:00
parent d21e99a3f3
commit 2fb72be487
3 changed files with 16 additions and 2 deletions

View file

@ -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();
}

View file

@ -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;

View file

@ -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),