diff options
Diffstat (limited to 'src/crypto/rand.rs')
| -rw-r--r-- | src/crypto/rand.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/crypto/rand.rs b/src/crypto/rand.rs index 9db87fcd..dffddee7 100644 --- a/src/crypto/rand.rs +++ b/src/crypto/rand.rs @@ -1,15 +1,11 @@ use libc::c_int; - -#[link(name = "crypto")] -extern { - fn RAND_bytes(buf: *mut u8, num: c_int) -> c_int; -} +use ffi; pub fn rand_bytes(len: uint) -> Vec<u8> { unsafe { let mut out = Vec::with_capacity(len); - let r = RAND_bytes(out.as_mut_ptr(), len as c_int); + let r = ffi::RAND_bytes(out.as_mut_ptr(), len as c_int); if r != 1 as c_int { fail!() } out.set_len(len); |