diff options
author | Austin Seipp <austin@well-typed.com> | 2014-02-26 16:18:20 -0600 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-02-26 16:18:20 -0600 |
commit | 4775d0060a7027196f7c5dd521d5754080667a84 (patch) | |
tree | a197a5951489216f606fff2e594f2eafcc90e05c /libraries/integer-gmp/cbits | |
parent | bcd38ea7f97cc3a3ed192bc0666c816c027bd9fc (diff) | |
download | haskell-4775d0060a7027196f7c5dd521d5754080667a84.tar.gz |
Fix GMP v4 compatibility.
We had started relying on GMP 5.x (for usage of mpz_powm_sec), but this
is pretty painful on RHEL-esque targets, which still use GMP 4.x.
In the mean time while we're still supporting this, it's easier to just
fallback to mpz_powm when _sec is unavailable, and emit a WARNING for
using the primitive.
This also installs a header, HsIntegerGmp.h, which clients could use for
a fallback.
As a side note, this will probably also help Debian oldstable users who
might have outdated GMP versions (which I believe is the cause for #8666.)
Reviewed-by: Herbert Valerio Riedel <hvr@gnu.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'libraries/integer-gmp/cbits')
-rw-r--r-- | libraries/integer-gmp/cbits/gmp-wrappers.cmm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libraries/integer-gmp/cbits/gmp-wrappers.cmm b/libraries/integer-gmp/cbits/gmp-wrappers.cmm index 4c7df574e7..a5652511bd 100644 --- a/libraries/integer-gmp/cbits/gmp-wrappers.cmm +++ b/libraries/integer-gmp/cbits/gmp-wrappers.cmm @@ -27,6 +27,7 @@ #include "Cmm.h" #include "GmpDerivedConstants.h" +#include "HsIntegerGmp.h" import "integer-gmp" __gmpz_add; import "integer-gmp" __gmpz_add_ui; @@ -61,7 +62,9 @@ import "integer-gmp" __gmpz_ior; import "integer-gmp" __gmpz_com; import "integer-gmp" __gmpz_pow_ui; import "integer-gmp" __gmpz_powm; +#if HAVE_SECURE_POWM == 1 import "integer-gmp" __gmpz_powm_sec; +#endif import "integer-gmp" __gmpz_invert; import "integer-gmp" __gmpz_nextprime; import "integer-gmp" __gmpz_probab_prime_p; @@ -629,7 +632,12 @@ GMP_TAKE2_RET2(integer_cmm_divModIntegerzh, __gmpz_fdiv_qr) GMP_TAKE1_UL1_RET2(integer_cmm_divModIntegerWordzh, __gmpz_fdiv_qr_ui) GMP_TAKE3_RET1(integer_cmm_powModIntegerzh, __gmpz_powm) +#if HAVE_SECURE_POWM == 1 GMP_TAKE3_RET1(integer_cmm_powModSecIntegerzh, __gmpz_powm_sec) +#else +GMP_TAKE3_RET1(integer_cmm_powModSecIntegerzh, __gmpz_powm) +#endif + GMP_TAKE2_RET1(integer_cmm_recipModIntegerzh, __gmpz_invert) GMP_TAKE1_UL1_RET1(integer_cmm_powIntegerzh, __gmpz_pow_ui) |