Commit bf587cd5 authored by Niels Möller's avatar Niels Möller

Replace mp_bitcnt_t by unsigned, for compatibility with older gmp versions.

parent fb709927
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.
......
......@@ -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;
......
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment