]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tpm2: rename pcr_values_size vars to n_pcr_values
authorDan Streetman <ddstreet@ieee.org>
Thu, 11 May 2023 19:33:31 +0000 (15:33 -0400)
committerDan Streetman <ddstreet@ieee.org>
Fri, 26 May 2023 15:06:53 +0000 (11:06 -0400)
Using the n_ prefix is more appropriate/conventional than the _size suffix.

No functional change, this is cosmetic only.

src/shared/tpm2-util.c

index 73282787777fe62808a546dc111dc055a92183f9..5e52191dd80fae82864d5213a80742e495a1e565 100644 (file)
@@ -1026,11 +1026,11 @@ static int tpm2_pcr_read(
                 const TPML_PCR_SELECTION *pcr_selection,
                 TPML_PCR_SELECTION *ret_pcr_selection,
                 TPM2B_DIGEST **ret_pcr_values,
-                size_t *ret_pcr_values_size) {
+                size_t *ret_n_pcr_values) {
 
         _cleanup_free_ TPM2B_DIGEST *pcr_values = NULL;
         TPML_PCR_SELECTION remaining, total_read = {};
-        size_t pcr_values_size = 0;
+        size_t n_pcr_values = 0;
         TSS2_RC rc;
 
         assert(c);
@@ -1065,12 +1065,12 @@ static int tpm2_pcr_read(
                 tpm2_tpml_pcr_selection_sub(&remaining, current_read);
                 tpm2_tpml_pcr_selection_add(&total_read, current_read);
 
-                if (!GREEDY_REALLOC(pcr_values, pcr_values_size + current_values->count))
+                if (!GREEDY_REALLOC(pcr_values, n_pcr_values + current_values->count))
                         return log_oom();
 
-                memcpy_safe(&pcr_values[pcr_values_size], current_values->digests,
+                memcpy_safe(&pcr_values[n_pcr_values], current_values->digests,
                             current_values->count * sizeof(TPM2B_DIGEST));
-                pcr_values_size += current_values->count;
+                n_pcr_values += current_values->count;
 
                 if (DEBUG_LOGGING) {
                         unsigned i = 0;
@@ -1093,8 +1093,8 @@ static int tpm2_pcr_read(
                 *ret_pcr_selection = total_read;
         if (ret_pcr_values)
                 *ret_pcr_values = TAKE_PTR(pcr_values);
-        if (ret_pcr_values_size)
-                *ret_pcr_values_size = pcr_values_size;
+        if (ret_n_pcr_values)
+                *ret_n_pcr_values = n_pcr_values;
 
         return 0;
 }
@@ -1106,7 +1106,7 @@ static int tpm2_pcr_mask_good(
 
         _cleanup_free_ TPM2B_DIGEST *pcr_values = NULL;
         TPML_PCR_SELECTION selection;
-        size_t pcr_values_size = 0;
+        size_t n_pcr_values = 0;
         int r;
 
         assert(c);
@@ -1117,14 +1117,14 @@ static int tpm2_pcr_mask_good(
 
         tpm2_tpml_pcr_selection_from_mask(mask, bank, &selection);
 
-        r = tpm2_pcr_read(c, &selection, &selection, &pcr_values, &pcr_values_size);
+        r = tpm2_pcr_read(c, &selection, &selection, &pcr_values, &n_pcr_values);
         if (r < 0)
                 return r;
 
         /* If at least one of the selected PCR values is something other than all 0x00 or all 0xFF we are happy. */
         unsigned i = 0;
         FOREACH_PCR_IN_TPML_PCR_SELECTION(pcr, s, &selection) {
-                assert(i < pcr_values_size);
+                assert(i < n_pcr_values);
 
                 if (!memeqbyte(0x00, pcr_values[i].buffer, pcr_values[i].size) &&
                     !memeqbyte(0xFF, pcr_values[i].buffer, pcr_values[i].size))