--- Python-3.7.2-orig/Lib/ctypes/util.py	2018-12-23 15:37:36.000000000 -0600
+++ Python-3.7.2/Lib/ctypes/util.py	2019-01-06 18:44:31.650250202 -0600
@@ -89,6 +89,25 @@ elif sys.platform.startswith("aix"):
 
     from ctypes._aix import find_library
 
+elif sys.platform == "cygwin":
+    def find_library(name):
+        for libdir in ['/usr/lib', '/usr/local/lib']:
+            for libext in ['lib%s.dll.a' % name, 'lib%s.a' % name]:
+                implib = os.path.join(libdir, libext)
+                if not os.path.exists(implib):
+                    continue
+                cmd = "dlltool -I " + implib + " 2>/dev/null"
+                f = os.popen(cmd)
+                try:
+                    data = f.read()
+                finally:
+                    f.close()
+                res = data.replace("\n","")
+                if not res:
+                    continue
+                return res
+        return None
+
 elif os.name == "posix":
     # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
     import re, tempfile
@@ -349,6 +368,10 @@ def test():
             print(f"crypt\t:: {cdll.LoadLibrary(find_library('crypt'))}")
             print(f"crypto\t:: {find_library('crypto')}")
             print(f"crypto\t:: {cdll.LoadLibrary(find_library('crypto'))}")
+        elif sys.platform == "cygwin":
+            print(cdll.LoadLibrary("cygbz2-1.dll"))
+            print(cdll.LoadLibrary("cygcrypt-0.dll"))
+            print(find_library("crypt"))
         else:
             print(cdll.LoadLibrary("libm.so"))
             print(cdll.LoadLibrary("libcrypt.so"))
