Gentoo Archives: gentoo-commits

From: Quentin Retornaz <gentoo@××××××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/libressl:master commit in: dev-python/cryptography/, dev-python/cryptography/files/
Date: Sun, 03 Jul 2022 17:47:40
Message-Id: 1656870422.84914d663ff104b31829f4754c366fa0b7eb88fe.quentin@gentoo
1 commit: 84914d663ff104b31829f4754c366fa0b7eb88fe
2 Author: orbea <orbea <AT> riseup <DOT> net>
3 AuthorDate: Sun Jul 3 04:45:01 2022 +0000
4 Commit: Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
5 CommitDate: Sun Jul 3 17:47:02 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=84914d66
7
8 dev-python/cryptography: Remove package
9
10 Works with libressl-3.5.x and cryptography-37.0.2-r1::gentoo.
11
12 Signed-off-by: orbea <orbea <AT> riseup.net>
13 Closes: https://github.com/gentoo/libressl/pull/430
14 Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com>
15
16 dev-python/cryptography/Manifest | 2 -
17 .../cryptography/cryptography-3.4.7-r3.ebuild | 82 ------
18 .../files/cryptography-3.4.7-libressl.patch | 185 -------------
19 .../files/cryptography-3.4.7-py310.patch | 301 ---------------------
20 4 files changed, 570 deletions(-)
21
22 diff --git a/dev-python/cryptography/Manifest b/dev-python/cryptography/Manifest
23 deleted file mode 100644
24 index af5ed6c..0000000
25 --- a/dev-python/cryptography/Manifest
26 +++ /dev/null
27 @@ -1,2 +0,0 @@
28 -DIST cryptography-3.4.7.tar.gz 546893 BLAKE2B 49bc1e098ed1ba0181059b645f6668cda6332d196eaca55270ebce6e07e5bb6ab6724c5050fde20e89b7025773960d74ec782bb875badbbd5dc9a04db0a536f1 SHA512 3c4cf64bc0b067ccdbb71efe04c32ac9d673faea6cc4ccd13d6b1b61920be4785806d19359b7657d032a2ff1c011a8b4f16ec4924d9df8a59d1a875a7f844473
29 -DIST cryptography_vectors-3.4.7.tar.gz 35168102 BLAKE2B fbefd3ff96548dde012fd290aba1c99d57db376023d486910e486cc9c143461ef1ae9b77824cc03307723d35142f0360bc961b548a4edc02357d3f1a0e7e4e9f SHA512 269b50fa4c5300da6758006d12be42f998630d23053ef9af0eb588fc9e6994b044d8822cff105e338f4d0d746ed0e204a4a9c42f54667e355e1ce86e6754bbe9
30
31 diff --git a/dev-python/cryptography/cryptography-3.4.7-r3.ebuild b/dev-python/cryptography/cryptography-3.4.7-r3.ebuild
32 deleted file mode 100644
33 index 87fcff4..0000000
34 --- a/dev-python/cryptography/cryptography-3.4.7-r3.ebuild
35 +++ /dev/null
36 @@ -1,82 +0,0 @@
37 -# Copyright 1999-2022 Gentoo Authors
38 -# Distributed under the terms of the GNU General Public License v2
39 -
40 -EAPI=8
41 -
42 -DISTUTILS_USE_PEP517=setuptools
43 -PYTHON_COMPAT=( python3_{8..10} pypy3 )
44 -PYTHON_REQ_USE="threads(+)"
45 -
46 -inherit distutils-r1 multiprocessing
47 -
48 -VEC_P=cryptography_vectors-${PV}
49 -DESCRIPTION="Library providing cryptographic recipes and primitives"
50 -HOMEPAGE="
51 - https://github.com/pyca/cryptography/
52 - https://pypi.org/project/cryptography/
53 -"
54 -SRC_URI="
55 - mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz
56 - test? ( mirror://pypi/c/cryptography_vectors/${VEC_P}.tar.gz )
57 -"
58 -
59 -LICENSE="|| ( Apache-2.0 BSD )"
60 -SLOT="0"
61 -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"
62 -
63 -RDEPEND="
64 - $(python_gen_cond_dep '
65 - >=dev-python/cffi-1.8:=[${PYTHON_USEDEP}]
66 - ' 'python*')
67 -"
68 -BDEPEND="
69 - test? (
70 - >=dev-python/hypothesis-1.11.4[${PYTHON_USEDEP}]
71 - dev-python/iso8601[${PYTHON_USEDEP}]
72 - dev-python/pretend[${PYTHON_USEDEP}]
73 - dev-python/pyasn1-modules[${PYTHON_USEDEP}]
74 - dev-python/pytz[${PYTHON_USEDEP}]
75 - dev-python/pytest-subtests[${PYTHON_USEDEP}]
76 - dev-python/pytest-xdist[${PYTHON_USEDEP}]
77 - )
78 -"
79 -
80 -distutils_enable_tests pytest
81 -
82 -DEPEND="
83 - >=dev-libs/openssl-1.0.2o-r6:0=
84 -"
85 -RDEPEND+=${DEPEND}
86 -
87 -PATCHES=(
88 - "${FILESDIR}/${P}-py310.patch"
89 - "${FILESDIR}/${P}-libressl.patch"
90 -)
91 -
92 -src_prepare() {
93 - default
94 -
95 - # avoid automagic dependency on dev-libs/openssl[sslv3]
96 - # https://bugs.gentoo.org/789450
97 - export CPPFLAGS="${CPPFLAGS} -DOPENSSL_NO_SSL3_METHOD=1"
98 -
99 - # work around availability macros not supported in GCC (yet)
100 - if [[ ${CHOST} == *-darwin* ]] ; then
101 - local darwinok=0
102 - [[ ${CHOST##*-darwin} -ge 16 ]] && darwinok=1
103 - sed -e 's/__builtin_available(macOS 10\.12, \*)/'"${darwinok}"'/' \
104 - -i src/_cffi_src/openssl/src/osrandom_engine.c || die
105 - fi
106 -
107 - # this version does not really use Rust, it just creates a dummy
108 - # extension to break stuff
109 - export CRYPTOGRAPHY_DONT_BUILD_RUST=1
110 - sed -e 's:from setuptools_rust import RustExtension:pass:' \
111 - -e '/setup_requires/d' \
112 - -i setup.py || die
113 -}
114 -
115 -python_test() {
116 - local -x PYTHONPATH=${PYTHONPATH}:${WORKDIR}/${VEC_P}
117 - epytest -n "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")"
118 -}
119
120 diff --git a/dev-python/cryptography/files/cryptography-3.4.7-libressl.patch b/dev-python/cryptography/files/cryptography-3.4.7-libressl.patch
121 deleted file mode 100644
122 index 4bd961f..0000000
123 --- a/dev-python/cryptography/files/cryptography-3.4.7-libressl.patch
124 +++ /dev/null
125 @@ -1,185 +0,0 @@
126 -From 52e3455eaa515a9f4ce4077ff169c6c2c40e9904 Mon Sep 17 00:00:00 2001
127 -From: Charlie Li <git@×××××××.info>
128 -Date: Mon, 19 Apr 2021 17:25:22 -0400
129 -Subject: [PATCH 1/5] LibreSSL 3.3.2 supports SSL_OP_NO_DTLS*
130 -
131 -While here, bump CI
132 ----
133 - src/_cffi_src/openssl/cryptography.py | 9 +++++++++
134 - 1 file changed, 9 insertions(+)
135 -
136 -diff --git a/src/_cffi_src/openssl/cryptography.py b/src/_cffi_src/openssl/cryptography.py
137 -index e2b5a13..ab29634 100644
138 ---- a/src/_cffi_src/openssl/cryptography.py
139 -+++ b/src/_cffi_src/openssl/cryptography.py
140 -@@ -32,6 +32,13 @@ INCLUDES = """
141 - #include <Winsock2.h>
142 - #endif
143 -
144 -+#if CRYPTOGRAPHY_IS_LIBRESSL
145 -+ #define CRYPTOGRAPHY_LIBRESSL_332_OR_GREATER \
146 -+ (LIBRESSL_VERSION_NUMBER >= 0x3030200f)
147 -+#else
148 -+#define CRYPTOGRAPHY_LIBRESSL_332_OR_GREATER (0)
149 -+#endif
150 -+
151 - #define CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER \
152 - (OPENSSL_VERSION_NUMBER >= 0x1010006f && !CRYPTOGRAPHY_IS_LIBRESSL)
153 -
154 -@@ -59,6 +66,8 @@ static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B;
155 - static const int CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE;
156 -
157 - static const int CRYPTOGRAPHY_IS_LIBRESSL;
158 -+
159 -+static const int CRYPTOGRAPHY_LIBRESSL_332_OR_GREATER;
160 - """
161 -
162 - FUNCTIONS = """
163 ---
164 -2.32.0
165 -
166 -From ca19df93826de2eb115756fe4989cc324fa69b6e Mon Sep 17 00:00:00 2001
167 -From: Charlie Li <git@×××××××.info>
168 -Date: Mon, 19 Apr 2021 18:16:14 -0400
169 -Subject: [PATCH 2/5] Switch to LESS_THAN context for LibreSSL 3.3.2
170 -
171 -While here, fix indents
172 ----
173 - src/_cffi_src/openssl/cryptography.py | 8 ++++----
174 - 1 file changed, 4 insertions(+), 4 deletions(-)
175 -
176 -diff --git a/src/_cffi_src/openssl/cryptography.py b/src/_cffi_src/openssl/cryptography.py
177 -index ab29634..0b468c8 100644
178 ---- a/src/_cffi_src/openssl/cryptography.py
179 -+++ b/src/_cffi_src/openssl/cryptography.py
180 -@@ -33,10 +33,10 @@ INCLUDES = """
181 - #endif
182 -
183 - #if CRYPTOGRAPHY_IS_LIBRESSL
184 -- #define CRYPTOGRAPHY_LIBRESSL_332_OR_GREATER \
185 -- (LIBRESSL_VERSION_NUMBER >= 0x3030200f)
186 -+#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332 \
187 -+ (LIBRESSL_VERSION_NUMBER < 0x3030200f)
188 - #else
189 --#define CRYPTOGRAPHY_LIBRESSL_332_OR_GREATER (0)
190 -+#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332 (0)
191 - #endif
192 -
193 - #define CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER \
194 -@@ -67,7 +67,7 @@ static const int CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE;
195 -
196 - static const int CRYPTOGRAPHY_IS_LIBRESSL;
197 -
198 --static const int CRYPTOGRAPHY_LIBRESSL_332_OR_GREATER;
199 -+static const int CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332;
200 - """
201 -
202 - FUNCTIONS = """
203 ---
204 -2.32.0
205 -
206 -From 0fd8db239ba8a8218229a53da248261bc36b1207 Mon Sep 17 00:00:00 2001
207 -From: Charlie Li <git@×××××××.info>
208 -Date: Mon, 19 Apr 2021 18:22:20 -0400
209 -Subject: [PATCH 3/5] Remove extra C variable declaration
210 -
211 -The variable is not actually used from Python
212 ----
213 - src/_cffi_src/openssl/cryptography.py | 2 --
214 - 1 file changed, 2 deletions(-)
215 -
216 -diff --git a/src/_cffi_src/openssl/cryptography.py b/src/_cffi_src/openssl/cryptography.py
217 -index 0b468c8..b9c7a79 100644
218 ---- a/src/_cffi_src/openssl/cryptography.py
219 -+++ b/src/_cffi_src/openssl/cryptography.py
220 -@@ -66,8 +66,6 @@ static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B;
221 - static const int CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE;
222 -
223 - static const int CRYPTOGRAPHY_IS_LIBRESSL;
224 --
225 --static const int CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332;
226 - """
227 -
228 - FUNCTIONS = """
229 ---
230 -2.32.0
231 -
232 -From 71bb8c1b32cb7da6221b09dc416616031a4de5fb Mon Sep 17 00:00:00 2001
233 -From: orbea <orbea@××××××.net>
234 -Date: Fri, 1 Oct 2021 23:17:30 -0700
235 -Subject: [PATCH 4/5] security/py-cryptography: fix build after
236 - EVP_Digest{Sign,Verify} addition
237 -
238 -Patch from OpenBSD.
239 -
240 -https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/security/py-cryptography/patches/patch-src__cffi_src_openssl_evp_py
241 -
242 -Signed-off-by: orbea <orbea@××××××.net>
243 ----
244 - src/_cffi_src/openssl/evp.py | 6 +-----
245 - 1 file changed, 1 insertion(+), 5 deletions(-)
246 -
247 -diff --git a/src/_cffi_src/openssl/evp.py b/src/_cffi_src/openssl/evp.py
248 -index 2b2f995..dcece6f 100644
249 ---- a/src/_cffi_src/openssl/evp.py
250 -+++ b/src/_cffi_src/openssl/evp.py
251 -@@ -204,14 +204,10 @@ int (*EVP_PKEY_set1_tls_encodedpoint)(EVP_PKEY *, const unsigned char *,
252 - #endif
253 -
254 - #if CRYPTOGRAPHY_OPENSSL_LESS_THAN_111
255 --static const long Cryptography_HAS_ONESHOT_EVP_DIGEST_SIGN_VERIFY = 0;
256 -+static const long Cryptography_HAS_ONESHOT_EVP_DIGEST_SIGN_VERIFY = 1;
257 - static const long Cryptography_HAS_RAW_KEY = 0;
258 - static const long Cryptography_HAS_EVP_DIGESTFINAL_XOF = 0;
259 - int (*EVP_DigestFinalXOF)(EVP_MD_CTX *, unsigned char *, size_t) = NULL;
260 --int (*EVP_DigestSign)(EVP_MD_CTX *, unsigned char *, size_t *,
261 -- const unsigned char *tbs, size_t) = NULL;
262 --int (*EVP_DigestVerify)(EVP_MD_CTX *, const unsigned char *, size_t,
263 -- const unsigned char *, size_t) = NULL;
264 - EVP_PKEY *(*EVP_PKEY_new_raw_private_key)(int, ENGINE *, const unsigned char *,
265 - size_t) = NULL;
266 - EVP_PKEY *(*EVP_PKEY_new_raw_public_key)(int, ENGINE *, const unsigned char *,
267 ---
268 -2.32.0
269 -
270 -From bb02823e94f79f6ff3eda254558aeacc0daa97a0 Mon Sep 17 00:00:00 2001
271 -From: orbea <orbea@××××××.net>
272 -Date: Fri, 1 Oct 2021 23:26:38 -0700
273 -Subject: [PATCH 5/5] security/py-cryptography: SSL_OP_NO_DTLSv1{,_2} were
274 - added to libcrypto
275 -
276 -From OpenBSD
277 -
278 -https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/security/py-cryptography/patches/patch-src__cffi_src_openssl_ssl_py?rev=1.8&content-type=text/plain
279 -
280 -Signed-off-by: orbea <orbea@××××××.net>
281 ----
282 - src/_cffi_src/openssl/ssl.py | 5 ++---
283 - 1 file changed, 2 insertions(+), 3 deletions(-)
284 -
285 -diff --git a/src/_cffi_src/openssl/ssl.py b/src/_cffi_src/openssl/ssl.py
286 -index 11a7d63..1d326f1 100644
287 ---- a/src/_cffi_src/openssl/ssl.py
288 -+++ b/src/_cffi_src/openssl/ssl.py
289 -@@ -586,8 +586,6 @@ static const long TLS_ST_OK = 0;
290 - #endif
291 -
292 - #if CRYPTOGRAPHY_IS_LIBRESSL
293 --static const long SSL_OP_NO_DTLSv1 = 0;
294 --static const long SSL_OP_NO_DTLSv1_2 = 0;
295 - long (*DTLS_set_link_mtu)(SSL *, long) = NULL;
296 - long (*DTLS_get_link_min_mtu)(SSL *) = NULL;
297 - #endif
298 -@@ -681,7 +679,8 @@ int (*SSL_set_tlsext_use_srtp)(SSL *, const char *) = NULL;
299 - SRTP_PROTECTION_PROFILE * (*SSL_get_selected_srtp_profile)(SSL *) = NULL;
300 - #endif
301 -
302 --#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_111
303 -+#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 && \
304 -+ !(CRYPTOGRAPHY_IS_LIBRESSL && defined(TLS1_3_VERSION))
305 - static const long Cryptography_HAS_TLSv1_3 = 0;
306 - static const long TLS1_3_VERSION = 0;
307 - static const long SSL_OP_NO_TLSv1_3 = 0;
308 ---
309 -2.32.0
310 -
311
312 diff --git a/dev-python/cryptography/files/cryptography-3.4.7-py310.patch b/dev-python/cryptography/files/cryptography-3.4.7-py310.patch
313 deleted file mode 100644
314 index d961af8..0000000
315 --- a/dev-python/cryptography/files/cryptography-3.4.7-py310.patch
316 +++ /dev/null
317 @@ -1,301 +0,0 @@
318 -diff --git a/src/cryptography/exceptions.py b/src/cryptography/exceptions.py
319 -index f5860590..3bd98d82 100644
320 ---- a/src/cryptography/exceptions.py
321 -+++ b/src/cryptography/exceptions.py
322 -@@ -3,10 +3,10 @@
323 - # for complete details.
324 -
325 -
326 --from enum import Enum
327 -+from cryptography import utils
328 -
329 -
330 --class _Reasons(Enum):
331 -+class _Reasons(utils.Enum):
332 - BACKEND_MISSING_INTERFACE = 0
333 - UNSUPPORTED_HASH = 1
334 - UNSUPPORTED_CIPHER = 2
335 -diff --git a/src/cryptography/hazmat/primitives/_serialization.py b/src/cryptography/hazmat/primitives/_serialization.py
336 -index 96a5ed9b..160a6b89 100644
337 ---- a/src/cryptography/hazmat/primitives/_serialization.py
338 -+++ b/src/cryptography/hazmat/primitives/_serialization.py
339 -@@ -3,13 +3,14 @@
340 - # for complete details.
341 -
342 - import abc
343 --from enum import Enum
344 -+
345 -+from cryptography import utils
346 -
347 - # This exists to break an import cycle. These classes are normally accessible
348 - # from the serialization module.
349 -
350 -
351 --class Encoding(Enum):
352 -+class Encoding(utils.Enum):
353 - PEM = "PEM"
354 - DER = "DER"
355 - OpenSSH = "OpenSSH"
356 -@@ -18,14 +19,14 @@ class Encoding(Enum):
357 - SMIME = "S/MIME"
358 -
359 -
360 --class PrivateFormat(Enum):
361 -+class PrivateFormat(utils.Enum):
362 - PKCS8 = "PKCS8"
363 - TraditionalOpenSSL = "TraditionalOpenSSL"
364 - Raw = "Raw"
365 - OpenSSH = "OpenSSH"
366 -
367 -
368 --class PublicFormat(Enum):
369 -+class PublicFormat(utils.Enum):
370 - SubjectPublicKeyInfo = "X.509 subjectPublicKeyInfo with PKCS#1"
371 - PKCS1 = "Raw PKCS#1"
372 - OpenSSH = "OpenSSH"
373 -@@ -34,7 +35,7 @@ class PublicFormat(Enum):
374 - UncompressedPoint = "X9.62 Uncompressed Point"
375 -
376 -
377 --class ParameterFormat(Enum):
378 -+class ParameterFormat(utils.Enum):
379 - PKCS3 = "PKCS3"
380 -
381 -
382 -diff --git a/src/cryptography/hazmat/primitives/kdf/kbkdf.py b/src/cryptography/hazmat/primitives/kdf/kbkdf.py
383 -index ac36474f..75fe7d51 100644
384 ---- a/src/cryptography/hazmat/primitives/kdf/kbkdf.py
385 -+++ b/src/cryptography/hazmat/primitives/kdf/kbkdf.py
386 -@@ -4,7 +4,6 @@
387 -
388 -
389 - import typing
390 --from enum import Enum
391 -
392 - from cryptography import utils
393 - from cryptography.exceptions import (
394 -@@ -19,11 +18,11 @@ from cryptography.hazmat.primitives import constant_time, hashes, hmac
395 - from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
396 -
397 -
398 --class Mode(Enum):
399 -+class Mode(utils.Enum):
400 - CounterMode = "ctr"
401 -
402 -
403 --class CounterLocation(Enum):
404 -+class CounterLocation(utils.Enum):
405 - BeforeFixed = "before_fixed"
406 - AfterFixed = "after_fixed"
407 -
408 -diff --git a/src/cryptography/hazmat/primitives/serialization/pkcs7.py b/src/cryptography/hazmat/primitives/serialization/pkcs7.py
409 -index bcd9e330..57aac7e3 100644
410 ---- a/src/cryptography/hazmat/primitives/serialization/pkcs7.py
411 -+++ b/src/cryptography/hazmat/primitives/serialization/pkcs7.py
412 -@@ -3,8 +3,8 @@
413 - # for complete details.
414 -
415 - import typing
416 --from enum import Enum
417 -
418 -+from cryptography import utils
419 - from cryptography import x509
420 - from cryptography.hazmat.backends import _get_backend
421 - from cryptography.hazmat.primitives import hashes, serialization
422 -@@ -35,7 +35,7 @@ _ALLOWED_PRIVATE_KEY_TYPES = typing.Union[
423 - ]
424 -
425 -
426 --class PKCS7Options(Enum):
427 -+class PKCS7Options(utils.Enum):
428 - Text = "Add text/plain MIME type"
429 - Binary = "Don't translate input data into canonical MIME format"
430 - DetachedSignature = "Don't embed data in the PKCS7 structure"
431 -diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py
432 -index ef0fc443..9e571cfd 100644
433 ---- a/src/cryptography/utils.py
434 -+++ b/src/cryptography/utils.py
435 -@@ -4,6 +4,7 @@
436 -
437 -
438 - import abc
439 -+import enum
440 - import inspect
441 - import sys
442 - import typing
443 -@@ -162,3 +163,13 @@ int_from_bytes = deprecated(
444 - "int_from_bytes is deprecated, use int.from_bytes instead",
445 - DeprecatedIn34,
446 - )
447 -+
448 -+
449 -+# Python 3.10 changed representation of enums. We use well-defined object
450 -+# representation and string representation from Python 3.9.
451 -+class Enum(enum.Enum):
452 -+ def __repr__(self):
453 -+ return f"<{self.__class__.__name__}.{self._name_}: {self._value_!r}>"
454 -+
455 -+ def __str__(self):
456 -+ return f"{self.__class__.__name__}.{self._name_}"
457 -diff --git a/src/cryptography/x509/base.py b/src/cryptography/x509/base.py
458 -index 5505fa3b..e3846c33 100644
459 ---- a/src/cryptography/x509/base.py
460 -+++ b/src/cryptography/x509/base.py
461 -@@ -7,9 +7,9 @@ import abc
462 - import datetime
463 - import os
464 - import typing
465 --from enum import Enum
466 -
467 - from cryptography.hazmat._types import _PRIVATE_KEY_TYPES, _PUBLIC_KEY_TYPES
468 -+from cryptography import utils
469 - from cryptography.hazmat.backends import _get_backend
470 - from cryptography.hazmat.primitives import hashes, serialization
471 - from cryptography.hazmat.primitives.asymmetric import (
472 -@@ -66,7 +66,7 @@ def _convert_to_naive_utc_time(time: datetime.datetime) -> datetime.datetime:
473 - return time
474 -
475 -
476 --class Version(Enum):
477 -+class Version(utils.Enum):
478 - v1 = 0
479 - v3 = 2
480 -
481 -diff --git a/src/cryptography/x509/certificate_transparency.py b/src/cryptography/x509/certificate_transparency.py
482 -index d51bee92..d80f051a 100644
483 ---- a/src/cryptography/x509/certificate_transparency.py
484 -+++ b/src/cryptography/x509/certificate_transparency.py
485 -@@ -5,15 +5,16 @@
486 -
487 - import abc
488 - import datetime
489 --from enum import Enum
490 -
491 -+from cryptography import utils
492 -
493 --class LogEntryType(Enum):
494 -+
495 -+class LogEntryType(utils.Enum):
496 - X509_CERTIFICATE = 0
497 - PRE_CERTIFICATE = 1
498 -
499 -
500 --class Version(Enum):
501 -+class Version(utils.Enum):
502 - v1 = 0
503 -
504 -
505 -diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
506 -index 6cae016a..742f1fa2 100644
507 ---- a/src/cryptography/x509/extensions.py
508 -+++ b/src/cryptography/x509/extensions.py
509 -@@ -8,7 +8,6 @@ import datetime
510 - import hashlib
511 - import ipaddress
512 - import typing
513 --from enum import Enum
514 -
515 - from cryptography import utils
516 - from cryptography.hazmat._der import (
517 -@@ -634,7 +633,7 @@ class DistributionPoint(object):
518 - crl_issuer = utils.read_only_property("_crl_issuer")
519 -
520 -
521 --class ReasonFlags(Enum):
522 -+class ReasonFlags(utils.Enum):
523 - unspecified = "unspecified"
524 - key_compromise = "keyCompromise"
525 - ca_compromise = "cACompromise"
526 -@@ -978,7 +977,7 @@ class TLSFeature(ExtensionType):
527 - return hash(tuple(self._features))
528 -
529 -
530 --class TLSFeatureType(Enum):
531 -+class TLSFeatureType(utils.Enum):
532 - # status_request is defined in RFC 6066 and is used for what is commonly
533 - # called OCSP Must-Staple when present in the TLS Feature extension in an
534 - # X.509 certificate.
535 -diff --git a/src/cryptography/x509/name.py b/src/cryptography/x509/name.py
536 -index a579aa21..9069a9f4 100644
537 ---- a/src/cryptography/x509/name.py
538 -+++ b/src/cryptography/x509/name.py
539 -@@ -3,14 +3,13 @@
540 - # for complete details.
541 -
542 - import typing
543 --from enum import Enum
544 -
545 - from cryptography import utils
546 - from cryptography.hazmat.backends import _get_backend
547 - from cryptography.x509.oid import NameOID, ObjectIdentifier
548 -
549 -
550 --class _ASN1Type(Enum):
551 -+class _ASN1Type(utils.Enum):
552 - UTF8String = 12
553 - NumericString = 18
554 - PrintableString = 19
555 -diff --git a/src/cryptography/x509/ocsp.py b/src/cryptography/x509/ocsp.py
556 -index 1c5de73e..bcf210c1 100644
557 ---- a/src/cryptography/x509/ocsp.py
558 -+++ b/src/cryptography/x509/ocsp.py
559 -@@ -6,8 +6,8 @@
560 - import abc
561 - import datetime
562 - import typing
563 --from enum import Enum
564 -
565 -+from cryptography import utils
566 - from cryptography import x509
567 - from cryptography.hazmat.primitives import hashes, serialization
568 - from cryptography.x509.base import (
569 -@@ -27,12 +27,12 @@ _OIDS_TO_HASH = {
570 - }
571 -
572 -
573 --class OCSPResponderEncoding(Enum):
574 -+class OCSPResponderEncoding(utils.Enum):
575 - HASH = "By Hash"
576 - NAME = "By Name"
577 -
578 -
579 --class OCSPResponseStatus(Enum):
580 -+class OCSPResponseStatus(utils.Enum):
581 - SUCCESSFUL = 0
582 - MALFORMED_REQUEST = 1
583 - INTERNAL_ERROR = 2
584 -@@ -58,7 +58,7 @@ def _verify_algorithm(algorithm):
585 - )
586 -
587 -
588 --class OCSPCertStatus(Enum):
589 -+class OCSPCertStatus(utils.Enum):
590 - GOOD = 0
591 - REVOKED = 1
592 - UNKNOWN = 2
593 -diff --git a/tests/test_cryptography_utils.py b/tests/test_cryptography_utils.py
594 -index 6b795e0c..803997ac 100644
595 ---- a/tests/test_cryptography_utils.py
596 -+++ b/tests/test_cryptography_utils.py
597 -@@ -2,6 +2,7 @@
598 - # 2.0, and the BSD License. See the LICENSE file in the root of this repository
599 - # for complete details.
600 -
601 -+import enum
602 - import typing
603 -
604 - import pytest
605 -@@ -51,3 +52,13 @@ class TestCachedProperty(object):
606 - assert len(accesses) == 1
607 - assert t.t == 14
608 - assert len(accesses) == 1
609 -+
610 -+
611 -+def test_enum():
612 -+ class TestEnum(utils.Enum):
613 -+ value = "something"
614 -+
615 -+ assert issubclass(TestEnum, enum.Enum)
616 -+ assert isinstance(TestEnum.value, enum.Enum)
617 -+ assert repr(TestEnum.value) == "<TestEnum.value: 'something'>"
618 -+ assert str(TestEnum.value) == "TestEnum.value"