Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7f6a13b

Browse files
authored
[3.6] bpo-30714: ALPN changes for OpenSSL 1.1.0f (#3093)
OpenSSL 1.1.0 to 1.1.0e aborted the handshake when server and client could not agree on a protocol using ALPN. OpenSSL 1.1.0f changed that. The most recent version now behaves like OpenSSL 1.0.2 again. The ALPN callback can pretend to not been set. See openssl/openssl#3158 for more details Signed-off-by: Christian Heimes <[email protected]> (cherry picked from commit a5c1bab)
1 parent a314590 commit 7f6a13b

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

Doc/library/ssl.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,8 +1442,9 @@ to speed up repeated connections from the same clients.
14421442
This method will raise :exc:`NotImplementedError` if :data:`HAS_ALPN` is
14431443
False.
14441444

1445-
OpenSSL 1.1.0+ will abort the handshake and raise :exc:`SSLError` when
1446-
both sides support ALPN but cannot agree on a protocol.
1445+
OpenSSL 1.1.0 to 1.1.0e will abort the handshake and raise :exc:`SSLError`
1446+
when both sides support ALPN but cannot agree on a protocol. 1.1.0f+
1447+
behaves like 1.0.2, :meth:`SSLSocket.selected_alpn_protocol` returns None.
14471448

14481449
.. versionadded:: 3.5
14491450

Lib/test/test_ssl.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3258,8 +3258,9 @@ def test_alpn_protocols(self):
32583258
except ssl.SSLError as e:
32593259
stats = e
32603260

3261-
if expected is None and IS_OPENSSL_1_1:
3262-
# OpenSSL 1.1.0 raises handshake error
3261+
if (expected is None and IS_OPENSSL_1_1
3262+
and ssl.OPENSSL_VERSION_INFO < (1, 1, 0, 6)):
3263+
# OpenSSL 1.1.0 to 1.1.0e raises handshake error
32633264
self.assertIsInstance(stats, ssl.SSLError)
32643265
else:
32653266
msg = "failed trying %s (s) and %s (c).\n" \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Address ALPN callback changes for OpenSSL 1.1.0f. The latest version behaves
2+
like OpenSSL 1.0.2 and no longer aborts handshake.

0 commit comments

Comments
 (0)