Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
with:
targets: ${{ matrix.target }}
- name: Install multilib
run: sudo apt-get install gcc-multilib
run: sudo apt-get update && sudo apt-get install gcc-multilib
- uses: Swatinem/rust-cache@v2
- run: cargo test --target=${{ matrix.target }} --features=std

Expand Down
7 changes: 1 addition & 6 deletions src/emscripten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@
use crate::{util_libc::last_os_error, Error};
use core::mem::MaybeUninit;

// Not yet defined in libc crate.
extern "C" {
fn getentropy(buffer: *mut libc::c_void, length: usize) -> libc::c_int;
}

pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
// Emscripten 2.0.5 added getentropy, so we can use it unconditionally.
// Unlike other getentropy implementations, there is no max buffer length.
let ret = unsafe { getentropy(dest.as_mut_ptr() as *mut libc::c_void, dest.len()) };
let ret = unsafe { libc::getentropy(dest.as_mut_ptr() as *mut libc::c_void, dest.len()) };
if ret < 0 {
return Err(last_os_error());
}
Expand Down