google / google/OpenSK

Full CTAPHID_CANCEL support

Open
#758 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.4k
Forks
338
Avg merge
9m
Merged PRs (30d)
1

Description

Until we implemented fingerprint supported, only commands that check for user presence had a long enough runtime to need keepalives and accept cancellation in practise. Our `Env` therefore had USB packets in its user presence API:
https://github.com/google/OpenSK/blob/016e81ca772b909fb5673f4a5851d02eb9173e9c/libraries/opensk/src/api/user_presence.rs#L42

Now that we start supporting fingerprints, waiting for the user here needs to be reactive the same way. There are two ways to implement this:

A) Add it the same way we did for user presence.
B) Make OpenSK's API more async, and the calls to various parts of the hardware more independent.

The first solution is a direct fix for the problem, and the second one a bigger refactoring of the whole repository. While more work, it has some advantages:

1.
We can correctly implement the CTAPHID_CANCEL not only to cancel commands that wait for user input, but also any that have a longer processing time. The specification requests this [1], our other commands never needed it because they were fast enough. Some software cryptography implementations or PQC might make it a necessity though.

2.
It is a requirement for fix #685. In general, this decision can have implications on what hardware we support.

3.
It makes our implementation cleaner, and it should be easier for users to implement `Env` in the future.

4.
It simplifies some other work that is outstanding:
- We can move the main loop inside the library. This can help with making OpenSK a crate.
- It makes it easier to multiplex between USB and NFC packets, if we get to support that fully in the future.

[1] https://fidoalliance.org/specs/fido-v2.2-ps-20250714/fido-client-to-authenticator-protocol-v2.2-ps-20250714.html#usb-hid-cancel

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.