diff options
author | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2011-10-10 19:14:30 -0400 |
---|---|---|
committer | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2011-10-10 19:15:50 -0400 |
commit | 323ce9ef951378dc96ce14c9e514e9aa19ab39d9 (patch) | |
tree | 5986ee1d95f37cdb4605b5b4899667747ae40dfc /src | |
parent | 32114297da2450af00c4612596bc15da4f6256f2 (diff) | |
download | pycrypto-323ce9ef951378dc96ce14c9e514e9aa19ab39d9.tar.gz |
Fix libgmp/libmpir autodetection
Diffstat (limited to 'src')
-rw-r--r-- | src/_fastmath.c | 10 | ||||
-rw-r--r-- | src/config.h.in | 7 | ||||
-rw-r--r-- | src/inc-msvc/config.h | 12 |
3 files changed, 24 insertions, 5 deletions
diff --git a/src/_fastmath.c b/src/_fastmath.c index f8e6f6a..eff3e29 100644 --- a/src/_fastmath.c +++ b/src/_fastmath.c @@ -31,15 +31,21 @@ #include "Python.h" #include "pycrypto_compat.h" #include <longintrepr.h> /* for conversions */ -#include <gmp.h> #include "config.h" +#if HAVE_LIBGMP +# include <gmp.h> +#elif HAVE_LIBMPIR +# include <mpir.h> +#else +# error "Neither HAVE_LIBGMP nor HAVE_LIBMPIR are set. Can't build." +#endif /* If available, use mpz_powm_sec to avoid timing attacks. * See the talk by Geremy Condra - * "PyCon 2011: Through the Side Channel: Timing and Implementation Attacks in Python" * http://blip.tv/pycon-us-videos-2009-2010-2011/pycon-2011-through-the-side-channel-timing-and-implementation-attacks-in-python-4897955 */ -#if HAVE_DECL_MPZ_POWM_SEC == 1 +#if HAVE_DECL_MPZ_POWM_SEC #define MPZ_POWM mpz_powm_sec #else #define MPZ_POWM mpz_powm diff --git a/src/config.h.in b/src/config.h.in index b71dd4e..514c060 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -11,8 +11,11 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H -/* Define to 1 if you have the `' library (-l). */ -#undef HAVE_LIB +/* Define to 1 if you have the `gmp' library (-lgmp). */ +#undef HAVE_LIBGMP + +/* Define to 1 if you have the `mpir' library (-lmpir). */ +#undef HAVE_LIBMPIR /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H diff --git a/src/inc-msvc/config.h b/src/inc-msvc/config.h index 19ced1d..aa42a7b 100644 --- a/src/inc-msvc/config.h +++ b/src/inc-msvc/config.h @@ -1,3 +1,13 @@ +/* Define to 1 if you have the declaration of `mpz_powm', and to 0 if you + don't. */ +#undef HAVE_DECL_MPZ_POWM + /* Define to 1 if you have the declaration of `mpz_powm_sec', and to 0 if you don't. */ -#define HAVE_DECL_MPZ_POWM_SEC 0 +#undef HAVE_DECL_MPZ_POWM_SEC + +/* Define to 1 if you have the `gmp' library (-lgmp). */ +#undef HAVE_LIBGMP + +/* Define to 1 if you have the `mpir' library (-lmpir). */ +#undef HAVE_LIBMPIR |