Commit 3c87a5aa authored by Niels Möller's avatar Niels Möller

Make ecc mod q test unconditional.

parent 14bca47e
2014-08-26 Niels Möller <nisse@lysator.liu.se>
* testsuite/ecc-mod-test.c (test_curve): Make modq test
unconditional, partially reverting 2014-07-04 change.
* ecc-25519.c (ecc_25519_modq): New function.
* eccdata.c (output_curve): Precomputation for curve25519 mod q.
......
......@@ -76,22 +76,19 @@ test_curve (gmp_randstate_t rands, const struct ecc_curve *ecc)
ref_mod (ref, a, ecc->q, ecc->size);
if (ecc->modq)
{
mpn_copyi (m, a, 2*ecc->size);
ecc->modq (ecc, m);
if (mpn_cmp (m, ecc->q, ecc->size) >= 0)
mpn_sub_n (m, m, ecc->q, ecc->size);
mpn_copyi (m, a, 2*ecc->size);
ecc->modq (ecc, m);
if (mpn_cmp (m, ecc->q, ecc->size) >= 0)
mpn_sub_n (m, m, ecc->q, ecc->size);
if (mpn_cmp (m, ref, ecc->size))
{
fprintf (stderr, "ecc->modq failed: bit_size = %u\n",
ecc->bit_size);
gmp_fprintf (stderr, "a = %Nx\n", a, 2*ecc->size);
gmp_fprintf (stderr, "m = %Nx (bad)\n", m, ecc->size);
gmp_fprintf (stderr, "ref = %Nx\n", ref, ecc->size);
abort ();
}
if (mpn_cmp (m, ref, ecc->size))
{
fprintf (stderr, "ecc->modq failed: bit_size = %u\n",
ecc->bit_size);
gmp_fprintf (stderr, "a = %Nx\n", a, 2*ecc->size);
gmp_fprintf (stderr, "m = %Nx (bad)\n", m, ecc->size);
gmp_fprintf (stderr, "ref = %Nx\n", ref, ecc->size);
abort ();
}
if (ecc->Bmodq_size < ecc->size)
{
......
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