summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2016-06-10 11:08:07 -0700
committerMartin Roth <martinroth@google.com>2016-06-12 12:45:25 +0200
commite7f35cd2924de7c9b2e8a74a50d35928b9da76a4 (patch)
treec2b3a38054ffca7262bf7c67b3483666de1d48d2 /util
parentfe42b11cdfd93e65517cd24f43496cfddff71d37 (diff)
downloadcoreboot-e7f35cd2924de7c9b2e8a74a50d35928b9da76a4.tar.xz
ifwitool: Do not calculate checksum for subpart_dir
1. The checksum method that was documented is not correct. So, no use filling in a value based on wrong calculations. This can be added back once updated information is available. 2. Checksum does not seem to affect the booting up of SoC. So, fill in 0 for now. Change-Id: I0e49ac8e0e04abb6d7c9be70323612bdef309975 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/15145 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/ifwitool.c55
1 files changed, 6 insertions, 49 deletions
diff --git a/util/cbfstool/ifwitool.c b/util/cbfstool/ifwitool.c
index a65c988d8a..7fca542322 100644
--- a/util/cbfstool/ifwitool.c
+++ b/util/cbfstool/ifwitool.c
@@ -101,8 +101,8 @@ struct subpart_dir_header {
/* Length of directory header in bytes. */
uint8_t header_length;
/*
- * 8-bit XOR checksum from first byte of header to last byte of
- * directory entry.
+ * TODO(furquan): Add checksum calculation once more details are
+ * available.
*/
uint8_t checksum;
/* ASCII short name of sub-partition. */
@@ -750,26 +750,7 @@ static void parse_sbpdt(void *data, size_t size)
"S-BPDT");
}
-static uint8_t calc_checksum(struct subpart_dir *s)
-{
- size_t size = subpart_dir_size(&s->h);
- uint8_t *data = (uint8_t *)s;
- uint8_t checksum = 0;
- size_t i;
-
- uint8_t old_checksum = s->h.checksum;
- s->h.checksum = 0;
-
- for (i = 0; i < size; i++) {
- checksum ^= data[i];
- }
-
- s->h.checksum = old_checksum;
- return checksum;
-}
-
-static void validate_subpart_dir(struct subpart_dir *s, const char *name,
- bool checksum_check)
+static void validate_subpart_dir(struct subpart_dir *s, const char *name)
{
if ((s->h.marker != SUBPART_DIR_MARKER) ||
(s->h.header_version != SUBPART_DIR_HEADER_VERSION_SUPPORTED) ||
@@ -778,27 +759,6 @@ static void validate_subpart_dir(struct subpart_dir *s, const char *name,
ERROR("Invalid subpart_dir for %s.\n", name);
exit(-1);
}
-
- if (checksum_check == 0)
- return;
-
- uint8_t checksum = calc_checksum(s);
-
- if (checksum != s->h.checksum)
- ERROR("Invalid checksum for %s(Expected=0x%x,Current=0x%x).\n",
- name, checksum, s->h.checksum);
-}
-
-static void validate_subpart_dir_without_checksum(struct subpart_dir *s,
- const char *name)
-{
- validate_subpart_dir(s, name, 0);
-}
-
-static void validate_subpart_dir_with_checksum(struct subpart_dir *s,
- const char *name)
-{
- validate_subpart_dir(s, name, 1);
}
static void parse_subpart_dir(struct buffer *subpart_dir_buf,
@@ -824,7 +784,7 @@ static void parse_subpart_dir(struct buffer *subpart_dir_buf,
memcpy(hdr.name, data + offset, sizeof(hdr.name));
offset += sizeof(hdr.name);
- validate_subpart_dir_without_checksum((struct subpart_dir *)&hdr, name);
+ validate_subpart_dir((struct subpart_dir *)&hdr, name);
assert(size > subpart_dir_size(&hdr));
alloc_buffer(subpart_dir_buf, subpart_dir_size(&hdr), "Subpart Dir");
@@ -845,8 +805,6 @@ static void parse_subpart_dir(struct buffer *subpart_dir_buf,
&e[i].rsvd);
}
- validate_subpart_dir_with_checksum(subpart_dir, name);
-
print_subpart_dir(subpart_dir);
}
@@ -1395,7 +1353,7 @@ static void create_subpart(struct buffer *dst, struct buffer *info[],
buffer_size(info[i]));
}
- h->checksum = calc_checksum(buffer_get(&subpart_dir_buff));
+ h->checksum = 0;
struct subpart_dir *dir = buffer_get(&subpart_dir_buff);
@@ -1759,8 +1717,7 @@ static enum ifwi_ret ifwi_dir_replace(int type)
s->e[i].offset += offset;
}
- /* Re-calculate checksum. */
- s->h.checksum = calc_checksum(s);
+ s->h.checksum = 0;
/* Convert members to litte-endian. */
subpart_dir_fixup_write_buffer(&subpart_dir_buf);