diff --git a/Cargo.lock b/Cargo.lock index 9f58955..35eab58 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/Cargo.toml b/Cargo.toml index 21b74c9..2ec3341 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/cli.rs b/src/cli.rs index 12ce8bf..f6c89ea 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -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 diff --git a/src/luks.rs b/src/luks.rs index 8ea515c..dae7a4f 100644 --- a/src/luks.rs +++ b/src/luks.rs @@ -9,21 +9,7 @@ use std::path::Path; fn load_device_handle>(path: P) -> Fido2LuksResult { 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) } diff --git a/src/main.rs b/src/main.rs index ea6982a..d23eda4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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::*;