Adapt to interrupt changes

This commit is contained in:
Sosthène Guédon
2023-06-20 18:01:50 +02:00
committed by sosthene-nitrokey
parent 083fca7693
commit e78883847f
4 changed files with 217 additions and 114 deletions
Generated
+203 -105
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -40,10 +40,10 @@ name = "fido"
required-features = ["ctaphid"]
[patch.crates-io]
trussed = { git = "https://github.com/trussed-dev/trussed", rev = "51477a4c5d22b7fbfe9d5fed137701764b2c86ec" }
trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "51e68500d7601d04f884f5e95567d14b9018a6cb" }
usbd-ctaphid = { git = "https://github.com/trussed-dev/usbd-ctaphid", rev = "2f658fbe84e262037621b15cb867424c4a60b038" }
usbd-ctaphid = { git = "https://github.com/trussed-dev/usbd-ctaphid", rev = "e9cbf904f548979685c4c06d75479b75e3695160" }
usbd-ccid = { git = "https://github.com/trussed-dev/usbd-ccid", rev = "eeea54f85cfa69a43c676b63c030608830ea35ea" }
ctaphid-dispatch = { git = "https://github.com/trussed-dev/ctaphid-dispatch", rev = "d9eb980da163b613fdf759f6092b7c3bdcc0a22c" }
ctaphid-dispatch = { git = "https://github.com/trussed-dev/ctaphid-dispatch", rev = "57cb3317878a8593847595319aa03ef17c29ec5b" }
apdu-dispatch = { git = "https://github.com/trussed-dev/apdu-dispatch.git", rev = "b72d5eb9f4d7a3f107a78a2f0e41f3c403f4c7a4" }
+5 -2
View File
@@ -2,10 +2,13 @@ use ctaphid_dispatch::dispatch::Dispatch;
use usb_device::bus::{UsbBus, UsbBusAllocator};
use usbd_ctaphid::CtapHid;
pub fn setup<'bus, 'pipe, B: UsbBus>(
pub fn setup<'bus, 'pipe, 'interrupt, B: UsbBus>(
bus_allocator: &'bus UsbBusAllocator<B>,
interchange: &'pipe ctaphid_dispatch::types::Channel,
) -> (CtapHid<'bus, 'pipe, B>, Dispatch<'pipe>) {
) -> (
CtapHid<'bus, 'pipe, 'interrupt, B>,
Dispatch<'pipe, 'interrupt>,
) {
let (ctaphid_rq, ctaphid_rp) = interchange.split().unwrap();
let ctaphid = CtapHid::new(bus_allocator, ctaphid_rq, 0u32)
.implements_ctap1()
+6 -4
View File
@@ -35,7 +35,7 @@ impl Options {
}
}
pub trait Apps<C: trussed::Client, D: Dispatch> {
pub trait Apps<'interrupt, C: trussed::Client, D: Dispatch> {
type Data;
fn new<B: ClientBuilder<C, D>>(builder: &B, data: Self::Data) -> Self;
@@ -43,7 +43,7 @@ pub trait Apps<C: trussed::Client, D: Dispatch> {
#[cfg(feature = "ctaphid")]
fn with_ctaphid_apps<T>(
&mut self,
f: impl FnOnce(&mut [&mut dyn ctaphid_dispatch::app::App]) -> T,
f: impl FnOnce(&mut [&mut dyn ctaphid_dispatch::app::App<'interrupt>]) -> T,
) -> T;
#[cfg(feature = "ccid")]
@@ -65,7 +65,9 @@ pub struct Runner<S: StoreProvider, D, A> {
_marker: PhantomData<A>,
}
impl<S: StoreProvider, D: Dispatch, A: Apps<Client<S, D>, D>> Runner<S, D, A> {
impl<'interrupt, S: StoreProvider, D: Dispatch, A: Apps<'interrupt, Client<S, D>, D>>
Runner<S, D, A>
{
pub fn builder(store: S, options: Options) -> Builder<S> {
Builder::new(store, options)
}
@@ -155,7 +157,7 @@ impl<S: StoreProvider, D> Builder<S, D> {
}
impl<S: StoreProvider, D: Dispatch> Builder<S, D> {
pub fn build<A: Apps<Client<S, D>, D>>(self) -> Runner<S, D, A> {
pub fn build<'interrupt, A: Apps<'interrupt, Client<S, D>, D>>(self) -> Runner<S, D, A> {
Runner {
store: self.store,
options: self.options,