summaryrefslogtreecommitdiff
path: root/cipher/primegen.c
diff options
context:
space:
mode:
authorMoritz Schulte <mo@g10code.com>2003-03-12 15:15:54 +0000
committerMoritz Schulte <mo@g10code.com>2003-03-12 15:15:54 +0000
commit115fc88f868119863b785237f91ac8fcf16cc1e9 (patch)
tree4be6c5c12a8051aaadd2c59b07e30578391c5616 /cipher/primegen.c
parente7d93eee048c0fa8d1a41e2810f0751f48bd6c18 (diff)
downloadlibgcrypt-115fc88f868119863b785237f91ac8fcf16cc1e9.tar.gz
2003-03-12 Moritz Schulte <moritz@g10code.com>
* primegen.c: Initialize `no_of_small_prime_numbers' statically. (gen_prime): Remove calculation of `no_of_small_prime_numbers'.
Diffstat (limited to 'cipher/primegen.c')
-rw-r--r--cipher/primegen.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/cipher/primegen.c b/cipher/primegen.c
index 73f678d4..ffeb52c8 100644
--- a/cipher/primegen.c
+++ b/cipher/primegen.c
@@ -32,7 +32,6 @@
#include "mpi.h"
#include "cipher.h"
-static int no_of_small_prime_numbers;
static MPI gen_prime( unsigned nbits, int mode, int randomlevel );
static int check_prime( MPI prime, MPI val_2 );
static int is_prime( MPI n, int steps, int *count );
@@ -125,7 +124,7 @@ static ushort small_prime_numbers[] = {
4957, 4967, 4969, 4973, 4987, 4993, 4999,
0
};
-
+static int no_of_small_prime_numbers = DIM (small_prime_numbers) - 1;
void
_gcry_register_primegen_progress ( void (*cb)(void *,const char*,int,int,int), void *cb_data )
@@ -390,10 +389,6 @@ gen_prime( unsigned nbits, int secret, int randomlevel )
if( 0 && DBG_CIPHER )
log_debug("generate a prime of %u bits ", nbits );
- if( !no_of_small_prime_numbers ) {
- for(i=0; small_prime_numbers[i]; i++ )
- no_of_small_prime_numbers++;
- }
mods = gcry_xmalloc( no_of_small_prime_numbers * sizeof *mods );
/* make nbits fit into MPI implementation */
val_2 = mpi_alloc_set_ui( 2 );