Skip to content

Commit

Permalink
bump cipher to 0.5.0-pre.7 (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
baloo authored Sep 30, 2024
1 parent 8da5f8a commit d2effd1
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 27 deletions.
26 changes: 12 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ x509-ocsp = { path = "./x509-ocsp" }

# Temp patches to external crates
rsa = { git = "https://github.com/RustCrypto/RSA" }

# https://github.com/RustCrypto/AEADs/pull/632
aes-gcm = { git = "https://github.com/RustCrypto/AEADs.git" }
# https://github.com/RustCrypto/stream-ciphers/pull/368
salsa20 = { git = "https://github.com/RustCrypto/stream-ciphers.git" }
6 changes: 3 additions & 3 deletions cms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ x509-cert = { version = "=0.3.0-pre", default-features = false, features = ["pem
const-oid = { version = "0.10.0-rc.0", features = ["db"] }

# optional dependencies
aes = { version = "=0.9.0-pre.1", optional = true }
aes = { version = "=0.9.0-pre.2", optional = true }
async-signature = { version = "=0.6.0-pre.4", features = ["digest", "rand_core"], optional = true }
cbc = { version = "=0.2.0-pre.1", optional = true }
cipher = { version = "=0.5.0-pre.6", features = ["alloc", "block-padding", "rand_core"], optional = true }
cbc = { version = "=0.2.0-pre.2", optional = true }
cipher = { version = "=0.5.0-pre.7", features = ["alloc", "block-padding", "rand_core"], optional = true }
rsa = { version = "=0.10.0-pre.2", optional = true }
sha1 = { version = "=0.11.0-pre.4", optional = true }
sha2 = { version = "=0.11.0-pre.4", optional = true }
Expand Down
6 changes: 3 additions & 3 deletions pkcs5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ der = { version = "0.8.0-rc.0", features = ["oid"] }
spki = { version = "0.8.0-rc.0" }

# optional dependencies
cbc = { version = "=0.2.0-pre.1", optional = true }
aes = { version = "=0.9.0-pre.1", optional = true, default-features = false }
cbc = { version = "=0.2.0-pre.2", optional = true }
aes = { version = "=0.9.0-pre.2", optional = true, default-features = false }
aes-gcm = { version = "=0.11.0-pre.1", optional = true, default-features = false, features = ["aes"] }
des = { version = "=0.9.0-pre.1", optional = true, default-features = false }
des = { version = "=0.9.0-pre.2", optional = true, default-features = false }
pbkdf2 = { version = "=0.13.0-pre.1", optional = true, default-features = false, features = ["hmac"] }
rand_core = { version = "0.6.4", optional = true, default-features = false }
scrypt = { version = "=0.12.0-pre.1", optional = true, default-features = false }
Expand Down
14 changes: 7 additions & 7 deletions pkcs5/src/pbes2/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{EncryptionScheme, Kdf, Parameters, Pbkdf2Params, Pbkdf2Prf, ScryptPa
use crate::{Error, Result};
use aes_gcm::{AeadInPlace, KeyInit as GcmKeyInit, Nonce, Tag};
use cbc::cipher::{
block_padding::Pkcs7, BlockCipher, BlockCipherDecrypt, BlockCipherEncrypt, BlockModeDecrypt,
block_padding::Pkcs7, BlockCipherDecrypt, BlockCipherEncrypt, BlockModeDecrypt,
BlockModeEncrypt, KeyInit, KeyIvInit,
};
use pbkdf2::{
Expand All @@ -24,7 +24,7 @@ use scrypt::scrypt;
/// Maximum size of a derived encryption key
const MAX_KEY_LEN: usize = 32;

fn cbc_encrypt<'a, C: BlockCipherEncrypt + BlockCipher + KeyInit>(
fn cbc_encrypt<'a, C: BlockCipherEncrypt + KeyInit>(
es: EncryptionScheme,
key: EncryptionKey,
iv: &[u8],
Expand All @@ -37,7 +37,7 @@ fn cbc_encrypt<'a, C: BlockCipherEncrypt + BlockCipher + KeyInit>(
.map_err(|_| Error::EncryptFailed)
}

fn cbc_decrypt<'a, C: BlockCipherDecrypt + BlockCipher + KeyInit>(
fn cbc_decrypt<'a, C: BlockCipherDecrypt + KeyInit>(
es: EncryptionScheme,
key: EncryptionKey,
iv: &[u8],
Expand All @@ -57,10 +57,10 @@ fn gcm_encrypt<C, NonceSize, TagSize>(
pos: usize,
) -> Result<&[u8]>
where
C: BlockCipher + BlockSizeUser<BlockSize = U16> + GcmKeyInit + BlockCipherEncrypt,
C: BlockSizeUser<BlockSize = U16> + GcmKeyInit + BlockCipherEncrypt,
aes_gcm::AesGcm<C, NonceSize, TagSize>: GcmKeyInit,
TagSize: aes_gcm::TagSize,
NonceSize: aes::cipher::ArraySize,
NonceSize: aes::cipher::array::ArraySize,
{
if buffer.len() < TagSize::USIZE + pos {
return Err(Error::EncryptFailed);
Expand All @@ -82,10 +82,10 @@ fn gcm_decrypt<C, NonceSize, TagSize>(
buffer: &mut [u8],
) -> Result<&[u8]>
where
C: BlockCipher + BlockSizeUser<BlockSize = U16> + GcmKeyInit + BlockCipherEncrypt,
C: BlockSizeUser<BlockSize = U16> + GcmKeyInit + BlockCipherEncrypt,
aes_gcm::AesGcm<C, NonceSize, TagSize>: GcmKeyInit,
TagSize: aes_gcm::TagSize,
NonceSize: aes::cipher::ArraySize,
NonceSize: aes::cipher::array::ArraySize,
{
let msg_len = buffer
.len()
Expand Down

0 comments on commit d2effd1

Please sign in to comment.