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

Fixes here and there.

This commit is contained in:
Werner Koch 2001-08-08 12:34:00 +00:00
parent bffeb8738b
commit 0fa9ffe75c
10 changed files with 61 additions and 25 deletions

View file

@ -1,3 +1,13 @@
2001-08-08 Werner Koch <wk@gnupg.org>
* rndw32.c (gather_random): Use toolhelp in addition to the NT
gatherer for Windows2000. Suggested by Sami Tolvanen.
* random.c (read_pool): Fixed length check, this used to be one
byte to strict. Made an assert out of it because the caller has
already made sure that only poolsize bytes are requested.
Reported by Marcus Brinkmann.
2001-07-18 Werner Koch <wk@gnupg.org>
* rndlinux.c (gather_random): casted a size_t arg to int so that

View file

@ -423,9 +423,8 @@ read_pool( byte *buffer, size_t length, int level )
int i;
ulong *sp, *dp;
if( length >= POOLSIZE ) {
log_fatal(_("too many random bits requested; the limit is %d\n"),
POOLSIZE*8-1 );
if( length > POOLSIZE ) {
log_bug("too many random bits requested\n");
}
if( !pool_filled ) {

View file

@ -730,7 +730,7 @@ gather_random( void (*add)(const void*, size_t, int), int requester,
size_t length, int level )
{
static int is_initialized;
static int is_windows95;
static int is_windowsNT, has_toolhelp;
if( !level )
@ -748,7 +748,9 @@ gather_random( void (*add)(const void*, size_t, int), int requester,
GetVersionEx( &osvi );
platform = osvi.dwPlatformId;
is_windows95 = platform == VER_PLATFORM_WIN32_WINDOWS;
is_windowsNT = platform == VER_PLATFORM_WIN32_NT;
has_toolhelp = (platform == VER_PLATFORM_WIN32_WINDOWS
|| (is_windowsNT && osvi.dwMajorVersion >= 5));
if ( platform == VER_PLATFORM_WIN32s ) {
g10_log_fatal("can't run on a W32s platform\n" );
@ -763,11 +765,11 @@ gather_random( void (*add)(const void*, size_t, int), int requester,
log_debug ("rndw32#gather_random: req=%d len=%u lvl=%d\n",
requester, (unsigned int)length, level );
if (is_windows95 ) {
slow_gatherer_windows95( add, requester );
if ( has_toolhelp ) {
slow_gatherer_windows95 ( add, requester );
}
else {
slow_gatherer_windowsNT( add, requester );
if ( is_windowsNT ) {
slow_gatherer_windowsNT ( add, requester );
}
return 0;