Skip to content

Commit

Permalink
Merge pull request zip-rs#354 from zip-rs/aes-bump
Browse files Browse the repository at this point in the history
update aes to 0.8
  • Loading branch information
Plecra authored May 16, 2023
2 parents 13a19f6 + 7fe6560 commit 4b8f99c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ edition = "2021"
rust-version = "1.59.0"

[dependencies]
aes = { version = "0.7.5", optional = true }
aes = { version = "0.8.2", optional = true }
byteorder = "1.4.3"
bzip2 = { version = "0.4.3", optional = true }
constant_time_eq = { version = "0.1.5", optional = true }
Expand Down
11 changes: 6 additions & 5 deletions src/aes_ctr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
//!
//! This was implemented since the zip specification requires the mode to not use a nonce and uses a
//! different byte order (little endian) than NIST (big endian).
//! See [AesCtrZipKeyStream](./struct.AesCtrZipKeyStream.html) for more information.
//! See [AesCtrZipKeyStream] for more information.

use aes::cipher::generic_array::GenericArray;
use aes::{BlockEncrypt, NewBlockCipher};
// use aes::{BlockEncrypt, NewBlockCipher};
use aes::cipher::{BlockEncrypt, KeyInit};
use byteorder::WriteBytesExt;
use std::{any, fmt};

Expand Down Expand Up @@ -82,7 +83,7 @@ where
impl<C> AesCtrZipKeyStream<C>
where
C: AesKind,
C::Cipher: NewBlockCipher,
C::Cipher: KeyInit,
{
/// Creates a new zip variant AES-CTR key stream.
///
Expand Down Expand Up @@ -150,14 +151,14 @@ fn xor(dest: &mut [u8], src: &[u8]) {
#[cfg(test)]
mod tests {
use super::{Aes128, Aes192, Aes256, AesCipher, AesCtrZipKeyStream, AesKind};
use aes::{BlockEncrypt, NewBlockCipher};
use aes::cipher::{BlockEncrypt, KeyInit};

/// Checks whether `crypt_in_place` produces the correct plaintext after one use and yields the
/// cipertext again after applying it again.
fn roundtrip<Aes>(key: &[u8], ciphertext: &mut [u8], expected_plaintext: &[u8])
where
Aes: AesKind,
Aes::Cipher: NewBlockCipher + BlockEncrypt,
Aes::Cipher: KeyInit + BlockEncrypt,
{
let mut key_stream = AesCtrZipKeyStream::<Aes>::new(key);

Expand Down

0 comments on commit 4b8f99c

Please sign in to comment.