Merge changes to aes_ctr
This commit is contained in:
commit
1e4d04552e
3 changed files with 13 additions and 8 deletions
|
@ -158,4 +158,10 @@
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- New method `with_alignment` on `FileOptions`.
|
- New method `with_alignment` on `FileOptions`.
|
||||||
|
|
||||||
|
## [0.8.3]
|
||||||
|
|
||||||
|
### Merged from upstream
|
||||||
|
|
||||||
|
- Uses the `aes::cipher::KeyInit` trait from `aes` 0.8.2 where appropriate.
|
||||||
|
|
|
@ -2,13 +2,12 @@
|
||||||
//!
|
//!
|
||||||
//! This was implemented since the zip specification requires the mode to not use a nonce and uses a
|
//! 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).
|
//! 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;
|
use aes::cipher;
|
||||||
use aes::cipher::generic_array::GenericArray;
|
use aes::cipher::generic_array::GenericArray;
|
||||||
use aes::cipher::{BlockCipher, BlockEncrypt};
|
use aes::cipher::{BlockEncrypt, KeyInit};
|
||||||
use byteorder::WriteBytesExt;
|
use byteorder::WriteBytesExt;
|
||||||
use cipher::KeyInit;
|
|
||||||
use std::{any, fmt};
|
use std::{any, fmt};
|
||||||
|
|
||||||
/// Internal block size of an AES cipher.
|
/// Internal block size of an AES cipher.
|
||||||
|
@ -84,7 +83,7 @@ where
|
||||||
impl<C> AesCtrZipKeyStream<C>
|
impl<C> AesCtrZipKeyStream<C>
|
||||||
where
|
where
|
||||||
C: AesKind,
|
C: AesKind,
|
||||||
C::Cipher: BlockCipher,
|
C::Cipher: KeyInit,
|
||||||
{
|
{
|
||||||
/// Creates a new zip variant AES-CTR key stream.
|
/// Creates a new zip variant AES-CTR key stream.
|
||||||
///
|
///
|
||||||
|
@ -152,14 +151,14 @@ fn xor(dest: &mut [u8], src: &[u8]) {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{Aes128, Aes192, Aes256, AesCipher, AesCtrZipKeyStream, AesKind};
|
use super::{Aes128, Aes192, Aes256, AesCipher, AesCtrZipKeyStream, AesKind};
|
||||||
use aes::cipher::{BlockCipher, BlockEncrypt};
|
use aes::cipher::{BlockEncrypt, KeyInit};
|
||||||
|
|
||||||
/// Checks whether `crypt_in_place` produces the correct plaintext after one use and yields the
|
/// Checks whether `crypt_in_place` produces the correct plaintext after one use and yields the
|
||||||
/// cipertext again after applying it again.
|
/// cipertext again after applying it again.
|
||||||
fn roundtrip<Aes>(key: &[u8], ciphertext: &mut [u8], expected_plaintext: &[u8])
|
fn roundtrip<Aes>(key: &[u8], ciphertext: &mut [u8], expected_plaintext: &[u8])
|
||||||
where
|
where
|
||||||
Aes: AesKind,
|
Aes: AesKind,
|
||||||
Aes::Cipher: BlockCipher + BlockEncrypt,
|
Aes::Cipher: KeyInit + BlockEncrypt,
|
||||||
{
|
{
|
||||||
let mut key_stream = AesCtrZipKeyStream::<Aes>::new(key);
|
let mut key_stream = AesCtrZipKeyStream::<Aes>::new(key);
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,6 @@ mod zipcrypto;
|
||||||
///
|
///
|
||||||
/// ```toml
|
/// ```toml
|
||||||
/// [dependencies]
|
/// [dependencies]
|
||||||
/// zip = "=0.6.5"
|
/// zip_next = "=0.8.3"
|
||||||
/// ```
|
/// ```
|
||||||
pub mod unstable;
|
pub mod unstable;
|
||||||
|
|
Loading…
Add table
Reference in a new issue