diff --git a/bao1x-boot/boot0/src/main.rs b/bao1x-boot/boot0/src/main.rs index 95ed88e23..22ae9d30b 100644 --- a/bao1x-boot/boot0/src/main.rs +++ b/bao1x-boot/boot0/src/main.rs @@ -76,7 +76,9 @@ pub unsafe extern "C" fn rust_entry() -> ! { _ => (), }; } + // self-validate the image with the keys we put in, just to make sure our code wasn't tampered with if bao1x_hal::sigcheck::validate_image( + bao1x_api::BOOT0_START as *const u32, bao1x_api::BOOT0_START as *const u32, bao1x_api::BOOT0_REVOCATION_OFFSET, false, @@ -90,13 +92,15 @@ pub unsafe extern "C" fn rust_entry() -> ! { // Primary boot selected. Check Boot1 first, then fall back to LOADER/BAREMETAL. bao1x_hal::sigcheck::validate_image( bao1x_api::BOOT1_START as *const u32, - bao1x_api::BOOT1_REVOCATION_OFFSET, + bao1x_api::BOOT0_START as *const u32, + bao1x_api::BOOT0_REVOCATION_OFFSET, true, ) .ok(); bao1x_hal::sigcheck::validate_image( bao1x_api::LOADER_START as *const u32, - bao1x_api::LOADER_REVOCATION_OFFSET, + bao1x_api::BOOT0_START as *const u32, + bao1x_api::BOOT0_REVOCATION_OFFSET, true, ) .ok(); @@ -105,13 +109,15 @@ pub unsafe extern "C" fn rust_entry() -> ! { // Alternate boot selected. Check LOADER/BAREMETAL, then fall back to Boot1. bao1x_hal::sigcheck::validate_image( bao1x_api::LOADER_START as *const u32, - bao1x_api::LOADER_REVOCATION_OFFSET, + bao1x_api::BOOT0_START as *const u32, + bao1x_api::BOOT0_REVOCATION_OFFSET, true, ) .ok(); bao1x_hal::sigcheck::validate_image( bao1x_api::BOOT1_START as *const u32, - bao1x_api::BOOT1_REVOCATION_OFFSET, + bao1x_api::BOOT0_START as *const u32, + bao1x_api::BOOT0_REVOCATION_OFFSET, true, ) .ok(); diff --git a/bao1x-boot/boot0/src/platform/bao1x/bao1x.rs b/bao1x-boot/boot0/src/platform/bao1x/bao1x.rs index 34dad3a75..78bb7497d 100644 --- a/bao1x-boot/boot0/src/platform/bao1x/bao1x.rs +++ b/bao1x-boot/boot0/src/platform/bao1x/bao1x.rs @@ -14,7 +14,6 @@ static ALLOCATOR: linked_list_allocator::LockedHeap = linked_list_allocator::Loc pub const RAM_SIZE: usize = utralib::generated::HW_SRAM_MEM_LEN; pub const RAM_BASE: usize = utralib::generated::HW_SRAM_MEM; -pub const FLASH_BASE: usize = utralib::generated::HW_RERAM_MEM; // This may not be a great assumption. TODO: fix this by deriving from the static boot constants. // also fix this in the baremetal/loader configs. diff --git a/bao1x-boot/boot1/src/secboot.rs b/bao1x-boot/boot1/src/secboot.rs index 90c87bca0..7da12b848 100644 --- a/bao1x-boot/boot1/src/secboot.rs +++ b/bao1x-boot/boot1/src/secboot.rs @@ -20,7 +20,8 @@ pub fn try_boot(board_type: &BoardTypeCoding, iox: &T) -> O // This diverges if the signature check is successful bao1x_hal::sigcheck::validate_image( bao1x_api::LOADER_START as *const u32, - bao1x_api::LOADER_REVOCATION_OFFSET, + bao1x_api::BOOT1_START as *const u32, + bao1x_api::BOOT1_REVOCATION_OFFSET, true, ) .ok(); @@ -46,7 +47,8 @@ pub fn boot_or_die() -> ! { // This diverges if the signature check is successful bao1x_hal::sigcheck::validate_image( bao1x_api::LOADER_START as *const u32, - bao1x_api::LOADER_REVOCATION_OFFSET, + bao1x_api::BOOT1_START as *const u32, + bao1x_api::BOOT1_REVOCATION_OFFSET, true, ) .ok();