Commit graph

43 commits

Author SHA1 Message Date
bunnie
8a82caf2fc intermediate check-in on rootkeys enclave 2021-08-16 23:35:36 +08:00
bunnie
c88c986aea clean up key signing routines, finally everything "seems" to work 2021-08-14 19:46:42 +08:00
bunnie
b4ee254001 finally, a semblance of sanity... 2021-08-14 16:24:19 +08:00
bunnie
ee4368e747 gateware update code in place 2021-08-13 06:00:21 +08:00
bunnie
f334199ee6 commit host mode debugging 2021-08-12 23:01:34 +08:00
bunnie
192109d09a add some skeletal jtag access routines to rootkeys 2021-08-12 02:32:38 +08:00
bunnie
1c447fabef Merge branch 'jtag-premerge' into main 2021-08-12 01:55:48 +08:00
bunnie
3d65d7d5ed add some docnotes on the resolution to the problem 2021-08-12 01:42:58 +08:00
bunnie
aaf16dcf5e light refactor to the GAM to solve a deadlock issue
This is a "no good choice" situation but there is a problem with
progress bars.

You want progress bars to update quickly, and you don't want
to have to context switch out for the entire graphics stack to
come back to you to approve the drawing of your progress bar update.

On the other hand, you don't want to short-circuit all the checks
on drawing stuff to the screen for the sake of progress bars --
right now, there are a number of checks in place to make sure you
can't draw stuff on parts of the screen you shouldn't, to avoid
fake messages and dialog boxes.

I had managed to work out a way to get a dialog box to redraw without
violating the security rules -- each redraw is checked by the defacing
routine -- however, due to the way I was computing the height of
the modal I was causing the dialog box to be resized to its largest
size and then shrunk again to fit the text every iteration. This
in essence also caused the defacement routine to run repeatedly,
which caused the GAM to also issue repeated redraw requests to
the main loop.

These redraw requests can't be serviced until the task being tracked
by the progress bar is completed. As the progress bar gets redrawn
almost a hundred times as part of the task, roughly a hundred messages
arrive in the server's queue before it can handle a single one.

This results in a deadlock situation on completion of the progress
bar, because we want to fire off a message to ourselves to go to
the next state in the Ux routine.

There are a few possible solutions to this:

1. Multi thread the heck out of the routine doing the progress bar,
so the dialog box and the slider are each in their own threads
with their own responders and then the thing doing the computation
is doing some Mutex-guarded-Arc thing.

2. Do some very unsafe bodge to allow sliders to do direct draws
that are unchecked

3. Add a check so that if the size of the dialog box doesn't change,
defacement isn't recomputed and thus redraw messages aren't sent back.

(1) doesn't work for a number of reasons -- in a general case, it's
probably OK, but it does cause a lot more memory usage (and we are
lean on memory); but more importantly, for this use case, our routine
is interacting with CSRs and those don't implement Send so you can't
pass them into a thread via a closure. You could maybe put the dialog
boxes themselves into an Arc Mutex thing but because this routine
was heavily coded to re-use the heavyweight Ux resources this becomes
a bit cumersome to code.

(2) is terrible

(3) ended up working and what is in this commit. I think it's OK
because a progress bar generally doesn't require changing the
size of a window to update its state; therefore the redraw is
deface-safe (since you aren't changing the bounds of what you were
already approved to draw in). Of course, if you have some sort
of a progress bar implementation that changes the size of the messages
reported up top so that the dialog box has to change size over and
over again, you still end up in the deadlock situation!
2021-08-12 01:25:35 +08:00
bunnie
0ccd487f5a test case now failing, now we can solve the problem faster 2021-08-11 23:22:15 +08:00
bunnie
35e7cfe89e jtag server now reporting ID 2021-08-10 22:46:00 +08:00
bunnie
bdd70f9502 stash to figure out build issue 2021-08-10 22:41:22 +08:00
bunnie
3be03bfb8b fix debug statements 2021-08-10 22:41:15 +08:00
bunnie
5113df5eec Merge branch 'bunnie-dev' into main
Use a RefCell to solve the interior mutability issue introduced
by the &mut check introduced on MemoryRanges.
2021-08-10 18:13:33 +08:00
bunnie
cf3ed935e7 add staging location lockout and xous-names completion checking 2021-08-10 04:30:45 +08:00
bunnie
184bb8405f getting closer to a finalized flow. 2021-08-10 03:04:03 +08:00
bunnie
29f7cbe53b refactor main menu to give options for rootkey operations 2021-08-10 01:54:35 +08:00
bunnie
7edc119472 clean up debug spew 2021-08-09 14:06:54 +08:00
bunnie
04dc6a4c2b refactor engine-sha512 to be named sha2
this makes patch.crates-io much easier to debug, we now
have the hardware hasher working in all the places i expect it to.
2021-08-09 04:40:33 +08:00
bunnie
ec6a3fd1a3 self-signing working, but the patch to use the SHA hash engine seems to be disregarded... 2021-08-09 03:27:43 +08:00
bunnie
bc6ec8caf4 initial key provisioning demo working 2021-08-07 22:21:49 +08:00
bunnie
82aaeb072f gateware HMAC verification now working! 2021-08-06 02:33:52 +08:00
Sean Cross
75fbf173a9 services: fix mutable references via as_slice_mut
The function `as_slice_mut()` takes a `MemoryRange` and returns a
mutable slice. Previously, this could be called on a memory range that
was not defined as `mut`.

This will be fixed in `xous-rs` so that `as_slice_mut()` can only be
called on a region that is defined as `mut`.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-05 16:55:53 +08:00
bunnie
7921b0216f try to improve system stability in debug modes 2021-08-04 22:40:53 +08:00
bunnie
34d44ee9e7 start to remove heapless and commit to libstd flow 2021-08-04 00:07:47 +08:00
bunnie
cabcce9ab2 fix minor issues for std integration 2021-08-03 18:23:04 +08:00
bunnie
68ea69c2ed Merge branch 'bunnie-dev' into main 2021-08-03 17:22:10 +08:00
bunnie
01d6c61bb6 commit before merging main stuff
want to capture in the libstd improvements before we get too much
version drift
2021-08-03 16:54:42 +08:00
bunnie
07bf3478fa add the KEYROM patching database for rewriting bitstreams with new keys
This code was originally in https://github.com/betrusted-io/rom-locate.
However, the majority of that crate is concerned with creating the database
files necessary for the patching, and it pulls in a lot of dependencies.

Changing hardware targets is considered to be a "huge" change for this
project, so we're pushing the code generator directly into xous-core,
and commiting the generated code directly. The theory is that we would
probably never have to modify this code, since it's so intimately linked
to the hardware; it's a bit like committing an include file with
register offsets for a particular peripheral.
2021-08-03 16:28:17 +08:00
bunnie
d86c78eea8 partial progress on self-signing 2021-08-03 04:58:34 +08:00
bunnie
d112d49524 clean up UX work before switching back into crypto work 2021-08-01 17:52:15 +08:00
bunnie
cfd5e18549 add a progress bar/slider element. getting there. 2021-08-01 04:02:15 +08:00
bunnie
d56e58cb06 ux now to the point of gathering all the required passwords. 2021-07-31 03:54:10 +08:00
bunnie
d7d052b6ff refactor ux flow, now on a good footing 2021-07-31 03:27:16 +08:00
bunnie
41843db988 intermediate progress on the main UX flow again
does not build clean because still deciding on how to handle
UX feedback.
2021-07-30 19:04:02 +08:00
bunnie
151d1ee229 add tests to bcrypt and fix some corner cases 2021-07-30 15:28:47 +08:00
bunnie
919e9e87ff add bcrypt for password hashing, take care of life cycle of plaintext 2021-07-30 04:07:10 +08:00
bunnie
86a5c34a5b refactor root-keys to use the latest UX features
UX flow for requesting passwords is now more or less complete...

this yak is shaved?
2021-07-29 03:30:03 +08:00
bunnie
8cdf3c148b clean up warnings before merge to main 2021-07-28 23:58:15 +08:00
bunnie
b6c443145c extend modal functions; refactor status into its own server 2021-07-28 01:01:39 +08:00
bunnie
53f35f9928 intermediate work toward getting the password box going
lots of changes, maybe finally getting out of the UX rathole now
that basic localization is in place
2021-07-26 00:51:22 +08:00
bunnie
556f0aaea5 beginnings of a password dialog system 2021-07-22 03:04:16 +08:00
bunnie
5280d232e5 figuring out which way is up on the RootKeys implementation 2021-07-21 19:47:09 +08:00