summaryrefslogtreecommitdiff
path: root/eccdata.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2018-12-26 17:27:00 +0100
committerNiels Möller <nisse@lysator.liu.se>2018-12-26 17:27:00 +0100
commit1cc82bbb8b23f79b7f3097e8143fc2f705237ace (patch)
tree7b9afd5be803b57a792775ea4630ad22295d2462 /eccdata.c
parentd7a2b703eaff56aa821efa589c2099c456fbf8da (diff)
downloadnettle-1cc82bbb8b23f79b7f3097e8143fc2f705237ace.tar.gz
eccdata: Check that table size is at least 2.
Intended to silence warning from the clang static analyzer.
Diffstat (limited to 'eccdata.c')
-rw-r--r--eccdata.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/eccdata.c b/eccdata.c
index 51ecde35..8aa57e06 100644
--- a/eccdata.c
+++ b/eccdata.c
@@ -650,6 +650,12 @@ ecc_pippenger_precompute (struct ecc_curve *ecc, unsigned k, unsigned c)
unsigned M = ecc_table_size (ecc->bit_size, k, c);
unsigned i, j;
+ if (M < 2)
+ {
+ fprintf (stderr, "Invalid parameters, implies M = %u\n", M);
+ exit (EXIT_FAILURE);
+ }
+
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",