Update aes and xts-mode

This commit is contained in:
Jeremy Soller
2025-07-02 12:48:39 -06:00
parent bd6efe0c83
commit dc25344b68
4 changed files with 35 additions and 22 deletions
Generated
+17 -14
View File
@@ -4,14 +4,13 @@ version = 4
[[package]]
name = "aes"
version = "0.7.5"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
dependencies = [
"cfg-if",
"cipher",
"cpufeatures",
"opaque-debug",
]
[[package]]
@@ -127,11 +126,12 @@ checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]]
name = "cipher"
version = "0.3.0"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7"
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
dependencies = [
"generic-array",
"crypto-common",
"inout",
]
[[package]]
@@ -256,6 +256,15 @@ dependencies = [
"wasi 0.14.2+wasi-0.2.4",
]
[[package]]
name = "inout"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
dependencies = [
"generic-array",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
@@ -333,12 +342,6 @@ version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
[[package]]
name = "opaque-debug"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
name = "page_size"
version = "0.6.0"
@@ -725,9 +728,9 @@ dependencies = [
[[package]]
name = "xts-mode"
version = "0.4.1"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75a099a2f21d48275314733f85bc43b6c6213b66394233aaea573fc7a520dcd9"
checksum = "09cbddb7545ca0b9ffa7bdc653e8743303e1712687a6918ced25f2cdbed42520"
dependencies = [
"byteorder",
"cipher",
+2 -5
View File
@@ -31,7 +31,7 @@ doc = false
required-features = ["std"]
[dependencies]
aes = { version = "=0.7.5", default-features = false }
aes = { version = "0.8", default-features = false }
argon2 = { version = "0.4", default-features = false, features = ["alloc"] }
base64ct = { version = "1", default-features = false }
endian-num = "0.1"
@@ -47,13 +47,10 @@ redox_syscall = { version = "0.5.13" }
seahash = { version = "4.1.0", default-features = false }
termion = { version = "4", optional = true }
uuid = { version = "1.4", default-features = false }
xts-mode = { version = "=0.4.1", default-features = false }
xts-mode = { version = "0.5", default-features = false }
[features]
default = ["std", "log"]
force-soft = [
"aes/force-soft"
]
std = [
"env_logger",
"fuser",
+12 -2
View File
@@ -99,7 +99,12 @@ impl Header {
}
if let Some(cipher) = cipher_opt {
let mut block = aes::Block::from(encrypted_hash);
cipher.encrypt_area(&mut block, BLOCK_SIZE as usize, self.generation().into(), get_tweak_default);
cipher.encrypt_area(
&mut block,
BLOCK_SIZE as usize,
self.generation().into(),
get_tweak_default,
);
encrypted_hash = block.into();
}
encrypted_hash
@@ -115,7 +120,12 @@ impl Header {
//TODO: handle errors
let cipher = slot.cipher(password).unwrap();
let mut block = aes::Block::from(self.encrypted_hash);
cipher.decrypt_area(&mut block, BLOCK_SIZE as usize, self.generation().into(), get_tweak_default);
cipher.decrypt_area(
&mut block,
BLOCK_SIZE as usize,
self.generation().into(),
get_tweak_default,
);
if block == aes::Block::from(hash) {
return Some(cipher);
}
+4 -1
View File
@@ -1,4 +1,7 @@
use aes::{Aes128, BlockDecrypt, BlockEncrypt, NewBlockCipher};
use aes::{
cipher::{BlockDecrypt, BlockEncrypt, KeyInit},
Aes128,
};
use xts_mode::Xts128;
// The raw key, keep secret!