diff options
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/blowfish.c | 2 | ||||
-rw-r--r-- | cipher/md.c | 2 | ||||
-rw-r--r-- | cipher/md5.c | 1 | ||||
-rw-r--r-- | cipher/misc.c | 6 | ||||
-rw-r--r-- | cipher/primegen.c | 4 | ||||
-rw-r--r-- | cipher/random.c | 16 |
6 files changed, 20 insertions, 11 deletions
diff --git a/cipher/blowfish.c b/cipher/blowfish.c index 5dbaf7195..81e33d080 100644 --- a/cipher/blowfish.c +++ b/cipher/blowfish.c @@ -412,7 +412,7 @@ selftest() void blowfish_setkey( BLOWFISH_context *c, byte *key, unsigned keylen ) { - int i, j, k; + int i, j; u32 data, datal, datar; static int initialized; diff --git a/cipher/md.c b/cipher/md.c index e88a45c77..eb7b7b845 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -144,7 +144,7 @@ md_read( MD_HANDLE a, int algo ) if( algo == DIGEST_ALGO_MD5 ) return md5_read( &a->md5 ); } - log_bug(NULL); + BUG(); } int diff --git a/cipher/md5.c b/cipher/md5.c index 6906503d4..c9f9a86b4 100644 --- a/cipher/md5.c +++ b/cipher/md5.c @@ -73,7 +73,6 @@ #endif -static void Init( MD5_CONTEXT *mdContext); static void Transform(u32 *buf,u32 *in); static byte PADDING[64] = { diff --git a/cipher/misc.c b/cipher/misc.c index cd0d31a49..7c8f2e3c7 100644 --- a/cipher/misc.c +++ b/cipher/misc.c @@ -67,7 +67,7 @@ string_to_cipher_algo( const char *string ) int i; const char *s; - for(i=0; s=cipher_names[i].name; i++ ) + for(i=0; (s=cipher_names[i].name); i++ ) if( !stricmp( s, string ) ) return cipher_names[i].algo; return 0; @@ -83,7 +83,7 @@ string_to_pubkey_algo( const char *string ) int i; const char *s; - for(i=0; s=pubkey_names[i].name; i++ ) + for(i=0; (s=pubkey_names[i].name); i++ ) if( !stricmp( s, string ) ) return pubkey_names[i].algo; return 0; @@ -98,7 +98,7 @@ string_to_digest_algo( const char *string ) int i; const char *s; - for(i=0; s=digest_names[i].name; i++ ) + for(i=0; (s=digest_names[i].name); i++ ) if( !stricmp( s, string ) ) return digest_names[i].algo; return 0; diff --git a/cipher/primegen.c b/cipher/primegen.c index 3f6c1f325..9514fdae8 100644 --- a/cipher/primegen.c +++ b/cipher/primegen.c @@ -319,8 +319,6 @@ check_prime( MPI prime ) int i; unsigned x; int count=0; - MPI result; - MPI val_2; /* check against small primes */ for(i=0; (x = small_prime_numbers[i]); i++ ) { @@ -431,7 +429,7 @@ m_out_of_n( char *array, int m, int n ) array[i] = 1; return; } - log_bug(NULL); + BUG(); } for(j=1; j < n; j++ ) { diff --git a/cipher/random.c b/cipher/random.c index 41f001e7e..b082022af 100644 --- a/cipher/random.c +++ b/cipher/random.c @@ -30,6 +30,7 @@ #include <fcntl.h> #include "util.h" #include "cipher.h" +#include "ttyio.h" struct cache { int len; @@ -41,6 +42,18 @@ static struct cache cache[3]; static void fill_buffer( byte *buffer, size_t length, int level ); +static int quick_test; + + +int +quick_random_gen( int onoff ) +{ + int last = quick_test; + if( onoff != -1 ) + quick_test = onoff; + return last; +} + /**************** * Fill the buffer with LENGTH bytes of cryptologic strong @@ -95,14 +108,13 @@ open_device( const char *name, int minor ) static void fill_buffer( byte *buffer, size_t length, int level ) { - FILE *fp; static int fd_urandom = -1; static int fd_random = -1; int fd; int n; int warn=0; - if( level == 2 ) { + if( level == 2 && !quick_test ) { if( fd_random == -1 ) fd_random = open_device( "/dev/random", 8 ); fd = fd_random; |