summaryrefslogtreecommitdiffstats
path: root/src/home
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-10-08 16:58:42 +0200
committerLennart Poettering <lennart@poettering.net>2021-10-08 23:50:04 +0200
commite7e30330ff9fe0c2df3debe8cdf89bf6f5ed1bfd (patch)
treed05147c222eaf9ae0cc2c0eca060c4a13d598af1 /src/home
parentcryptsetup: also define crypt_token_max() as fallback locally, not just sym_c... (diff)
downloadsystemd-e7e30330ff9fe0c2df3debe8cdf89bf6f5ed1bfd.tar.xz
systemd-e7e30330ff9fe0c2df3debe8cdf89bf6f5ed1bfd.zip
homed: use crypt_token_max() where appropriate
Let's use the new crypt_token_max() API in systemd-homework too, to cut iteration of tokens short. We already use it in cryptenroll/cryptsetup, so let's use it here too.
Diffstat (limited to 'src/home')
-rw-r--r--src/home/homework-luks.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c
index 8af9223d57..b716218716 100644
--- a/src/home/homework-luks.c
+++ b/src/home/homework-luks.c
@@ -698,7 +698,7 @@ static int luks_validate_home_record(
assert(cd);
assert(h);
- for (int token = 0;; token++) {
+ for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token++) {
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL, *rr = NULL;
_cleanup_(EVP_CIPHER_CTX_freep) EVP_CIPHER_CTX *context = NULL;
_cleanup_(user_record_unrefp) UserRecord *lhr = NULL;
@@ -894,7 +894,7 @@ int home_store_header_identity_luks(
_cleanup_(user_record_unrefp) UserRecord *header_home = NULL;
_cleanup_free_ char *text = NULL;
- int token = 0, r;
+ int r;
assert(h);
@@ -924,7 +924,7 @@ int home_store_header_identity_luks(
if (r < 0)
return r;
- for (;; token++) {
+ for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token++) {
crypt_token_info state;
const char *type;