update libcryptsetup_rs to 0.4.0
This commit is contained in:
@@ -413,10 +413,15 @@ pub fn run_cli() -> Fido2LuksResult<()> {
|
||||
}
|
||||
}
|
||||
}
|
||||
Command::OpenToken { device, name, salt } => luks::open_container_token(
|
||||
// TODO: utilise salt
|
||||
Command::OpenToken {
|
||||
device,
|
||||
name,
|
||||
salt: _,
|
||||
} => luks::open_container_token(
|
||||
device,
|
||||
&name[..],
|
||||
Box::new(|mut creds| {
|
||||
Box::new(|creds| {
|
||||
let (secret, cred) = SecretGeneration {
|
||||
credential_ids: CommaSeparated(
|
||||
creds
|
||||
|
16
src/luks.rs
16
src/luks.rs
@@ -9,21 +9,7 @@ use std::path::Path;
|
||||
|
||||
fn load_device_handle<P: AsRef<Path>>(path: P) -> Fido2LuksResult<CryptDevice> {
|
||||
let mut device = CryptInit::init(path.as_ref())?;
|
||||
//TODO: determine luks version some way other way than just trying
|
||||
let mut load = |format| {
|
||||
device
|
||||
.context_handle()
|
||||
.load::<()>(Some(format), None)
|
||||
.map(|_| ())
|
||||
};
|
||||
vec![EncryptionFormat::Luks2, EncryptionFormat::Luks1]
|
||||
.into_iter()
|
||||
.fold(None, |res, format| match res {
|
||||
Some(Ok(())) => res,
|
||||
Some(e) => Some(e.or_else(|_| load(format))),
|
||||
None => Some(load(format)),
|
||||
})
|
||||
.unwrap()?;
|
||||
device.context_handle().load::<()>(None, None)?;
|
||||
Ok(device)
|
||||
}
|
||||
|
||||
|
@@ -3,8 +3,6 @@ extern crate failure;
|
||||
extern crate ctap_hmac as ctap;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
#[macro_use]
|
||||
extern crate libcryptsetup_rs;
|
||||
use crate::cli::*;
|
||||
use crate::config::*;
|
||||
use crate::device::*;
|
||||
|
Reference in New Issue
Block a user