diff options
| author | Steven Fackler <[email protected]> | 2014-10-13 23:19:14 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2014-10-13 23:19:14 -0700 |
| commit | 60dce4c2190ecb935044152c02f4362d76a381e2 (patch) | |
| tree | 9be063d21a6ca4c90f20be1dd54d0dc3144b959f /src/bn | |
| parent | Merge pull request #83 from jmesmon/set-cipher-list (diff) | |
| parent | Correct init mutexes and locking function (diff) | |
| download | rust-openssl-60dce4c2190ecb935044152c02f4362d76a381e2.tar.xz rust-openssl-60dce4c2190ecb935044152c02f4362d76a381e2.zip | |
Merge pull request #81 from vhbit/lock-init
Correct init mutexes and locking function
Diffstat (limited to 'src/bn')
| -rw-r--r-- | src/bn/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bn/mod.rs b/src/bn/mod.rs index 129f6b90..510c9269 100644 --- a/src/bn/mod.rs +++ b/src/bn/mod.rs @@ -79,8 +79,10 @@ macro_rules! with_bn_in_ctx( ) impl BigNum { + // FIXME: squash 3 constructors into one pub fn new() -> Result<BigNum, SslError> { unsafe { + ffi::init(); let v = ffi::BN_new(); if v.is_null() { Err(SslError::get()) @@ -92,6 +94,7 @@ impl BigNum { pub fn new_from(n: u64) -> Result<BigNum, SslError> { unsafe { + ffi::init(); let bn = ffi::BN_new(); if bn.is_null() || ffi::BN_set_word(bn, n as c_ulong) == 0 { Err(SslError::get()) @@ -103,6 +106,7 @@ impl BigNum { pub fn new_from_slice(n: &[u8]) -> Result<BigNum, SslError> { unsafe { + ffi::init(); let bn = ffi::BN_new(); if bn.is_null() || ffi::BN_bin2bn(n.as_ptr(), n.len() as c_int, bn).is_null() { Err(SslError::get()) |