aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/dh.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-10-31 19:56:03 -0700
committerSteven Fackler <[email protected]>2016-10-31 20:02:24 -0700
commit28f375974a21342f3ae4c39f0a4df17570d89e69 (patch)
tree0bda00db8d534ccb0fc5f0f97c7ef552ddd3f4e4 /openssl/src/dh.rs
parentConvert Asn1Time (diff)
downloadrust-openssl-28f375974a21342f3ae4c39f0a4df17570d89e69.tar.xz
rust-openssl-28f375974a21342f3ae4c39f0a4df17570d89e69.zip
Convert Dh
Diffstat (limited to 'openssl/src/dh.rs')
-rw-r--r--openssl/src/dh.rs31
1 files changed, 2 insertions, 29 deletions
diff --git a/openssl/src/dh.rs b/openssl/src/dh.rs
index 5c5ea05e..4ae145d6 100644
--- a/openssl/src/dh.rs
+++ b/openssl/src/dh.rs
@@ -3,25 +3,12 @@ use error::ErrorStack;
use bio::MemBioSlice;
use std::ptr;
use std::mem;
-use std::ops::Deref;
use {cvt, cvt_p};
use bn::BigNum;
-use opaque::Opaque;
+use types::OpenSslType;
-pub struct DhRef(Opaque);
-
-impl DhRef {
- pub unsafe fn from_ptr<'a>(ptr: *mut ffi::DH) -> &'a DhRef {
- &*(ptr as *mut _)
- }
-
- pub fn as_ptr(&self) -> *mut ffi::DH {
- self as *const _ as *mut _
- }
-}
-
-pub struct Dh(*mut ffi::DH);
+type_!(Dh, ffi::DH, ffi::DH_free);
impl Dh {
pub fn from_params(p: BigNum, g: BigNum, q: BigNum) -> Result<Dh, ErrorStack> {
@@ -63,20 +50,6 @@ impl Dh {
}
}
-impl Drop for Dh {
- fn drop(&mut self) {
- unsafe { ffi::DH_free(self.0) }
- }
-}
-
-impl Deref for Dh {
- type Target = DhRef;
-
- fn deref(&self) -> &DhRef {
- unsafe { DhRef::from_ptr(self.0) }
- }
-}
-
#[cfg(ossl110)]
mod compat {
pub use ffi::DH_set0_pqg;