Commit Graph

35 Commits

Author SHA1 Message Date
hcyang
31774ef316 Add storage test cases for multi-PIN (#567)
* Add storage test cases for multi-PIN

* Fixed proc-macro2 version (#550)

* fixes proc-macro2 in dependencies

* adds missing locked versions, and a verbose print for cargo check

* commits Cargo.lock files

* removes unnecessary Cargo.lock entries

* adds missing Cargo.lock

Co-authored-by: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com>
2022-10-26 11:29:56 +08:00
hcyang
078e565ac1 Add basic setup for multi-PIN (#530)
* Add basic setup for multi-PIN

- Reserve the storage keys for maximum of 8 user slots.
- Modify the storage functions to take a slot_id parameter.
- Add the slot_count() customization.
- Assume slot_id as a parameter when needed except these places:
  - Entrance functions of command processing that directly takes the
    command parameter structure. slot_id is set as 0, and will be
    parsed from the parameters when we enable the feature.
  - MakeCredential/GetAssertion/AuthenticatorConfig will take the
    slot_id from active token state when we enable the feature,
    resulting in an `Option<usize>`. Below code will act on the option
    value correctly. When the feature isn't enabled, we're always
    referring to the only PIN slot so set slot_id as Some(0).
  - GetInfo returns verdict of whether PIN is supported and enabled, and
    whether PIN needs to be forced changed. There will be new fields to
    represent those values when the feature is enabled, and the old
    fields will not be populated. So when the feature isn't enabled, we
    can treat slot_id as 0.

Not covered in this commit:
- Unittests for other slots. The existing tests all pass and I plan to
  add unittests for multi-slot case after the codebase allows enabling
  the feature.
- Persisting and checking the slot_id in credentials. This is planned to
  come in the next commit.

* Fix storage and some other style

* Add support for concatenated values

* Switch some storage entries back to multi-entry

* Set bumpalo version for fuzzing (#532)

* maximum working bumpalo version

* explicit comment to explain version locking

* removes incorrect comment

* moves serde version lock to dev dependencies

* removes serde dependencies

* reverts serde removal in crypto library

* Make PIN_PROPERTIES use concatenated storage entry

* Fix bumpalo issue

* Use concatenated storage entry for force_pin_change too

* Fix cargofmt

Co-authored-by: Julien Cretin <cretin@google.com>
Co-authored-by: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com>
2022-08-23 23:01:13 +08: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
hcyang
85fe9cd29d Add sturctured get assertion and client pin fuzzers (#482) 2022-05-27 10:34:38 +08:00
hcyang
3a39c4dff1 Add test_helpers (#474)
* Add set_enterprise_attestation in TestEnv

* Add test_helpers for Test Unification

* Used it in structured fuzzer and enterprise attestation unittests

* Restructure test_helpers

* Rename setup_enterprise_attestation to enable_
2022-05-10 18:50:18 +08:00
kaczmarczyck
4782d7e186 Separate RNG library (#470)
* seperates the RNG library

* fixes crypto tests

* adds rng256 workflow

* fixes formatting
2022-04-28 11:36:43 +02:00
hcyang
aca1f35170 Make rng in TestEnv deterministic and seedable (#461)
* Move three dependent customizations into new file

* default_min_pin_length(_rp_ids) and max_rp_ids_length

* Did some backing store tricks to make the list configurable in
  TestCustomization.

* Add testing for TestCustomization

* Change assert comparison to assert_eq

* Separate tests

* Move 3 pure constants to new file

* Return Vec<String> for rp_ids()

* Make rng in TestEnv deterministic and seedable

* Move seed method to TestRng256

* Change some constant name in comments to snake case

* Move seed rng of env to the start

* Fix unused warning

* Make rng in TestEnv deterministic and seedable

* Move seed method to TestRng256

* Move seed rng of env to the start

* Fix unused warning

* Seed rng in all fuzz targets

* Fix error introduced when merging

Co-authored-by: Julien Cretin <cretin@google.com>
2022-04-20 15:49:17 +08:00
hcyang
1ef9a4447d Introduce Customization struct (#458)
* Introduce Customization trait

* Introduce Customization trait including the customization accessors
  that control various behaviors.

* Expose Customization through a getter API in Env, and make the code
  that directly access the constants currently switch to accessing the
  customizations via Env.

* TockEnv's customization getter implementation directly returns the
  reference of the global DEFAULT_CUSTOMIZATION constant, so the
  constant values are still inlined and dead code won't be compiled.

* We'll add the customizations from global constants to the struct
  one-by-one, only MAX_MSG_SIZE in this commit.

* Small fixes

* Fix deploy script
* put is_valid under std gate
2022-04-14 08:57:18 +02:00
Howard Yang
17ecd46b04 Generate valid structure for MakeCredential params
* Add crate arbitrary as ctap's optional dependency, when feature "fuzz"
  is activated.

* Derive Arbitrary for all the necessary types in order to generate the
  concrete types from random bytes.

* Add a fuzz target that transforms the input to valid format for
  MakeCredential.
2022-03-22 19:06:20 +08:00
kaczmarczyck
ba0c583617 introduces Transport and Channel (#444) 2022-03-14 18:40:24 +01:00
kaczmarczyck
163057daf0 Clean public HID interface (#442)
* clear public HID interface and tests

* fixes nits
2022-03-14 12:08:44 +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
Fabian Kaczmarczyck
c595980a3b new process_message function and command enum 2022-03-07 15:19:49 +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
kaczmarczyck
40e912f8ac fixes the serde version (#407)
* fixes the serde version

* explicitly sets the version in the main Cargo.toml
2021-11-15 13:09:40 +01:00
Julien Cretin
7418196814 Specificy encoding when opening rust-toolchain file
This probably is just ASCII.
2021-08-30 11:41:14 +02:00
Julien Cretin
b5b9d3f6e0 Fix ctap2 fuzz targets to use prod cbor parsing
This fixes a left-over from #329.
2021-08-11 16:00:30 +02:00
David Drysdale
7719078d46 cbor: rename crate to sk-cbor
In anticipation of publishing to crates.io, which already has a `cbor`
crate.
2021-06-16 17:16:05 +02:00
David Drysdale
f2812e4fe2 cbor: drop std feature, use core in tests (#327) 2021-06-16 15:40:18 +02:00
Julien Cretin
4253854cf1 Remove ram_storage feature
We don't need to build a production key without persistent storage. Tests and
fuzzing continue to use the std feature to use the RAM implementation (that does
sanity checks).
2020-12-10 13:06:05 +01:00
Fabian Kaczmarczyck
ed59ebac0d command timeout for GetNextAssertion 2020-11-26 14:56:52 +01:00
mingxguo27
4edec261bc Resolved PR comments 2020-10-15 13:28:27 +00:00
mingxguo27
b43d618c03 Completed hex 2020-10-09 11:10:25 +00:00
mingxguo27
ed4514c3e0 Add initial corpus files 2020-10-08 19:14:38 +00:00
mingxguo27
9493014b13 Resolved PR comments 2020-10-02 17:18:36 +00:00
mingxguo27
f79a659e69 Resolved PR comments and added more fuzz targets. 2020-09-29 16:30:41 +00:00
mingxguo27
8231c89207 Formatting 2020-09-25 19:26:35 +00:00
mingxguo27
e8e52ff58a Added more fuzz targets 2020-09-25 19:05:07 +00:00
mingxguo27
3a42ab15ae Added fuzzing helper library to increase code reusability and refactored first fuzz target 2020-09-25 19:03:45 +00:00
Guillaume Endignoux
85a34ad085 Migrate import statements and macros to Rust 2018. 2020-09-24 11:28:24 +02:00
mingxguo27
d0a1f707bc Fixed dependencies 2020-09-23 14:33:05 +00:00
mingxguo27
6cab8aaa20 Resolved comments 2020-09-23 14:33:05 +00:00
mingxguo27
6e8eecce59 Resolved comments 2020-09-23 14:33:05 +00:00
mingxguo27
3a6a78bbf2 Resolved PR comments 2020-09-23 14:33:05 +00:00
mingxguo27
69a440fddb Added first fuzzing target 2020-09-23 14:33:05 +00:00