]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/cryptenroll/cryptenroll-tpm2.c
tree-wide: use UINT64_MAX or friends
[thirdparty/systemd.git] / src / cryptenroll / cryptenroll-tpm2.c
index 211f8f987404cf3e599d6c1ad4715e6b2aea5fee..9c1478c474e34a1476c1112277a5caf0d89b27f0 100644 (file)
@@ -20,7 +20,7 @@ static int search_policy_hash(
         if (hash_size == 0)
                 return 0;
 
-        for (int token = 0; token < LUKS2_TOKENS_MAX; token ++) {
+        for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token ++) {
                 _cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
                 _cleanup_free_ void *thash = NULL;
                 size_t thash_size = 0;
@@ -42,7 +42,7 @@ static int search_policy_hash(
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                                "TPM2 token data lacks 'tpm2-policy-hash' field.");
 
-                r = unhexmem(json_variant_string(w), (size_t) -1, &thash, &thash_size);
+                r = unhexmem(json_variant_string(w), SIZE_MAX, &thash, &thash_size);
                 if (r < 0)
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                                "Invalid base64 data in 'tpm2-policy-hash' field.");
@@ -61,7 +61,7 @@ int enroll_tpm2(struct crypt_device *cd,
                 uint32_t pcr_mask) {
 
         _cleanup_(erase_and_freep) void *secret = NULL, *secret2 = NULL;
-        _cleanup_(json_variant_unrefp) JsonVariant *v = NULL, *a = NULL;
+        _cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
         _cleanup_(erase_and_freep) char *base64_encoded = NULL;
         size_t secret_size, secret2_size, blob_size, hash_size;
         _cleanup_free_ void *blob = NULL, *hash = NULL;