update libcryptsetup_rs to 0.4.0
This commit is contained in:
parent
f774580c9c
commit
c1a82b9ae6
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -472,8 +472,9 @@ checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
|
||||
|
||||
[[package]]
|
||||
name = "libcryptsetup-rs"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/shimunn/libcryptsetup-rs.git?branch=luks2_token_set#e877155390f9f81cfc94c711fd99b956e1453dd6"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "286a440a894fafd96c841b61c73e2053ff5b4d456820b3e04f7e88c4e8636a6b"
|
||||
dependencies = [
|
||||
"either",
|
||||
"libc",
|
||||
@ -487,7 +488,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "libcryptsetup-rs-sys"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/shimunn/libcryptsetup-rs.git?branch=luks2_token_set#e877155390f9f81cfc94c711fd99b956e1453dd6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c605998e81e2a99c1f4c5d0be45ea1df6f1dc45dc64f5ca2847b0dbebf49ae7"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cc",
|
||||
|
@ -20,8 +20,7 @@ ring = "0.13.5"
|
||||
failure = "0.1.5"
|
||||
rpassword = "4.0.1"
|
||||
structopt = "0.3.2"
|
||||
#libcryptsetup-rs = "0.3.0"
|
||||
libcryptsetup-rs = { git = "https://github.com/shimunn/libcryptsetup-rs.git", branch = "luks2_token_set" }
|
||||
libcryptsetup-rs = "0.4.0"
|
||||
serde_json = "1.0.51"
|
||||
serde_derive = "1.0.106"
|
||||
serde = "1.0.106"
|
||||
|
@ -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::*;
|
||||
|
Loading…
x
Reference in New Issue
Block a user