1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

added some trust model stuff

This commit is contained in:
Werner Koch 1998-01-16 21:15:24 +00:00
parent 1ce26aa6d6
commit 4ec1775f3e
49 changed files with 1580 additions and 331 deletions

View file

@ -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;

View file

@ -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

View file

@ -73,7 +73,6 @@
#endif
static void Init( MD5_CONTEXT *mdContext);
static void Transform(u32 *buf,u32 *in);
static byte PADDING[64] = {

View file

@ -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;

View file

@ -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++ ) {

View file

@ -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;