WIP: 0.3.0 #5

Draft
shimun wants to merge 34 commits from 0.3.0 into master
2 changed files with 6 additions and 3 deletions
Showing only changes of commit 4b09fcb6cb - Show all commits

0
CHANGELOG.md Normal file
View File

View File

@ -33,7 +33,7 @@ fn derive_secret(
timeout: u64, timeout: u64,
pin: Option<&str>, pin: Option<&str>,
) -> Fido2LuksResult<([u8; 32], FidoCredential)> { ) -> Fido2LuksResult<([u8; 32], FidoCredential)> {
if credentials.len() == 0 { if credentials.is_empty() {
return Err(Fido2LuksError::InsufficientCredentials); return Err(Fido2LuksError::InsufficientCredentials);
} }
let timeout = Duration::from_secs(timeout); let timeout = Duration::from_secs(timeout);
@ -419,7 +419,7 @@ pub fn run_cli() -> Fido2LuksResult<()> {
let slot = if let Some(ref credentials) = credentials.ids { let slot = if let Some(ref credentials) = credentials.ids {
secret(Cow::Borrowed(&credentials.0)) secret(Cow::Borrowed(&credentials.0))
.and_then(|(secret, _cred)| luks_dev.activate(&name, &secret, luks.slot)) .and_then(|(secret, _cred)| luks_dev.activate(&name, &secret, luks.slot))
} else if luks_dev.is_luks2()? { } else if luks_dev.is_luks2()? && !luks.disable_token {
luks_dev.activate_token( luks_dev.activate_token(
&name, &name,
Box::new(|credentials: Vec<String>| { Box::new(|credentials: Vec<String>| {
@ -432,8 +432,11 @@ pub fn run_cli() -> Fido2LuksResult<()> {
}), }),
luks.slot, luks.slot,
) )
} else if luks_dev.is_luks2()? && luks.disable_token {
// disable-token is mostly cosmetic in this instance
return Err(Fido2LuksError::InsufficientCredentials);
} else { } else {
return Err(Fido2LuksError::WrongSecret); // creds or luks2 return Err(Fido2LuksError::WrongSecret);
}; };
match slot { match slot {
Err(e) => { Err(e) => {