Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/getrandom/src/solid.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / getrandom / src / solid.rs` 18 lines ยท 625 bytes Raw Blame History 1 //! Implementation for SOLID 2 use crate::Error; 3 use core::{mem::MaybeUninit, num::NonZeroU32}; 4 5 extern "C" { 6 pub fn SOLID_RNG_SampleRandomBytes(buffer: *mut u8, length: usize) -> i32; 7 } 8 9 pub fn getrandom_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { 10 let ret = unsafe { SOLID_RNG_SampleRandomBytes(dest.as_mut_ptr() as *mut u8, dest.len()) }; 11 if ret >= 0 { 12 Ok(()) 13 } else { 14 // ITRON error numbers are always negative, so we negate it so that it 15 // falls in the dedicated OS error range (1..INTERNAL_START). 16 Err(NonZeroU32::new((-ret) as u32).unwrap().into()) 17 } 18 }