aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@davidben.net>2018-05-12 15:07:21 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2018-05-12 15:07:21 -0400
commit590692fe6a071b3c694ae8966b84b45ece9b1a07 (patch)
tree9a41ccdca9bcb0feeffe172c2827f288ed28342d
parent617825d026a933e355d644ba12a408c63b8fb20f (diff)
downloadcryptography-590692fe6a071b3c694ae8966b84b45ece9b1a07.tar.gz
cryptography-590692fe6a071b3c694ae8966b84b45ece9b1a07.tar.bz2
cryptography-590692fe6a071b3c694ae8966b84b45ece9b1a07.zip
Check for CMAC_Init errors. (#4232)
-rw-r--r--src/cryptography/hazmat/backends/openssl/cmac.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/cmac.py b/src/cryptography/hazmat/backends/openssl/cmac.py
index 5919017a..e20f66d3 100644
--- a/src/cryptography/hazmat/backends/openssl/cmac.py
+++ b/src/cryptography/hazmat/backends/openssl/cmac.py
@@ -36,10 +36,11 @@ class _CMACContext(object):
self._backend.openssl_assert(ctx != self._backend._ffi.NULL)
ctx = self._backend._ffi.gc(ctx, self._backend._lib.CMAC_CTX_free)
- self._backend._lib.CMAC_Init(
+ res = self._backend._lib.CMAC_Init(
ctx, self._key, len(self._key),
evp_cipher, self._backend._ffi.NULL
)
+ self._backend.openssl_assert(res == 1)
self._ctx = ctx