ableos_userland/drivers/randomness_handler/src/main.rs

30 lines
732 B
Rust
Raw Normal View History

2022-12-05 03:34:40 -06:00
#![no_std]
#![no_main]
2022-12-05 09:26:26 -06:00
use cryptography::random::Csprng;
2022-12-05 03:34:40 -06:00
use versioning::Version;
pub const VERSION: Version = Version::new(0, 1, 0);
#[no_mangle]
fn start() {
let mut inner_rng = Csprng::new();
inner_rng.mix_in_data(&[8, 9, 10, 23, 2, 3]);
2022-12-05 04:04:54 -06:00
// Request PCI IDS and mixin
let pci_id_data = [8, 12];
inner_rng.mix_in_data(&pci_id_data);
let rand_bytes = inner_rng.get_random_u128().unwrap();
inner_rng.mix_in_data(&rand_bytes.to_le_bytes());
// Loop driver forever
loop {
// Request Mouse XY
let mouse_x_y = [12, 12];
inner_rng.mix_in_data(&mouse_x_y);
// Request the last keypress
let key_press = [7];
inner_rng.mix_in_data(&key_press);
}
2022-12-05 03:34:40 -06:00
}