Skip to content

Commit ed4bec1

Browse files
committed
security/py-cryptography: revert Update to 38.0.1
This reverts commit f5711e9. Revert due to multiple breakage reports.
1 parent 0112afb commit ed4bec1

File tree

5 files changed

+195
-36
lines changed

5 files changed

+195
-36
lines changed

‎security/py-cryptography/Makefile‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
PORTNAME= cryptography
2-
PORTVERSION= 38.0.1
2+
PORTVERSION= 3.4.8
3+
PORTEPOCH= 1
34
CATEGORIES= security python
45
MASTER_SITES= CHEESESHOP
56
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@@ -19,7 +20,6 @@ TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}cryptography-vectors>=${PORTVERSION}:securi
1920
${PYTHON_PKGNAMEPREFIX}hypothesis>=1.11.4:devel/py-hypothesis@${PY_FLAVOR} \
2021
${PYTHON_PKGNAMEPREFIX}iso8601>=0:devel/py-iso8601@${PY_FLAVOR} \
2122
${PYTHON_PKGNAMEPREFIX}pretend>=0:devel/py-pretend@${PY_FLAVOR} \
22-
${PYTHON_PKGNAMEPREFIX}pytest-benchmark>=0:devel/py-pytest-benchmark@${PY_FLAVOR} \
2323
${PYTHON_PKGNAMEPREFIX}pytest-cov>=0:devel/py-pytest-cov@${PY_FLAVOR} \
2424
${PYTHON_PKGNAMEPREFIX}pytest-subtests>=0:devel/py-pytest-subtests@${PY_FLAVOR} \
2525
${PYTHON_PKGNAMEPREFIX}pytest-xdist>=0,1:devel/py-pytest-xdist@${PY_FLAVOR} \
@@ -31,15 +31,15 @@ USE_PYTHON= autoplist concurrent distutils pytest
3131

3232
CFLAGS+= -I${OPENSSLINC}
3333
LDFLAGS+= -L${OPENSSLLIB}
34+
MAKE_ENV= CRYPTOGRAPHY_DONT_BUILD_RUST=1
3435
TEST_ENV= PYTHONPATH=${STAGEDIR}${PYTHON_SITELIBDIR}
3536

3637
CPE_VENDOR= cryptography_project
3738

3839
.include <bsd.port.pre.mk>
3940

40-
post-patch:
41-
@${RM} -r ${WRKSRC}/src/rust/
4241
.if ${CHOSEN_COMPILER_TYPE} == gcc && ${COMPILER_VERSION} <= 42
42+
post-patch:
4343
@${REINPLACE_CMD} -e 's|"-Wno-error=sign-conversion"||' ${WRKSRC}/src/_cffi_src/build_openssl.py
4444
.endif
4545

‎security/py-cryptography/distinfo‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
TIMESTAMP = 1665073152
2-
SHA256 (cryptography-38.0.1.tar.gz) = 1db3d807a14931fa317f96435695d9ec386be7b84b618cc61cfa5d08b0ae33d7
3-
SIZE (cryptography-38.0.1.tar.gz) = 599412
1+
TIMESTAMP = 1652122693
2+
SHA256 (cryptography-3.4.8.tar.gz) = 94cc5ed4ceaefcbe5bf38c8fba6a21fc1d365bb8fb826ea1688e3370b2e24a1c
3+
SIZE (cryptography-3.4.8.tar.gz) = 546907
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
From 94590a9aecc9e5ef6fc8eda52bae43643a4c44bd Mon Sep 17 00:00:00 2001
2+
From: Charlie Li <vishwin@users.noreply.github.com>
3+
Date: Mon, 19 Apr 2021 18:38:38 -0400
4+
Subject: [PATCH] Fix build with LibreSSL 3.3.2 (#5988)
5+
6+
* LibreSSL 3.3.2 supports SSL_OP_NO_DTLS*
7+
8+
While here, bump CI
9+
10+
* Fix preprocessor guards for LibreSSL's SSL_OP_NO_DTLS*
11+
12+
DTLS_set_link_mtu and DTLS_get_link_min_mtu are not part of 3.3.2
13+
14+
* Switch to LESS_THAN context for LibreSSL 3.3.2
15+
16+
While here, fix indents
17+
18+
* Remove extra C variable declaration
19+
20+
The variable is not actually used from Python
21+
---
22+
.github/workflows/ci.yml | 2 +-
23+
src/_cffi_src/openssl/cryptography.py | 7 +++++++
24+
src/_cffi_src/openssl/ssl.py | 2 ++
25+
3 files changed, 10 insertions(+), 1 deletion(-)
26+
27+
diff --git src/_cffi_src/openssl/cryptography.py src/_cffi_src/openssl/cryptography.py
28+
index e2b5a132..b9c7a793 100644
29+
--- src/_cffi_src/openssl/cryptography.py
30+
+++ src/_cffi_src/openssl/cryptography.py
31+
@@ -32,6 +32,13 @@ INCLUDES = """
32+
#include <Winsock2.h>
33+
#endif
34+
35+
+#if CRYPTOGRAPHY_IS_LIBRESSL
36+
+#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332 \
37+
+ (LIBRESSL_VERSION_NUMBER < 0x3030200f)
38+
+#else
39+
+#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332 (0)
40+
+#endif
41+
+
42+
#define CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER \
43+
(OPENSSL_VERSION_NUMBER >= 0x1010006f && !CRYPTOGRAPHY_IS_LIBRESSL)
44+
45+
diff --git src/_cffi_src/openssl/ssl.py src/_cffi_src/openssl/ssl.py
46+
index 11a7d63a..081ef041 100644
47+
--- src/_cffi_src/openssl/ssl.py
48+
+++ src/_cffi_src/openssl/ssl.py
49+
@@ -586,8 +586,10 @@ static const long TLS_ST_OK = 0;
50+
#endif
51+
52+
#if CRYPTOGRAPHY_IS_LIBRESSL
53+
+#if CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332
54+
static const long SSL_OP_NO_DTLSv1 = 0;
55+
static const long SSL_OP_NO_DTLSv1_2 = 0;
56+
+#endif
57+
long (*DTLS_set_link_mtu)(SSL *, long) = NULL;
58+
long (*DTLS_get_link_min_mtu)(SSL *) = NULL;
59+
#endif
60+
--
61+
2.31.1
62+
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
From 7a341a5d3cb9380e77b0241b5198373ab6fc355e Mon Sep 17 00:00:00 2001
2+
From: Charlie Li <vishwin@users.noreply.github.com>
3+
Date: Sun, 3 Oct 2021 00:20:31 -0400
4+
Subject: [PATCH] Support LibreSSL 3.4.0 (#6360)
5+
6+
* Add LibreSSL 3.4.0 to CI
7+
8+
* Add a LibreSSL 3.4.0 guard
9+
10+
Since LibreSSL 3.4.0 makes most of the TLSv1.3 API available, redefine CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 to LibreSSL versions below 3.4.0.
11+
12+
* DTLS_get_data_mtu does not exist in LibreSSL
13+
14+
* Only EVP_Digest{Sign,Verify} exist in LibreSSL 3.4.0+
15+
16+
* SSL_CTX_{set,get}_keylog_callback does not exist in LibreSSL
17+
18+
* Do not pollute CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 with LibreSSL
19+
20+
While LibreSSL 3.4.0 supports more of TLSv1.3 API, the guard redefinition caused the X448 tests to run when not intended.
21+
---
22+
.github/workflows/ci.yml | 6 ++++--
23+
src/_cffi_src/openssl/cryptography.py | 3 +++
24+
src/_cffi_src/openssl/evp.py | 15 ++++++++++-----
25+
src/_cffi_src/openssl/ssl.py | 3 ++-
26+
4 files changed, 19 insertions(+), 8 deletions(-)
27+
28+
diff --git src/_cffi_src/openssl/cryptography.py src/_cffi_src/openssl/cryptography.py
29+
index 878d22d8..821ddc9f 100644
30+
--- src/_cffi_src/openssl/cryptography.py
31+
+++ src/_cffi_src/openssl/cryptography.py
32+
@@ -36,8 +36,11 @@ INCLUDES = """
33+
#if CRYPTOGRAPHY_IS_LIBRESSL
34+
#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332 \
35+
(LIBRESSL_VERSION_NUMBER < 0x3030200f)
36+
+#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_340 \
37+
+ (LIBRESSL_VERSION_NUMBER < 0x3040000f)
38+
#else
39+
#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332 (0)
40+
+#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_340 (0)
41+
#endif
42+
43+
#define CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER \
44+
diff --git src/_cffi_src/openssl/evp.py src/_cffi_src/openssl/evp.py
45+
index ab7cfeb3..cad3339a 100644
46+
--- src/_cffi_src/openssl/evp.py
47+
+++ src/_cffi_src/openssl/evp.py
48+
@@ -203,15 +203,21 @@ int (*EVP_PKEY_set1_tls_encodedpoint)(EVP_PKEY *, const unsigned char *,
49+
size_t) = NULL;
50+
#endif
51+
52+
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_111
53+
+#if CRYPTOGRAPHY_LIBRESSL_LESS_THAN_340 || \
54+
+ (CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 && !CRYPTOGRAPHY_IS_LIBRESSL)
55+
static const long Cryptography_HAS_ONESHOT_EVP_DIGEST_SIGN_VERIFY = 0;
56+
-static const long Cryptography_HAS_RAW_KEY = 0;
57+
-static const long Cryptography_HAS_EVP_DIGESTFINAL_XOF = 0;
58+
-int (*EVP_DigestFinalXOF)(EVP_MD_CTX *, unsigned char *, size_t) = NULL;
59+
int (*EVP_DigestSign)(EVP_MD_CTX *, unsigned char *, size_t *,
60+
const unsigned char *tbs, size_t) = NULL;
61+
int (*EVP_DigestVerify)(EVP_MD_CTX *, const unsigned char *, size_t,
62+
const unsigned char *, size_t) = NULL;
63+
+#else
64+
+static const long Cryptography_HAS_ONESHOT_EVP_DIGEST_SIGN_VERIFY = 1;
65+
+#endif
66+
+
67+
+#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_111
68+
+static const long Cryptography_HAS_RAW_KEY = 0;
69+
+static const long Cryptography_HAS_EVP_DIGESTFINAL_XOF = 0;
70+
+int (*EVP_DigestFinalXOF)(EVP_MD_CTX *, unsigned char *, size_t) = NULL;
71+
EVP_PKEY *(*EVP_PKEY_new_raw_private_key)(int, ENGINE *, const unsigned char *,
72+
size_t) = NULL;
73+
EVP_PKEY *(*EVP_PKEY_new_raw_public_key)(int, ENGINE *, const unsigned char *,
74+
@@ -221,7 +227,6 @@ int (*EVP_PKEY_get_raw_private_key)(const EVP_PKEY *, unsigned char *,
75+
int (*EVP_PKEY_get_raw_public_key)(const EVP_PKEY *, unsigned char *,
76+
size_t *) = NULL;
77+
#else
78+
-static const long Cryptography_HAS_ONESHOT_EVP_DIGEST_SIGN_VERIFY = 1;
79+
static const long Cryptography_HAS_RAW_KEY = 1;
80+
static const long Cryptography_HAS_EVP_DIGESTFINAL_XOF = 1;
81+
#endif
82+
diff --git src/_cffi_src/openssl/ssl.py src/_cffi_src/openssl/ssl.py
83+
index ca275e91..0830a463 100644
84+
--- src/_cffi_src/openssl/ssl.py
85+
+++ src/_cffi_src/openssl/ssl.py
86+
@@ -678,7 +678,8 @@ int (*SSL_set_tlsext_use_srtp)(SSL *, const char *) = NULL;
87+
SRTP_PROTECTION_PROFILE * (*SSL_get_selected_srtp_profile)(SSL *) = NULL;
88+
#endif
89+
90+
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_111
91+
+#if CRYPTOGRAPHY_LIBRESSL_LESS_THAN_340 || \
92+
+ (CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 && !CRYPTOGRAPHY_IS_LIBRESSL)
93+
static const long Cryptography_HAS_TLSv1_3 = 0;
94+
static const long SSL_OP_NO_TLSv1_3 = 0;
95+
static const long SSL_VERIFY_POST_HANDSHAKE = 0;
96+
--
97+
2.32.0
98+
Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
--- setup.py.orig 2022-09-07 12:20:58 UTC
1+
--- setup.py.orig 2021-03-25 17:19:57 UTC
22
+++ setup.py
3-
@@ -13,23 +13,6 @@ import sys
3+
@@ -10,23 +10,7 @@ import sys
44

5-
from setuptools import setup
5+
from setuptools import find_packages, setup
66

77
-try:
88
- from setuptools_rust import RustExtension
@@ -12,7 +12,7 @@
1212
- =============================DEBUG ASSISTANCE==========================
1313
- If you are seeing an error here please try the following to
1414
- successfully install cryptography:
15-
-
15+
1616
- Upgrade to the latest pip and try again. This will fix errors for most
1717
- users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
1818
- =============================DEBUG ASSISTANCE==========================
@@ -24,33 +24,32 @@
2424
base_dir = os.path.dirname(__file__)
2525
src_dir = os.path.join(base_dir, "src")
2626

27-
@@ -43,20 +26,6 @@ try:
28-
cffi_modules=[
27+
@@ -41,9 +25,8 @@ with open(os.path.join(src_dir, "cryptography", "__abo
28+
29+
# `install_requirements` and `setup_requirements` must be kept in sync with
30+
# `pyproject.toml`
31+
-setuptools_rust = "setuptools-rust>=0.11.4"
32+
install_requirements = ["cffi>=1.12"]
33+
-setup_requirements = install_requirements + [setuptools_rust]
34+
+setup_requirements = install_requirements
35+
36+
if os.environ.get("CRYPTOGRAPHY_DONT_BUILD_RUST"):
37+
rust_extensions = []
38+
@@ -129,9 +112,6 @@ try:
39+
"twine >= 1.12.0",
40+
"sphinxcontrib-spelling >= 4.0.1",
41+
],
42+
- "sdist": [
43+
- setuptools_rust,
44+
- ],
45+
"pep8test": [
46+
"black",
47+
"flake8",
48+
@@ -149,7 +129,6 @@ try:
2949
"src/_cffi_src/build_openssl.py:ffi",
50+
"src/_cffi_src/build_padding.py:ffi",
3051
],
31-
- rust_extensions=[
32-
- RustExtension(
33-
- "cryptography.hazmat.bindings._rust",
34-
- "src/rust/Cargo.toml",
35-
- py_limited_api=True,
36-
- # Enable abi3 mode if we're not using PyPy.
37-
- features=(
38-
- []
39-
- if platform.python_implementation() == "PyPy"
40-
- else ["pyo3/abi3-py36"]
41-
- ),
42-
- rust_version=">=1.48.0",
43-
- )
44-
- ],
52+
- rust_extensions=rust_extensions,
4553
)
4654
except: # noqa: E722
4755
# Note: This is a bare exception that re-raises so that we don't interfere
48-
@@ -86,7 +55,7 @@ except: # noqa: E722
49-
)
50-
print(f" Python: {'.'.join(str(v) for v in sys.version_info[:3])}")
51-
print(f" platform: {platform.platform()}")
52-
- for dist in ["pip", "setuptools", "setuptools_rust"]:
53-
+ for dist in ["pip", "setuptools"]:
54-
try:
55-
version = pkg_resources.get_distribution(dist).version
56-
except pkg_resources.DistributionNotFound:

0 commit comments

Comments
 (0)