Commit graph

1593 commits

Author SHA1 Message Date
bunnie
9ee306315e fix warnings that result from the PDDB mutability change 2022-05-31 23:55:12 +08:00
bunnie
bf535bd0e1 use interior mutability to handle callbacks
this eases a mutability requirement for the PDDB object
2022-05-31 23:54:16 +08:00
bunnie
b20514e87d cleanup hosted mode warnings 2022-05-31 14:48:09 +08:00
bunnie
376d7a713b Merge branch 'main' into u2f 2022-05-31 14:39:08 +08:00
bunnie
98289b1405 fix warnings that have cropped up for transition to 2021 edition 2022-05-31 14:38:41 +08:00
Sean Cross
3ae9d8abf0 apps/services: remove xous::xous_main macro usage
This macro will be removed, since it is no longer necessary. Remove this
macro across the project and replace it with a standard `main()`
function.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-05-31 13:33:30 +08:00
bunnie
647a3a26dd port to composite format 2022-05-30 18:52:03 +08:00
bunnie
372c2cb680 Merge branch 'main' into u2f 2022-05-30 17:41:27 +08:00
bunnie
c046e0bb16 initialize the keyboard interface with a clean report on boot 2022-05-30 17:39:09 +08:00
bunnie
798eafeb75 Merge branch 'main' into u2f 2022-05-30 13:50:57 +08:00
Sean Cross
93b6d9f2c5 Merge branch 'main' into spawn
Signed-off-by: Sean Cross <sean@xobs.io>
2022-05-30 08:13:59 +08:00
bunnie
e30a2a17d3 Merge branch 'main' into u2f 2022-05-30 04:50:58 +08:00
bunnie
1946d38a69 work around https://github.com/RustCrypto/AEADs/issues/410
We're trying to bring the AES version up so we can do CBC
(required for FIDO2) but unfortunately the aes-gcm-siv crate
is locked to an outdated version of AES, and this is blocking
on a type that is missing in the `block-ciphers` crate.

For now, we're using a patched version of aes-gcm-siv from
rozbb's repo, which allows us to move forward, but this needs
to be reverted once a new version of the official crate is patched.
2022-05-30 04:36:33 +08:00
bunnie
596cebc9c9 add ParBlocks type to our AES implementation
see https://github.com/RustCrypto/AEADs/issues/410
2022-05-30 04:33:46 +08:00
bunnie
a54e8c79c2 bump root-keys cipher version compat to 0.4+ 2022-05-30 04:33:16 +08:00
bunnie
c11d5fe52b bring shellchat to AES 0.8 compatibility
Also note here that we have:

- Run all the AES test vectors and confirmed the pass for both
  hw and sw
- Updated the benchmark numbers for the new AES implementation
2022-05-30 03:09:05 +08:00
bunnie
684c92ca0f bring root keys to AES 0.8 compatibility 2022-05-30 03:08:54 +08:00
bunnie
2cd4e80d9c bring PDDB to AES 0.8 compatibility 2022-05-30 03:08:41 +08:00
bunnie
9bf431a232 move AES API to version 0.8.2 compatibility
This is in a bid to gain CBC crate compatibility which requires
at least an AES 0.8 API level.

It breaks a lot of stuff, which is fixed in the next commit.
2022-05-30 03:06:34 +08:00
Sean Cross
bf6e5a0fef test-spawn: move into services
Move the `test-spawn` program into `services` and document it better.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-05-29 19:09:46 +08:00
bunnie
cbb5462895 Merge branch 'main' into u2f 2022-05-29 14:45:40 +08:00
bunnie
0641cad639 clean out some unused crates and test structures 2022-05-29 14:32:26 +08:00
bunnie
a4c72cc9bb fixup merge 2022-05-29 03:35:45 +08:00
bunnie
268fe63cc1 Merge branch 'main' into u2f 2022-05-29 03:25:49 +08:00
bunnie
a9e2b15c7e fix warnings that have cropped up 2022-05-29 02:58:10 +08:00
bunnie
e14e6206ed include a getrandom implementation that allows us to use modern randcore
A lot of packages are depending on 0.6 api, which requires a crate
that has OS specific TRNG calls. This patch keeps the 0.5 calls
inside the TRNG crate as direct API calls, and migrates to support
a 0.6 api to a patched version of getrandom that supports Xous.
2022-05-29 02:47:51 +08:00
bunnie
844543f72d beginning of ecdsa port...need to resolve rand_core dependency
*everoyne* is relying on rand_core, a later version, that uses
a "getrandom" thing that tries to make the call for random
number generators generic.

I mean, it's kind of cool, but, it's also sort of a libc
non-pure-rust nightmare because basically it always delegates
to a C-style API for a variety of platforms.

Next step is to see if we can't...patch...getrandom to point
to a much simplified, xous-only version that is 100% pure Rust.
2022-05-28 23:38:23 +08:00
bunnie
f4a18401e5 expose is_efuse_secured() API via the PDDB
is_efuse_secured() comes from rootkeys, but we don't want
to expose the full rootkeys API to the world.

PDDB already has an approved capability for accessing rootkeys,
so this single API is passed through via the PDDB object here,
allowing other procesess to query it.
2022-05-28 18:21:07 +08:00
bunnie
cd18aa2609 expose is_efuse_secured() API via the PDDB
is_efuse_secured() comes from rootkeys, but we don't want
to expose the full rootkeys API to the world.

PDDB already has an approved capability for accessing rootkeys,
so this single API is passed through via the PDDB object here,
allowing other procesess to query it.
2022-05-28 18:18:37 +08:00
bunnie
81f823ff34 migrate u2f to the "vault" app
The vault app is the beginning of a multi-purpose authentication vault.
It will feature:

1. FIDO2 authentication
2. TOTP authenticators
3. Password storage to PDDB with auto-typing via keyboard HID

This is the first step on a very very long journey.
2022-05-28 01:17:54 +08:00
bunnie
6745206303 mulling this pile of OpenSK code to see what we should cut, what we should keep
alright. the composite device problem is solved. The bigger issue I'm
mulling is if I should try to port the Google OpenSK FIDO2 stack into
Xous, or if I should just do a limited U2F implementation.

Poking around at the OpenSK stuff...porting looks possible, but, it's
going to be vendoring in all of the source from the OpenSK project. So
it'll be tough to apply patches if they happen; on the other hand, the
OpenSK implementation is FIDO2 certified, and the stable branch hasn't
moved since Nov 2021.

The main downsides of the OpenSK implementation are:

- it uses nightly. I think it can be stripped out, though; I haven't
  seen a "good reason" for it yet, it's mostly because Tock uses
  nightly. There's only one alarming use of it and it's in the crypto
  crates but those will be stripped out because....
- the crypto libraries are in fact not suitable for use. I dug into
  them and they definitely need to be gutted and replaced with the
  community-blessed crypto libraries and APIs. which is one big reason
  why once this goes into Xous land it doesn't go back easily into
  OpenSK land -- they actually have slightly different crypto
  APIs. more modern ones, to be fair, but, they haven't been reviewed.
- the implementation has "too many features"...for example, I don't
  think we'll ever realistically do authenticator attestation as it
  requires signing NDAs and provisioning secret keys that we can't
  share with users. But that code is there, and we'll either have to
  gut or bodge it.

The plusses are:

- it's FIDO2 certified. So, at least the protocol stack is probably
  complete and fully implemented, which means for features we don't
  use today I can just leave hooks or dummy values there for a fast
  migration path.
- Looks like they aren't changing things too fast in the dev
  branch...so this probably is not like riding a greased pig
- Looks like a couple of paid professionals wrote the code...better
  than what we have going on here
- I think I see a path to carve out their "persistent store" and glom
  it into the PDDB; a path to adapt their crypto traits into
  Xous-native traits; and a path to connect their CTAP protocol engine
  to the Xous HID server. So it seems feasible. But they baked in some
  bad API assumptions deeply enough that they are one-way streets I
  think to get these ports done.

I'm going to sleep on this, but I'm leaning toward trying to pull in
the OpenSK code because even tho it is a bit painful it probably gets
a bigger feature scope and so far it looks like I wouldn't be changing
any protocol-level stuff for the port, I would just be monkeying
around with the internal storage, crypto, and USB implementations, so
ideally the end result is we get a certified FIDO2 protocol engine for
the effort.

I think the main concern I have going in this direction is I don't see
a way to do this and simultaneously be able to absorb upstream patches
into this vendored code, because their API assumptions are too
different. Any bug fixes or patches would have to be manually applied
and merged. But maybe that's not such a big deal...?
2022-05-27 03:01:39 +08:00
bunnie
634f3b0e93 fix composite device description - we now have HID & U2F simultaneously! 2022-05-27 00:34:06 +08:00
bunnie
a8f761722a start to lay in u2f messaging infrastructure 2022-05-26 17:58:22 +08:00
bunnie
811bd88111 improve reboot timings after root key init 2022-05-25 14:30:13 +08:00
bunnie
54947a2216 add an initdone sentinel for rootkey provisioning
simplifies script logic a bit
2022-05-25 04:09:36 +08:00
bunnie
62cbc86aeb add automation strings 2022-05-24 23:21:26 +08:00
bunnie
2f8c850cd6 fix issue #152 2022-05-24 18:10:47 +08:00
bunnie
3b6bc6aeeb suppress hosted mode warnings in usb dev crate 2022-05-24 17:08:27 +08:00
bunnie
3fccc6c314 fix hosted mode error 2022-05-24 17:06:43 +08:00
bunnie
a468733ea6 Merge branch 'automation' into bunnie-dev 2022-05-24 16:58:55 +08:00
bunnie
5815eae023 restore the security check around recalculatesleep 2022-05-24 16:28:16 +08:00
bunnie
4d1d132233 add a first-pass at what hardware CI automation strings might look like 2022-05-24 02:22:36 +08:00
bunnie
8221f92d95 potential fix for #162
see issue for discussion
2022-05-23 17:30:02 +08:00
bunnie
d6d5c89746 add facility to help debug stalled suspend/resume 2022-05-23 13:50:52 +08:00
bunnie
ed16fc1b2f advance timer state by +1 ms on suspend to avoid double-interrupts on resume
Issue #159 may be caused by queueing a connection to respond to when
the timer expires, but if the timer expires twice then it tries to
respond to a null connection id.

And if it goes to suspend in the same millisecond as it services the
condvar, then it'll reissue the interrupt when it comes back from
suspend.
2022-05-21 01:34:35 +08:00
bunnie
3bfdc238a0 add support for keymaps in HID
remaps keys based on the assumed keymap based on the user's
preference for the keyboard layout on the device.

So far, only dvorak and QWERTY are supported.
2022-05-17 16:41:08 +08:00
bunnie
4cba739a81 remove improper warning message
this was a vestige of an earlier version that should have been
removed
2022-05-17 03:13:19 +08:00
bunnie
b69fbfdd01 adjust keyboard emulation delays for better compatibility 2022-05-17 03:08:08 +08:00
bunnie
4a23cf671d fix hosted mode MAC address 2022-05-17 03:07:56 +08:00
bunnie
ca275308ef Merge branch 'usbdev' into main 2022-05-17 02:31:10 +08:00