Skip to content

Commit

Permalink
OpenSSL 1.1.0 compatibility fixes
Browse files Browse the repository at this point in the history
- function check missed 1.1.0 release
- TLS didn't work with anonymous ciphers
  • Loading branch information
PeterSurda committed Jan 14, 2017
1 parent 6247e1d commit 59b5ac3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/protocol.py
Expand Up @@ -495,3 +495,9 @@ def broadcastToSendDataQueues(data):
# this means TLSv1, there is no way to set "TLSv1 or higher" or
# "TLSv1.2" in < 2.7.9
sslProtocolVersion = ssl.PROTOCOL_TLSv1

# ciphers
if ssl.OPENSSL_VERSION_NUMBER >= 0x10100000
sslProtocolCiphers = "AECDH-AES256-SHA@SECLEVEL=0"
else:
sslProtocolCiphers = "AECDH-AES256-SHA"
6 changes: 3 additions & 3 deletions src/pyelliptic/openssl.py
Expand Up @@ -170,7 +170,7 @@ def __init__(self, library):
self.EC_KEY_set_private_key.argtypes = [ctypes.c_void_p,
ctypes.c_void_p]

if self._hexversion > 0x10100000:
if self._hexversion >= 0x10100000:
self.EC_KEY_OpenSSL = self._lib.EC_KEY_OpenSSL
self._lib.EC_KEY_OpenSSL.restype = ctypes.c_void_p
self._lib.EC_KEY_OpenSSL.argtypes = []
Expand Down Expand Up @@ -250,7 +250,7 @@ def __init__(self, library):
self.EVP_rc4.restype = ctypes.c_void_p
self.EVP_rc4.argtypes = []

if self._hexversion > 0x10100000:
if self._hexversion >= 0x10100000:
self.EVP_CIPHER_CTX_reset = self._lib.EVP_CIPHER_CTX_reset
self.EVP_CIPHER_CTX_reset.restype = ctypes.c_int
self.EVP_CIPHER_CTX_reset.argtypes = [ctypes.c_void_p]
Expand Down Expand Up @@ -306,7 +306,7 @@ def __init__(self, library):
self.ECDSA_verify.argtypes = [ctypes.c_int, ctypes.c_void_p,
ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p]

if self._hexversion > 0x10100000:
if self._hexversion >= 0x10100000:
self.EVP_MD_CTX_new = self._lib.EVP_MD_CTX_new
self.EVP_MD_CTX_new.restype = ctypes.c_void_p
self.EVP_MD_CTX_new.argtypes = []
Expand Down

0 comments on commit 59b5ac3

Please sign in to comment.