before we were looking at the amount of data transferred and
seeing if it matches the expected amount
I just realized that we can just look at the descriptor pointer in
the status region; if it is non-zero, then the descriptor set
is "live" and needs to be filled.
if it's zero, then a packet came in.
use this to fix the wait conditions for accepting new commands.
IN descriptors now chain up to 512 bytes long
OUT descriptors still need to be worked up
However, there is an issue where the system is injecting the
ZLP/CSW immediately after the bulk response is queued up, and this
is getting sent before the bulk data is issued. Need to figure out
this race condition.
Users are confused when they are prompted to enter a PIN code for
the first time with no preparation. Update the format request message
to prime users for the task.
Fix a segfault that occurred when using ReplyAndReceiveNext on hosted
mode. This now properly passes memory messages back to the client.
Signed-off-by: Sean Cross <sean@xobs.io>
Much of the hosted machinery requires the ability to access memory on
syscalls. This feature was overlooked in the previous implementation of
ReplyAndReceiveNext, which caused it to not properly return memory.
Implement the ability to call `.memory()` on ReplyAndReceiveNext
messages.
Note that this requires the use of a sentinal value in the
previously-unused `valid` field.
Signed-off-by: Sean Cross <sean@xobs.io>
`vault` is changed so that instead of clearing the list of
data each time the screen is updated, it tries to compare it
against the existing data and modifies the record if it needs to,
or leaves it untouched.
Furthermore, at least in the password path, temporary strings
are pre-allocated and re-used, instead of freed and re-allocated
every time through the main loop.
The combination of these optimzations reduces the time to re-parse
a couple hundred records from about 1000ms to 200ms, reducing the
overall time to retrieve the database from 1.8s to 1.0s. It also
makes the loop much more stable over time; previously, as the heap
fragmented, performance would slowly degrade. Now that most
records are static and re-used, the performance seems to stay
constant.
The framwork is also put in place to re-use TOTP/U2F records,
but the code still uses the legacy method of clearing the
entire stored list and rebuilding it. However, it wasn't deemed
a priority to fix this because generally I haven't seen use cases
where users have hundreds of tokens or TOTP's; so long as the
number is about 20 or so, the performance difference should
be imperceptible with or without optimization.