add sampling countermeasures to the kernel

this evolves the TRNG state further after reporting any raw samples
for QC to make it harder to reason about the TRNG state after QC.
This commit is contained in:
bunnie 2024-06-13 15:41:30 +08:00
parent ed2b5ec84d
commit a5322eaa7a

View file

@ -102,3 +102,13 @@ pub fn get_u32() -> u32 {
LOCAL_RNG_STATE_MSB.store((next_state >> 32) as u32, Ordering::SeqCst);
ret_val
}
pub fn get_raw_u32() -> u32 {
unsafe {
TRNG_KERNEL
.as_mut()
.expect("TRNG_KERNEL driver not initialized")
.get_u32()
.expect("Error in random number generation")
}
}