]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Update Rsa2048Sha256Sign to use openssl standard options
authorLiming Gao <liming.gao@intel.com>
Tue, 27 Mar 2018 02:29:48 +0000 (10:29 +0800)
committerLiming Gao <liming.gao@intel.com>
Tue, 27 Mar 2018 08:11:00 +0000 (16:11 +0800)
sha256 is not the standard option. It should be replaced by sha -sha256.
Otherwise, it doesn't work in MAC OS.

In V2, update the option to sha1 -sha256.
In late openssl version >= 1.1, there is no sha option, but has sha1,sha256.
In previous openssl version < 1.1, there is no sha256, but has sha,sha1.
To work with all openssl version, use sha1 -sha256 for it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liao Jui-peng <jui-pengx.liao@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py

index 1ae6ebb3588604beaa010e466a7ea6856231be8c..4188f8e23c2703d27963919643f1987c9f569eca 100644 (file)
@@ -176,7 +176,7 @@ if __name__ == '__main__':
     # \r
     # Sign the input file using the specified private key and capture signature from STDOUT\r
     #\r
-    Process = subprocess.Popen('%s sha256 -sign "%s"' % (OpenSslCommand, args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
+    Process = subprocess.Popen('%s sha1 -sha256 -sign "%s"' % (OpenSslCommand, args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
     Signature = Process.communicate(input=FullInputFileBuffer)[0]\r
     if Process.returncode <> 0:\r
       sys.exit(Process.returncode)\r
@@ -225,7 +225,7 @@ if __name__ == '__main__':
     #\r
     # Verify signature\r
     #    \r
-    Process = subprocess.Popen('%s sha256 -prverify "%s" -signature %s' % (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
+    Process = subprocess.Popen('%s sha1 -sha256 -prverify "%s" -signature %s' % (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
     Process.communicate(input=FullInputFileBuffer)\r
     if Process.returncode <> 0:\r
       print 'ERROR: Verification failed'\r