BaseTools/GenerateCapsule.py: Fix checking for DepExp presence

struct.unpack() returns a tuple even for a single-element pack,
resulting in signature verification being evaluated to false even when
the signature is there.

This fixes --decode and --dump-info actions incorrectly reporting issues
with parsing capsule dependencies when there are none.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
This commit is contained in:
Sergii Dmytruk 2024-06-22 20:47:56 +03:00 committed by mergify[bot]
parent eeddb86aaa
commit 26bc42f1e3
1 changed files with 2 additions and 2 deletions

View File

@ -831,7 +831,7 @@ if __name__ == '__main__':
print ('--------')
print ('No EFI_FIRMWARE_IMAGE_AUTHENTICATION')
PayloadSignature = struct.unpack ('<I', SinglePayloadDescriptor.Payload[0:4])
(PayloadSignature,) = struct.unpack ('<I', SinglePayloadDescriptor.Payload[0:4])
if PayloadSignature != FmpPayloadHeader.Signature:
SinglePayloadDescriptor.UseDependency = True
try:
@ -918,7 +918,7 @@ if __name__ == '__main__':
print ('--------')
print ('No EFI_FIRMWARE_IMAGE_AUTHENTICATION')
PayloadSignature = struct.unpack ('<I', Result[0:4])
(PayloadSignature,) = struct.unpack ('<I', Result[0:4])
if PayloadSignature != FmpPayloadHeader.Signature:
try:
Result = CapsuleDependency.Decode (Result)