Commit Graph

1203 Commits

Author SHA1 Message Date
kaczmarczyck
5daf5f81d1 uses latest in workflows (#528) 2022-08-15 10:44:05 +02:00
Julien Cretin
d3e01d22fb Duplicate the credential management command as a vendor command (#527)
* Duplicate the credential management command as a vendor command

This permits to work with libfido2 and thus ssh-add. Fix #526.

* fix deploy_partition script
2022-08-13 06:27:31 +02:00
Liam Murphy
c6d3f51b5f Add configure-only mode to deploy.py script (#471)
* Add configure-only mode to deploy.py script

* Default configure flag to true
2022-08-09 08:12:37 +02:00
Liam Murphy
f07be7f2ac Tweak: use the Usage page const, not an immediate (#525)
Co-authored-by: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com>
2022-08-08 16:23:19 +02:00
Liam Murphy
262e505ef7 Support configure via the Vendor interface (#524)
* Support configure via the Vendor interface

* Adjust tests now that GetInfo is supported on vendor_hid

* Add test for vendor_hid not supporting FIDO command
2022-08-08 13:54:46 +02:00
Liam Murphy
4a2217f025 Interleave sending and receiving of packets to reduce rx latency (#515)
* Interleave sending and receiving of packets to reduce latency in receiving of packets

* Add patch to CtapUsbSyscallDriver

* Minor tweaks from review

* Log when overwritting an existing reply

* Only log when 'debug_ctap' is enabled

* Make ctap mod public, as per review

* Rename send_or_recv to send_and_maybe_recv

* fix typo

* Don't process packets on other transport while doing keepalive

* Don't process packets on other transport while doing keepalive

* More accurately determine if reply has finished

* Move comment closer to appropriate location

* Add tests for canceling keepalive packets

* Added a TODO for kaczmarczyck re ctap module being public

* remove the unnecessary sleep()s

* undo messed up commit

* address pylint warnings

* Fix merge mess up, and patch fido2 Usage Page

* Fix up completely borked merge

* Remove patch to FIDO usage, after #523.

* remove obsolete aspects to diff

Co-authored-by: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com>
2022-08-04 14:54:22 +02:00
Liam Murphy
0dad7b19ff Set the Vendor HID Usage to 1 (#523) 2022-08-04 13:32:34 +02:00
Liam Murphy
6276904a42 Fix user presence by not overwriting error with OK() (#521)
* Fix user presence by not overwriting error with OK()

* revert debugging change to TOUCH_TIMEOUT_MS

* fix up incomplete merge

* rename variable to more understandable name

* Add tests to test user_presence
2022-08-02 11:38:02 +02:00
Liam Murphy
253d27d612 Add tests to demonstrate broken user presence timeouts (#520)
* Add tests to demonstrate broken user presence timeouts

* fix up some formatting

* apply auto-formatting
2022-08-01 09:13:14 +02:00
Liam Murphy
2bc405165e Process incoming packets on different interfaces in a round robin fashion. (#514)
* Round-robin order for receiving packets

* Update next packet after sending packet

* fix up some formatted raised during review

* remove the whitespace noise from last commit
2022-07-26 13:07:26 +02:00
hcyang
8ef813cf76 Move out check credProtectPolicy logic (#516)
* Move out check credProtectPolicy logic

Move the credProtectPolicy check outside credential ID decryption &
discoverable credential finding. Modify the unit tests, and add unit
tests for credProtectPolicy checking in non resident flows that were
originally missing.
2022-07-23 11:10:10 +08:00
hcyang
9bb1a2f7ac Fix ctap1 clippy warning (#517)
And improve clippy workflows.
2022-07-22 13:23:29 +08:00
Liam Murphy
168de290de Add test script to verify Vendor HID interface (#503)
* Add test script to verify Vendor HID interface

* fix formatting

* fix formatting

* fix formatting

* fix formatting

* duplicate tests to test both interfaces first and second

* simplifiy using unique byte val

* more tests

* fix up tings from review

* reset rx packets after reading.

* fix formatting.
2022-07-20 12:27:07 +02:00
Liam Murphy
fbe00d57f9 Fix USB deadlock handling pending packets (#513) 2022-07-15 08:23:27 +02:00
Julien Cretin
d2377740ab Merge pull request #511 from ia0/attestation_store
Abstract attestation support
2022-07-14 13:27:48 +02:00
Julien Cretin
07a28fe611 Inline Helper 2022-07-14 12:50:39 +02:00
Julien Cretin
b28f8f6d33 Merge branch 'develop' into attestation_store 2022-07-14 12:37:11 +02:00
hcyang
4736cc63c4 Add CBOR credential ID type (#512)
* Add CBOR credential ID type

Update the format of the credential ID we generated to extend the
encrypted portion from only private_key + rp_id_hash to a flexible CBOR
map. This way we can persist more data into the key handle in the future
without need of a new version.

We add credProtectPolicy to the persisted data in this commit too, so we
can correctly check the credProtectPolicy for non-discoverable
credentials in follow-up commits.

* Fixed some style problems.

* Fix cargo clippy warning

* Check credProtectPolicy for non-discoverable credentials.

* Remove support of old v1, v2 key handles

- And changed some style problems

* Style changes

* Add missing `alloc` use
2022-07-14 14:17:12 +08:00
Julien Cretin
f528567ce1 Expose the get and set helper implementation 2022-07-12 16:58:29 +02:00
Julien Cretin
bc354d8abb Fix attestation priority 2022-07-11 11:16:58 +02:00
Julien Cretin
0bbc8663c2 Remove unused variable 2022-07-07 17:28:33 +02:00
Julien Cretin
25c884c070 Address comments 2022-07-07 17:23:24 +02:00
Julien Cretin
80a6b82ed7 Abstract attestation support 2022-07-05 16:26:07 +02:00
Julien Cretin
aee7d7c9b3 Merge pull request #509 from ia0/keystore
Add a key store to avoid storing secrets in the store
2022-07-01 14:31:10 +02:00
Julien Cretin
c8dc1dd0e8 Rename STORE_KEY 2022-07-01 13:59:09 +02:00
Julien Cretin
ecb98b0f58 Return Result instead of Option 2022-07-01 13:30:27 +02:00
Julien Cretin
30a3205fa7 Address comments 2022-07-01 10:58:56 +02:00
Julien Cretin
2095513771 Merge branch 'develop' into keystore 2022-07-01 10:33:58 +02:00
Julien Cretin
0c64dd4778 Merge pull request #510 from ia0/readonly
Configure the flash as read-only at boot
2022-06-30 19:04:08 +02:00
kaczmarczyck
adecf281dd Merge branch 'develop' into readonly 2022-06-30 18:16:14 +02:00
Julien Cretin
8549e2e436 Configure the flash as read-only at boot 2022-06-30 16:56:05 +02:00
Julien Cretin
ff6c700cd9 Use indirection to implement the default KeyStore 2022-06-30 15:03:38 +02:00
Julien Cretin
2256c739cd Fix ed25519 test 2022-06-30 12:04:46 +02:00
Julien Cretin
2f9e82696d Fix ctap1 tests 2022-06-30 11:53:44 +02:00
Julien Cretin
87a4dc725f Fix doc 2022-06-30 11:43:11 +02:00
Julien Cretin
fcdf617a2e Rename kh_ to key_handle_ 2022-06-30 11:38:03 +02:00
Julien Cretin
9a7760f362 Actually use ECDSA seed mechanism 2022-06-30 11:35:42 +02:00
Julien Cretin
d793a992d3 Add a key store to avoid storing secrets in the store 2022-06-29 12:51:57 +02:00
foopub
a9a67ae0d7 Provide openocd_cmd and add some documentation (#492)
* Provide openocd_cmd

* Add openocd instructions for dongle
2022-06-29 01:40:02 +02:00
Julien Cretin
667c269552 Merge pull request #508 from ia0/copyright
Add missing copyright notice
2022-06-28 12:23:30 +02:00
Julien Cretin
55a856fd88 Add missing copyright notice 2022-06-28 11:06:04 +02:00
egor-duda
41780e9e33 Move protocol-specific user presence checking code from Env to CTAP library (#501)
* Common duration type for ctap library independent of TockOS

* Implement Env-specific ctap-hid channels for I/O
Common I/O Status, Error and Result types

* Move common user presence checking code to ctap library

* Move CtapHidChannel and UserPresence traits, with their accompanying
types to separate API mods. Remove Default implementations of methods
in these traits, to keep all implementation details inside of concrete
Env types.

Rename methods in UserPresence trait, for better readability.

Remove duplicate code for finding appropriate HID channel for given
transport.

Rework check_user_presence() function so that there's no more need for
quick_check() method in UserPresence trait. To short-circuit user
presence check, Env implementation may use wait_with_timeout() method.

* Fix button press wait with zero timeout for TockEnv

* Fix formatting

* Remove type for duration, use embedded_time::duration::Milliseconds
directly, for better readability.

Treat any unconfirmed result of user presence check as an error, which
maps more naturally to CTAP spec status codes.

Remove unneeded underscores in trait definition.

Store usb endpoint directly, in TockEnv channels, to avoid unneeded
conversions.

* No need for separate error type for send_keepalive_up_needed()

* Document UserPresence trait and types.

Remove unused parameters in UserPresence trait's methods.

Add conversion function from UserPresence errors to Ctap2 status codes.

Do not check button status when tock user presence wait is called with
zero timeout.

* Make test environment always report success sending data

* Rename CtapHidChannel to HidConnection, rename *_hid_channel ->
*_hid_connection, for clarity. Use "Channel" to refer to the logical
connection from authenticator to one client, and use "Connection" to
refer to physical connection of authenticator to platform, on which
clients run.

Remove channel parameter from user presence API, it's not needed.

* Remove duplicate comments.

Co-authored-by: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com>
2022-06-23 16:34:27 +02:00
Julien Cretin
e52cafb394 Merge pull request #505 from ia0/patches
Also restore index for check
2022-06-22 13:30:21 +02:00
Julien Cretin
7d414439fd Also restore index for check 2022-06-22 11:26:02 +02:00
Julien Cretin
195ac4a28c Merge pull request #504 from ia0/patches
Add check command to patches script
2022-06-22 10:45:23 +02:00
Julien Cretin
d7b24424e5 Disable patches check on github 2022-06-21 19:58:43 +02:00
Julien Cretin
90322cf5ed Fix pylint 2022-06-21 19:52:10 +02:00
Julien Cretin
b14ed0e742 Add check command to patches script 2022-06-21 19:42:37 +02:00
Liam Murphy
2544afbfee Connect Vendor HID interface between USB driver and CTAP app (#490)
* Connect Vendor HID endpoint to Ctap app

* tweaks from review

* formatting nit

* revert tock submodule revision

* fix formatting of deploy.py for yapf error

* Changes based on review

* Track state for each USB endpoint separately

* Rename patch file to ensure correct patching order

* Adjust patch from changes #494 and #500

* rustfmt

* rustfmt

* Deprecate patch 11 in favor of this full working code
2022-06-20 07:31:31 +02:00
kaczmarczyck
1d53f3c921 Adapts libtock drivers for vendor HID (#500)
* adapts libtock drivers for vendor HID

* status with timeout
2022-06-16 17:56:44 +02:00