[git] GnuPG - branch, master, updated. gnupg-2.2.7-293-g73e74de

by Jussi Kivilinna cvs at cvs.gnupg.org
Sat Dec 1 12:59:02 CET 2018


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 Privacy Guard".

The branch, master has been updated
       via  73e74de0e33bbb76300f96a4174024779047df06 (commit)
       via  654e353d9b20f10fa275e7ae10cc50480654f079 (commit)
       via  2a650772b4e1c78a4fd20bc88433930e5551fe9c (commit)
      from  3a90efb7cf13532cc82b45c11a7abdadfe0c81f1 (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 73e74de0e33bbb76300f96a4174024779047df06
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Sat Dec 1 13:43:10 2018 +0200

    g10/mainproc: disable hash contexts when --skip-verify is used
    
    * g10/mainproc.c (proc_plaintext): Do not enable hash contexts when
    opt.skip_verify is set.
    --
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/g10/mainproc.c b/g10/mainproc.c
index 7eceb7e..dce3f37 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -862,7 +862,10 @@ proc_plaintext( CTX c, PACKET *pkt )
           /* The onepass signature case. */
           if (n->pkt->pkt.onepass_sig->digest_algo)
             {
-              gcry_md_enable (c->mfx.md, n->pkt->pkt.onepass_sig->digest_algo);
+              if (!opt.skip_verify)
+                gcry_md_enable (c->mfx.md,
+                                n->pkt->pkt.onepass_sig->digest_algo);
+
               any = 1;
             }
         }
@@ -880,7 +883,8 @@ proc_plaintext( CTX c, PACKET *pkt )
            * documents.  */
           clearsig = (*data == 0x01);
           for (data++, datalen--; datalen; datalen--, data++)
-            gcry_md_enable (c->mfx.md, *data);
+            if (!opt.skip_verify)
+              gcry_md_enable (c->mfx.md, *data);
           any = 1;
           break;  /* Stop here as one-pass signature packets are not
                      expected.  */
@@ -888,7 +892,8 @@ proc_plaintext( CTX c, PACKET *pkt )
       else if (n->pkt->pkttype == PKT_SIGNATURE)
         {
           /* The SIG+LITERAL case that PGP used to use.  */
-          gcry_md_enable ( c->mfx.md, n->pkt->pkt.signature->digest_algo );
+          if (!opt.skip_verify)
+            gcry_md_enable (c->mfx.md, n->pkt->pkt.signature->digest_algo);
           any = 1;
         }
     }

commit 654e353d9b20f10fa275e7ae10cc50480654f079
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Sat Dec 1 13:43:10 2018 +0200

    common/iobuf: fix memory wiping in iobuf_copy
    
    * common/iobuf.c (iobuf_copy): Wipe used area of buffer instead of
    first sizeof(char*) bytes.
    --
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/common/iobuf.c b/common/iobuf.c
index 5eeba8f..0594425 100644
--- a/common/iobuf.c
+++ b/common/iobuf.c
@@ -2262,6 +2262,7 @@ iobuf_copy (iobuf_t dest, iobuf_t source)
 
   size_t nread;
   size_t nwrote = 0;
+  size_t max_read = 0;
   int err;
 
   assert (source->use == IOBUF_INPUT || source->use == IOBUF_INPUT_TEMP);
@@ -2278,6 +2279,9 @@ iobuf_copy (iobuf_t dest, iobuf_t source)
         /* EOF.  */
         break;
 
+      if (nread > max_read)
+        max_read = nread;
+
       err = iobuf_write (dest, temp, nread);
       if (err)
         break;
@@ -2285,7 +2289,8 @@ iobuf_copy (iobuf_t dest, iobuf_t source)
     }
 
   /* Burn the buffer.  */
-  wipememory (temp, sizeof (temp));
+  if (max_read)
+    wipememory (temp, max_read);
   xfree (temp);
 
   return nwrote;

commit 2a650772b4e1c78a4fd20bc88433930e5551fe9c
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Sat Dec 1 13:43:09 2018 +0200

    common/mischelp: use platform memory zeroing function for wipememory
    
    * common/mischelp.h (wipememory): Replace macro with function
    prototype.
    (wipememory2): Remove.
    * common/mischelp.c (wipememory): New.
    * configure.ac (AC_CHECK_FUNCS): Check for 'explicit_bzero'.
    --
    
    In new wipememory function, memory is cleared through platform
    provided secure memory zeroing function, SecureZeroMemory
    or explicit_bzero.
    
    If none of these is available, memset is called through
    volatile function pointer to so that compiler won't optimize
    away the call.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/common/mischelp.c b/common/mischelp.c
index 75ba607..81dd501 100644
--- a/common/mischelp.c
+++ b/common/mischelp.c
@@ -49,6 +49,22 @@
 #include "mischelp.h"
 
 
+void
+wipememory (void *ptr, size_t len)
+{
+#if defined(HAVE_W32_SYSTEM) && defined(SecureZeroMemory)
+  SecureZeroMemory (ptr, len);
+#elif defined(HAVE_EXPLICIT_BZERO)
+  explicit_bzero (ptr, len);
+#else
+  /* Prevent compiler from optimizing away the call to memset by accessing
+     memset through volatile pointer. */
+  static void *(*volatile memset_ptr)(void *, int, size_t) = (void *)memset;
+  memset_ptr (ptr, 0, len);
+#endif
+}
+
+
 /* Check whether the files NAME1 and NAME2 are identical.  This is for
    example achieved by comparing the inode numbers of the files.  */
 int
diff --git a/common/mischelp.h b/common/mischelp.h
index 18ec96e..bdee5a4 100644
--- a/common/mischelp.h
+++ b/common/mischelp.h
@@ -47,15 +47,9 @@ time_t timegm (struct tm *tm);
 #define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
 #define DIMof(type,member)   DIM(((type *)0)->member)
 
-/* To avoid that a compiler optimizes certain memset calls away, these
-   macros may be used instead. */
-#define wipememory2(_ptr,_set,_len) do { \
-              volatile char *_vptr=(volatile char *)(_ptr); \
-              size_t _vlen=(_len); \
-              while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } \
-                  } while(0)
-#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
-
+/* To avoid that a compiler optimizes certain memset calls away,
+   wipememory function may be used instead.  */
+void wipememory(void *ptr, size_t len);
 
 /* Include hacks which are mainly required for Slowaris.  */
 #ifdef GNUPG_COMMON_NEED_AFLOCAL
diff --git a/configure.ac b/configure.ac
index 9d3eb41..89ef939 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1400,16 +1400,16 @@ AC_FUNC_FSEEKO
 AC_FUNC_VPRINTF
 AC_FUNC_FORK
 AC_CHECK_FUNCS([atexit canonicalize_file_name clock_gettime ctermid  \
-                fcntl flockfile fsync ftello ftruncate funlockfile   \
-                getaddrinfo getenv getpagesize getpwnam getpwuid     \
-                getrlimit getrusage gettimeofday gmtime_r            \
-                inet_ntop inet_pton isascii lstat                    \
-                memicmp memmove memrchr mmap nl_langinfo pipe        \
-                raise rand setenv setlocale setrlimit sigaction      \
-                sigprocmask stat stpcpy strcasecmp strerror strftime \
-                stricmp strlwr strncasecmp strpbrk strsep            \
-                strtol strtoul strtoull tcgetattr timegm times       \
-                ttyname unsetenv wait4 waitpid ])
+                explicit_bzero fcntl flockfile fsync ftello          \
+                ftruncate funlockfile getaddrinfo getenv getpagesize \
+                getpwnam getpwuid getrlimit getrusage gettimeofday   \
+                gmtime_r inet_ntop inet_pton isascii lstat memicmp   \
+                memmove memrchr mmap nl_langinfo pipe raise rand     \
+                setenv setlocale setrlimit sigaction sigprocmask     \
+                stat stpcpy strcasecmp strerror strftime stricmp     \
+                strlwr strncasecmp strpbrk strsep strtol strtoul     \
+                strtoull tcgetattr timegm times ttyname unsetenv     \
+                wait4 waitpid ])
 
 # On some systems (e.g. Solaris) nanosleep requires linking to librl.
 # Given that we use nanosleep only as an optimization over a select

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

Summary of changes:
 common/iobuf.c    |  7 ++++++-
 common/mischelp.c | 16 ++++++++++++++++
 common/mischelp.h | 12 +++---------
 configure.ac      | 20 ++++++++++----------
 g10/mainproc.c    | 11 ++++++++---
 5 files changed, 43 insertions(+), 23 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list