summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cipher/ChangeLog15
-rw-r--r--cipher/md.c1
-rw-r--r--cipher/pubkey.c6
-rw-r--r--cipher/random.c5
-rw-r--r--cipher/rndw32.c17
5 files changed, 31 insertions, 13 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index ee015638..5a9743fb 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,18 @@
+2001-11-07 Werner Koch <wk@gnupg.org>
+
+ * md.c (gcry_md_hash_buffer): Close the handle which was left open
+ for algorithms other than rmd160.
+
+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-08-03 Werner Koch <wk@gnupg.org>
* cipher.c (cipher_encrypt, cipher_decrypt): Prepare to return
diff --git a/cipher/md.c b/cipher/md.c
index 99c4cfa1..14005c0c 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -703,6 +703,7 @@ gcry_md_hash_buffer( int algo, char *digest, const char *buffer, size_t length)
md_write( h, (byte*)buffer, length );
md_final( h );
memcpy( digest, md_read( h, algo ), md_digest_length( algo ) );
+ md_close (h);
}
}
diff --git a/cipher/pubkey.c b/cipher/pubkey.c
index a8fb88d7..ea00080f 100644
--- a/cipher/pubkey.c
+++ b/cipher/pubkey.c
@@ -908,8 +908,10 @@ sexp_to_enc( GCRY_SEXP sexp, MPI **retarray, int *retalgo)
*
* Caller has to provide a public key as the SEXP pkey and data as a SEXP
* with just one MPI in it. The function returns a a sexp which may
- * be passed tp to pk_decrypt.
- * Later versions of this functions may take more complex input data.
+ * be passed to to pk_decrypt.
+ * Later versions of this functions may take more complex input data, for
+ * example s_data could have a control tag which allows us to to PKCS-1
+ * encoding directly here.
*
* Returns: 0 or an errorcode.
*
diff --git a/cipher/random.c b/cipher/random.c
index 91c80829..8608951c 100644
--- a/cipher/random.c
+++ b/cipher/random.c
@@ -434,9 +434,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 4f53cdbc..1ee61712 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,10 +748,12 @@ 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 ) {
- log_fatal("can't run on a W32s platform\n" );
+ g10_log_fatal("can't run on a W32s platform\n" );
}
is_initialized = 1;
if ( debug_me )
@@ -763,18 +765,17 @@ 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;
}
-
static int
gather_random_fast( void (*add)(const void*, size_t, int), int requester )
{