Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/arch/aarch64/kernel/processor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use core::arch::asm;
use core::{fmt, mem};

use aarch64_cpu::asm::random::ArmRng;
use aarch64_cpu::registers::*;
use hermit_sync::{Lazy, OnceCell, without_interrupts};

Expand Down Expand Up @@ -196,8 +197,16 @@ impl fmt::Display for CpuFrequency {
}
}

static RNG: Lazy<Option<ArmRng>> = Lazy::new(ArmRng::new);

pub fn seed_entropy() -> Option<[u8; 32]> {
None
let rng = RNG.as_ref()?;
let mut buf = [0u8; 32];
for word in buf.chunks_mut(8) {
let value = rng.rndr().or(None).unwrap().to_ne_bytes();
word.copy_from_slice(&value);
}
Some(buf)
}

/// The halt function stops the processor until the next interrupt arrives
Expand Down
Loading