The fallback is duplicated in eccdata.c to avoid having this file (which is built for the host) to include other target specific headers. --- ecc-internal.h | 1 + eccdata.c | 4 ++++ gmp-glue.h | 4 ++++ 3 files changed, 9 insertions(+)
diff --git a/ecc-internal.h b/ecc-internal.h index 0df8c9e..23207c7 100644 --- a/ecc-internal.h +++ b/ecc-internal.h @@ -29,6 +29,7 @@
#include "nettle-types.h" #include "ecc-curve.h" +#include "gmp-glue.h"
/* Name mangling */ #define ecc_generic_modp _nettle_ecc_generic_modp diff --git a/eccdata.c b/eccdata.c index ea922b5..a52e3ae 100644 --- a/eccdata.c +++ b/eccdata.c @@ -31,6 +31,10 @@
#include <gmp.h>
+#if __GNU_MP__ < 5 +typedef unsigned long int mp_bitcnt_t; +#endif + /* Affine coordinates, for simplicity. Infinity point represented as x == y == 0. */ struct ecc_point diff --git a/gmp-glue.h b/gmp-glue.h index e764571..ef17c2f 100644 --- a/gmp-glue.h +++ b/gmp-glue.h @@ -33,6 +33,10 @@ #define GMP_HAVE_mpz_limbs_read 0 #endif
+#if __GNU_MP__ < 5 +typedef unsigned long int mp_bitcnt_t; +#endif + /* Name mangling. */ #if !GMP_HAVE_mpz_limbs_read #define mpz_limbs_read _nettle_mpz_limbs_read