From 5532fd6f09eb4c9d61a05dacf85d3b62677a332e Mon Sep 17 00:00:00 2001 From: Lireer Date: Wed, 14 Oct 2020 15:08:10 +0200 Subject: [PATCH] Document aes related modules --- src/aes.rs | 6 ++++++ src/aes_ctr.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/aes.rs b/src/aes.rs index 7847df01..8baa796c 100644 --- a/src/aes.rs +++ b/src/aes.rs @@ -1,3 +1,9 @@ +//! Implementation of the AES decryption for zip files. +//! +//! This was implemented according to the [WinZip specification](https://www.winzip.com/win/en/aes_info.html). +//! Note that using CRC with AES depends on the specific encryption specification used, AE-1 or AE-2. +//! AE-2 doesn't set the CRC field correctly, even though some zip files still have CRC set even with AE-2. + use crate::aes_ctr; use constant_time_eq::constant_time_eq; use hmac::{Hmac, Mac, NewMac}; diff --git a/src/aes_ctr.rs b/src/aes_ctr.rs index 1497a287..e23eb3bb 100644 --- a/src/aes_ctr.rs +++ b/src/aes_ctr.rs @@ -1,3 +1,9 @@ +//! A counter mode (CTR) for AES to work with the encryption used in zip files. +//! +//! 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. + use aes::block_cipher::generic_array::GenericArray; use aes::{BlockCipher, NewBlockCipher}; use byteorder::WriteBytesExt;