On 1/29/24 02:31, Florian Weimer wrote:
As far as I can tell, this warning is both technically correct and
harmless.  The called generate_composite_hash hash function only writes
SHA1_DIGEST_SIZE bytes and uses byte accesses.

Thanks,
Florian

diff --git a/lcptools-v2/pconf_legacy.c b/lcptools-v2/pconf_legacy.c
index 443b5cd5525b9fe1..5ebc6c451f7008b1 100644
--- a/lcptools-v2/pconf_legacy.c
+++ b/lcptools-v2/pconf_legacy.c
@@ -324,7 +324,7 @@ static lcp_policy_element_t *create(void)
              ERROR("Error: no pcrs were selected.\n");
              return NULL;
          }
-        digest = malloc(SHA1_DIGEST_SIZE);
+        digest = malloc(sizeof(*digest));
          if (digest == NULL) {
              ERROR("Error: failed to allocate memory for digest buffer.\n");
              return NULL;



_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

That's not the only patch that file needed. When I submitted the original patch to use the correct algorithm, I missed a line.
# HG changeset patch
# User Christopher Byrne <salah.coro...@gmail.com>
# Date 1645847383 21600
#      Fri Feb 25 21:49:43 2022 -0600
# Node ID 167619b51646aac056109fbe2a1b1198a221cdad
# Parent  abe5b6c022f37a86e810dab44292c478e3b4a48c
lcptools-v2/pconf_legacy.c: Add missing BE size_of_pcrs to hash buffer

Signed-of-by: Christopher Byrne <salah.coro...@gmail.com>

diff -r abe5b6c022f3 -r 167619b51646 lcptools-v2/pconf_legacy.c
--- a/lcptools-v2/pconf_legacy.c	Tue Jan 23 12:20:07 2024 +0100
+++ b/lcptools-v2/pconf_legacy.c	Fri Feb 25 21:49:43 2022 -0600
@@ -241,6 +241,7 @@
         ERROR("Error: failed to allocate buffer for composite digest.\n");
         return false;
     }
+    buff->size_of_pcrs = htonl(no_of_pcrs * SHA1_DIGEST_SIZE);
     memcpy_s(
         &buff->pcr_selection,
         sizeof buff->pcr_selection,
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to