Commit Graph

50 Commits

Author SHA1 Message Date
Robin Krahl 997311da4c pipe: Introduce Buffer type for message buffering 2024-06-27 13:59:08 +02:00
Robin Krahl 1620003031 pipe: Return response instead of sending directly 2024-03-18 15:20:31 +01:00
Robin Krahl 8e2c8b02a5 Use Result to collect errors 2024-03-18 15:07:28 +01:00
Robin Krahl 529fcfe2a9 pipe: Directly send error in send_error_now
Instead of resetting the pipe state after sending the error, we can
direclty write it to the endpoint as it will always fit into one init
packet.
2024-03-18 13:53:29 +01:00
Robin Krahl da5dd49e8a pipe: Move read and write handling into helper class 2024-03-18 13:53:26 +01:00
Robin Krahl 80b30e987a Update pipe visibility
Previously, some internals of the pipe module were public, while parts
of the public interface where only pub(crate).  This patch fixes
visibility in the pipe module so that internals are private and the
public API is public.

It also fixes some clippy lints on the way.
2024-03-11 10:47:25 +01:00
Robin Krahl 1db2e014f2 Don’t reset state on CTAPHID_CANCEL
When we receive a CTAPHID_CANCEL command and cancel a user presence
check, we still need to respond to the original command, typically with
a CTAP2_ERR_KEEPALIVE_CANCEL error.  And if we already finished
executing the command, there is no harm in sending out its response.

With this patch, we never discard responses that have already been
calculated.  Also, we never reset the pipe state and just finish the
normal command flow.  We just set the interrupt flag if the
authenticator is currently processing a command.
2024-02-29 21:34:23 +01:00
Robin Krahl eda9b76c36 Support invalid CTAPHID commands
Previously, we just ignored invalid CTAPHID commands.  With this patch,
we return a CTAPHID_INVALID_COMMAND error.
2024-02-22 13:31:39 +01:00
Sosthène Guédon 3f24df2f8b Use reference to the response rather than copying it 2023-07-12 11:39:17 +02:00
Sosthène Guédon e9cbf904f5 Use merged PRs 2023-06-20 17:37:08 +02:00
Sosthène Guédon d92deebf24 Fix typo 2023-06-20 17:37:08 +02:00
Sosthène Guédon 913f61527c Bump deps 2023-06-20 17:37:08 +02:00
Sosthène Guédon 33a47ec70b Update deps 2023-06-20 17:37:08 +02:00
Sosthène Guédon d85acccb8a Use released ref-swap 2023-06-20 17:37:08 +02:00
Sosthène Guédon 9dc54d6de8 Add request interrupt mechanism 2023-06-20 17:37:08 +02:00
Sosthène Guédon 2f658fbe84 Use upstream ctaphid-dispatch 2023-06-20 16:18:04 +02:00
Sosthène Guédon e415b176c8 Add pipe lifetime 2023-06-20 16:18:04 +02:00
Sosthène Guédon 2580bc6944 Migrate to interchange 0.3.0 2023-06-20 16:18:04 +02:00
Robin Krahl 46070aa05f Check if response message fits in buffer
Our packet buffer is smaller than the response buffer used by
ctaphid-dispatch.  Therefore we have to check whether a response fits
into the buffer and return an error if not.
2023-03-01 10:13:18 +01:00
Nicolas Stalder 2f29e0126f cargo fmt 0.1.0 2023-01-24 22:57:14 +01:00
Nicolas Stalder 51d2d8e72d clippy 2023-01-24 22:57:05 +01:00
Nicolas Stalder 2aa15b7011 Prepare release 2023-01-24 22:54:55 +01:00
Nicolas Stalder d872dbb815 Allow setting versions in CTAPHID_INIT 2022-03-17 23:23:14 +01:00
Nicolas Stalder a2104a29b3 Configurably larger CTAP pipe; winking 2022-03-17 23:23:14 +01:00
Nicolas Stalder 1d97873e72 Bump dependencies to published versions 2022-03-17 23:23:14 +01:00