Skip to content

Commit

Permalink
Merge pull request #266 from Nitrokey/interchange030
Browse files Browse the repository at this point in the history
Bump all dependencies to their interchange 0.3.0 versions
  • Loading branch information
sosthene-nitrokey authored Jun 20, 2023
2 parents f2daacc + b9765af commit 1e7c4e6
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 41 deletions.
29 changes: 14 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ ctap-types = { git = "https://github.com/Nitrokey/ctap-types", tag = "v0.1.2-nit
fido-authenticator = { git = "https://github.com/Nitrokey/fido-authenticator.git", tag = "v0.1.1-nitrokey.4" }
lpc55-hal = { git = "https://github.com/Nitrokey/lpc55-hal", tag = "v0.3.0-nitrokey.2" }
trussed = { git = "https://github.com/Nitrokey/trussed", tag = "v0.1.0-nitrokey.11" }
ctaphid-dispatch = { git = "https://github.com/Nitrokey/ctaphid-dispatch", tag = "v0.1.1-nitrokey.1" }

# unreleased upstream changes
interchange = { git = "https://github.com/trussed-dev/interchange" }
usbd-ctaphid = { git = "https://github.com/trussed-dev/usbd-ctaphid" }
usbd-ctaphid = { git = "https://github.com/trussed-dev/usbd-ctaphid", rev = "2f658fbe84e262037621b15cb867424c4a60b038" }
usbd-ccid = { git = "https://github.com/trussed-dev/usbd-ccid", rev = "eeea54f85cfa69a43c676b63c030608830ea35ea" }
ctaphid-dispatch = { git = "https://github.com/trussed-dev/ctaphid-dispatch", rev = "d9eb980da163b613fdf759f6092b7c3bdcc0a22c" }
apdu-dispatch = { git = "https://github.com/trussed-dev/apdu-dispatch.git", rev = "b72d5eb9f4d7a3f107a78a2f0e41f3c403f4c7a4" }

# unreleased crates
secrets-app = { git = "https://github.com/Nitrokey/trussed-secrets-app", tag = "0.11.0" }
Expand All @@ -30,8 +31,8 @@ piv-authenticator = { git = "https://github.com/Nitrokey/piv-authenticator", tag
trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth", tag = "v0.2.2" }
trussed-rsa-alloc = { git = "https://github.com/Nitrokey/trussed-rsa-backend.git", tag = "v0.1.0"}
trussed-staging = { git = "https://github.com/Nitrokey/trussed-staging.git", tag = "v0.1.0"}
trussed-usbip = { git = "https://github.com/trussed-dev/pc-usbip-runner" }
iso7816 = { git = "https://github.com/Nitrokey/iso7816.git", tag = "v0.1.1-nitrokey.1" }
trussed-usbip = { git = "https://github.com/trussed-dev/pc-usbip-runner", rev = "083fca7693a9a910dd2337d8eaf9d50ccd1987d0" }

[profile.release]
codegen-units = 1
Expand Down
2 changes: 1 addition & 1 deletion components/nfc-device/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ nb = "1"

apdu-dispatch = "0.1"
iso7816 = "0.1"
interchange = "0.2.1"
interchange = "0.3.0"

[features]
default = []
Expand Down
9 changes: 4 additions & 5 deletions components/nfc-device/src/iso14443.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use core::mem::MaybeUninit;

use apdu_dispatch::interchanges;
use apdu_dispatch::interchanges::{self, Requester};
use embedded_time::duration::Milliseconds;
use heapless::Vec;
use interchange::Requester;

use crate::traits::nfc;

Expand Down Expand Up @@ -99,14 +98,14 @@ pub struct Iso14443<DEV: nfc::Device> {

buffer: interchanges::Data,

interchange: Requester<interchanges::Contactless>,
interchange: Requester<'static>,
}

impl<DEV> Iso14443<DEV>
where
DEV: nfc::Device,
{
pub fn new(device: DEV, interchange: Requester<interchanges::Contactless>) -> Self {
pub fn new(device: DEV, interchange: Requester<'static>) -> Self {
Self {
device: device,
state: Iso14443State::Receiving,
Expand Down Expand Up @@ -339,7 +338,7 @@ where
let command = interchanges::Data::from_slice(&self.buffer);
self.buffer.clear();
if command.is_ok() {
if self.interchange.request(command.as_ref().unwrap()).is_ok() {
if self.interchange.request(command.unwrap()).is_ok() {
Ok(())
} else {
// Would be better to try canceling and taking on this apdu.
Expand Down
2 changes: 1 addition & 1 deletion runners/embedded/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ctap-types = "0.1"

### trussed core
trussed = "0.1"
interchange = "0.2"
interchange = "0.3"
littlefs2 = { version = "0.4", features = ["c-stubs"] }

### usb machinery
Expand Down
13 changes: 9 additions & 4 deletions runners/embedded/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_std]

use interchange::Interchange;
use interchange::Channel;
use littlefs2::fs::Filesystem;
use soc::types::Soc as SocT;
use types::Soc;
Expand Down Expand Up @@ -176,10 +176,15 @@ pub fn init_usb_nfc(
) -> types::usbnfc::UsbNfcInit {
let config = <SocT as Soc>::INTERFACE_CONFIG;

use apdu_dispatch::interchanges::Channel as CcidChannel;
use ctaphid_dispatch::types::Channel as CtapChannel;
static CCID_CHANNEL: CcidChannel = Channel::new();
static NFC_CHANNEL: CcidChannel = Channel::new();
static CTAP_CHANNEL: CtapChannel = Channel::new();
/* claim interchanges */
let (ccid_rq, ccid_rp) = apdu_dispatch::interchanges::Contact::claim().unwrap();
let (nfc_rq, nfc_rp) = apdu_dispatch::interchanges::Contactless::claim().unwrap();
let (ctaphid_rq, ctaphid_rp) = ctaphid_dispatch::types::HidInterchange::claim().unwrap();
let (ccid_rq, ccid_rp) = CCID_CHANNEL.split().unwrap();
let (nfc_rq, nfc_rp) = NFC_CHANNEL.split().unwrap();
let (ctaphid_rq, ctaphid_rp) = CTAP_CHANNEL.split().unwrap();

/* initialize dispatchers */
let apdu_dispatch = apdu_dispatch::dispatch::ApduDispatch::new(ccid_rp, nfc_rp);
Expand Down
4 changes: 2 additions & 2 deletions runners/embedded/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ pub type Trussed = trussed::Service<RunnerPlatform, Dispatch>;

pub type Iso14443 = nfc_device::Iso14443<<SocT as Soc>::NfcDevice>;

pub type ApduDispatch = apdu_dispatch::dispatch::ApduDispatch;
pub type CtaphidDispatch = ctaphid_dispatch::dispatch::Dispatch;
pub type ApduDispatch = apdu_dispatch::dispatch::ApduDispatch<'static>;
pub type CtaphidDispatch = ctaphid_dispatch::dispatch::Dispatch<'static>;

pub type Apps = apps::Apps<Runner>;

Expand Down
14 changes: 5 additions & 9 deletions runners/embedded/src/types/usbnfc.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
use crate::soc::types::Soc as SocT;
use crate::types::Soc;

pub type CcidClass = usbd_ccid::Ccid<
'static,
<SocT as Soc>::UsbBus,
apdu_dispatch::interchanges::Contact,
{ apdu_dispatch::interchanges::SIZE },
>;
pub type CtapHidClass = usbd_ctaphid::CtapHid<'static, <SocT as Soc>::UsbBus>;
pub type CcidClass =
usbd_ccid::Ccid<'static, 'static, <SocT as Soc>::UsbBus, { apdu_dispatch::interchanges::SIZE }>;
pub type CtapHidClass = usbd_ctaphid::CtapHid<'static, 'static, <SocT as Soc>::UsbBus>;
// pub type KeyboardClass = usbd_hid::hid_class::HIDClass<'static, <SocT as Soc>::UsbBus>;
pub type SerialClass = usbd_serial::SerialPort<'static, <SocT as Soc>::UsbBus>;

Expand Down Expand Up @@ -40,7 +36,7 @@ impl UsbClasses {

pub struct UsbNfcInit {
pub usb_classes: Option<UsbClasses>,
pub apdu_dispatch: apdu_dispatch::dispatch::ApduDispatch,
pub ctaphid_dispatch: ctaphid_dispatch::dispatch::Dispatch,
pub apdu_dispatch: apdu_dispatch::dispatch::ApduDispatch<'static>,
pub ctaphid_dispatch: ctaphid_dispatch::dispatch::Dispatch<'static>,
pub iso14443: Option<super::Iso14443>,
}

0 comments on commit 1e7c4e6

Please sign in to comment.