mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 03:10:08 +01:00
Fix PBKDF2 benchmark to not double iteration count for corner case.
If measurement function returns exactly 500 ms, the iteration calculation loop doubles iteration count but instead of repeating measurement it uses this value directly. Thanks to Ondrej Mosnacek for bug report.
This commit is contained in:
@@ -71,7 +71,7 @@ int crypt_pbkdf_check(const char *kdf, const char *hash,
|
||||
return -ENOMEM;
|
||||
|
||||
iterations = 1 << 15;
|
||||
while (ms < 500) {
|
||||
while (1) {
|
||||
if (getrusage(RUSAGE_SELF, &rstart) < 0) {
|
||||
r = -EINVAL;
|
||||
goto out;
|
||||
|
||||
Reference in New Issue
Block a user