Skip to content

Commit 2e788b7

Browse files
committed
parent 7f3e4f9
author julianz- <[email protected]> 1692386750 -0700 committer julianz- <[email protected]> 1706310924 -0800 fix for problem caused by SSL_WANT_READ or SSL_WANT_WRITE errors. When SSL_WANT_READ or SSL_WANT_WRITE are encountered, it's typical to retry the call but this must be repeated with the exact same arguments. Without this change, openSSL requires that the address of the buffer passed is the same. However, buffers in python can change location in some circumstances which cause the retry to fail. By add the setting SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER, the requirement for the same buffer address is forgiven and the retry has a better chance of success. See cherrypy/cheroot#245 for discussion.
1 parent 4fcf1a8 commit 2e788b7

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

CHANGELOG.rst

+16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ Changelog
44
Versions are year-based with a strict backward-compatibility policy.
55
The third digit is only for regressions.
66

7+
24.1.0 (UNRELEASED)
8+
-------------------
9+
Backward-incompatible changes:
10+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11+
12+
- ``pyOpenSSL`` now sets ``SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER`` by default, matching CPython's behavior. `#1287 <https://github.com/pyca/pyopenssl/pull/1287>`_.
13+
- The minimum ``cryptography`` version is now 42.0.0.
14+
15+
Deprecations:
16+
^^^^^^^^^^^^^
17+
18+
Changes:
19+
^^^^^^^^
20+
21+
22+
723
24.0.0 (2024-01-22)
824
-------------------
925

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def find_meta(meta):
9393
packages=find_packages(where="src"),
9494
package_dir={"": "src"},
9595
install_requires=[
96-
"cryptography>=41.0.5,<43",
96+
"cryptography>=42.0.0,<43",
9797
],
9898
extras_require={
9999
"test": ["flaky", "pretend", "pytest>=3.0.1"],

src/OpenSSL/SSL.py

+5-14
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,11 @@
163163
DTLS_SERVER_METHOD = 11
164164
DTLS_CLIENT_METHOD = 12
165165

166-
try:
167-
SSL3_VERSION = _lib.SSL3_VERSION
168-
TLS1_VERSION = _lib.TLS1_VERSION
169-
TLS1_1_VERSION = _lib.TLS1_1_VERSION
170-
TLS1_2_VERSION = _lib.TLS1_2_VERSION
171-
TLS1_3_VERSION = _lib.TLS1_3_VERSION
172-
except AttributeError:
173-
# Hardcode constants for cryptography < 3.4, see
174-
# https://github.com/pyca/pyopenssl/pull/985#issuecomment-775186682
175-
SSL3_VERSION = 768
176-
TLS1_VERSION = 769
177-
TLS1_1_VERSION = 770
178-
TLS1_2_VERSION = 771
179-
TLS1_3_VERSION = 772
166+
SSL3_VERSION = _lib.SSL3_VERSION
167+
TLS1_VERSION = _lib.TLS1_VERSION
168+
TLS1_1_VERSION = _lib.TLS1_1_VERSION
169+
TLS1_2_VERSION = _lib.TLS1_2_VERSION
170+
TLS1_3_VERSION = _lib.TLS1_3_VERSION
180171

181172
OP_NO_SSLv2 = _lib.SSL_OP_NO_SSLv2
182173
OP_NO_SSLv3 = _lib.SSL_OP_NO_SSLv3

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extras =
1818
test
1919
deps =
2020
coverage>=4.2
21-
cryptographyMinimum: cryptography==41.0.5
21+
cryptographyMinimum: cryptography==42.0.0
2222
randomorder: pytest-randomly
2323
setenv =
2424
# Do not allow the executing environment to pollute the test environment

0 commit comments

Comments
 (0)