Commit 3396725b authored by Niels Möller's avatar Niels Möller

Renamed gmp_randstate_t variables to "rands".

parent 17352ba7
......@@ -22,14 +22,14 @@ ref_mod (mp_limb_t *rp, const mp_limb_t *ap, const mp_limb_t *mp, mp_size_t mn)
void
test_main (void)
{
gmp_randstate_t state;
gmp_randstate_t rands;
mp_limb_t a[MAX_SIZE];
mp_limb_t m[MAX_SIZE];
mp_limb_t ref[MAX_SIZE];
unsigned i;
mpz_t r;
gmp_randinit_default (state);
gmp_randinit_default (rands);
mpz_init (r);
......@@ -40,9 +40,9 @@ test_main (void)
for (j = 0; j < COUNT; j++)
{
if (j & 1)
mpz_rrandomb (r, state, 2*ecc->size * GMP_NUMB_BITS);
mpz_rrandomb (r, rands, 2*ecc->size * GMP_NUMB_BITS);
else
mpz_urandomb (r, state, 2*ecc->size * GMP_NUMB_BITS);
mpz_urandomb (r, rands, 2*ecc->size * GMP_NUMB_BITS);
mpz_limbs_copy (a, r, 2*ecc->size);
......@@ -119,6 +119,6 @@ test_main (void)
}
mpz_clear (r);
gmp_randclear (state);
gmp_randclear (rands);
}
#endif /* ! NETTLE_USE_MINI_GMP */
......@@ -40,7 +40,7 @@ ref_modinv (mp_limb_t *rp, const mp_limb_t *ap, const mp_limb_t *mp, mp_size_t m
void
test_main (void)
{
gmp_randstate_t state;
gmp_randstate_t rands;
mp_limb_t a[MAX_ECC_SIZE];
mp_limb_t ai[MAX_ECC_SIZE];
mp_limb_t ref[MAX_ECC_SIZE];
......@@ -48,7 +48,7 @@ test_main (void)
unsigned i;
mpz_t r;
gmp_randinit_default (state);
gmp_randinit_default (rands);
mpz_init (r);
for (i = 0; ecc_curves[i]; i++)
......@@ -58,9 +58,9 @@ test_main (void)
for (j = 0; j < COUNT; j++)
{
if (j & 1)
mpz_rrandomb (r, state, ecc->size * GMP_NUMB_BITS);
mpz_rrandomb (r, rands, ecc->size * GMP_NUMB_BITS);
else
mpz_urandomb (r, state, ecc->size * GMP_NUMB_BITS);
mpz_urandomb (r, rands, ecc->size * GMP_NUMB_BITS);
mpz_limbs_copy (a, r, ecc->size);
......@@ -110,7 +110,7 @@ test_main (void)
}
}
}
gmp_randclear (state);
gmp_randclear (rands);
mpz_clear (r);
}
#endif /* ! NETTLE_USE_MINI_GMP */
......@@ -11,11 +11,11 @@ test_main (void)
void
test_main (void)
{
gmp_randstate_t state;
gmp_randstate_t rands;
mpz_t r;
unsigned i;
gmp_randinit_default (state);
gmp_randinit_default (rands);
mpz_init (r);
for (i = 0; ecc_curves[i]; i++)
......@@ -72,9 +72,9 @@ test_main (void)
for (j = 0; j < 100; j++)
{
if (j & 1)
mpz_rrandomb (r, state, size * GMP_NUMB_BITS);
mpz_rrandomb (r, rands, size * GMP_NUMB_BITS);
else
mpz_urandomb (r, state, size * GMP_NUMB_BITS);
mpz_urandomb (r, rands, size * GMP_NUMB_BITS);
/* Reduce so that (almost surely) n < q */
mpz_limbs_copy (n, r, size);
......@@ -106,6 +106,6 @@ test_main (void)
free (scratch);
}
mpz_clear (r);
gmp_randclear (state);
gmp_randclear (rands);
}
#endif /* ! NETTLE_USE_MINI_GMP */
......@@ -11,11 +11,11 @@ test_main (void)
void
test_main (void)
{
gmp_randstate_t state;
gmp_randstate_t rands;
mpz_t r;
unsigned i;
gmp_randinit_default (state);
gmp_randinit_default (rands);
mpz_init (r);
for (i = 0; ecc_curves[i]; i++)
......@@ -62,6 +62,6 @@ test_main (void)
free (scratch);
}
mpz_clear (r);
gmp_randclear (state);
gmp_randclear (rands);
}
#endif /* ! NETTLE_USE_MINI_GMP */
......@@ -42,14 +42,14 @@ ref_redc (mp_limb_t *rp, const mp_limb_t *ap, const mp_limb_t *mp, mp_size_t mn)
void
test_main (void)
{
gmp_randstate_t state;
gmp_randstate_t rands;
mp_limb_t a[MAX_SIZE];
mp_limb_t m[MAX_SIZE];
mp_limb_t ref[MAX_SIZE];
unsigned i;
mpz_t r;
gmp_randinit_default (state);
gmp_randinit_default (rands);
mpz_init (r);
......@@ -63,9 +63,9 @@ test_main (void)
for (j = 0; j < COUNT; j++)
{
if (j & 1)
mpz_rrandomb (r, state, 2*ecc->size * GMP_NUMB_BITS);
mpz_rrandomb (r, rands, 2*ecc->size * GMP_NUMB_BITS);
else
mpz_urandomb (r, state, 2*ecc->size * GMP_NUMB_BITS);
mpz_urandomb (r, rands, 2*ecc->size * GMP_NUMB_BITS);
mpz_limbs_copy (a, r, 2*ecc->size);
......@@ -104,6 +104,6 @@ test_main (void)
}
mpz_clear (r);
gmp_randclear (state);
gmp_randclear (rands);
}
#endif /* ! NETTLE_USE_MINI_GMP */
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