From 0e396a20c3137244b1774bd14a0cb03921ff326d Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 20 Jun 2017 18:28:38 +0200 Subject: [PATCH] bpo-30714: ALPN changes for OpenSSL 1.1.0f 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 https://github.com/openssl/openssl/pull/3158 for more details Signed-off-by: Christian Heimes --- Doc/library/ssl.rst | 5 +++-- Lib/test/test_ssl.py | 5 +++-- Misc/NEWS | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 729a239a1ba..b51b9c6e396 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1447,8 +1447,9 @@ to speed up repeated connections from the same clients. This method will raise :exc:`NotImplementedError` if :data:`HAS_ALPN` is False. - OpenSSL 1.1.0+ will abort the handshake and raise :exc:`SSLError` when - both sides support ALPN but cannot agree on a protocol. + OpenSSL 1.1.0 to 1.1.0e will abort the handshake and raise :exc:`SSLError` + when both sides support ALPN but cannot agree on a protocol. 1.1.0f+ + behaves like 1.0.2. .. versionadded:: 3.5 diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index fdaf1c52046..3215031206c 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -3267,8 +3267,9 @@ def test_alpn_protocols(self): except ssl.SSLError as e: stats = e - if expected is None and IS_OPENSSL_1_1: - # OpenSSL 1.1.0 raises handshake error + if (expected is None and IS_OPENSSL_1_1 + and ssl.OPENSSL_VERSION_INFO < (1, 1, 0, 6)): + # OpenSSL 1.1.0 to 1.1.0e raises handshake error self.assertIsInstance(stats, ssl.SSLError) else: msg = "failed trying %s (s) and %s (c).\n" \