rpms/python-crypto/devel python-crypto-hmac_md5.patch, NONE, 1.1 python-crypto-use_hashlib_when_possible.patch, NONE, 1.1 python-crypto.spec, 1.28, 1.29 pycrypto-2.0.1-hashlib.patch, 1.2, NONE
Stewart Adam
firewing at fedoraproject.org
Mon Feb 16 14:06:38 UTC 2009
Author: firewing
Update of /cvs/extras/rpms/python-crypto/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv30782
Modified Files:
python-crypto.spec
Added Files:
python-crypto-hmac_md5.patch
python-crypto-use_hashlib_when_possible.patch
Removed Files:
pycrypto-2.0.1-hashlib.patch
Log Message:
* Fri Feb 13 2009 Stewart Adam <s.adam at diffingo.com> - 2.0.1-16.1
- Use patches in upstream git to fix #484473
python-crypto-hmac_md5.patch:
--- NEW FILE python-crypto-hmac_md5.patch ---
--- pycrypto-2.0.1.orig/Hash/HMAC.py 2002-07-25 13:19:02.000000000 -0400
+++ pycrypto-2.0.1/Hash/HMAC.py 2009-02-13 14:11:10.000000000 -0500
@@ -33,8 +33,8 @@
digestmod: A module supporting PEP 247. Defaults to the md5 module.
"""
if digestmod == None:
- import md5
- digestmod = md5
+ import MD5
+ digestmod = MD5
self.digestmod = digestmod
self.outer = digestmod.new()
python-crypto-use_hashlib_when_possible.patch:
--- NEW FILE python-crypto-use_hashlib_when_possible.patch ---
--- pycrypto-2.0.1.orig/Hash/MD5.py 2002-07-11 10:31:19.000000000 -0400
+++ pycrypto-2.0.1/Hash/MD5.py 2009-02-13 14:07:52.000000000 -0500
@@ -3,11 +3,21 @@
__revision__ = "$Id: MD5.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $"
-from md5 import *
+__all__ = ['new', 'digest_size']
-import md5
-if hasattr(md5, 'digestsize'):
- digest_size = digestsize
- del digestsize
-del md5
+try:
+ # The md5 module is deprecated in Python 2.6, so use hashlib when possible.
+ import hashlib
+ def new(data=""):
+ return hashlib.md5(data)
+ digest_size = new().digest_size
+
+except ImportError:
+ from md5 import *
+
+ import md5
+ if hasattr(md5, 'digestsize'):
+ digest_size = digestsize
+ del digestsize
+ del md5
--- pycrypto-2.0.1.orig/Hash/SHA.py 2002-07-11 10:31:19.000000000 -0400
+++ pycrypto-2.0.1/Hash/SHA.py 2009-02-13 14:13:09.000000000 -0500
@@ -3,9 +3,19 @@
__revision__ = "$Id: SHA.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $"
-from sha import *
-import sha
-if hasattr(sha, 'digestsize'):
- digest_size = digestsize
- del digestsize
-del sha
+__all__ = ['new', 'digest_size']
+
+try:
+ # The md5 module is deprecated in Python 2.6, so use hashlib when possible.
+ import hashlib
+ def new(data=""):
+ return hashlib.sha1(data)
+ digest_size = new().digest_size
+
+except ImportError:
+ from sha import *
+ import sha
+ if hasattr(sha, 'digestsize'):
+ digest_size = digestsize
+ del digestsize
+ del sha
Index: python-crypto.spec
===================================================================
RCS file: /cvs/extras/rpms/python-crypto/devel/python-crypto.spec,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- python-crypto.spec 13 Feb 2009 16:35:30 -0000 1.28
+++ python-crypto.spec 16 Feb 2009 14:06:07 -0000 1.29
@@ -1,4 +1,5 @@
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from
+distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
Summary: Cryptography library for Python
@@ -13,10 +14,12 @@
# patch taken from
# http://gitweb2.dlitz.net/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d1c4875e1f220652fe7ff8358f56dee3b2aba31b
Patch0: %{name}-fix_buffer_overflow.patch
-# similar patches upstream already
-# http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d2311689910240e425741a546576129f4c9735e2
+# Python 2.6 compatibility: Use Hash.MD5 instead of Python "md5" module in the HMAC...
# http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=84b793416b52311643bfd456a4544444afbfb5da
-Patch1: pycrypto-2.0.1-hashlib.patch
+Patch1: python-crypto-hmac_md5.patch
+# Python 2.6 compatibility: When possible, use hashlib instead of the deprecated 'md5...
+# http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d2311689910240e425741a546576129f4c9735e2
+Patch2: python-crypto-use_hashlib_when_possible.patch
Provides: pycrypto = %{version}-%{release}
BuildRequires: python >= 2.2
@@ -26,15 +29,15 @@
%description
Python-crypto is a collection of both secure hash functions (such as MD5 and
-SHA), and various encryption algorithms (AES, DES, IDEA, RSA, ElGamal,
-etc.).
+SHA), and various encryption algorithms (AES, DES, IDEA, RSA, ElGamal, etc.).
%prep
%setup -n pycrypto-%{version} -q
sed -i s:/lib:/%_lib:g setup.py
%patch0 -b .patch0 -p1
-%patch1 -b .hashlib
+%patch1 -b .patch1 -p1
+%patch2 -b .patch2 -p1
%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
@@ -72,6 +75,9 @@
%changelog
+* Fri Feb 13 2009 Stewart Adam <s.adam at diffingo.com> - 2.0.1-16.1
+- Use patches in upstream git to fix #484473
+
* Fri Feb 13 2009 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 2.0.1-16
- add patch to fix #485298 / CVE-2009-0544
--- pycrypto-2.0.1-hashlib.patch DELETED ---
More information about the scm-commits
mailing list