diff --git a/repak/src/entry.rs b/repak/src/entry.rs index 64ffd03..980d780 100644 --- a/repak/src/entry.rs +++ b/repak/src/entry.rs @@ -310,7 +310,7 @@ impl Entry { &self, reader: &mut R, version: Version, - key: Option<&aes::Aes256Dec>, + key: Option<&aes::Aes256>, buf: &mut W, ) -> Result<(), super::Error> { reader.seek(io::SeekFrom::Start(self.offset))?; diff --git a/repak/src/pak.rs b/repak/src/pak.rs index 632f9d1..9ecdb07 100644 --- a/repak/src/pak.rs +++ b/repak/src/pak.rs @@ -1,6 +1,6 @@ use super::ext::{ReadExt, WriteExt}; use super::{Version, VersionMajor}; -use aes::Aes256Enc; +use aes::Aes256; use byteorder::{ReadBytesExt, WriteBytesExt, LE}; use std::collections::BTreeMap; use std::io::{self, Read, Seek, Write}; @@ -8,14 +8,14 @@ use std::io::{self, Read, Seek, Write}; #[derive(Debug)] pub struct PakReader { pak: Pak, - key: Option, + key: Option, } #[derive(Debug)] pub struct PakWriter { pak: Pak, writer: W, - key: Option, + key: Option, } #[derive(Debug)] @@ -62,7 +62,7 @@ impl Index { } } -fn decrypt(key: &Option, bytes: &mut [u8]) -> Result<(), super::Error> { +fn decrypt(key: &Option, bytes: &mut [u8]) -> Result<(), super::Error> { if let Some(key) = &key { use aes::cipher::BlockDecrypt; for chunk in bytes.chunks_mut(16) { @@ -77,7 +77,7 @@ fn decrypt(key: &Option, bytes: &mut [u8]) -> Result<(), super:: impl PakReader { pub fn new_any( mut reader: R, - key: Option, + key: Option, ) -> Result { for ver in Version::iter() { match Pak::read(&mut reader, ver, key.clone()) { @@ -124,7 +124,7 @@ impl PakReader { impl PakWriter { pub fn new( writer: W, - key: Option, + key: Option, version: Version, mount_point: String, path_hash_seed: Option, @@ -185,7 +185,7 @@ impl Pak { fn read( mut reader: R, version: super::Version, - key: Option, + key: Option, ) -> Result { // read footer to get index, encryption & compression info reader.seek(io::SeekFrom::End(-version.size()))?; @@ -316,7 +316,7 @@ impl Pak { fn write( &self, writer: &mut W, - _key: Option, + _key: Option, ) -> Result<(), super::Error> { let index_offset = writer.stream_position()?; @@ -548,7 +548,7 @@ fn pad_zeros_to_alignment(v: &mut Vec, alignment: usize) { assert!(v.len() % alignment == 0); } -fn encrypt(key: Aes256Enc, bytes: &mut [u8]) { +fn encrypt(key: Aes256, bytes: &mut [u8]) { use aes::cipher::BlockEncrypt; for chunk in bytes.chunks_mut(16) { key.encrypt_block(aes::Block::from_mut_slice(chunk)) diff --git a/repak/tests/test.rs b/repak/tests/test.rs index cc1bde6..3d0ea9d 100644 --- a/repak/tests/test.rs +++ b/repak/tests/test.rs @@ -113,7 +113,7 @@ macro_rules! mt_encryptindex_read { .as_ref() .map_err(|_| repak::Error::Base64) .and_then(|bytes| { - aes::Aes256Dec::new_from_slice(bytes).map_err(|_| repak::Error::Aes) + aes::Aes256::new_from_slice(bytes).map_err(|_| repak::Error::Aes) }).unwrap(); @@ -199,7 +199,7 @@ macro_rules! mt_encryptindex_write { .as_ref() .map_err(|_| repak::Error::Base64) .and_then(|bytes| { - aes::Aes256Dec::new_from_slice(bytes).map_err(|_| repak::Error::Aes) + aes::Aes256::new_from_slice(bytes).map_err(|_| repak::Error::Aes) }).unwrap(); let mut reader = std::io::Cursor::new(include_bytes!(concat!("packs/pack_", $version, $compress, $encrypt, $encryptindex, ".pak"))); diff --git a/repak_cli/src/main.rs b/repak_cli/src/main.rs index 2cffcbd..a4d5c27 100644 --- a/repak_cli/src/main.rs +++ b/repak_cli/src/main.rs @@ -117,14 +117,14 @@ fn main() -> Result<(), repak::Error> { } } -fn aes_key(key: &str) -> Result { +fn aes_key(key: &str) -> Result { use aes::cipher::KeyInit; use base64::{engine::general_purpose, Engine as _}; general_purpose::STANDARD .decode(key) .as_ref() .map_err(|_| repak::Error::Base64) - .and_then(|bytes| aes::Aes256Dec::new_from_slice(bytes).map_err(|_| repak::Error::Aes)) + .and_then(|bytes| aes::Aes256::new_from_slice(bytes).map_err(|_| repak::Error::Aes)) } fn info(args: ActionInfo) -> Result<(), repak::Error> {