aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_ksk.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-10-08 15:47:24 +0000
committerChristian Grothoff <christian@grothoff.org>2010-10-08 15:47:24 +0000
commitce0a92249ea2fddfb223051c5f8f94700024fcda (patch)
tree2bc53cdd363a4363b31b31c8d2ad9f819d2b3d46 /src/util/crypto_ksk.c
parentba0a724ce6cf3845ed67f311831c9a7da54baebe (diff)
downloadgnunet-ce0a92249ea2fddfb223051c5f8f94700024fcda.tar.gz
gnunet-ce0a92249ea2fddfb223051c5f8f94700024fcda.zip
fix
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);