Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The purpose of this branch is to reduce the number of dependencies on the PDDB so that it is easier to port it to new hardware platforms.
The original notion of the PDDB as designed for precursor was to minimize the number of dependencies that a password had to touch - this included all the I/O operations to get the keystrokes into the device. This meant integrating a lot of UX code into what would otherwise be a filesystem crate.
The cramium platform has a significantly smaller RAM footprint, but it is all entirely contained on-chip: this makes MITM attacks on RAM etc. much harder. In the case of this platform, the goal would be to minimize the total number of dependencies in the system, to reduce the code footprint overall, even if it means sharing UX resources for moving passwords and keystrokes.
This refactor is an attempt to line these two disparate feature requirements against each other. The two versions are selected by either using a "gen1" or "gen2" feature flag.
Here are the notes so far on the refactor:
PDDB will need a dependency on some sort of a "rootkey" crate. Probably, we will need to re-implement rootkeys entirely for each different hardware system, because the way the key boxes are handled is so radically different. Here are the features of RootKeys used by the PDDB:
PDDB also captures the UX flow for some key operations, such as formatting the disk, redoing the PIN, creating free space and so forth. If it were a platonic file system, I guess you'd try to turn these into "pure" APIs where you hand the PDDB everything it needs to do the specific operations on the filesystem. However, it feels strange to divorce such critical protocol-level code from the crate. So, I think the strategy will be incremental here - instead, let's rework "modals" to be more device independent:
Thus:
Strategy:
even if the lifecycle stuff is broken, the ability to read/write those keys are configured
"out of band"
the mini-gfx library, so that there are no other dependencies to get user I/O going.
The code as checked in is broken, but we'll come back to this branch once the other primitives are in better shape. Fwiw, as long as we don't select the PDDB crate as a cramium target, the cramium target still builds.