Per UEFI spec UpdateImageSize may or may not include Firmware Image
Authentication information. so for FMP auth capsule, UpdateImageSize
should include the Image auth info.

Cc: Liming Gao <liming....@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong....@intel.com>
---
 BaseTools/Source/Python/GenFds/Capsule.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/Capsule.py 
b/BaseTools/Source/Python/GenFds/Capsule.py
index 93ecee1..c9fddf6 100644
--- a/BaseTools/Source/Python/GenFds/Capsule.py
+++ b/BaseTools/Source/Python/GenFds/Capsule.py
@@ -139,11 +139,10 @@ class Capsule (CapsuleClassObject) :
             PreSize += os.path.getsize(FileName)
             File = open(FileName, 'rb')
             Content.write(File.read())
             File.close()
         for fmp in self.FmpPayloadList:
-            Buffer = fmp.GenCapsuleSubItem()
             if fmp.Certificate_Guid:
                 ExternalTool, ExternalOption = FindExtendTool([], 
GenFdsGlobalVariable.ArchList, fmp.Certificate_Guid)
                 CmdOption = ''
                 CapInputFile = fmp.ImageFile
                 if not os.path.isabs(fmp.ImageFile):
@@ -160,10 +159,12 @@ class Capsule (CapsuleClassObject) :
                 GenFdsGlobalVariable.CallExternalTool(CmdList, "Failed to 
generate FMP auth capsule")
                 if uuid.UUID(fmp.Certificate_Guid) == EFI_CERT_TYPE_PKCS7_GUID:
                     dwLength = 4 + 2 + 2 + 16 + os.path.getsize(CapOutputTmp) 
- os.path.getsize(CapInputFile)
                 else:
                     dwLength = 4 + 2 + 2 + 16 + 16 + 256 + 256
+                fmp.ImageFile = CapOutputTmp
+                Buffer = fmp.GenCapsuleSubItem()
                 Buffer += pack('Q', fmp.MonotonicCount)
                 Buffer += pack('I', dwLength)
                 Buffer += pack('H', WIN_CERT_REVISION)
                 Buffer += pack('H', WIN_CERT_TYPE_EFI_GUID)
                 Buffer += uuid.UUID(fmp.Certificate_Guid).get_bytes_le()
@@ -177,10 +178,11 @@ class Capsule (CapsuleClassObject) :
                         VendorFile.close()
                     FwMgrHdr.write(pack('=Q', PreSize))
                     PreSize += len(Buffer)
                     Content.write(Buffer)
             else:
+                Buffer = fmp.GenCapsuleSubItem()
                 ImageFile = open(fmp.ImageFile, 'rb')
                 Buffer += ImageFile.read()
                 ImageFile.close()
                 if fmp.VendorCodeFile:
                     VendorFile = open(fmp.VendorCodeFile, 'rb')
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to