Repository navigation
perf(kdf): benchmark and calibrate default parameters - #23
Merged
Merged
Conversation
Times derive_key for the floor, the current default and larger profiles so the production default can be chosen from measurements on real hardware rather than assumed. Refs #22
RFC 9106's second option (64 MiB, t=3, p=4) unlocks in ~0.14 s on an Apple M1, well under the 0.5-1 s target. 256 MiB with the same passes and lanes takes ~0.6 s and makes each offline guess cost four times the memory. Existing vaults keep the parameters in their header. Refs #22
Adds the M1 timings to DESIGN.md and ADR 0002 explaining the 256 MiB default and why argon2's parallel feature stays off. Updates the default in the threat model and AGENTS.md to match. Refs #22
Owner
Author
|
Self-review: I read the full
|
6 tasks done
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.
Summary
Adds
cargo run --release --example kdf_bench, runs it on the owner's Apple M1, and raises the production Argon2id default from 64 MiB to 256 MiB (t=3, p=4). That takes unlock from ~0.14 s to ~0.6 s, inside the 0.5–1 s target. ADR 0002 records the reasoning, including why argon2'sparallelfeature stays off.Closes #22
Type of change
perf: KDF calibration.
How was this tested?
cargo run --release --example kdf_benchthree times on the M1. DESIGN.md quotes the final run, made with the committed code.cargo fmt --check,cargo clippy -D warnings(with and without--all-features),cargo test --workspacein both modes,cargo deny check.production_default_meets_production_floorstill passes in the featureless run. No test runs Argon2 with the production default (the crypto tests use a fixed key, and the storage and integration tests are gated oninsecure-test-kdf), so CI time is unchanged.Security checklist
pwv-core::kdf/pwv-core::crypto(the example callskdf::derive_key)Notes for the reviewer