diff options
Diffstat (limited to 'openssl/src/macros.rs')
-rw-r--r-- | openssl/src/macros.rs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/openssl/src/macros.rs b/openssl/src/macros.rs index 06e3c019..d1d35d27 100644 --- a/openssl/src/macros.rs +++ b/openssl/src/macros.rs @@ -3,10 +3,10 @@ macro_rules! private_key_from_pem { from_pem!($(#[$m])* $n, $t, $f); $(#[$m2])* - pub fn $n2(pem: &[u8], passphrase: &[u8]) -> Result<$t, ::error::ErrorStack> { + pub fn $n2(pem: &[u8], passphrase: &[u8]) -> Result<$t, crate::error::ErrorStack> { unsafe { ffi::init(); - let bio = ::bio::MemBioSlice::new(pem)?; + let bio = crate::bio::MemBioSlice::new(pem)?; let passphrase = ::std::ffi::CString::new(passphrase).unwrap(); cvt_p($f(bio.as_ptr(), ptr::null_mut(), @@ -17,16 +17,16 @@ macro_rules! private_key_from_pem { } $(#[$m3])* - pub fn $n3<F>(pem: &[u8], callback: F) -> Result<$t, ::error::ErrorStack> - where F: FnOnce(&mut [u8]) -> Result<usize, ::error::ErrorStack> + pub fn $n3<F>(pem: &[u8], callback: F) -> Result<$t, crate::error::ErrorStack> + where F: FnOnce(&mut [u8]) -> Result<usize, crate::error::ErrorStack> { unsafe { ffi::init(); - let mut cb = ::util::CallbackState::new(callback); - let bio = ::bio::MemBioSlice::new(pem)?; + let mut cb = crate::util::CallbackState::new(callback); + let bio = crate::bio::MemBioSlice::new(pem)?; cvt_p($f(bio.as_ptr(), ptr::null_mut(), - Some(::util::invoke_passwd_cb::<F>), + Some(crate::util::invoke_passwd_cb::<F>), &mut cb as *mut _ as *mut _)) .map(|p| ::foreign_types::ForeignType::from_ptr(p)) } @@ -37,9 +37,9 @@ macro_rules! private_key_from_pem { macro_rules! private_key_to_pem { ($(#[$m:meta])* $n:ident, $(#[$m2:meta])* $n2:ident, $f:path) => { $(#[$m])* - pub fn $n(&self) -> Result<Vec<u8>, ::error::ErrorStack> { + pub fn $n(&self) -> Result<Vec<u8>, crate::error::ErrorStack> { unsafe { - let bio = ::bio::MemBio::new()?; + let bio = crate::bio::MemBio::new()?; cvt($f(bio.as_ptr(), self.as_ptr(), ptr::null(), @@ -54,11 +54,11 @@ macro_rules! private_key_to_pem { $(#[$m2])* pub fn $n2( &self, - cipher: ::symm::Cipher, + cipher: crate::symm::Cipher, passphrase: &[u8] - ) -> Result<Vec<u8>, ::error::ErrorStack> { + ) -> Result<Vec<u8>, crate::error::ErrorStack> { unsafe { - let bio = ::bio::MemBio::new()?; + let bio = crate::bio::MemBio::new()?; assert!(passphrase.len() <= ::libc::c_int::max_value() as usize); cvt($f(bio.as_ptr(), self.as_ptr(), @@ -76,9 +76,9 @@ macro_rules! private_key_to_pem { macro_rules! to_pem { ($(#[$m:meta])* $n:ident, $f:path) => { $(#[$m])* - pub fn $n(&self) -> Result<Vec<u8>, ::error::ErrorStack> { + pub fn $n(&self) -> Result<Vec<u8>, crate::error::ErrorStack> { unsafe { - let bio = ::bio::MemBio::new()?; + let bio = crate::bio::MemBio::new()?; cvt($f(bio.as_ptr(), self.as_ptr()))?; Ok(bio.get_buf().to_owned()) } @@ -89,12 +89,12 @@ macro_rules! to_pem { macro_rules! to_der { ($(#[$m:meta])* $n:ident, $f:path) => { $(#[$m])* - pub fn $n(&self) -> Result<Vec<u8>, ::error::ErrorStack> { + pub fn $n(&self) -> Result<Vec<u8>, crate::error::ErrorStack> { unsafe { - let len = ::cvt($f(::foreign_types::ForeignTypeRef::as_ptr(self), + let len = crate::cvt($f(::foreign_types::ForeignTypeRef::as_ptr(self), ptr::null_mut()))?; let mut buf = vec![0; len as usize]; - ::cvt($f(::foreign_types::ForeignTypeRef::as_ptr(self), + crate::cvt($f(::foreign_types::ForeignTypeRef::as_ptr(self), &mut buf.as_mut_ptr()))?; Ok(buf) } @@ -105,11 +105,11 @@ macro_rules! to_der { macro_rules! from_der { ($(#[$m:meta])* $n:ident, $t:ty, $f:path) => { $(#[$m])* - pub fn $n(der: &[u8]) -> Result<$t, ::error::ErrorStack> { + pub fn $n(der: &[u8]) -> Result<$t, crate::error::ErrorStack> { unsafe { - ::ffi::init(); + ffi::init(); let len = ::std::cmp::min(der.len(), ::libc::c_long::max_value() as usize) as ::libc::c_long; - ::cvt_p($f(::std::ptr::null_mut(), &mut der.as_ptr(), len)) + crate::cvt_p($f(::std::ptr::null_mut(), &mut der.as_ptr(), len)) .map(|p| ::foreign_types::ForeignType::from_ptr(p)) } } @@ -119,10 +119,10 @@ macro_rules! from_der { macro_rules! from_pem { ($(#[$m:meta])* $n:ident, $t:ty, $f:path) => { $(#[$m])* - pub fn $n(pem: &[u8]) -> Result<$t, ::error::ErrorStack> { + pub fn $n(pem: &[u8]) -> Result<$t, crate::error::ErrorStack> { unsafe { - ::init(); - let bio = ::bio::MemBioSlice::new(pem)?; + crate::init(); + let bio = crate::bio::MemBioSlice::new(pem)?; cvt_p($f(bio.as_ptr(), ::std::ptr::null_mut(), None, ::std::ptr::null_mut())) .map(|p| ::foreign_types::ForeignType::from_ptr(p)) } |