Commit Graph

1238 Commits

Author SHA1 Message Date
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
Liam Murphy 7e0c0938bb Avoid app re-entry by passing App argument to relevant calls (#494)
* Avoid app re-entry by passing App argument to relevant calls

* Remove underscoring leading name

* fixups

* allows passing in capabilities to CtapHid (#496)

* Fix libfido in configure (#499)

* fix capitalization of Ctap2 in configure

* changes setup to match new libfido2 version

Co-authored-by: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com>
2022-06-16 15:44:33 +02:00
kaczmarczyck 92e1d51442 Fix libfido in configure (#499)
* fix capitalization of Ctap2 in configure

* changes setup to match new libfido2 version
2022-06-13 13:46:15 +02:00
kaczmarczyck 95aa02f932 allows passing in capabilities to CtapHid (#496) 2022-06-10 14:31:33 +02:00
Liam Murphy dc3e34b824 Use VENDOR_HID when creating USB config when Vendor HID enabled (#495)
* Use VENDOR_HID when creating USB config when Vendor HID enabled

* reduce noise
2022-06-10 12:56:29 +02:00
Julien Cretin 4763c3a3f1 Merge pull request #489 from egor-duda/hostenv-file-storage
Hostenv file storage
2022-06-08 17:06:13 +02:00
Julien Cretin aea4c56884 Merge branch 'develop' into hostenv-file-storage 2022-06-08 15:55:28 +02:00
Jean-Michel Picod 15233dba3e Fix pylint configuration, script and matcher (#491)
* Fix pylint configuration, script and matcher

* Makes yapf happy

* Fix one-liner docstring

* Fix one-liner docstring
2022-06-07 20:39:22 +02:00
Egor Duda cc1fb2543e Accommodate Store requirements for max_word_writes and max_page_erases 2022-06-07 17:04:18 +03:00
Egor Duda 0158cc846d Use 0xff for consistency 2022-06-07 15:58:08 +03:00
Egor Duda 2708074949 Improve variable names and comments readability 2022-06-06 15:08:42 +03:00
Egor Duda 660b6b76b2 Make FileOptions available to library's users 2022-06-06 15:06:29 +03:00
Egor Duda 4e47968233 Separate options type for FileStorage, remove hardcoded constants 2022-06-05 22:40:59 +03:00
Egor Duda c0299c3225 No need for specific feature, use std instead 2022-06-05 22:40:32 +03:00
Egor Duda f2cb2f72e7 Use StorageError::CustomError for implementations-specific (I/O) errors 2022-06-05 22:39:13 +03:00
Egor Duda 1cf7373bfe With new Storage API there's no need to double-buffer file data
read_slice(...) can return Cow::Owned buffer to the caller
2022-06-05 15:16:49 +03:00