vpnor partition table: fix checksums
Checksums in the host-endian partition table were being incorrectly
computed. Fixed this problem.
The checksums in the host-endian (big-endian) partition table were being
computed by just converting their little-endian checksum counterparts to
big-endian. This won't work because one of the fields in the table is a
string, which is stored the same irrespective of endian-ness. Hence the
checksum must be re-computed for the host-endian partition tables.
Change-Id: I45f876b5eb536620a9b361ac47317df816481cc1
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/pnor_partition_table.cpp b/pnor_partition_table.cpp
index d20b44c..f98dc71 100644
--- a/pnor_partition_table.cpp
+++ b/pnor_partition_table.cpp
@@ -212,7 +212,7 @@
dst->data.entry_count = htobe32(src->data.entry_count);
dst->data.block_size = htobe32(src->data.block_size);
dst->data.block_count = htobe32(src->data.block_count);
- dst->checksum = htobe32(src->checksum);
+ dst->checksum = details::checksum(dst->data);
for (decltype(src->data.entry_count) i{}; i < src->data.entry_count; ++i)
{
@@ -232,7 +232,7 @@
{
pdst->data.user.data[j] = htobe32(psrc->data.user.data[j]);
}
- pdst->checksum = htobe32(psrc->checksum);
+ pdst->checksum = details::checksum(pdst->data);
}
return out;