From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 08D89211BB8CA for ; Thu, 24 Jan 2019 21:05:21 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2019 21:05:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,519,1539673200"; d="scan'208";a="294272617" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga005.jf.intel.com with ESMTP; 24 Jan 2019 21:05:19 -0800 From: "Feng, Bob C" To: edk2-devel@lists.01.org Cc: Bob Feng , Liming Gao , Yonghong Zhu , "Zhiju . Fan" Date: Fri, 25 Jan 2019 12:56:21 +0800 Message-Id: <20190125045626.14700-29-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190125045626.14700-1-bob.c.feng@intel.com> References: <20190125045626.14700-1-bob.c.feng@intel.com> MIME-Version: 1.0 Subject: [Patch 28/33] BaseTools:Fixed Rsa issue and a set define issue. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2019 05:05:21 -0000 Content-Transfer-Encoding: 8bit ValueError: non-hexadecimal number found in fromhex() arg at position 0 Cc: Bob Feng Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py index d2bb0c998c..c285a69ec0 100644 --- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py +++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py @@ -154,11 +154,11 @@ if __name__ == '__main__': # 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() PublicKey = '' while len(PublicKeyHexString) > 0: - PublicKey = PublicKey + chr(int(PublicKeyHexString[0:2], 16)) + PublicKey = PublicKey + PublicKeyHexString[0:2] PublicKeyHexString=PublicKeyHexString[2:] if Process.returncode != 0: sys.exit(Process.returncode) if args.MonotonicCountStr: @@ -186,11 +186,11 @@ if __name__ == '__main__': # # Write output file that contains hash GUID, Public Key, Signature, and Input data # args.OutputFile = open(args.OutputFileName, 'wb') 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(args.InputFileBuffer) args.OutputFile.close() if args.Decode: -- 2.20.1.windows.1