bump cryptography-3.4.8

This commit is contained in:
Andreas Billmeier 2021-10-02 11:00:27 +02:00 committed by Andreas Billmeier
parent e6c565226e
commit e39df42aab
Signed by: onkelbeh
GPG Key ID: E6DB12C8C550F3C0
5 changed files with 383 additions and 58 deletions

View File

@ -1,7 +1,8 @@
DIST cryptography-3.2.tar.gz 540815 BLAKE2B be4edd5d4cd9564e8622284ff9b1d3a7cc7d6e46cfa790d8e1cfa1ce389c5d628e39b056dc5cba3b94ab3fa45603df73a7b4ebd9d1c70fc88c457780f6616311 SHA512 0096e6408b5868cc0b5e6f67945e4200bb943a00ac803546048fa4d332f81af4a224b2d67b911ee8da1ad086120935d7d557fc70a739ecffb22f408ee9b8d09e
AUX cryptography-3.4.8-py310.patch 8611 BLAKE2B 6cabc8056658f6a0c895a75b287ebfaa3d25c4ba9f95e28bf63c34bb87ccccdb4b04e42c5d72fdb4d889560e1ca13c602755fa05b9bab3b1fe05788abe110964 SHA512 d1c89a6c50fd4032d6aedcf026592b52b1e38922ecc2a83e8defcee5b7b4845a66de45de897fd3c2022c6118591811b9fc25df7fdd33d219647e0923cd906a66
DIST cryptography-3.3.2.tar.gz 539883 BLAKE2B e35de90362b24170c4025f67914e60c16fbf37fce6bcd5d6f3fe32e5a9bb60de8edbebcb1ff0450fabc9c244d4b1a4618c720b630f28c747fea17e9bf008f01f SHA512 55f6ee13342b3209b1fcb310f4c4d33d22856ee785cb2347e6ad36c34e9b42f6e0d5bece8e458b09663a5b78e34c4567fe7a211b51ca71f55ccc93e3f62dc5e4
DIST cryptography_vectors-3.2.tar.gz 35168065 BLAKE2B ebd915eee9b91bd61445bcb442d3052972b1463132b8e63343832baa27c25566e22ca9f50c9d4ea73cb12185f9228144eaac4bf5cc68a3bd79f347fe2d021adc SHA512 bb0d00c8a66fd328ef38b0008519856a14d35b6fd634a6f67ea5530775d36538fbd326326c3f0cd962b1a008c21f2aded4d733f97bc12577679ed8be67b858bc
DIST cryptography-3.4.8.tar.gz 546907 BLAKE2B 804cba30e437f23059223cc6d4b2912cf291adb54e107fecb094b7510272b90a904af85517bed87b0f6027cd7cdc2c20bef97ad09975a304c09f193f1987fc36 SHA512 b0d64a573b488af3e453fc1885bbafb65f8a2260e81cf64830f981589afca0bd7be052a5f5b8ed83dd78d9638da37c680f3705cbf2d47d5b28fb5a5454f1cea5
DIST cryptography_vectors-3.3.2.tar.gz 35168168 BLAKE2B 3991a16556ae5be0d153cfe302dd9a860918a80bd0bdef7104f3c170ba63941c4b1ff74750bc12329422a6061161cb6452bea60e191d85c0d79e0852566c6c0b SHA512 18590adb96a6f04b8a41d4346b126b8adfc854cbcec85f8c1c0a23b1b363f215b37da60ea94a481b8fd7752f07fba515b08fc18faf2e29fb858e133129971f7c
EBUILD cryptography-3.2.ebuild 1603 BLAKE2B 91d3cc7995d6f2a7ac6e25d830652d9c99fec02d202fb06ed195d3649848fa762966e3c80d10040d1ac365aedbd812c74154be5ffc09c9b10485b1adf8dbc4c8 SHA512 1d18a716b6e4429816754fa6cdd07549d9cae8e7c59922df7b624ea27ebc8b3fa46fdd9e171d2da1aa16b7fe319216aade3c009296c1a8bb5076f3411ea6b0eb
DIST cryptography_vectors-3.4.8.tar.gz 35168097 BLAKE2B 0811086c69e6d3dd09a8a8d7e464dd82a4545f1289434a35ca8d21fded74b9ae805abd6becd386b830dff56c807b3ad02ec5f14e1ae52bbffb178cba1d2b76f0 SHA512 de668cc0599862f32993022dead7fd682cd6b9a458d00a71c810a2904bc6d5482b8f5544b174b9e34a3f13a126b7c957942d0159a13c0a0676e702cf87c49071
EBUILD cryptography-3.3.2.ebuild 1869 BLAKE2B 296de8e188815e9f5964b6c3273bc4e9e608612065f53a4179a5f8681cbb4bd3874bc407505aa119160eeb80405d11ddc724ea100896e4342bdd30bd4ed9a844 SHA512 bb0741c924edd1b86f327d43b570d07884c340ca9e7de128f1ceed526c16a59c36946ae231224e225093c06db4e9c05d59598e9291b77be6ab5c1bacdde763c2
MISC metadata.xml 479 BLAKE2B 637fbeecd5f411ce492dc6bc433f5996e33422be878f1fd47b2e28b98554b0e086be846c273f6dd9f4fbf0dc1880123fa4b9201dc130d802cb29f3288b0b340c SHA512 ab01a7440d9a51c073b2d8b9670ae3e821897fec59ee969165576961e2432ed84aa5fbda3075af46877809a78792923f9a75d4d64b33d1defa7c662bcd23bb33
EBUILD cryptography-3.4.8.ebuild 2172 BLAKE2B d80bea8ba8b62ff1551b1e4c5f154589cf5a67fecc5b8fcc3cf775979062b49cda41b928f926d47de467c01b93cb24660cef50c574436ddf0597ebf92090342b SHA512 dc960ab574d7b289166cb0c9b61ca3cd9546f07bd9e59b3c933e0aec64c1e81a18e0b34e2a1dc6deaa3e4a397d8d6e72cb936d6fe66b9cb621821c6a9b7ee06c
MISC metadata.xml 514 BLAKE2B b6a872cf35c5cbbd12c450141ba82d7627b1ab353920e5d5f9f19a8c3a05bc7aa9df93d6baa4d2fb61b5c39bcbf137c32a24c38dbe74f3097cc120b71c0b629f SHA512 674589e3493fc59f26c9eac5c325ed4b9da8dcf7cef04bdfb61e2b4b9c38a359aa902d4d528f826ed034fca89f2d702c38ed21fd6df10645f9f5bb78de7cde06

View File

@ -1,53 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{6..9} pypy3 )
PYTHON_REQ_USE="threads(+)"
inherit distutils-r1 multiprocessing
VEC_P=cryptography_vectors-${PV}
DESCRIPTION="Library providing cryptographic recipes and primitives"
HOMEPAGE="https://github.com/pyca/cryptography/ https://pypi.org/project/cryptography/"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz
test? ( mirror://pypi/c/cryptography_vectors/${VEC_P}.tar.gz )"
LICENSE="|| ( Apache-2.0 BSD )"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="libressl idna"
RDEPEND="
>=dev-python/six-1.4.1[${PYTHON_USEDEP}]
idna? ( >=dev-python/idna-2.1[${PYTHON_USEDEP}] )
$(python_gen_cond_dep '
>=dev-python/cffi-1.8:=[${PYTHON_USEDEP}]
' 'python*')
"
BDEPEND="
test? (
>=dev-python/hypothesis-1.11.4[${PYTHON_USEDEP}]
dev-python/iso8601[${PYTHON_USEDEP}]
dev-python/pretend[${PYTHON_USEDEP}]
dev-python/pyasn1-modules[${PYTHON_USEDEP}]
dev-python/pytz[${PYTHON_USEDEP}]
dev-python/pytest-xdist[${PYTHON_USEDEP}]
)"
distutils_enable_tests pytest
DEPEND="
!libressl? ( >=dev-libs/openssl-1.0.2o-r6:0= )
libressl? ( >=dev-libs/libressl-2.9.1:0= )
"
RDEPEND+=${DEPEND}
DOCS=( AUTHORS.rst CONTRIBUTING.rst README.rst )
python_test() {
local -x PYTHONPATH=${PYTHONPATH}:${WORKDIR}/${VEC_P}
pytest -vv -n "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")" ||
die "Tests fail with ${EPYTHON}"
}

View File

@ -0,0 +1,76 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7..10} pypy3 )
PYTHON_REQ_USE="threads(+)"
inherit distutils-r1 multiprocessing
VEC_P=cryptography_vectors-${PV}
DESCRIPTION="Library providing cryptographic recipes and primitives"
HOMEPAGE="https://github.com/pyca/cryptography/ https://pypi.org/project/cryptography/"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz
test? ( mirror://pypi/c/cryptography_vectors/${VEC_P}.tar.gz )"
LICENSE="|| ( Apache-2.0 BSD )"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
RDEPEND="
$(python_gen_cond_dep '
>=dev-python/cffi-1.8:=[${PYTHON_USEDEP}]
' 'python*')
"
BDEPEND="
test? (
>=dev-python/hypothesis-1.11.4[${PYTHON_USEDEP}]
dev-python/iso8601[${PYTHON_USEDEP}]
dev-python/pretend[${PYTHON_USEDEP}]
dev-python/pyasn1-modules[${PYTHON_USEDEP}]
dev-python/pytz[${PYTHON_USEDEP}]
dev-python/pytest-subtests[${PYTHON_USEDEP}]
dev-python/pytest-xdist[${PYTHON_USEDEP}]
)"
distutils_enable_tests pytest
DEPEND="
>=dev-libs/openssl-1.0.2o-r6:0=
"
RDEPEND+=${DEPEND}
PATCHES=(
"${FILESDIR}/${P}-py310.patch"
)
src_prepare() {
default
# avoid automagic dependency on dev-libs/openssl[sslv3]
# https://bugs.gentoo.org/789450
export CPPFLAGS="${CPPFLAGS} -DOPENSSL_NO_SSL3_METHOD=1"
# work around availability macros not supported in GCC (yet)
if [[ ${CHOST} == *-darwin* ]] ; then
local darwinok=0
if [[ ${CHOST##*-darwin} -ge 16 ]] ; then
darwinok=1
fi
sed -i -e 's/__builtin_available(macOS 10\.12, \*)/'"${darwinok}"'/' \
src/_cffi_src/openssl/src/osrandom_engine.c || die
fi
# this version does not really use Rust, it just creates a dummy
# extension to break stuff
export CRYPTOGRAPHY_DONT_BUILD_RUST=1
sed -e 's:from setuptools_rust import RustExtension:pass:' \
-e '/setup_requires/d' \
-i setup.py || die
}
python_test() {
local -x PYTHONPATH=${PYTHONPATH}:${WORKDIR}/${VEC_P}
epytest -n "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")"
}

View File

@ -0,0 +1,301 @@
diff --git a/src/cryptography/exceptions.py b/src/cryptography/exceptions.py
index f5860590..3bd98d82 100644
--- a/src/cryptography/exceptions.py
+++ b/src/cryptography/exceptions.py
@@ -3,10 +3,10 @@
# for complete details.
-from enum import Enum
+from cryptography import utils
-class _Reasons(Enum):
+class _Reasons(utils.Enum):
BACKEND_MISSING_INTERFACE = 0
UNSUPPORTED_HASH = 1
UNSUPPORTED_CIPHER = 2
diff --git a/src/cryptography/hazmat/primitives/_serialization.py b/src/cryptography/hazmat/primitives/_serialization.py
index 96a5ed9b..160a6b89 100644
--- a/src/cryptography/hazmat/primitives/_serialization.py
+++ b/src/cryptography/hazmat/primitives/_serialization.py
@@ -3,13 +3,14 @@
# for complete details.
import abc
-from enum import Enum
+
+from cryptography import utils
# This exists to break an import cycle. These classes are normally accessible
# from the serialization module.
-class Encoding(Enum):
+class Encoding(utils.Enum):
PEM = "PEM"
DER = "DER"
OpenSSH = "OpenSSH"
@@ -18,14 +19,14 @@ class Encoding(Enum):
SMIME = "S/MIME"
-class PrivateFormat(Enum):
+class PrivateFormat(utils.Enum):
PKCS8 = "PKCS8"
TraditionalOpenSSL = "TraditionalOpenSSL"
Raw = "Raw"
OpenSSH = "OpenSSH"
-class PublicFormat(Enum):
+class PublicFormat(utils.Enum):
SubjectPublicKeyInfo = "X.509 subjectPublicKeyInfo with PKCS#1"
PKCS1 = "Raw PKCS#1"
OpenSSH = "OpenSSH"
@@ -34,7 +35,7 @@ class PublicFormat(Enum):
UncompressedPoint = "X9.62 Uncompressed Point"
-class ParameterFormat(Enum):
+class ParameterFormat(utils.Enum):
PKCS3 = "PKCS3"
diff --git a/src/cryptography/hazmat/primitives/kdf/kbkdf.py b/src/cryptography/hazmat/primitives/kdf/kbkdf.py
index ac36474f..75fe7d51 100644
--- a/src/cryptography/hazmat/primitives/kdf/kbkdf.py
+++ b/src/cryptography/hazmat/primitives/kdf/kbkdf.py
@@ -4,7 +4,6 @@
import typing
-from enum import Enum
from cryptography import utils
from cryptography.exceptions import (
@@ -19,11 +18,11 @@ from cryptography.hazmat.primitives import constant_time, hashes, hmac
from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
-class Mode(Enum):
+class Mode(utils.Enum):
CounterMode = "ctr"
-class CounterLocation(Enum):
+class CounterLocation(utils.Enum):
BeforeFixed = "before_fixed"
AfterFixed = "after_fixed"
diff --git a/src/cryptography/hazmat/primitives/serialization/pkcs7.py b/src/cryptography/hazmat/primitives/serialization/pkcs7.py
index bcd9e330..57aac7e3 100644
--- a/src/cryptography/hazmat/primitives/serialization/pkcs7.py
+++ b/src/cryptography/hazmat/primitives/serialization/pkcs7.py
@@ -3,8 +3,8 @@
# for complete details.
import typing
-from enum import Enum
+from cryptography import utils
from cryptography import x509
from cryptography.hazmat.backends import _get_backend
from cryptography.hazmat.primitives import hashes, serialization
@@ -35,7 +35,7 @@ _ALLOWED_PRIVATE_KEY_TYPES = typing.Union[
]
-class PKCS7Options(Enum):
+class PKCS7Options(utils.Enum):
Text = "Add text/plain MIME type"
Binary = "Don't translate input data into canonical MIME format"
DetachedSignature = "Don't embed data in the PKCS7 structure"
diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py
index ef0fc443..9e571cfd 100644
--- a/src/cryptography/utils.py
+++ b/src/cryptography/utils.py
@@ -4,6 +4,7 @@
import abc
+import enum
import inspect
import sys
import typing
@@ -162,3 +163,13 @@ int_from_bytes = deprecated(
"int_from_bytes is deprecated, use int.from_bytes instead",
DeprecatedIn34,
)
+
+
+# Python 3.10 changed representation of enums. We use well-defined object
+# representation and string representation from Python 3.9.
+class Enum(enum.Enum):
+ def __repr__(self):
+ return f"<{self.__class__.__name__}.{self._name_}: {self._value_!r}>"
+
+ def __str__(self):
+ return f"{self.__class__.__name__}.{self._name_}"
diff --git a/src/cryptography/x509/base.py b/src/cryptography/x509/base.py
index 5505fa3b..e3846c33 100644
--- a/src/cryptography/x509/base.py
+++ b/src/cryptography/x509/base.py
@@ -7,9 +7,9 @@ import abc
import datetime
import os
import typing
-from enum import Enum
from cryptography.hazmat._types import _PRIVATE_KEY_TYPES, _PUBLIC_KEY_TYPES
+from cryptography import utils
from cryptography.hazmat.backends import _get_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import (
@@ -66,7 +66,7 @@ def _convert_to_naive_utc_time(time: datetime.datetime) -> datetime.datetime:
return time
-class Version(Enum):
+class Version(utils.Enum):
v1 = 0
v3 = 2
diff --git a/src/cryptography/x509/certificate_transparency.py b/src/cryptography/x509/certificate_transparency.py
index d51bee92..d80f051a 100644
--- a/src/cryptography/x509/certificate_transparency.py
+++ b/src/cryptography/x509/certificate_transparency.py
@@ -5,15 +5,16 @@
import abc
import datetime
-from enum import Enum
+from cryptography import utils
-class LogEntryType(Enum):
+
+class LogEntryType(utils.Enum):
X509_CERTIFICATE = 0
PRE_CERTIFICATE = 1
-class Version(Enum):
+class Version(utils.Enum):
v1 = 0
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
index 6cae016a..742f1fa2 100644
--- a/src/cryptography/x509/extensions.py
+++ b/src/cryptography/x509/extensions.py
@@ -8,7 +8,6 @@ import datetime
import hashlib
import ipaddress
import typing
-from enum import Enum
from cryptography import utils
from cryptography.hazmat._der import (
@@ -634,7 +633,7 @@ class DistributionPoint(object):
crl_issuer = utils.read_only_property("_crl_issuer")
-class ReasonFlags(Enum):
+class ReasonFlags(utils.Enum):
unspecified = "unspecified"
key_compromise = "keyCompromise"
ca_compromise = "cACompromise"
@@ -978,7 +977,7 @@ class TLSFeature(ExtensionType):
return hash(tuple(self._features))
-class TLSFeatureType(Enum):
+class TLSFeatureType(utils.Enum):
# status_request is defined in RFC 6066 and is used for what is commonly
# called OCSP Must-Staple when present in the TLS Feature extension in an
# X.509 certificate.
diff --git a/src/cryptography/x509/name.py b/src/cryptography/x509/name.py
index a579aa21..9069a9f4 100644
--- a/src/cryptography/x509/name.py
+++ b/src/cryptography/x509/name.py
@@ -3,14 +3,13 @@
# for complete details.
import typing
-from enum import Enum
from cryptography import utils
from cryptography.hazmat.backends import _get_backend
from cryptography.x509.oid import NameOID, ObjectIdentifier
-class _ASN1Type(Enum):
+class _ASN1Type(utils.Enum):
UTF8String = 12
NumericString = 18
PrintableString = 19
diff --git a/src/cryptography/x509/ocsp.py b/src/cryptography/x509/ocsp.py
index 1c5de73e..bcf210c1 100644
--- a/src/cryptography/x509/ocsp.py
+++ b/src/cryptography/x509/ocsp.py
@@ -6,8 +6,8 @@
import abc
import datetime
import typing
-from enum import Enum
+from cryptography import utils
from cryptography import x509
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.x509.base import (
@@ -27,12 +27,12 @@ _OIDS_TO_HASH = {
}
-class OCSPResponderEncoding(Enum):
+class OCSPResponderEncoding(utils.Enum):
HASH = "By Hash"
NAME = "By Name"
-class OCSPResponseStatus(Enum):
+class OCSPResponseStatus(utils.Enum):
SUCCESSFUL = 0
MALFORMED_REQUEST = 1
INTERNAL_ERROR = 2
@@ -58,7 +58,7 @@ def _verify_algorithm(algorithm):
)
-class OCSPCertStatus(Enum):
+class OCSPCertStatus(utils.Enum):
GOOD = 0
REVOKED = 1
UNKNOWN = 2
diff --git a/tests/test_cryptography_utils.py b/tests/test_cryptography_utils.py
index 6b795e0c..803997ac 100644
--- a/tests/test_cryptography_utils.py
+++ b/tests/test_cryptography_utils.py
@@ -2,6 +2,7 @@
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
+import enum
import typing
import pytest
@@ -51,3 +52,13 @@ class TestCachedProperty(object):
assert len(accesses) == 1
assert t.t == 14
assert len(accesses) == 1
+
+
+def test_enum():
+ class TestEnum(utils.Enum):
+ value = "something"
+
+ assert issubclass(TestEnum, enum.Enum)
+ assert isinstance(TestEnum.value, enum.Enum)
+ assert repr(TestEnum.value) == "<TestEnum.value: 'something'>"
+ assert str(TestEnum.value) == "TestEnum.value"

View File

@ -9,7 +9,7 @@
<remote-id type="pypi">cryptography</remote-id>
<maintainer status="unknown">
<email>cryptography-dev@python.org</email>
<name>The cryptography developers</name>
<name>The Python Cryptographic Authority and individual contributors</name>
</maintainer>
</upstream>
</pkgmetadata>