latchset / kryoptic

a pkcs#11 software token written in Rust
GNU General Public License v3.0
10 stars 4 forks source link

Storage changes #17

Closed simo5 closed 6 months ago

simo5 commented 7 months ago

Refactor storage to allow multiple backends. Add a sqlite based storage backend (see more info on the commit). Rework some PIN operations to simplify and address storage/masking issues.

also Fixes #23

simo5 commented 6 months ago

@Jakuje I have a few more changes I want to make, you can start to review the general change if you want, but expect some API changes in the next rebase, so feel free to hold off.

simo5 commented 6 months ago

I think it is basically ready for review.

I am not happy with the need to take a write lock for token for so many operations now (due to the caches needing updates on object fetching which are technically just reads).

One idea is to change the object caches in the storage implementations to have themselves locks, so for most operations the locking can be in the caches themselves instead of locking the whole token object.

Another option is to move the caches into the session objects, but the reason I moved them in the token is that some non-token objects still need to be available across sessions, and that would make matters complicated still requiring a caching layer at the token level ...

simo5 commented 6 months ago

@Jakuje I think I addressed all of the issues you raised

simo5 commented 6 months ago

merged