diff options
-rw-r--r-- | lib/Crypto/Cipher/AES.py | 5 | ||||
-rw-r--r-- | lib/Crypto/SelfTest/Cipher/test_AES.py | 5 | ||||
-rw-r--r-- | src/cpuid.c | 5 |
3 files changed, 12 insertions, 3 deletions
diff --git a/lib/Crypto/Cipher/AES.py b/lib/Crypto/Cipher/AES.py index 2aaaaa8..351b954 100644 --- a/lib/Crypto/Cipher/AES.py +++ b/lib/Crypto/Cipher/AES.py @@ -46,6 +46,9 @@ As an example, encryption can be done as follows: __revision__ = "$Id$" +import sys +if sys.version_info[0] == 2 and sys.version_info[1] == 1: + from Crypto.Util.py21compat import * from Crypto.Cipher import blockalgo from Crypto.Cipher import _AES from Crypto.Util import cpuid @@ -69,7 +72,7 @@ class AESCipher (blockalgo.BlockAlgo): # Check if the use_aesni was specified. use_aesni = True - if 'use_aesni' in kwargs: + if kwargs.has_key('use_aesni'): use_aesni = kwargs['use_aesni'] del kwargs['use_aesni'] diff --git a/lib/Crypto/SelfTest/Cipher/test_AES.py b/lib/Crypto/SelfTest/Cipher/test_AES.py index a675f8e..c387020 100644 --- a/lib/Crypto/SelfTest/Cipher/test_AES.py +++ b/lib/Crypto/SelfTest/Cipher/test_AES.py @@ -26,8 +26,11 @@ __revision__ = "$Id$" -from common import dict # For compatibility with Python 2.1 and 2.2 +import sys +if sys.version_info[0] == 2 and sys.version_info[1] == 1: + from Crypto.Util.py21compat import * from Crypto.Util.py3compat import * +from common import dict # For compatibility with Python 2.1 and 2.2 from binascii import hexlify # This is a list of (plaintext, ciphertext, key[, description[, params]]) tuples. diff --git a/src/cpuid.c b/src/cpuid.c index e4d8b27..5b4b405 100644 --- a/src/cpuid.c +++ b/src/cpuid.c @@ -42,6 +42,9 @@ static char have_aes_ni__doc__[] = static PyObject * have_aes_ni(PyObject *self, PyObject *args) { + if (!PyArg_ParseTuple(args, "")) + return NULL; + #ifndef HAVE_CPUID_H Py_INCREF(Py_False); return Py_False; @@ -64,7 +67,7 @@ have_aes_ni(PyObject *self, PyObject *args) */ static PyMethodDef cpuid_methods[] = { - {"have_aes_ni", have_aes_ni, METH_NOARGS, have_aes_ni__doc__}, + {"have_aes_ni", have_aes_ni, METH_VARARGS, have_aes_ni__doc__}, {NULL, NULL, 0, NULL} /* end-of-list sentinel value */ }; |