# * Do not support vendor code bytes in a capsule.\r
#\r
# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
\r
'''\r
\r
if Process.returncode != 0:\r
shutil.rmtree (TempDirectoryName)\r
- print (Result[1].decode())\r
+ print (Result[1].decode(encoding='utf-8', errors='ignore'))\r
raise ValueError ('GenerateCapsule: error: signtool failed.')\r
\r
#\r
raise ValueError ('GenerateCapsule: error: can not run openssl.')\r
\r
if Process.returncode != 0:\r
- print (Result[1].decode())\r
+ print (Result[1].decode(encoding='utf-8', errors='ignore'))\r
raise ValueError ('GenerateCapsule: error: openssl failed.')\r
\r
return Signature\r
\r
if Process.returncode != 0:\r
shutil.rmtree (TempDirectoryName)\r
- print (Result[1].decode())\r
+ print (Result[1].decode(encoding='utf-8', errors='ignore'))\r
raise ValueError ('GenerateCapsule: error: openssl failed.')\r
\r
shutil.rmtree (TempDirectoryName)\r
)\r
except:\r
print ('GenerateCapsule: error: can not sign payload')\r
- raise\r
sys.exit (1)\r
\r
try:\r
FmpCapsuleHeader.DumpInfo ()\r
if UseSignTool or UseOpenSsl:\r
Result = FmpAuthHeader.Decode (Result)\r
+ if args.Verbose:\r
+ print ('--------')\r
+ FmpAuthHeader.DumpInfo ()\r
\r
#\r
# Verify Image with 64-bit MonotonicCount appended to end of image\r
except ValueError:\r
print ('GenerateCapsule: warning: can not verify payload.')\r
\r
- Result = FmpPayloadHeader.Decode (Result)\r
- if args.Verbose:\r
- print ('--------')\r
- FmpAuthHeader.DumpInfo ()\r
- print ('--------')\r
- FmpPayloadHeader.DumpInfo ()\r
+ try:\r
+ Result = FmpPayloadHeader.Decode (Result)\r
+ if args.Verbose:\r
+ print ('--------')\r
+ FmpPayloadHeader.DumpInfo ()\r
+ print ('========')\r
+ except:\r
+ if args.Verbose:\r
+ print ('--------')\r
+ print ('No FMP_PAYLOAD_HEADER')\r
+ print ('========')\r
+ raise\r
else:\r
if args.Verbose:\r
print ('--------')\r
print ('No EFI_FIRMWARE_IMAGE_AUTHENTICATION')\r
print ('--------')\r
print ('No FMP_PAYLOAD_HEADER')\r
- if args.Verbose:\r
- print ('========')\r
+ print ('========')\r
except:\r
print ('GenerateCapsule: error: can not decode capsule')\r
- raise\r
sys.exit (1)\r
\r
elif args.DumpInfo:\r
FmpCapsuleHeader.DumpInfo ()\r
try:\r
Result = FmpAuthHeader.Decode (Result)\r
- Result = FmpPayloadHeader.Decode (Result)\r
print ('--------')\r
FmpAuthHeader.DumpInfo ()\r
- print ('--------')\r
- FmpPayloadHeader.DumpInfo ()\r
+ try:\r
+ Result = FmpPayloadHeader.Decode (Result)\r
+ print ('--------')\r
+ FmpPayloadHeader.DumpInfo ()\r
+ except:\r
+ print ('--------')\r
+ print ('No FMP_PAYLOAD_HEADER')\r
except:\r
print ('--------')\r
print ('No EFI_FIRMWARE_IMAGE_AUTHENTICATION')\r