⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

try_hardware_rng

Function try_hardware_rng 

Source
pub fn try_hardware_rng(dest: &mut [u8; 32]) -> bool
Expand description

Attempt to read 32 bytes from a hardware random number generator.

Returns true if the hardware RNG was available and dest was filled, false if hardware RNG is unavailable (in which case dest is unmodified).

  • x86_64: Uses RDRAND instruction with retry logic. Falls back to false if the CPU does not support RDRAND (checked via CPUID).
  • AArch64/RISC-V: No dedicated hardware RNG; always returns false.