[git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.4-4-ga684988

by Kristian Fiskerstrand cvs at cvs.gnupg.org
Fri Dec 22 13:45:53 CET 2017


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, STABLE-BRANCH-2-2 has been updated
       via  a6849888295f0e0872c948cd72a59374bb867777 (commit)
       via  f3ba66781a07af2e32f5887e6e15acdd4822a431 (commit)
      from  290348e349e8d56a856f187a08e913f2ed525b3c (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 a6849888295f0e0872c948cd72a59374bb867777
Author: Kristian Fiskerstrand <kf at sumptuouscapital.com>
Date:   Wed Dec 20 21:12:01 2017 +0100

    build: Increase libassuan min version to 2.5.0
    
    --
    assuan_sock_set_system_hooks is used unconditionally in gnupg since
    commit 9f641430dcdecbd7ee205d407cb19bb4262aa95d, and as such it requires
    libassuan 2.5.0 (function introduced in
    commit 90dc81682b13a7cf716a8a26b891051cbd4b0caf)
    
    For a detailed description see:
    https://lists.gnupg.org/pipermail/gnupg-devel/2017-December/033323.html

diff --git a/configure.ac b/configure.ac
index 33148b4..c3fce31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,7 @@ NEED_LIBGCRYPT_API=1
 NEED_LIBGCRYPT_VERSION=1.7.0
 
 NEED_LIBASSUAN_API=2
-NEED_LIBASSUAN_VERSION=2.4.3
+NEED_LIBASSUAN_VERSION=2.5.0
 
 NEED_KSBA_API=1
 NEED_KSBA_VERSION=1.3.4

commit f3ba66781a07af2e32f5887e6e15acdd4822a431
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Dec 22 12:55:32 2017 +0100

    kbx: Simplify by removing custom memory functions.
    
    * kbx/keybox-util.c (keybox_set_malloc_hooks): Remove.
    (_keybox_malloc, _keybox_calloc, keybox_realloc)
    (_keybox_free): Remove.
    (keybox_file_rename): Remove.  Was not used.
    * sm/gpgsm.c (main): Remove call to keybox_set_malloc_hooks.
    * kbx/kbxutil.c (main): Ditto.
    * kbx/keybox-defs.h: Remove all separate includes.  Include util.h.
    remove convenience macros.
    * common/logging.h (return_if_fail): New.  Originally from
    keybox-defs.h but now using log_debug.
    (return_null_if_fail): Ditto.
    (return_val_if_fail): Ditto.
    (never_reached): Ditto.
    --
    
    Originally the KBX code was written to allow standalone use.  However
    this required lot of ugliness like separate memory allocators and
    such.  It also precludes the use of some standard functions from
    common due to their use of the common gnupg malloc functions.
    Dropping all that makes things easier.  Minor disadvantages: the kbx
    call done for gpg will now use gcry malloc fucntions and not the
    standard malloc functions.  This might be a bit slower but removing
    them even fixes a possible bug in keybox_tmp_names which is used in
    gpg and uses gpg's xfree which is actually gcry_free.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/logging.h b/common/logging.h
index e1bf56b..2225100 100644
--- a/common/logging.h
+++ b/common/logging.h
@@ -112,4 +112,30 @@ void log_printhex (const char *text, const void *buffer, size_t length);
 void log_clock (const char *string);
 
 
+/* Some handy assertion macros which don't abort.  */
+
+#define return_if_fail(expr) do {                        \
+    if (!(expr)) {                                       \
+        log_debug ("%s:%d: assertion '%s' failed\n",     \
+                   __FILE__, __LINE__, #expr );          \
+        return;	                                         \
+    } } while (0)
+#define return_null_if_fail(expr) do {                   \
+    if (!(expr)) {                                       \
+        log_debug ("%s:%d: assertion '%s' failed\n",     \
+                   __FILE__, __LINE__, #expr );          \
+        return NULL;	                                 \
+    } } while (0)
+#define return_val_if_fail(expr,val) do {                \
+    if (!(expr)) {                                       \
+        log_debug ("%s:%d: assertion '%s' failed\n",     \
+                   __FILE__, __LINE__, #expr );          \
+        return (val);	                                 \
+    } } while (0)
+#define never_reached() do {                             \
+    log_debug ("%s:%d: oops - should never get here\n",  \
+               __FILE__, __LINE__ );                     \
+    } while (0)
+
+
 #endif /*GNUPG_COMMON_LOGGING_H*/
diff --git a/kbx/kbxutil.c b/kbx/kbxutil.c
index 9b43584..07774f2 100644
--- a/kbx/kbxutil.c
+++ b/kbx/kbxutil.c
@@ -464,7 +464,6 @@ main( int argc, char **argv )
   /*create_dotlock(NULL); register locking cleanup */
 
   /* We need to use the gcry malloc function because jnlib uses them.  */
-  keybox_set_malloc_hooks (gcry_malloc, gcry_realloc, gcry_free);
   ksba_set_malloc_hooks (gcry_malloc, gcry_realloc, gcry_free );
 
 
diff --git a/kbx/keybox-defs.h b/kbx/keybox-defs.h
index fd331f1..be2dd72 100644
--- a/kbx/keybox-defs.h
+++ b/kbx/keybox-defs.h
@@ -33,16 +33,7 @@
 
 #include <sys/types.h> /* off_t */
 
-/* We include the type definitions from jnlib instead of defining our
-   owns here.  This will not allow us build KBX in a standalone way
-   but there is currently no need for it anyway.  Same goes for
-   stringhelp.h which for example provides a replacement for stpcpy -
-   fixme: Better use the LIBOBJ mechnism. */
-#include "../common/types.h"
-#include "../common/stringhelp.h"
-#include "../common/dotlock.h"
-#include "../common/logging.h"
-
+#include "../common/util.h"
 #include "keybox.h"
 
 
@@ -209,64 +200,10 @@ int _keybox_dump_cut_records (const char *filename, unsigned long from,
 
 
 /*-- keybox-util.c --*/
-void *_keybox_malloc (size_t n);
-void *_keybox_calloc (size_t n, size_t m);
-void *_keybox_realloc (void *p, size_t n);
-void  _keybox_free (void *p);
-
-#define xtrymalloc(a)    _keybox_malloc ((a))
-#define xtrycalloc(a,b)  _keybox_calloc ((a),(b))
-#define xtryrealloc(a,b) _keybox_realloc((a),(b))
-#define xfree(a)         _keybox_free ((a))
-
-
-#define DIM(v) (sizeof(v)/sizeof((v)[0]))
-#define DIMof(type,member)   DIM(((type *)0)->member)
-#ifndef STR
-#  define STR(v) #v
-#endif
-#define STR2(v) STR(v)
 
 /*
-  a couple of handy macros
-*/
-
-#define return_if_fail(expr) do {                        \
-    if (!(expr)) {                                       \
-        fprintf (stderr, "%s:%d: assertion '%s' failed\n", \
-                 __FILE__, __LINE__, #expr );            \
-        return;	                                         \
-    } } while (0)
-#define return_null_if_fail(expr) do {                   \
-    if (!(expr)) {                                       \
-        fprintf (stderr, "%s:%d: assertion '%s' failed\n", \
-                 __FILE__, __LINE__, #expr );            \
-        return NULL;	                                 \
-    } } while (0)
-#define return_val_if_fail(expr,val) do {                \
-    if (!(expr)) {                                       \
-        fprintf (stderr, "%s:%d: assertion '%s' failed\n", \
-                 __FILE__, __LINE__, #expr );            \
-        return (val);	                                 \
-    } } while (0)
-#define never_reached() do {                                   \
-        fprintf (stderr, "%s:%d: oops; should never get here\n", \
-                 __FILE__, __LINE__ );                         \
-    } while (0)
-
-
-/* some macros to replace ctype ones and avoid locale problems */
-#define digitp(p)   (*(p) >= '0' && *(p) <= '9')
-#define hexdigitp(a) (digitp (a)                     \
-                      || (*(a) >= 'A' && *(a) <= 'F')  \
-                      || (*(a) >= 'a' && *(a) <= 'f'))
-/* the atoi macros assume that the buffer has only valid digits */
-#define atoi_1(p)   (*(p) - '0' )
-#define atoi_2(p)   ((atoi_1(p) * 10) + atoi_1((p)+1))
-#define atoi_4(p)   ((atoi_2(p) * 100) + atoi_2((p)+2))
-#define xtoi_1(p)   (*(p) <= '9'? (*(p)- '0'): \
-                     *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
-#define xtoi_2(p)   ((xtoi_1(p) * 16) + xtoi_1((p)+1))
+ * A couple of handy macros
+ */
 
 
 #endif /*KEYBOX_DEFS_H*/
diff --git a/kbx/keybox-util.c b/kbx/keybox-util.c
index b71335b..3ce5162 100644
--- a/kbx/keybox-util.c
+++ b/kbx/keybox-util.c
@@ -27,52 +27,6 @@
 #endif
 
 #include "keybox-defs.h"
-#include "../common/utilproto.h"
-
-
-static void *(*alloc_func)(size_t n) = malloc;
-static void *(*realloc_func)(void *p, size_t n) = realloc;
-static void (*free_func)(void*) = free;
-
-
-
-void
-keybox_set_malloc_hooks ( void *(*new_alloc_func)(size_t n),
-                          void *(*new_realloc_func)(void *p, size_t n),
-                          void (*new_free_func)(void*) )
-{
-  alloc_func	    = new_alloc_func;
-  realloc_func      = new_realloc_func;
-  free_func	    = new_free_func;
-}
-
-void *
-_keybox_malloc (size_t n)
-{
-  return alloc_func (n);
-}
-
-void *
-_keybox_realloc (void *a, size_t n)
-{
-  return realloc_func (a, n);
-}
-
-void *
-_keybox_calloc (size_t n, size_t m)
-{
-  void *p = _keybox_malloc (n*m);
-  if (p)
-    memset (p, 0, n* m);
-  return p;
-}
-
-void
-_keybox_free (void *p)
-{
-  if (p)
-    free_func (p);
-}
 
 
 /* Store the two malloced temporary file names used for keybox updates
@@ -146,10 +100,3 @@ keybox_tmp_names (const char *filename, int for_keyring,
   *r_tmpname = tmp_name;
   return 0;
 }
-
-gpg_error_t
-keybox_file_rename (const char *oldname, const char *newname,
-                    int *block_signals)
-{
-  return gnupg_rename_file (oldname, newname, block_signals);
-}
diff --git a/kbx/keybox.h b/kbx/keybox.h
index 29884b0..665b05f 100644
--- a/kbx/keybox.h
+++ b/kbx/keybox.h
@@ -127,10 +127,6 @@ int keybox_rebuild_cache (void *);
 
 
 /*-- keybox-util.c --*/
-void keybox_set_malloc_hooks ( void *(*new_alloc_func)(size_t n),
-                               void *(*new_realloc_func)(void *p, size_t n),
-                               void (*new_free_func)(void*) );
-
 gpg_error_t keybox_tmp_names (const char *filename, int for_keyring,
                               char **r_bakname, char **r_tmpname);
 
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index b505be1..ab08a52 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -1007,8 +1007,6 @@ main ( int argc, char **argv)
   assuan_set_gpg_err_source (GPG_ERR_SOURCE_DEFAULT);
   setup_libassuan_logging (&opt.debug, NULL);
 
-  keybox_set_malloc_hooks (gcry_malloc, gcry_realloc, gcry_free);
-
   /* Setup a default control structure for command line mode */
   memset (&ctrl, 0, sizeof ctrl);
   gpgsm_init_default_ctrl (&ctrl);

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

Summary of changes:
 common/logging.h  | 26 +++++++++++++++++++++
 configure.ac      |  2 +-
 kbx/kbxutil.c     |  1 -
 kbx/keybox-defs.h | 69 +++----------------------------------------------------
 kbx/keybox-util.c | 53 ------------------------------------------
 kbx/keybox.h      |  4 ----
 sm/gpgsm.c        |  2 --
 7 files changed, 30 insertions(+), 127 deletions(-)


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




More information about the Gnupg-commits mailing list