mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Check for physical memory available also in PBKDF benchmark.
This commit is contained in:
@@ -101,6 +101,7 @@ int crypt_benchmark_pbkdf(struct crypt_device *cd,
|
||||
{
|
||||
int r, priority;
|
||||
const char *kdf_opt;
|
||||
uint32_t memory_kb;
|
||||
|
||||
if (!pbkdf || (!password && password_size))
|
||||
return -EINVAL;
|
||||
@@ -113,6 +114,14 @@ int crypt_benchmark_pbkdf(struct crypt_device *cd,
|
||||
|
||||
log_dbg(cd, "Running %s(%s) benchmark.", pbkdf->type, kdf_opt);
|
||||
|
||||
memory_kb = pbkdf_adjusted_phys_memory_kb();
|
||||
if (memory_kb < pbkdf->max_memory_kb) {
|
||||
log_dbg(cd, "Not enough physical memory detected, "
|
||||
"PBKDF max memory decreased from %dkB to %dkB.",
|
||||
pbkdf->max_memory_kb, memory_kb);
|
||||
pbkdf->max_memory_kb = memory_kb;
|
||||
}
|
||||
|
||||
crypt_process_priority(cd, &priority, true);
|
||||
r = crypt_pbkdf_perf(pbkdf->type, pbkdf->hash, password, password_size,
|
||||
salt, salt_size, volume_key_size, pbkdf->time_ms,
|
||||
|
||||
Reference in New Issue
Block a user