summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLegrandin <helderijs@gmail.com>2014-04-26 09:10:19 +0200
committerDwayne Litzenberger <dlitz@dlitz.net>2014-06-22 23:47:53 -0700
commit9e2b6af8c34efba80d141490b48b82a3c2185ae5 (patch)
tree937e96e8b2d1f229b1b152f87b2db977e2776510
parentfc266f4ae9138022df4808e19c579c8a5c60f24b (diff)
downloadpycrypto-9e2b6af8c34efba80d141490b48b82a3c2185ae5.tar.gz
Make Cipher.galois module private
-rw-r--r--lib/Crypto/Cipher/blockalgo.py8
-rw-r--r--setup.py4
-rw-r--r--src/galois.c18
3 files changed, 15 insertions, 15 deletions
diff --git a/lib/Crypto/Cipher/blockalgo.py b/lib/Crypto/Cipher/blockalgo.py
index db45404..002726c 100644
--- a/lib/Crypto/Cipher/blockalgo.py
+++ b/lib/Crypto/Cipher/blockalgo.py
@@ -37,7 +37,7 @@ from Crypto.Hash import CMAC
from Crypto.Hash.CMAC import _SmoothMAC
from Crypto.Protocol.KDF import _S2V
-from Crypto.Util import galois
+from Crypto.Util import _galois
#: *Electronic Code Book (ECB)*.
#: This is the simplest encryption mode. Each of the plaintext blocks
@@ -331,9 +331,9 @@ class _GHASH(_SmoothMAC):
def __init__(self, hash_subkey, block_size):
_SmoothMAC.__init__(self, block_size, None, 0)
- self._hash_subkey = galois._ghash_expand(hash_subkey)
+ self._hash_subkey = _galois.ghash_expand(hash_subkey)
self._last_y = bchr(0) * 16
- self._mac = galois._ghash
+ self._mac = _galois.ghash
def copy(self):
clone = _GHASH(self._hash_subkey, self._bs)
@@ -342,7 +342,7 @@ class _GHASH(_SmoothMAC):
return clone
def _update(self, block_data):
- self._last_y = galois._ghash(block_data, self._last_y,
+ self._last_y = _galois.ghash(block_data, self._last_y,
self._hash_subkey)
def _digest(self, left_data):
diff --git a/setup.py b/setup.py
index 5269e9d..8099299 100644
--- a/setup.py
+++ b/setup.py
@@ -81,7 +81,7 @@ if sys.version_info[0] == 2:
else:
EXCLUDE_PY = [
# We don't want Py3k to choke on the 2.x compat code
- ('Crypto.Util', 'py21compat'),
+ ('Crypto.Util', 'py21compat'),
]
if sys.platform != "win32": # Avoid nt.py, as 2to3 can't fix it w/o winrandom
EXCLUDE_PY += [('Crypto.Random.OSRNG','nt')]
@@ -481,7 +481,7 @@ kw = {'name':"pycrypto",
Extension("Crypto.Util.cpuid",
include_dirs=['src/'],
sources=['src/cpuid.c']),
- Extension("Crypto.Util.galois",
+ Extension("Crypto.Util._galois",
include_dirs=['src/'],
sources=['src/galois.c']),
diff --git a/src/galois.c b/src/galois.c
index 0da79e6..05b91c7 100644
--- a/src/galois.c
+++ b/src/galois.c
@@ -175,7 +175,7 @@ static void ghash(
}
static char ghash_expand__doc__[] =
-"_ghash_expand(h:str) -> str\n"
+"ghash_expand(h:str) -> str\n"
"\n"
"Return an expanded GHASH key.\n";
@@ -222,7 +222,7 @@ out:
static char ghash__doc__[] =
-"_ghash(data:str, y:str, exp_key:str) -> str\n"
+"ghash(data:str, y:str, exp_key:str) -> str\n"
"\n"
"Return a GHASH.\n";
@@ -284,8 +284,8 @@ out:
*/
static PyMethodDef galois_methods[] = {
- {"_ghash_expand", ghash_expand_function, METH_VARARGS, ghash_expand__doc__},
- {"_ghash", ghash_function, METH_VARARGS, ghash__doc__},
+ {"ghash_expand", ghash_expand_function, METH_VARARGS, ghash_expand__doc__},
+ {"ghash", ghash_function, METH_VARARGS, ghash__doc__},
{NULL, NULL, 0, NULL} /* end-of-list sentinel value */
};
@@ -293,8 +293,8 @@ static PyMethodDef galois_methods[] = {
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
- "galois",
- NULL,
+ "_galois",
+ "Arithmetic in Galois Fields",
-1,
galois_methods,
NULL,
@@ -304,7 +304,7 @@ static struct PyModuleDef moduledef = {
};
PyMODINIT_FUNC
-PyInit_galois(void)
+PyInit__galois(void)
{
PyObject *m;
@@ -318,12 +318,12 @@ PyInit_galois(void)
#else
PyMODINIT_FUNC
-initgalois(void)
+init_galois(void)
{
PyObject *m;
/* Initialize the module */
- m = Py_InitModule("galois", galois_methods);
+ m = Py_InitModule("_galois", galois_methods);
if (m == NULL)
return;
}