Commit 9539db4e authored by Niels Möller's avatar Niels Möller

Test edddsa point compression with curve448.

parent 1a85646b
2020-01-01 Niels Möller <nisse@lysator.liu.se>
* testsuite/eddsa-compress-test.c: Test also with curve448.
2019-12-30 Niels Möller <nisse@lysator.liu.se>
Preparation for ed448, based on patch by Daiki Ueno.
......
......@@ -38,8 +38,14 @@
void test_main (void)
{
const struct ecc_curve *ecc = &_nettle_curve25519;
gmp_randstate_t rands;
unsigned i;
gmp_randinit_default (rands);
for (i = 0; ecc_curves[i]; i++)
{
const struct ecc_curve *ecc = ecc_curves[i];
mp_size_t size, itch;
mpz_t zp, t;
mp_limb_t *s;
......@@ -51,7 +57,8 @@ void test_main (void)
uint8_t *c;
unsigned j;
gmp_randinit_default (rands);
if (!(ecc->p.bit_size == 255 || ecc->p.bit_size == 448))
continue;
size = ecc_size (ecc);
clen = 1 + ecc->p.bit_size / 8;
......@@ -68,6 +75,7 @@ void test_main (void)
itch = _eddsa_decompress_itch (ecc);
if (itch < ecc->mul_g_itch)
itch = ecc->mul_g_itch;
ASSERT (_eddsa_compress_itch (ecc) <= itch);
scratch = xalloc_limbs (itch);
......@@ -99,7 +107,7 @@ void test_main (void)
fprintf (stderr, ",\n 0x");
mpz_out_str (stderr, 16, y2);
fprintf (stderr, "\n");
abort ();
FAIL();
}
}
mpz_clear (t);
......@@ -109,5 +117,6 @@ void test_main (void)
free (pa1);
free (pa2);
free (scratch);
}
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