mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
fix public key origin for signature checks
in general the public key should come from a trusted block, not the image itself. The initial prototype of the image was written for self-checking of boot0; but for other images, the public key should "chain" from the trusted image (i.e. boot0's key should check boot1, boot1's key should check baremetal/loader, etc.)
This commit is contained in:
parent
a3a2a1de9d
commit
54b16cdf64
3 changed files with 14 additions and 7 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ pub fn try_boot<T: IoSetup + IoGpio>(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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue