Commit 0d63669e authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Miss Islington (bot)

[2.7] bpo-35264: Modules/_ssl.c: fix build with OpenSSL 1.1.0 (GH-10570)



Fixes a build error with OpenSSL 1.1.0. There is already code in the
`_ssl.c` that handles all the weird cases of the NPN config macros (with
various OpenSSL & LibreSSL versions).
That code will provide a HAVE_NPN variable, which should be used in the
rest of the code to check whether (or what) to compile regarding NPN.

This change adds HAVE_NPN in the remaining places where it should have been
placed.
Signed-off-by: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>


https://bugs.python.org/issue35264
parent f9db011c
...@@ -1590,7 +1590,7 @@ static PyObject *PySSL_version(PySSLSocket *self) ...@@ -1590,7 +1590,7 @@ static PyObject *PySSL_version(PySSLSocket *self)
return PyUnicode_FromString(version); return PyUnicode_FromString(version);
} }
#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) #if HAVE_NPN
static PyObject *PySSL_selected_npn_protocol(PySSLSocket *self) { static PyObject *PySSL_selected_npn_protocol(PySSLSocket *self) {
const unsigned char *out; const unsigned char *out;
unsigned int outlen; unsigned int outlen;
...@@ -2118,7 +2118,7 @@ static PyMethodDef PySSLMethods[] = { ...@@ -2118,7 +2118,7 @@ static PyMethodDef PySSLMethods[] = {
PySSL_peercert_doc}, PySSL_peercert_doc},
{"cipher", (PyCFunction)PySSL_cipher, METH_NOARGS}, {"cipher", (PyCFunction)PySSL_cipher, METH_NOARGS},
{"version", (PyCFunction)PySSL_version, METH_NOARGS}, {"version", (PyCFunction)PySSL_version, METH_NOARGS},
#ifdef OPENSSL_NPN_NEGOTIATED #if HAVE_NPN
{"selected_npn_protocol", (PyCFunction)PySSL_selected_npn_protocol, METH_NOARGS}, {"selected_npn_protocol", (PyCFunction)PySSL_selected_npn_protocol, METH_NOARGS},
#endif #endif
#if HAVE_ALPN #if HAVE_ALPN
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment