diff options
Diffstat (limited to 'openssl/src/dh')
| -rw-r--r-- | openssl/src/dh/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/openssl/src/dh/mod.rs b/openssl/src/dh/mod.rs index d2f26c3f..14bf076d 100644 --- a/openssl/src/dh/mod.rs +++ b/openssl/src/dh/mod.rs @@ -1,7 +1,7 @@ use ffi; use std::io; use std::io::prelude::*; -use ssl::error::{SslError, StreamError}; +use error::ErrorStack; use bio::MemBio; use bn::BigNum; use std::mem; @@ -10,7 +10,7 @@ use std::ptr; pub struct DH(*mut ffi::DH); impl DH { - pub fn from_params(p: BigNum, g: BigNum, q: BigNum) -> Result<DH, SslError> { + pub fn from_params(p: BigNum, g: BigNum, q: BigNum) -> Result<DH, ErrorStack> { let dh = try_ssl_null!(unsafe { ffi::DH_new_from_params(p.raw(), g.raw(), q.raw()) }); mem::forget(p); mem::forget(g); @@ -18,11 +18,11 @@ impl DH { Ok(DH(dh)) } - pub fn from_pem<R>(reader: &mut R) -> Result<DH, SslError> + pub fn from_pem<R>(reader: &mut R) -> io::Result<DH> where R: Read { let mut mem_bio = try!(MemBio::new()); - try!(io::copy(reader, &mut mem_bio).map_err(StreamError)); + try!(io::copy(reader, &mut mem_bio)); let dh = unsafe { ffi::PEM_read_bio_DHparams(mem_bio.get_handle(), ptr::null_mut(), None, ptr::null_mut()) }; @@ -31,19 +31,19 @@ impl DH { } #[cfg(feature = "rfc5114")] - pub fn get_1024_160() -> Result<DH, SslError> { + pub fn get_1024_160() -> Result<DH, ErrorStack> { let dh = try_ssl_null!(unsafe { ffi::DH_get_1024_160() }); Ok(DH(dh)) } #[cfg(feature = "rfc5114")] - pub fn get_2048_224() -> Result<DH, SslError> { + pub fn get_2048_224() -> Result<DH, ErrorStack> { let dh = try_ssl_null!(unsafe { ffi::DH_get_2048_224() }); Ok(DH(dh)) } #[cfg(feature = "rfc5114")] - pub fn get_2048_256() -> Result<DH, SslError> { + pub fn get_2048_256() -> Result<DH, ErrorStack> { let dh = try_ssl_null!(unsafe { ffi::DH_get_2048_256() }); Ok(DH(dh)) } |