summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorMelvyn Sopacua <melvyn-sopacua@users.noreply.github.com>2017-09-04 21:35:15 (GMT)
committerChristian Heimes <christian@python.org>2017-09-04 21:35:15 (GMT)
commitb2d096bd2a5ff86e53c25d00ee5fa097b36bf1d8 (patch)
treefd4406a8c07c523d5d5b13a8a5563c697b48f001 /Modules/clinic
parent973b901212bd84d279904bab6654709f4ec32470 (diff)
downloadcpython-b2d096bd2a5ff86e53c25d00ee5fa097b36bf1d8.zip
cpython-b2d096bd2a5ff86e53c25d00ee5fa097b36bf1d8.tar.gz
cpython-b2d096bd2a5ff86e53c25d00ee5fa097b36bf1d8.tar.bz2
bpo-30622: Change NPN detection: (#2079)
* Change NPN detection: Version breakdown, support disabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will be defined -> True/False Version breakdown support enabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True * Refine NPN guard: - If NPN is disabled, but ALPN is available we need our callback - Make clinic's ssl behave the same way This created a working ssl module for me, with NPN disabled and ALPN enabled for OpenSSL 1.1.0f. Concerns to address: The initial commit for NPN support into OpenSSL [1], had the OPENSSL_NPN_* variables defined inside the OPENSSL_NO_NEXTPROTONEG guard. The question is if that ever made it into a release. This would need an ugly hack, something like: #if defined(OPENSSL_NO_NEXTPROTONEG) && \ !defined(OPENSSL_NPN_NEGOTIATED) # define OPENSSL_NPN_UNSUPPORTED 0 # define OPENSSL_NPN_NEGOTIATED 1 # define OPENSSL_NPN_NO_OVERLAP 2 #endif [1] https://github.com/openssl/openssl/commit/68b33cc5c7
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/_ssl.c.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h
index ac205f6..fa4f7e2 100644
--- a/Modules/clinic/_ssl.c.h
+++ b/Modules/clinic/_ssl.c.h
@@ -132,7 +132,7 @@ _ssl__SSLSocket_version(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
return _ssl__SSLSocket_version_impl(self);
}
-#if defined(OPENSSL_NPN_NEGOTIATED)
+#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG)
PyDoc_STRVAR(_ssl__SSLSocket_selected_npn_protocol__doc__,
"selected_npn_protocol($self, /)\n"
@@ -151,7 +151,7 @@ _ssl__SSLSocket_selected_npn_protocol(PySSLSocket *self, PyObject *Py_UNUSED(ign
return _ssl__SSLSocket_selected_npn_protocol_impl(self);
}
-#endif /* defined(OPENSSL_NPN_NEGOTIATED) */
+#endif /* defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) */
#if defined(HAVE_ALPN)