switch to env variable based static/dynamic switch for windows
diff --git a/cryptography/hazmat/bindings/openssl/binding.py b/cryptography/hazmat/bindings/openssl/binding.py
index 6b4afe1..7305874 100644
--- a/cryptography/hazmat/bindings/openssl/binding.py
+++ b/cryptography/hazmat/bindings/openssl/binding.py
@@ -13,6 +13,7 @@
 
 from __future__ import absolute_import, division, print_function
 
+import os
 import sys
 import threading
 
@@ -97,10 +98,8 @@
         if sys.platform != "win32":
             libraries = ["crypto", "ssl"]
         else:  # pragma: no cover
-            libraries = [
-                "libeay32mt", "ssleay32mt", "advapi32",
-                "crypt32", "gdi32", "user32", "ws2_32"
-            ]
+            link_type = os.environ.get("PYCA_OPENSSL_INSTALL", "static")
+            libraries = _get_windows_libraries(link_type)
 
         cls.ffi, cls.lib = build_ffi(
             module_prefix=cls._module_prefix,
@@ -157,3 +156,15 @@
                     mode, n, file, line
                 )
             )
+
+
+def _get_windows_libraries(link_type):
+    if link_type == "dynamic":
+        return ["libeay32", "ssleay32", "advapi32"]
+    elif link_type == "static":
+        return ["libeay32mt", "ssleay32mt", "advapi32",
+                "crypt32", "gdi32", "user32", "ws2_32"]
+    else:
+        raise ValueError(
+            "PYCA_OPENSSL_INSTALL must be 'static' or 'dynamic'"
+        )
diff --git a/docs/installation.rst b/docs/installation.rst
index 56d21e7..81e150d 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -45,13 +45,25 @@
 If you prefer to compile it yourself you'll need to have OpenSSL installed.
 There are `pre-compiled binaries`_ available. If your installation is in an
 unusual location set the ``LIB`` and ``INCLUDE`` environment variables to
-include the corresponding locations. For example:
+include the corresponding locations.For example:
 
 .. code-block:: console
 
     C:\> \path\to\vcvarsall.bat x86_amd64
-    C:\> set LIB=C:\OpenSSL-1.0.1h-64bit\lib\VC\static;%LIB%
-    C:\> set INCLUDE=C:\OpenSSL-1.0.1h-64bit\include;%INCLUDE%
+    C:\> set LIB=C:\OpenSSL\lib\VC\static;C:\OpenSSL\lib;%LIB%
+    C:\> set INCLUDE=C:\OpenSSL\include;%INCLUDE%
+    C:\> pip install cryptography
+
+You can also choose to build statically or dynamically using the
+``PYCA_OPENSSL_INSTALL`` variable. Allowed values are ``static`` (default) and
+``dynamic``.
+
+.. code-block:: console
+
+    C:\> \path\to\vcvarsall.bat x86_amd64
+    C:\> set LIB=C:\OpenSSL\lib\VC\static;C:\OpenSSL\lib;%LIB%
+    C:\> set INCLUDE=C:\OpenSSL\include;%INCLUDE%
+    C:\> set PYCA_OPENSSL_INSTALL=dynamic
     C:\> pip install cryptography
 
 Building cryptography on Linux
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py
index 58d7602..84f46b2 100644
--- a/tests/hazmat/bindings/test_openssl.py
+++ b/tests/hazmat/bindings/test_openssl.py
@@ -15,7 +15,9 @@
 
 import pytest
 
-from cryptography.hazmat.bindings.openssl.binding import Binding
+from cryptography.hazmat.bindings.openssl.binding import (
+    Binding, _get_windows_libraries
+)
 
 
 class TestOpenSSL(object):
@@ -137,3 +139,11 @@
         resp = b.lib.SSL_set_mode(ssl, b.lib.SSL_OP_ALL)
         assert resp == b.lib.SSL_OP_ALL
         assert b.lib.SSL_OP_ALL == b.lib.SSL_get_mode(ssl)
+
+    def test_windows_static_dynamic_libraries(self):
+        assert len(_get_windows_libraries("static")) == 7
+
+        assert len(_get_windows_libraries("dynamic")) == 3
+
+        with pytest.raises(ValueError):
+            _get_windows_libraries("notvalid")