aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/crypto/rand.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openssl/src/crypto/rand.rs')
-rw-r--r--openssl/src/crypto/rand.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/openssl/src/crypto/rand.rs b/openssl/src/crypto/rand.rs
index 519449e9..c1c49e7b 100644
--- a/openssl/src/crypto/rand.rs
+++ b/openssl/src/crypto/rand.rs
@@ -1,13 +1,14 @@
use libc::c_int;
use ffi;
+
+use cvt;
use error::ErrorStack;
pub fn rand_bytes(buf: &mut [u8]) -> Result<(), ErrorStack> {
unsafe {
ffi::init();
assert!(buf.len() <= c_int::max_value() as usize);
- try_ssl_if!(ffi::RAND_bytes(buf.as_mut_ptr(), buf.len() as c_int) != 1);
- Ok(())
+ cvt(ffi::RAND_bytes(buf.as_mut_ptr(), buf.len() as c_int)).map(|_| ())
}
}