diff options
| author | Steven Fackler <[email protected]> | 2017-07-30 13:23:19 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2017-07-30 13:23:19 -0700 |
| commit | d1a42598d7ded3a2242f3c6b007108633823eb9e (patch) | |
| tree | d21bd8870bc33feab3970fbe9125a8e85eb54879 /openssl/src | |
| parent | Delete old script (diff) | |
| download | rust-openssl-d1a42598d7ded3a2242f3c6b007108633823eb9e.tar.xz rust-openssl-d1a42598d7ded3a2242f3c6b007108633823eb9e.zip | |
Init in Dh constructors
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/dh.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/openssl/src/dh.rs b/openssl/src/dh.rs index a98de0f4..09d286f9 100644 --- a/openssl/src/dh.rs +++ b/openssl/src/dh.rs @@ -24,7 +24,6 @@ impl DhRef { impl Dh { pub fn from_params(p: BigNum, g: BigNum, q: BigNum) -> Result<Dh, ErrorStack> { unsafe { - init(); let dh = Dh(try!(cvt_p(ffi::DH_new()))); try!(cvt(compat::DH_set0_pqg( dh.0, @@ -43,19 +42,28 @@ impl Dh { /// Requires the `v102` or `v110` features and OpenSSL 1.0.2 or OpenSSL 1.1.0. #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))] pub fn get_1024_160() -> Result<Dh, ErrorStack> { - unsafe { cvt_p(ffi::DH_get_1024_160()).map(Dh) } + unsafe { + init(); + cvt_p(ffi::DH_get_1024_160()).map(Dh) + } } /// Requires the `v102` or `v110` features and OpenSSL 1.0.2 or OpenSSL 1.1.0. #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))] pub fn get_2048_224() -> Result<Dh, ErrorStack> { - unsafe { cvt_p(ffi::DH_get_2048_224()).map(Dh) } + unsafe { + init(); + cvt_p(ffi::DH_get_2048_224()).map(Dh) + } } /// Requires the `v102` or `v110` features and OpenSSL 1.0.2 or OpenSSL 1.1.0. #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))] pub fn get_2048_256() -> Result<Dh, ErrorStack> { - unsafe { cvt_p(ffi::DH_get_2048_256()).map(Dh) } + unsafe { + init(); + cvt_p(ffi::DH_get_2048_256()).map(Dh) + } } } |