pub struct RandomManager {
sources: Mutex<Vec<Arc<dyn EntropySource>>>,
pool: Mutex<VecDeque<u8>>,
}Expand description
Random number generator manager
This is the central component that manages entropy sources and provides random numbers to the rest of the kernel.
Fields§
§sources: Mutex<Vec<Arc<dyn EntropySource>>>Registered entropy sources
pool: Mutex<VecDeque<u8>>Internal random pool buffer
Implementations§
Source§impl RandomManager
impl RandomManager
Sourcefn instance() -> &'static RandomManager
fn instance() -> &'static RandomManager
Get the global RandomManager instance
Sourcepub fn register_entropy_source(source: Arc<dyn EntropySource>)
pub fn register_entropy_source(source: Arc<dyn EntropySource>)
Sourcefn fill_pool(&self) -> Result<usize, &'static str>
fn fill_pool(&self) -> Result<usize, &'static str>
Fill the internal pool with entropy from available sources
Sourcepub fn get_random_bytes(buffer: &mut [u8]) -> usize
pub fn get_random_bytes(buffer: &mut [u8]) -> usize
Sourcepub fn get_random_byte() -> Option<u8>
pub fn get_random_byte() -> Option<u8>
Read a single random byte