gpgme.git
3 years agoRelease 1.5.3. gpgme-1.5.3
Werner Koch [Thu, 11 Dec 2014 11:07:49 +0000 (12:07 +0100)]
Release 1.5.3.

* configure.ac: Set LT version to C24/A13/R2.

3 years agoReturn an error for some export key operations.
Werner Koch [Mon, 8 Dec 2014 10:19:16 +0000 (11:19 +0100)]
Return an error for some export key operations.

* src/context.h (OPDATA_EXPORT): New.
* src/export.c (op_data_t): New.
(release_op_data): New.
(parse_error): New.
(export_status_handler): New.
(export_start, export_ext_start): Prepare op_data.
(gpgme_op_export_ext, gpgme_op_export_keys): Return an error from the
status handler.
--

To support an error return also for the async functions we need to
extend the API.  Until we have done that this new features helps at
least in some cases; in particular for --send-keys.

3 years agoPost release updates
Werner Koch [Fri, 21 Nov 2014 20:29:11 +0000 (21:29 +0100)]
Post release updates

--

3 years agoRelease 1.5.2. gpgme-1.5.2
Werner Koch [Fri, 21 Nov 2014 20:19:26 +0000 (21:19 +0100)]
Release 1.5.2.

* configure.ac: Set LT version to C24/A13/R1.

3 years agoUpdate the previous commit
Werner Koch [Wed, 19 Nov 2014 09:34:32 +0000 (10:34 +0100)]
Update the previous commit

* src/sign.c (gpgme_op_sign_result): Reformat and take care of failed
malloc.
--

Although _gpgme_debug_trace() is current always true, the code should
be run always and not just in trace mode.  Also added error checking
to malloc and strdup.  And while at replace some while by for loop for
easier readability.

3 years agoFix returning new signatures when there are none.
Ben Kibbey [Sun, 9 Nov 2014 21:42:54 +0000 (16:42 -0500)]
Fix returning new signatures when there are none.

* src/sign.c (gpgme_op_sign_result): Test that invalid and valid
signatures add up to gpgme_signers_count().
--

When invalid and valid signatures do not equal gpgme_signers_count() it
means that there was a bad passphrase during signing after the first
signer. This leaves the result.signatures from previous signers intact
which isn't correct since gpg will report:

gpg: number of one-pass packets does not match number of signature
packets
gpg: can't handle this ambiguous signature data

during verify. So when this happens append the valid signatures to the
.invalid_signers list with .reason set to GPG_ERR_GENERAL.

3 years agodoc: Clarify the FILE command.
Werner Koch [Wed, 19 Nov 2014 09:34:32 +0000 (10:34 +0100)]
doc: Clarify the FILE command.

--

3 years agoImprove the debug output a bit.
Werner Koch [Thu, 6 Nov 2014 14:59:06 +0000 (15:59 +0100)]
Improve the debug output a bit.

* src/debug.h (TRACE_ERR): Include the line number in the output.

3 years agobuild: Implement SYSROOT feature. origin/bjk/master
Werner Koch [Thu, 2 Oct 2014 13:48:53 +0000 (15:48 +0200)]
build: Implement SYSROOT feature.

* configure.ac: Document SYSROOT.
* m4/gpg-error.m4: Update from libgpg-error master.
* src/gpgme.m4: Implement SYSROOT stuff.

3 years agoUse --no-sk-comments, not --no-sk-comment.
Daniel Kahn Gillmor [Mon, 29 Sep 2014 21:48:39 +0000 (17:48 -0400)]
Use --no-sk-comments, not --no-sk-comment.

--
The --no-sk-comments flag is (or should be) a no-op in modern versions
of gnupg, but gpgme should still use its full form rather than the
(slightly) abbreviated --no-sk-comment

3 years agoRegister DCO for Daniel Kahn Gillmor.
Werner Koch [Wed, 24 Sep 2014 13:24:05 +0000 (15:24 +0200)]
Register DCO for Daniel Kahn Gillmor.

--

3 years agoAdd ftp and git URLs to AUTHORS.
Werner Koch [Thu, 18 Sep 2014 14:00:34 +0000 (16:00 +0200)]
Add ftp and git URLs to AUTHORS.

--

3 years agotests: Delay some test file extraction until "make check".
Werner Koch [Thu, 18 Sep 2014 14:00:34 +0000 (16:00 +0200)]
tests: Delay some test file extraction until "make check".

* tests/gpg/Makefile.am (all-local): Change to check-local.
* tests/gpgsm/Makefile.am (all-local): Ditto.

3 years agoClean up gpgme's tests/gpg when gpg2.1 is available
Daniel Kahn Gillmor [Tue, 23 Sep 2014 16:46:00 +0000 (12:46 -0400)]
Clean up gpgme's tests/gpg when gpg2.1 is available

* tests/gpg/Makefile.am: Clean up .gpg-v21-migrated
--

We also need to gitignore this file.

3 years agogpgme-tool: Print fingerprint and keyid with keyservers.
Werner Koch [Tue, 12 Aug 2014 08:36:30 +0000 (10:36 +0200)]
gpgme-tool: Print fingerprint and keyid with keyservers.

* src/gpgme-tool.c (cmd_keylist): Print keyid.  Print FPR only if
available.

3 years agoHandle modern keyserver output which may emit the fingerprint.
Werner Koch [Tue, 12 Aug 2014 08:36:30 +0000 (10:36 +0200)]
Handle modern keyserver output which may emit the fingerprint.

* src/engine-gpg.c (read_colon_line): Split preprocessed lines.
(gpg_keylist_preprocess): Limit keyid field and print fingerprint.

3 years agogpgme-tool: Install gpgme-tool.
Werner Koch [Tue, 12 Aug 2014 08:36:30 +0000 (10:36 +0200)]
gpgme-tool: Install gpgme-tool.

* src/Makefile.am (bin_PROGRAMS): New.  Add gpgme-tools.
(noinst_PROGRAMS): Remove.

3 years agogpgme-tool: Fix segv for external key listing.
Werner Koch [Tue, 12 Aug 2014 15:42:08 +0000 (17:42 +0200)]
gpgme-tool: Fix segv for external key listing.

* src/gpgme-tool.c (result_xml_escape): Allow for DATA being NULL.

3 years agoPost release updates.
Werner Koch [Wed, 30 Jul 2014 10:03:47 +0000 (12:03 +0200)]
Post release updates.

--

3 years agoRelease 1.5.1 gpgme-1.5.1
Werner Koch [Wed, 30 Jul 2014 09:47:31 +0000 (11:47 +0200)]
Release 1.5.1

* configure.ac: Change LT version to C24/A13/R0.

3 years agoFix possible realloc overflow for gpgsm and uiserver engines.
Werner Koch [Wed, 30 Jul 2014 09:04:55 +0000 (11:04 +0200)]
Fix possible realloc overflow for gpgsm and uiserver engines.

* src/engine-gpgsm.c (status_handler):
* src/engine-uiserver.c (status_handler):
--

After a realloc (realloc is also used for initial alloc) the allocated
size if the buffer is not correctly recorded.  Thus an overflow can be
introduced by receiving data with different line lengths in a specific
order.  This is not easy exploitable because libassuan constructs the
line.  However a crash has been reported and thus it might be possible
to constructs an exploit.

CVE-id: CVE-2014-3564
Reported-by: Tomáš Trnka
4 years agow32: Get IOSPAWN flag back in sync with spawn helper.
Werner Koch [Wed, 25 Jun 2014 18:25:28 +0000 (20:25 +0200)]
w32: Get IOSPAWN flag back in sync with spawn helper.

* src/gpgme-w32spawn.c: Include priv-io.h.

4 years agow32: Add comment about a compiler warning
Werner Koch [Wed, 25 Jun 2014 18:25:28 +0000 (20:25 +0200)]
w32: Add comment about a compiler warning

--

4 years agoAdd new reason codes to the INV_RECP status code.
Werner Koch [Tue, 10 Jun 2014 12:52:06 +0000 (14:52 +0200)]
Add new reason codes to the INV_RECP status code.

* src/op-support.c (_gpgme_parse_inv_recp): Add codes 13 and 14.

4 years agoAdd new keylist mode GPGME_KEYLIST_MODE_WITH_SECRET.
Werner Koch [Wed, 4 Jun 2014 07:57:54 +0000 (09:57 +0200)]
Add new keylist mode GPGME_KEYLIST_MODE_WITH_SECRET.

* src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_SECRET): New.
* src/engine-gpg.c (gpg_keylist_build_options): Handle new mode.
* src/engine-gpgsm.c (gpgsm_keylist, gpgsm_keylist_ext): Ditto.
* src/keylist.c (parse_sec_field15): Add arg key and take care of
--with-secret output.

* src/gpgme-tool.c (gt_get_keylist_mode, cmd_keylist_mode): Add
"with_secret".  Print card info and and secret flag for subkeys.
--

Note: This mode may only be used with GnuPG >= 2.1.

4 years agoPost release updates
Werner Koch [Wed, 21 May 2014 07:43:53 +0000 (09:43 +0200)]
Post release updates

--

4 years agoRelease 1.5.0. gpgme-1.5.0
Werner Koch [Wed, 21 May 2014 07:08:42 +0000 (09:08 +0200)]
Release 1.5.0.

* configure.ac: Change LT version to C22/A11/R0.

4 years agoAdd 6 new GPGME_STATUS_ codes.
Werner Koch [Tue, 13 May 2014 13:44:52 +0000 (15:44 +0200)]
Add 6 new GPGME_STATUS_ codes.

* src/status-table.c: Also add missing DECRYPTION_INFO entry.

4 years agoAdd field CURVE to the key info.
Werner Koch [Thu, 8 May 2014 18:39:15 +0000 (20:39 +0200)]
Add field CURVE to the key info.

* src/gpgme.h.in (struct _gpgme_subkey): Add field CURVE.
* src/key.c (gpgme_key_unref): Free CURVE.
* src/keylist.c (keylist_colon_handler): Set CURVE.

* src/gpgme.c (gpgme_release): For failsafe reasons reset engine and
engine info after freeing.
--

The engine hack is useful in case the other release functions
accidently call engine release.

4 years agoFix a memory access and a double slash bug.
Werner Koch [Thu, 8 May 2014 18:35:57 +0000 (20:35 +0200)]
Fix a memory access and a double slash bug.

* src/engine-spawn.c (engspawn_start): Allocate space for list
terminator.
* src/posix-util.c (walk_path): Fix trailing slash detection.
--

Kudos to Valgrind for pointing out these two problems.

The first is a plain allocation bug in a code pattern I have written
thousands of times - this time it went wrong.  The allocation is not
user controlled thus not directly exploitable.

The second is missed to do what it intended to do.  Found due to the
access of malloced but not initialized memory.  Not using calloc
again proved to be helpful to detect logical error.

4 years agoMap public key algos returned by gpg to gpgme values.
Werner Koch [Thu, 8 May 2014 12:03:14 +0000 (14:03 +0200)]
Map public key algos returned by gpg to gpgme values.

* src/conversion.c (_gpgme_map_pk_algo): New.
* src/decrypt.c (parse_enc_to): Add arg PROTOCOL and map pubkey algo.
(_gpgme_decrypt_status_handler): Map pubkey algo.
* src/keylist.c (keylist_colon_handler): Map pubkey algo.
* src/sign.c (parse_sig_created): Add arg PROTOCOL and map pubkey
algo.
* src/verify.c (parse_new_sig): Ditto.
(parse_valid_sig): Ditto.

* src/gpgme.h.in (GPGME_PK_ECC): New.
(GPGME_MD_SHA224): New.
* src/gpgme.c (gpgme_pubkey_algo_name): Add GPGME_PK_ECC case.
(gpgme_hash_algo_name): Add GPGME_MD_SHA224.
--

This affects only the not yet released ECC code of GnuPG 2.1.

4 years agoAdd GPGME_ENCRYPT_NO_COMPRESS flag.
Werner Koch [Thu, 8 May 2014 09:31:30 +0000 (11:31 +0200)]
Add GPGME_ENCRYPT_NO_COMPRESS flag.

* src/gpgme.h.in (GPGME_ENCRYPT_NO_COMPRESS): New.
* src/engine-gpg.c (gpg_encrypt, gpg_encrypt_sign): Implement it.
* src/gpgme-tool.c (_cmd_sign_encrypt): Add option --no-compress.

4 years agow32: Fix another memleak on error.
Werner Koch [Tue, 15 Apr 2014 14:40:48 +0000 (16:40 +0200)]
w32: Fix another memleak on error.

* src/w32-io.c (create_reader): free CTX.
--

Found by Hans-Christoph Steiner with cppcheck.

4 years agow32: Fix memleak in an error code paths.
Werner Koch [Tue, 15 Apr 2014 14:40:48 +0000 (16:40 +0200)]
w32: Fix memleak in an error code paths.

* src/w32-io.c (create_writer): Free CTX in cased of bad FD.
* src/w32-util.c (_gpgme_mkstemp): Free TMPNAME in case of a failed
mkstemp.
--

Found by Hans-Christoph Steiner with cppcheck.

4 years agoFix possible zombie processes.
Werner Koch [Tue, 15 Apr 2014 10:25:45 +0000 (12:25 +0200)]
Fix possible zombie processes.

* src/posix-io.c (_gpgme_io_waitpid): Protect waitpid agains EINTR.
(_gpgme_io_dup): Likewise.
(_gpgme_io_connect): Likewise.
--

GnuPG-bug-id: 1630

4 years agoActually implement flags for gpgme_op_spawn.
Werner Koch [Thu, 10 Apr 2014 12:17:19 +0000 (14:17 +0200)]
Actually implement flags for gpgme_op_spawn.

* src/spawn.c (gpgme_op_spawn_start, gpgme_op_spawn): Pass FLAGS dow
to spawn_start and add FLAGS args along the call path.
* src/engine-spawn.c (engspawn_start): Hack to automagically provide
argv[0].

4 years agoAdd GPGME_PROTOCOL_SPAWN and gpgme_op_spawn.
Werner Koch [Thu, 10 Apr 2014 11:01:00 +0000 (13:01 +0200)]
Add GPGME_PROTOCOL_SPAWN and gpgme_op_spawn.

* src/gpgme.h.in (GPGME_PROTOCOL_SPAWN): New.
(GPGME_SPAWN_DETACHED, GPGME_SPAWN_ALLOW_SET_FG): New.
* src/gpgme.c (gpgme_set_protocol): Add new protocol.
(gpgme_get_protocol_name): Ditto.
* src/spawn.c: New.
* src/libgpgme.vers, src/gpgme.def: Add new public functions.
* src/engine-spawn.c: New.
* src/Makefile.am: Add new files.
* src/engine-backend.h (struct engine_ops): Add OPSPAWN.
* src/engine.c (engine_ops): Add _gpgme_engine_ops_spawn.
(gpgme_get_engine_info): Add Spawn to the list of protocols.
(_gpgme_engine_op_spawn): New.

* src/gpgme-tool.c (gt_protocol_from_name): Add new protocol.
(gt_spawn, cmd_spawn): New.

4 years agoAdd gpgme_get_dirinfo.
Werner Koch [Thu, 10 Apr 2014 09:47:19 +0000 (11:47 +0200)]
Add gpgme_get_dirinfo.

* src/dirinfo.c (gpgme_get_dirinfo): New.
* tests/t-engine-info.c (main): Print results from that function.

4 years agoRemove compiler warning from test
Werner Koch [Thu, 10 Apr 2014 09:42:39 +0000 (11:42 +0200)]
Remove compiler warning from test

--

4 years agoMake use of internal iospawn flags more flexible.
Werner Koch [Thu, 10 Apr 2014 09:39:14 +0000 (11:39 +0200)]
Make use of internal iospawn flags more flexible.

* src/priv-io.h (IOSPAWN_FLAG_DETACHED): New. Renumber the others.
* src/w32-io.c (_gpgme_io_spawn): Use DETACHED_PROCESS process only if
IOSPAWN_FLAG_DETACHED is given.
* src/w32-qt-io.cpp (_gpgme_io_spawn): Ditto.
* src/w32-glib-io.c (_gpgme_io_spawn): Ditto.
* src/assuan-support.c (my_spawn): Pass IOSPAWN_FLAG_DETACHED flags.
* src/dirinfo.c (read_gpgconf_dirs): Ditto.
* src/engine-gpg.c (start): Ditto.
* src/engine-gpgconf.c (gpgconf_read, gpgconf_write): Ditto.
* src/version.c (_gpgme_get_program_version): Ditto.

4 years agoMake sure a spawned process has all standard fds connected.
Werner Koch [Thu, 10 Apr 2014 09:15:40 +0000 (11:15 +0200)]
Make sure a spawned process has all standard fds connected.

* src/posix-io.c (_gpgme_io_spawn): dup /dev/null also to unsued
stdout.
--

Better be sure that stdout of a spawned process is connected to stdout
so that the process does not run into a write error if it writes to
stdout.  AFAICS we always use a connected stdout; thus this is only
for correctness.

4 years agoAdd configure option --enable-fixed-path.
Werner Koch [Thu, 13 Mar 2014 13:24:14 +0000 (14:24 +0100)]
Add configure option --enable-fixed-path.

* configure.ac: Add option --enable-fixed-path.
(FIXED_SEARCH_PATH): New ac_define.
* src/posix-util.c (walk_path): Make use of the option.  Remove
current directory from fallback PATH.
--

Note that using this option PATH is entirely ignored by GPGME and only
the given value is used instead to locate the GnuPG binaries.

On Android the use of PATH is not desirable.  Instead the GnuPG tools
are expected in a fixed directory.  By using

  ./configure --enable-fixed-path="/foo/bar"

gpg et al are expected to be installed as /foo/bar/gpg.  With

  ./configure --enable-fixed-path="/foo/bar:/bin"

gpg is expected as /foo/bar/gpg or /bin/gpg.

4 years agoAvoid pointer arithmetic on void pointer.
Werner Koch [Tue, 11 Mar 2014 12:58:38 +0000 (13:58 +0100)]
Avoid pointer arithmetic on void pointer.

* src/gpgme.c (gpgme_io_writen): Use new var buffer.
--

Reported-by: Albert Chin
4 years agoChange implementation return type to match the definition.
Werner Koch [Tue, 11 Mar 2014 12:54:21 +0000 (13:54 +0100)]
Change implementation return type to match the definition.

* src/gpgme.c (gpgme_get_sub_protocol): Change return type to
gpgme_protocol_t.
--

Yet another enum/int mismatch.

Reported-by: Albert Chin.
4 years agodoc: Fix documentation of struct data types
Daiki Ueno [Wed, 5 Mar 2014 05:52:49 +0000 (14:52 +0900)]
doc: Fix documentation of struct data types

* gpgme.texi (Key Management): Document is_cardkey and card_number
members of gpgme_subkey_t.
(Decrypt): Remove description of the non-existent wrong_key_usage
member of gpgme_recipient_t.
(Verify): Document pka_address member of gpgme_signature_t.
(Creating a Signature): Add missing member names in
gpgme_new_signature_t.
(Registering I/O Callbacks): Fix reference of gpgme_io_cbs struct.

4 years agoAlways pass correct name to argv[0]. Ignore GPG_AGENT_INFO for gpg2.
Werner Koch [Fri, 21 Feb 2014 10:22:45 +0000 (11:22 +0100)]
Always pass correct name to argv[0].  Ignore GPG_AGENT_INFO for gpg2.

* src/dirinfo.c (WANT_GPG_ONE_MODE): New.
(struct dirinfo): Add field "gpg_one_mode".
(get_gpgconf_item): Set that field and return it if requested.
(_gpgme_in_gpg_one_mode): New.
* src/engine-gpg.c (build_argv): Check GPG_AGENT_INFO only in gpg-1
mode.

* src/dirinfo.c (_gpgme_get_basename): New.
* src/engine-g13.c (g13_new): Take argv[0] from the pgmname.
* src/engine-gpgsm.c (gpgsm_new): Ditto.
* src/engine-gpg.c (build_argv): Ditto. Add arg PGMNAME.
(start): Pass PGMNAME to buildargv.

4 years agoFix type inconsistency between gpgme.h and gpgme.c.
Werner Koch [Wed, 12 Feb 2014 19:36:08 +0000 (20:36 +0100)]
Fix type inconsistency between gpgme.h and gpgme.c.

* src/gpgme.c (gpgme_set_pinentry_mode): Fix type of MODE.
--

GnuPG-bug-id: 1617

4 years agoUse the generic autogen.sh script.
Werner Koch [Thu, 9 Jan 2014 18:14:09 +0000 (19:14 +0100)]
Use the generic autogen.sh script.

* autogen.rc: New.
* Makefile.am (EXTRA_DIST): Add it.
* autogen.sh: Update from GnuPG.

* configure.ac (AM_SILENT_RULES): New.

4 years agoSet next version to 1.5.0
Werner Koch [Tue, 7 Jan 2014 17:08:41 +0000 (18:08 +0100)]
Set next version to 1.5.0

--

4 years agoMake gpgconf engine work again - fixes 02ba35c1.
Werner Koch [Tue, 7 Jan 2014 16:59:59 +0000 (17:59 +0100)]
Make gpgconf engine work again - fixes 02ba35c1.

* src/gpgconf.c: Remove ENABLE_GPGCONF and move prototypes to ...
* src/engine-backend.h: ... here.
--

gpgconf is a required part for gpgme.

4 years agoMake gpgme_new return a proper error if no engines are installed.
Werner Koch [Tue, 7 Jan 2014 12:32:08 +0000 (13:32 +0100)]
Make gpgme_new return a proper error if no engines are installed.

* src/engine.c (gpgme_get_engine_info): Improve error handling.
(_gpgme_engine_info_copy): Ditto.
* src/gpgme.c (gpgme_new): Return error GPG_ERR_NO_ENGINE.

4 years agoPrint the full PATH in the log if gpg was not found.
Werner Koch [Tue, 7 Jan 2014 11:44:55 +0000 (12:44 +0100)]
Print the full PATH in the log if gpg was not found.

* src/posix-util.c (walk_path): Keep a copy of PATH.

4 years agoAdd global flags disable-gpgconf, gpgconf-name, and gpg-name.
Werner Koch [Mon, 6 Jan 2014 16:16:52 +0000 (17:16 +0100)]
Add global flags disable-gpgconf, gpgconf-name, and gpg-name.

* src/gpgme.c (gpgme_set_global_flag): Add names "disable-gpgconf",
"gpgconf-name", and "gpg-name".
* src/dirinfo.c (_gpgme_dirinfo_disable_gpgconf): New.
(get_gpgconf_item): Minor debug info change.
* src/posix-util.c (default_gpg_name, default_gpgconf_name): Add vars.
(_gpgme_set_default_gpg_name): New.
(_gpgme_set_default_gpgconf_name): New.
(_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use new vars.
(walk_path): Add debug output on failure.
* src/w32-util.c (default_gpg_name, default_gpgconf_name): Add vars.
(replace_slashes): New.
(get_basename): New.
(_gpgme_set_default_gpg_name): New.
(_gpgme_set_default_gpgconf_name): New.
(_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use new vars.

* tests/t-engine-info.c (main): Add --verbose and --set-global-flag
options.
--

Note that the Windows part has not been tested.

4 years agoLocate engine names only at runtime and prefer GnuPG-2.
Werner Koch [Fri, 27 Dec 2013 15:08:20 +0000 (16:08 +0100)]
Locate engine names only at runtime and prefer GnuPG-2.

* configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION)
(NEED_G13_VERSION, NEED_GPGCONF_VERSION): Remove vars and all related
checks.  Do not check for any engine version.
(HAVE_ASSUAN): Remove AM conditional.
* src/Makefile.am: Remove separate component vars and always build all
engines but uiserver.
* src/dirinfo.c (WANT_GPGCONF_NAME): New.
(struct dirinfo): Add field gpgconf_name.
(_gpgme_get_default_gpgconf_name): Use WANT_GPGCONF_NAME.
(get_gpgconf_item): Set gpgconf name and adjust for _gpgme_get_*_path
now returning a malloced string.
* src/engine.c (engine_ops): Always init all engines except for
uiserver.
* src/posix-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path):
Remove unused functions.
(walk_path): New.
(_gpgme_get_gpg_path, _gpgme_get_gpgconf_path ): Re-implement using
walk_path.
* src/w32-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path): Remove
unused functions.
(_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Return a malloced
string.
* src/engine-g13.c (g13_get_req_version): Use a hardwired string with
the required version.  This info belongs into this file.
* src/engine-gpg.c (gpg_get_req_version): Ditto.
* src/engine-gpgconf.c (gpgconf_get_req_version): Ditto.
* src/engine-gpgsm.c (gpgsm_get_req_version): Ditto.
* tests/t-engine-info.c: Replace now useless test by an info output.
* tests/gpg/Makefile.am (GPG, GPG_AGENT): Hardwire gpg and gpg-agent.
* tests/gpgsm/Makefile.am (GPGSM): Hardwire gpgsm.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 years agoDocument API change for GPGME_EVENT_DONE from 2009.
Werner Koch [Mon, 19 Aug 2013 18:43:19 +0000 (20:43 +0200)]
Document API change for GPGME_EVENT_DONE from 2009.

* doc/gpgme.texi (I/O Callback Interface): Fix description for the
event arg.
--

With commit c8e934b2 (2009-10-26) gpgme_io_event_done_data_t was
introduced to replace the use of gpg_error_t with GPGME_EVENT_DONE.
Unfortunately this was not documented.  Maybe at that time the event
code was considered internal and its use in GPA was not known.  Too
bad.

4 years agoFix possible segv in the gpgme_op_card_edit.
Werner Koch [Mon, 19 Aug 2013 18:40:10 +0000 (20:40 +0200)]
Fix possible segv in the gpgme_op_card_edit.

* src/edit.c (gpgme_op_edit_start, gpgme_op_card_edit_start): Do not
deref a NULL KEY in TRACE_BEG.

4 years agotests: Fix NULL ptr deref in gpgsm/t-verify.
Werner Koch [Mon, 19 Aug 2013 18:38:36 +0000 (20:38 +0200)]
tests: Fix NULL ptr deref in gpgsm/t-verify.

* tests/gpgsm/t-verify.c (check_result): Do not dereference a sig or
sig->fpr if NULL.

4 years agoRelease 1.4.3. gpgme-1.4.3
Werner Koch [Mon, 12 Aug 2013 12:33:49 +0000 (14:33 +0200)]
Release 1.4.3.

* configure.ac: Change LT version to C22/A11/R0.

4 years agoMake test suite workable with GnuPG 2.1.
Werner Koch [Mon, 12 Aug 2013 12:32:21 +0000 (14:32 +0200)]
Make test suite workable with GnuPG 2.1.

* tests/gpg/start-stop-agent: New.
* tests/gpg/initial.test: New.
* tests/gpg/final.test: New.
* tests/gpg/Makefile.am (c_tests): New.
(TESTS): Move all to c_tests.  Add initial.test, final.test, and
c_tests.
(TESTS_ENVIRONMENT): Add C_ALL=C
(private_keys): New.
(EXTRA_DIST): Add new files.
(./private-keys-v1.d/gpg-sample.stamp): Copy private keys.
(all-local): Depend on gpg-sample.stamp.
* tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F: New.
* tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD: New.
* tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66: New.
* tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C: New.
* tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD: New.
--

GnuPG 2.1 requires that the agent knows the private keys.  Thus we
need to install them.  The code should still work with GnuPG < 2.1.

To make the whole testing using a agent more robust, the way to start
the agent has also be changed.

4 years agoImprove detection of default gpg by configure.
Werner Koch [Mon, 12 Aug 2013 12:24:34 +0000 (14:24 +0200)]
Improve detection of default gpg by configure.

* configure.ac: Move test for gpgconf before test for gpg.
(GPG, GPGSM, G13): Use gpgconf instead of AC_PATH_PROG if possible.
--

This change is required so that the t-engine-info test does not
fail.  In any case, it is a good idea to use gpgconf for these test
because this is how it works at runtime.

4 years agoAdd function gpgme_data_identify.
Werner Koch [Fri, 9 Aug 2013 17:19:26 +0000 (19:19 +0200)]
Add function gpgme_data_identify.

* src/gpgme.h.in (gpgme_data_type_t): New.
(gpgme_data_identify): New prototype.
* src/data-identify.c: New.
* src/parsetlv.c, src/parsetlv.h: New.  Take from gpa.
* src/libgpgme.vers, src/gpgme.def: Add gpgme_data_identify.
* src/gpgme-tool.c (status): Add STATUS_IDENTIFY_RESULT.
(gt_identify): New.
(cmd_identify): New.

(hlp_passwd): Move close to cmd_passwd.
--

It is often useful to have a way to identify the data which needs
processing.  This is such a common task that it makes sense to
implement this in gpgme to avoid diverging implementations.

4 years agoPrefer GnuPG-2 engines over GnuPG-1.
Werner Koch [Fri, 2 Aug 2013 13:25:23 +0000 (15:25 +0200)]
Prefer GnuPG-2 engines over GnuPG-1.

* src/util.h: Move some prototypes to ...
* src/sys-util.h: New.
* src/Makefile.am (main_sources): Add sys-util.h.
* configure.ac (AH_VERBATIM): Add DIRSEP_C and DIRSEP_S.
* src/dirinfo.c: Include sys-util.h.
(WANT_GPG_NAME, WANT_GPGSM_NAME, WANT_G13_NAME)
(WANT_UISRV_SOCKET): New.
(dirinfo): Add corresponding fields.
(parse_output): Add arg COMPONENTS and set new fields.
(read_gpgconf_dirs): Add arg components and act upon it.
(get_gpgconf_item): Call read_gpgconf_dirs two times.  Add debug
output.
(_gpgme_get_default_gpg_name): New.
(_gpgme_get_default_gpgsm_name): New.
(_gpgme_get_default_g13_name): New.
(_gpgme_get_default_gpgconf_name): New.
(_gpgme_get_default_uisrv_socket): New.
* src/engine-gpg.c, src/engine-g13.c, src/engine-gpgconf.c
* src/engine-gpgsm.c, src/engine-uiserver.c: Change to use
_gpgme_get_default_ instead of those from sys-util.h.
* src/posix-util.c (_gpgme_get_gpg_path): Include sys-util.h.
(_gpgme_get_uiserver_socket_path): Remove.
* src/w32-util.c (_gpgme_get_gpg_path): Include sys-util.h.
(_gpgme_get_uiserver_socket_path): Remove.
--

The default engines names are now taken from the output of gpgconf.
If gpgconf is not installed gpg 1 is assumed and locate the same was
as gpgconf.

4 years agow32: Try to locate gpg in the gpgme installation dir.
Werner Koch [Fri, 2 Aug 2013 10:48:30 +0000 (12:48 +0200)]
w32: Try to locate gpg in the gpgme installation dir.

* src/w32-util.c (my_hmodule): New.
(wchar_to_utf8): New.
(DllMain): New.
(_gpgme_get_inst_dir): New.
(find_program_in_dir): New.
(find_program_in_inst_dir): Add arg INST_DIR.
(_gpgme_get_gpg_path): Get inst_dir before acquiring the lock.
(_gpgme_get_gpgconf_path): Ditto.
(_gpgme_get_g13_path): Ditto.
(_gpgme_get_w32spawn_path): Ditto.

4 years agodoc: Add --binary option for the OUTPUT command of an uiserver.
Werner Koch [Wed, 31 Jul 2013 15:32:02 +0000 (17:32 +0200)]
doc: Add --binary option for the OUTPUT command of an uiserver.

5 years agodoc: Fix variable name.
Werner Koch [Tue, 18 Jun 2013 08:46:04 +0000 (10:46 +0200)]
doc: Fix variable name.

--
GnuPG-bug-id: 1507

5 years agoAdd function gpgme_signers_count.
Werner Koch [Tue, 18 Jun 2013 08:27:46 +0000 (10:27 +0200)]
Add function gpgme_signers_count.

* src/signers.c (gpgme_signers_count): New.
* src/libgpgme.vers, src/gpgme.def: Add as external symbol.
* src/gpgme.h.in: Add prototype.

5 years agoPost release version bump.
Werner Koch [Tue, 28 May 2013 10:05:43 +0000 (12:05 +0200)]
Post release version bump.

--

5 years agoRelease 1.4.2. gpgme-1.4.2
Werner Koch [Tue, 28 May 2013 09:05:43 +0000 (11:05 +0200)]
Release 1.4.2.

* configure.ac: Set LT version to C21/A10/R0.

5 years agoAdd convenience macro GPGME_PROTOCOL_OPENPGP.
Werner Koch [Tue, 28 May 2013 08:53:43 +0000 (10:53 +0200)]
Add convenience macro GPGME_PROTOCOL_OPENPGP.

* src/gpgme.h.in (GPGME_PROTOCOL_OPENPGP): New.

5 years agodoc: rename gpgme_sub_key_t to gpgme_subkey_t to match gpgme.h
Hans-Christoph Steiner [Fri, 24 May 2013 15:51:16 +0000 (11:51 -0400)]
doc: rename gpgme_sub_key_t to gpgme_subkey_t to match gpgme.h

--

5 years agow32: Fix installing of .def file.
Werner Koch [Thu, 18 Apr 2013 12:40:43 +0000 (14:40 +0200)]
w32: Fix installing of .def file.

* src/Makefile.am (install-def-file): Create libdir first.

5 years agoFix libtool 2.4.2 to correctly detect .def files.
Werner Koch [Thu, 18 Apr 2013 12:40:43 +0000 (14:40 +0200)]
Fix libtool 2.4.2 to correctly detect .def files.

* build-aux/ltmain.sh (sed_uncomment_deffile): New.
(orig_export_symbols): Uncomment def file before testing for EXPORTS.
* m4/libtool.m4: Do the same for the generated code.
--

The old code was not correct in that it only looked at the first line
and puts an EXPORTS keyword in front if missing.  Binutils 2.22
accepted a duplicated EXPORTS keyword but at least 2.23.2 is more
stringent and bails out without this fix.

There is no need to send this upstream.  Upstream's git master has a
lot of changes including a similar fix for this problems.  There are
no signs that a libtool 2.4.3 will be released to fix this problem and
thus we need to stick to our copy of 2.4.2 along with this patch.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 years agoSupport --no-encrypt-to also with gpgme_op_encrypt_sign.
Werner Koch [Wed, 22 May 2013 14:35:12 +0000 (15:35 +0100)]
Support --no-encrypt-to also with gpgme_op_encrypt_sign.

* src/engine-gpg.c (gpg_encrypt_sign): Support the
GPGME_ENCRYPT_NO_ENCRYPT_TO flag.

5 years agoAllow symmetric encryption with gpgme_op_encrypt_sign.
Werner Koch [Wed, 22 May 2013 14:30:12 +0000 (15:30 +0100)]
Allow symmetric encryption with gpgme_op_encrypt_sign.

* src/encrypt-sign.c (encrypt_sym_status_handler): New.
(encrypt_sign_start): Handle recp == NULL case.
* src/engine-gpg.c (gpg_encrypt_sign): Implement symmetric encryption.
* tests/gpg/t-encrypt-sign.c (main): Add a test case for this.
--

Co-authored-by: Kyle L. Huff <g10bts@curetheitch.com>
GnuPG-bug-id: 1440

5 years agogpgme-tool: Allow for symmetric encryption.
Werner Koch [Wed, 22 May 2013 08:50:12 +0000 (09:50 +0100)]
gpgme-tool: Allow for symmetric encryption.

* src/gpgme-tool.c (gt_sign_encrypt): Pass NULL for recp if no
recipients are given.

5 years agotests: Print auditlog in plain text format.
Werner Koch [Wed, 22 May 2013 08:50:12 +0000 (09:50 +0100)]
tests: Print auditlog in plain text format.

* tests/gpgsm/t-verify.c (show_auditlog): Use plain text format.
--

The HTML output is not very helpful on the console and a pain to the
eyes.

5 years agoImprove C++ compatibility of previous patch.
Werner Koch [Thu, 25 Apr 2013 11:00:16 +0000 (12:00 +0100)]
Improve C++ compatibility of previous patch.

* src/gpgme.h.in: Move gpgme_sssize_t and gpgme_off_t typedefs into
the extern "C" scope.
--

Frankly, this does not help very much because g++ still does not
interpret gpgme_data_seek_cb_t as compatible with the C++ ssize_t.  I
am sorry for that API change but C and C++ are too different to always
get both of them under one umbrella.  However, the ABI should now be
identical to older gpgme versions.

5 years agoMake definition of off_t robust against misbehaving w32 toolchains.
Werner Koch [Thu, 25 Apr 2013 11:00:16 +0000 (12:00 +0100)]
Make definition of off_t robust against misbehaving w32 toolchains.

* configure.ac (NEED__FILE_OFFSET_BITS): Change to define gpgme_off_t
and gpgme_ssize_t.
(API__OFF_T, API__SSIZE_T): New ac_subst.
* src/gpgme.h.in: Replace all ssize_t and off_t by ac_subst macros.
* src/assuan-support.c, src/ath-pthread.c, src/ath.c, src/ath.h
* src/data-compat.c, src/data-fd.c, src/data-mem.c, src/data-stream.c
* src/data-user.c, src/data.c, src/data.h, src/engine-gpgsm.c
* src/engine-uiserver.c, src/gpgme-tool.c, src/gpgme.c: Replace off_t
by gpgme_off_t and sszie_t by gpgme_ssize_t.
* src/ath-pthread.c, src/ath.h: Include gpgme.h.
--

For a detailed description, see the gpgme.texi diff.

5 years agow32: Change the way the I/O threads are cleaned up.
Werner Koch [Thu, 25 Apr 2013 11:00:16 +0000 (12:00 +0100)]
w32: Change the way the I/O threads are cleaned up.

* src/w32-io.c (reader_context_s, create_reader)
(writer_context_s, create_writer): Rename STOPPED to CLOSE_EV.
(reader, writer): Remove setting of STOPPED.  Wait for CLOSE_EV and
then release the context.
(destroy_reader, destroy_writer): Do not wait but set the CLOSE_EV.
(kill_reader, kill_writer): Remove.
(_gpgme_io_close): Add code from kill_reader and kill_writer.
--

The old code was prone to deadlocks which were actually exhibited at
Kleopatra startup.  The new code is much more straightforward and
easier to understand.  The reason for the complex old code was
probably due to our former idea to allow re-use of the I/O threads.
However we have long given up on this.

5 years agoFix hang in socket closing.
Werner Koch [Thu, 25 Apr 2013 11:00:16 +0000 (12:00 +0100)]
Fix hang in socket closing.

* src/w32-io.c (destroy_reader): Call shutdown.
(reader): Do not print an error in the shutdown case.

5 years agoImprove debug output of the I/O reader and writer.
Werner Koch [Mon, 6 May 2013 18:23:47 +0000 (20:23 +0200)]
Improve debug output of the I/O reader and writer.

* src/w32-io.c (reader, writer): Also print file_sock.

5 years agoSimplify a debug code function.
Werner Koch [Mon, 6 May 2013 18:22:23 +0000 (20:22 +0200)]
Simplify a debug code function.

* src/debug.c (_gpgme_debug): Remove static space string.

5 years agoPost release version bump.
Werner Koch [Wed, 1 May 2013 12:27:08 +0000 (14:27 +0200)]
Post release version bump.

--

5 years agoRelease 1.4.1. gpgme-1.4.1
Werner Koch [Wed, 1 May 2013 11:51:27 +0000 (13:51 +0200)]
Release 1.4.1.

* configure.ac: Bump LT version to C20/A9/R1.

5 years agoDisable fd-passing for Apple.
Werner Koch [Wed, 1 May 2013 11:47:41 +0000 (13:47 +0200)]
Disable fd-passing for Apple.

* configure.ac: Disable fd-passing by default for Apple.
--

We have not yet tracked down the problem, thus we revert to the
pre-1.4 behaviour for Apple.

GnuPG-bug-id: 1483

5 years agoAllow reading of long gpgconf output lines.
Werner Koch [Tue, 30 Apr 2013 16:09:13 +0000 (18:09 +0200)]
Allow reading of long gpgconf output lines.

* src/engine-gpgconf.c (gpgconf_read): Rewrite to allow for line
lengths up to 64k.

5 years agoSyntax fix for gpgme.texi.
Werner Koch [Tue, 30 Apr 2013 16:05:04 +0000 (18:05 +0200)]
Syntax fix for gpgme.texi.

--

This fixes commit 12374cbecede047accd2d2267bba5927037ed16c.

5 years agoFix for i686-w64-mingw32.
Werner Koch [Mon, 29 Apr 2013 07:58:57 +0000 (09:58 +0200)]
Fix for i686-w64-mingw32.

* configure.ac (NEED__FILE_OFFSET_BITS): Do not define under Windows.

5 years agoExplain the GPGME_DEBUG variable.
Werner Koch [Tue, 16 Apr 2013 16:30:20 +0000 (18:30 +0200)]
Explain the GPGME_DEBUG variable.

--

5 years agoPost release version number bump.
Werner Koch [Tue, 26 Feb 2013 17:32:08 +0000 (18:32 +0100)]
Post release version number bump.

--

5 years agoRelease 1.4.0. gpgme-1.4.0
Werner Koch [Tue, 26 Feb 2013 16:28:04 +0000 (17:28 +0100)]
Release 1.4.0.

* configure.ac: Bump LT version to C20/A9/R0.

5 years agoEnable FD passing and thus building of the UI-server.
Werner Koch [Tue, 26 Feb 2013 16:25:20 +0000 (17:25 +0100)]
Enable FD passing and thus building of the UI-server.

* configure.ac: Make --enable-fd-passing the default.
* src/engine-uiserver.c (_gpgme_engine_ops_uiserver): Syntax fix.

5 years agow32: Hacks for building with 32 bit mingw64.
Werner Koch [Tue, 26 Feb 2013 16:06:39 +0000 (17:06 +0100)]
w32: Hacks for building with 32 bit mingw64.

* configure.ac (INSERT__TYPEDEFS_FOR_GPGME_H): Add hacks for 32 bit
mingw64.
* src/util.h [W32]: Include winsock2.h before windows to make mingw64
happy.
* src/w32-util.c (_WIN32_IE): Need to use 5.1 for mingw64.
--

It is not clear to me what mingw64 wants to achieve with their POSIX
hacks. In particular the off64_t stuff looks quite strange given that
Windows has a pretty stable API for close to 2 decades.  Thus I can't
say whether it will really work when build with that toolchain.

5 years agoImprove missing libgpg-error reporting in configure.
Werner Koch [Tue, 26 Feb 2013 14:58:51 +0000 (15:58 +0100)]
Improve missing libgpg-error reporting in configure.

* configure.ac (NEED_GPG_ERROR_VERSION): New.  Improve reporting for
missing libgpg-error.

5 years agoChange the various version numbers to the new scheme.
Werner Koch [Tue, 26 Feb 2013 16:10:18 +0000 (17:10 +0100)]
Change the various version numbers to the new scheme.

* configure.ac: Rename my_foo variables to mym4_foo variables to make
clear that they are processed by m4.
(VERSION_NUMBER): New ac_subst.
(AH_BOTTOM): Add CRIGHTBLURB macro.
(BUILD_REVISION, BUILD_FILEVERSION, BUILD_TIMESTAMP): Change them to
work similar to libgpg-error et al.
* src/versioninfo.rc.in: Remove use of BUILD_NUMBER and get it in line
with gpg-error et al.
* src/version.c (cright_blurb): New.
(gpgme_check_version_internal): Add magic to display the above
information.
* tests/t-version.c (main): Add option --verbose.

5 years agoUpdate GnuPG related m4 files.
Werner Koch [Tue, 26 Feb 2013 12:33:28 +0000 (13:33 +0100)]
Update GnuPG related m4 files.

* m4/gpg-error.m4: Update from libgpg-error.
* m4/libassuan.m4: Update from libassuan.

5 years agoUpdate helper scripts.
Werner Koch [Tue, 26 Feb 2013 15:14:52 +0000 (16:14 +0100)]
Update helper scripts.

* configure.ac: Use AC_CONFIG_AUX_DIR.  Remove args from
AM_INIT_AUTOMAKE.  Replace AM_CONFIG_HEADER by AC_CONFIG_HEADER.
* compile, config.guess, config.sub, depcomp, install-sh, ltmain.sh
* mkinstalldirs, texinfo.texi: Move to build-aux/ and update from
gnulib (c042abf).
* build-aux/mdate-sh, build-aux/missing: Install via automake -a -c.
Update autogen.sh for changed config dir.
* autogen.sh: Adjust for scripts dir change.  Update W32 toolprefix
list.

5 years agoRemove included gitlog-to-changelog.
Werner Koch [Mon, 25 Feb 2013 13:40:36 +0000 (14:40 +0100)]
Remove included gitlog-to-changelog.

* build-aux/gitlog-to-changelog: Remove.
* configure.ac (GITLOG_TO_CHANGELOG): Default to just
gitlog-to-changelog.

5 years agoDeclare next version to be 1.4.0
Werner Koch [Tue, 12 Feb 2013 13:06:07 +0000 (14:06 +0100)]
Declare next version to be 1.4.0

--

5 years agoAdd macro GPGME_VERSION_NUMBER.
Werner Koch [Tue, 12 Feb 2013 13:02:08 +0000 (14:02 +0100)]
Add macro GPGME_VERSION_NUMBER.

* src/gpgme.h.in (GPGME_VERSION_NUMBER): New.
* configure.ac (my_version_major, my_version_minor)
(my_version_micro): New m4 macros.
(my_version): Build from new m4 macros.
(VERSION_NUMBER): New ac_subst.