diff --git a/.reuse/dep5 b/.reuse/dep5 new file mode 100644 index 0000000..a7e771b --- /dev/null +++ b/.reuse/dep5 @@ -0,0 +1,7 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: piv-authenticator +Source: https://github.com/Nitrokey/piv-authenticator + +Files: tests/default_admin_key +Copyright: 2022 Nitrokey GmbH +License: LGPL-3.0-only diff --git a/src/dispatch.rs b/src/dispatch.rs index fe03113..d1d8142 100644 --- a/src/dispatch.rs +++ b/src/dispatch.rs @@ -1,7 +1,7 @@ // Copyright (C) 2022 Nicolas Stalder AND Nitrokey GmbH // SPDX-License-Identifier: LGPL-3.0-only -use crate::{Authenticator, /*constants::PIV_AID,*/ Result}; +use crate::{reply::Reply, Authenticator, /*constants::PIV_AID,*/ Result}; use apdu_dispatch::{app::App, command, response, Command}; use trussed::client; @@ -12,7 +12,7 @@ where T: client::Client + client::Ed255 + client::Tdes, { fn select(&mut self, _apdu: &Command, reply: &mut response::Data) -> Result { - self.select(reply) + self.select(Reply(reply)) } fn deselect(&mut self) { @@ -25,6 +25,6 @@ where apdu: &Command, reply: &mut response::Data, ) -> Result { - self.respond(apdu, reply) + self.respond(apdu, &mut Reply(reply)) } } diff --git a/src/lib.rs b/src/lib.rs index fe80336..0c529c1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -497,7 +497,7 @@ impl<'a, T: trussed::Client + trussed::client::Ed255> LoadedAuthenticator<'a, T> } _ => { warn!("Response without a challenge or a witness"); - return Err(Status::ConditionsOfUseNotSatisfied); + Err(Status::ConditionsOfUseNotSatisfied) } } } diff --git a/src/state.rs b/src/state.rs index 55a92d8..160ffbc 100644 --- a/src/state.rs +++ b/src/state.rs @@ -214,7 +214,7 @@ impl Runtime { pub fn take_witness(&mut self) -> Option> { match self.command_cache.take() { Some(CommandCache::WitnessChallenge(b)) => return Some(b), - old @ _ => self.command_cache = old, + old => self.command_cache = old, }; None } @@ -222,7 +222,7 @@ impl Runtime { pub fn take_challenge(&mut self) -> Option> { match self.command_cache.take() { Some(CommandCache::AuthenticateChallenge(b)) => return Some(b), - old @ _ => self.command_cache = old, + old => self.command_cache = old, }; None } diff --git a/tests/opensc.rs b/tests/opensc.rs index 5e935a9..2ef0fd2 100644 --- a/tests/opensc.rs +++ b/tests/opensc.rs @@ -29,7 +29,7 @@ fn admin_mutual() { let mut command = Command::new("piv-tool"); command .env("PIV_EXT_AUTH_KEY", "tests/default_admin_key") - .args(&["-A", "M:9B:03"]); + .args(["-A", "M:9B:03"]); let mut p = expectrl::session::Session::spawn(command).unwrap(); p.check("Using reader with a card: Virtual PCD 00 00") .unwrap(); @@ -47,7 +47,7 @@ fn admin_card() { let mut command = Command::new("piv-tool"); command .env("PIV_EXT_AUTH_KEY", "tests/default_admin_key") - .args(&["-A", "A:9B:03"]); + .args(["-A", "A:9B:03"]); let mut p = expectrl::session::Session::spawn(command).unwrap(); p.check("Using reader with a card: Virtual PCD 00 00") .unwrap(); @@ -63,7 +63,7 @@ fn generate_key() { let mut command = Command::new("piv-tool"); command .env("PIV_EXT_AUTH_KEY", "tests/default_admin_key") - .args(&["-A", "M:9B:03", "-G", "9A:11"]); + .args(["-A", "M:9B:03", "-G", "9A:11"]); let mut p = expectrl::session::Session::spawn(command).unwrap(); p.check("Using reader with a card: Virtual PCD 00 00") .unwrap(); @@ -75,7 +75,7 @@ fn generate_key() { let mut command = Command::new("piv-tool"); command .env("PIV_EXT_AUTH_KEY", "tests/default_admin_key") - .args(&["-A", "M:9B:03", "-G", "9A:07"]); + .args(["-A", "M:9B:03", "-G", "9A:07"]); let mut p = expectrl::session::Session::spawn(command).unwrap(); p.check("Using reader with a card: Virtual PCD 00 00") .unwrap();