Skip to content

Commit

Permalink
Fix CTAPHID command dispatch for admin app
Browse files Browse the repository at this point in the history
Previously, the CTAPHID interface of the admin app did not handle the
UUID command and interpreted all unknown commands as Wink commands.
With this patch, we explicitly handle both the Wink and the UUID command
and return an error if any other command is received.

Fixes Nitrokey#8.
  • Loading branch information
robin-nitrokey committed Oct 18, 2021
1 parent b418ad0 commit fb2bf7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion components/admin-app/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ where T: TrussedClient,

fn call(&mut self, command: HidCommand, input_data: &Message, response: &mut Message) -> hid::AppResult {
match command {
HidCommand::Wink => {
self.got_wink = true;
}
HidCommand::Vendor(REBOOT) => {
R::reboot();
}
Expand All @@ -111,8 +114,12 @@ where T: TrussedClient,
// GET VERSION
response.extend_from_slice(&self.version.to_be_bytes()).ok();
}
HidCommand::Vendor(UUID) => {
// Get UUID
response.extend_from_slice(&self.uuid).ok();
}
_ => {
self.got_wink = true;
return Err(hid::Error::InvalidCommand);
}
}
Ok(())
Expand Down
4 changes: 4 additions & 0 deletions runners/lpc55/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

- Fix CTAPHID command dispatch for the admin application (#8).

# v1.0.0 (2021-10-16)

First stable firmware release with FIDO authenticator.

0 comments on commit fb2bf7a

Please sign in to comment.