Skip to content

Commit

Permalink
bump dependencies to pre-releases
Browse files Browse the repository at this point in the history
  • Loading branch information
baloo committed Mar 4, 2024
1 parent 8abfc94 commit e9206c0
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 175 deletions.
266 changes: 126 additions & 140 deletions Cargo.lock

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,40 @@ members = [

[profile.dev]
opt-level = 2

[patch.crates-io]
p256 = { git = "https://github.com/RustCrypto/elliptic-curves.git" }
p384 = { git = "https://github.com/RustCrypto/elliptic-curves.git" }
p521 = { git = "https://github.com/RustCrypto/elliptic-curves.git" }

ed25519 = { git = "https://github.com/baloo/signatures.git", branch = "baloo/pkcs8-0.11.0-pre.0" }
ed25519-dalek = { git = "https://github.com/baloo/curve25519-dalek.git", branch = "baloo/rust-crypto/digest-sha2-bumps" }

dsa = { git = "https://github.com/RustCrypto/signatures.git" }

# https://github.com/RustCrypto/password-hashes/pull/489
bcrypt-pbkdf = { git = "https://github.com/baloo/password-hashes.git", branch = "baloo/cipher/0.5.0-pre.4" }

# https://github.com/RustCrypto/stream-ciphers/pull/344
chacha20 = { git = "https://github.com/baloo/stream-ciphers.git", branch = "baloo/cipher-0.5.0-pre.4" }

# https://github.com/RustCrypto/block-ciphers/pull/413
aes = { git = "https://github.com/baloo/block-ciphers.git", branch = "baloo/bump-cipher/0.5.0-pre.4" }
blowfish = { git = "https://github.com/baloo/block-ciphers.git", branch = "baloo/bump-cipher/0.5.0-pre.4" }
des = { git = "https://github.com/baloo/block-ciphers.git", branch = "baloo/bump-cipher/0.5.0-pre.4" }

# https://github.com/RustCrypto/block-modes/pull/56
cbc = { git = "https://github.com/baloo/block-modes.git", branch = "baloo/bump-prereleases" }
ctr = { git = "https://github.com/baloo/block-modes.git", branch = "baloo/bump-prereleases" }

# https://github.com/RustCrypto/AEADs/pull/583
aes-gcm = { git = "https://github.com/baloo/AEADs.git", branch = "baloo/bump-cipher" }

# https://github.com/RustCrypto/universal-hashes/pull/196
ghash = { git = "https://github.com/baloo/universal-hashes.git", branch = "baloo/pre-releases" }
poly1305 = { git = "https://github.com/baloo/universal-hashes.git", branch = "baloo/pre-releases" }

aead = { git = "https://github.com/RustCrypto/traits.git", branch = "master" }
universal-hash = { git = "https://github.com/RustCrypto/traits.git", branch = "master" }


16 changes: 8 additions & 8 deletions ssh-cipher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ edition = "2021"
rust-version = "1.60"

[dependencies]
cipher = "0.4"
cipher = "0.5.0-pre.4"
encoding = { package = "ssh-encoding", version = "0.2", path = "../ssh-encoding" }

# optional dependencies
aes = { version = "0.8", optional = true, default-features = false }
aes-gcm = { version = "0.10", optional = true, default-features = false, features = ["aes"] }
cbc = { version = "0.1", optional = true }
ctr = { version = "0.9", optional = true, default-features = false }
chacha20 = { version = "0.9", optional = true, default-features = false }
des = { version = "0.8", optional = true, default-features = false }
poly1305 = { version = "0.8", optional = true, default-features = false }
aes = { version = "=0.9.0-pre", optional = true, default-features = false }
aes-gcm = { version = "=0.11.0-pre", optional = true, default-features = false, features = ["aes"] }
cbc = { version = "=0.2.0-pre", optional = true }
ctr = { version = "=0.10.0-pre", optional = true, default-features = false }
chacha20 = { version = "=0.10.0-pre", optional = true, default-features = false }
des = { version = "=0.9.0-pre", optional = true, default-features = false }
poly1305 = { version = "=0.9.0-pre", optional = true, default-features = false }
subtle = { version = "2", optional = true, default-features = false }

[features]
Expand Down
13 changes: 8 additions & 5 deletions ssh-cipher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ use aes::{Aes128, Aes192, Aes256};
#[cfg(any(feature = "aes-cbc", feature = "tdes"))]
use {
cbc::{Decryptor, Encryptor},
cipher::{block_padding::NoPadding, BlockCipher, BlockDecryptMut, BlockEncryptMut},
cipher::{
block_padding::NoPadding, BlockCipher, BlockCipherDecrypt, BlockCipherEncrypt,
BlockModeDecrypt, BlockModeEncrypt,
},
};

#[cfg(any(feature = "aes-cbc", feature = "aes-gcm", feature = "tdes"))]
Expand Down Expand Up @@ -418,13 +421,13 @@ impl str::FromStr for Cipher {
#[cfg(any(feature = "aes-cbc", feature = "tdes"))]
fn cbc_encrypt<C>(key: &[u8], iv: &[u8], buffer: &mut [u8]) -> Result<()>
where
C: BlockEncryptMut + BlockCipher + KeyInit,
C: BlockCipherEncrypt + BlockCipher + KeyInit,
{
let cipher = Encryptor::<C>::new_from_slices(key, iv).map_err(|_| Error::KeySize)?;

// Since the passed in buffer is already padded, using NoPadding here
cipher
.encrypt_padded_mut::<NoPadding>(buffer, buffer.len())
.encrypt_padded::<NoPadding>(buffer, buffer.len())
.map_err(|_| Error::Crypto)?;

Ok(())
Expand All @@ -433,13 +436,13 @@ where
#[cfg(any(feature = "aes-cbc", feature = "tdes"))]
fn cbc_decrypt<C>(key: &[u8], iv: &[u8], buffer: &mut [u8]) -> Result<()>
where
C: BlockDecryptMut + BlockCipher + KeyInit,
C: BlockCipherDecrypt + BlockCipher + KeyInit,
{
let cipher = Decryptor::<C>::new_from_slices(key, iv).map_err(|_| Error::KeySize)?;

// Since the passed in buffer is already padded, using NoPadding here
cipher
.decrypt_padded_mut::<NoPadding>(buffer)
.decrypt_padded::<NoPadding>(buffer)
.map_err(|_| Error::Crypto)?;

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions ssh-encoding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ rust-version = "1.60"
[dependencies]
base64 = { package = "base64ct", version = "1.4", optional = true }
bytes = { version = "1", optional = true, default-features = false }
pem = { package = "pem-rfc7468", version = "0.7", optional = true }
sha2 = { version = "0.10", optional = true, default-features = false }
pem = { package = "pem-rfc7468", version = "=1.0.0-pre.0", optional = true }
sha2 = { version = "=0.11.0-pre.3", optional = true, default-features = false }

[dev-dependencies]
hex-literal = "0.4.1"
Expand Down
2 changes: 1 addition & 1 deletion ssh-encoding/tests/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn encode_byte_slice() {
#[test]
fn encode_byte_vec() {
let mut out = Vec::new();
Vec::from(b"example".as_ref()).encode(&mut out).unwrap();
Vec::from(b"example").encode(&mut out).unwrap();
assert_eq!(out, hex!("000000076578616d706c65"));
}

Expand Down
22 changes: 11 additions & 11 deletions ssh-key/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ rust-version = "1.65"
[dependencies]
cipher = { package = "ssh-cipher", version = "0.2", path = "../ssh-cipher" }
encoding = { package = "ssh-encoding", version = "0.2", features = ["base64", "pem", "sha2"], path = "../ssh-encoding" }
sha2 = { version = "0.10.8", default-features = false }
signature = { version = "2", default-features = false }
sha2 = { version = "=0.11.0-pre.3", default-features = false }
signature = { version = "=2.3.0-pre.3", default-features = false }
subtle = { version = "2", default-features = false }
zeroize = { version = "1", default-features = false }

# optional dependencies
bcrypt-pbkdf = { version = "0.10", optional = true, default-features = false, features = ["alloc"] }
bcrypt-pbkdf = { version = "=0.11.0-pre.0", optional = true, default-features = false, features = ["alloc"] }
bigint = { package = "num-bigint-dig", version = "0.8", optional = true, default-features = false }
dsa = { version = "0.6", optional = true, default-features = false }
ed25519-dalek = { version = "2", optional = true, default-features = false }
p256 = { version = "0.13", optional = true, default-features = false, features = ["ecdsa"] }
p384 = { version = "0.13", optional = true, default-features = false, features = ["ecdsa"] }
p521 = { version = "0.13.3", optional = true, default-features = false, features = ["ecdsa", "getrandom"] } # TODO(tarcieri): RFC6979
dsa = { version = "=0.7.0-pre", optional = true, default-features = false }
ed25519-dalek = { version = "=2.2.0-pre", optional = true, default-features = false }
p256 = { version = "=0.14.0-pre.0", optional = true, default-features = false, features = ["ecdsa"] }
p384 = { version = "=0.14.0-pre", optional = true, default-features = false, features = ["ecdsa"] }
p521 = { version = "=0.14.0-pre", optional = true, default-features = false, features = ["ecdsa", "getrandom"] } # TODO(tarcieri): RFC6979
rand_core = { version = "0.6.4", optional = true, default-features = false }
rsa = { version = "0.9", optional = true, default-features = false, features = ["sha2"] }
sec1 = { version = "0.7.3", optional = true, default-features = false, features = ["point"] }
rsa = { version = "=0.10.0-pre.1", optional = true, default-features = false, features = ["sha2"] }
sec1 = { version = "=0.8.0-pre.1", optional = true, default-features = false, features = ["point"] }
serde = { version = "1", optional = true }
sha1 = { version = "0.10", optional = true, default-features = false }
sha1 = { version = "=0.11.0-pre.3", optional = true, default-features = false }

[dev-dependencies]
hex-literal = "0.4.1"
Expand Down
12 changes: 6 additions & 6 deletions ssh-key/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
//! if let Some(ed25519_public_key) = public_key.key_data().ed25519() {
//! assert_eq!(
//! ed25519_public_key.as_ref(),
//! [
//! &[
//! 0xb3, 0x3e, 0xae, 0xf3, 0x7e, 0xa2, 0xdf, 0x7c, 0xaa, 0x1, 0xd, 0xef, 0xde, 0xa3,
//! 0x4e, 0x24, 0x1f, 0x65, 0xf1, 0xb5, 0x29, 0xa4, 0xf4, 0x3e, 0xd1, 0x43, 0x27, 0xf5,
//! 0xc5, 0x4a, 0xab, 0x62
//! ].as_ref()
//! ]
//! );
//! }
//! # Ok(())
Expand Down Expand Up @@ -103,20 +103,20 @@
//! if let Some(ed25519_keypair) = private_key.key_data().ed25519() {
//! assert_eq!(
//! ed25519_keypair.public.as_ref(),
//! [
//! &[
//! 0xb3, 0x3e, 0xae, 0xf3, 0x7e, 0xa2, 0xdf, 0x7c, 0xaa, 0x1, 0xd, 0xef, 0xde, 0xa3,
//! 0x4e, 0x24, 0x1f, 0x65, 0xf1, 0xb5, 0x29, 0xa4, 0xf4, 0x3e, 0xd1, 0x43, 0x27, 0xf5,
//! 0xc5, 0x4a, 0xab, 0x62
//! ].as_ref()
//! ]
//! );
//!
//! assert_eq!(
//! ed25519_keypair.private.as_ref(),
//! [
//! &[
//! 0xb6, 0x6, 0xc2, 0x22, 0xd1, 0xc, 0x16, 0xda, 0xe1, 0x6c, 0x70, 0xa4, 0xd4, 0x51,
//! 0x73, 0x47, 0x2e, 0xc6, 0x17, 0xe0, 0x5c, 0x65, 0x69, 0x20, 0xd2, 0x6e, 0x56, 0xc0,
//! 0x8f, 0xb5, 0x91, 0xed
//! ].as_ref()
//! ]
//! )
//! }
//! # Ok(())
Expand Down
2 changes: 1 addition & 1 deletion ssh-key/src/private/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl Encode for Ed25519Keypair {

fn encode(&self, writer: &mut impl Writer) -> encoding::Result<()> {
self.public.encode(writer)?;
Zeroizing::new(self.to_bytes()).as_ref().encode(writer)?;
Zeroizing::new(self.to_bytes()).as_slice().encode(writer)?;
Ok(())
}
}
Expand Down
2 changes: 1 addition & 1 deletion ssh-key/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ mod tests {
#[cfg(feature = "p256")]
#[test]
fn convert_ecdsa_sha2_p256() {
let p256_signature = p256::ecdsa::Signature::try_from(hex!("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001").as_ref()).unwrap();
let p256_signature = p256::ecdsa::Signature::try_from(&hex!("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001")[..]).unwrap();
let _ssh_signature = Signature::try_from(p256_signature).unwrap();
}

Expand Down

0 comments on commit e9206c0

Please sign in to comment.