Commit 61a54890 authored by Niels Möller's avatar Niels Möller

Do some more tests in ecc-redc-test.

parent 8b83e812
2014-09-22 Niels Möller <nisse@lysator.liu.se>
* testsuite/ecc-redc-test.c (test_main): Relaxed tests for which
tests to run.
* testsuite/ecc-modinv-test.c (test_modulo): New function, same
organization as in ecc-mod-test.c below.
......
......@@ -57,9 +57,6 @@ test_main (void)
{
const struct ecc_curve *ecc = ecc_curves[i];
unsigned j;
if (ecc->p.reduce == ecc->p.mod)
continue;
ASSERT (ecc->p.redc_size != 0);
for (j = 0; j < COUNT; j++)
{
......@@ -72,6 +69,8 @@ test_main (void)
ref_redc (ref, a, ecc->p.m, ecc->p.size);
if (ecc->p.reduce != ecc->p.mod)
{
mpn_copyi (m, a, 2*ecc->p.size);
ecc->p.reduce (&ecc->p, m);
if (mpn_cmp (m, ecc->p.m, ecc->p.size) >= 0)
......@@ -79,14 +78,16 @@ test_main (void)
if (mpn_cmp (m, ref, ecc->p.size))
{
fprintf (stderr, "ecc->reduce failed: bit_size = %u\n",
fprintf (stderr, "ecc->p.reduce failed: bit_size = %u\n",
ecc->p.bit_size);
gmp_fprintf (stderr, "a = %Nx\n", a, 2*ecc->p.size);
gmp_fprintf (stderr, "m = %Nx (bad)\n", m, ecc->p.size);
gmp_fprintf (stderr, "ref = %Nx\n", ref, ecc->p.size);
abort ();
}
}
if (ecc->p.redc_size != 0)
{
mpn_copyi (m, a, 2*ecc->p.size);
if (ecc->p.m[0] == 1)
ecc_pm1_redc (&ecc->p, m);
......@@ -107,6 +108,7 @@ test_main (void)
}
}
}
}
mpz_clear (r);
gmp_randclear (rands);
......
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