diff --git a/bao1x-boot/boot0/src/main.rs b/bao1x-boot/boot0/src/main.rs index d446621ef..0f91baaba 100644 --- a/bao1x-boot/boot0/src/main.rs +++ b/bao1x-boot/boot0/src/main.rs @@ -312,7 +312,11 @@ pub unsafe extern "C" fn rust_entry() -> ! { bollard!(die, 4); jump_to((target ^ u32::from_le_bytes(tag)) as usize); } - _ => {} + Err(e) => { + crate::println!("Sigcheck err: {:?}", e); + csprng.random_delay(); + bollard!(die, 4); + } } } diff --git a/tools/src/bin/xous-sign-image.rs b/tools/src/bin/xous-sign-image.rs index 11d25c55d..cc6aa79b4 100644 --- a/tools/src/bin/xous-sign-image.rs +++ b/tools/src/bin/xous-sign-image.rs @@ -1,7 +1,10 @@ use std::io::{Error, ErrorKind}; use clap::{App, Arg, crate_version}; -use xous_tools::sign_image::{convert_to_uf2, load_pem, sign_file}; +use xous_tools::{ + sign_image::{convert_to_uf2, load_pem, sign_file}, + utils::parse_u32, +}; const DEVKEY_PATH: &str = "devkey/dev.key"; @@ -98,6 +101,13 @@ fn main() -> Result<(), Box> { .help("Function code to embed in the signature block. Only meaningful in combination with --bao1x") .required(false) ) + .arg( + Arg::with_name("antirollback-override") + .long("antirollback-override") + .takes_value(true) + .help("Manually specify an anti-rollback value for the image. Overrides the system configuration file.") + .required(false) + ) .get_matches(); let minver = @@ -109,6 +119,12 @@ fn main() -> Result<(), Box> { None }; + let arb_override = if let Some(arb_str) = matches.value_of("antirollback-override") { + parse_u32(arb_str).ok() + } else { + None + }; + let sig_length = usize::from_str_radix(matches.value_of("sig-length").unwrap_or("4096"), 10) .expect("sig-length should be a decimal number"); // Sign the loader, if an output file was specified @@ -140,6 +156,7 @@ fn main() -> Result<(), Box> { matches.is_present("with-jump"), sig_length, matches.value_of("function-code"), + arb_override.map(|x| x as usize), )?; if matches.is_present("bao1x") { @@ -181,6 +198,7 @@ fn main() -> Result<(), Box> { matches.is_present("with-jump"), sig_length, Some(matches.value_of("function-code").unwrap_or("kernel")), + arb_override.map(|x| x as usize), )?; if matches.is_present("bao1x") { diff --git a/tools/src/sign_image.rs b/tools/src/sign_image.rs index b9ff5602b..b2c0012f3 100644 --- a/tools/src/sign_image.rs +++ b/tools/src/sign_image.rs @@ -304,6 +304,7 @@ pub fn sign_file( with_jump: bool, sector_length: usize, function_code: Option<&str>, + arb_override: Option, ) -> Result<(), Box> where S: AsRef, @@ -324,7 +325,7 @@ where sector_length, version, function_code, - None, + arb_override, )?; dest_file.write_all(&result)?; Ok(())