Update zx_cprng_draw_new on Fuchsia
Fuchsia is changing the semantics for zx_cprng_draw and zx_cprng_draw_new is a temporary name for the new semantics.
This commit is contained in:
@@ -183,15 +183,14 @@ mod imp {
|
|||||||
mod imp {
|
mod imp {
|
||||||
#[link(name = "zircon")]
|
#[link(name = "zircon")]
|
||||||
extern {
|
extern {
|
||||||
fn zx_cprng_draw(buffer: *mut u8, len: usize, actual: *mut usize) -> i32;
|
fn zx_cprng_draw_new(buffer: *mut u8, len: usize) -> i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getrandom(buf: &mut [u8]) -> Result<usize, i32> {
|
fn getrandom(buf: &mut [u8]) -> Result<usize, i32> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut actual = 0;
|
let status = zx_cprng_draw_new(buf.as_mut_ptr(), buf.len());
|
||||||
let status = zx_cprng_draw(buf.as_mut_ptr(), buf.len(), &mut actual);
|
|
||||||
if status == 0 {
|
if status == 0 {
|
||||||
Ok(actual)
|
Ok(buf.len())
|
||||||
} else {
|
} else {
|
||||||
Err(status)
|
Err(status)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user