replace fuchsia-zircon with fuchsia-cprng in rand-0.4
As in #706, fuchsia is replacing users of fuchsia-zircon with
fuchsia-cprng since that reduces exposure to our changing syscalls.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0015204..aa4c293 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## [0.4.5] - 2019-01-25
+### Platforms
+- Fuchsia: Replaced fuchsia-zircon with fuchsia-cprng
+
## [0.4.4] - 2019-01-06
### Added
- SGX support
diff --git a/Cargo.toml b/Cargo.toml
index 82ab1f0..84c2643 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rand"
-version = "0.4.5"
+version = "0.4.6"
authors = ["The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
@@ -32,7 +32,7 @@
members = ["rand-derive"]
[target.'cfg(target_os = "fuchsia")'.dependencies]
-fuchsia-zircon = "0.3.2"
+fuchsia-cprng = "0.1.0"
[target.'cfg(target_env = "sgx")'.dependencies]
rdrand = "0.4.0"
diff --git a/src/os.rs b/src/os.rs
index 0be8713..c33a8cb 100644
--- a/src/os.rs
+++ b/src/os.rs
@@ -389,7 +389,7 @@
#[cfg(target_os = "fuchsia")]
mod imp {
- extern crate fuchsia_zircon;
+ extern crate fuchsia_cprng;
use std::io;
use Rng;
@@ -413,15 +413,7 @@
next_u64(&mut |v| self.fill_bytes(v))
}
fn fill_bytes(&mut self, v: &mut [u8]) {
- for s in v.chunks_mut(fuchsia_zircon::sys::ZX_CPRNG_DRAW_MAX_LEN) {
- let mut filled = 0;
- while filled < s.len() {
- match fuchsia_zircon::cprng_draw(&mut s[filled..]) {
- Ok(actual) => filled += actual,
- Err(e) => panic!("cprng_draw failed: {:?}", e),
- };
- }
- }
+ fuchsia_cprng::cprng_draw(v);
}
}
}