-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the largeBlobKeys extension and the largeBlobs command #41
Conversation
This patch updates the ctap-types dependency to pull in support for the largeBlobKey extension and the largeBlobs command.
This patch adds support for the largeBlobKey extension to the get_info command. It also adds a config entry to be able to enable or disable the extension.
This patch adds support for the largeBlobKey extension to make_credential. This means that we have to generate a 32-bit key and store it together with the credential if requested by the platform.
This patch adds support for the largeBlobKey extension to get_assertion. This means that we have to return the key stored together with the credential if it is present and requested by the platform.
This patch updates fido-authenticator to add support for the largeBlobKey extension and the largeBlobs command. See the fido-authenticator PR for more information: Nitrokey/fido-authenticator#41
For testing, use these PRs:
You can use the following tools for testing:
Note that there is an open issue with Chrome reporting an error for writes even if the write is successful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet tested on hardware.
trait Storage<C>: Sized { | ||
fn read(client: &mut C, location: Location, offset: usize, length: usize) -> Result<Chunk>; | ||
|
||
fn start_write(client: &mut C, offset: usize, expected_length: usize) -> Result<Self>; | ||
|
||
fn extend_buffer(&mut self, client: &mut C, data: &[u8]) -> Result<usize>; | ||
|
||
fn validate_checksum(&mut self, client: &mut C) -> bool; | ||
|
||
fn commit(&mut self, client: &mut C, location: Location) -> Result<()>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need a dedicated trait for that?
Can't it be just a group of free-standing functions where the implementation is selected based on the feature-flag?
No need to block merging on that since the storage will be revisited soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to have two implementations, one using the Trussed core API and one using the streaming extension. The trait should make sure that both are exchangeable.
Indeed Chrome no longer shows an error if we send an empty response instead of a response with an empty map when writing the large-blob array: trussed-dev/ctap-types#24 |
This branch adds support for the streaming API: https://github.com/Nitrokey/fido-authenticator/tree/large-blobs-chunked Requirements: |
I’ve updated Nitrokey/nitrokey-3-firmware#385 with a maximum size of 4096 bytes for the large-blob array. It mostly works fine in the usbip simulation, but sometimes after writing a large file, there seems to be an issue with the filesystem and subsequent larger writes fail. |
This patch implements the largeBlobs command for reading and writing the large-blob array. Currently, the maximum size of the total array with metadata is 1024 bytes because it has to fit in a Trussed message. The storage location can be configured by the runner.
This patch updates the credential management implementation to include the largeBlobKey if present.
If a resident credential is passed in the allowlist, we don’t deserialize the full credential. This means that we previously did not have access to the largeBlobKey in that case. Therefore, this patch adds the largeBlobKey to the StrippedCredential so that we can always access it. The downside is that this inceases the size of the credential ID. So a better alternative would be to load the full credential from the filesystem instead.
681d730
to
019a5d1
Compare
This patch updates fido-authenticator to add support for the largeBlobKey extension and the largeBlobs command in the test configuration over USB. See the fido-authenticator PR for more information: Nitrokey/fido-authenticator#41
This patch updates fido-authenticator to add support for the largeBlobKey extension and the largeBlobs command in the test configuration over USB. See the fido-authenticator PR for more information: Nitrokey/fido-authenticator#41
This patch implements the largeBlobKeys extension and the largeBlobs command. I tried to split it up into atomic commits to make it easier to review.
Limitations:
chunked
feature that replaces theSimpleStorage
insrc/ctap2/large_blobs.rs
with aChunkedStorage
that uses the streaming extension. The implementation uses theStorage
trait to try to ensure that the implementations can be easily switched.ctap-types
has aREALISTIC_MAX_MESSAGE_SIZE
constant (1200) and assumes that this is the maximum message size. But in fact, the max message size can be configured by the runner and is set tousbd_ctaphid::constants::MESSAGE_SIZE
(3072). This does not matter at the moment because our large-blob array has at most 1024 bytes, so even the buffer based on theREALISTIC_MAX_MESSAGE_SIZE
is large enough. Once we implement chunked storage, we need to add a feature flag to ctap-types to use the message size from usbd-ctaphid instead.Open issues:
Fixes: #38