aboutsummaryrefslogtreecommitdiffstats
path: root/cipher
diff options
context:
space:
mode:
Diffstat (limited to 'cipher')
-rw-r--r--cipher/ChangeLog10
-rw-r--r--cipher/random.c5
-rw-r--r--cipher/rndw32.c14
3 files changed, 20 insertions, 9 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index 14f76185f..2329dfe4b 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,13 @@
+2001-08-08 Werner Koch <[email protected]>
+
+ * 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 <[email protected]>
* rndlinux.c (gather_random): casted a size_t arg to int so that
diff --git a/cipher/random.c b/cipher/random.c
index 198663536..ffafd9a87 100644
--- a/cipher/random.c
+++ b/cipher/random.c
@@ -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 ) {
diff --git a/cipher/rndw32.c b/cipher/rndw32.c
index 63b78791c..278ea8ec2 100644
--- a/cipher/rndw32.c
+++ b/cipher/rndw32.c
@@ -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;