Commit graph

1441 commits

Author SHA1 Message Date
bunnie
38d6765586 fix remaining bugs in migration, tested and passing on CI + real hardware 2022-04-20 03:48:05 +08:00
bunnie
b3c89e5f09 add migration of secret basis for v1->v2; fix some interior mutability issues
Probably nobody is really using secret Bases right now, but it's
probably a good idea to lay out all the infrastructure and start
testing it for when it comes time to do it with data that really
matters.
2022-04-19 04:50:15 +08:00
bunnie
2596a35fe0 Merge branch 'main' into bunnie-dev 2022-04-19 02:05:46 +08:00
bunnie
f4f0812fb4 refactor API to use the None encoding for 0 on NonZeroUsize MemoryMessage fields
at the suggestion of @xobs, requires a new libstd to work with this.
2022-04-19 01:32:36 +08:00
bunnie
4ba34bbd58 intermediate work on v1->v2 migration, need to set aside to fix a libstd problem 2022-04-19 00:45:10 +08:00
bunnie
c8a38b4bf5 fix representation of va in pagetable so we're not burning 12 bits on 0's
this is a v2 fix, incompatible with v1
2022-04-19 00:44:45 +08:00
bunnie
7553053f29 v0.0.2.1 initial implementation - still needs migration code
Previous version was v0.0.1.1
New version is v0.0.2.1 (don't ask me why I skipped v0.0.2.0)

The most significant change is that the key derivation for the basis
is now split into two keys. One key is used for the page table ECB
encoding, and a different key is used for the data AES-GCM-SIV encoding.

This is because someone much smarter than me looked at my scheme
and said it is very dangerous to use the same key for two different
types of ciphers. This person is correct, so it had to be rectified.

For the System Basis, the keys are encrypted using the root keys
wrapper API. In this case, we simply create two random keys, one for
the page table, and one for the data region, and wrap them using
the root keys API.

For user secret Basis, the derived keys are sent through HKDF
with two different "info" strings to derive a pair of keys from
a common password.

In case the cryptographer who looked at this is reading along,
note that the basis name is encoded as a fixed-length, 0-padded
record, so, we don't encode the length of the basis in the hash
used to derive the keys. When I explained the scheme I thought
I was using a variable-length basis name to derive the key, but
when I checked the code, it's always 64 bytes long, and bytes
that are not used are 0-padded, so, I think we don't need the
length encoding field.
2022-04-18 15:59:15 +08:00
bunnie
c85f853e08 clean up use statements 2022-04-17 23:03:31 +08:00
bunnie
2fbb522c06 modify the web server to use mpsc, multiple workers
This is basically the Rust example for the web server, with
some tweaks. Add a command to make the device buzz when
a particular URL is hit, and to wait before responding when
another one is hit.
2022-04-17 18:50:10 +08:00
bunnie
89ceba9674 tweak some parameters and debug infos
total threads in the net crate are around 10 right now, 32 max, so
increasing the sleeping thread limit to 16, since every now and then
we get exhaustion notes.
2022-04-17 18:49:27 +08:00
bunnie
ecd875e64f remove the legacy files 2022-04-17 05:00:51 +08:00
bunnie
12190b9184 strip out the legacy xous Tcp stack implementation 2022-04-17 04:59:10 +08:00
bunnie
f2bd4a6193 fix listener address and also remove the forced timeout on read 2022-04-17 04:58:55 +08:00
bunnie
a97b548f94 implement Shutdown for TcpStream 2022-04-17 04:07:54 +08:00
bunnie
b3d83c8494 migrate to std::TcpListener in tests 2022-04-17 04:07:13 +08:00
bunnie
806b09ec0d apply TcpStream fixes
- allow for zero-length tx/rx returns
- implement "shutdown" function, which is different from close:
shutdown requires any pending connections to return Ok(0) immediately,
but the socket is not dropped.
2022-04-17 04:06:05 +08:00
bunnie
9eb35ddd49 Merge remote-tracking branch 'origin/main' into bunnie-dev 2022-04-16 06:28:29 +08:00
bunnie
a555f0380e initial tcplistener draft 2022-04-16 06:26:08 +08:00
bunnie
5d2c65cb6c fix missing update to display in panic handler 2022-04-10 16:57:04 +08:00
bunnie
46624addd0 clean up comments and review panic handler before push 2022-04-10 15:52:57 +08:00
bunnie
9254d6830a your host desires not your guru meditations
ommmmmmmmm
2022-04-10 04:47:34 +08:00
bunnie
7353c3ab9c add guru meditations 2022-04-10 04:42:02 +08:00
bunnie
3f962b6bb0 make progress updates fail gracefully on server queue full
Progress updates can come at a right too high for the renderer
to keep up, so instead of deadlocking, we discard update messages
that are too frequent.
2022-04-08 18:55:56 +08:00
bunnie
3ef2dae2f0 revert test config and make chinese text also render qr code 2022-04-08 16:05:42 +08:00
bunnie
b4dad54315 fix missing unlock() statement at end of modals 2022-04-08 15:58:59 +08:00
bunnie
fb4ce334c4 missed an instance in a demo app 2022-04-08 15:27:40 +08:00
bunnie
cd8c762c55 patch up QR code PR, change method signature as discussed
now any modal notification can also render as a QR code
2022-04-08 15:19:56 +08:00
bunnie
679fde33a7
Merge pull request #137 from nworbnhoj/qrcode
add as_qrcode to Notification modal
2022-04-08 14:28:26 +08:00
nworbnhoj
8c5c2228d2 Merge branch 'main' into qrcode 2022-04-08 16:22:19 +10:00
nworbnhoj
2a957e55cd add as_qrcode to Notification modal 2022-04-08 14:16:15 +10:00
bunnie
bc55e7db5f update the skeleton to the more recent practices 2022-04-08 01:33:31 +08:00
bunnie
d49c35dc0c verify that unmount callbacks are working 2022-04-07 17:58:37 +08:00
bunnie
52d56f39f1 wire up PDDB key unmount callbacks (oops) 2022-04-07 17:37:25 +08:00
bunnie
12ced30f40 fix a minor typo 2022-04-07 17:37:20 +08:00
bunnie
6ac4ef292b add basis mount/unmount to pddb shell commands, fix some UX formatting 2022-04-07 15:32:47 +08:00
bunnie
1ad7c43f81 refactor pddb ux thread to use deferred response messaging 2022-04-07 14:46:44 +08:00
bunnie
28de1b27a6 add some documentation to modals 2022-04-07 14:24:10 +08:00
bunnie
c97a00ed1f refactor validator to not create a new single-use server 2022-04-07 04:38:38 +08:00
bunnie
f720f3175c refactor main loop to use deferred responses
I think things could be compactified even further, but this is a
first-step "merge the threads and break as few things as possible"
pass. Would like to get @gsora's multi-line boxes merged into this
new system before doing even more optimization.
2022-04-07 04:04:37 +08:00
bunnie
360e50a8bb refactor locking to use deferred responses 2022-04-07 02:19:37 +08:00
bunnie
1261d73451 remove execution gate server and use deferred callback idiom instead
reduces one connection on all PIDs that require suspend/resume
callbacks; lightens kernel by about 16k runtime load
2022-04-07 01:13:49 +08:00
bunnie
c36d0d4111 remove an unnecessary xns registration 2022-04-07 00:20:07 +08:00
bunnie
92c6a93147 eliminate yield loop on blocking mount poller 2022-04-07 00:04:25 +08:00
bunnie
b75df1efb3 annotate rationale on multiple variants of pddb mount calls 2022-04-06 23:46:39 +08:00
bunnie
1b25f4c11d fix hosted mode 2022-04-06 13:38:44 +08:00
bunnie
33d8275321 refactor I2C to use deferred message responses instead of busy waits
This is a start on issue #111, where instead of starting a throw-away
server and doing a "yield" loop to emulate blocking behavior, messages
are instead stored so they don't drop, thus keeping a blocking
message blocking.
2022-04-06 03:35:43 +08:00
bunnie
b7adbcff52 remove no longer used UDP API stubs 2022-04-05 18:43:16 +08:00
bunnie
5b8e53aacb remove "log" feature from NTP crate, trims off some executable size 2022-04-05 13:32:23 +08:00
bunnie
dacc38808e fix blocking message detection clause in two places 2022-04-05 13:31:50 +08:00
bunnie
532c4a4f1f add NTP to time setting via SNTP library 2022-04-05 04:19:53 +08:00