Skip to content
Open
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
6 changes: 2 additions & 4 deletions src/aes_ctr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//! See [AesCtrZipKeyStream] for more information.

use crate::unstable::LittleEndianWriteExt;
use aes::cipher::generic_array::GenericArray;
use aes::cipher::{BlockEncrypt, KeyInit};
use std::{any, fmt};

Expand Down Expand Up @@ -92,7 +91,7 @@ where
pub fn new(key: &[u8]) -> AesCtrZipKeyStream<C> {
AesCtrZipKeyStream {
counter: 1,
cipher: C::Cipher::new(GenericArray::from_slice(key)),
cipher: C::Cipher::new(key.try_into().expect("invalid key length")),
buffer: [0u8; AES_BLOCK_SIZE],
pos: AES_BLOCK_SIZE,
}
Expand All @@ -114,8 +113,7 @@ where
.as_mut()
.write_u128_le(self.counter)
.expect("did not expect u128 le conversion to fail");
self.cipher
.encrypt_block(GenericArray::from_mut_slice(&mut self.buffer));
self.cipher.encrypt_block(&mut self.buffer);
self.counter += 1;
self.pos = 0;
}
Expand Down
Loading