Commit graph

10340 commits

Author SHA1 Message Date
bunnie
8fd94f061e fix default backend issue on configuration tool 2022-06-05 02:11:37 +08:00
bunnie
9bd39af684 Merge branch 'u2f' into main
Merge in the latest progress as it includes some fixes to the PDDB
(read_all() now works as expected), and to the keyboard listener
API on the dynamic notifications dialog box.
2022-06-05 01:53:41 +08:00
bunnie
1024cebe55 add primitive UX layer to U2F application. fix numerous bugs
The OpenSK UX layer was completely gutted and re-written using
Xous-native idioms. There's a bit of ambiguity on what exactly
OpenSK meant to do with the one button and the LEDs, but for
Xous we want to show things like what you're signing for and
why.

For now, we just show the app hash during registration and signing,
but down the road that will need to be matched up against a
plaintext description of the application upon registration, so
users can have a client-side description of what they are approving.

At the moment, we're stuck at provisioning the attestation certificate
and key. The transaction goes through, but is rejected by the
test web site right now with not too much explanation of what went
wrong, but maybe the next step is to try and use the OpenSK
native tools to provision a set of keys onto the device to see
if that fixes it (instead of the current bodge of hard-coding
some manually extracted hex values into the database).
2022-06-05 01:49:11 +08:00
bunnie
2161771b09 fix keyboard listener on dynamic notifications 2022-06-05 01:45:25 +08:00
bunnie
17446588bb fix read_all bug in PDDB 2022-06-05 01:45:05 +08:00
nworbnhoj
f7395ae0d5 add example of jpeg decoding 2022-06-04 21:18:54 +10:00
nworbnhoj
4b12915df0 performance improvement for gam bitmap from Img 2022-06-04 20:43:34 +10:00
nworbnhoj
7f90e6e999 change dithering algorithm to BURKES 2022-06-04 17:01:43 +10:00
nworbnhoj
069b54f86b rustfmt modals api 2022-06-04 16:54:22 +10:00
nworbnhoj
8deb266c45 remove image crate dependency from modals 2022-06-04 16:54:08 +10:00
nworbnhoj
767461fa16 remove image crate dependency from gam Bitmap 2022-06-04 16:34:00 +10:00
bunnie
f4f6106b48 fix CI issues in github actions due to namespace collision of feature & package 2022-06-04 14:20:45 +08:00
nworbnhoj
66b0665d08 remove unnecessary image processing step 2022-06-04 09:04:24 +10:00
bunnie
4698a98d40 note the FIDO2 merge in release notes 2022-06-04 01:07:58 +08:00
bunnie
5d3817ee1f fix top-level defaults for a merge 2022-06-04 00:58:34 +08:00
bunnie
272abfd157 cleanup pass on spew and warnings 2022-06-04 00:56:47 +08:00
bunnie
b2b4529c40 quiet down debug spew 2022-06-04 00:35:45 +08:00
bunnie
6397aafb21 quiet down debug spew 2022-06-04 00:35:28 +08:00
bunnie
3ad70c711d add mjolnir; fix EP allocation bug
Spent the last couple days tracing down a dastardly bug, which was
slew only upon the creation of mjolnir.

The SpinalHDL USB core is unique in that it has a hardware
implementation of a linked list for its descriptors. This can
be very high performance because you can receive packets much
faster than software can keep up with it in short bursts --
assuming the stack can deal with it.

Unfortunately the poor Rust stack that we adopted from
the STM32 land only assumes single descriptors. Alas, we cannot
unlock the full power of linked list descriptors, and instead
we use "single entry lists" with static allocations, to match
the paradigm of the STM32.

Anyways. Early on, when creating the linked list allocator,
I contemplated doing it the Rusty way, and the C way. The Rusty
way would create a structure that mapped the descriptor headers
plus the variable-sized data chunk into some magical structure
that got us bounds checking and had proper accessors etc.
The C way would just be raw pointer manipulation using unsafes.

Unfortunately, my Rust-fu was no match for the linked list.
The problem is that the descriptors could be of any data size,
and they had to be mapped to a very specific piece of memory.
So I had to create a `repr (C)` struct that matched Rust's
alignment requirements and also somehow could deal with
a variable length array *but could not be a slice* because
the hardware implementation does not have the flexibility
to accommodate a fat pointer. I couldn't figure out how
to get const generics to work, and the size of the array
could be anything from 0 bytes to a couple kilobytes. So,
I ditched the safety of Rust and went with a C-style unsafe
pointer implementation.

Sure enough, it came to haunt me. When I wrote the allocator,
I forgot to allocate space for the descriptor headers. This
worked fine for the keyboard, because the keyboard asks for
32-byte descriptors but only ever does a 25-byte report. That's
just enough to fit the descriptor headers, ironically.

When implementing FIDO/U2F, it asks for 64-byte descriptors
and uses exactly 64-byte messages for everything. This caused
a bug where I could receive one incoming packet, but when
responding with an outgoing packet we'd overwrite the descriptors
of the receiving packet, zeroing it out, causing the the descriptor
to fail in the hardware state machine. Of course I never saw
this because I would print the descriptors of the individual
endpoints upon creating them, but the pointer-overflow problem
only occurs later.

Thus mjolnir was created, it is basically a tool that gives me
a raw hex dump of the endpoint and descriptor banks, which I
can then analyze and diff. It's very powerful, but also very
unweildy -- if invoked indiscriminantly, the overhead of
all the prints would cause other failures due to timing problems.
Thus mjolnir exists as a feature that introduces special
locks around the USB endpoints so that they NAK while mjolnir
does its analysis, disallowing concurrent mutation of the
memory state.

Upon deploying mjolnir, the problem became obvious, and it is
now fixed.

Thus, while on the one hand, it's a great story of how maybe
we should avoid unsafe Rust, it's also a story of how hardware
structures like a hardware linked list may be fundamentally
incompatible with Rust. I think if the hardware USB descriptor
linked list was modified to allow for a fat pointer to track
a data slice, the implementation would almost be trivial. But,
rewriting HDL to fit Rust also has its hazards, as the exact
layout of a fat pointer in RAM is not guaranteed and it would
probably foolhardy to commit to something not guaranteed in
hardware.
2022-06-03 23:53:37 +08:00
bunnie
4dca789d22 make keyboard composite device optional
just to make debugging a bit easier
2022-06-03 18:17:39 +08:00
bunnie
6ff5924cea fix issue with in_progress being set on init for writes
also try to wait for transactions in progress on write before
re-initiating
2022-06-03 16:49:36 +08:00
bunnie
8914dad705 remove redundant nack overhead, and the mystery delay
looks like after solving the redundant interrupt problem,
the mystery delay is no longer needed.
2022-06-03 03:11:35 +08:00
bunnie
010e589e4d update lockfile 2022-06-03 02:27:49 +08:00
bunnie
f7a01693fe fix interrupts for USB; fix issue #170
this fixes two things:

1. writes no longer generate a spurious interrupt on completion
that also triggers a "non-read".

2. writes are not automatically set to send on allocation. this
solves issue #170. they are only set to send after a write.
2022-06-03 02:26:08 +08:00
bunnie
48f3b36875 stuck at getting FIDO stack to respond to second OUT packet. 2022-06-03 01:08:25 +08:00
bunnie
454ebd0b52 inital USB integration to stack 2022-06-03 01:08:08 +08:00
nworbnhoj
beb2778ce6 implement gam bitmap.rotate90() 2022-06-02 14:23:09 +10:00
bunnie
52e6071265 update FidoMsg api and fix opcode bug 2022-06-02 00:58:13 +08:00
bunnie
6f1bbb49d1 cleanup whitespace issues 2022-06-01 22:33:04 +08:00
bunnie
27c4d5e01d return the key hit to the listener of the notification 2022-06-01 22:32:03 +08:00
bunnie
da06d95acd add a deferred listener for keyboard events from a dynamic notification 2022-06-01 22:31:44 +08:00
bunnie
5812cef8f3 add standard features to the config & fixup code paths that broke 2022-06-01 14:15:49 +08:00
Sean Cross
b1ff16dee7 xous: add a small comment to nameserver
Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:25 +10:00
bunnie
f620296a94 fix warnings in hosted mode 2022-06-01 11:54:25 +10:00
bunnie
06cda24c19 fix another errant mut that wasn't needed in pddb 2022-06-01 11:54:25 +10:00
bunnie
503615a138 fix warnings that result from the PDDB mutability change 2022-06-01 11:54:25 +10:00
bunnie
d9cda3a715 use interior mutability to handle callbacks
this eases a mutability requirement for the PDDB object
2022-06-01 11:54:24 +10:00
bunnie
59550978f4 fix warnings that have cropped up for transition to 2021 edition 2022-06-01 11:54:24 +10:00
Sean Cross
a459f721d0 xous: bump to rust-2021 and version to 0.9.8
Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:24 +10:00
Sean Cross
d2a6097e9f macros: remove unused proc-macros crate
This crate held the `xous_main` proc_macro that was previously used when
we were in `no_std` land. Since we now have a libstd, we can remove this
crate and improve build times while having a standard `main()` function.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:24 +10:00
Sean Cross
aa12a6e37f xous: remove xous::xous_main macro
This macro is now unused, and does not serve a purpose. Remove it to
improve build times.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:24 +10:00
Sean Cross
d342d7a885 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-06-01 11:54:24 +10:00
Sean Cross
a8d5cd6189 xous: remove nearly all dependencies
This removes nearly all of the dependencies from `xous-rs`, making it
mostly self-contained.

There is one remaining dependency tree which is `xous-macros`. This is a
legacy feature from before a time we had main(). Attempts will be made
to remove it as well.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:24 +10:00
Sean Cross
00dc844113 xous-rs: remove log, hex, and debug-here deps
The `xous-rs` library is used in many places, and should have as few
dependencies as possible. Remove these as dependencies.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:24 +10:00
Sean Cross
15cdb850bb kernel: fix warning in hosted mode
Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:24 +10:00
bunnie
d47efa4f1f fix reset timing on USB PHY 2022-06-01 11:54:24 +10:00
bunnie
7e0831c756 initialize the keyboard interface with a clean report on boot 2022-06-01 11:54:24 +10:00
Sean Cross
444f41266d hosted: fix hosted mode after CreateProcess addition
Hosted mode spawns processes very differently, and this difference was
not reflected after changes were made to native mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:24 +10:00
Sean Cross
93b1fdea70 xous: remove hardcoded addresses from create_process_pre
These addresses were hardcoded, even after they became available from
the process args.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:24 +10:00
Sean Cross
0054a1ff69 kernel: ignore "ppid unused" warning for now
Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:24 +10:00