Compare commits

..

3 Commits
0.2.4 ... luks2

Author SHA1 Message Date
f6de4a033e more detailed messages 2020-03-27 18:28:33 +01:00
f5880346b9 switch to libcryptsetup-rs 2020-03-27 18:09:38 +01:00
6089b254b4 switch to libcryptsetup-rs for luks2 support 2020-03-22 17:39:44 +01:00
2 changed files with 3 additions and 2 deletions

View File

@@ -46,10 +46,10 @@ pub fn add_key<P: AsRef<Path>>(
pub fn remove_keyslots<P: AsRef<Path>>(path: P, exclude: &[u32]) -> Fido2LuksResult<u32> { pub fn remove_keyslots<P: AsRef<Path>>(path: P, exclude: &[u32]) -> Fido2LuksResult<u32> {
let mut device = load_device_handle(path)?; let mut device = load_device_handle(path)?;
let mut slot = 0;
let mut handle; let mut handle;
let mut destroyed = 0; let mut destroyed = 0;
//TODO: detect how many keyslots there are instead of trying within a given range loop {
for slot in 0..1024 {
handle = device.keyslot_handle(Some(slot)); handle = device.keyslot_handle(Some(slot));
match handle.status()? { match handle.status()? {
KeyslotInfo::Inactive => continue, KeyslotInfo::Inactive => continue,
@@ -63,6 +63,7 @@ pub fn remove_keyslots<P: AsRef<Path>>(path: P, exclude: &[u32]) -> Fido2LuksRes
KeyslotInfo::ActiveLast => break, KeyslotInfo::ActiveLast => break,
_ => (), _ => (),
} }
slot += 1;
} }
Ok(destroyed) Ok(destroyed)
} }

0
src/setup.rs Normal file
View File