aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-07-01 08:36:21 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-07-01 08:36:21 -0700
commitaf924ee5088af510934bb76efc6bd8ba584e68c0 (patch)
tree892429210609f880689f85ab4f1bf445cca31365
parent2159b414ea01be7721c99943d712956596a99337 (diff)
parent02de00885830b637d7614b48c7f8e8ab0d12d608 (diff)
downloadcryptography-af924ee5088af510934bb76efc6bd8ba584e68c0.tar.gz
cryptography-af924ee5088af510934bb76efc6bd8ba584e68c0.tar.bz2
cryptography-af924ee5088af510934bb76efc6bd8ba584e68c0.zip
Merge pull request #1207 from reaperhulk/rename-a-method
rename a method in the cc backend for clarity
-rw-r--r--cryptography/hazmat/backends/commoncrypto/backend.py6
-rw-r--r--cryptography/hazmat/backends/commoncrypto/ciphers.py16
-rw-r--r--tests/hazmat/backends/test_commoncrypto.py6
3 files changed, 14 insertions, 14 deletions
diff --git a/cryptography/hazmat/backends/commoncrypto/backend.py b/cryptography/hazmat/backends/commoncrypto/backend.py
index f78370c4..7bab979f 100644
--- a/cryptography/hazmat/backends/commoncrypto/backend.py
+++ b/cryptography/hazmat/backends/commoncrypto/backend.py
@@ -149,7 +149,7 @@ class Backend(object):
buf,
length
)
- self._check_response(res)
+ self._check_cipher_response(res)
return self._ffi.buffer(buf)[:]
@@ -223,7 +223,7 @@ class Backend(object):
self._lib.kCCModeRC4
)
- def _check_response(self, response):
+ def _check_cipher_response(self, response):
if response == self._lib.kCCSuccess:
return
elif response == self._lib.kCCAlignmentError:
@@ -246,7 +246,7 @@ class Backend(object):
"""
if ctx[0] != self._ffi.NULL:
res = self._lib.CCCryptorRelease(ctx[0])
- self._check_response(res)
+ self._check_cipher_response(res)
ctx[0] = self._ffi.NULL
diff --git a/cryptography/hazmat/backends/commoncrypto/ciphers.py b/cryptography/hazmat/backends/commoncrypto/ciphers.py
index 2820fd0e..525500c8 100644
--- a/cryptography/hazmat/backends/commoncrypto/ciphers.py
+++ b/cryptography/hazmat/backends/commoncrypto/ciphers.py
@@ -78,7 +78,7 @@ class _CipherContext(object):
self._backend._lib.ccNoPadding, iv_nonce,
cipher.key, len(cipher.key),
self._backend._ffi.NULL, 0, 0, mode_option, ctx)
- self._backend._check_response(res)
+ self._backend._check_cipher_response(res)
self._ctx = ctx
@@ -91,7 +91,7 @@ class _CipherContext(object):
res = self._backend._lib.CCCryptorUpdate(
self._ctx[0], data, len(data), buf,
len(data) + self._byte_block_size - 1, outlen)
- self._backend._check_response(res)
+ self._backend._check_cipher_response(res)
return self._backend._ffi.buffer(buf)[:outlen[0]]
def finalize(self):
@@ -105,7 +105,7 @@ class _CipherContext(object):
outlen = self._backend._ffi.new("size_t *")
res = self._backend._lib.CCCryptorFinal(
self._ctx[0], buf, len(buf), outlen)
- self._backend._check_response(res)
+ self._backend._check_cipher_response(res)
self._backend._release_cipher_ctx(self._ctx)
return self._backend._ffi.buffer(buf)[:outlen[0]]
@@ -143,14 +143,14 @@ class _GCMCipherContext(object):
self._backend._ffi.NULL,
cipher.key, len(cipher.key),
self._backend._ffi.NULL, 0, 0, 0, self._ctx)
- self._backend._check_response(res)
+ self._backend._check_cipher_response(res)
res = self._backend._lib.CCCryptorGCMAddIV(
self._ctx[0],
mode.initialization_vector,
len(mode.initialization_vector)
)
- self._backend._check_response(res)
+ self._backend._check_cipher_response(res)
def update(self, data):
buf = self._backend._ffi.new("unsigned char[]", len(data))
@@ -160,7 +160,7 @@ class _GCMCipherContext(object):
else:
res = self._backend._lib.CCCryptorGCMDecrypt(*args)
- self._backend._check_response(res)
+ self._backend._check_cipher_response(res)
return self._backend._ffi.buffer(buf)[:]
def finalize(self):
@@ -170,7 +170,7 @@ class _GCMCipherContext(object):
res = self._backend._lib.CCCryptorGCMFinal(
self._ctx[0], tag_buf, tag_len
)
- self._backend._check_response(res)
+ self._backend._check_cipher_response(res)
self._backend._release_cipher_ctx(self._ctx)
self._tag = self._backend._ffi.buffer(tag_buf)[:]
if (self._operation == self._backend._lib.kCCDecrypt and
@@ -184,7 +184,7 @@ class _GCMCipherContext(object):
res = self._backend._lib.CCCryptorGCMAddAAD(
self._ctx[0], data, len(data)
)
- self._backend._check_response(res)
+ self._backend._check_cipher_response(res)
@property
def tag(self):
diff --git a/tests/hazmat/backends/test_commoncrypto.py b/tests/hazmat/backends/test_commoncrypto.py
index 7c703f67..e2c6f4a0 100644
--- a/tests/hazmat/backends/test_commoncrypto.py
+++ b/tests/hazmat/backends/test_commoncrypto.py
@@ -51,13 +51,13 @@ class TestCommonCrypto(object):
from cryptography.hazmat.backends.commoncrypto.backend import backend
with pytest.raises(ValueError):
- backend._check_response(backend._lib.kCCAlignmentError)
+ backend._check_cipher_response(backend._lib.kCCAlignmentError)
with pytest.raises(InternalError):
- backend._check_response(backend._lib.kCCMemoryFailure)
+ backend._check_cipher_response(backend._lib.kCCMemoryFailure)
with pytest.raises(InternalError):
- backend._check_response(backend._lib.kCCDecodeError)
+ backend._check_cipher_response(backend._lib.kCCDecodeError)
def test_nonexistent_aead_cipher(self):
from cryptography.hazmat.backends.commoncrypto.backend import Backend