summaryrefslogtreecommitdiffstats
path: root/Lib
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 /Lib
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 'Lib')
-rw-r--r--Lib/ssl.py2
-rw-r--r--Lib/test/test_ssl.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index 0b2f743..d43d255 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -86,7 +86,7 @@ from _ssl import (
SSL_ERROR_EOF,
SSL_ERROR_INVALID_ERROR_CODE,
)
-from _ssl import HAS_SNI
+from _ssl import HAS_SNI, HAS_ECDH
from _ssl import (PROTOCOL_SSLv3, PROTOCOL_SSLv23,
PROTOCOL_TLSv1)
from _ssl import _OPENSSL_API_VERSION
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 8bbe0f7..1960e14 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -103,6 +103,7 @@ class BasicSocketTests(unittest.TestCase):
if ssl.OPENSSL_VERSION_INFO >= (1, 0):
ssl.OP_NO_COMPRESSION
self.assertIn(ssl.HAS_SNI, {True, False})
+ self.assertIn(ssl.HAS_ECDH, {True, False})
def test_random(self):
v = ssl.RAND_status()
@@ -561,6 +562,7 @@ class ContextTests(unittest.TestCase):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
ctx.set_default_verify_paths()
+ @unittest.skipUnless(ssl.HAS_ECDH, "ECDH disabled on this OpenSSL build")
def test_set_ecdh_curve(self):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
ctx.set_ecdh_curve("prime256v1")