utils: Fix for OpenSSL library name change

In OpenSSL 1.1.0 the name of the library was changed
from libeay32 to libcrypto.

Keeping the old name for backward compatibility.

https://cryptography.io/en/latest/installation/#building-cryptography-on-windows

Change-Id: I3ad8089ea92744b2798622767ce79a504e1baafa
This commit is contained in:
Adrian Vladu 2019-11-26 20:21:51 +02:00 committed by Madalin
parent aebec0f5cb
commit fb24f68a0a

View File

@ -26,7 +26,12 @@ if sys.platform == "win32":
else:
clib = ctypes.cdll.ucrtbase
openssl = ctypes.cdll.libeay32
# Note(mbivolan): The library name has changed in OpenSSL 1.1.0
# Keeping the old name for backward compatibility
try:
openssl = ctypes.cdll.libeay32
except Exception:
openssl = ctypes.cdll.libcrypto
else:
clib = ctypes.CDLL(clib_path)
openssl_lib_path = ctypes.util.find_library("ssl")