Commit graph

2596 commits

Author SHA1 Message Date
bunnie
dd017fb291 retire file-based versioning to symlink methodology 2022-02-28 16:06:48 +08:00
bunnie
4192c2105f pull in 0.9.7 soc precursors 2022-02-28 14:18:04 +08:00
bunnie
1fa0956bdc Update release notes 2022-02-28 14:16:56 +08:00
bunnie
2b3178be82 add a powershell script for bleeding edge CI
Because i don't know how to do variables in powershell :-/
2022-02-28 14:07:42 +08:00
bunnie
65499eb0fc bump version code in the pddbdbg.py script as well 2022-02-28 04:16:06 +08:00
bunnie
dcbe9f122a bump the PDDB version field to demarcate the breaking change 2022-02-28 04:07:45 +08:00
bunnie
39f9e656cf suppress a debug message
key commit seems to work on real hardware. will promote for
release status with a bit more testing
2022-02-28 03:57:16 +08:00
bunnie
0b454cb7a8 evict salamanders from AES-GCM-SIV in the PDDB
So you'd like to think that an authenticating cipher would like,
authenticate stuff on decryption. And AES-GCM-SIV was billed as sort
of AES with the pointy edges taken off.

Well, there's always one more bug, actually this time a salamander:
https://eprint.iacr.org/2020/1456.pdf Apparently one can forge
authentication if the attacker can control keys and ciphertext. In the
case of the PDDB I think the attack is largely theoretical, because
you'd have to forge through both the AES-GCM-SIV and the rather
insufficient nonce/murmur hash check on the PTE that locates the page
to be decrypted.

But it's never good to have cryptographic properties depend upon
something that's known to be insufficient, so let's assume the attacker
can simply forge keys and stick some data on the device.

This wouldn't be a problem for confidentiality but it could lead to
the ability to plant evidence, but more importantly could lead to code
paths that were thought to be protected against fuzzing being fuzzed
as you could conceivably create a Basis root record that "checked out"
and then the larger body of the PDDB code would try to chomp on other
pages that are forged, leading to a bigger attack surface. Plus who
knows what else might exist beyond salamanders...

This patch does a "key commitment" on the Basis root page, so that it
is now cryptographically hard to create a salamander.  Basically
instead of using the system root key directly in AES-GCM-SIV, the key
goes through a KDF that expands it with yet another nonce plus a bit
of header data. The KDF is SHA512/256 and it expands it twice,
changing one bit in the header data (as prescribed by the paper cited
above), to create a version of the key that is written to disk (the
commitment), and a version of the key that is used to
decrypt/authenticate the AES-GCM-SIV data. Only if both the commitment
and the authentication check out, do we accept a Basis root page as
valid.

I had some concerns about the slightly different structure of the
Basis Root page being detectable, but I have been assured that the key
commitment form and the MAC in AES-GCM-SIV satisfy a property known as
IND$-CPA ("indistinguishable from uniform randomness by a
chosen-plaintext attacker") by Rogaway[1], and, more strongly, "Secure
nonce misuse-resistant authenticated encryption (mrAE)" by Gueron and
Lindell (see appendix for def)[2]. Still, just out of total paranoia
and nothing else, I organize the basis root page such that the MAC is
in the identical location as the other non-committed pages...just in
case there is some mathematical property of the MAC that could be
leveraged to leak info about the existence of the basis root record.
The commitment nonce and sha512/256 result I understand better and
feel pretty comfortable that they are going to be strongly random and
indistinguishable from AES ciphertext.

Thanks to Michael Rosenberg for taking the time to explain all this to
me and to guide me through the process of making the fixes. It is a
major PDDB API-breaking change and I'm glad it's able to be rolled out
before most users have received a device.

[1] https://web.cs.ucdavis.edu/~rogaway/papers/ad.pdf
[2] https://eprint.iacr.org/2015/102
2022-02-28 03:13:26 +08:00
bunnie
2c668fde3d Merge branch 'main' into bunnie-dev 2022-02-27 18:21:50 +08:00
bunnie
8a17b45dc1 fix skeleton template 2022-02-27 18:21:11 +08:00
bunnie
d0ecd54435 remove stray espeak artifacts from this dev branch 2022-02-27 18:20:43 +08:00
bunnie
b012cfa2fc update SoC precursors to latest Litex
prep for future activities e.g. vexriscv perf optimization and
Luna USB integrations
2022-02-25 02:45:36 +08:00
bunnie
9e8c78c4a5 remove erroneous references to a dev branch 2022-02-24 20:12:27 +08:00
bunnie
a9a5e5c9a9 integrate app name in sec notes patch, make app name update retriggered on change 2022-02-24 19:44:24 +08:00
Gianguido Sorà
b47c7b2793 Add current app name in security notes
This commit adds the current's app name to the security bar at the top
of the screen, just beneath the status bar.
I had to add a new generated function to map app index back to its name,
along with an enum to signal whether or not the id is valid.

Signed-off-by: Gianguido Sorà <me@gsora.xyz>
2022-02-24 19:29:45 +08:00
Sean Cross
97615014f8 Merge branch 'main' of github.com:betrusted-io/xous-core 2022-02-23 21:47:54 +08:00
Sean Cross
768a7c4b0d emulation: add WF200 ethernet implementation
This adds a working Ethernet implementation based on the WF200. It
currently gets connected to a Linux machine running a udhcpd server,
however it could also get connected to a TUN/TAP connection on Linux or
Mac.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-23 21:44:01 +08:00
bunnie
271fd4d559 make the UDP socket specifiable on command line
this makes the bindings work on things other than localhost
2022-02-21 01:26:04 +08:00
bunnie
760957154e add a crappy but slightly more accurate approximation of UDP to hosted mode
It's crappy because it uses a busy wait loop to poll the udp
rx socket in order to accurately emulate the Xous async callback
feature (which is _not_ emulated for Tcp, for example).

It's more accurate because this emulation happens. But it's a lot
more complicated to implement it because zero-cost async UDP callbacks
aren't really a host-native feature (but they are a Xous-native feature!),
and I didn't want to .. pull in tokio or mio code surface into
the Xous hosted mode, seemed a bit like crushing a fly by dropping
a house on it. Maybe that's a fine solution in Oz, but Xous doesn't live in Oz.
2022-02-21 00:54:46 +08:00
bunnie
764b4be6b1 clean up status line overrun if text fitting went errant 2022-02-21 00:03:28 +08:00
bunnie
0dbf1661cb add TCP to hosted mode emulation
Total bodge -- we lop off the TCP stack at the Xous API level, and
substitute it with a native host TCP stack.

Caveat hacker: this means that a lot of OS-specific net properties
will carry through to the hosted mode emulation. This is adequate
for "smoke testing" a build but do not be shocked, *shocked* if
there are more bugs to be found because of some weird host integration
issue.
2022-02-20 21:31:32 +08:00
bunnie
535a090501 Merge branch 'main' of github.com:betrusted-io/xous-core into main 2022-02-19 01:42:00 +08:00
bunnie
9b07156b13 add deprecation notice to docs & reference to rtc lib for example 2022-02-19 01:41:27 +08:00
bunnie
960745ca61 eliminate static mut unsafe pattern in callback function storage
since xous 0.9.5, we've had a Box and we've had threads, so now we
can put the callback in a Box and pass it to a thread, instead
of relying on an `unsafe` work-around to get the callback function
pointer into the thread's environment.
2022-02-19 01:38:20 +08:00
bunnie
e4db83e59e add a "public" RTC get command to the LLIO
This implemnetation takes advantage of the fact that the LLIO
owns the RTC device, and bypasses a layer of indirection in the
call chain.
2022-02-19 01:16:20 +08:00
bunnie
95b857feea refactor i2c interface to eliminate static mut unsafes
also remove async write callbacks: in practice, these aren't used

Downside of this refactor is that threads for handling the
callbacks are not spawned on demand, they are spawned at boot,
leading to about an extra 68k of RAM used (most of it being
consumed in the codec block, actually). Some of this is also
probably extra object code because we're using more of the stdlib
primitives, which carry some weight.
2022-02-19 00:31:25 +08:00
bunnie
0bd8a97f63 fix refcount implementation i2c block 2022-02-18 19:04:04 +08:00
Sean Cross
9c1255bdd7 emulation: split Com emulation into three files
The COM bus is fundamentally three things: The SoC, the EC, and the glue
that binds the two together.

Now that we have the `EnsureTypeIsLoaded` trick, split the file into
three different groups.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-18 09:07:13 +08:00
Sean Cross
317f3136aa emulation: complete initial emulation of spinor/flash
Emulate both the SPINOR block as well as the OSPI flash attached to it.

With this change, the PDDB can now be initialized and resets itself
properly. Additionally, data persists across virtual reboots.

Data does not persist across runs of the emulator. That will follow in
an upcoming patch.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-17 18:03:45 +08:00
bunnie
8dd991b534 reduce debug spew 2022-02-15 22:25:07 +08:00
bunnie
38114b5cd9 add a facility to dump keys for Renode integration (or to steal keys if you can patch the firmware)
the code is commented out so it's not accidentally compiled in.
2022-02-15 22:24:03 +08:00
bunnie
1f21d8a43c Merge branch 'main' of github.com:betrusted-io/xous-core into main 2022-02-15 17:37:27 +08:00
bunnie
4df39797c1 fix issue #101 based on @xobs changes 2022-02-15 17:36:53 +08:00
bunnie
40812600ee
Merge pull request #103 from taivlam/patch-2
Fix minor typos
2022-02-15 15:50:39 +08:00
bunnie
8c692681dc
Merge pull request #102 from taivlam/patch-1
Edit minor typos
2022-02-15 15:50:10 +08:00
taivlam
152abdac6b
Fix minor typos
Fixed minor typos in comments (I guessed "ts" was "its")
2022-02-14 19:45:12 -05:00
taivlam
dd7fc7c453
Edit minor typos
Fixed 2 minor typos in README.md for PDDB
2022-02-14 19:39:12 -05:00
Sean Cross
88512da693 emulation: keyboard: add key injection functions
It is now possible to inject keys, strings, and lines of text.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-14 17:51:56 +08:00
Sean Cross
5402582f97 spinor: fix incorrect ecc write into softirq block
The init code tried to set up the ECC block to report errors by writing
into the softirq block. Correct the block so that it goes into the
spinor block instead.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-14 17:32:20 +08:00
Sean Cross
d44cae2eae xous-release: silence GPIO range
Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-14 16:37:33 +08:00
Sean Cross
ed4dfd4dc1 emulation: com: update HOLD as part of Transmit
Previously, the HOLD signal was updated in a different clock domain from
the transmission signal. This could result in the HOLD bit being set
even if there was no data available.

Update the HOLD bit if it's present as part of the Transmit cycle.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-14 13:52:43 +08:00
Sean Cross
11783a050e emulation: i2c: implement Reset bit on I2C
Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-14 13:41:50 +08:00
Sean Cross
c392d8df90 emulation: BQ27421: implement more registers
This gets the gas gauge showing more data.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-14 13:41:15 +08:00
Sean Cross
a0377db06e Merge branch 'main' of github.com:betrusted-io/xous-core 2022-02-14 12:47:19 +08:00
Sean Cross
49e1eb19c0 emulation: connect EC
Connect the EC to the SoC. This allows for emulating both the EC and SoC
in tandem. Messages flow via a 16-bit bus. When data is not available,
`0xdddd` is returned.

There is a HOLD line that goes from the EC to the SoC. This is tied to
the inverse of presence of data in the EC FIFO -- when it's empty, HOLD
is `1`, and when there is data it's `0`.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-14 12:28:40 +08:00
Sean Cross
fbbb2120ab com: working on getting com functioning
Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-13 10:59:47 +08:00
bunnie
122221227b fix some bitrot on usb burning routines, add windows support 2022-02-12 23:18:27 +08:00
bunnie
b1859b57ae fix hw_pkgs -> pkgs thanks @gsora 2022-02-12 00:56:28 +08:00
bunnie
af52f4ae3c add apps to debug hosted mode flow 2022-02-12 00:42:19 +08:00
bunnie
32c3f03609 prevent double-injections on windows 2022-02-10 03:04:05 +08:00