Skip to content
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

Fix buffer size in large-blobs response #25

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

robin-nitrokey
Copy link
Member

The buffer size used in the response to the large-blobs command should match the maximum message size of the FIDO2 implementation (minus 64). At the same time, the buffer size must be hardcoded because serde-indexed does not support const generics. As a temporary workaround, this PR changes the default buffer size to zero (to reduce stack usage if the extension is not used) and sets the buffer size to 3008 if the large-blobs feature is activated (matching the max message size declared by usbd-ctaphid that is used in solo2 and nitrokey-3-firmware).

This PR also removes the REALISTIC_MAX_MESSAGE_SIZE as it is unused in ctap-types and does not have any significance for other crates either.

This patch removes the unused REALISTIC_MAX_MESSAGE_SIZE constant.  Its
value has no inherent meaning, and applications should not rely on it.
In fact, implementations in the Trussed ecosystem typically use a max
message size of 3072, see usbd-ctaphid.
The buffer size used in the response to the large-blobs command should
match the maximum message size of the FIDO2 implementation (minus 64).
At the same time, the buffer size must be hardcoded because
serde-indexed does not support const generics.  As a temporary
workaround, this patch changes the default buffer size to zero (to
reduce stack usage if the extension is not used) and sets the buffer
size to 3008 if the large-blobs feature is activated (matching the max
message size declared by usbd-ctaphid that is used in solo2 and
nitrokey-3-firmware).
@robin-nitrokey robin-nitrokey merged commit 7d4ad69 into trussed-dev:main Nov 29, 2023
4 checks passed
@robin-nitrokey robin-nitrokey deleted the msg-size branch November 29, 2023 10:18
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