mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
add audit of boot mode to audit and security assessment
Turns out we *can* check this at run-time. I thought originally once the chip was sealed these became hidden. I was wrong. So, this means we can actually test to confirm that production was done correctly and in fact the CM7 and debug ports are sealed off. this adds that test.
This commit is contained in:
parent
6eda3925ae
commit
341c2353ab
2 changed files with 27 additions and 0 deletions
|
|
@ -438,6 +438,17 @@ impl Repl {
|
|||
} else {
|
||||
crate::println!("In-system keys have been generated");
|
||||
}
|
||||
let ifr = unsafe { core::slice::from_raw_parts(0x6040_0180 as *const u8, 0x10) };
|
||||
let ref_value = [
|
||||
0x00u8, 0x00, 0x00, 0x00, 0x82, 0x8c, 0x42, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
];
|
||||
if ifr == &ref_value {
|
||||
crate::println!("CM7 & debug confirmed fused off");
|
||||
} else {
|
||||
crate::println!("Factory configuration error - CM7 or debug is enabled!");
|
||||
secure = false;
|
||||
}
|
||||
if !secure {
|
||||
crate::println!("** System did not meet minimum requirements for security **");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,22 @@ pub fn try_boot(or_die: bool, csprng: &mut Csprng) {
|
|||
if dev2 != 0 {
|
||||
bao1x_hal::sigcheck::erase_secrets(&mut Some(csprng)).inspect_err(|e| crate::println!("{}", e)).ok(); // "ok" because the expected error is a check on logic/configuration bugs, not attacks
|
||||
}
|
||||
bollard!(bao1x_hal::sigcheck::die_no_std, 4);
|
||||
csprng.random_delay();
|
||||
{
|
||||
// check IFR settings - this confirms that the Cortex M7 is disabled, and that hardware JTAG debug is
|
||||
// disabled
|
||||
let ifr = unsafe { core::slice::from_raw_parts(0x6040_0180 as *const u8, 0x10) };
|
||||
let ref_value = [
|
||||
0x00u8, 0x00, 0x00, 0x00, 0x82, 0x8c, 0x42, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
];
|
||||
if ifr != &ref_value {
|
||||
bao1x_hal::sigcheck::erase_secrets(&mut Some(csprng))
|
||||
.inspect_err(|e| crate::println!("{}", e))
|
||||
.ok(); // "ok" because the expected error is a check on logic/configuration bugs, not attacks
|
||||
crate::println!("Incorrect IFR: factory error, or under attack. Secrets erased.");
|
||||
}
|
||||
}
|
||||
|
||||
csprng.random_delay();
|
||||
let (paranoid1, paranoid2) = one_way.hardened_get2(PARANOID_MODE, PARANOID_MODE_DUPE).unwrap();
|
||||
|
|
|
|||
Loading…
Reference in a new issue