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

Trust stuff works partly.

This commit is contained in:
Werner Koch 1998-01-24 16:32:27 +00:00
parent ea4b6f9db7
commit d71f8bce7e
18 changed files with 590 additions and 125 deletions

View file

@ -167,6 +167,10 @@ the OS a chance to collect more entropy! (Need %d more bytes)\n", length );
#else /* not HAVE_DEV_RANDOM */
#ifndef RAND_MAX /* for SunOS */
#define RAND_MAX 32767
#endif
static void
fill_buffer( byte *buffer, size_t length, int level )
{
@ -178,11 +182,20 @@ fill_buffer( byte *buffer, size_t length, int level )
"it compile - 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
srand(make_timestamp()*getpid());
#else
srandom(make_timestamp()*getpid());
#endif
}
#ifdef HAVE_RAND
while( length-- )
*buffer++ = ((unsigned)(1 + (int) (256.0*rand()/(RAND_MAX+1.0)))-1);
#else
while( length-- )
*buffer++ = ((unsigned)(1 + (int) (256.0*random()/(RAND_MAX+1.0)))-1);
#endif
}
#endif