[Python-checkins] cpython: Try to really fix compilation failures of the _ssl module under very old

antoine.pitrou python-checkins at python.org
Fri Feb 17 18:51:09 CET 2012


http://hg.python.org/cpython/rev/06ed9b3f02af
changeset:   75005:06ed9b3f02af
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Fri Feb 17 18:47:54 2012 +0100
summary:
  Try to really fix compilation failures of the _ssl module under very old OpenSSLs.

files:
  Lib/ssl.py     |  6 +++++-
  Modules/_ssl.c |  6 ++++++
  2 files changed, 11 insertions(+), 1 deletions(-)


diff --git a/Lib/ssl.py b/Lib/ssl.py
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -68,12 +68,16 @@
 from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
 from _ssl import (
     OP_ALL, OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_TLSv1,
-    OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE, OP_SINGLE_ECDH_USE,
+    OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE
     )
 try:
     from _ssl import OP_NO_COMPRESSION
 except ImportError:
     pass
+try:
+    from _ssl import OP_SINGLE_ECDH_USE
+except ImportError:
+    pass
 from _ssl import RAND_status, RAND_egd, RAND_add, RAND_bytes, RAND_pseudo_bytes
 from _ssl import (
     SSL_ERROR_ZERO_RETURN,
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -145,6 +145,12 @@
 # define HAVE_OPENSSL_FINISHED 0
 #endif
 
+/* ECDH support got added to OpenSSL in 0.9.8 */
+#if OPENSSL_VERSION_NUMBER < 0x0090800fL && !defined(OPENSSL_NO_ECDH)
+# define OPENSSL_NO_ECDH
+#endif
+
+
 typedef struct {
     PyObject_HEAD
     SSL_CTX *ctx;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list