166 Commits

Author SHA1 Message Date
Robin Krahl 86f7b3dc93 Use enums instead of string constants
Previously, we used String<_> to represent string constants in some
responses.  This has multiple drawbacks:
- It is error-prone because the value is not validated.
- Construction is fallible because of the fixed length of the string.
- The length needs to be bumped if longer values are added.

This patch introduces enums to replace these constants.  As cbor_smol
serializes enums using the variant index instead of the string, we need
to manually implement the string conversion.
2024-06-22 15:06:10 +02:00
Robin Krahl be9589d303 Release v0.2.0 0.2.0 2024-06-21 13:53:55 +02:00
Robin Krahl 8ed4af3aa1 make_credential: Make att_stmt optional in Response
In CTAP 2.2, att_stmt will be optional in the make_credential response.
Applying this change now allows us to release v0.2.0 and then add the
remaining (compatible) changes required for CTAP 2.2 in a patch release.
2024-06-21 11:15:52 +02:00
Robin Krahl 8732e0096d Use byte arrays where possible
Fixes: https://github.com/trussed-dev/ctap-types/issues/45
2024-06-21 11:00:20 +02:00
Robin Krahl cd854a815b get_info: Add fields for CTAP 2.1 2024-06-21 10:11:17 +02:00
Robin Krahl bf5736b750 get_info: Put uncommon fields behind feature flag 2024-06-21 10:08:12 +02:00
Robin Krahl aa1164c64e Use references where possible 2024-06-21 10:05:09 +02:00
Robin Krahl d172ccb154 Check all features in CI 2024-06-20 10:03:04 +02:00
Robin Krahl 3e42568a39 Mark requests and responses as non-exhaustive 2024-06-12 12:49:11 +02:00
Robin Krahl 261c928602 Mark extension structs as non-exhaustive 2024-06-12 12:13:59 +02:00
Robin Krahl a59d966081 Remove dead code
This patch removes code that has been commented out and empty files that
are not actually used.  It also removes the unused and undocumented
get_assertion::Responses typedef.
2024-06-12 12:11:34 +02:00
Robin Krahl 18d0c5969b Use references for ClientPin, CredentialManagement 2024-06-11 12:37:51 +02:00
Robin Krahl a2cc1089f3 Use cosey 2024-06-02 12:25:42 +02:00
Robin Krahl a9f8003a1d Fix hmac-secret salt_auth size 2024-03-04 09:46:21 +01:00
Robin Krahl 4846817d9c client_pin: Add permissions 2024-03-01 16:54:44 +01:00
Robin Krahl 530a2cefad Add enterprise_attestation to make_credential::Request 2024-03-01 15:26:48 +01:00
Robin Krahl fd19cede89 credential_management: Add UpdateUserInformation subcommand 2024-03-01 15:26:25 +01:00
Robin Krahl 3735eb5a8e Add support for PIN protocol 2
This means that all encrypted values need additional 16 bytes for the
IV, and the PIN hash is now completely transmitted instead of truncating
it to 16 bytes.
2024-03-01 15:26:03 +01:00
Robin Krahl f0db7acb87 Support up to two PIN protocols 2024-02-28 13:10:17 +01:00
Robin Krahl e45b0c4bb1 Use upstream serde-indexed 2024-02-22 16:39:36 +01:00
Robin Krahl 885bcebdb2 Handle overlong icon values
We skip the icon field during deserialization if it is too long.
Previously, we directly tried to deserialize a String<N> and ignored any
errors.  This means that we also ignored any other errors, e. g. for
invalid data types.

This patch changes the implementation to first deserialize a string
slice and handle errors occuring during the deserialization.  Then we
check if the string slice fits into String<N> or if we should ignore the
value.
2024-02-22 13:52:19 +01:00
Sosthène Guédon 084db87a80 Remove unneeded dependencies 2023-12-07 15:29:14 +01:00
Robin Krahl 7d4ad69e64 Configure large-blobs buffer size with feature flag
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).
2023-11-29 11:18:28 +01:00
Robin Krahl 3b849e5948 Remove REALISTIC_MAX_MESSAGE_SIZE
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.
2023-11-29 11:18:28 +01:00
Robin Krahl 85eb70969d Replace empty maps with an empty response
Instead of sending an empty CBOR map as a response, we now always send
an empty response.  Previously, we had this as a special case for the
ClientPin response, but we need it for LargeBlobs too.  So a generic
implementation makes more sense and is easier to maintain.
2023-11-28 10:49:46 +01:00