alnyan/yggdrasil: add Yggdrasil getrandom
This commit is contained in:
parent
f68a940b4d
commit
69a646b970
@ -23,6 +23,9 @@ libc = { version = "0.2.149", default-features = false }
|
|||||||
[target.'cfg(target_os = "wasi")'.dependencies]
|
[target.'cfg(target_os = "wasi")'.dependencies]
|
||||||
wasi = { version = "0.11", default-features = false }
|
wasi = { version = "0.11", default-features = false }
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "yggdrasil")'.dependencies]
|
||||||
|
yggdrasil-rt = { git = "https://git.alnyan.me/yggdrasil/yggdrasil-rt.git" }
|
||||||
|
|
||||||
[target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dependencies]
|
[target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dependencies]
|
||||||
wasm-bindgen = { version = "0.2.62", default-features = false, optional = true }
|
wasm-bindgen = { version = "0.2.62", default-features = false, optional = true }
|
||||||
js-sys = { version = "0.3", optional = true }
|
js-sys = { version = "0.3", optional = true }
|
||||||
|
@ -284,6 +284,8 @@ cfg_if! {
|
|||||||
} else if #[cfg(target_os = "hurd")] {
|
} else if #[cfg(target_os = "hurd")] {
|
||||||
mod util_libc;
|
mod util_libc;
|
||||||
#[path = "hurd.rs"] mod imp;
|
#[path = "hurd.rs"] mod imp;
|
||||||
|
} else if #[cfg(target_os = "yggdrasil")] {
|
||||||
|
#[path = "yggdrasil.rs"] mod imp;
|
||||||
} else if #[cfg(feature = "custom")] {
|
} else if #[cfg(feature = "custom")] {
|
||||||
use custom as imp;
|
use custom as imp;
|
||||||
} else if #[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"),
|
} else if #[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"),
|
||||||
|
7
src/yggdrasil.rs
Normal file
7
src/yggdrasil.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
use core::mem::MaybeUninit;
|
||||||
|
|
||||||
|
use crate::Error;
|
||||||
|
|
||||||
|
pub(crate) fn getrandom_inner(buffer: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
|
||||||
|
Ok(unsafe { yggdrasil_rt::sys::get_random(crate::util::slice_assume_init_mut(buffer)) })
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user