diff options
author | Jonas Platte <jplatte+git@posteo.de> | 2020-12-31 19:56:30 +0100 |
---|---|---|
committer | Jonas Platte <jplatte+git@posteo.de> | 2021-01-01 04:11:43 +0100 |
commit | 3d2ac91667be6fcb36961de3a9744ebb2914f044 (patch) | |
tree | a9ab8f1a1bdf3b408621e6dce386cc255fe3e82e | |
parent | d68077d2d581fd11b19ae433703dd0106f5aa0c7 (diff) | |
download | rust-openssl-3d2ac91667be6fcb36961de3a9744ebb2914f044.zip |
Use crate in imports in the openssl crate
This was mostly automated using `cargo fix --edition`, except imports of
openssl_sys (renamed to ffi) were converted to crate::ffi, which was
reverted.
The same thing is not done for the openssl-sys crate because this breaks
ctest (used in systest to verify the -sys crate), see
https://github.com/gnzlbg/ctest/issues/70
44 files changed, 314 insertions, 312 deletions
diff --git a/openssl/src/aes.rs b/openssl/src/aes.rs index 2cda15b0..e4a626bd 100644 --- a/openssl/src/aes.rs +++ b/openssl/src/aes.rs @@ -59,7 +59,7 @@ use ffi; use libc::{c_int, c_uint}; use std::{mem, ptr}; -use symm::Mode; +use crate::symm::Mode; /// Provides Error handling for parsing keys. #[derive(Debug)] @@ -240,7 +240,7 @@ mod test { use hex::FromHex; use super::*; - use symm::Mode; + use crate::symm::Mode; // From https://www.mgp25.com/AESIGE/ #[test] diff --git a/openssl/src/asn1.rs b/openssl/src/asn1.rs index abf937e2..69f2026a 100644 --- a/openssl/src/asn1.rs +++ b/openssl/src/asn1.rs @@ -35,12 +35,12 @@ use std::ptr; use std::slice; use std::str; -use bio::MemBio; -use bn::{BigNum, BigNumRef}; -use error::ErrorStack; -use nid::Nid; -use string::OpensslString; -use {cvt, cvt_p}; +use crate::bio::MemBio; +use crate::bn::{BigNum, BigNumRef}; +use crate::error::ErrorStack; +use crate::nid::Nid; +use crate::string::OpensslString; +use crate::{cvt, cvt_p}; foreign_type_and_impl_send_sync! { type CType = ffi::ASN1_GENERALIZEDTIME; @@ -526,7 +526,7 @@ impl Asn1IntegerRef { #[allow(missing_docs)] #[deprecated(since = "0.10.6", note = "use to_bn instead")] pub fn get(&self) -> i64 { - unsafe { ::ffi::ASN1_INTEGER_get(self.as_ptr()) as i64 } + unsafe { ffi::ASN1_INTEGER_get(self.as_ptr()) as i64 } } /// Converts the integer to a `BigNum`. @@ -536,7 +536,7 @@ impl Asn1IntegerRef { /// [`ASN1_INTEGER_to_BN`]: https://www.openssl.org/docs/man1.1.0/crypto/ASN1_INTEGER_get.html pub fn to_bn(&self) -> Result<BigNum, ErrorStack> { unsafe { - cvt_p(::ffi::ASN1_INTEGER_to_BN(self.as_ptr(), ptr::null_mut())) + cvt_p(ffi::ASN1_INTEGER_to_BN(self.as_ptr(), ptr::null_mut())) .map(|p| BigNum::from_ptr(p)) } } @@ -549,7 +549,7 @@ impl Asn1IntegerRef { /// [`bn`]: ../bn/struct.BigNumRef.html#method.to_asn1_integer /// [`ASN1_INTEGER_set`]: https://www.openssl.org/docs/man1.1.0/crypto/ASN1_INTEGER_set.html pub fn set(&mut self, value: i32) -> Result<(), ErrorStack> { - unsafe { cvt(::ffi::ASN1_INTEGER_set(self.as_ptr(), value as c_long)).map(|_| ()) } + unsafe { cvt(ffi::ASN1_INTEGER_set(self.as_ptr(), value as c_long)).map(|_| ()) } } } @@ -674,8 +674,8 @@ cfg_if! { mod tests { use super::*; - use bn::BigNum; - use nid::Nid; + use crate::bn::BigNum; + use crate::nid::Nid; /// Tests conversion between BigNum and Asn1Integer. #[test] diff --git a/openssl/src/base64.rs b/openssl/src/base64.rs index 072df6b2..818163a2 100644 --- a/openssl/src/base64.rs +++ b/openssl/src/base64.rs @@ -1,6 +1,6 @@ //! Base64 encoding support. -use cvt_n; -use error::ErrorStack; +use crate::cvt_n; +use crate::error::ErrorStack; use ffi; use libc::c_int; diff --git a/openssl/src/bio.rs b/openssl/src/bio.rs index 4c2f1ff2..c4cbd44d 100644 --- a/openssl/src/bio.rs +++ b/openssl/src/bio.rs @@ -4,8 +4,8 @@ use std::marker::PhantomData; use std::ptr; use std::slice; -use cvt_p; -use error::ErrorStack; +use crate::cvt_p; +use crate::error::ErrorStack; pub struct MemBioSlice<'a>(*mut ffi::BIO, PhantomData<&'a [u8]>); diff --git a/openssl/src/bn.rs b/openssl/src/bn.rs index abb5397e..4371e741 100644 --- a/openssl/src/bn.rs +++ b/openssl/src/bn.rs @@ -30,10 +30,10 @@ use std::ffi::CString; use std::ops::{Add, Deref, Div, Mul, Neg, Rem, Shl, Shr, Sub}; use std::{fmt, ptr}; -use asn1::Asn1Integer; -use error::ErrorStack; -use string::OpensslString; -use {cvt, cvt_n, cvt_p}; +use crate::asn1::Asn1Integer; +use crate::error::ErrorStack; +use crate::string::OpensslString; +use crate::{cvt, cvt_n, cvt_p}; cfg_if! { if #[cfg(ossl110)] { @@ -1376,7 +1376,7 @@ impl Neg for BigNum { #[cfg(test)] mod tests { - use bn::{BigNum, BigNumContext}; + use crate::bn::{BigNum, BigNumContext}; #[test] fn test_to_from_slice() { diff --git a/openssl/src/cms.rs b/openssl/src/cms.rs index 8c5efd64..154fcbf0 100644 --- a/openssl/src/cms.rs +++ b/openssl/src/cms.rs @@ -9,14 +9,14 @@ use ffi; use foreign_types::{ForeignType, ForeignTypeRef}; use std::ptr; -use bio::{MemBio, MemBioSlice}; -use error::ErrorStack; +use crate::bio::{MemBio, MemBioSlice}; +use crate::error::ErrorStack; +use crate::pkey::{HasPrivate, PKeyRef}; +use crate::stack::StackRef; +use crate::symm::Cipher; +use crate::x509::{X509Ref, X509}; +use crate::{cvt, cvt_p}; use libc::c_uint; -use pkey::{HasPrivate, PKeyRef}; -use stack::StackRef; -use symm::Cipher; -use x509::{X509Ref, X509}; -use {cvt, cvt_p}; bitflags! { pub struct CMSOptions : c_uint { @@ -224,9 +224,9 @@ impl CmsContentInfo { #[cfg(test)] mod test { use super::*; - use pkcs12::Pkcs12; - use stack::Stack; - use x509::X509; + use crate::pkcs12::Pkcs12; + use crate::stack::Stack; + use crate::x509::X509; #[test] fn cms_encrypt_decrypt() { diff --git a/openssl/src/conf.rs b/openssl/src/conf.rs index 43ff3530..9eb6977a 100644 --- a/openssl/src/conf.rs +++ b/openssl/src/conf.rs @@ -1,8 +1,8 @@ //! Interface for processing OpenSSL configuration files. use ffi; -use cvt_p; -use error::ErrorStack; +use crate::cvt_p; +use crate::error::ErrorStack; pub struct ConfMethod(*mut ffi::CONF_METHOD); diff --git a/openssl/src/derive.rs b/openssl/src/derive.rs index 6c517553..3bd48f3f 100644 --- a/openssl/src/derive.rs +++ b/openssl/src/derive.rs @@ -4,9 +4,9 @@ use foreign_types::ForeignTypeRef; use std::marker::PhantomData; use std::ptr; -use error::ErrorStack; -use pkey::{HasPrivate, HasPublic, PKeyRef}; -use {cvt, cvt_p}; +use crate::error::ErrorStack; +use crate::pkey::{HasPrivate, HasPublic, PKeyRef}; +use crate::{cvt, cvt_p}; /// A type used to derive a shared secret between two keys. pub struct Deriver<'a>(*mut ffi::EVP_PKEY_CTX, PhantomData<&'a ()>); @@ -97,9 +97,9 @@ impl<'a> Deriver<'a> { mod test { use super::*; - use ec::{EcGroup, EcKey}; - use nid::Nid; - use pkey::PKey; + use crate::ec::{EcGroup, EcKey}; + use crate::nid::Nid; + use crate::pkey::PKey; #[test] fn derive_without_peer() { diff --git a/openssl/src/dh.rs b/openssl/src/dh.rs index 111795d5..11ea99f8 100644 --- a/openssl/src/dh.rs +++ b/openssl/src/dh.rs @@ -1,12 +1,12 @@ -use error::ErrorStack; +use crate::error::ErrorStack; use ffi; use foreign_types::{ForeignType, ForeignTypeRef}; use std::mem; use std::ptr; -use bn::{BigNum, BigNumRef}; -use pkey::{HasParams, HasPrivate, HasPublic, Params, Private}; -use {cvt, cvt_p}; +use crate::bn::{BigNum, BigNumRef}; +use crate::pkey::{HasParams, HasPrivate, HasPublic, Params, Private}; +use crate::{cvt, cvt_p}; generic_foreign_type_and_impl_send_sync! { type CType = ffi::DH; @@ -297,9 +297,9 @@ cfg_if! { #[cfg(test)] mod tests { - use bn::BigNum; - use dh::Dh; - use ssl::{SslContext, SslMethod}; + use crate::bn::BigNum; + use crate::dh::Dh; + use crate::ssl::{SslContext, SslMethod}; #[test] #[cfg(ossl102)] diff --git a/openssl/src/dsa.rs b/openssl/src/dsa.rs index 172cffed..c58c6486 100644 --- a/openssl/src/dsa.rs +++ b/openssl/src/dsa.rs @@ -12,11 +12,11 @@ use std::fmt; use std::mem; use std::ptr; -use bn::{BigNum, BigNumRef}; -use error::ErrorStack; -use pkey::{HasParams, HasPrivate, HasPublic, Private, Public}; -use util::ForeignTypeRefExt; -use {cvt, cvt_p}; +use crate::bn::{BigNum, BigNumRef}; +use crate::error::ErrorStack; +use crate::pkey::{HasParams, HasPrivate, HasPublic, Private, Public}; +use crate::util::ForeignTypeRefExt; +use crate::{cvt, cvt_p}; generic_foreign_type_and_impl_send_sync! { type CType = ffi::DSA; @@ -358,10 +358,10 @@ cfg_if! { #[cfg(test)] mod test { use super::*; - use bn::BigNumContext; - use hash::MessageDigest; - use pkey::PKey; - use sign::{Signer, Verifier}; + use crate::bn::BigNumContext; + use crate::hash::MessageDigest; + use crate::pkey::PKey; + use crate::sign::{Signer, Verifier}; #[test] pub fn test_generate() { diff --git a/openssl/src/ec.rs b/openssl/src/ec.rs index 379b3647..f43c8d3d 100644 --- a/openssl/src/ec.rs +++ b/openssl/src/ec.rs @@ -21,12 +21,12 @@ use libc::c_int; use std::fmt; use std::ptr; -use bn::{BigNumContextRef, BigNumRef}; -use error::ErrorStack; -use nid::Nid; -use pkey::{HasParams, HasPrivate, HasPublic, Params, Private, Public}; -use util::ForeignTypeRefExt; -use {cvt, cvt_n, cvt_p, init}; +use crate::bn::{BigNumContextRef, BigNumRef}; +use crate::error::ErrorStack; +use crate::nid::Nid; +use crate::pkey::{HasParams, HasPrivate, HasPublic, Params, Private, Public}; +use crate::util::ForeignTypeRefExt; +use crate::{cvt, cvt_n, cvt_p, init}; /// Compressed or Uncompressed conversion /// @@ -925,8 +925,8 @@ mod test { use hex::FromHex; use super::*; - use bn::{BigNum, BigNumContext}; - use nid::Nid; + use crate::bn::{BigNum, BigNumContext}; + use crate::nid::Nid; #[test] fn key_new_by_curve_name() { diff --git a/openssl/src/ecdsa.rs b/openssl/src/ecdsa.rs index 50d5eefc..b08c2e5a 100644 --- a/openssl/src/ecdsa.rs +++ b/openssl/src/ecdsa.rs @@ -6,12 +6,12 @@ use libc::c_int; use std::mem; use std::ptr; -use bn::{BigNum, BigNumRef}; -use ec::EcKeyRef; -use error::ErrorStack; -use pkey::{HasPrivate, HasPublic}; -use util::ForeignTypeRefExt; -use {cvt_n, cvt_p}; +use crate::bn::{BigNum, BigNumRef}; +use crate::ec::EcKeyRef; +use crate::error::ErrorStack; +use crate::pkey::{HasPrivate, HasPublic}; +use crate::util::ForeignTypeRefExt; +use crate::{cvt_n, cvt_p}; foreign_type_and_impl_send_sync! { type CType = ffi::ECDSA_SIG; @@ -175,10 +175,10 @@ cfg_if! { #[cfg(test)] mod test { use super::*; - use ec::EcGroup; - use ec::EcKey; - use nid::Nid; - use pkey::{Private, Public}; + use crate::ec::EcGroup; + use crate::ec::EcKey; + use crate::nid::Nid; + use crate::pkey::{Private, Public}; fn get_public_key(group: &EcGroup, x: &EcKey<Private>) -> Result<EcKey<Public>, ErrorStack> { let public_key_point = x.public_key(); diff --git a/openssl/src/encrypt.rs b/openssl/src/encrypt.rs index 0d28ac9e..658d7b7b 100644 --- a/openssl/src/encrypt.rs +++ b/openssl/src/encrypt.rs @@ -41,12 +41,12 @@ //! ``` use std::{marker::PhantomData, ptr}; -use error::ErrorStack; +use crate::error::ErrorStack; +use crate::hash::MessageDigest; +use crate::pkey::{HasPrivate, HasPublic, PKeyRef}; +use crate::rsa::Padding; +use crate::{cvt, cvt_p}; use foreign_types::ForeignTypeRef; -use hash::MessageDigest; -use pkey::{HasPrivate, HasPublic, PKeyRef}; -use rsa::Padding; -use {cvt, cvt_p}; /// A type which encrypts data. pub struct Encrypter<'a> { @@ -423,10 +423,10 @@ impl<'a> Decrypter<'a> { mod test { use hex::FromHex; - use encrypt::{Decrypter, Encrypter}; - use hash::MessageDigest; - use pkey::PKey; - use rsa::{Padding, Rsa}; + use crate::encrypt::{Decrypter, Encrypter}; + use crate::hash::MessageDigest; + use crate::pkey::PKey; + use crate::rsa::{Padding, Rsa}; const INPUT: &str = "65794a68624763694f694a53557a49314e694a392e65794a7063334d694f694a71623255694c41304b49434a6c\ diff --git a/openssl/src/envelope.rs b/openssl/src/envelope.rs index bd4e1b43..d9d103e0 100644 --- a/openssl/src/envelope.rs +++ b/openssl/src/envelope.rs @@ -26,15 +26,15 @@ //! encrypted.truncate(enc_len); //! } //! ``` -use error::ErrorStack; +use crate::error::ErrorStack; +use crate::pkey::{HasPrivate, HasPublic, PKey, PKeyRef}; +use crate::symm::Cipher; +use crate::{cvt, cvt_p}; use ffi; use foreign_types::{ForeignType, ForeignTypeRef}; use libc::c_int; -use pkey::{HasPrivate, HasPublic, PKey, PKeyRef}; use std::cmp; use std::ptr; -use symm::Cipher; -use {cvt, cvt_p}; /// Represents an EVP_Seal context. pub struct Seal { @@ -259,8 +259,8 @@ impl Drop for Open { #[cfg(test)] mod test { use super::*; - use pkey::PKey; - use symm::Cipher; + use crate::pkey::PKey; + use crate::symm::Cipher; #[test] fn public_encrypt_private_decrypt() { diff --git a/openssl/src/fips.rs b/openssl/src/fips.rs index 374a8299..a10af0d6 100644 --- a/openssl/src/fips.rs +++ b/openssl/src/fips.rs @@ -3,8 +3,8 @@ //! See [OpenSSL's documentation] for details. //! //! [OpenSSL's documentation]: https://www.openssl.org/docs/fips/UserGuide-2.0.pdf -use cvt; -use error::ErrorStack; +use crate::cvt; +use crate::error::ErrorStack; use ffi; /// Moves the library into or out of the FIPS 140-2 mode of operation. diff --git a/openssl/src/hash.rs b/openssl/src/hash.rs index 81c3ff32..c5c39a08 100644 --- a/openssl/src/hash.rs +++ b/openssl/src/hash.rs @@ -6,9 +6,9 @@ use std::io::prelude::*; use std::ops::{Deref, DerefMut}; use std::ptr; -use error::ErrorStack; -use nid::Nid; -use {cvt, cvt_p}; +use crate::error::ErrorStack; +use crate::nid::Nid; +use crate::{cvt, cvt_p}; cfg_if! { if #[cfg(ossl110)] { diff --git a/openssl/src/lib.rs b/openssl/src/lib.rs index 3c2c020b..05c3eb8c 100644 --- a/openssl/src/lib.rs +++ b/openssl/src/lib.rs @@ -130,7 +130,7 @@ pub use ffi::init; use libc::c_int; -use error::ErrorStack; +use crate::error::ErrorStack; #[macro_use] mod macros; 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)) } diff --git a/openssl/src/nid.rs b/openssl/src/nid.rs index cbff7f82..dde62282 100644 --- a/openssl/src/nid.rs +++ b/openssl/src/nid.rs @@ -5,8 +5,8 @@ use libc::{c_char, c_int}; use std::ffi::CStr; use std::str; -use cvt_p; -use error::ErrorStack; +use crate::cvt_p; +use crate::error::ErrorStack; /// The digest and public-key algorithms associated with a signature. pub struct SignatureAlgorithms { diff --git a/openssl/src/ocsp.rs b/openssl/src/ocsp.rs index 586fc3c0..861e3bbe 100644 --- a/openssl/src/ocsp.rs +++ b/openssl/src/ocsp.rs @@ -4,14 +4,14 @@ use libc::{c_int, c_long, c_ulong}; use std::mem; use std::ptr; -use asn1::Asn1GeneralizedTimeRef; -use error::ErrorStack; -use hash::MessageDigest; -use stack::StackRef; -use util::ForeignTypeRefExt; -use x509::store::X509StoreRef; -use x509::{X509Ref, X509}; -use {cvt, cvt_p}; +use crate::asn1::Asn1GeneralizedTimeRef; +use crate::error::ErrorStack; +use crate::hash::MessageDigest; +use crate::stack::StackRef; +use crate::util::ForeignTypeRefExt; +use crate::x509::store::X509StoreRef; +use crate::x509::{X509Ref, X509}; +use crate::{cvt, cvt_p}; bitflags! { pub struct OcspFlag: c_ulong { diff --git a/openssl/src/pkcs12.rs b/openssl/src/pkcs12.rs index dc650d4c..b2764786 100644 --- a/openssl/src/pkcs12.rs +++ b/openssl/src/pkcs12.rs @@ -6,13 +6,13 @@ use libc::c_int; use std::ffi::CString; use std::ptr; -use error::ErrorStack; -use nid::Nid; -use pkey::{HasPrivate, PKey, PKeyRef, Private}; -use stack::Stack; -use util::ForeignTypeExt; -use x509::{X509Ref, X509}; -use {cvt, cvt_p}; +use crate::error::ErrorStack; +use crate::nid::Nid; +use crate::pkey::{HasPrivate, PKey, PKeyRef, Private}; +use crate::stack::Stack; +use crate::util::ForeignTypeExt; +use crate::x509::{X509Ref, X509}; +use crate::{cvt, cvt_p}; foreign_type_and_impl_send_sync! { type CType = ffi::PKCS12; @@ -197,15 +197,15 @@ impl Pkcs12Builder { #[cfg(test)] mod test { - use hash::MessageDigest; + use crate::hash::MessageDigest; use hex; - use asn1::Asn1Time; - use nid::Nid; - use pkey::PKey; - use rsa::Rsa; - use x509::extension::KeyUsage; - use x509::{X509Name, X509}; + use crate::asn1::Asn1Time; + use crate::nid::Nid; + use crate::pkey::PKey; + use crate::rsa::Rsa; + use crate::x509::extension::KeyUsage; + use crate::x509::{X509Name, X509}; use super::*; diff --git a/openssl/src/pkcs5.rs b/openssl/src/pkcs5.rs index 5c25f3d1..6cc9609c 100644 --- a/openssl/src/pkcs5.rs +++ b/openssl/src/pkcs5.rs @@ -2,10 +2,10 @@ use ffi; use libc::c_int; use std::ptr; -use cvt; -use error::ErrorStack; -use hash::MessageDigest; -use symm::Cipher; +use crate::cvt; +use crate::error::ErrorStack; +use crate::hash::MessageDigest; +use crate::symm::Cipher; #[derive(Clone, Eq, PartialEq, Hash, Debug)] pub struct KeyIvPair { @@ -141,8 +141,8 @@ pub fn scrypt( #[cfg(test)] mod tests { - use hash::MessageDigest; - use symm::Cipher; + use crate::hash::MessageDigest; + use crate::symm::Cipher; // Test vectors from // https://git.lysator.liu.se/nettle/nettle/blob/nettle_3.1.1_release_20150424/testsuite/pbkdf2-test.c diff --git a/openssl/src/pkcs7.rs b/openssl/src/pkcs7.rs index 7820739c..0541629b 100644 --- a/openssl/src/pkcs7.rs +++ b/openssl/src/pkcs7.rs @@ -1,15 +1,15 @@ -use bio::{MemBio, MemBioSlice}; -use error::ErrorStack; +use crate::bio::{MemBio, MemBioSlice}; +use crate::error::ErrorStack; +use crate::pkey::{HasPrivate, PKeyRef}; +use crate::stack::StackRef; +use crate::symm::Cipher; +use crate::x509::store::X509StoreRef; +use crate::x509::{X509Ref, X509}; +use crate::{cvt, cvt_p}; use ffi; use foreign_types::ForeignTypeRef; use libc::c_int; -use pkey::{HasPrivate, PKeyRef}; -use stack::StackRef; use std::ptr; -use symm::Cipher; -use x509::store::X509StoreRef; -use x509::{X509Ref, X509}; -use {cvt, cvt_p}; foreign_type_and_impl_send_sync! { type CType = ffi::PKCS7; @@ -284,12 +284,12 @@ impl Pkcs7Ref { #[cfg(test)] mod tests { - use pkcs7::{Pkcs7, Pkcs7Flags}; - use pkey::PKey; - use stack::Stack; - use symm::Cipher; - use x509::store::X509StoreBuilder; - use x509::X509; + use crate::pkcs7::{Pkcs7, Pkcs7Flags}; + use crate::pkey::PKey; + use crate::stack::Stack; + use crate::symm::Cipher; + use crate::x509::store::X509StoreBuilder; + use crate::x509::X509; #[test] fn encrypt_decrypt_test() { diff --git a/openssl/src/pkey.rs b/openssl/src/pkey.rs index ff0746ff..dcf941af 100644 --- a/openssl/src/pkey.rs +++ b/openssl/src/pkey.rs @@ -53,16 +53,16 @@ use std::fmt; use std::mem; use std::ptr; -use bio::MemBioSlice; -use dh::Dh; -use dsa::Dsa; -use ec::EcKey; -use error::ErrorStack; -use rsa::Rsa; +use crate::bio::MemBioSlice; +use crate::dh::Dh; +use crate::dsa::Dsa; +use crate::ec::EcKey; +use crate::error::ErrorStack; +use crate::rsa::Rsa; #[cfg(ossl110)] -use symm::Cipher; -use util::{invoke_passwd_cb, CallbackState}; -use {cvt, cvt_p}; +use crate::symm::Cipher; +use crate::util::{invoke_passwd_cb, CallbackState}; +use crate::{cvt, cvt_p}; /// A tag type indicating that a key only has parameters. pub enum Params {} @@ -678,12 +678,12 @@ cfg_if! { #[cfg(test)] mod tests { - use dh::Dh; - use dsa::Dsa; - use ec::EcKey; - use nid::Nid; - use rsa::Rsa; - use symm::Cipher; + use crate::dh::Dh; + use crate::dsa::Dsa; + use crate::ec::EcKey; + use crate::nid::Nid; + use crate::rsa::Rsa; + use crate::symm::Cipher; use super::*; diff --git a/openssl/src/rand.rs b/openssl/src/rand.rs index 88011de7..36421485 100644 --- a/openssl/src/rand.rs +++ b/openssl/src/rand.rs @@ -13,8 +13,8 @@ use ffi; use libc::c_int; -use cvt; -use error::ErrorStack; +use crate::cvt; +use crate::error::ErrorStack; /// Fill buffer with cryptographically strong pseudo-random bytes. /// diff --git a/openssl/src/rsa.rs b/openssl/src/rsa.rs index 18cd4d42..446da6ab 100644 --- a/openssl/src/rsa.rs +++ b/openssl/src/rsa.rs @@ -35,11 +35,11 @@ use std::fmt; use std::mem; use std::ptr; -use bn::{BigNum, BigNumRef}; -use error::ErrorStack; -use pkey::{HasPrivate, HasPublic, Private, Public}; -use util::ForeignTypeRefExt; -use {cvt, cvt_n, cvt_p}; +use crate::bn::{BigNum, BigNumRef}; +use crate::error::ErrorStack; +use crate::pkey::{HasPrivate, HasPublic, Private, Public}; +use crate::util::ForeignTypeRefExt; +use crate::{cvt, cvt_n, cvt_p}; /// Type of encryption padding to use. /// @@ -754,7 +754,7 @@ cfg_if! { #[cfg(test)] mod test { - use symm::Cipher; + use crate::symm::Cipher; use super::*; diff --git a/openssl/src/sign.rs b/openssl/src/sign.rs index 5678d9d6..72438b6b 100644 --- a/openssl/src/sign.rs +++ b/openssl/src/sign.rs @@ -68,11 +68,11 @@ use std::io::{self, Write}; use std::marker::PhantomData; use std::ptr; -use error::ErrorStack; -use hash::MessageDigest; -use pkey::{HasPrivate, HasPublic, PKeyRef}; -use rsa::Padding; -use {cvt, cvt_p}; +use crate::error::ErrorStack; +use crate::hash::MessageDigest; +use crate::pkey::{HasPrivate, HasPublic, PKeyRef}; +use crate::rsa::Padding; +use crate::{cvt, cvt_p}; cfg_if! { if #[cfg(ossl110)] { @@ -639,12 +639,12 @@ mod test { use hex::{self, FromHex}; use std::iter; - use ec::{EcGroup, EcKey}; - use hash::MessageDigest; - use nid::Nid; - use pkey::PKey; - use rsa::{Padding, Rsa}; - use sign::{RsaPssSaltlen, Signer, Verifier}; + use crate::ec::{EcGroup, EcKey}; + use crate::hash::MessageDigest; + use crate::nid::Nid; + use crate::pkey::PKey; + use crate::rsa::{Padding, Rsa}; + use crate::sign::{RsaPssSaltlen, Signer, Verifier}; const INPUT: &str = "65794a68624763694f694a53557a49314e694a392e65794a7063334d694f694a71623255694c41304b49434a6c\ @@ -802,7 +802,7 @@ mod test { #[test] #[cfg(ossl110)] fn test_cmac() { - let cipher = ::symm::Cipher::aes_128_cbc(); + let cipher = crate::symm::Cipher::aes_128_cbc(); let key = Vec::from_hex("9294727a3638bb1c13f48ef8158bfc9d").unwrap(); let pkey = PKey::cmac(&cipher, &key).unwrap(); let mut signer = Signer::new_without_digest(&pkey).unwrap(); diff --git a/openssl/src/srtp.rs b/openssl/src/srtp.rs index b5e38b7b..b60fea57 100644 --- a/openssl/src/srtp.rs +++ b/openssl/src/srtp.rs @@ -1,7 +1,7 @@ +use crate::stack::Stackable; use ffi; use foreign_types::ForeignTypeRef; use libc::c_ulong; -use stack::Stackable; use std::ffi::CStr; use std::str; diff --git a/openssl/src/ssl/bio.rs b/openssl/src/ssl/bio.rs index 9edaed7b..0ce85472 100644 --- a/openssl/src/ssl/bio.rs +++ b/openssl/src/ssl/bio.rs @@ -10,8 +10,8 @@ use std::panic::{catch_unwind, AssertUnwindSafe}; use std::ptr; use std::slice; -use cvt_p; -use error::ErrorStack; +use crate::cvt_p; +use crate::error::ErrorStack; pub struct StreamState<S> { pub stream: S, @@ -191,7 +191,7 @@ unsafe extern "C" fn destroy<S>(bio: *mut BIO) -> c_int { cfg_if! { if #[cfg(any(ossl110, libressl273))] { use ffi::{BIO_get_data, BIO_set_data, BIO_set_flags, BIO_set_init}; - use cvt; + use crate::cvt; #[allow(bad_style)] unsafe fn BIO_set_num(_bio: *mut ffi::BIO, _num: c_int) {} diff --git a/openssl/src/ssl/callbacks.rs b/openssl/src/ssl/callbacks.rs index 42fb033b..e19a2673 100644 --- a/openssl/src/ssl/callbacks.rs +++ b/openssl/src/ssl/callbacks.rs @@ -15,23 +15,23 @@ use std::slice; use std::str; use std::sync::Arc; -use dh::Dh; +use crate::dh::Dh; #[cfg(all(ossl101, not(ossl110)))] -use ec::EcKey; -use error::ErrorStack; -use pkey::Params; +use crate::ec::EcKey; +use crate::error::ErrorStack; +use crate::pkey::Params; #[cfg(any(ossl102, libressl261))] -use ssl::AlpnError; -use ssl::{ +use crate::ssl::AlpnError; +use crate::ssl::{ try_get_session_ctx_index, SniError, Ssl, SslAlert, SslContext, SslContextRef, SslRef, SslSession, SslSessionRef, }; #[cfg(ossl111)] -use ssl::{ClientHelloResponse, ExtensionContext}; -use util::ForeignTypeRefExt; +use crate::ssl::{ClientHelloResponse, ExtensionContext}; +use crate::util::ForeignTypeRefExt; #[cfg(ossl111)] -use x509::X509Ref; -use x509::{X509StoreContext, X509StoreContextRef}; +use crate::x509::X509Ref; +use crate::x509::{X509StoreContext, X509StoreContextRef}; pub extern "C" fn raw_verify<F>(preverify_ok: c_int, x509_ctx: *mut ffi::X509_STORE_CTX) -> c_int where diff --git a/openssl/src/ssl/connector.rs b/openssl/src/ssl/connector.rs index 94c5a5f2..855aec62 100644 --- a/openssl/src/ssl/connector.rs +++ b/openssl/src/ssl/connector.rs @@ -1,13 +1,13 @@ use std::io::{Read, Write}; use std::ops::{Deref, DerefMut}; -use dh::Dh; -use error::ErrorStack; -use ssl::{ +use crate::dh::Dh; +use crate::error::ErrorStack; +use crate::ssl::{ HandshakeError, Ssl, SslContext, SslContextBuilder, SslContextRef, SslMethod, SslMode, SslOptions, SslRef, SslStream, SslVerifyMode, }; -use version; +use crate::version; const FFDHE_2048: &str = " -----BEGIN DH PARAMETERS----- @@ -366,8 +366,8 @@ cfg_if! { } } else { fn setup_curves(ctx: &mut SslContextBuilder) -> Result<(), ErrorStack> { - use ec::EcKey; - use nid::Nid; + use crate::ec::EcKey; + use crate::nid::Nid; let curve = EcKey::from_curve_name(Nid::X9_62_PRIME256V1)?; ctx.set_tmp_ecdh(&curve) @@ -382,7 +382,7 @@ cfg_if! { } fn setup_verify_hostname(ssl: &mut SslRef, domain: &str) -> Result<(), ErrorStack> { - use x509::verify::X509CheckFlags; + use crate::x509::verify::X509CheckFlags; let param = ssl.param_mut(); param.set_hostflags(X509CheckFlags::NO_PARTIAL_WILDCARDS); @@ -406,17 +406,17 @@ cfg_if! { mod verify { use std::net::IpAddr; use std::str; + use once_cell::sync::OnceCell; - use error::ErrorStack; - use ex_data::Index; - use nid::Nid; - use ssl::Ssl; - use stack::Stack; - use x509::{ + use crate::error::ErrorStack; + use crate::ex_data::Index; + use crate::nid::Nid; + use crate::ssl::Ssl; + use crate::stack::Stack; + use crate::x509::{ GeneralName, X509NameRef, X509Ref, X509StoreContext, X509StoreContextRef, X509VerifyResult, }; - use once_cell::sync::OnceCell; static HOSTNAME_IDX: OnceCell<Index<Ssl, String>> = OnceCell::new(); @@ -565,7 +565,7 @@ cfg_if! { #[test] fn test_dns_match() { - use ssl::connector::verify::matches_dns; + use crate::ssl::connector::verify::matches_dns; assert!(matches_dns("website.tld", "website.tld")); // A name should match itself. assert!(matches_dns("website.tld", "wEbSiTe.tLd")); // DNS name matching ignores case of hostname. assert!(matches_dns("wEbSiTe.TlD", "website.tld")); // DNS name matching ignores case of subject. diff --git a/openssl/src/ssl/error.rs b/openssl/src/ssl/error.rs index e397efde..06cbb35e 100644 --- a/openssl/src/ssl/error.rs +++ b/openssl/src/ssl/error.rs @@ -5,9 +5,9 @@ use std::error::Error as StdError; use std::fmt; use std::io; -use error::ErrorStack; -use ssl::MidHandshakeSslStream; -use x509::X509VerifyResult; +use crate::error::ErrorStack; +use crate::ssl::MidHandshakeSslStream; +use crate::x509::X509VerifyResult; /// An error code returned from SSL functions. #[derive(Debug, Copy, Clone, PartialEq, Eq)] diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 6ee91a8a..93a3bf0a 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -60,6 +60,7 @@ use ffi; use foreign_types::{ForeignType, ForeignTypeRef, Opaque}; use libc::{c_char, c_int, c_long, c_uchar, c_uint, c_ulong, c_void}; +use once_cell::sync::{Lazy, OnceCell}; use std::any::TypeId; use std::cmp; use std::collections::HashMap; @@ -77,34 +78,33 @@ use std::slice; use std::str; use std::sync::{Arc, Mutex}; -use dh::{Dh, DhRef}; +use crate::dh::{Dh, DhRef}; #[cfg(all(ossl101, not(ossl110)))] -use ec::EcKey; -use ec::EcKeyRef; -use error::ErrorStack; -use ex_data::Index; +use crate::ec::EcKey; +use crate::ec::EcKeyRef; +use crate::error::ErrorStack; +use crate::ex_data::Index; #[cfg(ossl111)] -use hash::MessageDigest; +use crate::hash::MessageDigest; #[cfg(ossl110)] -use nid::Nid; -use once_cell::sync::{Lazy, OnceCell}; -use pkey::{HasPrivate, PKeyRef, Params, Private}; -use srtp::{SrtpProtectionProfile, SrtpProtectionProfileRef}; -use ssl::bio::BioMethod; -use ssl::callbacks::*; -use ssl::error::InnerError; -use stack::{Stack, StackRef}; -use util::{ForeignTypeExt, ForeignTypeRefExt}; -use x509::store::{X509Store, X509StoreBuilderRef, X509StoreRef}; +use crate::nid::Nid; +use crate::pkey::{HasPrivate, PKeyRef, Params, Private}; +use crate::srtp::{SrtpProtectionProfile, SrtpProtectionProfileRef}; +use crate::ssl::bio::BioMethod; +use crate::ssl::callbacks::*; +use crate::ssl::error::InnerError; +use crate::stack::{Stack, StackRef}; +use crate::util::{ForeignTypeExt, ForeignTypeRefExt}; +use crate::x509::store::{X509Store, X509StoreBuilderRef, X509StoreRef}; #[cfg(any(ossl102, libressl261))] -use x509::verify::X509VerifyParamRef; -use x509::{X509Name, X509Ref, X509StoreContextRef, X509VerifyResult, X509}; -use {cvt, cvt_n, cvt_p, init}; +use crate::x509::verify::X509VerifyParamRef; +use crate::x509::{X509Name, X509Ref, X509StoreContextRef, X509VerifyResult, X509}; +use crate::{cvt, cvt_n, cvt_p, init}; -pub use ssl::connector::{ +pub use crate::ssl::connector::{ ConnectConfiguration, SslAcceptor, SslAcceptorBuilder, SslConnector, SslConnectorBuilder, }; -pub use ssl::error::{Error, ErrorCode, HandshakeError}; +pub use crate::ssl::error::{Error, ErrorCode, HandshakeError}; mod bio; mod callbacks; diff --git a/openssl/src/ssl/test/mod.rs b/openssl/src/ssl/test/mod.rs index e886f7e1..e145d22b 100644 --- a/openssl/src/ssl/test/mod.rs +++ b/openssl/src/ssl/test/mod.rs @@ -16,28 +16,28 @@ use std::thread; use std::time::Duration; use tempdir::TempDir; -use dh::Dh; -use error::ErrorStack; -use hash::MessageDigest; -use ocsp::{OcspResponse, OcspResponseStatus}; -use pkey::PKey; -use srtp::SrtpProfileId; -use ssl; -use ssl::test::server::Server; +use crate::dh::Dh; +use crate::error::ErrorStack; +use crate::hash::MessageDigest; +use crate::ocsp::{OcspResponse, OcspResponseStatus}; +use crate::pkey::PKey; +use crate::srtp::SrtpProfileId; +use crate::ssl; +use crate::ssl::test::server::Server; #[cfg(any(ossl110, ossl111, libressl261))] -use ssl::SslVersion; +use crate::ssl::SslVersion; #[cfg(ossl111)] -use ssl::{ClientHelloResponse, ExtensionContext}; -use ssl::{ +use crate::ssl::{ClientHelloResponse, ExtensionContext}; +use crate::ssl::{ Error, HandshakeError, MidHandshakeSslStream, ShutdownResult, ShutdownState, Ssl, SslAcceptor, SslAcceptorBuilder, SslConnector, SslContext, SslContextBuilder, SslFiletype, SslMethod, SslOptions, SslSessionCacheMode, SslStream, SslVerifyMode, StatusType, }; #[cfg(ossl102)] -use x509::store::X509StoreBuilder; +use crate::x509::store::X509StoreBuilder; #[cfg(ossl102)] -use x509::verify::X509CheckFlags; -use x509::{X509Name, X509StoreContext, X509VerifyResult, X509}; +use crate::x509::verify::X509CheckFlags; +use crate::x509::{X509Name, X509StoreContext, X509VerifyResult, X509}; mod server; @@ -868,8 +868,8 @@ fn tmp_dh_callback() { #[test] #[cfg(all(ossl101, not(ossl110)))] fn tmp_ecdh_callback() { - use ec::EcKey; - use nid::Nid; + use crate::ec::EcKey; + use crate::nid::Nid; static CALLED_BACK: AtomicBool = AtomicBool::new(false); @@ -917,8 +917,8 @@ fn tmp_dh_callback_ssl() { #[test] #[cfg(all(ossl101, not(ossl110)))] fn tmp_ecdh_callback_ssl() { - use ec::EcKey; - use nid::Nid; + use crate::ec::EcKey; + use crate::nid::Nid; static CALLED_BACK: AtomicBool = AtomicBool::new(false); diff --git a/openssl/src/ssl/test/server.rs b/openssl/src/ssl/test/server.rs index fe24531e..41677e57 100644 --- a/openssl/src/ssl/test/server.rs +++ b/openssl/src/ssl/test/server.rs @@ -2,7 +2,7 @@ use std::io::{Read, Write}; use std::net::{SocketAddr, TcpListener, TcpStream}; use std::thread::{self, JoinHandle}; -use ssl::{Ssl, SslContext, SslContextBuilder, SslFiletype, SslMethod, SslRef, SslStream}; +use crate::ssl::{Ssl, SslContext, SslContextBuilder, SslFiletype, SslMethod, SslRef, SslStream}; pub struct Server { handle: Option<JoinHandle<()>>, diff --git a/openssl/src/stack.rs b/openssl/src/stack.rs index d881f6ef..b412029b 100644 --- a/openssl/src/stack.rs +++ b/openssl/src/stack.rs @@ -9,9 +9,9 @@ use std::marker::PhantomData; use std::mem; use std::ops::{Deref, DerefMut, Index, IndexMut, Range}; -use error::ErrorStack; -use util::ForeignTypeExt; -use {cvt, cvt_p}; +use crate::error::ErrorStack; +use crate::util::ForeignTypeExt; +use crate::{cvt, cvt_p}; cfg_if! { if #[cfg(ossl110)] { diff --git a/openssl/src/string.rs b/openssl/src/string.rs index 9796500a..f20e8434 100644 --- a/openssl/src/string.rs +++ b/openssl/src/string.rs @@ -7,7 +7,7 @@ use std::fmt; use std::ops::Deref; use std::str; -use stack::Stackable; +use crate::stack::Stackable; foreign_type_and_impl_send_sync! { type CType = c_char; @@ -87,7 +87,7 @@ unsafe fn free(buf: *mut c_char) { #[cfg(ossl110)] unsafe fn free(buf: *mut c_char) { - ::ffi::CRYPTO_free( + ffi::CRYPTO_free( buf as *mut c_void, concat!(file!(), "\0").as_ptr() as *const c_char, line!() as ::libc::c_int, diff --git a/openssl/src/symm.rs b/openssl/src/symm.rs index beea446b..9b900073 100644 --- a/openssl/src/symm.rs +++ b/openssl/src/symm.rs @@ -57,9 +57,9 @@ use libc::c_int; use std::cmp; use std::ptr; -use error::ErrorStack; -use nid::Nid; -use {cvt, cvt_p}; +use crate::error::ErrorStack; +use crate::nid::Nid; +use crate::{cvt, cvt_p}; #[derive(Copy, Clone)] pub enum Mode { diff --git a/openssl/src/util.rs b/openssl/src/util.rs index c0c335a0..e390ea05 100644 --- a/openssl/src/util.rs +++ b/openssl/src/util.rs @@ -4,7 +4,7 @@ use std::any::Any; use std::panic::{self, AssertUnwindSafe}; use std::slice; -use error::ErrorStack; +use crate::error::ErrorStack; /// Wraps a user-supplied callback and a slot for panics thrown inside the callback (while FFI /// frames are on the stack). diff --git a/openssl/src/x509/extension.rs b/openssl/src/x509/extension.rs index 8a37d2f9..dd4899c8 100644 --- a/openssl/src/x509/extension.rs +++ b/openssl/src/x509/extension.rs @@ -22,9 +22,9 @@ //! ``` use std::fmt::Write; -use error::ErrorStack; -use nid::Nid; -use x509::{X509Extension, X509v3Context}; +use crate::error::ErrorStack; +use crate::nid::Nid; +use crate::x509::{X509Extension, X509v3Context}; /// An extension which indicates whether a certificate is a CA certificate. pub struct BasicConstraints { diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index 1bcb9ea8..ad983fbd 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -20,19 +20,21 @@ use std::ptr; use std::slice; use std::str; -use asn1::{Asn1BitStringRef, Asn1IntegerRef, Asn1ObjectRef, Asn1StringRef, Asn1TimeRef, Asn1Type}; -use bio::MemBioSlice; -use conf::ConfRef; -use error::ErrorStack; -use ex_data::Index; -use hash::{DigestBytes, MessageDigest}; -use nid::Nid; -use pkey::{HasPrivate, HasPublic, PKey, PKeyRef, Public}; -use ssl::SslRef; -use stack::{Stack, StackRef, Stackable}; -use string::OpensslString; -use util::{ForeignTypeExt, ForeignTypeRefExt}; -use {cvt, cvt_n, cvt_p}; +use crate::asn1::{ + Asn1BitStringRef, Asn1IntegerRef, Asn1ObjectRef, Asn1StringRef, Asn1TimeRef, Asn1Type, +}; +use crate::bio::MemBioSlice; +use crate::conf::ConfRef; +use crate::error::ErrorStack; +use crate::ex_data::Index; +use crate::hash::{DigestBytes, MessageDigest}; +use crate::nid::Nid; +use crate::pkey::{HasPrivate, HasPublic, PKey, PKeyRef, Public}; +use crate::ssl::SslRef; +use crate::stack::{Stack, StackRef, Stackable}; +use crate::string::OpensslString; +use crate::util::{ForeignTypeExt, ForeignTypeRefExt}; +use crate::{cvt, cvt_n, cvt_p}; #[cfg(any(ossl102, libressl261))] pub mod verify; diff --git a/openssl/src/x509/store.rs b/openssl/src/x509/store.rs index 5ae62321..2b7a74a3 100644 --- a/openssl/src/x509/store.rs +++ b/openssl/src/x509/store.rs @@ -44,10 +44,10 @@ use ffi; use foreign_types::ForeignTypeRef; use std::mem; -use error::ErrorStack; -use stack::StackRef; -use x509::{X509Object, X509}; -use {cvt, cvt_p}; +use crate::error::ErrorStack; +use crate::stack::StackRef; +use crate::x509::{X509Object, X509}; +use crate::{cvt, cvt_p}; foreign_type_and_impl_send_sync! { type CType = ffi::X509_STORE; diff --git a/openssl/src/x509/tests.rs b/openssl/src/x509/tests.rs index b11dac53..bd4e66a1 100644 --- a/openssl/src/x509/tests.rs +++ b/openssl/src/x509/tests.rs @@ -1,19 +1,19 @@ -use asn1::Asn1Time; -use bn::{BigNum, MsbOption}; -use hash::MessageDigest; -use hex::{self, FromHex}; -use nid::Nid; -use pkey::{PKey, Private}; -use rsa::Rsa; -use stack::Stack; -use x509::extension::{ +use crate::asn1::Asn1Time; +use crate::bn::{BigNum, MsbOption}; +use crate::hash::MessageDigest; +use crate::nid::Nid; +use crate::pkey::{PKey, Private}; +use crate::rsa::Rsa; +use crate::stack::Stack; +use crate::x509::extension::{ AuthorityKeyIdentifier, BasicConstraints, ExtendedKeyUsage, KeyUsage, SubjectAlternativeName, SubjectKeyIdentifier, }; -use x509::store::X509StoreBuilder; +use crate::x509::store::X509StoreBuilder; #[cfg(ossl110)] -use x509::X509Builder; -use x509::{X509Name, X509Req, X509StoreContext, X509VerifyResult, X509}; +use crate::x509::X509Builder; +use crate::x509::{X509Name, X509Req, X509StoreContext, X509VerifyResult, X509}; +use hex::{self, FromHex}; fn pkey() -> PKey<Private> { let rsa = Rsa::generate(2048).unwrap(); diff --git a/openssl/src/x509/verify.rs b/openssl/src/x509/verify.rs index 416556ab..74911ab9 100644 --- a/openssl/src/x509/verify.rs +++ b/openssl/src/x509/verify.rs @@ -3,8 +3,8 @@ use foreign_types::ForeignTypeRef; use libc::{c_uint, c_ulong}; use std::net::IpAddr; -use cvt; -use error::ErrorStack; +use crate::cvt; +use crate::error::ErrorStack; bitflags! { /// Flags used to check an `X509` certificate. |