aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/rand.rs
diff options
context:
space:
mode:
authorValerii Hiora <[email protected]>2014-10-13 17:41:03 +0300
committerValerii Hiora <[email protected]>2014-10-14 08:31:42 +0300
commitdd46d1922e4706cf4c15c8cd915c1254363def8c (patch)
tree9be063d21a6ca4c90f20be1dd54d0dc3144b959f /src/crypto/rand.rs
parentMerge pull request #83 from jmesmon/set-cipher-list (diff)
downloadrust-openssl-dd46d1922e4706cf4c15c8cd915c1254363def8c.tar.xz
rust-openssl-dd46d1922e4706cf4c15c8cd915c1254363def8c.zip
Correct init mutexes and locking function
`libcrypto` uses locks quite intensively even without SSL. So they should be initialized before everything else to function properly in multi-threaded apps in which SSL operations are absent or delayed. Finishes #79
Diffstat (limited to 'src/crypto/rand.rs')
-rw-r--r--src/crypto/rand.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/crypto/rand.rs b/src/crypto/rand.rs
index dffddee7..5f94c93c 100644
--- a/src/crypto/rand.rs
+++ b/src/crypto/rand.rs
@@ -5,6 +5,7 @@ pub fn rand_bytes(len: uint) -> Vec<u8> {
unsafe {
let mut out = Vec::with_capacity(len);
+ ffi::init();
let r = ffi::RAND_bytes(out.as_mut_ptr(), len as c_int);
if r != 1 as c_int { fail!() }