Require at least libgpg-error 1.36

* configure.ac (NEED_GPG_ERROR_VERSION): Require 1.36.
* src/cJSON.c: Remove code for older version.
* src/engine.c (gpgme_get_engine_info): Ditto.
* src/gpgme-json.c: Ditto.
* src/op-support.c: Ditto.
* src/util.h: Ditto.
--

Libgpg-error 1.36 has been released more than 18 months ago so it is
time to avoid hacks and require this verion.  This will for example
help Kleopatra to support PIV cards and improves the gpgme-json.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-11-09 11:48:42 +01:00
parent 35ca460019
commit eb99e8c483
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
7 changed files with 12 additions and 62 deletions

4
NEWS
View File

@ -1,4 +1,4 @@
Noteworthy changes in version 1.14.1 (unreleased) Noteworthy changes in version 1.15.0 (unreleased)
------------------------------------------------- -------------------------------------------------
* New function gpgme_op_setexpire to make changing the expiration * New function gpgme_op_setexpire to make changing the expiration
@ -18,6 +18,8 @@ Noteworthy changes in version 1.14.1 (unreleased)
* qt: Added QDebug stream operator for GpgME::Error. * qt: Added QDebug stream operator for GpgME::Error.
* Require a somewhat newer version of libgpg-error (1.36).
* Interface changes relative to the 1.14.0 release: * Interface changes relative to the 1.14.0 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpgme_op_setexpire_start NEW. gpgme_op_setexpire_start NEW.

View File

@ -85,7 +85,7 @@ AC_SUBST(LIBQGPGME_LT_REVISION)
GPGME_CONFIG_API_VERSION=1 GPGME_CONFIG_API_VERSION=1
############################################## ##############################################
NEED_GPG_ERROR_VERSION=1.24 NEED_GPG_ERROR_VERSION=1.36
NEED_LIBASSUAN_API=2 NEED_LIBASSUAN_API=2
NEED_LIBASSUAN_VERSION=2.4.2 NEED_LIBASSUAN_VERSION=2.4.2

View File

@ -66,25 +66,14 @@
#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len) #define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
/* We use malloc function wrappers from gpgrt (aka libgpg-error). */ /* We use malloc function wrappers from gpgrt (aka libgpg-error). */
#if GPGRT_VERSION_NUMBER >= 0x011c00 /* 1.28 */ #include <gpgrt.h>
# include <gpgrt.h> #define xtrycalloc(a,b) gpgrt_calloc ((a), (b))
# define xtrycalloc(a,b) gpgrt_calloc ((a), (b)) #define xtrystrdup(a) gpgrt_strdup ((a))
# define xtrystrdup(a) gpgrt_strdup ((a)) #define xfree(a) gpgrt_free ((a))
# define xfree(a) gpgrt_free ((a)) #if CALLOC_ONLY
# if CALLOC_ONLY # define xtrymalloc(a) gpgrt_calloc (1, (a))
# define xtrymalloc(a) gpgrt_calloc (1, (a)) #else
# else # define xtrymalloc(a) gpgrt_malloc ((a))
# define xtrymalloc(a) gpgrt_malloc ((a))
# endif
#else /* Without gpgrt (aka libgpg-error). */
# define xtrycalloc(a,b) calloc ((a), (b))
# define xtrystrdup(a) strdup ((a))
# define xfree(a) free ((a))
# if CALLOC_ONLY
# define xtrymalloc(a) calloc (1, (a))
# else
# define xtrymalloc(a) malloc ((a))
# endif
#endif #endif

View File

@ -258,11 +258,7 @@ gpgme_get_engine_info (gpgme_engine_info_t *info)
if (!err && version && engine_minimal_version if (!err && version && engine_minimal_version
&& !_gpgme_compare_versions (version, engine_minimal_version)) && !_gpgme_compare_versions (version, engine_minimal_version))
{ {
#if GPG_ERROR_VERSION_NUMBER < 0x011900 /* 1.25 */
err = gpg_error (GPG_ERR_NO_ENGINE);
#else
err = gpg_error (GPG_ERR_ENGINE_TOO_OLD); err = gpg_error (GPG_ERR_ENGINE_TOO_OLD);
#endif
} }
/* Now set the dummy version for pseudo engines. */ /* Now set the dummy version for pseudo engines. */

View File

@ -41,10 +41,6 @@
#include "cJSON.h" #include "cJSON.h"
#if GPGRT_VERSION_NUMBER < 0x011c00 /* 1.28 */
int main (void){fputs ("Build with Libgpg-error >= 1.28!\n", stderr);return 1;}
#else /* libgpg-error >= 1.28 */
/* We don't allow a request with more than 64 MiB. */ /* We don't allow a request with more than 64 MiB. */
#define MAX_REQUEST_SIZE (64 * 1024 * 1024) #define MAX_REQUEST_SIZE (64 * 1024 * 1024)
@ -246,9 +242,6 @@ static gpg_error_t
add_base64_to_object (cjson_t object, const char *name, add_base64_to_object (cjson_t object, const char *name,
const void *data, size_t datalen) const void *data, size_t datalen)
{ {
#if GPGRT_VERSION_NUMBER < 0x011d00 /* 1.29 */
return gpg_error (GPG_ERR_NOT_SUPPORTED);
#else
gpg_err_code_t err; gpg_err_code_t err;
estream_t fp = NULL; estream_t fp = NULL;
gpgrt_b64state_t state = NULL; gpgrt_b64state_t state = NULL;
@ -309,7 +302,6 @@ add_base64_to_object (cjson_t object, const char *name,
gpgrt_b64enc_finish (state); gpgrt_b64enc_finish (state);
es_fclose (fp); es_fclose (fp);
return err; return err;
#endif
} }
@ -629,10 +621,6 @@ release_onetime_context (gpgme_ctx_t ctx)
static gpg_error_t static gpg_error_t
data_from_base64_string (gpgme_data_t *r_data, cjson_t json) data_from_base64_string (gpgme_data_t *r_data, cjson_t json)
{ {
#if GPGRT_VERSION_NUMBER < 0x011d00 /* 1.29 */
*r_data = NULL;
return gpg_error (GPG_ERR_NOT_SUPPORTED);
#else
gpg_error_t err; gpg_error_t err;
size_t len; size_t len;
char *buf = NULL; char *buf = NULL;
@ -685,7 +673,6 @@ data_from_base64_string (gpgme_data_t *r_data, cjson_t json)
xfree (buf); xfree (buf);
gpgrt_b64dec_finish (state); gpgrt_b64dec_finish (state);
return err; return err;
#endif
} }
@ -3553,10 +3540,8 @@ interactive_repl (void)
int first; int first;
es_setvbuf (es_stdin, NULL, _IONBF, 0); es_setvbuf (es_stdin, NULL, _IONBF, 0);
#if GPGRT_VERSION_NUMBER >= 0x011d00 /* 1.29 */
es_fprintf (es_stderr, "%s %s ready (enter \",help\" for help)\n", es_fprintf (es_stderr, "%s %s ready (enter \",help\" for help)\n",
gpgrt_strusage (11), gpgrt_strusage (13)); gpgrt_strusage (11), gpgrt_strusage (13));
#endif
do do
{ {
es_fputs ("> ", es_stderr); es_fputs ("> ", es_stderr);
@ -3828,13 +3813,6 @@ my_strusage( int level )
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
#if GPGRT_VERSION_NUMBER < 0x011d00 /* 1.29 */
fprintf (stderr, "WARNING: Old libgpg-error - using limited mode\n");
native_messaging_repl ();
#else /* This is a modern libgp-error. */
enum { CMD_DEFAULT = 0, enum { CMD_DEFAULT = 0,
CMD_INTERACTIVE = 'i', CMD_INTERACTIVE = 'i',
CMD_SINGLE = 's', CMD_SINGLE = 's',
@ -3950,7 +3928,5 @@ main (int argc, char *argv[])
if (opt_debug) if (opt_debug)
log_debug ("ready"); log_debug ("ready");
#endif /* This is a modern libgp-error. */
return 0; return 0;
} }
#endif /* libgpg-error >= 1.28 */

View File

@ -34,10 +34,6 @@
#include "util.h" #include "util.h"
#include "debug.h" #include "debug.h"
#if GPG_ERROR_VERSION_NUMBER < 0x011700 /* 1.23 */
# define GPG_ERR_SUBKEYS_EXP_OR_REV 217
#endif
gpgme_error_t gpgme_error_t

View File

@ -41,15 +41,6 @@
#define DIM(v) (sizeof(v)/sizeof((v)[0])) #define DIM(v) (sizeof(v)/sizeof((v)[0]))
#if GPG_ERROR_VERSION_NUMBER < 0x011900 /* 1.25 */
# define GPG_ERR_ENGINE_TOO_OLD 300
# define GPG_ERR_TOO_OLD 308
#endif
#ifndef GPGRT_ATTR_SENTINEL
# define GPGRT_ATTR_SENTINEL(a) /* */
#endif
/*-- {posix,w32}-util.c --*/ /*-- {posix,w32}-util.c --*/