mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
convert secboot to have an argument for returning the hash
also compute the hash and return the value as part of this patch
This commit is contained in:
parent
2f47a9d4f2
commit
8f3229c9ea
1 changed files with 6 additions and 2 deletions
|
|
@ -271,7 +271,7 @@ impl Keyrom {
|
||||||
|
|
||||||
// returns true if the kernel is valid
|
// returns true if the kernel is valid
|
||||||
// side-effects the "devboot" register in the gfx engine if devkeys were detected
|
// side-effects the "devboot" register in the gfx engine if devkeys were detected
|
||||||
pub fn validate_xous_img(xous_img_offset: *const u32) -> bool {
|
pub fn validate_xous_img(xous_img_offset: *const u32, fs_prehash: &mut [u8; 64]) -> bool {
|
||||||
// reset the SHA block, in case we're coming out of a warm reset
|
// reset the SHA block, in case we're coming out of a warm reset
|
||||||
let mut sha = CSR::new(utra::sha512::HW_SHA512_BASE as *mut u32);
|
let mut sha = CSR::new(utra::sha512::HW_SHA512_BASE as *mut u32);
|
||||||
sha.wfo(utra::sha512::POWER_ON, 1);
|
sha.wfo(utra::sha512::POWER_ON, 1);
|
||||||
|
|
@ -448,7 +448,11 @@ pub fn validate_xous_img(xous_img_offset: *const u32) -> bool {
|
||||||
gfx.msg("Checking signature...\n\r", &mut cursor);
|
gfx.msg("Checking signature...\n\r", &mut cursor);
|
||||||
let mut h: Sha512 = Sha512::new();
|
let mut h: Sha512 = Sha512::new();
|
||||||
h.update(&image);
|
h.update(&image);
|
||||||
if pubkey.verify_prehashed(h, None, &ed25519_signature).is_ok() {
|
// The prehash needs to be finalized before we create a new hasher instance. We
|
||||||
|
// only have one hardware hasher available.
|
||||||
|
let prehash = h.finalize();
|
||||||
|
if pubkey.verify_prehashed(prehash.as_slice(), None, &ed25519_signature).is_ok() {
|
||||||
|
fs_prehash.copy_from_slice(prehash.as_slice());
|
||||||
gfx.msg("Signature check passed\n\r", &mut cursor);
|
gfx.msg("Signature check passed\n\r", &mut cursor);
|
||||||
println!("Signature check passed");
|
println!("Signature check passed");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue