diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index c87b4f56ed04b42fc36ede5b641473cbd7e5c2be..bc2176e1cfcc8ba37324d66774a0d6205640acd5 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -103,7 +103,7 @@ pub fn init() { use std::io::{self, Write}; use std::mem; use std::process; - use std::sync::{Mutex, MutexGuard, Once, ONCE_INIT}; + use std::sync::{Mutex, MutexGuard, Once}; static mut MUTEXES: *mut Vec> = 0 as *mut Vec>; static mut GUARDS: *mut Vec>> = @@ -147,7 +147,7 @@ pub fn init() { } } - static INIT: Once = ONCE_INIT; + static INIT: Once = Once::new(); INIT.call_once(|| unsafe { SSL_library_init(); diff --git a/openssl/src/aes.rs b/openssl/src/aes.rs index 10e6840ab1adc2aefc9a825e1abff941e332895f..c26a026945d46ae41f2cad0cf41c6d65f2451880 100644 --- a/openssl/src/aes.rs +++ b/openssl/src/aes.rs @@ -74,6 +74,7 @@ impl AesKey { /// # Failure /// /// Returns an error if the key is not 128, 192, or 256 bits. + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn new_encrypt(key: &[u8]) -> Result { unsafe { assert!(key.len() <= c_int::max_value() as usize / 8); @@ -97,6 +98,7 @@ impl AesKey { /// # Failure /// /// Returns an error if the key is not 128, 192, or 256 bits. + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn new_decrypt(key: &[u8]) -> Result { unsafe { assert!(key.len() <= c_int::max_value() as usize / 8); diff --git a/openssl/src/sha.rs b/openssl/src/sha.rs index 7f6c4067679f96bc55e805a61ec7579c3329a410..0cefaa93559fa40814782b2f5642a158a55d7008 100644 --- a/openssl/src/sha.rs +++ b/openssl/src/sha.rs @@ -56,6 +56,7 @@ use std::mem; /// SHA1 is known to be insecure - it should not be used unless required for /// compatibility with existing systems. #[inline] +#[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn sha1(data: &[u8]) -> [u8; 20] { unsafe { let mut hash: [u8; 20] = mem::uninitialized(); @@ -66,6 +67,7 @@ pub fn sha1(data: &[u8]) -> [u8; 20] { /// Computes the SHA224 hash of some data. #[inline] +#[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn sha224(data: &[u8]) -> [u8; 28] { unsafe { let mut hash: [u8; 28] = mem::uninitialized(); @@ -76,6 +78,7 @@ pub fn sha224(data: &[u8]) -> [u8; 28] { /// Computes the SHA256 hash of some data. #[inline] +#[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn sha256(data: &[u8]) -> [u8; 32] { unsafe { let mut hash: [u8; 32] = mem::uninitialized(); @@ -86,6 +89,7 @@ pub fn sha256(data: &[u8]) -> [u8; 32] { /// Computes the SHA384 hash of some data. #[inline] +#[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn sha384(data: &[u8]) -> [u8; 48] { unsafe { let mut hash: [u8; 48] = mem::uninitialized(); @@ -96,6 +100,7 @@ pub fn sha384(data: &[u8]) -> [u8; 48] { /// Computes the SHA512 hash of some data. #[inline] +#[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn sha512(data: &[u8]) -> [u8; 64] { unsafe { let mut hash: [u8; 64] = mem::uninitialized(); @@ -116,6 +121,7 @@ pub struct Sha1(ffi::SHA_CTX); impl Sha1 { /// Creates a new hasher. #[inline] + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn new() -> Sha1 { unsafe { let mut ctx = mem::uninitialized(); @@ -136,6 +142,7 @@ impl Sha1 { /// Returns the hash of the data. #[inline] + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn finish(mut self) -> [u8; 20] { unsafe { let mut hash: [u8; 20] = mem::uninitialized(); @@ -152,6 +159,7 @@ pub struct Sha224(ffi::SHA256_CTX); impl Sha224 { /// Creates a new hasher. #[inline] + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn new() -> Sha224 { unsafe { let mut ctx = mem::uninitialized(); @@ -172,6 +180,7 @@ impl Sha224 { /// Returns the hash of the data. #[inline] + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn finish(mut self) -> [u8; 28] { unsafe { let mut hash: [u8; 28] = mem::uninitialized(); @@ -188,6 +197,7 @@ pub struct Sha256(ffi::SHA256_CTX); impl Sha256 { /// Creates a new hasher. #[inline] + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn new() -> Sha256 { unsafe { let mut ctx = mem::uninitialized(); @@ -208,6 +218,7 @@ impl Sha256 { /// Returns the hash of the data. #[inline] + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn finish(mut self) -> [u8; 32] { unsafe { let mut hash: [u8; 32] = mem::uninitialized(); @@ -224,6 +235,7 @@ pub struct Sha384(ffi::SHA512_CTX); impl Sha384 { /// Creates a new hasher. #[inline] + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn new() -> Sha384 { unsafe { let mut ctx = mem::uninitialized(); @@ -244,6 +256,7 @@ impl Sha384 { /// Returns the hash of the data. #[inline] + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn finish(mut self) -> [u8; 48] { unsafe { let mut hash: [u8; 48] = mem::uninitialized(); @@ -260,6 +273,7 @@ pub struct Sha512(ffi::SHA512_CTX); impl Sha512 { /// Creates a new hasher. #[inline] + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn new() -> Sha512 { unsafe { let mut ctx = mem::uninitialized(); @@ -280,6 +294,7 @@ impl Sha512 { /// Returns the hash of the data. #[inline] + #[allow(deprecated)] // https://github.com/rust-lang/rust/issues/63566 pub fn finish(mut self) -> [u8; 64] { unsafe { let mut hash: [u8; 64] = mem::uninitialized(); diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 58d00be9d31c06938c6dfaa4b0a0b54e6626be0c..95c9ce1f92bf06d0299f2a6d1c47cd3d294b8113 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -3928,11 +3928,11 @@ cfg_if! { ) } } else { - use std::sync::{Once, ONCE_INIT}; + use std::sync::Once; unsafe fn get_new_idx(f: ffi::CRYPTO_EX_free) -> c_int { // hack around https://rt.openssl.org/Ticket/Display.html?id=3710&user=guest&pass=guest - static ONCE: Once = ONCE_INIT; + static ONCE: Once = Once::new(); ONCE.call_once(|| { ffi::SSL_CTX_get_ex_new_index(0, ptr::null_mut(), None, None, None); }); @@ -3942,7 +3942,7 @@ cfg_if! { unsafe fn get_new_ssl_idx(f: ffi::CRYPTO_EX_free) -> c_int { // hack around https://rt.openssl.org/Ticket/Display.html?id=3710&user=guest&pass=guest - static ONCE: Once = ONCE_INIT; + static ONCE: Once = Once::new(); ONCE.call_once(|| { ffi::SSL_get_ex_new_index(0, ptr::null_mut(), None, None, None); });