aboutsummaryrefslogtreecommitdiffstats
path: root/cipher
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cipher/ChangeLog5
-rw-r--r--cipher/primegen.c1
-rw-r--r--cipher/random.c4
3 files changed, 7 insertions, 3 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index bee034920..010952863 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jul 13 21:30:52 1998 Werner Koch ([email protected])
+
+ * random.c (read_pool): Simple alloc if secure_alloc is not set.
+ (get_random_bits): Ditto.
+
Thu Jul 9 13:01:14 1998 Werner Koch ([email protected])
* dynload.c (load_extension): Function now nbails out if
diff --git a/cipher/primegen.c b/cipher/primegen.c
index 23aa1dbe8..66d40dbfc 100644
--- a/cipher/primegen.c
+++ b/cipher/primegen.c
@@ -281,7 +281,6 @@ gen_prime( unsigned nbits, int secret, int randomlevel )
mods = m_alloc( no_of_small_prime_numbers * sizeof *mods );
/* make nbits fit into MPI implementation */
nlimbs = (nbits + BITS_PER_MPI_LIMB - 1) / BITS_PER_MPI_LIMB;
- assert( nlimbs );
val_2 = mpi_alloc( nlimbs );
mpi_set_ui(val_2, 2);
val_3 = mpi_alloc( nlimbs );
diff --git a/cipher/random.c b/cipher/random.c
index f44e4c3af..75754cd01 100644
--- a/cipher/random.c
+++ b/cipher/random.c
@@ -153,7 +153,7 @@ get_random_bits( size_t nbits, int level, int secure )
size_t nbytes = (nbits+7)/8;
MASK_LEVEL(level);
- buf = secure? m_alloc_secure( nbytes ) : m_alloc( nbytes );
+ buf = secure && secure_alloc ? m_alloc_secure( nbytes ) : m_alloc( nbytes );
read_pool( buf, nbytes, level );
return buf;
}
@@ -222,7 +222,7 @@ read_pool( byte *buffer, size_t length, int level )
needed = length - pool_balance;
if( needed > POOLSIZE )
BUG();
- p = m_alloc_secure( needed );
+ p = secure_alloc ? m_alloc_secure( needed ) : m_alloc(needed);
read_random_source( p, needed, 2 ); /* read /dev/random */
add_randomness( p, needed, 3);
m_free(p);