mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
See ChangeLog: Thu Dec 10 20:15:36 CET 1998 Werner Koch
This commit is contained in:
parent
a45f824150
commit
af6e96e4f9
40 changed files with 1848 additions and 1444 deletions
|
@ -1,3 +1,15 @@
|
|||
Thu Dec 10 20:15:36 CET 1998 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
* dynload.c (load_extension): increased needed verbosity level.
|
||||
|
||||
* random.c (fast_random_poll): Fallback to a default fast random
|
||||
poll function.
|
||||
(read_random_source): Always use the faked entroy gatherer if no
|
||||
gather module is available.
|
||||
* rndlinux.c (fast_poll): Removed.
|
||||
* rndunix.c (fast_poll): Removed.
|
||||
|
||||
|
||||
Wed Nov 25 12:33:41 1998 Werner Koch (wk@isil.d.shuttle.de)
|
||||
|
||||
* rand-*.c: Removed.
|
||||
|
|
|
@ -231,7 +231,7 @@ load_extension( EXTLIST el )
|
|||
name = (char**)addr;
|
||||
#endif
|
||||
|
||||
if( g10_opt_verbose )
|
||||
if( g10_opt_verbose > 1 )
|
||||
log_info("%s: %s%s%s%s\n", el->name, *name,
|
||||
el->hintstr? " (":"",
|
||||
el->hintstr? el->hintstr:"",
|
||||
|
@ -262,7 +262,7 @@ load_extension( EXTLIST el )
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_DL_DLOPEN
|
||||
if( g10_opt_verbose > 1 ) {
|
||||
if( g10_opt_verbose > 2 ) {
|
||||
/* list the contents of the module */
|
||||
while( (sym = (*el->enumfunc)(0, &seq, &class, &vers)) ) {
|
||||
if( vers != 1 ) {
|
||||
|
|
|
@ -32,6 +32,18 @@
|
|||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_GETHRTIME
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#include "util.h"
|
||||
#include "rmd.h"
|
||||
#include "ttyio.h"
|
||||
|
@ -83,9 +95,7 @@ static void read_pool( byte *buffer, size_t length, int level );
|
|||
static void add_randomness( const void *buffer, size_t length, int source );
|
||||
static void random_poll(void);
|
||||
static void read_random_source( byte *buffer, size_t length, int level );
|
||||
#ifndef HAVE_DEV_RANDOM
|
||||
static int gather_faked( byte *buffer, size_t *r_length, int level );
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
|
@ -329,11 +339,39 @@ fast_random_poll()
|
|||
initialize();
|
||||
initialized = 1;
|
||||
fnc = dynload_getfnc_fast_random_poll();
|
||||
if( !fnc )
|
||||
log_info("Ooops: No fast random poll function\n");
|
||||
}
|
||||
if( fnc )
|
||||
if( fnc ) {
|
||||
(*fnc)( add_randomness );
|
||||
return;
|
||||
}
|
||||
|
||||
/* fall back to the generic function */
|
||||
#if HAVE_GETHRTIME
|
||||
{ hrtime_t tv;
|
||||
tv = gethrtime();
|
||||
add_randomness( &tv, sizeof(tv), 1 );
|
||||
}
|
||||
#elif HAVE_GETTIMEOFDAY
|
||||
{ struct timeval tv;
|
||||
if( gettimeofday( &tv, NULL ) )
|
||||
BUG();
|
||||
add_randomness( &tv.tv_sec, sizeof(tv.tv_sec), 1 );
|
||||
add_randomness( &tv.tv_usec, sizeof(tv.tv_usec), 1 );
|
||||
}
|
||||
#else /* use times */
|
||||
{ struct tms buf;
|
||||
times( &buf );
|
||||
add_randomness( &buf, sizeof buf, 1 );
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
{ struct rusage buf;
|
||||
if( getrusage( RUSAGE_SELF, &buf ) )
|
||||
BUG();
|
||||
add_randomness( &buf, sizeof buf, 1 );
|
||||
memset( &buf, 0, sizeof buf );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -351,11 +389,7 @@ read_random_source( byte *buffer, size_t length, int level )
|
|||
fnc = dynload_getfnc_gather_random();
|
||||
if( !fnc ) {
|
||||
faked_rng = 1;
|
||||
#ifndef HAVE_DEV_RANDOM
|
||||
fnc = gather_faked;
|
||||
#else
|
||||
BUG();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
while( length ) {
|
||||
|
@ -368,7 +402,6 @@ read_random_source( byte *buffer, size_t length, int level )
|
|||
}
|
||||
|
||||
|
||||
#ifndef HAVE_DEV_RANDOM
|
||||
static int
|
||||
gather_faked( byte *buffer, size_t *r_length, int level )
|
||||
{
|
||||
|
@ -378,7 +411,7 @@ gather_faked( byte *buffer, size_t *r_length, int level )
|
|||
if( !initialized ) {
|
||||
log_info(_("WARNING: using insecure random number generator!!\n"));
|
||||
tty_printf(_("The random number generator is only a kludge to let\n"
|
||||
"it compile - it is in no way a strong RNG!\n\n"
|
||||
"it run - it is in no way a strong RNG!\n\n"
|
||||
"DON'T USE ANY DATA GENERATED BY THIS PROGRAM!!\n\n"));
|
||||
initialized=1;
|
||||
#ifdef HAVE_RAND
|
||||
|
@ -398,5 +431,3 @@ gather_faked( byte *buffer, size_t *r_length, int level )
|
|||
return 100; /* We really fake it ;-) */
|
||||
}
|
||||
|
||||
#endif /* ! HAVE_DEV_RANDOM */
|
||||
|
||||
|
|
|
@ -27,15 +27,9 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_GETHRTIME
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -61,38 +55,6 @@ static void tty_printf(const char *fmt, ... )
|
|||
#endif
|
||||
|
||||
|
||||
static void
|
||||
fast_poll( void (*add)(const void*, size_t, int) )
|
||||
{
|
||||
#if HAVE_GETHRTIME
|
||||
{ hrtime_t tv;
|
||||
tv = gethrtime();
|
||||
(*add)( &tv, sizeof(tv), 1 );
|
||||
}
|
||||
#elif HAVE_GETTIMEOFDAY
|
||||
{ struct timeval tv;
|
||||
if( gettimeofday( &tv, NULL ) )
|
||||
BUG();
|
||||
(*add)( &tv.tv_sec, sizeof(tv.tv_sec), 1 );
|
||||
(*add)( &tv.tv_usec, sizeof(tv.tv_usec), 1 );
|
||||
}
|
||||
#else /* use times */
|
||||
{ struct tms buf;
|
||||
times( &buf );
|
||||
(*add)( &buf, sizeof buf, 1 );
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
{ struct rusage buf;
|
||||
if( getrusage( RUSAGE_SELF, &buf ) )
|
||||
BUG();
|
||||
(*add)( &buf, sizeof buf, 1 );
|
||||
memset( &buf, 0, sizeof buf );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************
|
||||
* Used to open the Linux and xBSD /dev/random devices
|
||||
|
@ -192,7 +154,6 @@ static struct {
|
|||
void *func;
|
||||
} func_table[] = {
|
||||
{ 40, 1, gather_random },
|
||||
{ 41, 1, fast_poll },
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -617,38 +617,6 @@ slowPoll(void)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
fast_poll( void (*add)(const void*, size_t, int) )
|
||||
{
|
||||
#if HAVE_GETHRTIME
|
||||
{ hrtime_t tv;
|
||||
tv = gethrtime();
|
||||
(*add)( &tv, sizeof(tv), 1 );
|
||||
}
|
||||
#elif HAVE_GETTIMEOFDAY
|
||||
{ struct timeval tv;
|
||||
if( gettimeofday( &tv, NULL ) )
|
||||
BUG();
|
||||
(*add)( &tv.tv_sec, sizeof(tv.tv_sec), 1 );
|
||||
(*add)( &tv.tv_usec, sizeof(tv.tv_usec), 1 );
|
||||
}
|
||||
#else /* use times */
|
||||
{ struct tms buf;
|
||||
times( &buf );
|
||||
(*add)( &buf, sizeof buf, 1 );
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
{ struct rusage buf;
|
||||
if( getrusage( RUSAGE_SELF, &buf ) )
|
||||
BUG();
|
||||
(*add)( &buf, sizeof buf, 1 );
|
||||
memset( &buf, 0, sizeof buf );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
gather_random( byte *buffer, size_t *r_length, int level )
|
||||
|
@ -698,7 +666,6 @@ static struct {
|
|||
void *func;
|
||||
} func_table[] = {
|
||||
{ 40, 1, gather_random },
|
||||
{ 41, 1, fast_poll },
|
||||
};
|
||||
|
||||
/****************
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue