BaseTools:Fixed Rsa issue and a set define issue.

ValueError: non-hexadecimal number found in
 fromhex() arg at position 0

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Feng, Bob C 2019-01-23 09:27:30 +08:00
parent 7aef7b7cbf
commit 4a3773e578
1 changed files with 2 additions and 2 deletions

View File

@ -156,7 +156,7 @@ if __name__ == '__main__':
PublicKeyHexString = Process.communicate()[0].split('=')[1].strip() PublicKeyHexString = Process.communicate()[0].split('=')[1].strip()
PublicKey = '' PublicKey = ''
while len(PublicKeyHexString) > 0: while len(PublicKeyHexString) > 0:
PublicKey = PublicKey + chr(int(PublicKeyHexString[0:2], 16)) PublicKey = PublicKey + PublicKeyHexString[0:2]
PublicKeyHexString=PublicKeyHexString[2:] PublicKeyHexString=PublicKeyHexString[2:]
if Process.returncode != 0: if Process.returncode != 0:
sys.exit(Process.returncode) sys.exit(Process.returncode)
@ -188,7 +188,7 @@ if __name__ == '__main__':
# #
args.OutputFile = open(args.OutputFileName, 'wb') args.OutputFile = open(args.OutputFileName, 'wb')
args.OutputFile.write(EFI_HASH_ALGORITHM_SHA256_GUID.bytes_le) args.OutputFile.write(EFI_HASH_ALGORITHM_SHA256_GUID.bytes_le)
args.OutputFile.write(PublicKey) args.OutputFile.write(bytearray.fromhex(str(PublicKey)))
args.OutputFile.write(Signature) args.OutputFile.write(Signature)
args.OutputFile.write(args.InputFileBuffer) args.OutputFile.write(args.InputFileBuffer)
args.OutputFile.close() args.OutputFile.close()