aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2013-11-05 12:59:37 -0800
committerDavid Reid <dreid@dreid.org>2013-11-20 09:50:18 -0800
commit077e76e697ebf25aa9fd757f0ef1fd1251b7d408 (patch)
tree63f5d48206bee9575459ce604e3afde46910fe76 /cryptography
parenteb7f2a37fee0fdeb70f650b46f580b2eab6d0c05 (diff)
downloadcryptography-077e76e697ebf25aa9fd757f0ef1fd1251b7d408.tar.gz
cryptography-077e76e697ebf25aa9fd757f0ef1fd1251b7d408.tar.bz2
cryptography-077e76e697ebf25aa9fd757f0ef1fd1251b7d408.zip
Explicit backend
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/hazmat/primitives/ciphers/base.py7
-rw-r--r--cryptography/hazmat/primitives/hashes.py6
-rw-r--r--cryptography/hazmat/primitives/hmac.py8
3 files changed, 4 insertions, 17 deletions
diff --git a/cryptography/hazmat/primitives/ciphers/base.py b/cryptography/hazmat/primitives/ciphers/base.py
index 3d733afc..48e6da6f 100644
--- a/cryptography/hazmat/primitives/ciphers/base.py
+++ b/cryptography/hazmat/primitives/ciphers/base.py
@@ -19,12 +19,7 @@ from cryptography.hazmat.primitives import interfaces
class Cipher(object):
- def __init__(self, algorithm, mode, backend=None):
- if backend is None:
- from cryptography.hazmat.bindings import (
- _default_backend as backend,
- )
-
+ def __init__(self, algorithm, mode, backend):
if not isinstance(algorithm, interfaces.CipherAlgorithm):
raise TypeError("Expected interface of interfaces.CipherAlgorithm")
diff --git a/cryptography/hazmat/primitives/hashes.py b/cryptography/hazmat/primitives/hashes.py
index 93fc8c42..bee188b3 100644
--- a/cryptography/hazmat/primitives/hashes.py
+++ b/cryptography/hazmat/primitives/hashes.py
@@ -22,15 +22,11 @@ from cryptography.hazmat.primitives import interfaces
@utils.register_interface(interfaces.HashContext)
class Hash(object):
- def __init__(self, algorithm, backend=None, ctx=None):
+ def __init__(self, algorithm, backend, ctx=None):
if not isinstance(algorithm, interfaces.HashAlgorithm):
raise TypeError("Expected instance of interfaces.HashAlgorithm.")
self.algorithm = algorithm
- if backend is None:
- from cryptography.hazmat.bindings import _default_backend
- backend = _default_backend
-
self._backend = backend
if ctx is None:
diff --git a/cryptography/hazmat/primitives/hmac.py b/cryptography/hazmat/primitives/hmac.py
index 08dfae01..2bd8e4d3 100644
--- a/cryptography/hazmat/primitives/hmac.py
+++ b/cryptography/hazmat/primitives/hmac.py
@@ -22,15 +22,11 @@ from cryptography.hazmat.primitives import interfaces
@utils.register_interface(interfaces.HashContext)
class HMAC(object):
- def __init__(self, key, algorithm, ctx=None, backend=None):
+ def __init__(self, key, algorithm, backend, ctx=None):
if not isinstance(algorithm, interfaces.HashAlgorithm):
raise TypeError("Expected instance of interfaces.HashAlgorithm.")
self.algorithm = algorithm
- if backend is None:
- from cryptography.hazmat.bindings import _default_backend
- backend = _default_backend
-
self._backend = backend
self._key = key
if ctx is None:
@@ -51,7 +47,7 @@ class HMAC(object):
return HMAC(
self._key,
self.algorithm,
- backend=self._backend,
+ self._backend,
ctx=self._ctx.copy()
)