aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-01-29 16:00:18 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2014-01-29 16:00:18 -0800
commitc704ce36532784f19a88d245310c4c917c488736 (patch)
tree2a0f3cb4671820b51df7965211a4d3e576c5fbb3
parentb2ff87737ca27a171ce0034e100841782d19dd7b (diff)
parentef9d65a808d5afef3f7824cf0300aac21e7c698f (diff)
downloadcryptography-c704ce36532784f19a88d245310c4c917c488736.tar.gz
cryptography-c704ce36532784f19a88d245310c4c917c488736.tar.bz2
cryptography-c704ce36532784f19a88d245310c4c917c488736.zip
Merge pull request #532 from reaperhulk/cc-make-supported-calls-more-better
CC make supported calls more better
-rw-r--r--cryptography/hazmat/backends/commoncrypto/backend.py20
1 files changed, 3 insertions, 17 deletions
diff --git a/cryptography/hazmat/backends/commoncrypto/backend.py b/cryptography/hazmat/backends/commoncrypto/backend.py
index 4e70cab5..6a986090 100644
--- a/cryptography/hazmat/backends/commoncrypto/backend.py
+++ b/cryptography/hazmat/backends/commoncrypto/backend.py
@@ -90,20 +90,10 @@ class Backend(object):
}
def hash_supported(self, algorithm):
- try:
- self._hash_mapping[algorithm.name]
- except KeyError:
- return False
- else:
- return True
+ return algorithm.name in self._hash_mapping
def hmac_supported(self, algorithm):
- try:
- self._supported_hmac_algorithms[algorithm.name]
- except KeyError:
- return False
- else:
- return True
+ return algorithm.name in self._supported_hmac_algorithms
def create_hash_ctx(self, algorithm):
return _HashContext(self, algorithm)
@@ -112,11 +102,7 @@ class Backend(object):
return _HMACContext(self, key, algorithm)
def cipher_supported(self, cipher, mode):
- try:
- self._cipher_registry[type(cipher), type(mode)]
- except KeyError:
- return False
- return True
+ return (type(cipher), type(mode)) in self._cipher_registry
def create_symmetric_encryption_ctx(self, cipher, mode):
if isinstance(mode, GCM):