Skip to content

Commit

Permalink
Fix uefi parse of ASUS bios CAP files
Browse files Browse the repository at this point in the history
Checked with: https://dlcdnets.asus.com/pub/ASUS/mb/BIOS/Pro-WS-WRX90E-SAGE-SE-ASUS-0502.zip

Workaround for:
  File "uefi_firmware/guids/__init__.py", line 21, in get_guid_name
    raw_guid = aguid(guid)
               ^^^^^^^^^^^
  File "/home/denis/Develop/linux-kernel/checks/uefi-firmware-parser/uefi_firmware/utils.py", line 105, in aguid
    a, b, c, d = struct.unpack("%sIHH8s" % (">" if big else "<"), b)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: unpack requires a buffer of 16 bytes
  • Loading branch information
0lvin committed Aug 13, 2024
1 parent 990f312 commit dc53fad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions uefi_firmware/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ def a2sguid(a):

def aguid(b, big=False):
'''RFC4122 binary GUID as int array.'''
if len(b) < 16:
for i in range(16 - len(b)):
b += b'\0'
a, b, c, d = struct.unpack("%sIHH8s" % (">" if big else "<"), b)
return [a, b, c] + [_c for _c in d]

Expand Down

0 comments on commit dc53fad

Please sign in to comment.