-From 4c346aa9e816bddfedc8ac99809fd1ed91bfc8ee Mon Sep 17 00:00:00 2001
+From 8228c484a1533ff904b276c342adcb6310abe272 Mon Sep 17 00:00:00 2001
From: Taahir Ahmed <ahmed.taahir@gmail.com>
Date: Wed, 30 Mar 2016 11:23:54 -0300
Subject: [PATCH] crda: support python 3 in utils/key2pub.py
utils/key2pub.py can now be run under either python 2.7 or python 3.x.
This required some minor syntactical changes as well as switching from
-M2Crypto to pycrypto, since M2Crypto doesn't support python 3.x.
+M2Crypto to pycryptodomex, since M2Crypto doesn't support python 3.x.
In addition, some errors in the generated source file keys-ssl.h are
fixed:
[Gustavo: don't call /utils/key2pub.py since that doesn't compute]
+Use pycryptodomex insdead of pycrypto
+
+From [1]:
+"PyCryptodome is a fork of PyCrypto, which is not maintained any more
+(the last release dates back to 2013 [2]). It exposes almost the same
+API, but there are a few incompatibilities [3]."
+
+[1] https://github.com/OP-TEE/optee_os/commit/90ad2450436fdd9fc0d28a3f92f3fbcfd89a38f0
+[2] https://pypi.org/project/pycrypto/#history
+[3] https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html
+
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
[Rebased against crda-4.14]
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
----
-Status: submitted upstream by author but not (yet) accepted
-URL: http://www.spinics.net/lists/linux-wireless/msg138936.html
+[Romain: Use pycryptodomex]
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
Makefile | 2 +-
utils/key2pub.py | 146 ++++++++++++++++++++++++-----------------------
$(LIBREG): regdb.h reglib.h reglib.c
$(NQ) ' CC ' $@
diff --git a/utils/key2pub.py b/utils/key2pub.py
-index 9bb04cd..9f92ebd 100755
+index 9bb04cd..8a0ba2a 100755
--- a/utils/key2pub.py
+++ b/utils/key2pub.py
@@ -1,126 +1,128 @@
- sys.stderr.write('Please install the "M2Crypto" Python module.\n')
- sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n')
- sys.exit(1)
-+ from Crypto.PublicKey import RSA
++ from Cryptodome.PublicKey import RSA
+except ImportError as e:
-+ sys.stderr.write('ERROR: Failed to import the "Crypto.PublicKey" module: %s\n' % e.message)
-+ sys.stderr.write('Please install the "Crypto.PublicKey" Python module.\n')
-+ sys.stderr.write('On Debian GNU/Linux the package is called "python-crypto".\n')
++ sys.stderr.write('ERROR: Failed to import the "Cryptodome.PublicKey" module: %s\n' % e.message)
++ sys.stderr.write('Please install the "Cryptodome.PublicKey" Python module.\n')
++ sys.stderr.write('On Debian GNU/Linux the package is called "python-cryptodomex".\n')
+ sys.exit(1)
+
+def bitwise_collect(value, radix_bits):
modes[mode][1](output, idx - 1)
--
-2.18.0
+2.25.3