diff options
| author | Valerii Hiora <[email protected]> | 2014-09-28 08:15:51 +0300 |
|---|---|---|
| committer | Valerii Hiora <[email protected]> | 2014-09-30 08:21:31 +0300 |
| commit | 02637ec7d451c38792c42c5c2cb4d59505e13ced (patch) | |
| tree | 12a842f098c7cdbea5190097647666d34eabc093 /src/crypto/rand.rs | |
| parent | Merge pull request #53 from vhbit/cert-gen (diff) | |
| download | rust-openssl-02637ec7d451c38792c42c5c2cb4d59505e13ced.tar.xz rust-openssl-02637ec7d451c38792c42c5c2cb4d59505e13ced.zip | |
single `ffi` module
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); |