aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pbkdf/scrypt
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-12-29 09:17:48 -0500
committerJack Lloyd <[email protected]>2018-12-29 09:18:24 -0500
commit2d9b4aaa8bc80dd2bbefabebd52826caac532f82 (patch)
tree2e5c4dfeb55d1d10036543056a96d7d62ec62c90 /src/lib/pbkdf/scrypt
parentcf6127e3de2e5106dcda932a9c360a9791678e86 (diff)
Improve PBKDF self-tuning
Make the tune interval a build-time configurable instead of hardcoding it in each source file. Also use binary search in RFC4880_encode_count instead of linear search. Fix a bug in Timer
Diffstat (limited to 'src/lib/pbkdf/scrypt')
-rw-r--r--src/lib/pbkdf/scrypt/scrypt.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/pbkdf/scrypt/scrypt.cpp b/src/lib/pbkdf/scrypt/scrypt.cpp
index c20225734..e50073669 100644
--- a/src/lib/pbkdf/scrypt/scrypt.cpp
+++ b/src/lib/pbkdf/scrypt/scrypt.cpp
@@ -50,10 +50,10 @@ std::unique_ptr<PasswordHash> Scrypt_Family::tune(size_t output_length,
size_t r = 1;
size_t p = 1;
- Timer timer("Scrypt", 0);
- const std::chrono::milliseconds tune_msec(30);
+ Timer timer("Scrypt");
+ const auto tune_time = BOTAN_PBKDF_TUNING_TIME;
- timer.run_until_elapsed(tune_msec, [&]() {
+ timer.run_until_elapsed(tune_time, [&]() {
uint8_t output[32] = { 0 };
scrypt(output, sizeof(output), "test", 4, nullptr, 0, N, r, p);
});