Hello community, here is the log from the commit of package python3-pycrypto for openSUSE:Factory checked in at 2017-01-31 12:28:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-pycrypto (Old) and /work/SRC/openSUSE:Factory/.python3-pycrypto.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-pycrypto" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-pycrypto/python3-pycrypto.changes 2016-05-17 17:11:47.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python3-pycrypto.new/python3-pycrypto.changes 2017-02-03 18:59:13.722107429 +0100 @@ -1,0 +2,6 @@ +Wed Jan 4 16:52:24 UTC 2017 - vu...@suse.com + +- Add CVE-2013-7459.patch: python-pycrypto: Heap buffer overflow in + ALGnew (bsc#1017420). + +------------------------------------------------------------------- New: ---- CVE-2013-7459.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-pycrypto.spec ++++++ --- /var/tmp/diff_new_pack.1dA0LE/_old 2017-02-03 18:59:14.342020361 +0100 +++ /var/tmp/diff_new_pack.1dA0LE/_new 2017-02-03 18:59:14.346019800 +0100 @@ -1,7 +1,7 @@ # # spec file for package python3-pycrypto # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,6 +24,7 @@ License: Python-2.0 Group: Development/Languages/Python Source: https://files.pythonhosted.org/packages/source/p/pycrypto/pycrypto-%{version}.tar.gz +Patch0: CVE-2013-7459.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: gmp-devel BuildRequires: python3-devel @@ -44,6 +45,7 @@ %prep %setup -q -n pycrypto-%{version} +%patch0 -p1 %build CFLAGS="%{optflags}" python3 setup.py build ++++++ CVE-2013-7459.patch ++++++ >From 48ce477c3668ef3a688e0a89db7415bcc785803d Mon Sep 17 00:00:00 2001 From: Legrandin <helder...@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. (cherry picked from commit 8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4) Signed-off-by: Vincent Untz <vu...@suse.com> --- 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 8bebed9..91ec743 100644 --- a/lib/Crypto/SelfTest/Cipher/common.py +++ b/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) diff --git a/src/block_template.c b/src/block_template.c index c36b316..8746948 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, -- 2.11.0