diff options
author | Christian Heimes <cheimes@redhat.com> | 2019-06-05 14:58:18 +0200 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2019-06-05 08:58:18 -0400 |
commit | 1a868f39cb79273ca24bba8235f31ac4cf962d25 (patch) | |
tree | 4ae7b24584a4c24659699c6c561d49336c912a64 | |
parent | e41cf751e6a220923e6b82762d6c9384073a16fb (diff) | |
download | cryptography-1a868f39cb79273ca24bba8235f31ac4cf962d25.tar.gz cryptography-1a868f39cb79273ca24bba8235f31ac4cf962d25.tar.bz2 cryptography-1a868f39cb79273ca24bba8235f31ac4cf962d25.zip |
Only EVP_CTRL_AEAD_SET_TAG in _aead_setup for CCM mode (#4916)
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/aead.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/aead.py b/src/cryptography/hazmat/backends/openssl/aead.py index 1335b4f9..0cad15cc 100644 --- a/src/cryptography/hazmat/backends/openssl/aead.py +++ b/src/cryptography/hazmat/backends/openssl/aead.py @@ -49,10 +49,11 @@ def _aead_setup(backend, cipher_name, key, nonce, tag, tag_len, operation): ctx, backend._lib.EVP_CTRL_AEAD_SET_TAG, len(tag), tag ) backend.openssl_assert(res != 0) - else: + elif cipher_name.endswith(b"-ccm"): res = backend._lib.EVP_CIPHER_CTX_ctrl( ctx, backend._lib.EVP_CTRL_AEAD_SET_TAG, tag_len, backend._ffi.NULL ) + backend.openssl_assert(res != 0) nonce_ptr = backend._ffi.from_buffer(nonce) key_ptr = backend._ffi.from_buffer(key) |