Skip to content

Commit

Permalink
bump aes and block-modes
Browse files Browse the repository at this point in the history
  • Loading branch information
s3bk committed Sep 24, 2021
1 parent 9e56f00 commit 316168c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pdf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ log = "0.4.14"
tempfile = { version = "3.2.0", optional = true }
md5 = "0.7"
jpeg-decoder = { version = "0.1", default-features = false }
aes = "0.6.0"
block-modes = "0.7.0"
aes = "0.7.5"
block-modes = "0.8.1"
stringprep = "0.1.2"
sha2 = "0.9.2"
fax = "0.1.0"
Expand Down
6 changes: 3 additions & 3 deletions pdf/src/crypt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// PDF "cryptography" – This is why you don't write your own crypto.
use crate as pdf;
use aes::cipher::block::generic_array::{sequence::Split, GenericArray};
use aes::cipher::generic_array::{sequence::Split, GenericArray};
use aes::{Aes128, Aes256, NewBlockCipher};
use block_modes::block_padding::{NoPadding, Pkcs7};
use block_modes::{BlockMode, Cbc};
Expand Down Expand Up @@ -583,7 +583,7 @@ impl Decoder {
}
let (iv, ciphertext) = data.split_at_mut(16);
let cipher =
t!(Aes128Cbc::new_var(key, iv).map_err(|_| PdfError::DecryptionFailure));
t!(Aes128Cbc::new_from_slices(key, iv).map_err(|_| PdfError::DecryptionFailure));
Ok(t!(cipher
.decrypt(ciphertext)
.map_err(|_| PdfError::DecryptionFailure)))
Expand All @@ -595,7 +595,7 @@ impl Decoder {
}
let (iv, ciphertext) = data.split_at_mut(16);
let cipher =
t!(Aes256Cbc::new_var(self.key(), iv).map_err(|_| PdfError::DecryptionFailure));
t!(Aes256Cbc::new_from_slices(self.key(), iv).map_err(|_| PdfError::DecryptionFailure));
Ok(t!(cipher
.decrypt(ciphertext)
.map_err(|_| PdfError::DecryptionFailure)))
Expand Down

0 comments on commit 316168c

Please # to comment.