[arch-commits] Commit in pycrypto/repos (6 files)
Levente Polyak
anthraxx at archlinux.org
Sun Jan 15 22:35:33 UTC 2017
Date: Sunday, January 15, 2017 @ 22:35:32
Author: anthraxx
Revision: 286651
archrelease: copy trunk to extra-i686, extra-x86_64
Added:
pycrypto/repos/extra-i686/CVE-2013-7459.patch
(from rev 286650, pycrypto/trunk/CVE-2013-7459.patch)
pycrypto/repos/extra-i686/PKGBUILD
(from rev 286650, pycrypto/trunk/PKGBUILD)
pycrypto/repos/extra-x86_64/CVE-2013-7459.patch
(from rev 286650, pycrypto/trunk/CVE-2013-7459.patch)
pycrypto/repos/extra-x86_64/PKGBUILD
(from rev 286650, pycrypto/trunk/PKGBUILD)
Deleted:
pycrypto/repos/extra-i686/PKGBUILD
pycrypto/repos/extra-x86_64/PKGBUILD
----------------------------------+
/PKGBUILD | 134 +++++++++++++++++++++++++++++++++++++
extra-i686/CVE-2013-7459.patch | 88 ++++++++++++++++++++++++
extra-i686/PKGBUILD | 64 -----------------
extra-x86_64/CVE-2013-7459.patch | 88 ++++++++++++++++++++++++
extra-x86_64/PKGBUILD | 64 -----------------
5 files changed, 310 insertions(+), 128 deletions(-)
Copied: pycrypto/repos/extra-i686/CVE-2013-7459.patch (from rev 286650, pycrypto/trunk/CVE-2013-7459.patch)
===================================================================
--- extra-i686/CVE-2013-7459.patch (rev 0)
+++ extra-i686/CVE-2013-7459.patch 2017-01-15 22:35:32 UTC (rev 286651)
@@ -0,0 +1,88 @@
+From 8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4 Mon Sep 17 00:00:00 2001
+From: Legrandin <helderijs at gmail.com>
+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(-)
+
+diff --git a/lib/Crypto/SelfTest/Cipher/common.py b/lib/Crypto/SelfTest/Cipher/common.py
+index 420b6ff..a5f8a88 100644
+--- a/lib/Crypto/SelfTest/Cipher/common.py
++++ b/lib/Crypto/SelfTest/Cipher/common.py
+@@ -239,19 +239,34 @@ def shortDescription(self):
+ 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)
+diff --git a/src/block_template.c b/src/block_template.c
+index f940e0e..d555ceb 100644
+--- a/src/block_template.c
++++ b/src/block_template.c
+@@ -170,6 +170,17 @@ ALGnew(PyObject *self, PyObject *args, PyObject *kwdict)
+ "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,
Deleted: extra-i686/PKGBUILD
===================================================================
--- extra-i686/PKGBUILD 2017-01-15 22:35:15 UTC (rev 286650)
+++ extra-i686/PKGBUILD 2017-01-15 22:35:32 UTC (rev 286651)
@@ -1,64 +0,0 @@
-# $Id$
-# Maintainer: Jan de Groot <jgc at archlinux.org>
-# Contributor: Kritoke <kritoke at gamebox.net>
-
-pkgbase=pycrypto
-pkgname=('python2-crypto' 'python-crypto')
-pkgver=2.6.1
-pkgrel=4
-arch=('i686' 'x86_64')
-makedepends=('python2' 'python' 'gmp')
-url="http://www.dlitz.net/software/pycrypto/"
-license=('custom')
-source=(http://ftp.dlitz.net/pub/dlitz/crypto/${pkgbase}/${pkgbase}-${pkgver}.tar.gz{,.asc})
-sha256sums=('f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c'
- 'c2ab0516cc55321e6543ae75e2aa6f6e56e97432870f32a7799f3b89f467dc1b')
-validpgpkeys=('19E11FE8B3CFF273ED174A24928CEC1339C25CF7') # Dwayne Litzenberger
-
-prepare() {
- find ${pkgbase}-${pkgver}/LEGAL -type f -exec chmod 644 {} \;
- find ${pkgbase}-${pkgver}/LEGAL -type d -exec chmod 755 {} \;
-
- cp -r ${pkgbase}-${pkgver} ${pkgbase}-${pkgver}-py3
-}
-
-build() {
- cd ${pkgbase}-${pkgver}
- python2 setup.py build
-
- cd ../${pkgbase}-${pkgver}-py3
- python setup.py build
-}
-
-package_python2-crypto() {
- pkgdesc="Collection of cryptographic algorithms and protocols, implemented for use from Python 2."
- depends=('python2' 'gmp')
- replaces=('pycrypto')
- conflicts=('pycrypto')
- provides=("pycrypto=${pkgver}")
-
- cd ${pkgbase}-${pkgver}
- python2 setup.py install --root="${pkgdir}" --optimize=1
- install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
- install -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/"
- cp -r LEGAL "${pkgdir}/usr/share/licenses/${pkgname}/"
-}
-
-package_python-crypto() {
- pkgdesc="Collection of cryptographic algorithms and protocols, implemented for use from Python 3."
- depends=('python' 'gmp')
-
- cd ${pkgbase}-${pkgver}-py3
- python setup.py install --root="${pkgdir}" --optimize=1
- install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
- install -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/"
- cp -r LEGAL "${pkgdir}/usr/share/licenses/${pkgname}/"
-}
-
-check() {
- cd ${pkgbase}-${pkgver}
- python2 setup.py test
-
- cd ../${pkgbase}-${pkgver}-py3
- python setup.py test
-}
Copied: pycrypto/repos/extra-i686/PKGBUILD (from rev 286650, pycrypto/trunk/PKGBUILD)
===================================================================
--- extra-i686/PKGBUILD (rev 0)
+++ extra-i686/PKGBUILD 2017-01-15 22:35:32 UTC (rev 286651)
@@ -0,0 +1,67 @@
+# $Id$
+# Maintainer: Jan de Groot <jgc at archlinux.org>
+# Contributor: Kritoke <kritoke at gamebox.net>
+
+pkgbase=pycrypto
+pkgname=('python2-crypto' 'python-crypto')
+pkgver=2.6.1
+pkgrel=5
+arch=('i686' 'x86_64')
+makedepends=('python2' 'python' 'gmp')
+url="http://www.dlitz.net/software/pycrypto/"
+license=('custom')
+source=(http://ftp.dlitz.net/pub/dlitz/crypto/${pkgbase}/${pkgbase}-${pkgver}.tar.gz{,.asc}
+ CVE-2013-7459.patch)
+sha256sums=('f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c'
+ 'SKIP'
+ '71310698e88a7b960467ec2107e0aaed1cb106d0d7b8b4f381ee9cdf4d9a7c7a')
+validpgpkeys=('19E11FE8B3CFF273ED174A24928CEC1339C25CF7') # Dwayne Litzenberger
+
+prepare() {
+ find ${pkgbase}-${pkgver}/LEGAL -type f -exec chmod 644 {} \;
+ find ${pkgbase}-${pkgver}/LEGAL -type d -exec chmod 755 {} \;
+
+ patch -d ${pkgbase}-${pkgver} -p1 < "${srcdir}/CVE-2013-7459.patch"
+ cp -r ${pkgbase}-${pkgver} ${pkgbase}-${pkgver}-py3
+}
+
+build() {
+ cd ${pkgbase}-${pkgver}
+ python2 setup.py build
+
+ cd ../${pkgbase}-${pkgver}-py3
+ python setup.py build
+}
+
+package_python2-crypto() {
+ pkgdesc="Collection of cryptographic algorithms and protocols, implemented for use from Python 2."
+ depends=('python2' 'gmp')
+ replaces=('pycrypto')
+ conflicts=('pycrypto')
+ provides=("pycrypto=${pkgver}")
+
+ cd ${pkgbase}-${pkgver}
+ python2 setup.py install --root="${pkgdir}" --optimize=1
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/"
+ cp -r LEGAL "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
+
+package_python-crypto() {
+ pkgdesc="Collection of cryptographic algorithms and protocols, implemented for use from Python 3."
+ depends=('python' 'gmp')
+
+ cd ${pkgbase}-${pkgver}-py3
+ python setup.py install --root="${pkgdir}" --optimize=1
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/"
+ cp -r LEGAL "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
+
+check() {
+ cd ${pkgbase}-${pkgver}
+ python2 setup.py test
+
+ cd ../${pkgbase}-${pkgver}-py3
+ python setup.py test
+}
Copied: pycrypto/repos/extra-x86_64/CVE-2013-7459.patch (from rev 286650, pycrypto/trunk/CVE-2013-7459.patch)
===================================================================
--- extra-x86_64/CVE-2013-7459.patch (rev 0)
+++ extra-x86_64/CVE-2013-7459.patch 2017-01-15 22:35:32 UTC (rev 286651)
@@ -0,0 +1,88 @@
+From 8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4 Mon Sep 17 00:00:00 2001
+From: Legrandin <helderijs at gmail.com>
+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(-)
+
+diff --git a/lib/Crypto/SelfTest/Cipher/common.py b/lib/Crypto/SelfTest/Cipher/common.py
+index 420b6ff..a5f8a88 100644
+--- a/lib/Crypto/SelfTest/Cipher/common.py
++++ b/lib/Crypto/SelfTest/Cipher/common.py
+@@ -239,19 +239,34 @@ def shortDescription(self):
+ 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)
+diff --git a/src/block_template.c b/src/block_template.c
+index f940e0e..d555ceb 100644
+--- a/src/block_template.c
++++ b/src/block_template.c
+@@ -170,6 +170,17 @@ ALGnew(PyObject *self, PyObject *args, PyObject *kwdict)
+ "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,
Deleted: extra-x86_64/PKGBUILD
===================================================================
--- extra-x86_64/PKGBUILD 2017-01-15 22:35:15 UTC (rev 286650)
+++ extra-x86_64/PKGBUILD 2017-01-15 22:35:32 UTC (rev 286651)
@@ -1,64 +0,0 @@
-# $Id$
-# Maintainer: Jan de Groot <jgc at archlinux.org>
-# Contributor: Kritoke <kritoke at gamebox.net>
-
-pkgbase=pycrypto
-pkgname=('python2-crypto' 'python-crypto')
-pkgver=2.6.1
-pkgrel=4
-arch=('i686' 'x86_64')
-makedepends=('python2' 'python' 'gmp')
-url="http://www.dlitz.net/software/pycrypto/"
-license=('custom')
-source=(http://ftp.dlitz.net/pub/dlitz/crypto/${pkgbase}/${pkgbase}-${pkgver}.tar.gz{,.asc})
-sha256sums=('f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c'
- 'c2ab0516cc55321e6543ae75e2aa6f6e56e97432870f32a7799f3b89f467dc1b')
-validpgpkeys=('19E11FE8B3CFF273ED174A24928CEC1339C25CF7') # Dwayne Litzenberger
-
-prepare() {
- find ${pkgbase}-${pkgver}/LEGAL -type f -exec chmod 644 {} \;
- find ${pkgbase}-${pkgver}/LEGAL -type d -exec chmod 755 {} \;
-
- cp -r ${pkgbase}-${pkgver} ${pkgbase}-${pkgver}-py3
-}
-
-build() {
- cd ${pkgbase}-${pkgver}
- python2 setup.py build
-
- cd ../${pkgbase}-${pkgver}-py3
- python setup.py build
-}
-
-package_python2-crypto() {
- pkgdesc="Collection of cryptographic algorithms and protocols, implemented for use from Python 2."
- depends=('python2' 'gmp')
- replaces=('pycrypto')
- conflicts=('pycrypto')
- provides=("pycrypto=${pkgver}")
-
- cd ${pkgbase}-${pkgver}
- python2 setup.py install --root="${pkgdir}" --optimize=1
- install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
- install -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/"
- cp -r LEGAL "${pkgdir}/usr/share/licenses/${pkgname}/"
-}
-
-package_python-crypto() {
- pkgdesc="Collection of cryptographic algorithms and protocols, implemented for use from Python 3."
- depends=('python' 'gmp')
-
- cd ${pkgbase}-${pkgver}-py3
- python setup.py install --root="${pkgdir}" --optimize=1
- install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
- install -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/"
- cp -r LEGAL "${pkgdir}/usr/share/licenses/${pkgname}/"
-}
-
-check() {
- cd ${pkgbase}-${pkgver}
- python2 setup.py test
-
- cd ../${pkgbase}-${pkgver}-py3
- python setup.py test
-}
Copied: pycrypto/repos/extra-x86_64/PKGBUILD (from rev 286650, pycrypto/trunk/PKGBUILD)
===================================================================
--- extra-x86_64/PKGBUILD (rev 0)
+++ extra-x86_64/PKGBUILD 2017-01-15 22:35:32 UTC (rev 286651)
@@ -0,0 +1,67 @@
+# $Id$
+# Maintainer: Jan de Groot <jgc at archlinux.org>
+# Contributor: Kritoke <kritoke at gamebox.net>
+
+pkgbase=pycrypto
+pkgname=('python2-crypto' 'python-crypto')
+pkgver=2.6.1
+pkgrel=5
+arch=('i686' 'x86_64')
+makedepends=('python2' 'python' 'gmp')
+url="http://www.dlitz.net/software/pycrypto/"
+license=('custom')
+source=(http://ftp.dlitz.net/pub/dlitz/crypto/${pkgbase}/${pkgbase}-${pkgver}.tar.gz{,.asc}
+ CVE-2013-7459.patch)
+sha256sums=('f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c'
+ 'SKIP'
+ '71310698e88a7b960467ec2107e0aaed1cb106d0d7b8b4f381ee9cdf4d9a7c7a')
+validpgpkeys=('19E11FE8B3CFF273ED174A24928CEC1339C25CF7') # Dwayne Litzenberger
+
+prepare() {
+ find ${pkgbase}-${pkgver}/LEGAL -type f -exec chmod 644 {} \;
+ find ${pkgbase}-${pkgver}/LEGAL -type d -exec chmod 755 {} \;
+
+ patch -d ${pkgbase}-${pkgver} -p1 < "${srcdir}/CVE-2013-7459.patch"
+ cp -r ${pkgbase}-${pkgver} ${pkgbase}-${pkgver}-py3
+}
+
+build() {
+ cd ${pkgbase}-${pkgver}
+ python2 setup.py build
+
+ cd ../${pkgbase}-${pkgver}-py3
+ python setup.py build
+}
+
+package_python2-crypto() {
+ pkgdesc="Collection of cryptographic algorithms and protocols, implemented for use from Python 2."
+ depends=('python2' 'gmp')
+ replaces=('pycrypto')
+ conflicts=('pycrypto')
+ provides=("pycrypto=${pkgver}")
+
+ cd ${pkgbase}-${pkgver}
+ python2 setup.py install --root="${pkgdir}" --optimize=1
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/"
+ cp -r LEGAL "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
+
+package_python-crypto() {
+ pkgdesc="Collection of cryptographic algorithms and protocols, implemented for use from Python 3."
+ depends=('python' 'gmp')
+
+ cd ${pkgbase}-${pkgver}-py3
+ python setup.py install --root="${pkgdir}" --optimize=1
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/"
+ cp -r LEGAL "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
+
+check() {
+ cd ${pkgbase}-${pkgver}
+ python2 setup.py test
+
+ cd ../${pkgbase}-${pkgver}-py3
+ python setup.py test
+}
More information about the arch-commits
mailing list