]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
eccdata: Check that table size is at least 2.
authorNiels Möller <nisse@lysator.liu.se>
Wed, 26 Dec 2018 16:27:00 +0000 (17:27 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Wed, 26 Dec 2018 16:27:00 +0000 (17:27 +0100)
Intended to silence warning from the clang static analyzer.

ChangeLog
eccdata.c

index b6af7feabd72b041188adecad065f6176e186907..aa3daeb34d0dae8c11e1ebc3189a6c77854d7a10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2018-12-26  Niels Möller  <nisse@lysator.liu.se>
 
+       * eccdata.c (ecc_pippenger_precompute): Check that table size is
+       at least 2. Intended to silence warning from the clang static
+       analyzer.
+
        * configure.ac: Bump package version to 3.5.
        (LIBNETTLE_MAJOR): Bump major number, now 7.
        (LIBHOGWEED_MAJOR): Bump major number, now 5.
index 51ecde3592d73435d344196b6d3d3511c3e0c235..8aa57e06214b0ac43f504ef39869defe1c9b77d3 100644 (file)
--- 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",