Sha256: 5beb52344a9b71c75426bbc56eb989f5fcb81642772737d52e92578b315615a1
Contents?: true
Size: 632 Bytes
Versions: 8
Compression:
Stored size: 632 Bytes
Contents
//! Implementation using getentropy(2) //! //! Available since: //! - macOS 10.12 //! - OpenBSD 5.6 //! - Emscripten 2.0.5 //! - vita newlib since Dec 2021 //! //! For these targets, we use getentropy(2) because getrandom(2) doesn't exist. use crate::{util_libc::last_os_error, Error}; use core::mem::MaybeUninit; pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> { for chunk in dest.chunks_mut(256) { let ret = unsafe { libc::getentropy(chunk.as_mut_ptr() as *mut libc::c_void, chunk.len()) }; if ret != 0 { return Err(last_os_error()); } } Ok(()) }
Version data entries
8 entries across 8 versions & 1 rubygems