aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-12-23 09:54:03 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-12-23 09:54:03 -0800
commitf1ca56c42a9cb6fc1e83f6c28ae941d0f0044fb9 (patch)
tree72eacb9207463b0d37c51468c6ea6d72224988b4
parent549ee710c2f6639a1b32ada798fcac198a961c7c (diff)
downloadcryptography-f1ca56c42a9cb6fc1e83f6c28ae941d0f0044fb9.tar.gz
cryptography-f1ca56c42a9cb6fc1e83f6c28ae941d0f0044fb9.tar.bz2
cryptography-f1ca56c42a9cb6fc1e83f6c28ae941d0f0044fb9.zip
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.py15
2 files changed, 9 insertions, 12 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..e7b61b72 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,9 +104,6 @@ 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;
@@ -117,8 +114,8 @@ const int Cryptography_EVP_CTRL_GCM_SET_IVLEN = -1;
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",
]
}