aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2013-12-23 11:22:05 -0800
committerDavid Reid <dreid@dreid.org>2013-12-23 11:22:05 -0800
commit84b1f534791289dd855bde72bc512ee7e47f0f79 (patch)
tree856ddd560693474321f9754b0d68b505332990ab
parent549ee710c2f6639a1b32ada798fcac198a961c7c (diff)
parent0245a9a1070b4d0834cd84aad6292238cf74cb81 (diff)
downloadcryptography-84b1f534791289dd855bde72bc512ee7e47f0f79.tar.gz
cryptography-84b1f534791289dd855bde72bc512ee7e47f0f79.tar.bz2
cryptography-84b1f534791289dd855bde72bc512ee7e47f0f79.zip
Merge pull request #336 from alex/consistent-backend
Make the naming of things in the OpenSSL backend more consistent
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py6
-rw-r--r--cryptography/hazmat/backends/openssl/evp.py21
2 files changed, 12 insertions, 15 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 3e47afa1..f11ddf22 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -345,7 +345,7 @@ class _CipherContext(object):
assert res != 0
if isinstance(mode, GCM):
res = self._backend.lib.EVP_CIPHER_CTX_ctrl(
- ctx, self._backend.lib.Cryptography_EVP_CTRL_GCM_SET_IVLEN,
+ ctx, self._backend.lib.EVP_CTRL_GCM_SET_IVLEN,
len(iv_nonce), self._backend.ffi.NULL
)
assert res != 0
@@ -354,7 +354,7 @@ class _CipherContext(object):
raise ValueError("Authentication tag must be provided and "
"be 4 bytes or longer when decrypting")
res = self._backend.lib.EVP_CIPHER_CTX_ctrl(
- ctx, self._backend.lib.Cryptography_EVP_CTRL_GCM_SET_TAG,
+ ctx, self._backend.lib.EVP_CTRL_GCM_SET_TAG,
len(mode.tag), mode.tag
)
assert res != 0
@@ -396,7 +396,7 @@ class _CipherContext(object):
block_byte_size = self._block_size // 8
tag_buf = self._backend.ffi.new("unsigned char[]", block_byte_size)
res = self._backend.lib.EVP_CIPHER_CTX_ctrl(
- self._ctx, self._backend.lib.Cryptography_EVP_CTRL_GCM_GET_TAG,
+ self._ctx, self._backend.lib.EVP_CTRL_GCM_GET_TAG,
block_byte_size, tag_buf
)
assert res != 0
diff --git a/cryptography/hazmat/backends/openssl/evp.py b/cryptography/hazmat/backends/openssl/evp.py
index 7e50a6b3..8cf96b2d 100644
--- a/cryptography/hazmat/backends/openssl/evp.py
+++ b/cryptography/hazmat/backends/openssl/evp.py
@@ -32,9 +32,9 @@ typedef struct evp_pkey_st {
} EVP_PKEY;
static const int EVP_PKEY_RSA;
static const int EVP_PKEY_DSA;
-static const int Cryptography_EVP_CTRL_GCM_SET_IVLEN;
-static const int Cryptography_EVP_CTRL_GCM_GET_TAG;
-static const int Cryptography_EVP_CTRL_GCM_SET_TAG;
+static const int EVP_CTRL_GCM_SET_IVLEN;
+static const int EVP_CTRL_GCM_GET_TAG;
+static const int EVP_CTRL_GCM_SET_TAG;
static const int Cryptography_HAS_GCM;
"""
@@ -104,21 +104,18 @@ int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *, int, int, void *);
CUSTOMIZATIONS = """
#ifdef EVP_CTRL_GCM_SET_TAG
const int Cryptography_HAS_GCM = 1;
-const int Cryptography_EVP_CTRL_GCM_GET_TAG = EVP_CTRL_GCM_GET_TAG;
-const int Cryptography_EVP_CTRL_GCM_SET_TAG = EVP_CTRL_GCM_SET_TAG;
-const int Cryptography_EVP_CTRL_GCM_SET_IVLEN = EVP_CTRL_GCM_SET_IVLEN;
#else
const int Cryptography_HAS_GCM = 0;
-const int Cryptography_EVP_CTRL_GCM_GET_TAG = -1;
-const int Cryptography_EVP_CTRL_GCM_SET_TAG = -1;
-const int Cryptography_EVP_CTRL_GCM_SET_IVLEN = -1;
+const int EVP_CTRL_GCM_GET_TAG = -1;
+const int EVP_CTRL_GCM_SET_TAG = -1;
+const int EVP_CTRL_GCM_SET_IVLEN = -1;
#endif
"""
CONDITIONAL_NAMES = {
"Cryptography_HAS_GCM": [
- "Cryptography_EVP_CTRL_GCM_GET_TAG",
- "Cryptography_EVP_CTRL_GCM_SET_TAG",
- "Cryptography_EVP_CTRL_GCM_SET_IVLEN",
+ "EVP_CTRL_GCM_GET_TAG",
+ "EVP_CTRL_GCM_SET_TAG",
+ "EVP_CTRL_GCM_SET_IVLEN",
]
}