Merge pull request #171 from dreid/use-currentmodule

Make use of currentmodule to maybe reduce redundant module definitions a...
diff --git a/cryptography/bindings/openssl/evp.py b/cryptography/bindings/openssl/evp.py
index 41df105..80980c6 100644
--- a/cryptography/bindings/openssl/evp.py
+++ b/cryptography/bindings/openssl/evp.py
@@ -29,6 +29,9 @@
 } EVP_PKEY;
 static const int EVP_PKEY_RSA;
 static const int EVP_PKEY_DSA;
+static const int EVP_CTRL_GCM_SET_IVLEN;
+static const int EVP_CTRL_GCM_GET_TAG;
+static const int EVP_CTRL_GCM_SET_TAG;
 """
 
 FUNCTIONS = """
@@ -84,4 +87,5 @@
 int EVP_PKEY_assign_RSA(EVP_PKEY *, RSA *);
 int EVP_PKEY_assign_DSA(EVP_PKEY *, DSA *);
 int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *);
+int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *, int, int, void *);
 """
diff --git a/cryptography/primitives/hashes.py b/cryptography/primitives/hashes.py
index 7133a91..3aa5246 100644
--- a/cryptography/primitives/hashes.py
+++ b/cryptography/primitives/hashes.py
@@ -37,7 +37,7 @@
         self._api.update_hash_context(self._ctx, data)
 
     def copy(self):
-        return self.__class__(ctx=self._copy_ctx())
+        return self.__class__(api=self._api, ctx=self._copy_ctx())
 
     def digest(self):
         return self._api.finalize_hash_context(self._copy_ctx(),
diff --git a/docs/conf.py b/docs/conf.py
index 16b1109..a368ac7 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -248,3 +248,7 @@
 
 # Example configuration for intersphinx: refer to the Python standard library.
 intersphinx_mapping = {'http://docs.python.org/': None}
+
+
+# Enable the new ReadTheDocs theme
+RTD_NEW_THEME = True
diff --git a/docs/primitives/cryptographic-hashes.rst b/docs/primitives/cryptographic-hashes.rst
index f917ab4..dcf2125 100644
--- a/docs/primitives/cryptographic-hashes.rst
+++ b/docs/primitives/cryptographic-hashes.rst
@@ -88,5 +88,5 @@
 
 .. class:: MD5()
 
-    MD5 is a deprecated cryptographic hash function. It has a 160-bit message
+    MD5 is a deprecated cryptographic hash function. It has a 128-bit message
     digest and has practical known collision attacks.
diff --git a/tests/primitives/test_hashes.py b/tests/primitives/test_hashes.py
index 03de891..4651770 100644
--- a/tests/primitives/test_hashes.py
+++ b/tests/primitives/test_hashes.py
@@ -13,10 +13,14 @@
 
 from __future__ import absolute_import, division, print_function
 
+import pretend
+
 import pytest
 
 import six
 
+from cryptography.bindings import _default_api
+
 from cryptography.primitives import hashes
 
 from .utils import generate_base_hash_test
@@ -33,6 +37,24 @@
         assert isinstance(m.hexdigest(), str)
 
 
+class TestCopyHash(object):
+    def test_copy_api_object(self):
+        pretend_api = pretend.stub(copy_hash_context=lambda a: "copiedctx")
+        pretend_ctx = pretend.stub()
+        h = hashes.SHA1(api=pretend_api, ctx=pretend_ctx)
+        assert h._api is pretend_api
+        assert h.copy()._api is h._api
+
+
+class TestDefaultAPISHA1(object):
+    def test_default_api_creation(self):
+        """
+        This test assumes the presence of SHA1 in the default API.
+        """
+        h = hashes.SHA1()
+        assert h._api is _default_api
+
+
 class TestSHA1(object):
     test_SHA1 = generate_base_hash_test(
         hashes.SHA1,