mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
Merge pull request #756 from betrusted-io/simplify-keysetup
Zeroing in on dabao instability, CI fixes
This commit is contained in:
commit
5f2c6a0661
3 changed files with 16 additions and 11 deletions
|
|
@ -140,10 +140,9 @@ pub fn setup_backup_region() -> u32 {
|
|||
/// This can change the board type coding to a safer, simpler board type if the declared board type has
|
||||
/// problems booting.
|
||||
pub fn early_init(mut board_type: bao1x_api::BoardTypeCoding) -> (bao1x_api::BoardTypeCoding, u32) {
|
||||
#[cfg(not(feature = "alt-boot1"))]
|
||||
if setup_backup_region() == 0 {
|
||||
crate::println!("backup region is clean!");
|
||||
}
|
||||
// This can be used to debug stuff early on dabao, assuming boot0 setup the console UART. It normally
|
||||
// does, but we leave this commented out for non-debug situations because it's a weak guarantee.
|
||||
// crate::debug::USE_CONSOLE.store(true, core::sync::atomic::Ordering::SeqCst);
|
||||
|
||||
irq_setup();
|
||||
// all sensors & IRQs setup already by boot0, but it doesn't hurt to re-write these registers
|
||||
|
|
@ -157,6 +156,13 @@ pub fn early_init(mut board_type: bao1x_api::BoardTypeCoding) -> (bao1x_api::Boa
|
|||
|
||||
let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
|
||||
|
||||
// this has to happen after the IRQs are enabled because if a false security alarm is triggered the
|
||||
// system won't reboot properly at the end of the set_backup_region() routine
|
||||
#[cfg(not(feature = "alt-boot1"))]
|
||||
if setup_backup_region() == 0 {
|
||||
crate::println!("backup region is clean!");
|
||||
}
|
||||
|
||||
// setup board-specific I/Os - early boot set. These are items that have to be
|
||||
// done in a time-sensitive fashion.
|
||||
match board_type {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ param(
|
|||
[string]$CredentialFile = "beta.json",
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[string]$Target = "bunnie@10.0.245.183:code/jtag-tools/"
|
||||
[string]$Target = "bunnie@10.0.245.50:code/csp-tool/"
|
||||
)
|
||||
|
||||
# Configuration
|
||||
|
|
|
|||
|
|
@ -300,14 +300,13 @@ pub unsafe extern "C" fn rust_entry(signed_buffer: *const usize, signature: u32)
|
|||
csprng.random_delay();
|
||||
bollard!(bao1x_hal::sigcheck::die_no_std, 4);
|
||||
// this has to gate on keys being initialized, because without key setup nothing gets erased
|
||||
if (tag == *bao1x_api::pubkeys::KEYSLOT_INITIAL_TAGS[bao1x_api::pubkeys::DEVELOPER_KEY_SLOT]
|
||||
|| key == bao1x_api::pubkeys::DEVELOPER_KEY_SLOT)
|
||||
&& (init1 != 0)
|
||||
if tag == *bao1x_api::pubkeys::KEYSLOT_INITIAL_TAGS[bao1x_api::pubkeys::DEVELOPER_KEY_SLOT]
|
||||
|| key == bao1x_api::pubkeys::DEVELOPER_KEY_SLOT
|
||||
{
|
||||
csprng.random_delay();
|
||||
let erase_proof: &[u8; 32] =
|
||||
backup.get_slice(ERASURE_PROOF_RANGE_BYTES).try_into().unwrap();
|
||||
if dev_mode1 == 0 || erase_proof != &[ERASE_VALUE; 32] {
|
||||
if dev_mode1 == 0 || (erase_proof != &[ERASE_VALUE; 32]) && (init1 != 0) {
|
||||
if paranoid1 == 0 && paranoid2 == 0 {
|
||||
println!("{}LOADER.KERNDIE,{}", BOOKEND_START, BOOKEND_END);
|
||||
println!("Kernel is devkey signed, but system is not in developer mode. Dying!");
|
||||
|
|
@ -322,11 +321,11 @@ pub unsafe extern "C" fn rust_entry(signed_buffer: *const usize, signature: u32)
|
|||
// this consumes dev_mode2 & !k2 - the alternate version - preventing the check from being
|
||||
// optimized out
|
||||
bollard!(bao1x_hal::sigcheck::die_no_std, 4);
|
||||
if (!key_inv == bao1x_api::pubkeys::DEVELOPER_KEY_SLOT) && (init2 != 0) {
|
||||
if !key_inv == bao1x_api::pubkeys::DEVELOPER_KEY_SLOT {
|
||||
csprng.random_delay();
|
||||
let erase_proof: &[u8; 32] =
|
||||
backup.get_slice(ERASURE_PROOF_RANGE_BYTES).try_into().unwrap();
|
||||
if dev_mode2 == 0 || erase_proof != &[ERASE_VALUE; 32] {
|
||||
if dev_mode2 == 0 || (erase_proof != &[ERASE_VALUE; 32] && (init2 != 0)) {
|
||||
if paranoid1 == 0 && paranoid2 == 0 {
|
||||
println!("{}LOADER.KERNDIE,{}", BOOKEND_START, BOOKEND_END);
|
||||
println!("Kernel is devkey signed, but system is not in developer mode. Dying!");
|
||||
|
|
|
|||
Loading…
Reference in a new issue