Skip to content

Conversation

@msirringhaus
Copy link
Contributor

Implement basic writing and reading of large blob arrays associated with credentials.
Not yet supported: Stand-alone functions for updating (although that would be just reading, then writing), and Garbage collection.

Since we probably won't use this in Firefox right away, I have moved all operations that require more dependencies outside of the core and into the examples. In theory, we could all of that internally, but then we'd need AEAD-GCM and DEFLATE in the core.

@msirringhaus msirringhaus force-pushed the largeblobs branch 3 times, most recently from 3599d70 to 77572e2 Compare July 30, 2024 15:06
Copy link
Collaborator

@jschanck jschanck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the wait on this one. Just a few comments below.

where
Dev: FidoDevice,
{
if input.is_empty() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also error out if the input is length 1, otherwise we'll panic on &input[1..] below.


let byte_len = large_blob.len() as u64;
let large_blob_array: Vec<LargeBlobArrayElement> =
from_slice(large_blob).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to panic if the authenticator returns malformed data.

.get_authenticator_info()
.and_then(|i| i.max_msg_size)
.unwrap_or(1024)
- 64;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a guarantee that max_msg_size is greater than 64? We would need to error out if it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I interpreted the spec as "it has to be 1024 or bigger", but the way it is worded does indeed allow for smaller max_msg_sizes. (Plus, we may just as well guard against non-compliant tokens)

Likewise, because some authenticators are memory constrained, the maximum message size supported by an authenticator MAY be limited. By default, authenticators MUST support messages of at least 1024 bytes. Authenticators MAY declare a different maximum message size supported using the maxMsgSize authenticatorGetInfo result parameter.

I'll add a check and error out if it is smaller or equal to 64

.get_authenticator_info()
.and_then(|i| i.max_msg_size)
.unwrap_or(1024)
- 64;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, we need a consistency check here.

@jschanck jschanck mentioned this pull request Oct 22, 2025
@msirringhaus
Copy link
Contributor Author

Well, this was perfect timing if there ever was one. After all this time, generic-array pushed a 'broken' dot-release last week that causes deprecation warnings to be emitted. I need to do a weird dance now by requesting the new generic-array-version in our Cargo.toml with a compat-feature flag on, as the aes_gcm-folks don't have a new version ready and try to do it only by the end of the year.
Luckily, all this is only in dev-dependencies (I could avoid the warning in the main code).

@jschanck jschanck merged commit b5beeee into mozilla:ctap2-2021 Oct 23, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants