37a582
%bcond_without tests
37a582
37a582
%{!?python3_pkgversion:%global python3_pkgversion 3}
37a582
37a582
%global srcname cryptography
37a582
%global pyo3_version 0.13.1
37a582
37a582
Name:           python-%{srcname}
2753bc
Version:        36.0.1
410144
Release:        2%{?dist}
37a582
Summary:        PyCA's cryptography library
37a582
37a582
License:        ASL 2.0 or BSD
37a582
URL:            https://cryptography.io/en/latest/
37a582
Source0:        https://github.com/pyca/cryptography/archive/%{version}/%{srcname}-%{version}.tar.gz
37a582
                # created by ./vendor_rust.py helper script
37a582
Source1:        cryptography-%{version}-vendor.tar.bz2
37a582
Source2:        conftest-skipper.py
37a582
2753bc
Patch1:		0001-Block-TripleDES-in-FIPS-mode-6879.patch
2753bc
Patch2:		0002-Disable-DSA-tests-in-FIPS-mode-6916.patch
2753bc
Patch3:		0003-fixes-6927-handle-negative-return-values-from-openss.patch
2753bc
Patch4:		0004-Disable-test_openssl_assert_error_on_stack-in-FIPS-m.patch
2753bc
Patch5:		0005-Fixed-serialization-of-keyusage-ext-with-no-bits-693.patch
37a582
37a582
ExclusiveArch:  %{rust_arches}
37a582
37a582
BuildRequires:  openssl-devel
37a582
BuildRequires:  gcc
37a582
BuildRequires:  gnupg2
37a582
%if 0%{?fedora}
37a582
BuildRequires:  rust-packaging
37a582
%else
37a582
BuildRequires:  rust-toolset
37a582
%endif
37a582
37a582
BuildRequires:  python%{python3_pkgversion}-cffi >= 1.7
37a582
BuildRequires:  python%{python3_pkgversion}-devel
37a582
BuildRequires:  python%{python3_pkgversion}-setuptools
37a582
BuildRequires:  python%{python3_pkgversion}-setuptools-rust >= 0.11.3
37a582
BuildRequires:  python%{python3_pkgversion}-six >= 1.4.1
37a582
37a582
%if %{with tests}
37a582
%if 0%{?fedora}
37a582
BuildRequires:  python%{python3_pkgversion}-hypothesis >= 1.11.4
37a582
BuildRequires:  python%{python3_pkgversion}-iso8601
37a582
BuildRequires:  python%{python3_pkgversion}-pretend
37a582
BuildRequires:  python%{python3_pkgversion}-pytest-xdist
37a582
%endif
37a582
BuildRequires:  python%{python3_pkgversion}-pytest >= 6.0
37a582
BuildRequires:  python%{python3_pkgversion}-pytest-subtests >= 0.3.2
37a582
BuildRequires:  python%{python3_pkgversion}-pytz
37a582
%endif
37a582
37a582
%description
37a582
cryptography is a package designed to expose cryptographic primitives and
37a582
recipes to Python developers.
37a582
37a582
%package -n  python%{python3_pkgversion}-%{srcname}
37a582
Summary:        PyCA's cryptography library
37a582
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
37a582
37a582
Requires:       openssl-libs
37a582
Requires:       python%{python3_pkgversion}-six >= 1.4.1
37a582
Requires:       python%{python3_pkgversion}-cffi >= 1.7
37a582
%if 0%{?fedora} >= 35 || 0%{?rhel} >= 9
37a582
# Can be safely removed in Fedora 37
37a582
Obsoletes: python%{python3_pkgversion}-cryptography-vectors < 3.4.7
37a582
%endif
37a582
37a582
%description -n python%{python3_pkgversion}-%{srcname}
37a582
cryptography is a package designed to expose cryptographic primitives and
37a582
recipes to Python developers.
37a582
37a582
%prep
37a582
%autosetup -p1 -n %{srcname}-%{version}
37a582
37a582
%generate_buildrequires
37a582
37a582
%if 0%{?fedora}
37a582
# Fedora: use cargo macros to make use of RPMified crates
37a582
%cargo_prep
37a582
cd src/rust
37a582
rm -f Cargo.lock
37a582
%cargo_generate_buildrequires
37a582
cd ../..
37a582
%else
37a582
# RHEL: use vendored Rust crates
37a582
%cargo_prep -V 1
37a582
%endif
37a582
37a582
%build
37a582
%py3_build
37a582
37a582
%install
37a582
# Actually other *.c and *.h are appropriate
37a582
# see https://github.com/pyca/cryptography/issues/1463
37a582
find . -name .keep -print -delete
37a582
%py3_install
37a582
37a582
%check
37a582
%if %{with tests}
37a582
%if 0%{?rhel}
37a582
# skip hypothesis tests on RHEL
37a582
rm -rf tests/hypothesis
37a582
# append skipper to skip iso8601 and pretend tests
37a582
cat < %{SOURCE2} >> tests/conftest.py
37a582
%endif
37a582
2753bc
# enable SHA-1 signatures for RSA tests
2753bc
# also see https://github.com/pyca/cryptography/pull/6931 and rhbz#2060343
2753bc
export OPENSSL_ENABLE_SHA1_SIGNATURES=yes
2753bc
38f79d
# see rhbz#2042413 for memleak. It's unstable with openssl 3.0.1 and makes
38f79d
# not much sense for downstream testing.
37a582
PYTHONPATH=${PWD}/vectors:%{buildroot}%{python3_sitearch} \
37a582
    %{__python3} -m pytest \
2753bc
    -k "not (test_openssl_memleak)"
37a582
%endif
37a582
37a582
%files -n python%{python3_pkgversion}-%{srcname}
37a582
%doc README.rst docs
37a582
%license LICENSE LICENSE.APACHE LICENSE.BSD
37a582
%{python3_sitearch}/%{srcname}
37a582
%{python3_sitearch}/%{srcname}-%{version}-py*.egg-info
37a582
37a582
%changelog
410144
* Tue Apr 19 2022 Christian Heimes <cheimes@redhat.com> - 36.0.1-2
410144
- Rebuild for gating, related: rhbz#2060787
410144
2753bc
* Fri Mar 04 2022 Christian Heimes <cheimes@redhat.com> - 36.0.1-6
2753bc
- Rebase to 36.0.1, related: rhbz#2059630, rhbz#2060787
2753bc
- OpenSSL 3.0 FIPS mode is now detected correctly, related: rhbz#2054785
2753bc
- Fix error check from EVP_PKEY_CTX_set_signature_md, related: rhbz#2060343
2753bc
- Block 3DES in FIPS mode, related: rhbz#2055209
2753bc
- Disable DSA tests in FIPS mode
2753bc
- Enable SHA1 signatures in test suite
2753bc
- Fix serialization of keyusage ext with no bits
2753bc
- Re-enable tests that are passing again
2753bc
38f79d
* Tue Feb 08 2022 Tomas Orsava <torsava@redhat.com> - 3.4.7-8
38f79d
- Skip unstable memleak tests, backported from Fedora (BZ#2042413)
38f79d
- Related: rhbz#1990421
38f79d
38f79d
* Tue Feb 08 2022 Tomas Orsava <torsava@redhat.com> - 3.4.7-7
38f79d
- Add automatically generated Obsoletes tag with the python39- prefix
38f79d
  for smoother upgrade from RHEL8
38f79d
- Related: rhbz#1990421
38f79d
38f79d
* Tue Jan 18 2022 Christian Heimes <cheimes@redhat.com> - 3.4.7-6
38f79d
- Fix gating issues, resolves: rhbz#2039768
38f79d
- Fix poly1305 test, resolves: rhbz#2043582
38f79d
37a582
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 3.4.7-5
37a582
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
37a582
  Related: rhbz#1991688
37a582
37a582
* Sun Aug 08 2021 Christian Heimes <cheimes@redhat.com> - 3.4.7-4
37a582
- Remove bindings to ERR_GET_FUNC, which has been removed in 3.0.0-beta2
37a582
- Resolves: rhbz#1953446
37a582
37a582
* Tue Jun 15 2021 Mohan Boddu <mboddu@redhat.com> - 3.4.7-3
37a582
- Rebuilt for RHEL 9 BETA for openssl 3.0
37a582
- Related: rhbz#1971065
37a582
37a582
* Mon Apr 26 2021 Christian Heimes <cheimes@redhat.com> - 3.4.7-2
37a582
- Add backports of OpenSSL 3.0.0 fixes (upstream PR #6000)
37a582
- Resolves: rhbz#1953446
37a582
37a582
* Wed Apr 21 2021 Christian Heimes <cheimes@redhat.com> - 3.4.7-1
37a582
- Update to 3.4.7
37a582
- Remove dependency on python-cryptography-vectors package and use vectors
37a582
  directly from Github source tar ball. Related: rhbz#1952343
37a582
37a582
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 3.4.6-2
37a582
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
37a582
37a582
* Wed Mar 03 2021 Christian Heimes <cheimes@redhat.com> - 3.4.6-1
37a582
- Update to 3.4.6 (#1927044)
37a582
37a582
* Mon Feb 15 2021 Christian Heimes <cheimes@redhat.com> - 3.4.5-1
37a582
- Update to 3.4.5 (#1927044)
37a582
37a582
* Fri Feb 12 2021 Christian Heimes <cheimes@redhat.com> - 3.4.4-3
37a582
- Skip iso8601 and pretend tests on RHEL
37a582
37a582
* Fri Feb 12 2021 Christian Heimes <cheimes@redhat.com> - 3.4.4-2
37a582
- Provide RHEL build infrastructure
37a582
37a582
* Wed Feb 10 2021 Christian Heimes <cheimes@redhat.com> - 3.4.4-1
37a582
- Update to 3.4.4 (#1927044)
37a582
37a582
* Mon Feb 08 2021 Christian Heimes <cheimes@redhat.com> - 3.4.2-1
37a582
- Update to 3.4.2 (#1926339)
37a582
- Package no longer depends on Rust (#1926181)
37a582
37a582
* Mon Feb 08 2021 Fabio Valentini <decathorpe@gmail.com> - 3.4.1-2
37a582
- Use dynamically generated BuildRequires for PyO3 Rust module.
37a582
- Drop unnecessary CARGO_NET_OFFLINE environment variable.
37a582
37a582
* Sun Feb 07 2021 Christian Heimes <cheimes@redhat.com> - 3.4.1-1
37a582
- Update to 3.4.1 (#1925953)
37a582
37a582
* Sun Feb 07 2021 Christian Heimes <cheimes@redhat.com> - 3.4-2
37a582
- Add missing abi3 and pytest dependencies
37a582
37a582
* Sun Feb 07 2021 Christian Heimes <cheimes@redhat.com> - 3.4-1
37a582
- Update to 3.4 (#1925953)
37a582
- Remove Python 2 support
37a582
- Remove unused python-idna dependency
37a582
- Add Rust support
37a582
37a582
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.1-2
37a582
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
37a582
37a582
* Thu Dec 10 2020 Christian Heimes <cheimes@redhat.com> - 3.3.1-1
37a582
- Update to 3.3.1 (#1905756)
37a582
37a582
* Wed Oct 28 2020 Christian Heimes <cheimes@redhat.com> - 3.2.1-1
37a582
- Update to 3.2.1 (#1892153)
37a582
37a582
* Mon Oct 26 2020 Christian Heimes <cheimes@redhat.com> - 3.2-1
37a582
- Update to 3.2 (#1891378)
37a582
37a582
* Mon Sep 07 2020 Christian Heimes <cheimes@redhat.com> - 3.1-1
37a582
- Update to 3.1 (#1872978)
37a582
37a582
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-2
37a582
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
37a582
37a582
* Tue Jul 21 2020 Christian Heimes <cheimes@redhat.com> - 3.0-1
37a582
- Update to 3.0 (#185897)
37a582
37a582
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 2.9-3
37a582
- Rebuilt for Python 3.9
37a582
37a582
* Tue May 12 2020 Felix Schwarz <fschwarz@fedoraproject.org> - 2.9-2
37a582
- add source file verification
37a582
37a582
* Fri Apr 03 2020 Christian Heimes <cheimes@redhat.com> - 2.9-1
37a582
- Update to 2.9 (#1820348)
37a582
37a582
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.8-3
37a582
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
37a582
37a582
* Mon Jan 13 2020 Christian Heimes <cheimes@redhat.com> - 2.8-2
37a582
- cryptography 2.8+ no longer depends on python-asn1crypto
37a582
37a582
* Thu Oct 17 2019 Christian Heimes <cheimes@redhat.com> - 2.8-1
37a582
- Update to 2.8
37a582
- Resolves: rhbz#1762779
37a582
37a582
* Sun Oct 13 2019 Christian Heimes <cheimes@redhat.com> - 2.7-3
37a582
- Skip unit tests that fail with OpenSSL 1.1.1.d
37a582
- Resolves: rhbz#1761194
37a582
- Fix and simplify Python 3 packaging
37a582
37a582
* Sat Oct 12 2019 Christian Heimes <cheimes@redhat.com> - 2.7-2
37a582
- Drop Python 2 package
37a582
- Resolves: rhbz#1761081
37a582
37a582
* Tue Sep 03 2019 Randy Barlow <bowlofeggs@fedoraproject.org> - 2.7-1
37a582
- Update to 2.7 (#1715680).
37a582
37a582
* Fri Aug 16 2019 Miro Hrončok <mhroncok@redhat.com> - 2.6.1-3
37a582
- Rebuilt for Python 3.8
37a582
37a582
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-2
37a582
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
37a582
37a582
* Thu Feb 28 2019 Christian Heimes <cheimes@redhat.com> - 2.6.1-1
37a582
- New upstream release 2.6.1, resolves RHBZ#1683691
37a582
37a582
* Wed Feb 13 2019 Alfredo Moralejo <amoralej@redhat.com> - 2.5-1
37a582
- Updated to 2.5.
37a582
37a582
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.3-3
37a582
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
37a582
37a582
* Mon Aug 13 2018 Christian Heimes <cheimes@redhat.com> - 2.3-2
37a582
- Use TLSv1.2 in test as workaround for RHBZ#1615143
37a582
37a582
* Wed Jul 18 2018 Christian Heimes <cheimes@redhat.com> - 2.3-1
37a582
- New upstream release 2.3
37a582
- Fix AEAD tag truncation bug, RHBZ#1602752
37a582
37a582
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-3
37a582
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
37a582
37a582
* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 2.2.1-2
37a582
- Rebuilt for Python 3.7
37a582
37a582
* Wed Mar 21 2018 Christian Heimes <cheimes@redhat.com> - 2.2.1-1
37a582
- New upstream release 2.2.1
37a582
37a582
* Sun Feb 18 2018 Christian Heimes <cheimes@redhat.com> - 2.1.4-1
37a582
- New upstream release 2.1.4
37a582
37a582
* Sun Feb 18 2018 Christian Heimes <cheimes@redhat.com> - 2.1.3-4
37a582
- Build requires gcc
37a582
37a582
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.1.3-3
37a582
- Update Python 2 dependency declarations to new packaging standards
37a582
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
37a582
37a582
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-2
37a582
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild