[git] GCRYPT - branch, master, updated. libgcrypt-1.6.0-64-ga79c4ad

by Werner Koch cvs at cvs.gnupg.org
Tue Apr 22 10:34:32 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, master has been updated
       via  a79c4ad7c56ee4410f17beb73eeb58b0dd36bfc6 (commit)
      from  773e23698218755e9172d2507031a8263c47cc0b (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 a79c4ad7c56ee4410f17beb73eeb58b0dd36bfc6
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


_______________________________________________
Gnupg-commits mailing list
Gnupg-commits at gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-commits




More information about the Gcrypt-devel mailing list