diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2017-05-23 22:54:06 -0700 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-05-23 22:54:06 -0700 |
commit | 0517d1ae49061f486e2e4d279d70b6b61361de2f (patch) | |
tree | 31c3dab36869974ec9e1bc21fb2648f7ac05d621 | |
parent | a119d2eb06e0b7d7fdfd97fc725bfbcf6594f9e1 (diff) | |
download | cryptography-0517d1ae49061f486e2e4d279d70b6b61361de2f.tar.gz cryptography-0517d1ae49061f486e2e4d279d70b6b61361de2f.tar.bz2 cryptography-0517d1ae49061f486e2e4d279d70b6b61361de2f.zip |
Simplify the update (#3586)
* Simplify the update
* wtf, cant reproduce issue
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/ciphers.py | 10 |
1 files changed, 3 insertions, 7 deletions
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): |