summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-12-21 08:27:41 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-12-21 08:27:41 (GMT)
commit501da61671f88032cfde9b81060ddd82d22bf8ec (patch)
treef44c4c48aa3fe76eb688ccdf6639507d629c3036 /Modules/_ssl.c
parent822c790527eb4601e7303199ad78be4c9eb9bb72 (diff)
downloadcpython-501da61671f88032cfde9b81060ddd82d22bf8ec.zip
cpython-501da61671f88032cfde9b81060ddd82d22bf8ec.tar.gz
cpython-501da61671f88032cfde9b81060ddd82d22bf8ec.tar.bz2
Fix ssl module compilation if ECDH support was disabled in the OpenSSL build.
(followup to issue #13627)
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 480543c..02fe5f3 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2006,6 +2006,7 @@ set_default_verify_paths(PySSLContext *self, PyObject *unused)
Py_RETURN_NONE;
}
+#ifndef OPENSSL_NO_ECDH
static PyObject *
set_ecdh_curve(PySSLContext *self, PyObject *name)
{
@@ -2032,6 +2033,7 @@ set_ecdh_curve(PySSLContext *self, PyObject *name)
EC_KEY_free(key);
Py_RETURN_NONE;
}
+#endif
static PyGetSetDef context_getsetlist[] = {
{"options", (getter) get_options,
@@ -2054,8 +2056,10 @@ static struct PyMethodDef context_methods[] = {
METH_NOARGS, NULL},
{"set_default_verify_paths", (PyCFunction) set_default_verify_paths,
METH_NOARGS, NULL},
+#ifndef OPENSSL_NO_ECDH
{"set_ecdh_curve", (PyCFunction) set_ecdh_curve,
METH_O, NULL},
+#endif
{NULL, NULL} /* sentinel */
};
@@ -2523,6 +2527,14 @@ PyInit__ssl(void)
Py_INCREF(r);
PyModule_AddObject(m, "HAS_TLS_UNIQUE", r);
+#ifdef OPENSSL_NO_ECDH
+ r = Py_False;
+#else
+ r = Py_True;
+#endif
+ Py_INCREF(r);
+ PyModule_AddObject(m, "HAS_ECDH", r);
+
/* OpenSSL version */
/* SSLeay() gives us the version of the library linked against,
which could be different from the headers version.