Commit graph

3139 commits

Author SHA1 Message Date
bunnie
389ea55b00 add also the new files associated with the vault 2022-05-28 01:20:05 +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
cd0b952e2a bump com_rs rev (no mangling of opcodes by rustfmt) 2022-05-25 23:54:44 +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
6c1818ff97 update release notes
note the beginning of the inclusion of CI infra
2022-05-24 16:59:49 +08:00
bunnie
a468733ea6 Merge branch 'automation' into bunnie-dev 2022-05-24 16:58:55 +08:00
bunnie
6e61405609 update release notes 2022-05-24 16:58:21 +08:00
bunnie
5815eae023 restore the security check around recalculatesleep 2022-05-24 16:28:16 +08:00
bunnie
bdc43a5190 Merge branch 'bunnie-dev' into main 2022-05-24 16:18:50 +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
058e3480df add facility to help debug stalled suspend/resume 2022-05-23 13:50:40 +08:00
bunnie
424f8feab7 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-23 13:50:30 +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
7112b6a15f add a script to help extract keyboard mappings for unknown keyboards
use `usb kbdtest` to output a mapping assuming US-101 maps
it will then derive an appropriate keymap based on that mapping

doesn't support non-ascii characters (yet)
2022-05-17 16:39:48 +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
bunnie
03a191d182 adjust IP targets on helper scripts 2022-05-17 02:27:04 +08:00
bunnie
ec53be0ac7 add USB device checkup functions and fix hosted mode 2022-05-17 02:26:28 +08:00
bunnie
66e4d9f803 move test commands for USB status checkup from keys to USB 2022-05-17 02:25:59 +08:00
bunnie
c7f9688b5f have status point to the USB crate for USB checkup 2022-05-17 02:25:44 +08:00
bunnie
78611f97c4 remove USB checkup functions from LLIO crate 2022-05-17 02:25:28 +08:00
bunnie
346caad315 Add the usb-device-xous driver to the default hardware config
Also includes the USB test commands in shellchat.

This is different from the usb-test crate, in that it's fully
integrated into Xous. usb-test is just for quick-testing the USB
driver, in the absence of most of the rest of Xous.
2022-05-17 00:46:52 +08:00
bunnie
3f779d5def tweak delays for more consistent key down reporting 2022-05-16 21:43:24 +08:00
bunnie
71f5183766 working USB development demo (HID keyboard emulation) 2022-05-16 21:26:37 +08:00
bunnie
ffbfa1dc3f wooooo i spy with my little eye an emulated HID keyboard 2022-05-16 13:15:21 +08:00
bunnie
2b57fa559d use Cargo patches so we can target our branch of usb-device
we have to add a patch to usb-device because the SpinalHDL UDC
needs a little extra handholding on EP0 to switch IN and OUT modes
(vs e.g. STM32 where EP0 has IN and OUT descriptors).
2022-05-16 03:09:28 +08:00
bunnie
874c4d41ff well, it's enumerating. now what? 2022-05-16 02:49:23 +08:00
bunnie
45c4d6320c bug fixes for SpinalHDL core (EP0 setups now go to the correct location) 2022-05-16 00:34:42 +08:00
bunnie
77038737b2 just before attempting to use IN to linked list trick 2022-05-16 00:34:14 +08:00
bunnie
26739472af this requires an adjustment to the SoC, but now we're seeing half the setup
a small bug was found in the device core that is now fixed. the
device core was not computing the target for the SETUP transaction
correctly if the HEAD of the OUT descriptor was set in advance of
the SETUP transaction. we now see much more consistent SETUP
transactions, and even the first IN response.

the next challenge is figuring out why the second IN response doesn't
seem to be issued.
2022-05-15 14:11:14 +08:00
bunnie
8c39b64126 getting closer...
we're now two packets into the setup.

i think i see one fundamental mismatch between how the driver
behaves and how the hardware runs. it has to do with where the
ep0 data gets deposited for a SETUP or OUT transaction --
the HEAD of the list can't be allocated the transaction is
completely ready to go.

will bang on this more tomorrow, but this is progress at least.
2022-05-15 02:16:24 +08:00
bunnie
bd1cc10678 refactor code base after a slightly better understanding of the USB core
still one mystery remaining, howcome setup packets don't "stick"
the first time around...
2022-05-14 23:53:10 +08:00
bunnie
4f36027974
Merge pull request #157 from gsora/gsora/modals-time-crash-fix
fix: clamp TextEntryPayloads content slice to the real amount of fields used in the modal
2022-05-14 02:59:34 -07:00
Gianguido Sorà
dbff05d1f2 fix: clamp TextEntryPayloads content slice to the real amount of fields used in the modal 2022-05-14 11:49:15 +02:00
bunnie
0dadc32716 fix interrupts, direction
interrupts seem to behave much more like i think they should.
i think the interrupt unit on the spinalHDL block is not made to
have the whole set enabled/disabled frequently, it just wants
to have the bits banged to clear the interrupts. enabling and
disabling interrupts as a whole causes some erratic operations.
NB: the reference linux driver only enables them once and never
turns them off.

also, realized just now that OUT is from the direction of the host.
so OUT on the device is incoming data. oops.

things are moving in the right direction, i'm seeing the next
IN packet being issued by the USB driver on the precursor
side, but it's not being sent by the hardware. yet.
2022-05-13 23:44:15 +08:00
bunnie
9a11056340
Merge pull request #154 from NicolasDorier/patch-1
Fix link in repl demo
2022-05-13 00:18:22 -07:00
bunnie
e9b627cab8 update release notes, clean up Cargo.toml, smoltcp to 0.8.1
smoltcp gave us a patch for our smoltcp issues! thank you @dirbaio!
2022-05-13 15:09:45 +08:00