diff --git a/CHANGELOG.md b/CHANGELOG.md index 282f77f4787..4a09a5d463c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md). You may also find the [Update Guide](UPDATING.md) useful. +## [0.5.6] - 2019-01-25 +### Platforms +- Fuchsia: Replaced fuchsia-zircon with fuchsia-cprng + + ## [0.5.5] - 2018-08-07 ### Documentation - Fix links in documentation (#582) diff --git a/Cargo.toml b/Cargo.toml index de07f590418..3301ffaf571 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rand" -version = "0.5.5" # NB: When modifying, also modify html_root_url in lib.rs +version = "0.5.6" # NB: When modifying, also modify html_root_url in lib.rs authors = ["The Rust Project Developers"] license = "MIT/Apache-2.0" readme = "README.md" @@ -20,7 +20,7 @@ appveyor = { repository = "alexcrichton/rand" } [features] default = ["std" ] # without "std" rand uses libcore nightly = ["i128_support"] # enables all features requiring nightly rust -std = ["rand_core/std", "alloc", "libc", "winapi", "cloudabi", "fuchsia-zircon"] +std = ["rand_core/std", "alloc", "libc", "winapi", "cloudabi", "fuchsia-cprng"] alloc = ["rand_core/alloc"] # enables Vec and Box support (without std) i128_support = [] # enables i128 and u128 support serde1 = ["serde", "serde_derive", "rand_core/serde1"] # enables serialization for PRNGs @@ -44,7 +44,7 @@ winapi = { version = "0.3", features = ["minwindef", "ntsecapi", "profileapi", " cloudabi = { version = "0.0.3", optional = true } [target.'cfg(target_os = "fuchsia")'.dependencies] -fuchsia-zircon = { version = "0.3.2", optional = true } +fuchsia-cprng = { version = "0.1.0", optional = true } [target.wasm32-unknown-unknown.dependencies] # use with `--target wasm32-unknown-unknown --features=stdweb` diff --git a/src/lib.rs b/src/lib.rs index e1bd7905480..a1eb469a129 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -224,7 +224,7 @@ #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", html_favicon_url = "https://www.rust-lang.org/favicon.ico", - html_root_url = "https://docs.rs/rand/0.5.5")] + html_root_url = "https://docs.rs/rand/0.5.6")] #![deny(missing_docs)] #![deny(missing_debug_implementations)] diff --git a/src/rngs/os.rs b/src/rngs/os.rs index 7e1945bf581..ecc5f32166b 100644 --- a/src/rngs/os.rs +++ b/src/rngs/os.rs @@ -924,9 +924,9 @@ mod imp { #[cfg(target_os = "fuchsia")] mod imp { - extern crate fuchsia_zircon; + extern crate fuchsia_cprng; - use {Error, ErrorKind}; + use Error; use super::OsRngImpl; #[derive(Clone, Debug)] @@ -936,25 +936,10 @@ mod imp { fn new() -> Result { Ok(OsRng) } fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - let mut read = 0; - while read < dest.len() { - match fuchsia_zircon::cprng_draw(&mut dest[read..]) { - Ok(actual) => read += actual, - Err(e) => { - return Err(Error::with_cause( - ErrorKind::Unavailable, - "cprng_draw failed", - e.into_io_error())); - } - }; - } + fuchsia_cprng::cprng_draw(dest); Ok(()) } - fn max_chunk_size(&self) -> usize { - fuchsia_zircon::sys::ZX_CPRNG_DRAW_MAX_LEN - } - fn method_str(&self) -> &'static str { "cprng_draw" } } }