From 0517d1ae49061f486e2e4d279d70b6b61361de2f Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 23 May 2017 22:54:06 -0700 Subject: Simplify the update (#3586) * Simplify the update * wtf, cant reproduce issue --- src/cryptography/hazmat/backends/openssl/ciphers.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/cryptography/hazmat/backends/openssl/ciphers.py b/src/cryptography/hazmat/backends/openssl/ciphers.py index cfd6c1b5..13c9fa52 100644 --- a/src/cryptography/hazmat/backends/openssl/ciphers.py +++ b/src/cryptography/hazmat/backends/openssl/ciphers.py @@ -112,13 +112,9 @@ class _CipherContext(object): self._ctx = ctx def update(self, data): - buf = self._backend._ffi.new("unsigned char[]", - len(data) + self._block_size_bytes - 1) - outlen = self._backend._ffi.new("int *") - res = self._backend._lib.EVP_CipherUpdate(self._ctx, buf, outlen, data, - len(data)) - self._backend.openssl_assert(res != 0) - return self._backend._ffi.buffer(buf)[:outlen[0]] + buf = bytearray(len(data) + self._block_size_bytes - 1) + n = self.update_into(data, buf) + return bytes(buf[:n]) def update_into(self, data, buf): if len(buf) < (len(data) + self._block_size_bytes - 1): -- cgit v1.2.3