public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kinney, Michael D" <michael.d.kinney@intel.com>
To: edk2-devel@lists.01.org
Cc: Sean Brogan <sean.brogan@microsoft.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Yonghong Zhu <yonghong.zhu@intel.com>,
	Liming Gao <liming.gao@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>
Subject: [staging/FmpDevicePkg-master 8/8] BaseTools/Capsule: Support capsules without a payload header
Date: Sun, 29 Jul 2018 11:07:43 -0700	[thread overview]
Message-ID: <20180729180743.1648-9-michael.d.kinney@intel.com> (raw)
In-Reply-To: <20180729180743.1648-1-michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=1028

Update --dump-info and --decode to show auth header infomation
even if a payload header is not present.  The --decode operation
still fails if a payload header is not present.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 BaseTools/Source/Python/Capsule/GenerateCapsule.py | 34 +++++++++++++++-------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
index 42cd1fb8ba..7b08918857 100644
--- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py
+++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
@@ -455,6 +455,9 @@ if __name__ == '__main__':
                 FmpCapsuleHeader.DumpInfo ()
             if UseSignTool or UseOpenSsl:
                 Result = FmpAuthHeader.Decode (Result)
+                if args.Verbose:
+                    print ('--------')
+                    FmpAuthHeader.DumpInfo ()
 
                 #
                 # Verify Image with 64-bit MonotonicCount appended to end of image
@@ -479,20 +482,25 @@ if __name__ == '__main__':
                 except ValueError:
                     print ('GenerateCapsule: warning: can not verify payload.')
 
-                Result = FmpPayloadHeader.Decode (Result)
-                if args.Verbose:
-                    print ('--------')
-                    FmpAuthHeader.DumpInfo ()
-                    print ('--------')
-                    FmpPayloadHeader.DumpInfo ()
+                try:
+                    Result = FmpPayloadHeader.Decode (Result)
+                    if args.Verbose:
+                        print ('--------')
+                        FmpPayloadHeader.DumpInfo ()
+                        print ('========')
+                except:
+                    if args.Verbose:
+                        print ('--------')
+                        print ('No FMP_PAYLOAD_HEADER')
+                        print ('========')
+                    raise
             else:
                 if args.Verbose:
                     print ('--------')
                     print ('No EFI_FIRMWARE_IMAGE_AUTHENTICATION')
                     print ('--------')
                     print ('No FMP_PAYLOAD_HEADER')
-            if args.Verbose:
-                print ('========')
+                    print ('========')
         except:
             print ('GenerateCapsule: error: can not decode capsule')
             sys.exit (1)
@@ -508,11 +516,15 @@ if __name__ == '__main__':
             FmpCapsuleHeader.DumpInfo ()
             try:
                 Result = FmpAuthHeader.Decode (Result)
-                Result = FmpPayloadHeader.Decode (Result)
                 print ('--------')
                 FmpAuthHeader.DumpInfo ()
-                print ('--------')
-                FmpPayloadHeader.DumpInfo ()
+                try:
+                    Result = FmpPayloadHeader.Decode (Result)
+                    print ('--------')
+                    FmpPayloadHeader.DumpInfo ()
+                except:
+                    print ('--------')
+                    print ('No FMP_PAYLOAD_HEADER')
             except:
                 print ('--------')
                 print ('No EFI_FIRMWARE_IMAGE_AUTHENTICATION')
-- 
2.14.2.windows.3



  parent reply	other threads:[~2018-07-29 18:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-29 18:07 [staging/FmpDevicePkg-master 0/8] Fix GenerateCapsule issues Kinney, Michael D
2018-07-29 18:07 ` [staging/FmpDevicePkg-master 1/8] BaseTools/Capsule: Add max value checks to Capsule Generation tools Kinney, Michael D
2018-07-29 18:07 ` [staging/FmpDevicePkg-master 2/8] BaseTools/Capsule: Remove support for PopulateSystemTable Kinney, Michael D
2018-07-29 18:07 ` [staging/FmpDevicePkg-master 3/8] BaseTools/Capsule: Fix CertType GUID byte order Kinney, Michael D
2018-07-29 18:07 ` [staging/FmpDevicePkg-master 4/8] BaseTools/Capsule: Do not support -o with --dump-info Kinney, Michael D
2018-07-29 18:07 ` [staging/FmpDevicePkg-master 5/8] BaseTools/Capsule: Update help for --fw-version and --lsv Kinney, Michael D
2018-07-29 18:07 ` [staging/FmpDevicePkg-master 6/8] BaseTools/Capsule: Update file header with tool limitations Kinney, Michael D
2018-07-29 18:07 ` [staging/FmpDevicePkg-master 7/8] BaseTools/Capsule: Prevent traceback during signing operations Kinney, Michael D
2018-07-29 18:07 ` Kinney, Michael D [this message]
2018-07-30  4:53 ` [staging/FmpDevicePkg-master 0/8] Fix GenerateCapsule issues Zhu, Yonghong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180729180743.1648-9-michael.d.kinney@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox