This is a partial commit of the PDDB development items. The PDDB server
doesn't do anything yet in this commit, but in order to get the documentation
links correct the docs need to be pushed to main. So, consider this a
"push documentation" commit. There will be some build warnings resulting
from this that will be fixed as the PDDB becomes more finalized.
need to figure out how to compute if it passes; it of course, breaks
the checksum attached for CI purposes. Maybe it's just a matter
of reading back the data and patching it again -- works things even harder!
also, ran the manual test case on real hardware tonight, after 389 hours
of simulation-only development. happy to report that it worked as expected,
so there's no huge obvious gaps between simulation and reality.
can create/delete dicts, create/delete/update keys.
basis deletion is...just forgetting the password. that's the point,
at least. could maybe extend the basis AAD to include some small
amount of derived data that could be deleted to facilitate basis
deletion...
anyways. next up is...lots and lots of testing.
trying to allocate key indicies within the dictionary pool in a late-binding
way is hard to do in rust, because of various interior mutability problems.
i guess it could be done but it turned out to be easier to pro-actively
track everything and generate them on demand.
allocations are hard in rust. i guess that's why the alloc thing is
still not stable.
see comments in code for more details, but, the Rust borrow checker
found a problem where the virtual to physical map could be concurrently
modified with additional entries during an allocation, so now the code
works on an "look-before-you-leap" allocation basis (where it's assumed
you either ensured sufficient space or allocated as you ran along previously),
versus a "oops we need memory let's stop the world and redo everything
while in the middle of anything" situation. The latter is obviously
more convevient, but, alas, I have to agree with the borrow checker --
probably not the safest way to do things.
this probably isn't new to most other people but this has been
a very visceral exercise of how tricky it is to use Repr(c)
for data layouts in anything but the most trivial data structures.
Unfortunately the Basis root data structure needs to be fairly rich,
so we're playing around with using rkyv to help with the serialization
to disk but I'm also not convinced this is a good idea yet. This
checkpoints commits a "working" rkyv implementation, but I'm not
entirely happy with the notion that rkyv can shuffle around data
bits based on its particular version or decisions in the serializer
crate. I'd like deterministic, repeatable serialization that will
be solid through lots of revs...
- hosted mode uses an awful, horrific hack to simulate FLASH:
it makes a global singleton that is freely mutable. Oh but wait!
that's actually how the hardware behaves. It's up to the code
around the hardware to create those primitives. So, maybe it makes
sense that the simulation model for the hardware is terribly
unsafe and unprotected.
- the format routine at least doesn't crash and creates some
semblance of a result that looks right-ish. Need to write a
utility that helps to explore the "disk image" so we can
understand what's going on.
- TrngPool is going to be more efficient if I have a single pool that's
shared among all the functions of the PDDB. It's split out into its own
object that is refcell-counted.
- Trying to make the Basis handle encryption and decryption with iterator
traits. Let's see how that works out.
- reworked fast space allocation
- shifted order of events around slightly
- formatting is now using "generic" calls to create
the free space structures instead of bespoke single-use calls
left off at getting the system basis written. need to rework
the data structure to be orthogonal with the page table remap
on a page-by-page basis. have to think about it a bit...