In retrospect forcing apps to manage their suspend in resume
crosses too many abstraction barriers.
Instead, the app should specify the mode of the hardware, but
then the driver should be responsible for restoring that state
on resume, not the app.
perfomance regression on the PDDB with the latest fixes make
the device stop passing compliance when the database grows
to about 40-ish keys. For now, we set the cred limit to 32,
until the performance issues are addressed. (note that yubico
has a limit of 25 credentials, so, 32 is not insanely low).
The behavior with a secret basis is as follows:
- The key stays in the basis in which it was created.
- So, if you created k1 in .System basis, and k2 in Secret basis,
if you edit k1 while Secret basis is open, k1 stays in .System
basis. it does *not* migrate into Secret basis.
I think this is the "least surprising" behavior. There is an
argument that "maybe I want to keep secret notes in an overlay
on a key" but I feel like creating a second shadow copy of a key
with a different set of notes is not the most desired behavior
for this application (NB: it could be desired for others applications,
and that behavior can be programmed with the PDDB API; which is
why the API is a bit explicit at the moment. This flexibility goes
against the goal of "foolproof deniability", unfortunately, but
I think it is too early to know which default to set for the system).
These adjustments ideally make the system less confusing to use in
the face of secret Bases, but the spec calls for some information that
could be a leakage channel (see below).
- items that are assumed to be consistent regardless of the basis
are now forced into the System basis. This reduces potentially confusing
behavior if the system has han unlocked secret basis and things like
PIN hashes are set which appear to be global.
- There is a "global signature counter" which could leak some information
about how many credentials are in the device. However, the FIDO2 spec
enforces some plausible deniability by requiring that the counter increments
by a random value instead of by 1. In the OpenSK implementation, this increments
by a random integer from 1-8. So, if you store dozens of credentials in secret
bases, it may become less deniable due to this global signature counter.
The global signature counter seems optional, so maybe that is a feature to
be stripped out...
this checks to make sure that the system is in a usable state
for the vault to run before allowing it to be launched.
in particular, the PDDB must be initialized, and so must the
system time.
- test entries for passwords at 100 entries. it's...pretty slow
at 300 passwords, about 8 seconds to scan/read-in the database.
once the database is read-in, sorting and viewing is fast. good
news is that heap usage is about 300k for that many entries,
no OOM crashes found. just slow.
- fix an unimplemented()! error
- strip out some debug
originally we stuck it in the CRED_DICT because it forces its
creation -- but there's no reason to *really* do that. We just
set the dictionary to be created if it's not existent in the later
API calls.
By moving this to FIDO_DICT instead of FIDO_CRED_DICT it makes
key access & sorting much cleaner in the UX, because you don't
have this odd key hanging out, and it also means that you can't
have an attack on the system where you try to name a key with
the name held in FIDO_CRED_DICT to try and read it out.
UX interaction via blocking modals are put into its own thread
so that the background UX can update while menus and modals are
popped up.
Still some bugs to work out to make this fully implemented,
but this is the major work fleshed out.
The prediction API now takes an API token. This is a 128-bit
number that gets passed to the prediction engine, and it's meant
to be unique for every context that requires a predictor.
It's up to the prediction engine to do anything with the token.
For the "null" engines (such as the icontray for `vault` and
`tts`) the token is just ignored. But for example, in `shellchat`,
the API token is used to store a history record in a HashMap on
a per-token basis. This means that every app that uses the
`shellchat` history function gets their own history that can only
be read out by that app.
The actual token itself is mostly passed through the API. The
token storage is in the Context layer (each Context has a record
for a token, that starts as `None`), and is passed down to
the predictor every time the context swaps, and the predictor
receives the token and passes it back if the token was `Some`,
or allocates a new random token if it was `None`.
Note that everything is a Context, including, for example, menus and
modal dialog boxes, but not all contexts have predictors. Only
Contexts that ask for a predictor have them. This mechanism
works smoothly in this model (as opposed to other hacks and work-arounds
previously tried getting to this solution).
i've extracted the key parameters from the test suite and confirmed that
that the hash value is computed correctly on their side.
i've also confirmed that the hash value is computed correctly from
the locally computed key.
so what's gone wrong is the devired secret key doesn't match what's
on the other side.
possible issues could be either a PK serialization issue, or something
wrong in the DH exchange itself.
trying to debug why PIN authentication doesn't work. looks like
Cosekey conversion is fine, the data is arriving OK...but the
dh key exchange is not generated the expected shared secret.
Had two JSON entries with the same key, which meant you had
a 50/50 chance of a rebuild being triggered depending on which
entry was picked for the build. :-/
The OpenSK UX layer was completely gutted and re-written using
Xous-native idioms. There's a bit of ambiguity on what exactly
OpenSK meant to do with the one button and the LEDs, but for
Xous we want to show things like what you're signing for and
why.
For now, we just show the app hash during registration and signing,
but down the road that will need to be matched up against a
plaintext description of the application upon registration, so
users can have a client-side description of what they are approving.
At the moment, we're stuck at provisioning the attestation certificate
and key. The transaction goes through, but is rejected by the
test web site right now with not too much explanation of what went
wrong, but maybe the next step is to try and use the OpenSK
native tools to provision a set of keys onto the device to see
if that fixes it (instead of the current bodge of hard-coding
some manually extracted hex values into the database).
This macro will be removed, since it is no longer necessary. Remove this
macro across the project and replace it with a standard `main()`
function.
Signed-off-by: Sean Cross <sean@xobs.io>
the implementation uses an explicitly expanded key schedule for
every AES key, with separate enc/dec keys. This does save setting
up the key scheduler every time, but, it also breaks a lot of API
assumptions. Since we have the performance to afford the key
setup/teardown for every call, this commit basically turns
the key refs into actual slices of the key itself. This creates
a weird bit of code where you have an enc key being equated to
a dec key directly; those lines are left in to make it a bit easier
to diff against the original source.
But the high bit is that the original implementation, by expanding
the key scheduler, had to have a different enc and dec key schedule
(even tho they come from the same key) but this compacted form
makes them identical.
This commit also starts working in at converting the PersistentStore
to use the PDDB.
I think I basically understand the scope of the problem, and it's
mostly just some grunt recoding of the PersistentStore calls
to refer to PDDB entries by k/v names. The main thing I've done
so far is to recode the macro that creates the partitions in
OpenSK to just create string names for every item that needs
to be stored. These string names will be used to index into a dictionary
that is dedicated to the FIDO2 function.
Woo? we have CBC encryption using Rust's most favored AES library
now.
I have a feeling I'm going to be re-doing all of this once they
decide to finally take GenericArray out back and shoot it....
*everoyne* is relying on rand_core, a later version, that uses
a "getrandom" thing that tries to make the call for random
number generators generic.
I mean, it's kind of cool, but, it's also sort of a libc
non-pure-rust nightmare because basically it always delegates
to a C-style API for a variety of platforms.
Next step is to see if we can't...patch...getrandom to point
to a much simplified, xous-only version that is 100% pure Rust.
The vault app is the beginning of a multi-purpose authentication vault.
It will feature:
1. FIDO2 authentication
2. TOTP authenticators
3. Password storage to PDDB with auto-typing via keyboard HID
This is the first step on a very very long journey.
change the notification modal to accept the primary message and an
Option of independent text to display as a qrcode
pub fn show_notification(&self, notification: &str, qrtext:Option<&str>) -> Result<(), xous::Error> {}
trust levels now default to a mid-level, with the password
modals explicitly tested for by the Context logic (the idea
being to deny any untrusted canvases the ability to render
inverted text).
ball bounce app also basically works, and context
switching between the bounce app and the main menu
is working too.
The first "app" is just going to be a whole-framebuffer
demo that gets raw keys and does some stuff on the screen.
It's the starting point if you wanted to eg. write a simple
video game or something for the device, but you didn't care
about much of the other UX sugar.