summaryrefslogtreecommitdiffstats
path: root/src/cryptenroll/cryptenroll-tpm2.c
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2023-08-22 01:18:40 +0200
committerDan Streetman <ddstreet@ieee.org>2023-08-24 18:35:58 +0200
commit26d8d71fa5fc9d620899e3940ad246485991e632 (patch)
tree5b457216f67ced3ee741c018f3e217e100725403 /src/cryptenroll/cryptenroll-tpm2.c
parenttpm2: remove unnecessary void* cast (diff)
downloadsystemd-26d8d71fa5fc9d620899e3940ad246485991e632.tar.xz
systemd-26d8d71fa5fc9d620899e3940ad246485991e632.zip
tpm2: add tpm2_pcr_values_has_(any|all)_values() functions
Diffstat (limited to 'src/cryptenroll/cryptenroll-tpm2.c')
-rw-r--r--src/cryptenroll/cryptenroll-tpm2.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/cryptenroll/cryptenroll-tpm2.c b/src/cryptenroll/cryptenroll-tpm2.c
index d7f81ede3f..38920fb94e 100644
--- a/src/cryptenroll/cryptenroll-tpm2.c
+++ b/src/cryptenroll/cryptenroll-tpm2.c
@@ -211,12 +211,7 @@ int enroll_tpm2(struct crypt_device *cd,
if (r < 0)
return r;
- bool pcr_value_specified = false;
- for (size_t i = 0; i < n_hash_pcr_values; i++)
- if (hash_pcr_values[i].value.size > 0) {
- pcr_value_specified = true;
- break;
- }
+ bool pcr_value_specified = tpm2_pcr_values_has_any_values(hash_pcr_values, n_hash_pcr_values);
r = tpm2_pcr_read_missing_values(tpm2_context, hash_pcr_values, n_hash_pcr_values);
if (r < 0)