diff options
author | Sebastian Ramacher <sebastian@ramacher.at> | 2013-02-04 14:44:29 +0100 |
---|---|---|
committer | Dwayne Litzenberger <dlitz@dlitz.net> | 2013-04-21 20:41:18 -0700 |
commit | e1ce77b1673db76fb46d87effa7b1a1dc083d9b7 (patch) | |
tree | 3c999461384918aa9b1c2f10813db7211e2534b1 /setup.py | |
parent | 1dd8353cc490f954677285415ec01e253f84b93d (diff) | |
download | pycrypto-e1ce77b1673db76fb46d87effa7b1a1dc083d9b7.tar.gz |
Initial AES-NI support
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -162,6 +162,21 @@ class PCTBuildExt (build_ext): "Crypto.PublicKey._fastmath.") self.__remove_extensions(["Crypto.PublicKey._fastmath"]) + # Detect if we have AES-NI instrincs available + if not ac.get("HAVE_WMMINTRIN_H"): + # AES-NI instrincs not available + self.__remove_extensions(["Crypto.Cipher._AESNI"]) + elif ac.get("HAVE_MAES"): + # -maes has to be passed to the compiler to use the AES-NI instrincs + self.__add_extension_compile_option(["Crypto.Cipher._AESNI"], + ["-maes"]) + + def __add_extension_compile_option(self, names, options): + """Add compiler options for the specified extension(s)""" + for extension in self.extensions: + if extension.name in names: + extension.extra_compile_args = options + def __add_extension_link_option(self, names, options): """Add linker options for the specified extension(s)""" i = 0 @@ -426,6 +441,9 @@ kw = {'name':"pycrypto", Extension("Crypto.Cipher._AES", include_dirs=['src/'], sources=["src/AES.c"]), + Extension("Crypto.Cipher._AESNI", + include_dirs=['src/'], + sources=["src/AESNI.c"]), Extension("Crypto.Cipher._ARC2", include_dirs=['src/'], sources=["src/ARC2.c"]), @@ -454,6 +472,9 @@ kw = {'name':"pycrypto", Extension("Crypto.Util.strxor", include_dirs=['src/'], sources=['src/strxor.c']), + Extension("Crypto.Util.cpuid", + include_dirs=['src/'], + sources=['src/cpuid.c']), # Counter modules Extension("Crypto.Util._counter", |