Commit Graph

150 Commits

Author SHA1 Message Date
kaczmarczyck
78b7767682 CBOR maps use Vec instead of BTreeMap (#303)
* CBOR uses Vec for map internally

* remove BTreeMap from get_info

* rename cbor_map_btree and clean up cbor_array_vec

* destructure now takes Vec, not BTreeMap

* adds dedup in CBOR writer

* fail to write CBOR maps with duplicates

* CBOR interface refinements

* macro documentation for CBOR map and array
2021-04-13 14:46:28 +02:00
Julien Cretin
6cb6538db6 Fix typography 2021-03-15 12:10:13 +01:00
Julien Cretin
3c7c5a4810 Update the documentation to use linking by name
See https://doc.rust-lang.org/stable/rustdoc/linking-to-items-by-name.html
2021-03-13 13:16:57 +01:00
kaczmarczyck
eb0a0770dd adds the PIN protocol trait (#292)
* adds the PIN protocol trait

* improved documentation

* SharedSecret not mutable
2021-03-10 13:20:29 +01:00
kaczmarczyck
5e9c32dff5 HKDF for CTAP2.1 (#290)
* implements hkdf, both regular and FIDO specific

* improved documentation

* constant usage in function return type
2021-03-03 16:33:25 +01:00
Fabian Kaczmarczyck
9270afbc21 remove derive_debug feature 2021-02-02 06:45:04 +01:00
Fabian Kaczmarczyck
371e8b6f35 remove conditional trait implementation 2021-02-02 05:46:03 +01:00
kaczmarczyck
18f391d48f Merge branch 'develop' into large-blobs 2021-01-25 19:27:45 +01:00
Fabian Kaczmarczyck
4f3c773b15 formats code, clippy 2021-01-25 18:17:14 +01:00
Julien Cretin
ae0156d287 Factor test tools between store and fragment
Those need the driver to deal with the fact that the store is stateful. Those
tests can't be moved to the test suite because they use private functions.
2021-01-25 17:30:50 +01:00
Julien Cretin
41a3f512c8 Remove useless check 2021-01-25 11:31:42 +01:00
Julien Cretin
f0c51950cb Add fragmentation support 2021-01-23 21:27:59 +01:00
Julien Cretin
8634e2ec24 Make StoreUpdate generic over the byte slice ownership
This permits to call it without having to create a Vec<u8> when possible.
2021-01-20 15:56:06 +01:00
Julien Cretin
a712d1476b Return error instead of debug assert
With dirty storage we hit the assert. Returning an error permits to continue to
catch if the invariant is broken for normal operation while being able to
continue fuzzing with dirty storage.
2021-01-18 16:41:03 +01:00
Julien Cretin
55038cc084 Add bound-test in addition to equality-test 2021-01-18 16:13:01 +01:00
Julien Cretin
2cd760bad7 Merge branch 'develop' into v2_optim 2021-01-18 16:10:08 +01:00
Fabian Kaczmarczyck
2776bd9b8e new CoseKey data format 2021-01-12 15:11:20 +01:00
Fabian Kaczmarczyck
6f9f833c0b moves COSE related conversion from crypto to data_formats 2021-01-08 15:42:35 +01:00
Julien Cretin
1d576fdd31 Add unit-test for Store::entries 2020-12-14 21:06:12 +01:00
Julien Cretin
edcc206e9d Make store operations constant wrt flash operations 2020-12-10 18:41:32 +01:00
Julien Cretin
8800c3e906 Merge branch 'master' into no_ram_storage 2020-12-10 15:48:45 +01:00
Julien Cretin
19ebacec15 Do not use delay_map anymore
This permits to avoid copies. Before we used to do one copy per storage
operation. Now we do one copy per store operation.
2020-12-10 13:36:33 +01: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
Julien Cretin
a0e3048f82 Add debug helper for fuzzing 2020-11-30 11:30:49 +01:00
Julien Cretin
f548a35f01 Do not crash with dirty init 2020-11-30 10:29:18 +01:00
Julien Cretin
ed5a9e5b24 Apply review comments 2020-11-28 19:01:16 +01:00
Julien Cretin
9f04408433 Merge branch 'master' into v2_fuzz 2020-11-28 18:45:41 +01:00
Julien Cretin
29ee45de6c Do not crash in the driver for store errors
We prefer to return those errors to the fuzzer which can then decide whether
they are expected or not (e.g. when starting from a dirty storage, the store is
expected to have errors).
2020-11-24 11:31:54 +01:00
Julien Cretin
d23acb4f64 Make sure production store only builds with usize=u32 2020-11-20 15:55:56 +01:00
Julien Cretin
e842da0de7 Add store fuzzing 2020-11-19 11:27:50 +01:00
Julien Cretin
bbb73c77a8 Use width_lim instead of bucket_lim 2020-11-17 10:16:39 +01:00
Julien Cretin
fcc9484510 Add stats for fuzzing 2020-11-16 22:44:10 +01:00
Julien Cretin
de77d4fc0c Add histogram for fuzzing 2020-11-13 10:34:23 +01:00
Julien Cretin
1c2e450660 Improve documentation 2020-11-12 16:24:35 +01:00
Julien Cretin
db5b21a4ff Add more documentation 2020-11-12 10:54:23 +01:00
Julien Cretin
c6f9270be1 Update documentation 2020-11-11 17:52:33 +01:00
Julien Cretin
163e92fa6b Create fuzzing and add entropy helpers 2020-11-11 12:30:24 +01:00
Julien Cretin
d5a43c346f Rename into_ into extract_ 2020-11-11 10:28:32 +01:00
Julien Cretin
0e4be8ca4a Update documentation 2020-11-10 19:44:28 +01:00
Julien Cretin
45332158df Add driver for new store 2020-11-03 21:27:32 +01:00
Julien Cretin
a024e642d3 Return zero instead of negative immediate capacity 2020-11-03 13:30:39 +01:00
Julien Cretin
410314b780 Move transaction validity check to Format 2020-11-03 12:54:30 +01:00
Julien Cretin
d734da3a0e Move transaction capacity formula to Format 2020-11-03 12:39:38 +01:00
Julien Cretin
b97758dd99 Do not use import ::* 2020-11-03 11:58:20 +01:00
Julien Cretin
233c15b20c Add new store (without tests yet) 2020-11-02 11:17:09 +01:00
Julien Cretin
9778ea7fd2 Introduce distinct integer types
This PR does the following things:
- Give incompatible representations for integers with different semantics:
  - `usize` is used for natural numbers for the public API.
  - `Nat` is used internally for natural numbers (essentially a stable `usize`).
  - `Word` is used for sequences of bits representing words in flash.
  - `Position` is used for word positions in the virtual storage.
- Only use fixed size integers to preserve overflow behavior between targets.
- Use little-endian representation instead of native representation for `Word`.

Alternatives:
- Run tests and fuzzing on 32-bits architecture (or some compatibility mode).
  This approach would have better readability than the current solution (less
  conversions at public API). However it would require additional setup and
  might not be viable long-term by restricting machines on which fuzzing is
  possible.
- Accept the behavior difference for tests and fuzzing. This approach would also
  have better readability. However checking for arithmetic overflow (and other
  `usize` related concerns like memory size) is more important.
2020-10-29 18:48:15 +01:00
Julien Cretin
5ce91947b6 Fix StoreRatio fields visibility and improve documentation 2020-10-29 12:23:34 +01:00
Julien Cretin
e7303ed7c6 Add model for new store 2020-10-27 14:23:39 +01:00
Julien Cretin
71815cad09 Update ERASED_WORD definition to use WORD 2020-10-27 13:45:18 +01:00
Julien Cretin
edd1bcf5d2 Do not inline constants in documentation 2020-10-27 11:25:08 +01:00