From eecc8272e7bdcff09527a775459f267501ba5a89 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Wed, 6 Jun 2018 12:56:56 +0200 Subject: [PATCH] python-crypto: remove, unmaintained upstream See https://blog.sqreen.io/stop-using-pycrypto-use-pycryptodome/. --- .../python-crypto/patches/CVE-2013-7459.patch | 84 ------------------- srcpkgs/python-crypto/template | 34 -------- srcpkgs/python-crypto/update | 2 - srcpkgs/python3-crypto | 1 - 4 files changed, 121 deletions(-) delete mode 100644 srcpkgs/python-crypto/patches/CVE-2013-7459.patch delete mode 100644 srcpkgs/python-crypto/template delete mode 100644 srcpkgs/python-crypto/update delete mode 120000 srcpkgs/python3-crypto diff --git a/srcpkgs/python-crypto/patches/CVE-2013-7459.patch b/srcpkgs/python-crypto/patches/CVE-2013-7459.patch deleted file mode 100644 index 5cd7520b38d..00000000000 --- a/srcpkgs/python-crypto/patches/CVE-2013-7459.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4 Mon Sep 17 00:00:00 2001 -From: Legrandin -Date: Sun, 22 Dec 2013 22:24:46 +0100 -Subject: [PATCH] Throw exception when IV is used with ECB or CTR - -The IV parameter is currently ignored when initializing -a cipher in ECB or CTR mode. - -For CTR mode, it is confusing: it takes some time to see -that a different parameter is needed (the counter). - -For ECB mode, it is outright dangerous. - -This patch forces an exception to be raised. ---- - lib/Crypto/SelfTest/Cipher/common.py | 31 +++++++++++++++++++++++-------- - src/block_template.c | 11 +++++++++++ - 2 files changed, 34 insertions(+), 8 deletions(-) - ---- lib/Crypto/SelfTest/Cipher/common.py.orig -+++ lib/Crypto/SelfTest/Cipher/common.py -@@ -239,19 +239,34 @@ class RoundtripTest(unittest.TestCase): - return """%s .decrypt() output of .encrypt() should not be garbled""" % (self.module_name,) - - def runTest(self): -- for mode in (self.module.MODE_ECB, self.module.MODE_CBC, self.module.MODE_CFB, self.module.MODE_OFB, self.module.MODE_OPENPGP): -+ -+ ## ECB mode -+ mode = self.module.MODE_ECB -+ encryption_cipher = self.module.new(a2b_hex(self.key), mode) -+ ciphertext = encryption_cipher.encrypt(self.plaintext) -+ decryption_cipher = self.module.new(a2b_hex(self.key), mode) -+ decrypted_plaintext = decryption_cipher.decrypt(ciphertext) -+ self.assertEqual(self.plaintext, decrypted_plaintext) -+ -+ ## OPENPGP mode -+ mode = self.module.MODE_OPENPGP -+ encryption_cipher = self.module.new(a2b_hex(self.key), mode, self.iv) -+ eiv_ciphertext = encryption_cipher.encrypt(self.plaintext) -+ eiv = eiv_ciphertext[:self.module.block_size+2] -+ ciphertext = eiv_ciphertext[self.module.block_size+2:] -+ decryption_cipher = self.module.new(a2b_hex(self.key), mode, eiv) -+ decrypted_plaintext = decryption_cipher.decrypt(ciphertext) -+ self.assertEqual(self.plaintext, decrypted_plaintext) -+ -+ ## All other non-AEAD modes (but CTR) -+ for mode in (self.module.MODE_CBC, self.module.MODE_CFB, self.module.MODE_OFB): - encryption_cipher = self.module.new(a2b_hex(self.key), mode, self.iv) - ciphertext = encryption_cipher.encrypt(self.plaintext) -- -- if mode != self.module.MODE_OPENPGP: -- decryption_cipher = self.module.new(a2b_hex(self.key), mode, self.iv) -- else: -- eiv = ciphertext[:self.module.block_size+2] -- ciphertext = ciphertext[self.module.block_size+2:] -- decryption_cipher = self.module.new(a2b_hex(self.key), mode, eiv) -+ decryption_cipher = self.module.new(a2b_hex(self.key), mode, self.iv) - decrypted_plaintext = decryption_cipher.decrypt(ciphertext) - self.assertEqual(self.plaintext, decrypted_plaintext) - -+ - class PGPTest(unittest.TestCase): - def __init__(self, module, params): - unittest.TestCase.__init__(self) ---- src/block_template.c.orig -+++ src/block_template.c -@@ -170,6 +170,17 @@ ALGnew(PyObject *self, PyObject *args, P - "Key cannot be the null string"); - return NULL; - } -+ if (IVlen != 0 && mode == MODE_ECB) -+ { -+ PyErr_Format(PyExc_ValueError, "ECB mode does not use IV"); -+ return NULL; -+ } -+ if (IVlen != 0 && mode == MODE_CTR) -+ { -+ PyErr_Format(PyExc_ValueError, -+ "CTR mode needs counter parameter, not IV"); -+ return NULL; -+ } - if (IVlen != BLOCK_SIZE && mode != MODE_ECB && mode != MODE_CTR) - { - PyErr_Format(PyExc_ValueError, diff --git a/srcpkgs/python-crypto/template b/srcpkgs/python-crypto/template deleted file mode 100644 index b1af3b54dbd..00000000000 --- a/srcpkgs/python-crypto/template +++ /dev/null @@ -1,34 +0,0 @@ -# Template file for 'python-crypto' -pkgname=python-crypto -version=2.6.1 -revision=9 -wrksrc="pycrypto-${version}" -build_style=python-module -hostmakedepends="python-devel python3-devel" -makedepends="${hostmakedepends} gmp-devel" -depends="python" -pycompile_module="Crypto" -short_desc="The Python Cryptography Toolkit (Python2)" -maintainer="Juan RP " -homepage="https://www.dlitz.net/software/pycrypto/" -license="PSF, Public domain" -distfiles="https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-$version.tar.gz" -checksum=f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c - -pre_build() { - if [ "$CROSS_BUILD" ]; then - sed -e "s|'/usr/include/'|''|g" -i setup.py - CC= CFLAGS= ./configure ${configure_args} --host=${XBPS_CROSS_TRIPLET} - else - CC="$CC" CFLAGS="$CFLAGS" ./configure ${configure_args} - fi -} - -python3-crypto_package() { - depends="python3" - pycompile_module="Crypto" - short_desc="${short_desc/Python2/Python3}" - pkg_install() { - vmove usr/lib/python3* - } -} diff --git a/srcpkgs/python-crypto/update b/srcpkgs/python-crypto/update deleted file mode 100644 index 5c13dd3231b..00000000000 --- a/srcpkgs/python-crypto/update +++ /dev/null @@ -1,2 +0,0 @@ -pkgname=pycrypto -ignore="*a* *b*" diff --git a/srcpkgs/python3-crypto b/srcpkgs/python3-crypto deleted file mode 120000 index 2c5f4e916f4..00000000000 --- a/srcpkgs/python3-crypto +++ /dev/null @@ -1 +0,0 @@ -python-crypto \ No newline at end of file