aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-02-05 15:44:08 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-02-05 15:44:08 -0600
commitc91f2392f9cd5b63e1d0440ce851db768944964a (patch)
treeb21a3eab441b72ef3b1f1fe5545a8895c9c32702 /cryptography
parent27864789563c90edb42772a9af1602be87029abc (diff)
parentf970eaa676eb0cd89cdb2389f03d365899812822 (diff)
downloadcryptography-c91f2392f9cd5b63e1d0440ce851db768944964a.tar.gz
cryptography-c91f2392f9cd5b63e1d0440ce851db768944964a.tar.bz2
cryptography-c91f2392f9cd5b63e1d0440ce851db768944964a.zip
Merge branch 'master' into urandom-engine
* master: PKCS #1 RSA test vector loader Removed pointless anchor Docs need virtualenv as well Everything about bash is the worst Some reST markup nonsense Fix for OS X More clearly describe the behavior of constant_time.bytes_eq Run the doc tests under OS X Made OpenSSL's derive_pbkdf2_hmac raise the right exception Document which backends implement which itnerfaces. Fixes #538 pep8 Fixed a typo in the docs Make the default backend be a multi-backend Conflicts: tests/hazmat/backends/test_openssl.py
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/hazmat/backends/__init__.py6
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py7
2 files changed, 10 insertions, 3 deletions
diff --git a/cryptography/hazmat/backends/__init__.py b/cryptography/hazmat/backends/__init__.py
index d1b95f2a..41d260a8 100644
--- a/cryptography/hazmat/backends/__init__.py
+++ b/cryptography/hazmat/backends/__init__.py
@@ -12,6 +12,7 @@
# limitations under the License.
from cryptography.hazmat.backends import openssl
+from cryptography.hazmat.backends.multibackend import MultiBackend
from cryptography.hazmat.bindings.commoncrypto.binding import (
Binding as CommonCryptoBinding
)
@@ -23,5 +24,8 @@ if CommonCryptoBinding.is_available():
_ALL_BACKENDS.append(commoncrypto.backend)
+_default_backend = MultiBackend(_ALL_BACKENDS)
+
+
def default_backend():
- return openssl.backend
+ return _default_backend
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 31ffe0d1..f4b5c3ac 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -217,8 +217,11 @@ class Backend(object):
)
assert res == 1
else:
- # OpenSSL < 1.0.0
- assert isinstance(algorithm, hashes.SHA1)
+ if not isinstance(algorithm, hashes.SHA1):
+ raise UnsupportedAlgorithm(
+ "This version of OpenSSL only supports PBKDF2HMAC with "
+ "SHA1"
+ )
res = self._lib.PKCS5_PBKDF2_HMAC_SHA1(
key_material,
len(key_material),