summaryrefslogtreecommitdiffstats
path: root/cipher/primegen.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1997-12-31 13:32:54 +0100
committerWerner Koch <wk@gnupg.org>1997-12-31 13:32:54 +0100
commit4d2636eafe40bc11f2f08254ad9f5a5d376cb268 (patch)
treef3e5a05befb494ba699d8607802370b9576dcd20 /cipher/primegen.c
parentchanged configuration stuff, replaced some Makefile.am by distfiles. (diff)
downloadgnupg2-4d2636eafe40bc11f2f08254ad9f5a5d376cb268.tar.xz
gnupg2-4d2636eafe40bc11f2f08254ad9f5a5d376cb268.zip
Sylvester Version
Diffstat (limited to 'cipher/primegen.c')
-rw-r--r--cipher/primegen.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cipher/primegen.c b/cipher/primegen.c
index 8a72973e2..3f6c1f325 100644
--- a/cipher/primegen.c
+++ b/cipher/primegen.c
@@ -106,20 +106,24 @@ generate_elg_prime( unsigned pbits, unsigned qbits, MPI g )
/* allocate new primes */
for(i=0; i < m; i++ ) {
mpi_free(pool[i]);
- pool[i] = gen_prime( fbits, 0, 2 );
+ pool[i] = NULL;
}
/* init m_out_of_n() */
perms = m_alloc_clear( m );
for(i=0; i < n; i++ ) {
perms[i] = 1;
+ pool[i] = gen_prime( fbits, 0, 2 );
factors[i] = pool[i];
}
}
else {
m_out_of_n( perms, n, m );
for(i=j=0; i < m && j < n ; i++ )
- if( perms[i] )
+ if( perms[i] ) {
+ if( !pool[i] )
+ pool[i] = gen_prime( fbits, 0, 2 );
factors[j++] = pool[i];
+ }
if( i == n ) {
m_free(perms); perms = NULL;
fputc('!', stderr);