summaryrefslogtreecommitdiff
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-12-21 09:27:41 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2011-12-21 09:27:41 +0100
commit09527d025543447aaeb67e1da4a141fb5f596494 (patch)
tree3987b86839c76a1c4b9c9920c3fd87deff5810f1 /Modules/_ssl.c
parente0885f4b30719ef834575bcdf7fc24776af74a76 (diff)
downloadcpython-09527d025543447aaeb67e1da4a141fb5f596494.tar.gz
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 480543cbe1..02fe5f356e 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.