mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
use die_no_std in hardening; remove excess prints
also fix some math regarding birthday paradoxes and the random number checking.
This commit is contained in:
parent
70f219ba0a
commit
4d86e8a82b
2 changed files with 4 additions and 5 deletions
|
|
@ -157,7 +157,7 @@ where
|
||||||
cgu.wo(sysctrl::SFR_IPCARIPFLOW, 0x32);
|
cgu.wo(sysctrl::SFR_IPCARIPFLOW, 0x32);
|
||||||
|
|
||||||
for _ in 0..4096 {
|
for _ in 0..4096 {
|
||||||
bao1x_api::bollard!(4);
|
bao1x_api::bollard!(crate::sigcheck::die_no_std, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
cgu.wo(
|
cgu.wo(
|
||||||
|
|
@ -189,7 +189,7 @@ where
|
||||||
cgu.wo(sysctrl::SFR_IPCARIPFLOW, 0x32);
|
cgu.wo(sysctrl::SFR_IPCARIPFLOW, 0x32);
|
||||||
|
|
||||||
for _ in 0..4096 {
|
for _ in 0..4096 {
|
||||||
bao1x_api::bollard!(4);
|
bao1x_api::bollard!(crate::sigcheck::die_no_std, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bao1x_api::bollard!(6);
|
bao1x_api::bollard!(6);
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ pub fn check_pll() {
|
||||||
pub fn die() -> ! {
|
pub fn die() -> ! {
|
||||||
let owc = OneWayCounter::new();
|
let owc = OneWayCounter::new();
|
||||||
// safety: this is safe because the offset is from a checked, pre-defined value
|
// safety: this is safe because the offset is from a checked, pre-defined value
|
||||||
crate::println_d!("die!die!die!die!");
|
|
||||||
unsafe {
|
unsafe {
|
||||||
owc.inc(POSSIBLE_ATTACKS).unwrap();
|
owc.inc(POSSIBLE_ATTACKS).unwrap();
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +94,7 @@ impl Csprng {
|
||||||
|
|
||||||
// do a quick health check on the TRNG before using it. Looks for repeated values over 8 samples.
|
// do a quick health check on the TRNG before using it. Looks for repeated values over 8 samples.
|
||||||
// this will rule out e.g. TRNG output tied to 0 or 1, or an external feed just feeding it repetitive
|
// this will rule out e.g. TRNG output tied to 0 or 1, or an external feed just feeding it repetitive
|
||||||
// data. About 1 in 500 million chance of triggering falsely if the TRNG is truly random.
|
// data. About 1 in 33 million chance of triggering falsely if the TRNG is truly random.
|
||||||
let mut values = [0u32; 8];
|
let mut values = [0u32; 8];
|
||||||
for value in values.iter_mut() {
|
for value in values.iter_mut() {
|
||||||
*value = ro_trng.get_raw();
|
*value = ro_trng.get_raw();
|
||||||
|
|
@ -236,7 +235,7 @@ pub fn reset_sensors() {
|
||||||
}
|
}
|
||||||
// wait for reset to propagate
|
// wait for reset to propagate
|
||||||
for _ in 0..100 {
|
for _ in 0..100 {
|
||||||
bao1x_api::bollard!(4);
|
bao1x_api::bollard!(die, 4);
|
||||||
}
|
}
|
||||||
// re-arm
|
// re-arm
|
||||||
bao1x_api::bollard!(die, 4);
|
bao1x_api::bollard!(die, 4);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue