commit 63c98a5352a57fb5300ffc8fc2a2daf906d4951d Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:14:49 2019 -0400 Package init diff --git a/0001-Fixed-4380-do-not-assume-TLSv1-is-available-in-OpenS.patch b/0001-Fixed-4380-do-not-assume-TLSv1-is-available-in-OpenS.patch new file mode 100644 index 0000000..288d3fb --- /dev/null +++ b/0001-Fixed-4380-do-not-assume-TLSv1-is-available-in-OpenS.patch @@ -0,0 +1,66 @@ +From 2716cd2fa55cc867656a3e797797f5a1386afd69 Mon Sep 17 00:00:00 2001 +From: Alex Gaynor +Date: Sun, 12 Aug 2018 15:48:24 -0400 +Subject: [PATCH] Fixed #4380 -- do not assume TLSv1 is available in OpenSSL + (#4389) + +* Fixed #4380 -- do not assume TLSv1 is available in OpenSSL + +Hallelujah! It's starting to become the case that some OpenSSLs are disabling it. + +* cover this file as well +--- + tests/hazmat/backends/test_openssl.py | 2 +- + tests/hazmat/bindings/test_openssl.py | 9 ++++++--- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py +index 31b34cd0..e77f5dc3 100644 +--- a/tests/hazmat/backends/test_openssl.py ++++ b/tests/hazmat/backends/test_openssl.py +@@ -115,7 +115,7 @@ class TestOpenSSL(object): + assert len(errors) == 10 + + def test_ssl_ciphers_registered(self): +- meth = backend._lib.TLSv1_method() ++ meth = backend._lib.SSLv23_method() + ctx = backend._lib.SSL_CTX_new(meth) + assert ctx != backend._ffi.NULL + backend._lib.SSL_CTX_free(ctx) +diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py +index 488f64e1..f317f07f 100644 +--- a/tests/hazmat/bindings/test_openssl.py ++++ b/tests/hazmat/bindings/test_openssl.py +@@ -37,7 +37,8 @@ class TestOpenSSL(object): + # Test that we're properly handling 32-bit unsigned on all platforms. + b = Binding() + assert b.lib.SSL_OP_ALL > 0 +- ctx = b.lib.SSL_CTX_new(b.lib.TLSv1_method()) ++ ctx = b.lib.SSL_CTX_new(b.lib.SSLv23_method()) ++ assert ctx != b.ffi.NULL + ctx = b.ffi.gc(ctx, b.lib.SSL_CTX_free) + current_options = b.lib.SSL_CTX_get_options(ctx) + resp = b.lib.SSL_CTX_set_options(ctx, b.lib.SSL_OP_ALL) +@@ -49,7 +50,8 @@ class TestOpenSSL(object): + # Test that we're properly handling 32-bit unsigned on all platforms. + b = Binding() + assert b.lib.SSL_OP_ALL > 0 +- ctx = b.lib.SSL_CTX_new(b.lib.TLSv1_method()) ++ ctx = b.lib.SSL_CTX_new(b.lib.SSLv23_method()) ++ assert ctx != b.ffi.NULL + ctx = b.ffi.gc(ctx, b.lib.SSL_CTX_free) + ssl = b.lib.SSL_new(ctx) + ssl = b.ffi.gc(ssl, b.lib.SSL_free) +@@ -63,7 +65,8 @@ class TestOpenSSL(object): + # Test that we're properly handling 32-bit unsigned on all platforms. + b = Binding() + assert b.lib.SSL_OP_ALL > 0 +- ctx = b.lib.SSL_CTX_new(b.lib.TLSv1_method()) ++ ctx = b.lib.SSL_CTX_new(b.lib.SSLv23_method()) ++ assert ctx != b.ffi.NULL + ctx = b.ffi.gc(ctx, b.lib.SSL_CTX_free) + ssl = b.lib.SSL_new(ctx) + ssl = b.ffi.gc(ssl, b.lib.SSL_free) +-- +2.17.1 + diff --git a/cryptography-2.3.tar.gz b/cryptography-2.3.tar.gz new file mode 100644 index 0000000..9c15572 Binary files /dev/null and b/cryptography-2.3.tar.gz differ diff --git a/python-cryptography.spec b/python-cryptography.spec new file mode 100644 index 0000000..f82fcb5 --- /dev/null +++ b/python-cryptography.spec @@ -0,0 +1,95 @@ +Name: python-cryptography +Version: 2.3 +Release: 3 +Summary: a package designed to expose cryptographic primitives and recipes to Python developers. +License: ASL 2.0 or BSD +URL: https://cryptography.io +Source0: https://pypi.io/packages/source/c/cryptography/cryptography-2.3.tar.gz +Patch0001: 0001-Fixed-4380-do-not-assume-TLSv1-is-available-in-OpenS.patch + +BuildRequires: openssl-devel gcc python2-devel python2-pytest >= 3.2.1 +BuildRequires: python2-setuptools python2-pretend python2-iso8601 +BuildRequires: python2-cryptography-vectors = %{version} python2-pytz +BuildRequires: python2-asn1crypto >= 0.21 python2-hypothesis >= 1.11.4 +BuildRequires: python2-idna >= 2.1 python2-six >= 1.4.1 python2-cffi >= 1.7 +BuildRequires: python2-enum34 python2-ipaddress python3-iso8601 +BuildRequires: python3-devel python3-setuptools python3-pretend +BuildRequires: python3-pytest >= 3.2.1 python3-pytz python3-idna >= 2.1 +BuildRequires: python3-cryptography-vectors = %{version} python3-six >= 1.4.1 +BuildRequires: python3-asn1crypto >= 0.21 python3-hypothesis >= 1.11.4 +BuildRequires: python3-cffi >= 1.7 + +%description +cryptography is a package which provides cryptographic recipes and primitives +to Python developers. Our goal is for it to be your "cryptographic standard +library". It supports Python 2.7, Python 3.4+, and PyPy 5.4+. + +%package -n python2-cryptography +Summary: a package designed to expose cryptographic primitives and recipes to Python2 developers. +%{?python_provide:%python_provide python2-cryptography} +Requires: openssl python2-idna >= 2.1 python2-asn1crypto >= 0.21 +Requires: python2-six >= 1.4.1 python2-cffi >= 1.7 python2-enum34 python2-ipaddress + +%description -n python2-cryptography +cryptography is a package which provides cryptographic recipes and primitives +to Python developers. Our goal is for it to be your "cryptographic standard +library". It supports Python 2.7, Python 3.4+, and PyPy 5.4+. + +%package -n python3-cryptography +Summary: a package designed to expose cryptographic primitives and recipes to Python3 developers. +%{?python_provide:%python_provide python3-cryptography} +Requires: openssl python3-idna >= 2.1 python3-asn1crypto >= 0.21 +Requires: python3-six >= 1.4.1 python3-cffi >= 1.7 + +%description -n python3-cryptography +cryptography is a package which provides cryptographic recipes and primitives +to Python developers. Our goal is for it to be your "cryptographic standard +library". It supports Python 2.7, Python 3.4+, and PyPy 5.4+. + +%package_help + +%prep +%autosetup -n cryptography-%{version} -p1 +rm -rf %{py3dir} +cp -a . %{py3dir} +find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|' + +%build +%py2_build +pushd %{py3dir} +%py3_build +popd + +%install +find . -name .keep -print -delete +%py2_install +pushd %{py3dir} +%py3_install +popd + +%check +rm -f tests/hazmat/primitives/test_padding.py +%{__python2} setup.py test +pushd %{py3dir} +rm -f tests/hazmat/primitives/test_padding.py +%{__python3} setup.py test +popd + +%files -n python2-cryptography +%doc README.rst +%license LICENSE LICENSE.APACHE LICENSE.BSD +%{python2_sitearch}/cryptography +%{python2_sitearch}/cryptography-%{version}-py*.egg-info + +%files -n python3-cryptography +%doc README.rst +%license LICENSE LICENSE.APACHE LICENSE.BSD +%{python3_sitearch}/* +%{python3_sitearch}/cryptography-%{version}-py*.egg-info + +%files help +%doc docs + +%changelog +* Sat Sep 14 2019 openEuler Buildteam - 2.7-1 +- Package init