diff options
author | Ayrx <terrycwk1994@gmail.com> | 2014-04-22 18:05:04 +0800 |
---|---|---|
committer | Ayrx <terrycwk1994@gmail.com> | 2014-04-22 23:32:52 +0800 |
commit | 771fc77eb3f3e0d43471c6bde39a194bb17affbb (patch) | |
tree | c6d7ebd201f93d4824dfad6f78d1c4e63aac533b /cryptography | |
parent | 26d959668ff0a651b7637d0bad11854cc6788ee2 (diff) | |
download | cryptography-771fc77eb3f3e0d43471c6bde39a194bb17affbb.tar.gz cryptography-771fc77eb3f3e0d43471c6bde39a194bb17affbb.tar.bz2 cryptography-771fc77eb3f3e0d43471c6bde39a194bb17affbb.zip |
Added tests for multibackend
Diffstat (limited to 'cryptography')
-rw-r--r-- | cryptography/hazmat/backends/multibackend.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cryptography/hazmat/backends/multibackend.py b/cryptography/hazmat/backends/multibackend.py index b9388346..24a7a357 100644 --- a/cryptography/hazmat/backends/multibackend.py +++ b/cryptography/hazmat/backends/multibackend.py @@ -159,9 +159,15 @@ class MultiBackend(object): _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) def cmac_algorithm_supported(self, algorithm): - for b in self._filtered_backends(CMACBackend): - return b.cmac_algorithm_supported(algorithm) + return any( + b.cmac_algorithm_supported(algorithm) + for b in self._filtered_backends(CMACBackend) + ) def create_cmac_ctx(self, algorithm): for b in self._filtered_backends(CMACBackend): - return b.create_cmac_ctx(algorithm) + try: + return b.create_cmac_ctx(algorithm) + except UnsupportedAlgorithm: + pass + raise UnsupportedAlgorithm("This backend does not support CMAC") |