mirror of
https://github.com/trussed-dev/piv-authenticator.git
synced 2026-06-20 04:16:15 -07:00
More cleanup
This commit is contained in:
@@ -30,7 +30,6 @@ rand_core = { version = "0.5.1", features = ["getrandom"] }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
applet = ["apdu-dispatch"]
|
||||
strict-pin = []
|
||||
|
||||
log-all = []
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
use crate::{Authenticator, constants::PIV_AID, Result};
|
||||
|
||||
use apdu_dispatch::{
|
||||
app::{Aid, App},
|
||||
command::Size as CommandSize,
|
||||
Command,
|
||||
response::{Data, Size as ResponseSize},
|
||||
};
|
||||
use trussed::client;
|
||||
|
||||
impl<T> Aid for Authenticator<CommandSize, T> {
|
||||
|
||||
fn aid(&self) -> &'static [u8] {
|
||||
&PIV_AID
|
||||
}
|
||||
|
||||
fn right_truncated_length(&self) -> usize {
|
||||
11
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(feature = "apdu-dispatch")]
|
||||
impl<T> App<CommandSize, ResponseSize> for Authenticator<CommandSize, T>
|
||||
where
|
||||
T: client::Client + client::Ed255 + client::Tdes
|
||||
{
|
||||
fn select(&mut self, apdu: &Command, reply: &mut Data) -> Result {
|
||||
self.select(apdu, reply)
|
||||
}
|
||||
|
||||
fn deselect(&mut self) { self.deselect() }
|
||||
|
||||
fn call(&mut self, _: iso7816::Interface, apdu: &Command, reply: &mut Data) -> Result {
|
||||
self.respond(apdu, reply)
|
||||
}
|
||||
}
|
||||
+3
-28
@@ -16,6 +16,9 @@ pub mod derp;
|
||||
pub mod piv_types;
|
||||
pub use piv_types::{Pin, Puk};
|
||||
|
||||
#[cfg(feature = "apdu-dispatch")]
|
||||
mod apdu_dispatch;
|
||||
|
||||
use core::convert::TryInto;
|
||||
|
||||
use flexiber::EncodableHeapless;
|
||||
@@ -1069,31 +1072,3 @@ where
|
||||
}
|
||||
|
||||
|
||||
#[cfg(feature = "apdu-dispatch")]
|
||||
impl<T> apdu_dispatch::app::Aid for Authenticator<apdu_dispatch::command::Size, T> {
|
||||
|
||||
fn aid(&self) -> &'static [u8] {
|
||||
&constants::PIV_AID
|
||||
}
|
||||
|
||||
fn right_truncated_length(&self) -> usize {
|
||||
11
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(feature = "apdu-dispatch")]
|
||||
impl<T> apdu_dispatch::app::App<apdu_dispatch::command::Size, apdu_dispatch::response::Size> for Authenticator<apdu_dispatch::command::Size, T>
|
||||
where
|
||||
T: client::Client + client::Ed255 + client::Tdes
|
||||
{
|
||||
fn select(&mut self, apdu: &apdu_dispatch::Command, reply: &mut apdu_dispatch::response::Data) -> Result {
|
||||
self.select(apdu, reply)
|
||||
}
|
||||
|
||||
fn deselect(&mut self) { self.deselect() }
|
||||
|
||||
fn call(&mut self, _: iso7816::Interface, apdu: &apdu_dispatch::Command, reply: &mut apdu_dispatch::response::Data) -> Result {
|
||||
self.respond(apdu, reply)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user