fix(crypto): M-01 — increase argon2id default parameters to 256 mib and 4 iterations
This commit is contained in:
+18
-2
@@ -22,8 +22,8 @@ pub const CHUNK_SIZE: usize = 1024 * 1024; // 1 MB
|
|||||||
pub const COMPRESSION_NONE: u8 = 0x00;
|
pub const COMPRESSION_NONE: u8 = 0x00;
|
||||||
pub const COMPRESSION_LZ4: u8 = 0x01;
|
pub const COMPRESSION_LZ4: u8 = 0x01;
|
||||||
|
|
||||||
pub const DEFAULT_MEMORY_COST_KIB: u32 = 64 * 1024; // 64 MB
|
pub const DEFAULT_MEMORY_COST_KIB: u32 = 256 * 1024; // 256 MB (262_144 KiB)
|
||||||
pub const DEFAULT_TIME_COST: u32 = 3;
|
pub const DEFAULT_TIME_COST: u32 = 4;
|
||||||
pub const DEFAULT_PARALLELISM: u32 = 4;
|
pub const DEFAULT_PARALLELISM: u32 = 4;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
@@ -832,6 +832,22 @@ mod tests {
|
|||||||
assert!(unwrap_dek(&kek, &wrapped, &nonce, &tampered_tag).is_err());
|
assert!(unwrap_dek(&kek, &wrapped, &nonce, &tampered_tag).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_m01_default_kdf_params_256mib_4_iterations() {
|
||||||
|
let defaults = KdfParams::default();
|
||||||
|
assert_eq!(
|
||||||
|
defaults.memory_cost,
|
||||||
|
256 * 1024,
|
||||||
|
"Default memory cost must be 256 MiB (262,144 KiB)"
|
||||||
|
);
|
||||||
|
assert_eq!(defaults.time_cost, 4, "Default time cost must be 4 iterations");
|
||||||
|
assert_eq!(defaults.parallelism, 4, "Default parallelism must be 4 threads");
|
||||||
|
assert!(
|
||||||
|
validate_kdf_params(&defaults).is_ok(),
|
||||||
|
"Default KDF parameters must pass validation"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chunk_encryption_and_swap_protection() {
|
fn test_chunk_encryption_and_swap_protection() {
|
||||||
let dek = generate_dek();
|
let dek = generate_dek();
|
||||||
|
|||||||
Reference in New Issue
Block a user