From 502f1bada1ed11fdd1792646fda0bfafb8fa57fb Mon Sep 17 00:00:00 2001 From: yeggor Date: Tue, 13 Sep 2022 19:25:09 +0400 Subject: [PATCH] Handle LZMA_COMPRESSED_HP Guid-Defined sections (#108) --- uefi_firmware/structs/uefi_structs.py | 1 + uefi_firmware/uefi.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/uefi_firmware/structs/uefi_structs.py b/uefi_firmware/structs/uefi_structs.py index 57666e4..129704d 100644 --- a/uefi_firmware/structs/uefi_structs.py +++ b/uefi_firmware/structs/uefi_structs.py @@ -30,6 +30,7 @@ FIRMWARE_GUIDED_GUIDS = { "LZMA_COMPRESSED": "ee4e5898-3914-4259-9d6e-dc7bd79403cf", + "LZMA_COMPRESSED_HP": "0ed85e23-f253-413f-a03c-901987b04397", "TIANO_COMPRESSED": "a31280ad-481e-41b6-95e8-127f4c984779", "FIRMWARE_VOLUME": "24400798-3807-4a42-b413-a1ecee205dd8", #"VOLUME_SECTION": "367ae684-335d-4671-a16d-899dbfea6b88", diff --git a/uefi_firmware/uefi.py b/uefi_firmware/uefi.py index ec936fd..e6f135a 100644 --- a/uefi_firmware/uefi.py +++ b/uefi_firmware/uefi.py @@ -629,7 +629,7 @@ def decompress_guid(alg): return self.process_subsections() status = True - if sguid(self.guid) == FIRMWARE_GUIDED_GUIDS["LZMA_COMPRESSED"]: + if sguid(self.guid) in [FIRMWARE_GUIDED_GUIDS["LZMA_COMPRESSED"], FIRMWARE_GUIDED_GUIDS["LZMA_COMPRESSED_HP"]]: status = decompress_guid(efi_compressor.LzmaDecompress) if sguid(self.guid) == FIRMWARE_GUIDED_GUIDS["TIANO_COMPRESSED"]: status = decompress_guid(efi_compressor.TianoDecompress) @@ -660,7 +660,7 @@ def decompress_guid(alg): def build(self, generate_checksum=False, debug=False): data = self._build_subsections(generate_checksum) - if sguid(self.guid) == FIRMWARE_GUIDED_GUIDS["LZMA_COMPRESSED"]: + if sguid(self.guid) in [FIRMWARE_GUIDED_GUIDS["LZMA_COMPRESSED"], FIRMWARE_GUIDED_GUIDS["LZMA_COMPRESSED_HP"]]: data = str(efi_compressor.LzmaCompress(data, len(data))) pass