mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add code to check the flag
there's a dummy flag checked in, and this code helps check that the flag is treated correctly during CI testing
This commit is contained in:
parent
d8f4ef9fe0
commit
78036d71dc
1 changed files with 13 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ use bao1x_api::{
|
|||
use bao1x_hal::board::{BOOKEND_END, BOOKEND_START};
|
||||
use bao1x_hal::{
|
||||
acram::{OneWayCounter, SlotManager},
|
||||
board::{CHAFF_KEYS, NUISANCE_KEYS_0, NUISANCE_KEYS_1, ROOT_SEED},
|
||||
board::{CHAFF_KEYS, NUISANCE_KEYS_0, NUISANCE_KEYS_1, ROOT_SEED, THE_FLAG_1},
|
||||
rram::Reram,
|
||||
};
|
||||
use hkdf::Hkdf;
|
||||
|
|
@ -67,6 +67,10 @@ impl KeyStore {
|
|||
};
|
||||
let mut success = true;
|
||||
for key_range in key_set.iter() {
|
||||
if *key_range == THE_FLAG_1 {
|
||||
// don't overwrite the flag, it's pre-loaded from static data
|
||||
continue;
|
||||
}
|
||||
let mut storage = Vec::<u8>::with_capacity(key_range.len() * SLOT_ELEMENT_LEN_BYTES);
|
||||
storage.resize(key_range.len() * SLOT_ELEMENT_LEN_BYTES, 0);
|
||||
trng.fill_bytes(&mut storage);
|
||||
|
|
@ -245,6 +249,14 @@ impl KeyStore {
|
|||
self.owc.get(DEVELOPER_MODE).unwrap() != 0,
|
||||
"Either we have the most improbable chaff, or (more likely) the chaff is set to all 0's"
|
||||
);
|
||||
// check that "the flag" is erased in this mode by leaking the first few bytes
|
||||
#[cfg(feature = "hazardous-debug")]
|
||||
log::info!(
|
||||
"{}KEYSTORE.ERASEDFLAG,{},{:x?}",
|
||||
BOOKEND_START,
|
||||
BOOKEND_END,
|
||||
self.slot_mgr.read(&THE_FLAG_1).unwrap()[..4]
|
||||
);
|
||||
} else {
|
||||
log::info!("{}KEYSTORE.OKCHAFF,{}", BOOKEND_START, BOOKEND_END);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue