mirror of
https://github.com/ratspeak/rsReticulum
synced 2026-11-27 13:52:16 +00:00
crypto: wipe AES key schedules and CBC state when ciphers are dropped
This commit is contained in:
1 parent
ad10380bbb
commit
416f1ae86c
6 files changed
+26
-5
No files matched your search
Generated
+2
@@ -11,6 +11,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"cipher",
|
||||
"cpufeatures",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -328,6 +329,7 @@ checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
|
||||
dependencies = [
|
||||
"crypto-common",
|
||||
"inout",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
+2
-2
@@ -23,9 +23,9 @@ rust-version = "1.89"
|
||||
# Crypto
|
||||
x25519-dalek = { version = "2", features = ["static_secrets"] }
|
||||
ed25519-dalek = { version = "2", features = ["hazmat", "rand_core"] }
|
||||
aes = "0.8"
|
||||
aes = { version = "0.8", features = ["zeroize"] }
|
||||
des = "0.8"
|
||||
cbc = { version = "0.1", features = ["alloc"] }
|
||||
cbc = { version = "0.1", features = ["alloc", "zeroize"] }
|
||||
hkdf = "0.12"
|
||||
hmac = "0.12"
|
||||
md-5 = "0.10"
|
||||
|
||||
Generated
+2
@@ -11,6 +11,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"cipher",
|
||||
"cpufeatures",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -225,6 +226,7 @@ checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
|
||||
dependencies = [
|
||||
"crypto-common",
|
||||
"inout",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -117,6 +117,9 @@ wiped when it is dropped. Pass `&key[..]` where a slice is expected; the bytes
|
||||
are unchanged. `token::decrypt` still returns `Vec<u8>` and wipes its buffer
|
||||
when decryption fails; wrap a secret plaintext in `Zeroizing`.
|
||||
`Identity::from_file` refuses a file larger than 1 KiB without reading it.
|
||||
rns-crypto enables the `zeroize` features of `aes` and `cbc`, so AES key
|
||||
schedules and CBC state are wiped when dropped; dependents that build with
|
||||
`--locked` refresh their lock files.
|
||||
|
||||
The compatibility floor remains unchanged. Its cumulative exact-removal list
|
||||
also retains the already-reviewed [1.3 migration](1.3.md) for discovery ownership
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
"requirement": "^0.8",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
"features": [
|
||||
"zeroize"
|
||||
],
|
||||
"sourceKind": "registry"
|
||||
},
|
||||
{
|
||||
@@ -46,7 +48,8 @@
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [
|
||||
"alloc"
|
||||
"alloc",
|
||||
"zeroize"
|
||||
],
|
||||
"sourceKind": "registry"
|
||||
},
|
||||
@@ -1052,7 +1055,9 @@
|
||||
"requirement": "^0.8",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
"features": [
|
||||
"zeroize"
|
||||
],
|
||||
"sourceKind": "registry"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -176,6 +176,15 @@ mod tests {
|
||||
assert_eq!(&pt[..], &plaintext[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cipher_state_is_wiped_on_drop() {
|
||||
fn wiped_on_drop<T: zeroize::ZeroizeOnDrop>() {}
|
||||
wiped_on_drop::<Encryptor<Aes128>>();
|
||||
wiped_on_drop::<Encryptor<Aes256>>();
|
||||
wiped_on_drop::<Decryptor<Aes128>>();
|
||||
wiped_on_drop::<Decryptor<Aes256>>();
|
||||
}
|
||||
|
||||
/// Different key sizes must produce different ciphertexts for the same input.
|
||||
#[test]
|
||||
fn test_aes128_vs_aes256_distinct_ciphertexts() {
|
||||
|
||||
Reference in new issue
Block a user