summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoland Vet <RlndVt@protonmail.com>2024-02-20 20:51:31 +0100
committerRoland Vet <RlndVt@protonmail.com>2024-02-22 21:12:49 +0100
commiteaf5575080fe512cf5b91a3465e8a8a6e75c2fa9 (patch)
tree270e8021b7e003a571edc1d82aee46147dd8039a /src
parentceb9eaa0200ef59039c049f0200384782fce8f51 (diff)
Rename sb to block_device
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/key.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/key.rs b/src/key.rs
index 5e14c6ac..6215c7bb 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -150,22 +150,22 @@ fn decrypt_master_key(sb: &bch_sb_handle, pass: String) -> anyhow::Result<()> {
}
}
-pub fn read_from_key_file(sb: &bch_sb_handle, key_file: &std::path::Path) -> anyhow::Result<()> {
+pub fn read_from_key_file(block_device: &bch_sb_handle, key_file: &std::path::Path) -> anyhow::Result<()> {
// Attempts to decrypt the master key by key_file
// Return true if decryption was successful, false otherwise
- info!("Attempting to decrypt master key for filesystem {}, using key file {}", sb.sb().uuid(), key_file.display());
+ info!("Attempting to decrypt master key for filesystem {}, using key file {}", block_device.sb().uuid(), key_file.display());
// Read the contents of the key file into a string
let pass = fs::read_to_string(key_file)?;
// Call decrypt_master_key with the read string
- decrypt_master_key(sb, pass)
+ decrypt_master_key(block_device, pass)
}
-pub fn prepare_key(sb: &bch_sb_handle, password_policy: KeyPolicy) -> anyhow::Result<()> {
- info!("Attempting to decrypt master key for filesystem {}, using key policy {}", sb.sb().uuid(), password_policy);
+pub fn prepare_key(block_device: &bch_sb_handle, password_policy: KeyPolicy) -> anyhow::Result<()> {
+ info!("Attempting to decrypt master key for filesystem {}, using key policy {}", block_device.sb().uuid(), password_policy);
match password_policy {
KeyPolicy::Fail => Err(anyhow!("no key available")),
- KeyPolicy::Wait => Ok(wait_for_key(&sb.sb().uuid())?),
- KeyPolicy::Ask => ask_for_key(sb),
+ KeyPolicy::Wait => Ok(wait_for_key(&block_device.sb().uuid())?),
+ KeyPolicy::Ask => ask_for_key(block_device),
_ => Err(anyhow!("no keyoption specified for locked filesystem")),
}
}