From 3b1503f36bfd5ec71ff62fbc027163893bf336ac Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Mon, 5 Feb 2024 23:22:29 -0800 Subject: [PATCH 1/3] Prepare pre.0 prereleases --- Cargo.lock | 92 +++++++++++++++++++++++---------- Cargo.toml | 3 ++ argon2/Cargo.toml | 4 +- balloon-hash/Cargo.toml | 8 +-- balloon-hash/src/balloon.rs | 28 +++++----- balloon-hash/src/lib.rs | 30 +++++------ balloon-hash/tests/balloon.rs | 4 +- balloon-hash/tests/balloon_m.rs | 6 +-- bcrypt-pbkdf/Cargo.toml | 6 +-- bcrypt-pbkdf/src/lib.rs | 8 +-- password-auth/Cargo.toml | 8 +-- pbkdf2/Cargo.toml | 18 +++---- pbkdf2/src/lib.rs | 10 ++-- scrypt/Cargo.toml | 6 +-- sha-crypt/Cargo.toml | 4 +- 15 files changed, 137 insertions(+), 98 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18af07cd..ce97ba27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "argon2" -version = "0.5.3" +version = "0.6.0-pre.0" dependencies = [ "base64ct", "blake2", @@ -22,7 +22,7 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "balloon-hash" -version = "0.4.0" +version = "0.5.0-pre.0" dependencies = [ "crypto-bigint", "digest", @@ -41,7 +41,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bcrypt-pbkdf" -version = "0.10.0" +version = "0.11.0-pre.0" dependencies = [ "blowfish", "hex-literal", @@ -52,20 +52,19 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +version = "0.11.0-pre" +source = "git+https://github.com/RustCrypto/hashes.git#e4dcf120629bd6461eff9ca1b281736336de423c" dependencies = [ "digest", ] [[package]] name = "block-buffer" -version = "0.10.4" +version = "0.11.0-pre.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "3ded684142010808eb980d9974ef794da2bcf97d13396143b1515e9f0fb4a10e" dependencies = [ - "generic-array", + "crypto-common 0.2.0-pre.5", ] [[package]] @@ -102,10 +101,16 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "crypto-common", + "crypto-common 0.1.6", "inout", ] +[[package]] +name = "const-oid" +version = "0.10.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7e3352a27098ba6b09546e5f13b15165e6a88b5c2723afecb3ea9576b27e3ea" + [[package]] name = "cpufeatures" version = "0.2.12" @@ -160,11 +165,12 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.5.5" +version = "0.6.0-pre.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +checksum = "1943d7beadd9ce2b25f3bae73b9e9336fccc1edf38bdec1ed58d3aa183989e11" dependencies = [ - "generic-array", + "hybrid-array", + "num-traits", "subtle", ] @@ -178,14 +184,26 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-common" +version = "0.2.0-pre.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7aa2ec04f5120b830272a481e8d9d8ba4dda140d2cda59b0f1110d5eb93c38e" +dependencies = [ + "getrandom", + "hybrid-array", + "rand_core", +] + [[package]] name = "digest" -version = "0.10.7" +version = "0.11.0-pre.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "065d93ead7c220b85d5b4be4795d8398eac4ff68b5ee63895de0a3c1fb6edf25" dependencies = [ "block-buffer", - "crypto-common", + "const-oid", + "crypto-common 0.2.0-pre.5", "subtle", ] @@ -232,13 +250,22 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hmac" -version = "0.12.1" +version = "0.13.0-pre.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "ffd790a0795ee332ed3e8959e5b177beb70d7112eb7d345428ec17427897d5ce" dependencies = [ "digest", ] +[[package]] +name = "hybrid-array" +version = "0.2.0-rc.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcda354500b318c287a6b91c1cfbc42edd53d52d259a80783ceb5e3986fca2b2" +dependencies = [ + "typenum", +] + [[package]] name = "inout" version = "0.1.3" @@ -278,6 +305,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + [[package]] name = "num_cpus" version = "1.16.0" @@ -296,7 +332,7 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "password-auth" -version = "1.0.0" +version = "1.1.0-pre.0" dependencies = [ "argon2", "getrandom", @@ -319,7 +355,7 @@ dependencies = [ [[package]] name = "pbkdf2" -version = "0.12.2" +version = "0.13.0-pre.0" dependencies = [ "digest", "hex-literal", @@ -424,7 +460,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scrypt" -version = "0.11.0" +version = "0.12.0-pre.0" dependencies = [ "password-hash", "pbkdf2", @@ -434,7 +470,7 @@ dependencies = [ [[package]] name = "sha-crypt" -version = "0.5.0" +version = "0.6.0-pre.0" dependencies = [ "base64ct", "rand", @@ -444,9 +480,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.6" +version = "0.11.0-pre.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +checksum = "3885de8cb916f223718c1ccd47a840b91f806333e76002dc5cb3862154b4fed3" dependencies = [ "cfg-if", "cpufeatures", @@ -455,9 +491,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.8" +version = "0.11.0-pre.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "8f33549bf3064b62478926aa89cbfc7c109aab66ae8f0d5d2ef839e482cc30d6" dependencies = [ "cfg-if", "cpufeatures", @@ -466,9 +502,9 @@ dependencies = [ [[package]] name = "streebog" -version = "0.10.2" +version = "0.11.0-pre.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e7fe6ed8a42cec360e070309427bb7959e102849b0dbaa7de19d5b9860bd536" +checksum = "906aaaef0b6bfcf186c7aac662b06a11769e688744323aa6ff3b9f96a5c71c09" dependencies = [ "digest", ] diff --git a/Cargo.toml b/Cargo.toml index 4175fea8..5557a64e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,3 +13,6 @@ exclude = ["benches"] [profile.dev] opt-level = 2 + +[patch.crates-io] +blake2 = { git = "https://github.com/RustCrypto/hashes.git" } diff --git a/argon2/Cargo.toml b/argon2/Cargo.toml index 5b55fdc8..f3f67488 100644 --- a/argon2/Cargo.toml +++ b/argon2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "argon2" -version = "0.5.3" +version = "0.6.0-pre.0" description = """ Pure Rust implementation of the Argon2 password hashing function with support for the Argon2d, Argon2i, and Argon2id algorithmic variants @@ -17,7 +17,7 @@ rust-version = "1.65" [dependencies] base64ct = "1" -blake2 = { version = "0.10.6", default-features = false } +blake2 = { version = "0.11.0-pre", default-features = false } # optional dependencies password-hash = { version = "0.5", optional = true } diff --git a/balloon-hash/Cargo.toml b/balloon-hash/Cargo.toml index f6a3c5b9..ecc63a00 100644 --- a/balloon-hash/Cargo.toml +++ b/balloon-hash/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "balloon-hash" -version = "0.4.0" +version = "0.5.0-pre.0" description = "Pure Rust implementation of the Balloon password hashing function" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -13,8 +13,8 @@ edition = "2021" rust-version = "1.65" [dependencies] -digest = { version = "0.10.7", default-features = false } -crypto-bigint = { version = "0.5", default-features = false, features = ["generic-array"] } +digest = { version = "=0.11.0-pre.8", default-features = false } +crypto-bigint = { version = "=0.6.0-pre.12", default-features = false, features = ["hybrid-array"] } # optional dependencies password-hash = { version = "0.5", default-features = false, optional = true } @@ -23,7 +23,7 @@ zeroize = { version = "1", default-features = false, optional = true } [dev-dependencies] hex-literal = "0.4" -sha2 = "0.10" +sha2 = "=0.11.0-pre.3" [features] default = ["alloc", "password-hash", "rand"] diff --git a/balloon-hash/src/balloon.rs b/balloon-hash/src/balloon.rs index 7c59935f..42cc76d5 100644 --- a/balloon-hash/src/balloon.rs +++ b/balloon-hash/src/balloon.rs @@ -2,7 +2,7 @@ use crate::error::{Error, Result}; use crate::Params; use core::mem; use crypto_bigint::{ArrayDecoding, ArrayEncoding, NonZero}; -use digest::generic_array::GenericArray; +use digest::array::Array; use digest::{Digest, FixedOutputReset}; pub fn balloon( @@ -10,10 +10,10 @@ pub fn balloon( salt: &[u8], secret: Option<&[u8]>, params: Params, - memory_blocks: &mut [GenericArray], -) -> Result> + memory_blocks: &mut [Array], +) -> Result> where - GenericArray: ArrayDecoding, + Array: ArrayDecoding, { if params.p_cost.get() == 1 { hash_internal::(pwd, salt, secret, params, memory_blocks, None) @@ -27,15 +27,15 @@ pub fn balloon_m( salt: &[u8], secret: Option<&[u8]>, params: Params, - memory_blocks: &mut [GenericArray], - output: &mut GenericArray, + memory_blocks: &mut [Array], + output: &mut Array, ) -> Result<()> where - GenericArray: ArrayDecoding, + Array: ArrayDecoding, { #[cfg(not(feature = "parallel"))] let output_xor = { - let mut output = GenericArray::<_, D::OutputSize>::default(); + let mut output = Array::<_, D::OutputSize>::default(); for thread in 1..=u64::from(params.p_cost.get()) { let hash = hash_internal::(pwd, salt, secret, params, memory_blocks, Some(thread))?; @@ -63,7 +63,7 @@ where .map_with((params, secret), |(params, secret), (thread, memory)| { hash_internal::(pwd, salt, *secret, *params, memory, Some(thread)) }) - .try_reduce(GenericArray::default, |a, b| { + .try_reduce(Array::default, |a, b| { Ok(a.into_iter().zip(b).map(|(a, b)| a ^ b).collect()) }) }? @@ -88,16 +88,16 @@ fn hash_internal( salt: &[u8], secret: Option<&[u8]>, params: Params, - memory_blocks: &mut [GenericArray], + memory_blocks: &mut [Array], thread_id: Option, -) -> Result> +) -> Result> where - GenericArray: ArrayDecoding, + Array: ArrayDecoding, { // we will use `s_cost` to index arrays regularly let s_cost = params.s_cost.get() as usize; let s_cost_bigint = { - let mut s_cost = GenericArray::::default(); + let mut s_cost = Array::::default(); s_cost[..mem::size_of::()].copy_from_slice(¶ms.s_cost.get().to_le_bytes()); NonZero::new(s_cost.into_uint_le()).unwrap() }; @@ -183,7 +183,7 @@ where } Digest::update(&mut digest, idx_block); - let other = digest.finalize_reset().into_uint_le() % s_cost_bigint; + let other = digest.finalize_reset().into_uint_le() % s_cost_bigint.clone(); let other = usize::from_le_bytes( other.to_le_byte_array()[..mem::size_of::()] .try_into() diff --git a/balloon-hash/src/lib.rs b/balloon-hash/src/lib.rs index 7f38b65a..b744385e 100644 --- a/balloon-hash/src/lib.rs +++ b/balloon-hash/src/lib.rs @@ -83,7 +83,7 @@ pub use password_hash::{self, PasswordHash, PasswordHasher, PasswordVerifier}; use core::marker::PhantomData; use crypto_bigint::ArrayDecoding; -use digest::generic_array::GenericArray; +use digest::array::Array; use digest::typenum::Unsigned; use digest::{Digest, FixedOutputReset}; @@ -105,7 +105,7 @@ use zeroize::Zeroize; #[derive(Clone, Default)] pub struct Balloon<'key, D: Digest + FixedOutputReset> where - GenericArray: ArrayDecoding, + Array: ArrayDecoding, { /// Storing which hash function is used pub digest: PhantomData, @@ -119,7 +119,7 @@ where impl<'key, D: Digest + FixedOutputReset> Balloon<'key, D> where - GenericArray: ArrayDecoding, + Array: ArrayDecoding, { /// Create a new Balloon context. pub fn new(algorithm: Algorithm, params: Params, secret: Option<&'key [u8]>) -> Self { @@ -134,8 +134,8 @@ where /// Hash a password and associated parameters. #[cfg(feature = "alloc")] #[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] - pub fn hash(&self, pwd: &[u8], salt: &[u8]) -> Result> { - let mut output = GenericArray::default(); + pub fn hash(&self, pwd: &[u8], salt: &[u8]) -> Result> { + let mut output = Array::default(); self.hash_into(pwd, salt, &mut output)?; Ok(output) @@ -148,9 +148,9 @@ where #[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] pub fn hash_into(&self, pwd: &[u8], salt: &[u8], output: &mut [u8]) -> Result<()> { #[cfg(not(feature = "parallel"))] - let mut memory = alloc::vec![GenericArray::default(); self.params.s_cost.get() as usize]; + let mut memory = alloc::vec![Array::default(); self.params.s_cost.get() as usize]; #[cfg(feature = "parallel")] - let mut memory = alloc::vec![GenericArray::default(); (self.params.s_cost.get() * self.params.p_cost.get()) as usize]; + let mut memory = alloc::vec![Array::default(); (self.params.s_cost.get() * self.params.p_cost.get()) as usize]; self.hash_into_with_memory(pwd, salt, &mut memory, output)?; #[cfg(feature = "zeroize")] @@ -165,16 +165,16 @@ where /// /// - Users with the `alloc` feature enabled can use [`Balloon::hash`] /// to have it allocated for them. - /// - `no_std` users on "heapless" targets can use an array of the [`GenericArray`] type + /// - `no_std` users on "heapless" targets can use an array of the [`Array`] type /// to stack allocate this buffer. It needs a minimum size of `s_cost` or `s_cost * p_cost` /// with the `parallel` crate feature enabled. pub fn hash_with_memory( &self, pwd: &[u8], salt: &[u8], - memory_blocks: &mut [GenericArray], - ) -> Result> { - let mut output = GenericArray::default(); + memory_blocks: &mut [Array], + ) -> Result> { + let mut output = Array::default(); self.hash_into_with_memory(pwd, salt, memory_blocks, &mut output)?; Ok(output) @@ -189,11 +189,11 @@ where &self, pwd: &[u8], salt: &[u8], - memory_blocks: &mut [GenericArray], + memory_blocks: &mut [Array], output: &mut [u8], ) -> Result<()> { let output = if output.len() == D::OutputSize::USIZE { - GenericArray::from_mut_slice(output) + Array::from_mut_slice(output) } else { return Err(Error::OutputSize { actual: output.len(), @@ -221,7 +221,7 @@ where #[cfg_attr(docsrs, doc(cfg(feature = "password-hash")))] impl PasswordHasher for Balloon<'_, D> where - GenericArray: ArrayDecoding, + Array: ArrayDecoding, { type Params = Params; @@ -271,7 +271,7 @@ where impl<'key, D: Digest + FixedOutputReset> From for Balloon<'key, D> where - GenericArray: ArrayDecoding, + Array: ArrayDecoding, { fn from(params: Params) -> Self { Self::new(Algorithm::default(), params, None) diff --git a/balloon-hash/tests/balloon.rs b/balloon-hash/tests/balloon.rs index 36e3c190..6e5e37b3 100644 --- a/balloon-hash/tests/balloon.rs +++ b/balloon-hash/tests/balloon.rs @@ -1,5 +1,5 @@ use balloon_hash::{Algorithm, Balloon, Params}; -use digest::generic_array::GenericArray; +use digest::array::Array; use hex_literal::hex; struct TestVector { @@ -60,7 +60,7 @@ fn test_vectors() { None, ); - let mut memory = vec![GenericArray::default(); balloon.params.s_cost.get() as usize]; + let mut memory = vec![Array::default(); balloon.params.s_cost.get() as usize]; assert_eq!( balloon diff --git a/balloon-hash/tests/balloon_m.rs b/balloon-hash/tests/balloon_m.rs index 09bb81c5..5fa05462 100644 --- a/balloon-hash/tests/balloon_m.rs +++ b/balloon-hash/tests/balloon_m.rs @@ -1,5 +1,5 @@ use balloon_hash::{Algorithm, Balloon, Params}; -use digest::generic_array::GenericArray; +use digest::array::Array; use hex_literal::hex; struct TestVector { @@ -91,10 +91,10 @@ fn test_vectors() { ); #[cfg(not(feature = "parallel"))] - let mut memory = vec![GenericArray::default(); balloon.params.s_cost.get() as usize]; + let mut memory = vec![Array::default(); balloon.params.s_cost.get() as usize]; #[cfg(feature = "parallel")] let mut memory = vec![ - GenericArray::default(); + Array::default(); (balloon.params.s_cost.get() * balloon.params.p_cost.get()) as usize ]; diff --git a/bcrypt-pbkdf/Cargo.toml b/bcrypt-pbkdf/Cargo.toml index 86eb5afb..5d653db8 100644 --- a/bcrypt-pbkdf/Cargo.toml +++ b/bcrypt-pbkdf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bcrypt-pbkdf" -version = "0.10.0" +version = "0.11.0-pre.0" description = "bcrypt-pbkdf password-based key derivation function" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -14,8 +14,8 @@ rust-version = "1.60" [dependencies] blowfish = { version = "0.9.1", features = ["bcrypt"] } -pbkdf2 = { version = "0.12", default-features = false, path = "../pbkdf2" } -sha2 = { version = "0.10.5", default-features = false } +pbkdf2 = { version = "=0.13.0-pre.0", default-features = false, path = "../pbkdf2" } +sha2 = { version = "=0.11.0-pre.3", default-features = false } zeroize = { version = "1", default-features = false, optional = true } [dev-dependencies] diff --git a/bcrypt-pbkdf/src/lib.rs b/bcrypt-pbkdf/src/lib.rs index 7a46df20..743e16f1 100644 --- a/bcrypt-pbkdf/src/lib.rs +++ b/bcrypt-pbkdf/src/lib.rs @@ -24,7 +24,7 @@ use blowfish::Blowfish; use sha2::{ digest::{ crypto_common::{Key, KeyInit, KeySizeUser}, - generic_array::typenum::U32, + typenum::U32, FixedOutput, MacMarker, Output, OutputSizeUser, Update, }, Digest, Sha512, @@ -204,7 +204,7 @@ pub fn bcrypt_pbkdf_with_memory( mod test { use super::bhash; use hex_literal::hex; - use sha2::digest::generic_array::GenericArray; + use sha2::digest::array::Array; #[test] fn test_bhash() { @@ -257,8 +257,8 @@ mod test { ]; for t in tests.iter() { - let hpass = GenericArray::from_slice(&t.hpass); - let hsalt = GenericArray::from_slice(&t.hsalt); + let hpass = Array::from_slice(&t.hpass); + let hsalt = Array::from_slice(&t.hsalt); let out = bhash(hpass, hsalt); assert_eq!(out[..], t.out[..]); } diff --git a/password-auth/Cargo.toml b/password-auth/Cargo.toml index cf522dcd..b3a933eb 100644 --- a/password-auth/Cargo.toml +++ b/password-auth/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "password-auth" -version = "1.0.0" +version = "1.1.0-pre.0" description = """ Password authentication library with a focus on simplicity and ease-of-use, including support for Argon2, PBKDF2, and scrypt password hashing algorithms @@ -20,9 +20,9 @@ password-hash = { version = "0.5", features = ["alloc", "rand_core"] } rand_core = { version = "0.6", features = ["getrandom"] } # optional dependencies -argon2 = { version = "0.5", optional = true, default-features = false, features = ["alloc", "simple"], path = "../argon2" } -pbkdf2 = { version = "0.12", optional = true, default-features = false, features = ["simple"], path = "../pbkdf2" } -scrypt = { version = "0.11", optional = true, default-features = false, features = ["simple"], path = "../scrypt" } +argon2 = { version = "=0.6.0-pre.0", optional = true, default-features = false, features = ["alloc", "simple"], path = "../argon2" } +pbkdf2 = { version = "=0.13.0-pre.0", optional = true, default-features = false, features = ["simple"], path = "../pbkdf2" } +scrypt = { version = "=0.12.0-pre.0", optional = true, default-features = false, features = ["simple"], path = "../scrypt" } [features] default = ["argon2", "std"] diff --git a/pbkdf2/Cargo.toml b/pbkdf2/Cargo.toml index fd68db0c..8e243f33 100644 --- a/pbkdf2/Cargo.toml +++ b/pbkdf2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pbkdf2" -version = "0.12.2" +version = "0.13.0-pre.0" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" description = "Generic implementation of PBKDF2" @@ -13,21 +13,21 @@ edition = "2021" rust-version = "1.60" [dependencies] -digest = { version = "0.10.7", features = ["mac"] } +digest = { version = "=0.11.0-pre.8", features = ["mac"] } # optional dependencies rayon = { version = "1.7", optional = true } password-hash = { version = "0.5", default-features = false, optional = true, features = ["rand_core"] } -hmac = { version = "0.12", default-features = false, optional = true } -sha1 = { version = "0.10", default-features = false, optional = true } -sha2 = { version = "0.10", default-features = false, optional = true } +hmac = { version = "=0.13.0-pre.3", default-features = false, optional = true } +sha1 = { version = "=0.11.0-pre.3", default-features = false, optional = true } +sha2 = { version = "=0.11.0-pre.3", default-features = false, optional = true } [dev-dependencies] -hmac = "0.12" +hmac = "=0.13.0-pre.3" hex-literal = "0.4.0" -sha1 = "0.10" -sha2 = "0.10" -streebog = "0.10" +sha1 = "=0.11.0-pre.3" +sha2 = "=0.11.0-pre.3" +streebog = "=0.11.0-pre.3" [features] default = ["hmac"] diff --git a/pbkdf2/src/lib.rs b/pbkdf2/src/lib.rs index 027c2f84..017aa174 100644 --- a/pbkdf2/src/lib.rs +++ b/pbkdf2/src/lib.rs @@ -103,13 +103,13 @@ pub use crate::simple::{Algorithm, Params, Pbkdf2}; #[cfg(feature = "parallel")] use rayon::prelude::*; -use digest::{generic_array::typenum::Unsigned, FixedOutput, InvalidLength, KeyInit, Update}; +use digest::{typenum::Unsigned, FixedOutput, InvalidLength, KeyInit, Update}; #[cfg(feature = "hmac")] use digest::{ block_buffer::Eager, - core_api::{BlockSizeUser, BufferKindUser, CoreProxy, FixedOutputCore, UpdateCore}, - generic_array::typenum::{IsLess, Le, NonZero, U256}, + core_api::{BlockSizeUser, BufferKindUser, FixedOutputCore, UpdateCore}, + typenum::{IsLess, Le, NonZero, U256}, HashMarker, }; @@ -233,7 +233,7 @@ where #[cfg_attr(docsrs, doc(cfg(feature = "hmac")))] pub fn pbkdf2_hmac(password: &[u8], salt: &[u8], rounds: u32, res: &mut [u8]) where - D: CoreProxy, + D: hmac::EagerHash, D::Core: Sync + HashMarker + UpdateCore @@ -265,7 +265,7 @@ where #[cfg_attr(docsrs, doc(cfg(feature = "hmac")))] pub fn pbkdf2_hmac_array(password: &[u8], salt: &[u8], rounds: u32) -> [u8; N] where - D: CoreProxy, + D: hmac::EagerHash, D::Core: Sync + HashMarker + UpdateCore diff --git a/scrypt/Cargo.toml b/scrypt/Cargo.toml index 9540a5c5..7583519c 100644 --- a/scrypt/Cargo.toml +++ b/scrypt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scrypt" -version = "0.11.0" +version = "0.12.0-pre.0" description = "Scrypt password-based key derivation function" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -13,9 +13,9 @@ edition = "2021" rust-version = "1.60" [dependencies] -pbkdf2 = { version = "0.12", path = "../pbkdf2" } +pbkdf2 = { version = "=0.13.0-pre.0", path = "../pbkdf2" } salsa20 = { version = "0.10.2", default-features = false } -sha2 = { version = "0.10", default-features = false } +sha2 = { version = "=0.11.0-pre.3", default-features = false } # optional dependencies password-hash = { version = "0.5", default-features = false, features = ["rand_core"], optional = true } diff --git a/sha-crypt/Cargo.toml b/sha-crypt/Cargo.toml index cbba74ab..e5ad4266 100644 --- a/sha-crypt/Cargo.toml +++ b/sha-crypt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sha-crypt" -version = "0.5.0" +version = "0.6.0-pre.0" description = """ Pure Rust implementation of the SHA-crypt password hash based on SHA-512 as implemented by the POSIX crypt C library @@ -16,7 +16,7 @@ edition = "2021" rust-version = "1.60" [dependencies] -sha2 = { version = "0.10", default-features = false } +sha2 = { version = "=0.11.0-pre.3", default-features = false } # optional dependencies rand = { version = "0.8", optional = true } From 1fc5bfb8a262582bf09b1b3d5b7d4b0d93a2c6da Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Mon, 5 Feb 2024 23:36:13 -0800 Subject: [PATCH 2/3] bump MSRVs --- .github/workflows/argon2.yml | 8 ++++---- .github/workflows/balloon-hash.yml | 4 ++-- .github/workflows/bcrypt-pbkdf.yml | 4 ++-- .github/workflows/password-auth.yml | 4 ++-- .github/workflows/pbkdf2.yml | 4 ++-- .github/workflows/scrypt.yml | 4 ++-- .github/workflows/sha-crypt.yml | 4 ++-- .github/workflows/workspace.yml | 2 +- argon2/Cargo.toml | 2 +- balloon-hash/Cargo.toml | 2 +- bcrypt-pbkdf/Cargo.toml | 2 +- password-auth/Cargo.toml | 2 +- pbkdf2/Cargo.toml | 2 +- scrypt/Cargo.toml | 2 +- sha-crypt/Cargo.toml | 2 +- 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/argon2.yml b/.github/workflows/argon2.yml index 5d372d97..c26614c2 100644 --- a/.github/workflows/argon2.yml +++ b/.github/workflows/argon2.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: rust: - - 1.65.0 # MSRV + - 1.71.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -51,7 +51,7 @@ jobs: include: # 32-bit Linux - target: i686-unknown-linux-gnu - rust: 1.65.0 # MSRV + rust: 1.71.0 # MSRV deps: sudo apt update && sudo apt install gcc-multilib - target: i686-unknown-linux-gnu rust: stable @@ -59,7 +59,7 @@ jobs: # 64-bit Linux - target: x86_64-unknown-linux-gnu - rust: 1.65.0 # MSRV + rust: 1.71.0 # MSRV - target: x86_64-unknown-linux-gnu rust: stable steps: @@ -80,7 +80,7 @@ jobs: matrix: include: - target: powerpc-unknown-linux-gnu - rust: 1.65.0 # MSRV + rust: 1.71.0 # MSRV - target: powerpc-unknown-linux-gnu rust: stable runs-on: ubuntu-latest diff --git a/.github/workflows/balloon-hash.yml b/.github/workflows/balloon-hash.yml index 0493c4d6..c629c614 100644 --- a/.github/workflows/balloon-hash.yml +++ b/.github/workflows/balloon-hash.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: rust: - - 1.65.0 # MSRV + - 1.73.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -48,7 +48,7 @@ jobs: strategy: matrix: rust: - - 1.65.0 # MSRV + - 1.73.0 # MSRV - stable steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/bcrypt-pbkdf.yml b/.github/workflows/bcrypt-pbkdf.yml index 2d211676..b6b861df 100644 --- a/.github/workflows/bcrypt-pbkdf.yml +++ b/.github/workflows/bcrypt-pbkdf.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: rust: - - 1.60.0 # MSRV + - 1.72.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -46,7 +46,7 @@ jobs: strategy: matrix: rust: - - 1.60.0 # MSRV + - 1.72.0 # MSRV - stable steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/password-auth.yml b/.github/workflows/password-auth.yml index aa656fc1..01e30d77 100644 --- a/.github/workflows/password-auth.yml +++ b/.github/workflows/password-auth.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: rust: - - 1.65.0 # MSRV + - 1.72.0 # MSRV - stable steps: - uses: actions/checkout@v4 @@ -45,7 +45,7 @@ jobs: strategy: matrix: rust: - - 1.65.0 # MSRV + - 1.72.0 # MSRV - stable steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/pbkdf2.yml b/.github/workflows/pbkdf2.yml index fcd71e1c..cd2c4457 100644 --- a/.github/workflows/pbkdf2.yml +++ b/.github/workflows/pbkdf2.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: rust: - - 1.60.0 # MSRV + - 1.72.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -47,7 +47,7 @@ jobs: strategy: matrix: rust: - - 1.60.0 # MSRV + - 1.72.0 # MSRV - stable steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/scrypt.yml b/.github/workflows/scrypt.yml index 5fcdcf59..ba66ac54 100644 --- a/.github/workflows/scrypt.yml +++ b/.github/workflows/scrypt.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: rust: - - 1.60.0 # MSRV + - 1.72.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -47,7 +47,7 @@ jobs: strategy: matrix: rust: - - 1.60.0 # MSRV + - 1.72.0 # MSRV - stable steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/sha-crypt.yml b/.github/workflows/sha-crypt.yml index fbd69b59..7dbe564e 100644 --- a/.github/workflows/sha-crypt.yml +++ b/.github/workflows/sha-crypt.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: rust: - - 1.60.0 # MSRV + - 1.72.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -46,7 +46,7 @@ jobs: strategy: matrix: rust: - - 1.60.0 # MSRV + - 1.72.0 # MSRV - stable steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index d99b7c12..6fd9d509 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -17,7 +17,7 @@ jobs: - uses: RustCrypto/actions/cargo-cache@master - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.71.0 + toolchain: 1.73.0 components: clippy - run: cargo clippy --all -- -D warnings diff --git a/argon2/Cargo.toml b/argon2/Cargo.toml index f3f67488..de78c2a1 100644 --- a/argon2/Cargo.toml +++ b/argon2/Cargo.toml @@ -13,7 +13,7 @@ keywords = ["crypto", "hashing", "password", "phf"] categories = ["authentication", "cryptography", "no-std"] readme = "README.md" edition = "2021" -rust-version = "1.65" +rust-version = "1.71" [dependencies] base64ct = "1" diff --git a/balloon-hash/Cargo.toml b/balloon-hash/Cargo.toml index ecc63a00..9fe28c44 100644 --- a/balloon-hash/Cargo.toml +++ b/balloon-hash/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["crypto", "hashing", "password", "phf"] categories = ["authentication", "cryptography", "no-std"] readme = "README.md" edition = "2021" -rust-version = "1.65" +rust-version = "1.73" [dependencies] digest = { version = "=0.11.0-pre.8", default-features = false } diff --git a/bcrypt-pbkdf/Cargo.toml b/bcrypt-pbkdf/Cargo.toml index 5d653db8..29215dfc 100644 --- a/bcrypt-pbkdf/Cargo.toml +++ b/bcrypt-pbkdf/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/RustCrypto/password-hashes/tree/master/bcrypt-p keywords = ["crypto", "hashing", "password", "phf"] categories = ["authentication", "cryptography", "no-std"] edition = "2021" -rust-version = "1.60" +rust-version = "1.72" [dependencies] blowfish = { version = "0.9.1", features = ["bcrypt"] } diff --git a/password-auth/Cargo.toml b/password-auth/Cargo.toml index b3a933eb..976636b7 100644 --- a/password-auth/Cargo.toml +++ b/password-auth/Cargo.toml @@ -13,7 +13,7 @@ keywords = ["crypto", "password", "hashing"] categories = ["authentication", "cryptography", "no-std"] readme = "README.md" edition = "2021" -rust-version = "1.65" +rust-version = "1.72" [dependencies] password-hash = { version = "0.5", features = ["alloc", "rand_core"] } diff --git a/pbkdf2/Cargo.toml b/pbkdf2/Cargo.toml index 8e243f33..e432e3ef 100644 --- a/pbkdf2/Cargo.toml +++ b/pbkdf2/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["crypto", "hashing", "password", "phf"] categories = ["authentication", "cryptography", "no-std"] readme = "README.md" edition = "2021" -rust-version = "1.60" +rust-version = "1.72" [dependencies] digest = { version = "=0.11.0-pre.8", features = ["mac"] } diff --git a/scrypt/Cargo.toml b/scrypt/Cargo.toml index 7583519c..cc28f44d 100644 --- a/scrypt/Cargo.toml +++ b/scrypt/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/RustCrypto/password-hashes/tree/master/scrypt" keywords = ["crypto", "hashing", "password", "phf"] categories = ["authentication", "cryptography", "no-std"] edition = "2021" -rust-version = "1.60" +rust-version = "1.72" [dependencies] pbkdf2 = { version = "=0.13.0-pre.0", path = "../pbkdf2" } diff --git a/sha-crypt/Cargo.toml b/sha-crypt/Cargo.toml index e5ad4266..0417ed9f 100644 --- a/sha-crypt/Cargo.toml +++ b/sha-crypt/Cargo.toml @@ -13,7 +13,7 @@ keywords = ["crypto", "hashing", "password", "phf"] categories = ["authentication", "cryptography", "no-std"] readme = "README.md" edition = "2021" -rust-version = "1.60" +rust-version = "1.72" [dependencies] sha2 = { version = "=0.11.0-pre.3", default-features = false } From 906e0b28cbabad921d9d204448490ffc4b07f8f7 Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Wed, 7 Feb 2024 13:41:27 -0800 Subject: [PATCH 3/3] Bump `blake2` to `=0.11.0-pre.3` --- Cargo.toml | 3 --- argon2/Cargo.toml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5557a64e..4175fea8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,3 @@ exclude = ["benches"] [profile.dev] opt-level = 2 - -[patch.crates-io] -blake2 = { git = "https://github.com/RustCrypto/hashes.git" } diff --git a/argon2/Cargo.toml b/argon2/Cargo.toml index de78c2a1..5cd8356f 100644 --- a/argon2/Cargo.toml +++ b/argon2/Cargo.toml @@ -17,7 +17,7 @@ rust-version = "1.71" [dependencies] base64ct = "1" -blake2 = { version = "0.11.0-pre", default-features = false } +blake2 = { version = "=0.11.0-pre.3", default-features = false } # optional dependencies password-hash = { version = "0.5", optional = true }