From b3d23ee297b16a1e1be0239a5b8a94a31a7aaa79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Wed, 8 Nov 2023 11:52:00 +0100 Subject: [PATCH] Update apdu-dispatch This allows rejecting calls to `select` over NFC over NFC --- Cargo.lock | 26 ++++++++++++++++++++++---- Cargo.toml | 8 ++++---- src/lib/ctap_app.rs | 5 +++++ 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c065180..bb271d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,12 +5,17 @@ version = 3 [[package]] name = "admin-app" version = "0.1.0" -source = "git+https://github.com/Nitrokey/admin-app?tag=v0.1.0-nitrokey.3#15aec92ff3f30f2ad1ff157ac5077c7211a04c77" +source = "git+https://github.com/Nitrokey/admin-app?rev=dfd54a67d40f32e47f0a43711c46510a89e20ea8#dfd54a67d40f32e47f0a43711c46510a89e20ea8" dependencies = [ "apdu-dispatch", + "cbor-smol", "ctaphid-dispatch", "delog", + "hex-literal", "iso7816", + "littlefs2", + "serde", + "strum_macros", "trussed", ] @@ -48,7 +53,7 @@ dependencies = [ [[package]] name = "apdu-dispatch" version = "0.1.2" -source = "git+https://github.com/Nitrokey/apdu-dispatch?tag=v0.1.2-nitrokey.1#b72d5eb9f4d7a3f107a78a2f0e41f3c403f4c7a4" +source = "git+https://github.com/trussed-dev/apdu-dispatch.git?rev=915fc237103fcecc29d0f0b73391f19abf6576de#915fc237103fcecc29d0f0b73391f19abf6576de" dependencies = [ "delog", "heapless", @@ -362,7 +367,7 @@ dependencies = [ [[package]] name = "ctap-types" version = "0.1.2" -source = "git+https://github.com/nitrokey/ctap-types.git?tag=v0.1.2-nitrokey.4#702b5b5248f88091b22c46c936cb0f99425c0a61" +source = "git+https://github.com/nitrokey/ctap-types.git?rev=de8aa1f3dc4f773160f427680e854759bed869d7#de8aa1f3dc4f773160f427680e854759bed869d7" dependencies = [ "bitflags", "cbor-smol", @@ -550,7 +555,7 @@ dependencies = [ [[package]] name = "fido-authenticator" version = "0.1.1" -source = "git+https://github.com/Nitrokey/fido-authenticator.git?tag=v0.1.1-nitrokey.7#2f49017eec5a87bd2570593571b87a15a9890ed0" +source = "git+https://github.com/Nitrokey/fido-authenticator.git?rev=aa769b243bce8490a361f51de62761255ab561c6#aa769b243bce8490a361f51de62761255ab561c6" dependencies = [ "apdu-dispatch", "ctap-types", @@ -1518,6 +1523,19 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.28", +] + [[package]] name = "subtle" version = "2.5.0" diff --git a/Cargo.toml b/Cargo.toml index fded9e1..9558efa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -91,15 +91,15 @@ 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" } +admin-app = { git = "https://github.com/Nitrokey/admin-app", rev = "dfd54a67d40f32e47f0a43711c46510a89e20ea8" } +ctap-types = { git = "https://github.com/nitrokey/ctap-types.git", rev = "de8aa1f3dc4f773160f427680e854759bed869d7" } +fido-authenticator = { git = "https://github.com/Nitrokey/fido-authenticator.git", rev = "aa769b243bce8490a361f51de62761255ab561c6" } trussed = { git = "https://github.com/Nitrokey/trussed", tag = "v0.1.0-nitrokey.12" } serde-indexed = { git = "https://github.com/sosthene-nitrokey/serde-indexed.git", rev = "5005d23cb4ee8622e62188ea0f9466146f851f0d" } # unreleased upstream changes 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" } +apdu-dispatch = { git = "https://github.com/trussed-dev/apdu-dispatch.git", rev = "915fc237103fcecc29d0f0b73391f19abf6576de" } # unreleased crates trussed-auth = { git = "https://github.com/Nitrokey/trussed-auth", tag = "v0.2.2-nitrokey.1" } diff --git a/src/lib/ctap_app.rs b/src/lib/ctap_app.rs index 4a12436..65e93b0 100644 --- a/src/lib/ctap_app.rs +++ b/src/lib/ctap_app.rs @@ -304,9 +304,14 @@ where { fn select( &mut self, + interface: Interface, _apdu: &apdu::Command<{ SIZE }>, reply: &mut apdu::Data<{ apdu_dispatch::response::SIZE }>, ) -> apdu::Result { + if interface != Interface::Contactless { + return Err(Status::ConditionsOfUseNotSatisfied); + } + reply.extend_from_slice(b"U2F_V2").unwrap(); Ok(()) }