summaryrefslogtreecommitdiff
path: root/src/shared/user-record.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-10-05 18:24:05 +0200
committerLennart Poettering <lennart@poettering.net>2021-10-06 16:21:09 +0200
commit8b4f88d13681c6dec839de06c668d32374d44724 (patch)
tree663e658b4f1a7fbd9ebae3a797e5d8901186133f /src/shared/user-record.c
parent1d3d81cf013795fb6c171347ad0333156229f436 (diff)
downloadsystemd-8b4f88d13681c6dec839de06c668d32374d44724.tar.gz
user-record: disable two pbkdf fields that don't apply for pkbdf2
Fixes: #20830
Diffstat (limited to 'src/shared/user-record.c')
-rw-r--r--src/shared/user-record.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/shared/user-record.c b/src/shared/user-record.c
index fd6b37b908..f4e509e13e 100644
--- a/src/shared/user-record.c
+++ b/src/shared/user-record.c
@@ -1912,9 +1912,9 @@ uint64_t user_record_luks_pbkdf_memory_cost(UserRecord *h) {
assert(h);
/* Returns a value with kb granularity, since that's what libcryptsetup expects */
-
if (h->luks_pbkdf_memory_cost == UINT64_MAX)
- return 64*1024*1024; /* We default to 64M, since this should work on smaller systems too */
+ return streq(user_record_luks_pbkdf_type(h), "pbkdf2") ? 0 : /* doesn't apply for simple pbkdf2 */
+ 64*1024*1024; /* We default to 64M, since this should work on smaller systems too */
return MIN(DIV_ROUND_UP(h->luks_pbkdf_memory_cost, 1024), UINT32_MAX) * 1024;
}
@@ -1922,8 +1922,9 @@ uint64_t user_record_luks_pbkdf_memory_cost(UserRecord *h) {
uint64_t user_record_luks_pbkdf_parallel_threads(UserRecord *h) {
assert(h);
- if (h->luks_pbkdf_memory_cost == UINT64_MAX)
- return 1; /* We default to 1, since this should work on smaller systems too */
+ if (h->luks_pbkdf_parallel_threads == UINT64_MAX)
+ return streq(user_record_luks_pbkdf_type(h), "pbkdf2") ? 0 : /* doesn't apply for simple pbkdf2 */
+ 1; /* We default to 1, since this should work on smaller systems too */
return MIN(h->luks_pbkdf_parallel_threads, UINT32_MAX);
}