diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ecc-mul-a.c | 6 | ||||
-rw-r--r-- | ecc-mul-g.c | 4 | ||||
-rw-r--r-- | eccdata.c | 4 | ||||
-rw-r--r-- | sec-modinv.c | 4 |
5 files changed, 19 insertions, 5 deletions
@@ -1,5 +1,11 @@ 2013-04-11 Niels Möller <nisse@lysator.liu.se> + * ecc-mul-a.c (ecc_mul_a): Avoid using mp_bitcnt_t, for + compatibility with older GMP versions. + * ecc-mul-g.c (ecc_mul_g): Likewise. + * eccdata.c (ecc_mul_binary): Likewise. + * sec-modinv.c (sec_modinv): Likewise. + * x86_64/sha3-permute.asm: Go via memory for moves between general registers and xmm registers. diff --git a/ecc-mul-a.c b/ecc-mul-a.c index b23bdc5d..7a537bf6 100644 --- a/ecc-mul-a.c +++ b/ecc-mul-a.c @@ -122,8 +122,10 @@ ecc_mul_a (const struct ecc_curve *ecc, mp_limb_t *scratch_out = table + (3*ecc->size << ECC_MUL_A_WBITS); int is_zero = 0; - mp_bitcnt_t blocks = (ecc->bit_size + ECC_MUL_A_WBITS - 1) / ECC_MUL_A_WBITS; - mp_bitcnt_t bit_index = (blocks-1) * ECC_MUL_A_WBITS; + /* Avoid the mp_bitcnt_t type for compatibility with older GMP + versions. */ + unsigned blocks = (ecc->bit_size + ECC_MUL_A_WBITS - 1) / ECC_MUL_A_WBITS; + unsigned bit_index = (blocks-1) * ECC_MUL_A_WBITS; mp_size_t limb_index = bit_index / GMP_NUMB_BITS; unsigned shift = bit_index % GMP_NUMB_BITS; diff --git a/ecc-mul-g.c b/ecc-mul-g.c index d95e518d..8e41c110 100644 --- a/ecc-mul-g.c +++ b/ecc-mul-g.c @@ -66,7 +66,9 @@ ecc_mul_g (const struct ecc_curve *ecc, mp_limb_t *r, for (j = 0; j * c < bit_rows; j++) { unsigned bits; - mp_bitcnt_t bit_index; + /* Avoid the mp_bitcnt_t type for compatibility with older GMP + versions. */ + unsigned bit_index; /* Extract c bits from n, stride k, starting at i + kcj, ending at i + k (cj + c - 1)*/ @@ -219,7 +219,9 @@ static void ecc_mul_binary (const struct ecc_curve *ecc, struct ecc_point *r, const mpz_t n, const struct ecc_point *p) { - mp_bitcnt_t k; + /* Avoid the mp_bitcnt_t type for compatibility with older GMP + versions. */ + unsigned k; assert (r != p); assert (mpz_sgn (n) > 0); diff --git a/sec-modinv.c b/sec-modinv.c index 0991a98c..16b67384 100644 --- a/sec-modinv.c +++ b/sec-modinv.c @@ -72,7 +72,9 @@ sec_modinv (mp_limb_t *vp, mp_limb_t *ap, mp_size_t n, #define dp (scratch + n) #define up (scratch + 2*n) - mp_bitcnt_t i; + /* Avoid the mp_bitcnt_t type for compatibility with older GMP + versions. */ + unsigned i; /* Maintain |