Commit 162d599a authored by Niels Möller's avatar Niels Möller

Make eccdata warn about poor parameters.

parent 98efe78d
2018-03-10 Niels Möller <nisse@lysator.liu.se>
* eccdata.c (ecc_table_size): New helper function.
(ecc_pippenger_precompute): Display warning for poor parameters.
* eccparams.c (main): New program, to list parameter alternatives
for Pippenger's algorithm.
......
......@@ -611,18 +611,30 @@ ecc_curve_init (struct ecc_curve *ecc, unsigned bit_size)
ecc->bit_size = bit_size;
}
static unsigned
ecc_table_size(unsigned bits, unsigned k, unsigned c)
{
unsigned p = (bits + k-1) / k;
unsigned M = (p + c-1)/c;
return M;
}
static void
ecc_pippenger_precompute (struct ecc_curve *ecc, unsigned k, unsigned c)
{
unsigned p = (ecc->bit_size + k-1) / k;
unsigned M = (p + c-1)/c;
unsigned M = ecc_table_size (ecc->bit_size, k, c);
unsigned i, j;
if (M == ecc_table_size (ecc->bit_size, k-1, c))
fprintf(stderr,
"warn: Parameters k = %u, c = %d are suboptimal, could use smaller k\n",
k, c);
ecc->pippenger_k = k;
ecc->pippenger_c = c;
ecc->table_size = M << c;
ecc->table = ecc_alloc (ecc->table_size);
/* Compute the first 2^c entries */
ecc_set_zero (&ecc->table[0]);
ecc_set (&ecc->table[1], &ecc->g);
......
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