Commit Graph

47 Commits

Author SHA1 Message Date
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
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
ecb98b0f58 Return Result instead of Option 2022-07-01 13:30:27 +02:00
Julien Cretin
2f9e82696d Fix ctap1 tests 2022-06-30 11:53:44 +02:00
Julien Cretin
9a7760f362 Actually use ECDSA seed mechanism 2022-06-30 11:35:42 +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
kaczmarczyck
f95ae1f5ab Make private keys extensible (#476)
* adds PrivateKey to handle different algorithms

* fixes input check problem of decrypt_credential_source

* addresses comments

* version number not encrypted

* version number test

* adds a credential size test

* removes the algorithm from credential encoding
2022-05-10 14:31:29 +02:00
kaczmarczyck
8979af6ca4 adds Eq to PartialEq (#477) 2022-05-05 15:50:28 +02:00
Howard Yang
ab67d14e93 Move 3 pure constants to new file 2022-04-14 19:21:51 +08:00
kaczmarczyck
7e7d5e38a1 enforces Module imports granularity (#445) 2022-03-14 20:44:48 +01:00
Shiling Wang
2050f9f272 Replaced Libtock driver clock with embedded_time::Clock (#422)
* Replaced Libtock driver clock with embedded_time::Clock

* Add unittest and address some comments

* Add unittest and address some comments
2022-03-10 16:18:47 +01:00
Julien Cretin
732523d380 Use Store instead of Storage in Env 2022-03-07 12:48:33 +01:00
Julien Cretin
c4a27bf935 Add Storage and UpgradeStorage to Env 2022-03-03 17:37:28 +01:00
Julien Cretin
18faf9f38f Introduce a trait to abstract the CTAP environment
The end goal is to provide users with:
- the Env trait that they should implement
- the Ctap struct that they can use
2022-03-03 17:32:48 +01:00
Jean-Michel Picod
c1f2551d0d Bump Tock kernel version (#374)
* Bump Tock kernel version

* Update boards to new kernel

* Update patches to new kernel

* Update PR template

* Bump libtock-rs

* Use new layout from libtock-rs

* Fix clippy warnings due to updated toolchain

* Fix new toolchain file format

* Bump elf2tab to v0.7.0

* Fix worklow and setup.sh script to use the TOML rust-toolchain file

* New libtock-rs style of declaring the stack.

* Fix padding in layout file.

The layout from libtock-rs generates invalid flash padding.
The value is 32-bit and therefore setting padding to 0xff yields
0xff000000 instead of 0xffffffff that we want.

* adds tock patch for app break hard fault

* sets in deploy, removed patch 04-mpu-fix

* fixed the if deploy

* fixes indentation

* updates board names in install.md

* fix docs and deploy style

Co-authored-by: Fabian Kaczmarczyck <kaczmarczyck@google.com>
Co-authored-by: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com>
2021-09-10 08:32:34 +02:00
Fabian Kaczmarczyck
f90d43a6a1 implements alwaysUv and makeCredUvNotRqd 2021-02-05 18:57:39 +01:00
Fabian Kaczmarczyck
371e8b6f35 remove conditional trait implementation 2021-02-02 05:46:03 +01:00
Fabian Kaczmarczyck
da27848c27 updates license header to 2021 in ctap 2021-01-12 19:13:43 +01:00
Kamran Khan
35bdfe90ed Re-instate the length check for Le bytes 2020-12-14 04:54:25 -08:00
Kamran Khan
dbbdddd58b Fix error codes 2020-12-14 03:45:13 -08:00
Kamran Khan
9c9f9efcce Merge remote-tracking branch 'upstream/master' into ctap1-new-apdu-parser 2020-12-10 21:18:53 -08:00
Kamran Khan
29dbff7a40 The great ApduStatusCode encroachment 2020-12-10 20:15:05 -08:00
Julien Cretin
f5ef235c69 Merge branch 'master' into v2_lib 2020-12-10 09:38:26 +01:00
Kamran Khan
6f1c63e9b8 Add test cases to cover different length scenarios 2020-12-09 21:06:49 -08:00
Fabian Kaczmarczyck
90def7dfd3 implicitly generate HMAC-secret 2020-12-08 18:12:48 +01:00
Kamran Khan
56bc86c5d0 No need to cast again 2020-12-07 23:40:06 -08:00
Kamran Khan
2d17bb2afa Readability improvements 2020-12-07 23:38:21 -08:00
Kamran Khan
e4d160aaee Use TryFrom to convert between APDU and CTAP status codes 2020-12-07 23:32:04 -08:00
Kamran Khan
4c84e94039 Use new APDU parser in CTAP1 code 2020-12-07 21:23:55 -08:00
kaczmarczyck
c5007e384e Merge branch 'master' into v2_lib 2020-12-04 15:26:03 +01:00
Fabian Kaczmarczyck
0b55ff3c3a fixes formatting 2020-12-04 14:57:11 +01:00
Fabian Kaczmarczyck
b032a15654 makes the global signature counter more privacy friendly 2020-12-04 13:41:41 +01:00
Julien Cretin
a0801c3023 Merge branch 'master' into v2_lib 2020-11-28 19:27:21 +01:00
kaczmarczyck
1d7365c4cb Merge branch 'master' into get-next-assertion 2020-11-26 18:51:06 +01:00
Jean-Michel Picod
3d1d827984 Address PR comments 2020-11-26 16:29:14 +01:00
Fabian Kaczmarczyck
ed59ebac0d command timeout for GetNextAssertion 2020-11-26 14:56:52 +01:00
Jean-Michel Picod
d491492554 Format 2020-11-25 17:48:47 +01:00
Jean-Michel Picod
41f7cc7b14 CTAP1/U2F accesses attestation material through the store. 2020-11-25 17:31:05 +01:00
Fabian Kaczmarczyck
9bb1aad45d wraps HMAC secret into credentials 2020-11-23 12:59:25 +01:00
Guillaume Endignoux
85a34ad085 Migrate import statements and macros to Rust 2018. 2020-09-24 11:28:24 +02:00
Julien Cretin
cae38c39c5 Merge branch 'master' into v2_error 2020-09-23 10:12:22 +02:00
Julien Cretin
7c6a1e27b4 Return errors and Vecs from CTAP storage 2020-09-22 16:23:51 +02:00
Guillaume Endignoux
ff73936a4d Fix imports in ctap, embedded_flash and lang-items. 2020-09-22 13:14:33 +02:00
Guillaume Endignoux
56acc4b73a Don't dereference slices obtained from include_bytes. 2020-02-06 13:28:28 +01:00
Jean-Michel Picod
f91d2fd3db Initial commit 2020-01-30 11:47:29 +01:00