diff --git a/reproducible/reference_binaries_macos-10.15.sha256sum b/reproducible/reference_binaries_macos-10.15.sha256sum index 83e63ba..ee54c1f 100644 --- a/reproducible/reference_binaries_macos-10.15.sha256sum +++ b/reproducible/reference_binaries_macos-10.15.sha256sum @@ -1,9 +1,9 @@ 0b54df6d548849e24d67b9b022ca09cb33c51f078ce85d0c9c4635ffc69902e1 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840dk.bin -e93f56b4b6bb602ab37cf967f1c3fd3d253e05ccc85d4718762f68216c35d68c target/nrf52840dk_merged.hex +136480e054c13cb3502a78f47b6496f0488adc001a568508f6fbb0bb92715317 target/nrf52840dk_merged.hex 052eec0ae526038352b9f7573468d0cf7fb5ec331d4dc1a2df75fdbd514ea5ca third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle.bin -8cff9a4d513be338ba6a3fd91d3d4cfdd63bc066e8bf9dc22f64176114da08b8 target/nrf52840_dongle_merged.hex +21602fe8f25e329e80989e97c637ec8a2f1b02d2a88de636a06632465012a9c9 target/nrf52840_dongle_merged.hex 908d7f4f40936d968b91ab6e19b2406612fe8c2c273d9c0b71ef1f55116780e0 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle_dfu.bin -94452673fb0022a07ac886d4ab74576f067c2d727aed30ed368f4e5af382238f target/nrf52840_dongle_dfu_merged.hex +40d176b43006dc3b2aaabfffab6210153d99641d9835e953cb48769f58d4cc48 target/nrf52840_dongle_dfu_merged.hex 34ecbecaebf1188277f2310fe769c8c60310d8576493242712854deb4ba1036e third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_mdk_dfu.bin -414aaf7fcc3a0121ab02b1222d508ae503e268cb7da0df5795a6d6a01aeed345 target/nrf52840_mdk_dfu_merged.hex -212698e7c7919fa4542e1263d56f601632902f86bdf3d48cf6300b96ad452cb1 target/tab/ctap2.tab +a3cf456e2f8e8216be891d7d4153c72535029c538612395a843bee65e573f8ba target/nrf52840_mdk_dfu_merged.hex +9fcc808b6df7d773cbe8740fbe33fa6522011991a9ed777656ba0ae67d6e8767 target/tab/ctap2.tab diff --git a/reproducible/reference_binaries_ubuntu-18.04.sha256sum b/reproducible/reference_binaries_ubuntu-18.04.sha256sum index 9f5f433..bed5f19 100644 --- a/reproducible/reference_binaries_ubuntu-18.04.sha256sum +++ b/reproducible/reference_binaries_ubuntu-18.04.sha256sum @@ -1,9 +1,9 @@ 29382e72d0f3c6a72ce9517211952ff29ea270193d7f0ddc48ca69009ee29925 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840dk.bin -4d5165d8ff46148a585ade23d3030c8a95928a158d283ccd7c93e14902452b6f target/nrf52840dk_merged.hex +0c2732e9051d2a920a1b0c8ef1094d920145e34a169af24b25109685b913ba6a target/nrf52840dk_merged.hex 30f239390ae9bef0825731e4c82d40470fc5e9bded2bf0d942e92dbb5d4faba1 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle.bin -8204a87c9e93909ed79907f2d7b655d07397161ecd64bd213bc483630a38e8c9 target/nrf52840_dongle_merged.hex +d99d216f5c231b87e50b193dcb2cbdd8e09c5cee605abd72456da905832fece3 target/nrf52840_dongle_merged.hex e3acf15d5ae3a22aecff6cc58db5fc311f538f47328d348b7ad7db7f9ab5e72c third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle_dfu.bin -b937eaeea7ae9ca3c26bee082cb5af596942947c84171cb4d03cc66bc31d35da target/nrf52840_dongle_dfu_merged.hex +56845828e90e595388a0a219b5a9a5eda6f768d0e5cc7e2b1712ce5b4b2f848d target/nrf52840_dongle_dfu_merged.hex cae312a26a513ada6c198fdc59b2bba3860c51726b817a9fd17a4331ee12c882 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_mdk_dfu.bin -6d125877a207744a73b0b315152188a85329d31e8f85e8205ac6033e46056931 target/nrf52840_mdk_dfu_merged.hex -e6dbbc68daa1b5269dce5ddbc91ea00169f9c8ed8d94a574dac1524e63c21b18 target/tab/ctap2.tab +7028d2253d30e5a809f4d3c2deb4cb46953a9de31978834f01a3b1392da38291 target/nrf52840_mdk_dfu_merged.hex +f96c01efac9382c001d0e277247ff20f9b17b0bb34b98a38f0e4e9cc5c3c0b90 target/tab/ctap2.tab diff --git a/reproducible/reference_elf2tab_macos-10.15.txt b/reproducible/reference_elf2tab_macos-10.15.txt index dd0b0b2..1972223 100644 --- a/reproducible/reference_elf2tab_macos-10.15.txt +++ b/reproducible/reference_elf2tab_macos-10.15.txt @@ -5,8 +5,8 @@ Min RAM size from sections in ELF: 16 bytes Number of writeable flash regions: 0 Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Entry point is in .text section - Adding .text section. Offset: 128 (0x80). Length: 179204 (0x2bc04) bytes. - Adding .stack section. Offset: 179332 (0x2bc84). Length: 16384 (0x4000) bytes. + Adding .text section. Offset: 128 (0x80). Length: 179172 (0x2bbe4) bytes. + Adding .stack section. Offset: 179300 (0x2bc64). Length: 16384 (0x4000) bytes. Searching for .rel.X sections to add. TBF Header: version: 2 0x2 @@ -24,8 +24,8 @@ Min RAM size from sections in ELF: 16 bytes Number of writeable flash regions: 0 Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Entry point is in .text section - Adding .text section. Offset: 128 (0x80). Length: 179204 (0x2bc04) bytes. - Adding .stack section. Offset: 179332 (0x2bc84). Length: 16384 (0x4000) bytes. + Adding .text section. Offset: 128 (0x80). Length: 179172 (0x2bbe4) bytes. + Adding .stack section. Offset: 179300 (0x2bc64). Length: 16384 (0x4000) bytes. Searching for .rel.X sections to add. TBF Header: version: 2 0x2 @@ -43,8 +43,8 @@ Min RAM size from sections in ELF: 16 bytes Number of writeable flash regions: 0 Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Entry point is in .text section - Adding .text section. Offset: 128 (0x80). Length: 179204 (0x2bc04) bytes. - Adding .stack section. Offset: 179332 (0x2bc84). Length: 16384 (0x4000) bytes. + Adding .text section. Offset: 128 (0x80). Length: 179172 (0x2bbe4) bytes. + Adding .stack section. Offset: 179300 (0x2bc64). Length: 16384 (0x4000) bytes. Searching for .rel.X sections to add. TBF Header: version: 2 0x2 @@ -62,8 +62,8 @@ Min RAM size from sections in ELF: 16 bytes Number of writeable flash regions: 0 Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Entry point is in .text section - Adding .text section. Offset: 128 (0x80). Length: 179204 (0x2bc04) bytes. - Adding .stack section. Offset: 179332 (0x2bc84). Length: 16384 (0x4000) bytes. + Adding .text section. Offset: 128 (0x80). Length: 179172 (0x2bbe4) bytes. + Adding .stack section. Offset: 179300 (0x2bc64). Length: 16384 (0x4000) bytes. Searching for .rel.X sections to add. TBF Header: version: 2 0x2 diff --git a/reproducible/reference_elf2tab_ubuntu-18.04.txt b/reproducible/reference_elf2tab_ubuntu-18.04.txt index 6b3b7a2..2571f3b 100644 --- a/reproducible/reference_elf2tab_ubuntu-18.04.txt +++ b/reproducible/reference_elf2tab_ubuntu-18.04.txt @@ -5,8 +5,8 @@ Min RAM size from sections in ELF: 16 bytes Number of writeable flash regions: 0 Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Entry point is in .text section - Adding .text section. Offset: 128 (0x80). Length: 179236 (0x2bc24) bytes. - Adding .stack section. Offset: 179364 (0x2bca4). Length: 16384 (0x4000) bytes. + Adding .text section. Offset: 128 (0x80). Length: 178740 (0x2ba34) bytes. + Adding .stack section. Offset: 178868 (0x2bab4). Length: 16384 (0x4000) bytes. Searching for .rel.X sections to add. TBF Header: version: 2 0x2 @@ -24,8 +24,8 @@ Min RAM size from sections in ELF: 16 bytes Number of writeable flash regions: 0 Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Entry point is in .text section - Adding .text section. Offset: 128 (0x80). Length: 179236 (0x2bc24) bytes. - Adding .stack section. Offset: 179364 (0x2bca4). Length: 16384 (0x4000) bytes. + Adding .text section. Offset: 128 (0x80). Length: 178740 (0x2ba34) bytes. + Adding .stack section. Offset: 178868 (0x2bab4). Length: 16384 (0x4000) bytes. Searching for .rel.X sections to add. TBF Header: version: 2 0x2 @@ -43,8 +43,8 @@ Min RAM size from sections in ELF: 16 bytes Number of writeable flash regions: 0 Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Entry point is in .text section - Adding .text section. Offset: 128 (0x80). Length: 179236 (0x2bc24) bytes. - Adding .stack section. Offset: 179364 (0x2bca4). Length: 16384 (0x4000) bytes. + Adding .text section. Offset: 128 (0x80). Length: 178740 (0x2ba34) bytes. + Adding .stack section. Offset: 178868 (0x2bab4). Length: 16384 (0x4000) bytes. Searching for .rel.X sections to add. TBF Header: version: 2 0x2 @@ -62,8 +62,8 @@ Min RAM size from sections in ELF: 16 bytes Number of writeable flash regions: 0 Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Entry point is in .text section - Adding .text section. Offset: 128 (0x80). Length: 179236 (0x2bc24) bytes. - Adding .stack section. Offset: 179364 (0x2bca4). Length: 16384 (0x4000) bytes. + Adding .text section. Offset: 128 (0x80). Length: 178740 (0x2ba34) bytes. + Adding .stack section. Offset: 178868 (0x2bab4). Length: 16384 (0x4000) bytes. Searching for .rel.X sections to add. TBF Header: version: 2 0x2 diff --git a/src/ctap/command.rs b/src/ctap/command.rs index 9f0e20b..ef1e6ed 100644 --- a/src/ctap/command.rs +++ b/src/ctap/command.rs @@ -37,6 +37,8 @@ pub enum Command { AuthenticatorClientPin(AuthenticatorClientPinParameters), AuthenticatorReset, AuthenticatorGetNextAssertion, + #[cfg(feature = "with_ctap2_1")] + AuthenticatorSelection, // TODO(kaczmarczyck) implement FIDO 2.1 commands (see below consts) } @@ -101,6 +103,11 @@ impl Command { // Parameters are ignored. Ok(Command::AuthenticatorGetNextAssertion) } + #[cfg(feature = "with_ctap2_1")] + Command::AUTHENTICATOR_SELECTION => { + // Parameters are ignored. + Ok(Command::AuthenticatorSelection) + } _ => Err(Ctap2StatusCode::CTAP1_ERR_INVALID_COMMAND), } } @@ -474,4 +481,12 @@ mod test { let command = Command::deserialize(&cbor_bytes); assert_eq!(command, Ok(Command::AuthenticatorGetNextAssertion)); } + + #[cfg(feature = "with_ctap2_1")] + #[test] + fn test_deserialize_selection() { + let cbor_bytes = [Command::AUTHENTICATOR_SELECTION]; + let command = Command::deserialize(&cbor_bytes); + assert_eq!(command, Ok(Command::AuthenticatorSelection)); + } } diff --git a/src/ctap/mod.rs b/src/ctap/mod.rs index 7edc79b..027e91f 100644 --- a/src/ctap/mod.rs +++ b/src/ctap/mod.rs @@ -367,8 +367,10 @@ where Command::AuthenticatorGetInfo => self.process_get_info(), Command::AuthenticatorClientPin(params) => self.process_client_pin(params), Command::AuthenticatorReset => self.process_reset(cid), + #[cfg(feature = "with_ctap2_1")] + Command::AuthenticatorSelection => self.process_selection(cid), // TODO(kaczmarczyck) implement GetNextAssertion and FIDO 2.1 commands - _ => unimplemented!(), + _ => self.process_unknown_command(), }; #[cfg(feature = "debug_ctap")] writeln!(&mut Console::new(), "Sending response: {:#?}", response).unwrap(); @@ -1100,6 +1102,16 @@ where Ok(ResponseData::AuthenticatorReset) } + #[cfg(feature = "with_ctap2_1")] + fn process_selection(&self, cid: ChannelID) -> Result { + (self.check_user_presence)(cid)?; + Ok(ResponseData::AuthenticatorSelection) + } + + fn process_unknown_command(&self) -> Result { + Err(Ctap2StatusCode::CTAP1_ERR_INVALID_COMMAND) + } + pub fn generate_auth_data(&self, rp_id_hash: &[u8], flag_byte: u8) -> Vec { let mut auth_data = vec![]; auth_data.extend(rp_id_hash); @@ -1708,6 +1720,18 @@ mod test { ); } + #[test] + fn test_process_unknown_command() { + let mut rng = ThreadRng256 {}; + let user_immediately_present = |_| Ok(()); + let mut ctap_state = CtapState::new(&mut rng, user_immediately_present); + + // This command does not exist. + let reset_reponse = ctap_state.process_command(&[0xDF], DUMMY_CHANNEL_ID); + let expected_response = vec![Ctap2StatusCode::CTAP1_ERR_INVALID_COMMAND as u8]; + assert_eq!(reset_reponse, expected_response); + } + #[test] fn test_encrypt_decrypt_credential() { let mut rng = ThreadRng256 {}; diff --git a/src/ctap/response.rs b/src/ctap/response.rs index 2a33a6d..0a4548d 100644 --- a/src/ctap/response.rs +++ b/src/ctap/response.rs @@ -31,6 +31,8 @@ pub enum ResponseData { AuthenticatorGetInfo(AuthenticatorGetInfoResponse), AuthenticatorClientPin(Option), AuthenticatorReset, + #[cfg(feature = "with_ctap2_1")] + AuthenticatorSelection, } impl From for Option { @@ -43,6 +45,8 @@ impl From for Option { ResponseData::AuthenticatorClientPin(Some(data)) => Some(data.into()), ResponseData::AuthenticatorClientPin(None) => None, ResponseData::AuthenticatorReset => None, + #[cfg(feature = "with_ctap2_1")] + ResponseData::AuthenticatorSelection => None, } } } @@ -372,4 +376,11 @@ mod test { let response_cbor: Option = ResponseData::AuthenticatorReset.into(); assert_eq!(response_cbor, None); } + + #[cfg(feature = "with_ctap2_1")] + #[test] + fn test_selection_into_cbor() { + let response_cbor: Option = ResponseData::AuthenticatorSelection.into(); + assert_eq!(response_cbor, None); + } }