Repository navigation
Compute the vault KDF's four lanes in parallel (unlock 194 ms → 56 ms) - #185
Open
Sadykhzadeh wants to merge 1 commit into
Open
Sadykhzadeh wants to merge 1 commit into
Sadykhzadeh wants to merge 1 commit into
Conversation
Argon2 was built without its parallel feature, so unlock ran all four lanes one after another on a single thread.
PR Summary by QodoParallelize the vault's four Argon2 KDF lanes
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
The vault key comes from Argon2id with 64 MiB, t=3, p=4. The workspace built
argon2without itsparallelfeature, so the four lanes ran one after another on one thread. Every unlock (passphrase, Touch ID passphrase check, reset verification, vault creation) paid for all four in wall time on any machine.What changes
argon2 = { version = "0.6", features = ["parallel"] }. Lanes are computed on rayon's pool. Parameters, output and the cost to an attacker don't change; only the wait does.New crates in the lock file:
rayon1.12.0,rayon-core1.13.0,crossbeam-deque0.8.8,crossbeam-epoch0.9.21,either1.19.0.cargo auditreports none of them.Measured
Release build on this 4-core box, best of 5, same passphrase and salt:
ef b5 1f 9aef b5 1f 9aThe vault's existing known-answer tests also pass unchanged. That's the check that matters: a different output would lock everyone out of their vault.
Test plan
cargo test -p clavyn-core: 118 + 5 + 32 + 9 passedcargo audit: no advisory for the added crates (the existing quinn-proto/rustls entries are handled in Consolidate the four open dependency bumps and clear the npm production audit #128)node scripts/verify/check-comments.mjs: okNeed help on this PR? Tag
@codesmith-botwith what you need.