Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

update aes to 0.8 #354

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Library to support the reading and writing of zip files.
edition = "2018"

[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};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove unused commented code.

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