Skip to content

Commit 94fe812

Browse files
committed
Remove fuchsia-cprng dependancy
Also, reenable fuchsia building
1 parent 9fb38dd commit 94fe812

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ matrix:
113113
- cargo build --target=x86_64-sun-solaris --all-features
114114
- cargo build --target=x86_64-unknown-cloudabi --all-features
115115
- cargo build --target=x86_64-unknown-freebsd --all-features
116-
#- cargo build --target=x86_64-unknown-fuchsia --all-features
116+
- cargo build --target=x86_64-fuchsia --all-features
117117
- cargo build --target=x86_64-unknown-netbsd --all-features
118118
- cargo build --target=x86_64-unknown-redox --all-features
119119
- cargo build --target=x86_64-fortanix-unknown-sgx --all-features
@@ -123,7 +123,7 @@ matrix:
123123
- cargo build --target=x86_64-sun-solaris --all-features
124124
- cargo build --target=x86_64-unknown-cloudabi --all-features
125125
- cargo build --target=x86_64-unknown-freebsd --all-features
126-
#- cargo build --target=x86_64-unknown-fuchsia --all-features
126+
- cargo build --target=x86_64-fuchsia --all-features
127127
- cargo build --target=x86_64-unknown-netbsd --all-features
128128
- cargo build --target=x86_64-unknown-redox --all-features
129129
- cargo build --target=x86_64-fortanix-unknown-sgx --all-features

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ libc = "0.2.54"
2424
[target.'cfg(unix)'.dependencies]
2525
lazy_static = "1.3.0"
2626

27-
[target.'cfg(fuchsia)'.dependencies]
28-
fuchsia-cprng = "0.1"
29-
3027
[target.'cfg(target_os = "redox")'.dependencies]
3128
lazy_static = "1.3.0"
3229

src/fuchsia.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
use crate::Error;
1111
use core::num::NonZeroU32;
1212

13+
#[link(name = "zircon")]
14+
extern "C" {
15+
fn zx_cprng_draw(buffer: *mut u8, length: usize);
16+
}
17+
1318
pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
14-
fuchsia_cprng::cprng_draw(dest);
19+
unsafe { zx_cprng_draw(dest.as_mut_ptr(), dest.len()) }
1520
Ok(())
1621
}
1722

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
//! [8]: https://leaf.dragonflybsd.org/cgi/web-man?command=random&section=4
108108
//! [9]: https://docs.oracle.com/cd/E88353_01/html/E37841/getrandom-2.html
109109
//! [10]: https://docs.oracle.com/cd/E86824_01/html/E54777/random-7d.html
110-
//! [11]: https://fuchsia.googlesource.com/zircon/+/HEAD/docs/syscalls/cprng_draw.md
110+
//! [11]: https://fuchsia.googlesource.com/fuchsia/+/master/zircon/docs/syscalls/cprng_draw.md
111111
//! [12]: https://github.com/redox-os/randd/blob/master/src/main.rs
112112
//! [13]: https://github.com/nuxinl/cloudabi#random_get
113113
//! [14]: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues

0 commit comments

Comments
 (0)