summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-02-24 19:59:44 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2012-02-24 19:59:44 +0100
commit70cdc4ed1b21de9a402b32cd668c520312a20264 (patch)
treef83d501ca38d15b9b2d2c4ca7e7cc91b58c771a3 /src
parent930e9aae139aa30d899ca55b950be07bb68df8d9 (diff)
Fix crc in EFI backup GPT
Diffstat (limited to 'src')
-rw-r--r--src/partgptw.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/partgptw.c b/src/partgptw.c
index a3f0420..1aad89f 100644
--- a/src/partgptw.c
+++ b/src/partgptw.c
@@ -217,7 +217,6 @@ int write_part_gpt(disk_t *disk_car, const list_part_t *list_part, const int ro,
gpt->hdr_size=le32(92);
gpt->hdr_entries=le32(hdr_entries);
gpt->hdr_entsz=le32(sizeof(struct gpt_ent));
- gpt->hdr_crc_self=le32(0);
gpt->__reserved=le32(0);
gpt->hdr_lba_start=le64(1 + gpt_entries_size/disk_car->sector_size + 1);
gpt->hdr_lba_end=le64((disk_car->disk_size-1 - gpt_entries_size)/disk_car->sector_size - 1);
@@ -226,6 +225,7 @@ int write_part_gpt(disk_t *disk_car, const list_part_t *list_part, const int ro,
gpt->hdr_lba_self=le64(1);
gpt->hdr_lba_alt=le64((disk_car->disk_size-1)/disk_car->sector_size);
gpt->hdr_lba_table=le64(1+1);
+ gpt->hdr_crc_self=le32(0);
gpt->hdr_crc_self=le32(get_crc32(gpt, le32(gpt->hdr_size), 0xFFFFFFFF)^0xFFFFFFFF);
if((unsigned)disk_car->pwrite(disk_car, gpt_entries, gpt_entries_size, le64(gpt->hdr_lba_table) * disk_car->sector_size) != gpt_entries_size)
{
@@ -242,6 +242,7 @@ int write_part_gpt(disk_t *disk_car, const list_part_t *list_part, const int ro,
gpt->hdr_lba_self=le64((disk_car->disk_size-1)/disk_car->sector_size);
gpt->hdr_lba_alt=le64(1);
gpt->hdr_lba_table=le64((disk_car->disk_size-1 - gpt_entries_size)/disk_car->sector_size);
+ gpt->hdr_crc_self=le32(0);
gpt->hdr_crc_self=le32(get_crc32(gpt, le32(gpt->hdr_size), 0xFFFFFFFF)^0xFFFFFFFF);
if((unsigned)disk_car->pwrite(disk_car, gpt_entries, gpt_entries_size, le64(gpt->hdr_lba_table) * disk_car->sector_size) != gpt_entries_size)
{