aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_ksk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/crypto_ksk.c')
-rw-r--r--src/util/crypto_ksk.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util/crypto_ksk.c b/src/util/crypto_ksk.c
index 248869695..7600c5600 100644
--- a/src/util/crypto_ksk.c
+++ b/src/util/crypto_ksk.c
@@ -321,7 +321,7 @@ gen_prime (gcry_mpi_t *ptest, unsigned int nbits, GNUNET_HashCode * hc)
321 /* Calculate all remainders. */ 321 /* Calculate all remainders. */
322 tmp = gcry_mpi_new (0); 322 tmp = gcry_mpi_new (0);
323 sp = gcry_mpi_new (0); 323 sp = gcry_mpi_new (0);
324 for (i = 0; i <= no_of_small_primer_numbers; i++) 324 for (i = 0; i <= no_of_small_prime_numbers; i++)
325 { 325 {
326 size_t written; 326 size_t written;
327 327
@@ -337,14 +337,15 @@ gen_prime (gcry_mpi_t *ptest, unsigned int nbits, GNUNET_HashCode * hc)
337 for (step = 0; step < 20000; step += 2) 337 for (step = 0; step < 20000; step += 2)
338 { 338 {
339 /* Check against all the small primes we have in mods. */ 339 /* Check against all the small primes we have in mods. */
340 for (i = 0; (x = small_prime_numbers[i]); i++) 340 for (i = 0; i <= no_of_small_prime_numbers; i++)
341 { 341 {
342 uint16_t x = small_prime_numbers[i];
342 while (mods[i] + step >= x) 343 while (mods[i] + step >= x)
343 mods[i] -= x; 344 mods[i] -= x;
344 if (!(mods[i] + step)) 345 if (!(mods[i] + step))
345 break; 346 break;
346 } 347 }
347 if (x) 348 if (i <= no_of_small_prime_numbers)
348 continue; /* Found a multiple of an already known prime. */ 349 continue; /* Found a multiple of an already known prime. */
349 350
350 gcry_mpi_add_ui (*ptest, prime, step); 351 gcry_mpi_add_ui (*ptest, prime, step);