[git] GCRYPT - branch, LIBGCRYPT-1-5-BRANCH, updated. libgcrypt-1.5.0-5-gf84bfb4

by Werner Koch cvs at cvs.gnupg.org
Thu Sep 8 14:48:44 CEST 2011


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-5-BRANCH has been updated
       via  f84bfb4898b3cd8b552367ea251d0b8a59a7e759 (commit)
       via  061b11de60415e228f33599270d66aafe4b88d72 (commit)
      from  674f10dba527f8c50af028c97cf046e16bc4e6fb (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 f84bfb4898b3cd8b552367ea251d0b8a59a7e759
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Sep 8 14:04:55 2011 +0200

    Let GCRYPT_NO_DEPRECATED also cover gcry_ac structures.

diff --git a/src/ChangeLog b/src/ChangeLog
index 8506532..ad08ddf 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-08  Werner Koch  <wk at g10code.com>
+
+	* gcrypt.h.in [GCRYPT_NO_DEPRECATED]: Exclude gcry_ac structures.
+
 2011-06-10  Werner Koch  <wk at g10code.com>
 
 	* sexp.c (vsexp_sscan): Add new format specifiers 'M' and 'u'.
diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in
index 63f71c0..44070bc 100644
--- a/src/gcrypt.h.in
+++ b/src/gcrypt.h.in
@@ -1249,6 +1249,7 @@ void gcry_md_debug (gcry_md_hd_t hd, const char *suffix);
 gcry_error_t gcry_md_list (int *list, int *list_length);
 
 
+#if !defined(GCRYPT_NO_DEPRECATED) || defined(_GCRYPT_IN_LIBGCRYPT)
 /* Alternative interface for asymmetric cryptography.  This interface
    is deprecated.  */
 
@@ -1400,6 +1401,7 @@ typedef struct gcry_ac_ssa_pkcs_v1_5
 {
   gcry_md_algo_t md;
 } gcry_ac_ssa_pkcs_v1_5_t _GCRY_ATTR_INTERNAL;
+#endif /* !GCRYPT_NO_DEPRECATED || !_GCRYPT_IN_LIBGCRYPT */
 
 
 #ifndef GCRYPT_NO_DEPRECATED

commit 061b11de60415e228f33599270d66aafe4b88d72
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Sep 8 10:53:12 2011 +0200

    Fix a problem with select and high fds.
    
    If on systems where the maximum number of fds may be dynamically
    configured to a value of FD_MAXSIZE or higher and the RNG is first
    used after more than FD_SETSIZE-1 descriptors are in use, we disable
    the progress messages from the RNG.  A better solution would be too
    use poll but that requires more tests.
    
    The same problem exists in rndunix.c - however this rng is only used
    on old Unices and I assume that they don't feature dynamically
    configured maximum fd sizes.

diff --git a/random/ChangeLog b/random/ChangeLog
index 7784d44..b7a0d5a 100644
--- a/random/ChangeLog
+++ b/random/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-08  Werner Koch  <wk at g10code.com>
+
+	* rndlinux.c (_gcry_rndlinux_gather_random): Don't use select if
+	the fd number is too high.  Reported by Jakub Bogusz.
+
 2010-10-18  Werner Koch  <wk at g10code.com>
 
 	* rndw32.c (registry_poll): Disable performace fata gathering if
diff --git a/random/rndlinux.c b/random/rndlinux.c
index 5b84a19..b304cc9 100644
--- a/random/rndlinux.c
+++ b/random/rndlinux.c
@@ -134,29 +134,39 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t,
       struct timeval tv;
       int rc;
 
-      FD_ZERO(&rfds);
-      FD_SET(fd, &rfds);
-      tv.tv_sec = delay;
-      tv.tv_usec = delay? 0 : 100000;
-      if ( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) )
+      /* If the system has no limit on the number of file descriptors
+         and we encounter an fd which is larger than the fd_set size,
+         we don't use the select at all.  The select code is only used
+         to emit progress messages.  A better solution would be to
+         fall back to poll() if available.  */
+#ifdef FD_SETSIZE
+      if (fd < FD_SETSIZE)
+#endif
         {
-          if (!any_need_entropy || last_so_far != (want - length) )
+          FD_ZERO(&rfds);
+          FD_SET(fd, &rfds);
+          tv.tv_sec = delay;
+          tv.tv_usec = delay? 0 : 100000;
+          if ( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) )
             {
-              last_so_far = want - length;
-              _gcry_random_progress ("need_entropy", 'X',
-                                     (int)last_so_far, (int)want);
-              any_need_entropy = 1;
-	    }
-          delay = 3; /* Use 3 seconds henceforth.  */
-	  continue;
-	}
-      else if( rc == -1 )
-        {
-          log_error ("select() error: %s\n", strerror(errno));
-          if (!delay)
-            delay = 1; /* Use 1 second if we encounter an error before
+              if (!any_need_entropy || last_so_far != (want - length) )
+                {
+                  last_so_far = want - length;
+                  _gcry_random_progress ("need_entropy", 'X',
+                                         (int)last_so_far, (int)want);
+                  any_need_entropy = 1;
+                }
+              delay = 3; /* Use 3 seconds henceforth.  */
+              continue;
+            }
+          else if( rc == -1 )
+            {
+              log_error ("select() error: %s\n", strerror(errno));
+              if (!delay)
+                delay = 1; /* Use 1 second if we encounter an error before
                           we have ever blocked.  */
-          continue;
+              continue;
+            }
         }
 
       do
diff --git a/random/rndunix.c b/random/rndunix.c
index cc5eb14..1b810d7 100644
--- a/random/rndunix.c
+++ b/random/rndunix.c
@@ -551,7 +551,8 @@ slow_poll(FILE *dbgfp, int dbgall, size_t *nbytes )
 #else
 #error O_NONBLOCK is missing
 #endif
-
+            /* FIXME: We need to make sure that the fd is less than
+               FD_SETSIZE.  */
 	    FD_SET(dataSources[i].pipeFD, &fds);
 	    dataSources[i].length = 0;
 

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

Summary of changes:
 random/ChangeLog  |    5 +++++
 random/rndlinux.c |   50 ++++++++++++++++++++++++++++++--------------------
 random/rndunix.c  |    3 ++-
 src/ChangeLog     |    4 ++++
 src/gcrypt.h.in   |    2 ++
 5 files changed, 43 insertions(+), 21 deletions(-)


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




More information about the Gnupg-commits mailing list