1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-23 10:50:16 +03:00

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.
This commit is contained in:
Lennart Poettering 2021-10-08 16:58:42 +02:00
parent 4a09a67755
commit e7e30330ff

View File

@ -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;