Update apdu-dispatch and reject NFC requests

This commit is contained in:
Sosthène Guédon
2023-11-08 16:22:12 +01:00
parent 76bb22daab
commit c01678f6a7
2 changed files with 15 additions and 7 deletions
+1
View File
@@ -78,6 +78,7 @@ trussed = { git = "https://github.com/trussed-dev/trussed" , rev = "55ea391367fc
trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth.git", tag = "v0.2.2"}
trussed-rsa-alloc = { git = "https://github.com/trussed-dev/trussed-rsa-backend.git", tag = "v0.1.0"}
trussed-staging = { git = "https://github.com/trussed-dev/trussed-staging", tag = "v0.1.0" }
apdu-dispatch = { git = "https://github.com/trussed-dev/apdu-dispatch.git", rev = "915fc237103fcecc29d0f0b73391f19abf6576de" }
[profile.dev.package.rsa]
opt-level = 2
+14 -7
View File
@@ -1,13 +1,22 @@
use crate::{reply::Reply, Authenticator, /*constants::PIV_AID,*/ Result};
use apdu_dispatch::{app::App, command, response, Command};
use iso7816::{Interface, Status};
#[cfg(feature = "apdu-dispatch")]
impl<T> App<{ command::SIZE }, { response::SIZE }> for Authenticator<T>
where
T: crate::Client,
{
fn select(&mut self, _apdu: &Command, reply: &mut response::Data) -> Result {
fn select(
&mut self,
interface: Interface,
_apdu: &Command,
reply: &mut response::Data,
) -> Result {
if interface != Interface::Contact {
return Err(Status::ConditionsOfUseNotSatisfied);
}
self.select(Reply(reply))
}
@@ -15,12 +24,10 @@ where
self.deselect()
}
fn call(
&mut self,
_: iso7816::Interface,
apdu: &Command,
reply: &mut response::Data,
) -> Result {
fn call(&mut self, interface: Interface, apdu: &Command, reply: &mut response::Data) -> Result {
if interface != Interface::Contact {
return Err(Status::ConditionsOfUseNotSatisfied);
}
self.respond(apdu, &mut Reply(reply))
}
}