[git] GCRYPT - branch, LIBGCRYPT-1-6-BRANCH, updated. libgcrypt-1.6.3-16-g936098e

by Werner Koch cvs at cvs.gnupg.org
Tue Sep 8 08:53:16 CEST 2015


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  936098e99bd29cb3627c6aa296e3895feb53fa27 (commit)
       via  72e8c2715dff99b63ef3c1541ae0dbfee4e99410 (commit)
       via  6098f88d17754683e1003c5ead77b707117c3cd0 (commit)
       via  84be4b23fca5faa910f04965e3e6b92ba2dc594f (commit)
      from  59058aaca0892f5259f233a3a2af1e5084716198 (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 936098e99bd29cb3627c6aa296e3895feb53fa27
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Sep 8 08:50:28 2015 +0200

    Post release updates.
    
    --

diff --git a/NEWS b/NEWS
index 07b4b6e..25689ba 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Noteworthy changes in version 1.6.5 (unreleased) [C20/A0/R_]
+------------------------------------------------
+
+
 Noteworthy changes in version 1.6.4 (2015-09-08) [C20/A0/R4]
 ------------------------------------------------
 
diff --git a/configure.ac b/configure.ac
index 985e045..eb1ba34 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,7 +30,7 @@ min_automake_version="1.14"
 # for the LT versions.
 m4_define(mym4_version_major, [1])
 m4_define(mym4_version_minor, [6])
-m4_define(mym4_version_micro, [4])
+m4_define(mym4_version_micro, [5])
 
 # Below is m4 magic to extract and compute the revision number, the
 # decimalized short revision number, a beta version string, and a flag

commit 72e8c2715dff99b63ef3c1541ae0dbfee4e99410
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Sep 8 08:29:55 2015 +0200

    Release 1.6.4.
    
    * configure.ac: Change LT version to C20/A0/R4.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/NEWS b/NEWS
index 85838ed..07b4b6e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,22 @@
-Noteworthy changes in version 1.6.4 (unreleased) [C20/A0/R3]
+Noteworthy changes in version 1.6.4 (2015-09-08) [C20/A0/R4]
 ------------------------------------------------
 
+ * Speed up the random number generator by requiring less extra
+   seeding.
+
  * New flag "no-keytest" for ECC key generation.  Due to a bug in the
    parser that flag will also be accepted but ignored by older version
    of Libgcrypt.
 
+ * Always verify a created RSA signature to avoid private key leaks
+   due to hardware failures.
+
+ * Fix alignment bug in the AESNI code on Windows > 7.
+
+ * Support FreeBSD 10 and later.
+
+ * Other minor bug fixes.
+
 
 Noteworthy changes in version 1.6.3 (2015-02-27) [C20/A0/R3]
 ------------------------------------------------
diff --git a/configure.ac b/configure.ac
index efcbc52..985e045 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,7 +56,7 @@ AC_INIT([libgcrypt],[mym4_full_version],[http://bugs.gnupg.org])
 #   (No interfaces changed:                   REVISION++)
 LIBGCRYPT_LT_CURRENT=20
 LIBGCRYPT_LT_AGE=0
-LIBGCRYPT_LT_REVISION=3
+LIBGCRYPT_LT_REVISION=4
 
 
 # If the API is changed in an incompatible way: increment the next counter.

commit 6098f88d17754683e1003c5ead77b707117c3cd0
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Sep 4 12:39:56 2015 +0200

    w32: Avoid a few compiler warnings.
    
    * cipher/cipher-selftest.c (_gcry_selftest_helper_cbc)
    (_gcry_selftest_helper_cfb, _gcry_selftest_helper_ctr): Mark variable
    as unused.
    * random/rndw32.c (slow_gatherer): Avoid signed pointer mismatch
    warning.
    * src/secmem.c (init_pool): Avoid unused variable warning.
    * tests/random.c (writen, readn): Include on if needed.
    --
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
    (cherry picked from commit e97c62a4a687b56d00a2d0a63e072a977f8eb81c)
    
    Resolved conflicts:
    	tests/gchash.c - Remove.

diff --git a/cipher/cipher-selftest.c b/cipher/cipher-selftest.c
index 0852332..e77fdf5 100644
--- a/cipher/cipher-selftest.c
+++ b/cipher/cipher-selftest.c
@@ -127,6 +127,8 @@ _gcry_selftest_helper_cbc (const char *cipher, gcry_cipher_setkey_t setkey_func,
       syslog (LOG_USER|LOG_WARNING, "Libgcrypt warning: "
               "%s-CBC-%d test failed (plaintext mismatch)", cipher,
 	      blocksize * 8);
+#else
+      (void)cipher; /* Not used.  */
 #endif
       return "selftest for CBC failed - see syslog for details";
     }
@@ -243,6 +245,8 @@ _gcry_selftest_helper_cfb (const char *cipher, gcry_cipher_setkey_t setkey_func,
       syslog (LOG_USER|LOG_WARNING, "Libgcrypt warning: "
               "%s-CFB-%d test failed (plaintext mismatch)", cipher,
 	      blocksize * 8);
+#else
+      (void)cipher; /* Not used.  */
 #endif
       return "selftest for CFB failed - see syslog for details";
     }
@@ -367,6 +371,8 @@ _gcry_selftest_helper_ctr (const char *cipher, gcry_cipher_setkey_t setkey_func,
       syslog (LOG_USER|LOG_WARNING, "Libgcrypt warning: "
               "%s-CTR-%d test failed (plaintext mismatch)", cipher,
 	      blocksize * 8);
+#else
+      (void)cipher; /* Not used.  */
 #endif
       return "selftest for CTR failed - see syslog for details";
     }
diff --git a/random/rndw32.c b/random/rndw32.c
index 4ab1bca..1325b18 100644
--- a/random/rndw32.c
+++ b/random/rndw32.c
@@ -513,7 +513,7 @@ slow_gatherer ( void (*add)(const void*, size_t, enum random_origins),
 
           status = RegQueryValueEx (hKey, "ProductType", 0, NULL,
                                     szValue, &dwSize);
-          if (status == ERROR_SUCCESS && stricmp (szValue, "WinNT"))
+          if (status == ERROR_SUCCESS && stricmp ((char*)szValue, "WinNT"))
             {
               /* Note: There are (at least) three cases for ProductType:
                  WinNT = NT Workstation, ServerNT = NT Server, LanmanNT =
diff --git a/src/secmem.c b/src/secmem.c
index cce1a03..69fdca9 100644
--- a/src/secmem.c
+++ b/src/secmem.c
@@ -370,8 +370,6 @@ lock_pool (void *p, size_t n)
 static void
 init_pool (size_t n)
 {
-  size_t pgsize;
-  long int pgsize_val;
   memblock_t *mb;
 
   pool_size = n;
@@ -379,48 +377,54 @@ init_pool (size_t n)
   if (disable_secmem)
     log_bug ("secure memory is disabled");
 
-#if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
-  pgsize_val = sysconf (_SC_PAGESIZE);
-#elif defined(HAVE_GETPAGESIZE)
-  pgsize_val = getpagesize ();
-#else
-  pgsize_val = -1;
-#endif
-  pgsize = (pgsize_val != -1 && pgsize_val > 0)? pgsize_val:DEFAULT_PAGE_SIZE;
-
 
 #if HAVE_MMAP
-  pool_size = (pool_size + pgsize - 1) & ~(pgsize - 1);
-#ifdef MAP_ANONYMOUS
-  pool = mmap (0, pool_size, PROT_READ | PROT_WRITE,
-	       MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-#else /* map /dev/zero instead */
   {
-    int fd;
+    size_t pgsize;
+    long int pgsize_val;
+
+# if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
+    pgsize_val = sysconf (_SC_PAGESIZE);
+# elif defined(HAVE_GETPAGESIZE)
+    pgsize_val = getpagesize ();
+# else
+    pgsize_val = -1;
+# endif
+    pgsize = (pgsize_val != -1 && pgsize_val > 0)? pgsize_val:DEFAULT_PAGE_SIZE;
+
+    pool_size = (pool_size + pgsize - 1) & ~(pgsize - 1);
+# ifdef MAP_ANONYMOUS
+    pool = mmap (0, pool_size, PROT_READ | PROT_WRITE,
+                 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+# else /* map /dev/zero instead */
+    {
+      int fd;
 
-    fd = open ("/dev/zero", O_RDWR);
-    if (fd == -1)
-      {
-	log_error ("can't open /dev/zero: %s\n", strerror (errno));
-	pool = (void *) -1;
-      }
+      fd = open ("/dev/zero", O_RDWR);
+      if (fd == -1)
+        {
+          log_error ("can't open /dev/zero: %s\n", strerror (errno));
+          pool = (void *) -1;
+        }
+      else
+        {
+          pool = mmap (0, pool_size,
+                       (PROT_READ | PROT_WRITE), MAP_PRIVATE, fd, 0);
+          close (fd);
+        }
+    }
+# endif
+    if (pool == (void *) -1)
+      log_info ("can't mmap pool of %u bytes: %s - using malloc\n",
+                (unsigned) pool_size, strerror (errno));
     else
       {
-	pool = mmap (0, pool_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
-        close (fd);
+        pool_is_mmapped = 1;
+        pool_okay = 1;
       }
   }
-#endif
-  if (pool == (void *) -1)
-    log_info ("can't mmap pool of %u bytes: %s - using malloc\n",
-	      (unsigned) pool_size, strerror (errno));
-  else
-    {
-      pool_is_mmapped = 1;
-      pool_okay = 1;
-    }
+#endif /*HAVE_MMAP*/
 
-#endif
   if (!pool_okay)
     {
       pool = malloc (pool_size);
diff --git a/tests/fipsdrv.c b/tests/fipsdrv.c
index eef2ddd..b3da2a3 100644
--- a/tests/fipsdrv.c
+++ b/tests/fipsdrv.c
@@ -2358,14 +2358,14 @@ main (int argc, char **argv)
             {
               if (!(++count % 1000))
                 fprintf (stderr, PGM ": %lu random bytes so far\n",
-                         (unsigned long int)count * sizeof buffer);
+                         (unsigned long int)(count * sizeof buffer));
             }
         }
       while (loop_mode);
 
       if (progress)
         fprintf (stderr, PGM ": %lu random bytes\n",
-                         (unsigned long int)count * sizeof buffer);
+                 (unsigned long int)(count * sizeof buffer));
 
       deinit_external_rng_test (context);
     }
diff --git a/tests/random.c b/tests/random.c
index 10bf646..d7a624a 100644
--- a/tests/random.c
+++ b/tests/random.c
@@ -87,7 +87,7 @@ progress_cb (void *cb_data, const char *what, int printchar,
 }
 
 
-
+#ifndef HAVE_W32_SYSTEM
 static int
 writen (int fd, const void *buf, size_t nbytes)
 {
@@ -110,7 +110,10 @@ writen (int fd, const void *buf, size_t nbytes)
 
   return 0;
 }
+#endif /*!HAVE_W32_SYSTEM*/
+
 
+#ifndef HAVE_W32_SYSTEM
 static int
 readn (int fd, void *buf, size_t buflen, size_t *ret_nread)
 {
@@ -136,7 +139,7 @@ readn (int fd, void *buf, size_t buflen, size_t *ret_nread)
     *ret_nread = buflen - nleft;
   return 0;
 }
-
+#endif /*!HAVE_W32_SYSTEM*/
 
 
 /* Check that forking won't return the same random. */

commit 84be4b23fca5faa910f04965e3e6b92ba2dc594f
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Wed Apr 29 18:18:07 2015 +0300

    Prepare random/win32.c fast poll for 64-bit Windows
    
    * random/win32.c (_gcry_rndw32_gather_random_fast) [ADD]: Rename to
    ADDINT.
    (_gcry_rndw32_gather_random_fast): Add ADDPTR.
    (_gcry_rndw32_gather_random_fast): Disable entropy gathering from
    GetQueueStatus(QS_ALLEVENTS).
    (_gcry_rndw32_gather_random_fast): Change minimumWorkingSetSize and
    maximumWorkingSetSize to SIZE_T from DWORD.
    (_gcry_rndw32_gather_random_fast): Only add lower 32-bits of
    minimumWorkingSetSize and maximumWorkingSetSize to random poll.
    (_gcry_rndw32_gather_random_fast) [__WIN64__]: Read TSC directly
    using intrinsic.
    --
    
    Introduce entropy gatherer changes related to 64-bit Windows platform as done
    in cryptlib fast poll:
     - Change ADD macro to ADDPTR/ADDINT to handle pointer values. ADDPTR
       discards high 32-bits of 64-bit pointer values.
     - minimum/maximumWorkingSetSize changed to SIZE_T type to avoid stack
       corruption on 64-bit; only low 32-bits are used for entropy.
     - Use __rdtsc() intrinsic on 64-bit (as TSC is always available).
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
    
    (cherry picked from commit 0cdd24456b33defc7f8176fa82ab694fbc284385)

diff --git a/random/rndw32.c b/random/rndw32.c
index c495131..4ab1bca 100644
--- a/random/rndw32.c
+++ b/random/rndw32.c
@@ -826,39 +826,47 @@ _gcry_rndw32_gather_random_fast (void (*add)(const void*, size_t,
      cursor position for last message, 1 ms time for last message,
      handle of window with clipboard open, handle of process heap,
      handle of procs window station, types of events in input queue,
-     and milliseconds since Windows was started.  */
+     and milliseconds since Windows was started. On 64-bit platform
+     some of these return values are pointers and thus 64-bit wide.
+     We discard the upper 32-bit of those values.  */
 
   {
     byte buffer[20*sizeof(ulong)], *bufptr;
 
     bufptr = buffer;
-#define ADD(f)  do { ulong along = (ulong)(f);                  \
-                     memcpy (bufptr, &along, sizeof (along) );  \
-                     bufptr += sizeof (along);                  \
-                   } while (0)
-
-    ADD ( GetActiveWindow ());
-    ADD ( GetCapture ());
-    ADD ( GetClipboardOwner ());
-    ADD ( GetClipboardViewer ());
-    ADD ( GetCurrentProcess ());
-    ADD ( GetCurrentProcessId ());
-    ADD ( GetCurrentThread ());
-    ADD ( GetCurrentThreadId ());
-    ADD ( GetDesktopWindow ());
-    ADD ( GetFocus ());
-    ADD ( GetInputState ());
-    ADD ( GetMessagePos ());
-    ADD ( GetMessageTime ());
-    ADD ( GetOpenClipboardWindow ());
-    ADD ( GetProcessHeap ());
-    ADD ( GetProcessWindowStation ());
-    ADD ( GetQueueStatus (QS_ALLEVENTS));
-    ADD ( GetTickCount ());
+#define ADDINT(f)  do { ulong along = (ulong)(f);                  \
+                        memcpy (bufptr, &along, sizeof (along) );  \
+                        bufptr += sizeof (along);                  \
+                      } while (0)
+#define ADDPTR(f)  do { void *aptr = (f);                          \
+                        ADDINT((SIZE_T)aptr);                      \
+                      } while (0)
+
+    ADDPTR ( GetActiveWindow ());
+    ADDPTR ( GetCapture ());
+    ADDPTR ( GetClipboardOwner ());
+    ADDPTR ( GetClipboardViewer ());
+    ADDPTR ( GetCurrentProcess ());
+    ADDINT ( GetCurrentProcessId ());
+    ADDPTR ( GetCurrentThread ());
+    ADDINT ( GetCurrentThreadId ());
+    ADDPTR ( GetDesktopWindow ());
+    ADDPTR ( GetFocus ());
+    ADDINT ( GetInputState ());
+    ADDINT ( GetMessagePos ());
+    ADDINT ( GetMessageTime ());
+    ADDPTR ( GetOpenClipboardWindow ());
+    ADDPTR ( GetProcessHeap ());
+    ADDPTR ( GetProcessWindowStation ());
+    /* Following function in some cases stops returning events, and cannot
+       be used as an entropy source.  */
+    /*ADDINT ( GetQueueStatus (QS_ALLEVENTS));*/
+    ADDINT ( GetTickCount ());
 
     gcry_assert ( bufptr-buffer < sizeof (buffer) );
     (*add) ( buffer, bufptr-buffer, origin );
-#undef ADD
+#undef ADDINT
+#undef ADDPTR
   }
 
   /* Get multiword system information: Current caret position, current
@@ -888,7 +896,7 @@ _gcry_rndw32_gather_random_fast (void (*add)(const void*, size_t,
   {
     HANDLE handle;
     FILETIME creationTime, exitTime, kernelTime, userTime;
-    DWORD minimumWorkingSetSize, maximumWorkingSetSize;
+    SIZE_T minimumWorkingSetSize, maximumWorkingSetSize;
 
     handle = GetCurrentThread ();
     GetThreadTimes (handle, &creationTime, &exitTime,
@@ -910,10 +918,9 @@ _gcry_rndw32_gather_random_fast (void (*add)(const void*, size_t,
        process.  */
     GetProcessWorkingSetSize (handle, &minimumWorkingSetSize,
                               &maximumWorkingSetSize);
-    (*add) ( &minimumWorkingSetSize,
-             sizeof (minimumWorkingSetSize), origin );
-    (*add) ( &maximumWorkingSetSize,
-             sizeof (maximumWorkingSetSize), origin );
+    /* On 64-bit system, discard the high 32-bits. */
+    (*add) ( &minimumWorkingSetSize, sizeof (int), origin );
+    (*add) ( &maximumWorkingSetSize, sizeof (int), origin );
   }
 
 
@@ -961,7 +968,20 @@ _gcry_rndw32_gather_random_fast (void (*add)(const void*, size_t,
 
      To make things unambiguous, we detect a CPU new enough to call RDTSC
      directly by checking for CPUID capabilities, and fall back to QPC if
-     this isn't present.  */
+     this isn't present.
+
+     On AMD64, TSC is always available and intrinsic is provided for accessing
+     it.  */
+#ifdef __WIN64__
+    {
+      unsigned __int64 aint64;
+
+      /* Note: cryptlib does not discard upper 32 bits of TSC on WIN64, but does
+       * on WIN32.  Is this correct?  */
+      aint64 = __rdtsc();
+      (*add) (&aint64, sizeof(aint64), origin);
+    }
+#else
 #ifdef __GNUC__
 /*   FIXME: We would need to implement the CPU feature tests first.  */
 /*   if (cpu_has_feature_rdtsc) */
@@ -990,6 +1010,7 @@ _gcry_rndw32_gather_random_fast (void (*add)(const void*, size_t,
           (*add) (&aword, sizeof (aword), origin );
         }
     }
+#endif /*__WIN64__*/
 
 
 }

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

Summary of changes:
 NEWS                     | 18 +++++++++-
 cipher/cipher-selftest.c |  6 ++++
 configure.ac             |  4 +--
 random/rndw32.c          | 85 ++++++++++++++++++++++++++++++------------------
 src/secmem.c             | 74 +++++++++++++++++++++--------------------
 tests/fipsdrv.c          |  4 +--
 tests/random.c           |  7 ++--
 7 files changed, 124 insertions(+), 74 deletions(-)


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




More information about the Gnupg-commits mailing list