Commit graph

142 commits

Author SHA1 Message Date
bunnie
4e40ae6c5d move from target selectors to feature selectors for back-ends
This will allow for e.g. xous on riscv32-imac but not a precursor
target, for example: by using feature selectors we get to have
a bigger range of targets that we support, such as for implementations
that haven't been upstreamed or have official target-triples.

The downsides are:

- patch override libraries don't absorb feature flags. so, for
example, the AES crate that is used to patch other crates won't
be aware of the target features without modifying the referencing
crates.

- features are normally meant to be additive, but target features
are mutually exclusive. The mutex is enforced by a check in
utralib that throws a panic on build if two targets are accidentally
selected at the same time.
2022-10-02 02:56:44 +08:00
bunnie
72859d18dd fix UX update issue on FIDO adding records.
maybe need to also chase this down in the password add new area too?

need to check.
2022-09-23 00:37:15 +08:00
bunnie
278570d8d3 progress on issue #223
This adds the abort flow to the U2F approvals. Needs more testing.
2022-09-23 00:27:14 +08:00
bunnie
13402b99b9 fix #224
was a logic bug where the database name was not updated while
doing some refactoring previously
2022-09-22 22:05:57 +08:00
bunnie
8fe4c50373 improve error reproting on #206 2022-09-20 23:24:42 +08:00
bunnie
ba45fc2685 fix validator issue on hotp count 2022-09-20 23:13:18 +08:00
bunnie
9225cbaba3 resolve issue #206 by adding check for existing basis 2022-09-20 23:06:22 +08:00
bunnie
22a440f75f Add HOTP initial count feature; try to fix HOTP panic
- HOTP now prompts for an initial count
- Found a code path where improperly formatted HOTP field can
lead to a 0-value being passed to a totp generator
- Added guardrails around the TOTP generator so it can't divide by 0:
it issues a warning instead.
2022-09-19 23:44:45 +08:00
bunnie
47ce1e3149 add version history for TOTP records 2022-09-18 21:53:35 +08:00
bunnie
d1cda8f669 add hotp support
hotp is merged as a "minor" feature off of totp. In other words,
the default mode is totp, but one can specify a totp record
to be an hotp record and it will behave as an hotp record.

We re-use the "step_seconds" field to specify the count parameter.
There is no separate initial count / count field -- the two are
tracked in a single u64 that is stored in the "step_seconds" field
of what would be a totp record.

This also revs the TOTP record to v2. This *should* not break
anything:

- v1 records deserialize as totp records into v2 (which is correct,
as there are no hotp in v1)
- when a v1 record is saved to disk, it is stored in v2 format
- v1 records that are not edited stay as v1
2022-09-17 00:39:47 +08:00
bunnie
fad3aa6ec0 fix fido readback from test vectors made in hosted mode 2022-09-17 00:39:19 +08:00
bunnie
e7576ebb42 reduce debug level on vault 2022-08-13 23:55:40 +08:00
bunnie
8570449b04 make vendor backup locked out by default; hook to UX enable dialog box
also halts updates of the TOTP timer bar while this is happening
to avoid overflowing the server queue with unanswered redraw
requests
2022-08-13 23:54:36 +08:00
bunnie
56172e37a9 shift vendor command space to 0x70 range
this avoids conflicts with OpenSK and open-ssh's handling
of their vendor commands.
2022-08-13 22:25:07 +08:00
bunnie
9e0b63c871 make the "hash" arguments match the display UX values
that way any entries that would show up "exactly" as the same
description would flag as conflicts on re-upload
2022-08-13 21:46:06 +08:00
bunnie
7ec39e4be6 strip out the random-guid code 2022-08-13 21:37:56 +08:00
Gianguido Sorà
cd42cf6395 fix(vault): storage for totp and passwords derive pddb key from their
unique content

Instead of generating a unique GUID every time a new record gets
created, hash known unique content for every entry and use that as key.

The StorageContent trait now has a hash() method that returns a Vec
containing the SHA-256 hash of the object's unique content.

Hashing is done by re-using the same calls that ctap uses.

This allows dupes detection when restoring a backup, allowing us to
employ a "never overwrite" policy: Precursor is the main source of truth
for such data.
2022-08-13 13:29:42 +02:00
Gianguido Sorà
cdfae27afc feat(vault): implement basics of dupe detection
Still needs a way to deterministically generate a key for each entry.

Idea: a `hash() -> String` method on StorageContent so that new_record
can call it, store said object with the newly-generated key.

Since this is a deterministic operation, restoring a backup with dupes
would not overwrite what's present in PDDB already.
2022-08-12 18:47:38 +02:00
Gianguido Sorà
473e1cf77b chore(vault): address warnings 2022-08-12 17:37:51 +02:00
Gianguido Sorà
51b04fe14e Merge branch 'main' into feat/vault-usb-totp-loading 2022-08-12 17:16:30 +02:00
Gianguido Sorà
115781b979 feat(vault): implement VendorSession for backup/restore calls that span
multiple CTAPHID sessions
2022-08-12 16:57:05 +02:00
Gianguido Sorà
a594342d03 feat(vault): add bulk new record method on storage abstraction
Instead of syncing for each new record, new_records() only syncs:
- when it's writing an entry that has index multiple of 10
- when it's the last packet in sequence
2022-08-12 16:55:59 +02:00
Gianguido Sorà
5758b1d4c0 feat(vault): handle usb restore for >7601 bytes of payload 2022-08-12 16:54:26 +02:00
bunnie
6fff73ace8 fix missing path to try_send_message 2022-08-11 03:11:47 +08:00
bunnie
cfa65a3a72 add some notes about integration with #205 2022-08-11 02:48:56 +08:00
bunnie
b39ec5d044 don't crash if the pumper thread can't send a redraw poll 2022-08-11 02:48:38 +08:00
bunnie
e824334747 add a thin UX layer to manage switching host readout mode
needs a bit more integration with the final TOTP/password
scripts logic
2022-08-11 02:32:38 +08:00
bunnie
d1bd99a7f2 demonstrate switching of core between configurations using shell commands 2022-08-10 18:58:55 +08:00
bunnie
d128a91892 don't completely break the CTAP2.0 compliance suite
The response to get OpenSSH to work is non-compliant
(because it's trying to read a 2.1 command set out of a 2.0
device). This will lead to breakage in the 2.0 test bench,
but, it will allow the device to work with OpenSSH.

meh. specs, schmecs.
2022-08-03 23:46:52 +08:00
bunnie
3ab4031706 reveal credProtect extension 2022-08-03 14:45:18 +08:00
Gianguido Sorà
199d5ddeb5 Merge branch 'main' into feat/vault-usb-totp-loading 2022-08-02 15:53:11 +02:00
bunnie
6b53688249 fix #195
let's see if we can raise the limit on credentials now that
the performance issues have been partially addressed.
2022-08-02 01:45:39 +08:00
bunnie
e32ea1e32f change read buffer api from read_to_end() to read_exact()
read_to_end() "guesses" the total amount of data to read by doing
roughly 5 calls per couple hundred bytes: it starts by guessing
it's 32 bytes long, then another 32, then 64, then 128, and then
a final call to make sure there's nothing more.

The read() call is somewhat expensive in that it involves initializing
and sending page-sized memory chunks, and every time it also
descends the entire basis hierarchy, recomputing the overlay.

Probably, this can be improved with some sort of server-side caching
of read results -- if a file is read, it seems very likely that
the next few bytes will be read and a smarter caching implementation
could smooth over some of the expense.

However, a much easier fix for now is to just change the read
call to read exactly the length of the file being presented. Since
we already have the key handle, we can get the attributes and then
do a single read of the exact amount.

Doing this improves the speed of the UX substantially, about 40%
faster for the same operation (at least).
2022-08-02 01:38:46 +08:00
Gianguido Sorà
6fe53e6be9 chore(vault): rustfmt on storage.rs 2022-07-29 15:22:53 +02:00
Gianguido Sorà
af9c71273b improvement(vault): get rid of monomorphization on most storage::Manager
methods

Less kernel bloat!
2022-07-29 15:18:49 +02:00
Gianguido Sorà
21d77cc92a Merge branch 'main' into feat/vault-usb-totp-loading 2022-07-29 13:17:12 +02:00
bunnie
318f95d347 fix problem with over-zealous validator fields
actually, we just need to check for : on the basis names, not
everything else!
2022-07-28 04:46:07 +08:00
bunnie
494ec7c2b3 improve the basis name validator - ':' is an illegal character in a basis name. 2022-07-26 00:05:45 +08:00
Gianguido Sorà
b21ef727bc chore(vault): clean up
Remove unused funcs, types and replace them with the storage crate
analogous.
2022-07-25 11:31:44 +02:00
Gianguido Sorà
31cb7c9ae1 chore(vault): support backup/restore of passwords 2022-07-19 16:47:28 +02:00
Gianguido Sorà
23f9717fee chore(vault): use storage more and more 2022-07-18 17:32:54 +02:00
Gianguido Sorà
75b30f723e chore(vault): use new generic storage in vendor commands 2022-07-18 17:32:09 +02:00
Gianguido Sorà
5f7fb22317 chore(vault): provide default for TotpAlgorithm
The default is "None", which will fail any conversion or usage
2022-07-18 17:31:32 +02:00
Gianguido Sorà
222a912603 chore(vault): don't generalize delete on storage, pass ContentKind as
ref
2022-07-18 17:31:08 +02:00
Gianguido Sorà
6cdf2fa880 feat(vault): finish generic implementation of storage methods 2022-07-15 10:54:44 +02:00
Gianguido Sorà
3edb98431b chore(vault): make the error explicit 2022-07-14 19:21:02 +02:00
Gianguido Sorà
ba2c573ef4 chore(vault): try generalizing Manager operation 2022-07-14 18:39:13 +02:00
Gianguido Sorà
71979f81d7 feat(vault): implemet totp backup on device-side 2022-07-12 17:30:26 +02:00
Gianguido Sorà
bdeb68a158 feat(vault): add password-related methods to storage abstraction 2022-07-12 17:30:11 +02:00
Gianguido Sorà
9722bbc573 chore(vault): use backup structs, storage abstraction in vendor command handling 2022-07-11 18:15:14 +02:00