From fb24f68a0ab4ef3d895db239c2078cd4097bfb91 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Tue, 26 Nov 2019 20:21:51 +0200 Subject: [PATCH] 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 --- cloudbaseinit/utils/crypt.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cloudbaseinit/utils/crypt.py b/cloudbaseinit/utils/crypt.py index 20364383..a3950709 100644 --- a/cloudbaseinit/utils/crypt.py +++ b/cloudbaseinit/utils/crypt.py @@ -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")