mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
reduce leakage during hazardous-debug
in theory, no production images should be signed that have this feature enabled. But, reducing the amount of leakage just in case an accident happens and this flag is somehow slipped into a signed production image.
This commit is contained in:
parent
0723306085
commit
ad116b5af6
1 changed files with 11 additions and 3 deletions
|
|
@ -173,7 +173,9 @@ impl KeyStore {
|
|||
}
|
||||
|
||||
#[cfg(feature = "hazardous-debug")]
|
||||
log::info!("chaff: {:x?}", chaff_xor);
|
||||
// leak only part of the chaff, see below comment about hedging against accidental signing of a debug
|
||||
// image
|
||||
log::info!("chaff: {:x?}", chaff_xor[..8]);
|
||||
ikm.extend_from_slice(&chaff_xor);
|
||||
assert!(ikm.len() == (nk_len + 1 + 1) * KEY_LEN); // sanity check that all keys were in fact added
|
||||
|
||||
|
|
@ -201,8 +203,14 @@ impl KeyStore {
|
|||
}
|
||||
|
||||
#[cfg(feature = "hazardous-debug")]
|
||||
for (i, chunk) in ikm.chunks(256).enumerate() {
|
||||
log::info!("ikm({:4}): {:x?}", i, chunk);
|
||||
for (i, chunk) in ikm.chunks(32).enumerate() {
|
||||
// subsample the keyspace - we're using hazardous-debug in CI to confirm correctness
|
||||
// of keys, which creates some risk that these images are abused in production (e.g. if
|
||||
// one is accidentally signed where this is on). Subsampling the keys reduces the risk
|
||||
// in case such an image gets out.
|
||||
if i % 8 == 0 {
|
||||
log::info!("ikm({:4}): {:x?}", i * 32, chunk);
|
||||
}
|
||||
}
|
||||
log::debug!("salt: {:x?}", salt); // not hazardous, these are public values
|
||||
let hk = Hkdf::<Sha256>::new(Some(&salt[..]), &ikm);
|
||||
|
|
|
|||
Loading…
Reference in a new issue