Browse Source

python-crypto-2.6.1-2

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@12102 ec354946-7b23-47d6-9f5a-488ba84defc7
tomop 4 years ago
parent
commit
dd8cf94008
1 changed files with 77 additions and 12 deletions
  1. 77 12
      p/python-crypto/python-crypto-vl.spec

+ 77 - 12
p/python-crypto/python-crypto-vl.spec

@@ -5,45 +5,96 @@ Summary:	Cryptography library for Python
 Summary(ja):	Python 用 Cryptography ライブラリ
 Name:		python-crypto
 Version:	2.6.1
-Release:	1%{?_dist_release}
-License:	Python License (CNRI Python License)
+Release:	2%{?_dist_release}
+License:	Public Domain and Python
 Group:		Development/Libraries
 URL:		http://www.dlitz.net/software/pycrypto/
 Source:		http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-%{version}.tar.gz
 
-Patch0:         dont-drop-g.patch
-Patch1:         fix-epydoc-ignore.patch
-Patch2:         fix-unresolved-reference-size.patch
+Patch0:         python-crypto-2.4-optflags.patch
+Patch1:         python-crypto-2.4-fix-pubkey-size-divisions.patch
+Patch2:         pycrypto-2.6.1-CVE-2013-7459.patch
+Patch4:         python-crypto-2.6.1-link.patch
+Patch5:         pycrypto-2.6.1-CVE-2018-6594.patch
 
 BuildRequires:	python >= 2.2
 BuildRequires:	python-devel >= 2.2
+BuildRequires:	python-rpm-macros
+BuildRequires:	python3
+BuildRequires:	python3-devel
+BuildRequires:	python3-rpm-macros
+BuildRequires:	libxcrypt-devel
 BuildRequires:	gmp-devel >= 5
 BuildRoot:	%{_tmppath}/%{name}-%{version}-root
 
+Vendor: Project Vine
+Distribution: Vine Linux
+
 %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.).
 
+
+%package -n python3-crypto
+Summary:        Cryptography library for Python 3
+%{?python_provide:%python_provide python3-crypto}
+
+%description -n python3-crypto
+PyCrypto is a collection of both secure hash functions (such as MD5 and
+SHA), and various encryption algorithms (AES, DES, RSA, ElGamal, etc.).
+
+This is the Python 3 build of the package.
+
 %prep
 %setup -n pycrypto-%{version} -q
+
+# Use distribution compiler flags rather than upstream's
 %patch0 -p1
+
+# Fix divisions within benchmarking suite:
 %patch1 -p1
+
+# AES.new with invalid parameter crashes python
+# https://github.com/dlitz/pycrypto/issues/176
+# CVE-2013-7459
 %patch2 -p1
 
+# log() not available in libgmp, need libm too
+%patch4
+
+# When creating ElGamal keys, the generator wasn't a square residue: ElGamal
+# encryption done with those keys cannot be secure under the DDH assumption
+# https://bugzilla.redhat.com/show_bug.cgi?id=1542313 (CVE-2018-6594)
+# https://github.com/TElgamal/attack-on-pycrypto-elgamal
+# https://github.com/Legrandin/pycryptodome/issues/90
+# https://github.com/dlitz/pycrypto/issues/253
+# Patch based on this commit from cryptodome:
+# https://github.com/Legrandin/pycryptodome/commit/99c27a3b
+# Converted to pull request for pycrypto:
+# https://github.com/dlitz/pycrypto/pull/256
+%patch5
+
 # Remove spurious shellbangs
 %{__sed} -i -e '\|^#!/usr/local/bin/python| d' lib/Crypto/Util/RFC1751.py
 
 %build
-CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+%global optflags %{optflags} -fno-strict-aliasing
+%py_build
+%py3_build
 
 %install
 %{__rm} -rf %{buildroot}
-%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+%py_install
+%py3_install
 
 # Remove group write permissions on shared objects
-/usr/bin/find %{buildroot}%{python_sitearch} -name '*.so' \
-	-exec %{__chmod} g-w {} \;
+find %{buildroot}%{python_sitearch} -name '*.so' -exec chmod -c g-w {} \;
+find %{buildroot}%{python3_sitearch} -name '*.so' -exec chmod -c g-w {} \;
+
+%check
+%{__python} setup.py test
+%{__python3} setup.py test
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -51,11 +102,25 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(-,root,root,-)
-%doc README TODO ACKS ChangeLog LEGAL/ COPYRIGHT Doc/
-#%{python_sitearch}/pycrypto-2.2-py2.6.egg-info
-%{python_sitearch}/
+%license COPYRIGHT LEGAL/
+%doc README TODO ACKS ChangeLog Doc/
+%{python_sitearch}/Crypto/
+%{python_sitearch}/pycrypto-%{version}-py2.*.egg-info
+
+%files -n python3-crypto
+%defattr(-,root,root,-)
+%license COPYRIGHT LEGAL/
+%doc README TODO ACKS ChangeLog Doc/
+%{python3_sitearch}/Crypto/
+%{python3_sitearch}/pycrypto-%{version}-py3.*.egg-info
 
 %changelog
+* Tue May 14 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.6.1-2
+- dropped all patches.
+- import patched from rawhide.
+- added BR:libxcrypt-devel.
+- added python3 support.
+
 * Sun Dec 15 2013 NAKAMURA Kenta <kenta@vinelinux.org> 2.6.1-1
 - new upstream release
 - drop Patch3: doc.patch