Do not allow PBKDF benchmark over maximum allowed threads.

Unfortunatelly the benchmark function cannot return
corrected parallel cost, so it must fail.

Note that some backends (like OpenSSL) also limits maximal thread count,
so currently it was clapped at 4 for luksFormat and 8 for benchmark.

This patch set it all to PBKDF internal parallel limit.
This commit is contained in:
Milan Broz
2025-05-14 14:55:17 +02:00
parent 6b832b8d03
commit e6f6ee9291

View File

@@ -408,6 +408,9 @@ int crypt_pbkdf_perf(const char *kdf, const char *hash,
if (r < 0)
return r;
if (parallel_threads > pbkdf_limits.max_parallel)
return -EINVAL;
min_memory = pbkdf_limits.min_bench_memory;
if (min_memory > max_memory_kb)
min_memory = max_memory_kb;