[git] GCRYPT - branch, LIBGCRYPT-1-6-BRANCH, updated. libgcrypt-1.6.1-7-g06b4192

by Werner Koch cvs at cvs.gnupg.org
Thu Apr 24 11:24:04 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU crypto library".

The branch, LIBGCRYPT-1-6-BRANCH has been updated
       via  06b4192efdd93fa59d76bf731da9829f01b04294 (commit)
      from  bceb5ec22bd966f4c78c7349d5821c9e17423660 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 06b4192efdd93fa59d76bf731da9829f01b04294
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Apr 15 16:40:48 2014 +0200

    random: Small patch for consistency and really burn the stack.
    
    * random/rndlinux.c (_gcry_rndlinux_gather_random): s/int/size_t/.
    (_gcry_rndlinux_gather_random): Replace memset by wipememory.
    --
    
    size_t was suggested by Marcus Meissner <meissner at suse.de>.  While
    looking at the code I identified the useless (i.e. likely optimized
    away) memset.

diff --git a/random/rndlinux.c b/random/rndlinux.c
index 89ac203..9eeec57 100644
--- a/random/rndlinux.c
+++ b/random/rndlinux.c
@@ -226,21 +226,23 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t,
 
       do
         {
-          int nbytes = length < sizeof(buffer)? length : sizeof(buffer);
-          n = read(fd, buffer, nbytes );
-          if( n >= 0 && n > nbytes )
+          size_t nbytes;
+
+          nbytes = length < sizeof(buffer)? length : sizeof(buffer);
+          n = read (fd, buffer, nbytes);
+          if (n >= 0 && n > nbytes)
             {
               log_error("bogus read from random device (n=%d)\n", n );
               n = nbytes;
             }
         }
-      while( n == -1 && errno == EINTR );
-      if ( n == -1 )
+      while (n == -1 && errno == EINTR);
+      if  (n == -1)
         log_fatal("read error on random device: %s\n", strerror(errno));
-      (*add)( buffer, n, origin );
+      (*add)(buffer, n, origin);
       length -= n;
     }
-  memset(buffer, 0, sizeof(buffer) );
+  wipememory (buffer, sizeof buffer);
 
   if (any_need_entropy)
     _gcry_random_progress ("need_entropy", 'X', (int)want, (int)want);

-----------------------------------------------------------------------

Summary of changes:
 random/rndlinux.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
The GNU crypto library
http://git.gnupg.org




More information about the Gnupg-commits mailing list