0.34.13_cleaup_code

This commit is contained in:
Mateusz Gruszczyński committed 2026-10-26 14:14:41 +01:00
1 parent ec46a96a29
commit 5c2e50ec06
87 files changed
+4890 -1338

No files matched your search

+10 -11
View File
@@ -231,8 +231,12 @@ fn derive_key(password: &str, salt: &[u8]) -> Result<Zeroizing<[u8; 32]>> {
fn new_crypto(password: &str) -> Result<CryptoContext> {
let mut salt = [0u8; 16];
let mut nonce_prefix = [0u8; 4];
SysRng.try_fill_bytes(&mut salt).expect("secure operating system random source unavailable");
SysRng.try_fill_bytes(&mut nonce_prefix).expect("secure operating system random source unavailable");
SysRng
.try_fill_bytes(&mut salt)
.expect("secure operating system random source unavailable");
SysRng
.try_fill_bytes(&mut nonce_prefix)
.expect("secure operating system random source unavailable");
let header = CryptoHeader {
format_version: FORMAT_VERSION,
kdf: "Argon2id".into(),
@@ -395,7 +399,9 @@ fn decrypt_archive(input: &Path, output: &Path, password: &str) -> Result<Zeroiz
fn seal_master_key(master: &[u8], backup_key: &[u8]) -> Result<Vec<u8>> {
ensure!(master.len() == 32, "invalid secret store master key");
let mut nonce_bytes = [0u8; 12];
SysRng.try_fill_bytes(&mut nonce_bytes).expect("secure operating system random source unavailable");
SysRng
.try_fill_bytes(&mut nonce_bytes)
.expect("secure operating system random source unavailable");
let cipher = cipher(backup_key)?;
let mut encrypted = Zeroizing::new(master.to_vec());
cipher
@@ -462,13 +468,6 @@ fn hash_bytes(bytes: &[u8]) -> String {
fn excluded_directory(name: &str) -> bool {
matches!(
name,
"cache"
| "logs"
| "tmp"
| "temp"
| "work"
| "acme-http01"
| "acme-python"
| "acme_python"
"cache" | "logs" | "tmp" | "temp" | "work" | "acme-http01" | "acme-python" | "acme_python"
)
}