X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FRsa2048Sha256Sign%2FRsa2048Sha256Sign.py;h=df05826282ebb685f14f4dd00a686944780f759c;hp=c285a69ec0db0ae9b1a29f25546aef34e3a335f9;hb=HEAD;hpb=4a3773e5783d60f7142325667de2af53da662142
diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
index c285a69ec0..df05826282 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
@@ -5,13 +5,7 @@
# This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013
#
# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
#
'''
@@ -42,7 +36,7 @@ __usage__ = '%s -e|-d [options] ' % (__prog__)
EFI_HASH_ALGORITHM_SHA256_GUID = uuid.UUID('{51aa59de-fdf2-4ea3-bc63-875fb7842ee9}')
#
-# Structure defintion to unpack EFI_CERT_BLOCK_RSA_2048_SHA256 from UEFI 2.4 Specification
+# Structure definition to unpack EFI_CERT_BLOCK_RSA_2048_SHA256 from UEFI 2.4 Specification
#
# typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
# EFI_GUID HashType;
@@ -105,7 +99,7 @@ if __name__ == '__main__':
if Process.returncode != 0:
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
sys.exit(Process.returncode)
- print(Version[0])
+ print(Version[0].decode('utf-8'))
#
# Read input file into a buffer and save input filename
@@ -153,7 +147,8 @@ if __name__ == '__main__':
# Extract public key from private key into STDOUT
#
Process = subprocess.Popen('%s rsa -in "%s" -modulus -noout' % (OpenSslCommand, args.PrivateKeyFileName), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- PublicKeyHexString = Process.communicate()[0].split('=')[1].strip()
+ PublicKeyHexString = Process.communicate()[0].split(b'=')[1].strip()
+ PublicKeyHexString = PublicKeyHexString.decode('utf-8')
PublicKey = ''
while len(PublicKeyHexString) > 0:
PublicKey = PublicKey + PublicKeyHexString[0:2]
@@ -210,7 +205,7 @@ if __name__ == '__main__':
#
# Verify the public key
#
- if Header.PublicKey != PublicKey:
+ if Header.PublicKey != bytearray.fromhex(PublicKey):
print('ERROR: Public key in input file does not match public key from private key file')
sys.exit(1)