-libcrypto = CDLL("libcrypto.so.1.0.0")
-libcrypto.OPENSSL_config.argtypes=(c_char_p,)
+if sys.platform.startswith('win'):
+ __libname__ = find_library('libeay32')
+else:
+ __libname__ = find_library('crypto')
+
+if __libname__ is None:
+ raise OSError("Cannot find OpenSSL crypto library")
+
+libcrypto = CDLL(__libname__)
+libcrypto.OPENSSL_config.argtypes = (c_char_p, )