Skip to content

Commit

Permalink
Merge pull request #14 from Nitrokey/ctap-types
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
robin-nitrokey authored Nov 29, 2023
2 parents e4ab7c3 + 7324f78 commit 012227d
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 31 deletions.
64 changes: 45 additions & 19 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,22 @@ ctaphid-dispatch = { git = "https://github.com/Nitrokey/ctaphid-dispatch", tag =
#apdu-dispatch = { git = "https://github.com/Nitrokey/apdu-dispatch.git", branch="sz-multiple-apps" }

# forked
admin-app = { git = "https://github.com/Nitrokey/admin-app", tag = "v0.1.0-nitrokey.3" }
ctap-types = { git = "https://github.com/nitrokey/ctap-types.git", tag = "v0.1.2-nitrokey.4" }
fido-authenticator = { git = "https://github.com/Nitrokey/fido-authenticator.git", tag = "v0.1.1-nitrokey.7" }
trussed = { git = "https://github.com/Nitrokey/trussed", tag = "v0.1.0-nitrokey.12" }
admin-app = { git = "https://github.com/Nitrokey/admin-app.git", tag = "v0.1.0-nitrokey.8" }
fido-authenticator = { git = "https://github.com/Nitrokey/fido-authenticator.git", rev = "162ac6a2e603fb69944ff1679dced9752f0c7cf2" }
serde-indexed = { git = "https://github.com/sosthene-nitrokey/serde-indexed.git", rev = "5005d23cb4ee8622e62188ea0f9466146f851f0d" }

# unreleased upstream changes
apdu-dispatch = { git = "https://github.com/trussed-dev/apdu-dispatch.git", rev = "915fc237103fcecc29d0f0b73391f19abf6576de" }
ctap-types = { git = "https://github.com/trussed-dev/ctap-types.git", rev = "7d4ad69e64ad308944c012aef5b9cfd7654d9be8" }
iso7816 = { git = "https://github.com/Nitrokey/iso7816.git", tag = "v0.1.1-nitrokey.1" }
trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "b1781805a2e33615d2d00b8bec80c0b1f5870ca1" }
usbd-ctaphid = { git = "https://github.com/Nitrokey/usbd-ctaphid", tag = "v0.1.0-nitrokey.1" }
apdu-dispatch = { git = "https://github.com/Nitrokey/apdu-dispatch", tag = "v0.1.2-nitrokey.1" }

# unreleased crates
trussed-auth = { git = "https://github.com/Nitrokey/trussed-auth", tag = "v0.2.2-nitrokey.1" }
trussed-rsa-alloc = { git = "https://github.com/Nitrokey/trussed-rsa-backend.git", tag = "v0.1.0"}
iso7816 = { git = "https://github.com/Nitrokey/iso7816.git", tag = "v0.1.1-nitrokey.1" }
trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth", rev = "62235294bd63977bbb88eb01e7ac44b8010eb450" }
trussed-rsa-alloc = { git = "https://github.com/trussed-dev/trussed-rsa-backend.git", rev = "2f51478f0861ff8db19fdd5290f023ab6f4c2fb9" }
trussed-usbip = { git = "https://github.com/Nitrokey/pc-usbip-runner", tag = "v0.0.1-nitrokey.1" }
trussed-staging = { git = "https://github.com/Nitrokey/trussed-staging", branch = "hmacsha256p256" }
trussed-staging = { git = "https://github.com/Nitrokey/trussed-staging.git", branch = "hmacsha256p256-chunked" }

# Local development
#trussed = { path = "../trussed" }
Expand Down
26 changes: 23 additions & 3 deletions examples/usbip/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const LOCATION_FOR_SIMULATION: Location = Location::Internal;

mod dispatch {
use trussed_staging::hmacsha256p256::HmacSha256P256Extension;
use trussed_staging::manage::ManageExtension;
use trussed_staging::StagingBackend;
use trussed_staging::StagingContext;

Expand Down Expand Up @@ -44,13 +45,15 @@ mod dispatch {
pub enum Extension {
Auth,
HmacShaP256,
Manage,
}

impl From<Extension> for u8 {
fn from(extension: Extension) -> Self {
match extension {
Extension::Auth => 0,
Extension::HmacShaP256 => 1,
Extension::Manage => 2,
}
}
}
Expand All @@ -62,6 +65,7 @@ mod dispatch {
match id {
0 => Ok(Extension::Auth),
1 => Ok(Extension::HmacShaP256),
2 => Ok(Extension::Manage),
_ => Err(Error::InternalError),
}
}
Expand Down Expand Up @@ -144,7 +148,7 @@ mod dispatch {
request,
resources,
),
_ => todo!(),
_ => Err(Error::RequestNotAvailable),
},
#[cfg(feature = "rsa")]
Backend::Rsa => Err(Error::RequestNotAvailable),
Expand All @@ -159,6 +163,15 @@ mod dispatch {
request,
resources,
),
Extension::Manage => {
ExtensionImpl::<ManageExtension>::extension_request_serialized(
&mut self.staging,
&mut ctx.core,
&mut ctx.backends.staging,
request,
resources,
)
}
Extension::Auth => Err(Error::RequestNotAvailable),
},
}
Expand All @@ -176,6 +189,12 @@ mod dispatch {

const ID: Self::Id = Self::Id::HmacShaP256;
}

impl ExtensionId<ManageExtension> for Dispatch {
type Id = Extension;

const ID: Self::Id = Self::Id::Manage;
}
}

#[cfg(feature = "ccid")]
Expand Down Expand Up @@ -393,7 +412,7 @@ type FidoAuthApp = fido_authenticator::Authenticator<fido_authenticator::Conform
type WebcryptApp = webcrypt::Webcrypt<VirtClient>;

struct Apps {
admin: admin_app::App<VirtClient, Reboot, AdminStatus>,
admin: admin_app::App<VirtClient, Reboot, AdminStatus, ()>,
peeking_fido: PeekingBypass<'static, FidoAuthApp, WebcryptApp>,
}

Expand All @@ -409,10 +428,11 @@ impl trussed_usbip::Apps<'static, VirtClient, dispatch::Dispatch> for Apps {
max_msg_size: MESSAGE_SIZE,
skip_up_timeout: None,
max_resident_credential_count: Some(MAX_RESIDENT_CREDENTIAL_COUNT),
large_blobs: None,
},
);
let data = AdminData::new(Variant::Usbip);
let admin = admin_app::App::new(
let admin = admin_app::App::without_config(
builder.build("admin", &[BackendId::Core]),
[0; 16],
0,
Expand Down
3 changes: 3 additions & 0 deletions src/lib/ctap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ where
// user: Some(user),
user: None,
number_of_credentials: None,
user_selected: None,
large_blob_key: None,
}))
}

Expand Down Expand Up @@ -304,6 +306,7 @@ where
{
fn select(
&mut self,
_interface: Interface,
_apdu: &apdu::Command<{ SIZE }>,
reply: &mut apdu::Data<{ apdu_dispatch::response::SIZE }>,
) -> apdu::Result {
Expand Down

0 comments on commit 012227d

Please sign in to comment.