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

Skip to content

Commit 7b40cb7

Browse files
authored
bpo-30714: ALPN changes for OpenSSL 1.1.0f (#2305)
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]>
1 parent 2f89646 commit 7b40cb7

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
@@ -1447,8 +1447,9 @@ to speed up repeated connections from the same clients.
14471447
This method will raise :exc:`NotImplementedError` if :data:`HAS_ALPN` is
14481448
False.
14491449

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

14531454
.. versionadded:: 3.5
14541455

Lib/test/test_ssl.py

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

3271-
if expected is None and IS_OPENSSL_1_1:
3272-
# OpenSSL 1.1.0 raises handshake error
3271+
if (expected is None and IS_OPENSSL_1_1
3272+
and ssl.OPENSSL_VERSION_INFO < (1, 1, 0, 6)):
3273+
# OpenSSL 1.1.0 to 1.1.0e raises handshake error
32733274
self.assertIsInstance(stats, ssl.SSLError)
32743275
else:
32753276
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)