Commit graph

148 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
85279566f0 fix #77
This adds some UX feedback in the edge case that a suspend could not
happen due to a blocking sever, e.g. a sha512 hash pending or
a SPINOR flash write/erase pending.

The UI will tell the user to retry again; usually the ops in
a normally functioning system for hashes or SPI are very short,
so we could almost just retry automatically but I think for now
I want to see if this edge case actually happens.
2022-09-24 02:40:11 +08:00
bunnie
d3daca9c5e migrate suspend/resume to the private server
this seems to resolve an issue where the time server fails to
suspend due to contention for the llio block.
2022-09-24 01:26:17 +08:00
bunnie
035bdaf986 complete wifi on/off interface
fully integrates wifi on and off commands. measured standby power
when wifi is off is "immeasurable" (0 mA), so probably < 1-2mA.

fix ui transitions so that the off request is respected, through
sleep/resume cycles as well.
2022-09-20 19:36:55 +08:00
bunnie
ec8a16f3d7 touch up some UI interactions 2022-09-20 15:54:48 +08:00
bunnie
851604f471 add translations and minor fixes to workflow 2022-09-20 01:51:40 +08:00
Gianguido Sorà
f63d69debc Merge branch 'main' into gsora/wlan-manager 2022-09-12 13:04:38 +02:00
bunnie
ec55f6de6d reduce the wait time on boot to PDDB mount
improves user experience, doesn't seem to impact startup
2022-08-05 04:56:37 +08:00
bunnie
7ad418be7c fix bug where RestoreDna backup op fails to be set. 2022-07-19 05:26:48 +08:00
bunnie
d68e3c229d add "gutter" server for status thread so it doesn't block during autoupdates
this properly solves the issue of the keypress machine sending
notifications to a status thread that's not running: it creates
a dummy server that can drain the queue until the status thread
is ready to run properly.
2022-07-19 04:39:00 +08:00
bunnie
421542d9da add auto-rekey flow to boot 2022-07-19 03:17:21 +08:00
bunnie
83eb05273f sync the PDDB before doing a backup 2022-07-18 03:09:07 +08:00
bunnie
3550cec14a fix double-lock on rootkeys object 2022-07-17 03:12:49 +08:00
bunnie
37154f3350 add edge case handling for restore to new device
Just remembered that the PDDB is *locked* to a given device.
To restore to a new device, you have to unlock all the Bases,
and re-encrypt them to the new device's DNA.

This commit adds the facilities to detect this condition, but
the actual code to do this is quite involved...let's handle that
after we've got a "simple" restore to the same device going.

Why do we lock to a device's DNA? the idea is to prevent
attacks where people are taking static blocks of crypto data
and just swapping it between devices to see if they can
get something to decrypt. It also makes it harder for
an adversary to replace the physical device -- e.g., an
evil maid prepared a replacement with implants in advance, and they
image your PDDB onto the replaced device, hoping that you don't
notice. Because the PDDB is device-locked, the "evil maid"
would have to forge the devices DNA to match yours:
possible, but would require kernel mods that patch over the
reported ID; that would trigger the line across the top of the
screen; or, somehow editing the FPGA itself to force
its device ID to report the same as yours. This last attack
vector would be successful, but afaik there is no known way
to modify an FPGA's DNA code. I'm sure there is some proprietary
secret know that Xilinx uses to set it, and if you were
a large government you may be able to coerce Xilinx into giving
you those codes plus some tool that could set the fuses
plus some unfused devices (the fuses are burn-once) but....
2022-07-16 02:31:18 +08:00
bunnie
e1d946a18d other items for keyboard layout backup/restore 2022-07-16 00:39:34 +08:00
bunnie
abade9e1af minor fixes in the autoupdate flow
- do not try to create root keys if we just did an SoC update.
that's just too many things going on, we should definitely force
a clean reboot first.

- add a clean reboot step after a no-key soc update

- try to switch USB debug mode on if a backup was created
2022-07-14 19:26:09 +08:00
bunnie
239cdef1ef add enhanced debug to time 2022-07-14 03:50:13 +08:00
bunnie
d0c0fdd9ab fix forward-version autoupdate flow and change boot ordering
in order to trigger an update in early boot, all the security
sensitive servers have to have their connection tables occupied
(I guess the fancy term is the "capabilities" need to be allocated.
whatevs. #notanacademic).

This fixes the flow so those capabilities are occupied before
we get to the update check. Also fixes options to ignore updates.
2022-07-14 02:00:24 +08:00
bunnie
5847cb04cf improve resume error handling in the time block 2022-07-13 15:16:15 +08:00
bunnie
b4b6fc2a49 unbreak hosted mode 2022-07-13 05:01:36 +08:00
bunnie
85ced42465 add automatic checks for backup/restore on boot 2022-07-13 04:44:44 +08:00
bunnie
941d72f3c5 add a magic word check to the wf200 routine
avoids running an update if nothing is staged at all.
2022-07-12 03:31:54 +08:00
bunnie
ed2f029874 add SoC autoupdate flow options -- still needs testing 2022-07-11 18:36:00 +08:00
bunnie
f756c4ee66 note stats on quitting the updater thread 2022-07-11 16:27:13 +08:00
bunnie
3e8065ee56 quit the ec updater thread once we're done checking for updates
unless we're debugging, there is no more need for its resources
to be allocated.
2022-07-11 16:23:36 +08:00
bunnie
24c10dcfb2 bump the rate of update feedback slightly
slightly more aesthetic experience without too much performance
penalty.
2022-07-11 15:09:47 +08:00
bunnie
a90b5f2554 clean up autoupdate flow & clean up net link reset flow
We are now at a point where the EC update can be applied and the
net stack recovers gracefully, so no reboot is required in the
case of an EC update.
2022-07-11 15:07:53 +08:00
bunnie
d639b3db55 fix debug output 2022-07-11 04:13:04 +08:00
bunnie
70003b641f migrate ecup to the status thread
also rework the boot flow to have auto-update detect for EC updates
2022-07-11 04:05:53 +08:00
bunnie
ead5bd7dac enable gateware updates when no root keys are present 2022-06-30 22:58:54 +08:00
bunnie
77baf89d5c have time server retry on I2C error 2022-06-28 03:25:14 +08:00
bunnie
a0217d9ffd debug logic and whitespace 2022-06-28 01:14:38 +08:00
bunnie
95b4df1923 fix regression on suspend/resume on time server
seems like we're putting too much demand on the I2C bus
on resume at the moment, backing off the requests a bit
helps ease the logjam.
2022-06-28 01:13:25 +08:00
bunnie
be7d8a76a5 catch potential div by 0 on status redraw 2022-06-27 18:45:02 +08:00
bunnie
ac3f6a06fb fix status bar (ran out of precision during the floating pt refactoring) 2022-06-27 04:25:18 +08:00
bunnie
9f409fda2d fix basis search order issues
at least, it passes some simple tests. much more testing is needed.
2022-06-26 03:52:27 +08:00
bunnie
b9e1e69adb update a commment so we know not to change a particular constant 2022-06-25 00:21:46 +08:00
bunnie
78ea80f809 remove main() thread-wrapping for non-ditherpunk configs
saves a bit of memory
2022-06-19 21:39:29 +08:00
bunnie
82919637d8 remove TODO (@gsora confirmed everything is OK!) 2022-06-18 00:42:50 +08:00
bunnie
9eec4436ea some comment bookkeeping and whitespace cleanup 2022-06-18 00:17:35 +08:00
bunnie
6d2531804b
Merge pull request #191 from gsora/gsora/backlight-on-keypress
Automatic backlight on keypress
2022-06-17 23:55:44 +08:00
bunnie
cf89ebe5f5 add wrapper around main functions that need bigger stacks
This allows for `ditherpunk` config to have a much larger
stack size on select processes only.

The cost comes at a 4k fixed overhead for the sacrificial
wrapper thread, so we lose about 20k of runtime RAM, even
when ditherpunk is *not* activated (because we're
always wrapping the threads).

There is no impact on scheduling or CPU utilization, as the
wrapper thread blocks and is never scheduled once the real
main starts. However, it does subtract one thread from the
total available thread pool.
2022-06-16 03:40:19 +08:00
Gianguido Sorà
cfbc6eeed3 feat: embed plain-text name in op num, implement stored network delete 2022-06-14 16:22:23 +02:00
bunnie
8cb632180c fix fractional decimal places on integer conversions 2022-06-14 04:30:58 +08:00
bunnie
7b2fbdc88b evict f64's from the kernel, and eliminate f32 parsing
turns out these routines add quite a bit of bloat to the kernel
for only cosmetic reasons.
2022-06-14 04:14:25 +08:00
Gianguido Sorà
d7eb53664e chore: move automatic backlight in status crate
Let's not use a precious process just for some a backlight effect :-)
2022-06-13 16:33:44 +02:00
Gianguido Sorà
1ebf3316e7 feat: wire keyboard backlight controls to main menu 2022-06-10 17:14:38 +02:00
Gianguido Sorà
4115c9b2cd feat: wire keyboard-backlight to status menu 2022-06-10 14:33:33 +02:00
Gianguido Sorà
014dcfd612 status: add wifi management menu 2022-06-10 12:20:39 +02:00
bunnie
9ee306315e fix warnings that result from the PDDB mutability change 2022-05-31 23:55:12 +08:00