81 Commits
Author SHA1 Message Date
Sosthène GuédonandNicolas Stalder 50912999b3 Prepare release 0.2.0 0.2.0 2023-02-07 02:20:28 +01:00
Sosthène GuédonandRobin Krahl 693b647b03 Fix clippy warnings 2023-02-02 20:50:40 +01:00
Robin Krahl 7de7b416b7 Implement abort handling
Previously, we just panicked when receiving an abort request.  This
caused a long delay in scdaemon/gnupg when the NK3 was connected.  With
this patch, we add abort handling to usb-ccid to fix this issue.

The implementation is based on Section 5.3.1 of the CCID specification
[0].  The device is expected to send two abort messages, one over the
bulk endpoint and one over the control pipe.  We perform the abort once
we have received both messages.  In the time between receiving the first
and the second message, we reject all incoming messages on the bulk
endpoint.

[0] https://www.usb.org/sites/default/files/DWG_Smart-Card_CCID_Rev110.pdf
2023-01-31 10:28:25 +01:00
Sosthène GuédonandRobin Krahl 1a2b703245 Use assert! in const 2023-01-31 10:27:49 +01:00
Markus MeissnerandGitHub 7e6cc15da7 Merge pull request #6 from trussed-dev/fix-calc
fix calculation during packet handling
2023-01-30 22:32:02 +01:00
Markus Meissner 1f9b6820a8 fix long_packet_missing calculation 2023-01-30 22:26:03 +01:00
Sosthène GuédonandRobin Krahl 84de5d4fe3 Remove public modules 2023-01-26 20:54:03 +01:00
Sosthène GuédonandRobin Krahl 6e589d6b76 Remove the PowerSelection enum
This could be usefull for a smartcard reader's firmware,
but is not useful to our use-case, and was currently used anyway.
2023-01-26 20:54:03 +01:00
Sosthène GuédonandRobin Krahl fe4424496f Remove unused items 2023-01-26 20:54:03 +01:00
Sosthène GuédonandRobin Krahl 1c4c9fda5c Fix visibility
All the internals of the crate were public. This patch makes a lot more private
to allow evolution without everything being a breaking change
2023-01-26 20:54:03 +01:00
sosthene-nitrokeyandGitHub d2af0efeff Merge pull request #3 from trussed-dev/fix-fmt
Fix formatting error
2023-01-25 13:27:05 +01:00
Robin KrahlandGitHub c9d9a06227 Merge pull request #4 from trussed-dev/alloc
Remove `'static` requirement on the bus
2023-01-25 12:02:03 +01:00
Sosthène Guédon a3069b39fe Remove 'static requirement on the bus
This is required by https://github.com/trussed-dev/pc-usbip-runner
2023-01-25 11:53:57 +01:00
Sosthène Guédon 70cb2df93a Fix formatting error 2023-01-25 11:31:46 +01:00
Robin KrahlandGitHub 3826ffebf0 Merge pull request #1 from trussed-dev/nitrokey-upstreaming
Upstream changes from the Nitrokey firmware repository
2023-01-25 11:25:38 +01:00
Sosthène Guédon 0dc5ac9d8c Rename packet_len to data_len
This makes the distinction clearer between the length of the USB packet
and the length of the data its CCID header references
2023-01-25 10:11:53 +01:00
Sosthène Guédon 9d3949659c Fix https://github.com/Nitrokey/nitrokey-3-firmware/issues/150
When using highspeed usb, some calculations worked with usb 1 constants.
This caused packets to be handled improperly.
2023-01-25 10:11:31 +01:00
Sosthène Guédon 34d587cf77 Improve usage of constants to avoid magic valuse 2023-01-25 10:11:31 +01:00
Sosthène Guédon 06bf940f3a Log errors 2023-01-25 10:11:31 +01:00
Sosthène Guédon 7434e799f1 Stop using undocumented Interchange APIs
This doesn't change the panic risk. The internal `rp_mut` method uses
the `unreachable!` macro
2023-01-25 10:11:23 +01:00
Sosthène Guédon a92755abd3 Add error message to panic 2023-01-25 10:11:23 +01:00
Sosthène Guédon 0a7bd5c4e4 Use == for readability 2023-01-25 10:11:23 +01:00
Sosthène Guédon ef34467e87 Fix links and add basic docs 2023-01-25 10:11:23 +01:00
Sosthène Guédon cf11d375b7 Fix typo 2023-01-25 10:11:23 +01:00
Sosthène Guédon e3cb8acfef Fix panic when running on x86_64
The length of usize::to_be_bytes depends on the size of the pointer on the
targeted cpu architecture
2023-01-25 10:11:23 +01:00