gpgme.git
2 years agocore: New function gpgme_op_interact, deprecate gpgme_op_edit.
Werner Koch [Thu, 15 Sep 2016 08:45:04 +0000 (10:45 +0200)]
core: New function gpgme_op_interact, deprecate gpgme_op_edit.

* src/gpgme.h.in (gpgme_interact_cb_t): New.
(GPGME_INTERACT_CARD): New.
(gpgme_op_interact_start, gpgme_op_interact): New.
* src/libgpgme.vers, src/gpgme.def: Add new functions.
* src/edit.c (op_data_t): Rename fnc to fnc_old and change users.  Add
fnc.
(edit_status_handler): Call old or new callback.
(command_handler): Ditto.
(interact_start): New.
(gpgme_op_interact_start, gpgme_op_interact_start): New.
* src/status-table.c (_gpgme_status_to_string): New.

* tests/gpg/t-edit.c (edit_fnc): Rename to interact_fnc and change
type of STATUS.  Use gpgme_io_writen.
(main): s/gpgme_op_edit/gpgme_op_interact/.
--

This change will eventually allow us to remove all those status codes
from gpgme.h.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Minor change of the gpgme_op_edit semantics.
Werner Koch [Thu, 15 Sep 2016 07:24:29 +0000 (09:24 +0200)]
core: Minor change of the gpgme_op_edit semantics.

* src/edit.c (command_handler): Handle special error code.
* src/engine-gpg.c (read_status): Ditto.
* src/engine-gpgsm.c (status_handler): Ditto.
* src/engine-uiserver.c (status_handler): Ditto.
* src/util.h (GPG_ERR_FALSE): Define for older libgpg-error versions.
--

An edit callback may now simply return GPG_ERR_FALSE to indicate that
it did not handled the status code.  GPGME will the do the appropriate
action, which is to send an empty line.

Note that it is highly unlikely that GPG_ERR_FALSE has ever been used
by an application as return value from an edit interactor.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New function gpgme_op_tofu_policy
Werner Koch [Wed, 14 Sep 2016 18:21:19 +0000 (20:21 +0200)]
core: New function gpgme_op_tofu_policy

* src/gpgme.h.in (gpgme_op_tofu_policy_start): New function.
(gpgme_op_tofu_policy): New function.
* src/libgpgme.vers, src/gpgme.def: Add new functions.
* src/tofupolicy.c: New.
* src/Makefile.am (main_sources): Add that file.
* src/context.h (ctx_op_data_id_t): Add OPDATA_TOFU_POLICY.
* src/engine.c (_gpgme_engine_op_tofu_policy): New.
* src/engine-backend.h (engine_ops): Add funcptr 'tofu_policy'.
Adjust all engine initializations.
* src/engine-gpg.c (gpg_tofu_policy): New.
(_gpgme_engine_ops_gpg): Register this function.

* tests/run-tofu.c: New.
* tests/Makefile.am (noinst_PROGRAMS): Add it.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Defer implementation of gpgme_op_createkey with gpg < 2.1
Werner Koch [Wed, 14 Sep 2016 17:02:40 +0000 (19:02 +0200)]
core: Defer implementation of gpgme_op_createkey with gpg < 2.1

* src/engine-gpg.c (gpg_createkey_legacy): Mark unused variables.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New function gpgme_op_keysign.
Werner Koch [Wed, 14 Sep 2016 16:44:33 +0000 (18:44 +0200)]
core: New function gpgme_op_keysign.

* src/gpgme.h.in (gpgme_op_keysign_start, gpgme_op_keysign): New.
(GPGME_KEYSIGN_LOCAL): New.
(GPGME_KEYSIGN_LFSEP): New.
(GPGME_KEYSIGN_NOEXPIRE): New.
* src/context.h (ctx_op_data_id_t): Add OPDATA_KEYSIGN.
* src/keysign.c: New.
* src/Makefile.am (main_sources): Add keysig.
* src/libgpgme.vers, src/gpgme.def: Add gpgme_op_keysign_start.
* src/engine.c (_gpgme_engine_op_keysign): New.
* src/engine-backend.h (engine_ops): Add 'keysign' and adjust all
engine initializers.
* src/engine-gpg.c (_add_arg): Add args PREFIX and ARGLEN and change
callers to set them.
(add_arg_pfx): New.
(add_arg_len): New.
(gpg_keysign): New.
(_gpgme_engine_ops_gpg): Set keysign to gpg_keysign.
* tests/run-keysign.c: New.
* tests/Makefile.am (noinst_PROGRAMS): Add run-keysign.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopython: Clarify that we support Python 2.7 too.
Justus Winter [Wed, 14 Sep 2016 12:36:29 +0000 (14:36 +0200)]
python: Clarify that we support Python 2.7 too.

* lang/python/README: Use 'Python' instead of 'Python 3'.
* lang/python/pyme/version.py.in: Likewise.
* lang/python/setup.py.in: Add classifier for 2.7, drop 3 only.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Trim imports.
Justus Winter [Wed, 14 Sep 2016 12:35:00 +0000 (14:35 +0200)]
python: Trim imports.

* lang/python/examples/encrypt-to-all.py: Drop unused import of 'os'.
* lang/python/examples/signverify.py: Likewise.
* lang/python/examples/simple.py: Likewise.
* lang/python/examples/verifydetails.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Improve error handling.
Justus Winter [Wed, 14 Sep 2016 12:34:14 +0000 (14:34 +0200)]
python: Improve error handling.

* lang/python/gpgme.i (gpgme_engine_info_t): Improve error handling.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Adapt to TOFU changes.
Justus Winter [Wed, 14 Sep 2016 12:32:48 +0000 (14:32 +0200)]
python: Adapt to TOFU changes.

* lang/python/pyme/results.py (TofuInfo): Drop.
(Signature): The TOFU information moved to the key.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Improve build system integration.
Justus Winter [Wed, 14 Sep 2016 11:00:20 +0000 (13:00 +0200)]
python: Improve build system integration.

* configure.ac: Try to compile a Python module for each version.
* m4/m4_ax_swig_python.m4: Drop unused file.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocore: New function gpgme_op_revuid.
Werner Koch [Wed, 14 Sep 2016 10:41:16 +0000 (12:41 +0200)]
core: New function gpgme_op_revuid.

* src/engine.h (GENKEY_EXTRAFLAG_REVOKE): New.
* src/genkey.c (adduid_start): Rename to addrevuid_start.  Add arg
REVOKE and pass it as extraflags.  Remove useless ARMOR extraflag.
Adjust callers.
(gpgme_op_revuid_start, gpgme_op_revuid): New.
* src/gpgme.def, src/libgpgme.vers: Add them.

* tests/run-genkey.c: Add option --revuid.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Change a parameter for the engine's genkey function.
Werner Koch [Wed, 14 Sep 2016 10:15:35 +0000 (12:15 +0200)]
core: Change a parameter for the engine's genkey function.

* src/engine.h (GENKEY_EXTRAFLAG_ARMOR): New.
* src/engine-backend.h (engine_ops): Rename USE_ARMOR in genkey to
EXTRAFLAGS.
* src/engine.c (_gpgme_engine_op_genkey): Ditto.
* src/engine-gpg.c (gpg_createkey_from_param): Ditto and test the
flags.
(gpg_createkey_legacy): Ditto.
(gpg_createkey): Ditto.
(gpg_addkey): Ditto.
(gpg_genkey): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopython: Build for both Python2 and Python3.
Justus Winter [Wed, 14 Sep 2016 08:22:07 +0000 (10:22 +0200)]
python: Build for both Python2 and Python3.

* NEWS: Update.
* configure.ac: Check for multiple Python versions.
* lang/python/Makefile.am: Build and install for both Python versions.
* lang/python/tests/Makefile.am: Test both versions.
* lang/python/tests/run-tests.py: New test runner.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Import from __future__ to align behavior of Python 2.7.
Justus Winter [Wed, 14 Sep 2016 09:39:00 +0000 (11:39 +0200)]
python: Import from __future__ to align behavior of Python 2.7.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Use more generic shebang.
Justus Winter [Wed, 14 Sep 2016 08:51:49 +0000 (10:51 +0200)]
python: Use more generic shebang.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocore: New function gpgme_op_adduid.
Werner Koch [Wed, 14 Sep 2016 09:40:34 +0000 (11:40 +0200)]
core: New function gpgme_op_adduid.

* src/genkey.c: Replace most error codes GPG_ERR_INV_VALUE by
GPG_ERR_INV_ARG.
(struct op_data_t): Add field UIDMODE.
(genkey_status_handler): Use UIDMODE.
(adduid_start): New.
(gpgme_op_adduid_start, gpgme_op_adduid): New.
* src/gpgme.def, src/libgpgme.vers: Add them.
* tests/run-genkey.c: Add option --adduid.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New function gpgme_op_createsubkey.
Werner Koch [Wed, 14 Sep 2016 07:51:16 +0000 (09:51 +0200)]
core: New function gpgme_op_createsubkey.

* src/genkey.c (createsubkey_start): New.
(gpgme_op_createsubkey_start, gpgme_op_createsubkey): New.
* src/gpgme.def, src/libgpgme.vers: Add them.
* src/engine-gpg.c (gpg_createkey): Factor some code out to ...
(gpg_add_algo_usage_expire): new.
(gpg_addkey): Implement.
* tests/run-genkey.c: Add option --addkey.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Use const char * where appropriate.
Werner Koch [Tue, 13 Sep 2016 18:59:07 +0000 (20:59 +0200)]
core: Use const char * where appropriate.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Cast away the common const problem with spawn and argv.
Werner Koch [Tue, 13 Sep 2016 18:57:15 +0000 (20:57 +0200)]
core: Cast away the common const problem with spawn and argv.

* src/dirinfo.c (read_gpgconf_dirs): Use a cast to assignd to ARGV.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Fix condition-always-true warning in trace macro.
Werner Koch [Tue, 13 Sep 2016 18:54:55 +0000 (20:54 +0200)]
core: Fix condition-always-true warning in trace macro.

* src/data-compat.c (old_user_read): Cast AMT.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Mark unused function args.
Werner Koch [Tue, 13 Sep 2016 18:53:14 +0000 (20:53 +0200)]
core: Mark unused function args.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotests: Mark lots of unused vars and fix const mismatches.
Werner Koch [Tue, 13 Sep 2016 18:48:06 +0000 (20:48 +0200)]
tests: Mark lots of unused vars and fix const mismatches.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotests: Use gpgme_io_write in passhrase callbacks.
Werner Koch [Tue, 13 Sep 2016 18:46:41 +0000 (20:46 +0200)]
tests: Use gpgme_io_write in passhrase callbacks.

* tests/gpg/t-support.h (passphrase_cb): Use gpgme_io_write.
* tests/gpgsm/t-support.h (passphrase_cb): Ditto.
* tests/run-support.h (passphrase_cb): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Do not pass const char* to functions taking a char*.
Werner Koch [Tue, 13 Sep 2016 18:44:59 +0000 (20:44 +0200)]
core: Do not pass const char* to functions taking a char*.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agobuild: Use more compiler warnings
Werner Koch [Tue, 13 Sep 2016 18:41:16 +0000 (20:41 +0200)]
build: Use more compiler warnings

* configure.ac: Add useful compiler warnings.
--

It is strange that this seems to be the only GnuPG package which does
not use modern warning.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New function gpgme_op_create_key.
Werner Koch [Tue, 13 Sep 2016 16:57:38 +0000 (18:57 +0200)]
core: New function gpgme_op_create_key.

* src/engine-backend.h (engine_ops): Change prototype of genkey.
* src/engine-gpgsm.c (gpgsm_genkey): Change accordingly.
* src/engine-gpg.c (gpg_genkey): Change it to a dispatcher.
(gpg_createkey_from_param): New for the old functionality.
(gpg_createkey_legacy): New.  Stub for now.
(gpg_createkey): New.
(gpg_addkey): New.  Stub for now.
(gpg_adduid): New.  Stub for now.
* src/engine.c (_gpgme_engine_op_genkey): Add new args.
* src/genkey.c (op_data_t): Add field ERROR_CODE.
(parse_error): New.
(genkey_status_handler): Parse ERROR status line.
(genkey_start): Use NULL/0 for the new args.
(createkey_start): New.
(gpgme_op_createkey_start, gpgme_op_createkey): New.
* src/gpgme.def, src/libgpgme.vers: Add gpgme_op_createkey_start and
gpgme_op_createkey.
* src/gpgme.h.in (_gpgme_op_genkey_result): Add fields PUBKEY and
SECKEY.
(GPGME_CREATE_SIGN): New.
(GPGME_CREATE_ENCR): New.
(GPGME_CREATE_CERT): New.
(GPGME_CREATE_AUTH): New.
(GPGME_CREATE_NOPASSWD): New.
(GPGME_CREATE_SELFSIGNED): New.
(GPGME_CREATE_NOSTORE): New.
(GPGME_CREATE_WANTPUB): New.
(GPGME_CREATE_WANTSEC): New.
(GPGME_CREATE_FORCE): New.

* tests/run-genkey.c: New.
* tests/Makefile.am (noinst_PROGRAMS): Add it.
--

This function uses the new --quick-gen-key API of gpg.  A limited
compatibility mode to use older gpg versions and gpgsm will eventually
be provided.  Not all flags are currently implemented.

 ./run-genkey --unprotected --force test@example.com

Create a new standard key with the given user id.  --force is used to
allow creating more than one key with that user id in the keyring.

 ./run-genkey --unprotected --force \
      test@example.com default default 2145826800

Creates a new standard key with an expiration date of 2037-12-31.

 ./run-genkey --unprotected --force \
      test@example.com future-default default 2145826800

Create a standard key using the fugure default algorithms.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopython: Handle slight differences between Python 2 and 3.
Justus Winter [Tue, 13 Sep 2016 08:44:14 +0000 (10:44 +0200)]
python: Handle slight differences between Python 2 and 3.

* lang/python/helpers.c (pyDataWriteCb): Handle Python integers being
returned on Python 2.
(pyDataSeekCb): Likewise.
* lang/python/pyme/core.py (Data.__init__): Fix testing for string
argument.
(Data.new_from_filepart): Likewise.
* lang/python/pyme/util.py (is_a_string): New function.
* lang/python/tests/t-encrypt-large.py (read_cb): Force evaluation of
generator.
* lang/python/tests/t-idiomatic.py: Partly skip test on Python 2.
* lang/python/tests/t-verify.py (check_result): Here, the difference
between 2 and 3 really matters.  We cannot change the char *
conversion in Python 2 without breaking all existing applications, and
using bytestrings in Python 3 would be very inconvenient.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Fix types and error handling.
Justus Winter [Tue, 13 Sep 2016 11:25:15 +0000 (13:25 +0200)]
python: Fix types and error handling.

* lang/python/helpers.c (_pyme_edit_cb): Drop the const.
(_pyme_assuan_{data,inquire,status}_cb): Fix error handling.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Avoid Python3-only form of super().
Justus Winter [Mon, 12 Sep 2016 15:21:34 +0000 (17:21 +0200)]
python: Avoid Python3-only form of super().

* lang/python/pyme/core.py (GpgmeWrapper.__repr__): Use more
compatible form of super.
(GpgmeWrapper.__setattr__): Likewise.
(Context.__init__): Likewise.
(Data.__init__): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Make type translation compatible with Python 2.7.
Justus Winter [Mon, 12 Sep 2016 15:11:19 +0000 (17:11 +0200)]
python: Make type translation compatible with Python 2.7.

* lang/python/gpgme.i: Avoid functions not available in Python 2.7.
* lang/python/helpers.c: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Avoid hardcoding the interpreter.
Justus Winter [Mon, 12 Sep 2016 14:19:07 +0000 (16:19 +0200)]
python: Avoid hardcoding the interpreter.

* lang/python/setup.py.in: Avoid hardcoding the interpreter.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Do not rely on subprocess.DEVNULL.
Justus Winter [Mon, 12 Sep 2016 14:18:31 +0000 (16:18 +0200)]
python: Do not rely on subprocess.DEVNULL.

* lang/python/setup.py.in: Do not rely on subprocess.DEVNULL.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Fix version comparison.
Justus Winter [Mon, 12 Sep 2016 13:42:07 +0000 (15:42 +0200)]
tests: Fix version comparison.

* tests/gpg/t-sig-notation.c: Fix version comparison.

Fixes-commit: a0263ad2
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Make signature notation test compatible with older GnuPGs.
Justus Winter [Mon, 12 Sep 2016 12:53:08 +0000 (14:53 +0200)]
tests: Make signature notation test compatible with older GnuPGs.

* lang/python/tests/t-sig-notation.py: Only check the critical flag
when GnuPG >= 2.1.13 is used.
* tests/gpg/t-sig-notation.c: Likewise.

Fixes-commit: c88c9ef3
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoqt: Fix some includes
Andre Heinecke [Mon, 12 Sep 2016 08:52:10 +0000 (10:52 +0200)]
qt: Fix some includes

* lang/qt/src/qgpgmekeyformailboxjob.cpp: Explicitly include
QStringList.
* lang/qt/tests/t-support.h, lang/qt/tests/t-support.cpp: Move
includes into impl. Explicitly include QDir.

--
This fixes build against Qt versions where the includes are less
implicit.

2 years agoqt: Fix tofu test.
Justus Winter [Mon, 12 Sep 2016 08:11:44 +0000 (10:11 +0200)]
qt: Fix tofu test.

* lang/qt/tests/t-tofuinfo.cpp: Adjust member names.

Fixes-commit: 120b1478
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocore,cpp: Extend the TOFU information.
Werner Koch [Wed, 7 Sep 2016 07:26:11 +0000 (09:26 +0200)]
core,cpp: Extend the TOFU information.

* src/gpgme.h.in (struct _gpeme_tofu_info): Rename FIRSTSEEN to
SIGNFIRST and LASTSEEN to SIGNLAST.  Add ENCRFIST and ENCRLAST.
* src/keylist.c (parse_tfs_record): Parse to ENCRFIRST and ENCRLAST.
* src/verify.c (parse_tofu_stats): Ditto.
* tests/run-keylist.c (main): Adjust and print encrypt stats.
* tests/run-verify.c (print_result): Ditto.

* lang/cpp/src/tofuinfo.h (TofuInfo): Rename firstSeen to signFirst
and lastSeen to signLast.  Add encrCount, encrFirst and encrLast.
* lang/cpp/src/tofuinfo.cpp (encrCount, encrFirst, encrLast): New.
--

The latest GnuPG commits have the needed changes but we also allow the
use of currently released GnuPG version.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotests: Set passphrase cb in t-encrypt-mixed
Andre Heinecke [Tue, 6 Sep 2016 14:32:01 +0000 (16:32 +0200)]
tests: Set passphrase cb in t-encrypt-mixed

* tests/gpg/t-encrypt-mixed.c (main): Set passphrase cb.

--
This fixes the test when run without an agent and our
faked pinentry program.

2 years agocore: Check for gpg version for loopback mode
Andre Heinecke [Tue, 6 Sep 2016 14:30:24 +0000 (16:30 +0200)]
core: Check for gpg version for loopback mode

* src/engine-gpg.c (build_argv): Check for version 2.1.0
before adding pinentry-mode.

--
This is a compatibility fix for older versions that don't support
this flag which would otherwise result in an invalid argument
error.

2 years agocore: Fix passphrase cb for mixed sym encrypt
Andre Heinecke [Tue, 6 Sep 2016 14:28:45 +0000 (16:28 +0200)]
core: Fix passphrase cb for mixed sym encrypt

* src/encrypt.c (encrypt_start): Handle SYMMETRIC flag.
* src/encrypt-sign.c (encrypt_sign_start): Ditto.

--
This causes the passphrace command handler to be properly
registered which in turn will result in the passphrase
callback beeing called.

2 years agoqt: Clarify comment and strings in tofuinfo test
Andre Heinecke [Mon, 5 Sep 2016 14:54:50 +0000 (16:54 +0200)]
qt: Clarify comment and strings in tofuinfo test

* lang/qt/tests/t-tofuinfo.cpp (testTofuSignCount)
(testTofuKeyList): Ensure distinct messages. Clarify comment.

2 years agoqt: Enable signcount checks in tofuinfo test
Andre Heinecke [Mon, 5 Sep 2016 10:58:35 +0000 (12:58 +0200)]
qt: Enable signcount checks in tofuinfo test

* lang/qt/tests/t-tofuinfo.cpp: Enable checks for signcount.

--
Signcount for userIDs works now as expected with gnupg 2.1.16.

2 years agocpp: Add convenience update function to a key
Andre Heinecke [Mon, 5 Sep 2016 10:53:02 +0000 (12:53 +0200)]
cpp: Add convenience update function to a key

* lang/cpp/src/key.cpp (Key::update): New.
* lang/cpp/src/key.h: Update accordingly.

--
This function helps if you have an incomplete key or want
to make sure all info in a key is complete (e.g. validity / tofuinfo)

2 years agocpp: Add ostream operators for key and uid
Andre Heinecke [Mon, 5 Sep 2016 09:57:09 +0000 (11:57 +0200)]
cpp: Add ostream operators for key and uid

* lang/cpp/src/key.cpp (Key, UserID): Add ostream operator.
* lang/cpp/src/key.h: Update accordingly.

--
This is helpful debugging / showing the state of a key / uid and
tofuinfo.

2 years agoqt: Add missing header redirection
Andre Heinecke [Mon, 5 Sep 2016 08:44:41 +0000 (10:44 +0200)]
qt: Add missing header redirection

* lang/qt/src/keyformailboxjob.h,
lang/qt/src/qgpgmekeyformailboxjob.h: Fix includes.

--
This ensures that when building qgpgme you do not need an installed
gpgme++.

2 years agoqt: Include cpp before core directory
Andre Heinecke [Mon, 5 Sep 2016 08:42:02 +0000 (10:42 +0200)]
qt: Include cpp before core directory

* lang/qt/src/Makefile.am (AM_CPPFLAGS): Include cpp before core.

--
Both core and cpp have headers that have the same names, this
can lead to the wrong headers beeing included when qt bindings
are built.

2 years agoqt: Fix 2.1 t-support copy
Andre Heinecke [Thu, 25 Aug 2016 15:16:25 +0000 (17:16 +0200)]
qt: Fix 2.1 t-support copy

* lang/qt/src/t-support.cpp (copyKeyring): Fix seckey copy.

2 years agoqt: Fix and extend TofuInfo test.
Andre Heinecke [Thu, 25 Aug 2016 14:25:49 +0000 (16:25 +0200)]
qt: Fix and extend TofuInfo test.

* lang/qt/tests/t-tofuinfo.cpp: Delete executed jobs.
(testTofuKeyList): New.
(testSupported): Activate for 2.1.16
(signAndVerify): Disable sigcount tests.

2 years agoqt: Fix keyring copy in tests
Andre Heinecke [Thu, 25 Aug 2016 14:23:58 +0000 (16:23 +0200)]
qt: Fix keyring copy in tests

* lang/qt/test/t-encrypt.cpp,
lang/qt/test/t-tofuinfo.cpp: Assert on copy failure.
* lang/qt/test/t-support.cpp (copyKeyrings): Fix path.

2 years agoqt: Add generic flag support for keylistjobs
Andre Heinecke [Thu, 25 Aug 2016 14:22:12 +0000 (16:22 +0200)]
qt: Add generic flag support for keylistjobs

* lang/qt/src/keylistjob.h (addMode): New.
* lang/qt/src/qgpgmekeylistjob.h (addMode): New.
* lang/qt/src/qgpgmekeylistjob.cpp (addMode: New.

--
Instead of new API for each new thing lets be a bit more
generic / open.

2 years agoqt: Ensure that current src dir is included first
Andre Heinecke [Thu, 25 Aug 2016 14:19:39 +0000 (16:19 +0200)]
qt: Ensure that current src dir is included first

* lang/qt/src/Makefile.am: Reorder include directives.

--
This fixes the problem that QGpgME would pick up gpgme or
gpgme++ headers from an installed version.

2 years agocpp: Add WithTofu Keylist Mode
Andre Heinecke [Thu, 25 Aug 2016 14:17:46 +0000 (16:17 +0200)]
cpp: Add WithTofu Keylist Mode

* lang/cpp/src/context.cpp: Handle WithTofu.
* lang/cpp/src/global.h (KeyListMode): Add WithTofu.
* lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t): Handle WithTofu.

2 years agoqt: Fix tofuinfo test when gpg is gpg2
Andre Heinecke [Thu, 25 Aug 2016 13:20:02 +0000 (15:20 +0200)]
qt: Fix tofuinfo test when gpg is gpg2

* lang/qt/tests/t-support.cpp (QGpgMETest::copyKeyrings): New helper.
* lang/qt/tests/t-support.h: Declare.
* lang/qt/tests/t-encrypt.cpp: use it
* lang/qt/tests/t-tofuinbo.cpp: ditto.

--
New helper takes care of copying the correct files for either
keybox or keyring.

2 years agoqt: Remove unused variable in test
Andre Heinecke [Thu, 25 Aug 2016 13:00:46 +0000 (15:00 +0200)]
qt: Remove unused variable in test

* t-wkspublish.cpp (testWKSPublishCreate): Remove context.

2 years agoqt: Add test for wkspublishjob
Andre Heinecke [Thu, 25 Aug 2016 12:35:09 +0000 (14:35 +0200)]
qt: Add test for wkspublishjob

* lang/qt/tests/t-wkspublish.cpp: New.
* lang/qt/tests/Makefile.am: Update accordingly.

--
Most tests are disabled by default as tey require
an online connection.
Define DO_ONLINE_TESTS to enable the tests.

2 years agoqt: Add WKSPublishJob
Andre Heinecke [Thu, 25 Aug 2016 12:29:41 +0000 (14:29 +0200)]
qt: Add WKSPublishJob

* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp: Include moc / subclass stub.
* lang/qt/src/protocol.h: Add virtual for new job.
* lang/qt/src/protocol_p.h: Add job.
* lang/qt/src/wkspublishjob.h: Interface for WKSPublishJob.
* lang/qt/src/qgpgmewkspublishjob.cpp,
lang/qt/src/qgpgmewkspublishjob.h: New.

--
The Job was originally intended to be used with a SpawnEngine
Context but QProcess was a better fit for the job.

Usage is similar to the client tool. check, create, recieve.

2 years agoCpp: Change firstSeen / lastSeen return values
Andre Heinecke [Thu, 25 Aug 2016 08:46:17 +0000 (10:46 +0200)]
Cpp: Change firstSeen / lastSeen return values

* lang/cpp/src/tofuinfo.cpp,
lang/cpp/src/tofuinfo.h (TofuInfo::firstSeen, TofuInfo::lastSeen):
Change return values to unsigned long and update doc.

2 years agoCpp: Add wrapper for gpgme_get_dirinfo
Andre Heinecke [Thu, 25 Aug 2016 08:45:24 +0000 (10:45 +0200)]
Cpp: Add wrapper for gpgme_get_dirinfo

* lang/cpp/src/context.cpp (dirInfo): New.
* lang/cpp/src/global.h (dirInfo): New.

2 years agoCpp: Add support for spawn engine
Andre Heinecke [Thu, 25 Aug 2016 08:42:49 +0000 (10:42 +0200)]
Cpp: Add support for spawn engine

* lang/cpp/src/context.cpp (Context::spawn, Context::spawnAsync): New.
* lang/cpp/src/context.h: Add prototypes.
(SpawnFlags): New.
* lang/cpp/src/global.h (SpawnEngine): Added.

2 years agocore: Add GPGME_KEYLIST_MODE_WITH_TOFU.
Werner Koch [Thu, 25 Aug 2016 09:38:03 +0000 (11:38 +0200)]
core: Add GPGME_KEYLIST_MODE_WITH_TOFU.

* src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_TOFU): New.
* src/engine-gpg.c (gpg_keylist_build_options): Use that.
* src/keylist.c: Include limits.h.
(parse_tfs_record): New.
(keylist_colon_handler): Support TFS record.
* tests/run-keylist.c: Include time.h.
(isotimestr): New.
(main): Add option --tofu.  Print TOFU info.
* tests/run-verify.c: Include time.h.
(isotimestr): New.
(print_result): Use isotimestr for TOFU dates.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Adjust for TOFU_STATS change in gnupg 2.1.16.
Werner Koch [Wed, 24 Aug 2016 18:10:36 +0000 (20:10 +0200)]
core: Adjust for TOFU_STATS change in gnupg 2.1.16.

* src/gpgme.h.in (_gpgme_tofu_info): Change 'firstseen' and 'lastseen'
to a timestamp value.
* src/verify.c (parse_tofu_stats): Do not cap these values at UINT_MAX.
--

Using an unsigned long here is okay: We will never get an error and
even on machines where unsigned long is 32 bit (e.g. Windows64) this
allows us to operate until 2106.  By then Windows will be a footnote
in history or Windows128 has changed that type to something larger
than 32 bit ;-)

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Set the 'encrcount' field in gpgme_tofu_info_t.
Werner Koch [Wed, 24 Aug 2016 14:04:54 +0000 (16:04 +0200)]
core: Set the 'encrcount' field in gpgme_tofu_info_t.

* src/verify.c (parse_tofu_stats): Set ENCRCOUNT field.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocpp: Get rid of AssuanResult due to its deprecation.
Werner Koch [Tue, 23 Aug 2016 17:50:01 +0000 (19:50 +0200)]
cpp: Get rid of AssuanResult due to its deprecation.

* lang/cpp/src/assuanresult.cpp: Remove.
* lang/cpp/src/assuanresult.h: Remove.
* lang/cpp/src/Makefile.am: Remove these files.
* lang/cpp/src/context.cpp: Remove header assuanresult.h
(assuanTransact): Change return type to Error.  Use
gpgme_op_assuan_transact_ext.
(startAssuanTransaction): Change return type to Error.
(assuanResult): Remove
* lang/cpp/src/context.h (assuanResult): Adjust for changes.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoQt: Adapt (disabled) tofuinfo test to new API
Andre Heinecke [Wed, 24 Aug 2016 12:00:41 +0000 (14:00 +0200)]
Qt: Adapt (disabled) tofuinfo test to new API

* lang/qt/tests/t-tofuinfo.cpp: Switch to UID based API.

--
Test is still disabled as GnuPG still returns unexpected
results.

2 years agoCpp: Add Key to signature
Andre Heinecke [Wed, 24 Aug 2016 11:59:37 +0000 (13:59 +0200)]
Cpp: Add Key to signature

* lang/cpp/src/verificationresult.cpp,
lang/cpp/src/verificationresult.h (Signature::key): New.

2 years agoCpp: Use fpr field for primaryFingerprint
Andre Heinecke [Wed, 24 Aug 2016 11:57:49 +0000 (13:57 +0200)]
Cpp: Use fpr field for primaryFingerprint

* lang/cpp/src/key.cpp (Key::primaryFingerprint): Return
fpr value if available.

--
Should not be necessary but we might have an incomplete
key without subkeys but the fingerprint already set in
gpgme's data type.

2 years agoCpp: Move tofuinfo from signature to userid
Andre Heinecke [Tue, 23 Aug 2016 14:40:21 +0000 (16:40 +0200)]
Cpp: Move tofuinfo from signature to userid

* lang/cpp/src/key.cpp (UserID::tofuInfo): New.
* lang/cpp/src/key.h: Update accordingly.
* lang/cpp/src/tofuinfo.cpp: Remove dropped fields.
* lang/cpp/src/tofuinfo.h: Update accordingly.
* lang/cpp/src/verificationresult.cpp,
lang/cpp/src/verificationresult.h: Remove tofu info.
* lang/qt/tests/t-tofuinfo.cpp: Disable for now.

--
With be4ff75d7 Tofu info now lives with a UserID
Object. While this breaks API it was not yet released.

2 years agocore: Put the protocol into a TOFU created key object.
Werner Koch [Tue, 23 Aug 2016 13:55:55 +0000 (15:55 +0200)]
core: Put the protocol into a TOFU created key object.

* src/verify.c (parse_tofu_user): Add arg 'protocol' and store it in
the KEY.
(_gpgme_verify_status_handler): Pass protocol.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Change the way TOFU information are represented.
Werner Koch [Tue, 23 Aug 2016 13:22:28 +0000 (15:22 +0200)]
core: Change the way TOFU information are represented.

* src/gpgme.h.in (struct _gpgme_signature): Remove field 'tofu'.  Add
field 'key'.
(struct _gpgme_key): Add field 'fpr'.
(struct _gpgme_user_id): Add field 'tofu'.
(struct _gpgme_tofu_info): Remove fields 'address' and 'fpr'.
* src/key.c (gpgme_key_unref): Release TOFU and FPR.
* src/keylist.c (keylist_colon_handler): Store the fingerprint of the
first subkey also in KEY.
* src/verify.c (release_tofu_info): Remove.
(release_op_data): Release KEY.
(parse_tofu_user): Rewrite for new data structure.
(parse_tofu_stats): Ditto.
(parse_tofu_stats_long): Ditto.
* tests/run-verify.c (print_result): Ditto.
* tests/run-keylist.c (main): Print more fields.
--

TOFU information are now associated with the user ID and not with a
separate object.

Note that this breaks code relying on the former non-released TOFU
feature.  The C++ bindings won't work right now.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Extend gpgme_user_id_t with 'address'.
Werner Koch [Tue, 23 Aug 2016 04:48:50 +0000 (06:48 +0200)]
core: Extend gpgme_user_id_t with 'address'.

* src/mbox-util.c, src/mbox-util.h: Adjust for use in gpgme.
* src/Makefile.am (main_sources): Add mbox-util.
* src/key.c (_gpgme_key_append_name): Set 'address' field of uid.
(gpgme_key_unref): Free it.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New code for parsing mail addresses.
Werner Koch [Mon, 22 Aug 2016 18:50:37 +0000 (20:50 +0200)]
core: New code for parsing mail addresses.

* src/mbox-util.c: New.
* src/mbox-util.h: New.
--

The files haven been copied verbatim from
GnuPG 2.1.15 commit 54245979e691129ed9d3a6c642087fb8d3227449
after the license has been changed in GnuPG.

We need this file too match GnuPG's idea of a mail address.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Add new items for gpgme_get_dirinfo.
Werner Koch [Mon, 22 Aug 2016 14:57:51 +0000 (16:57 +0200)]
core: Add new items for gpgme_get_dirinfo.

* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Base gpgme_get_dirinfo(uiserver-socket) on the socket dir.
Werner Koch [Mon, 22 Aug 2016 14:32:14 +0000 (16:32 +0200)]
core: Base gpgme_get_dirinfo(uiserver-socket) on the socket dir.

* src/dirinfo.c (dirname_len): New.
(parse_output): Change computation of UISRV_SOCKET.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New commands --lang and --have-lang for gpgme-config
Werner Koch [Sun, 21 Aug 2016 13:49:03 +0000 (15:49 +0200)]
core: New commands --lang and --have-lang for gpgme-config

* configure.ac (GPGME_CONFIG_AVAIL_LANG): New ac_subst.
* src/gpgme-config.in (avail_lang): Add commands --lang and
--have-lang.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Remove (now) useless diagnostic
Andre Heinecke [Thu, 18 Aug 2016 15:14:36 +0000 (17:14 +0200)]
core: Remove (now) useless diagnostic

* src/w32-io.c(_gpgme_io_spawn): Remove spawnhelper not found
diagnostic.

--
When spawnhelper is not found the error is now catched before
the CreateProcess call so the added diagnostic in bb2d11c
(which was not helpful because the value for spawnhelper
would be NULL in that case) is now no longer needed.

2 years agocore: Fail loudly in case w32 spawner not found
Andre Heinecke [Thu, 18 Aug 2016 14:56:58 +0000 (16:56 +0200)]
core: Fail loudly in case w32 spawner not found

* src/w32-io.c (_gpgme_io_spawn): Show a message box in
case gpgme-w32spawn.exe not found.

--
Otherwise every engine call will just fail with unsupported
protocol. Even in the debug output the problem was not made
clear because CreateProcess will fail with error code 87
(Invalid Parameter) because spawnhelper is NULL. The helpful
error message for ERROR_INVALID_PARAMETER would have been:
"is 'NULL' correctly installed"

As GpgME basically becomes useless on Windows without the
spawnhelper we want to fail very loud in that case.

2 years agoCpp: Fix some pedantic warnings
Andre Heinecke [Wed, 17 Aug 2016 05:23:05 +0000 (07:23 +0200)]
Cpp: Fix some pedantic warnings

* lang/cpp/src/context.cpp,
lang/cpp/src/context.h (Context::getKeysFromRecipients): Remove
ignored / invalid const qualifier.
* lang/cpp/src/result.h: Don't shadow error function in ctor.

2 years agocore: New global flag "require-gnupg".
Werner Koch [Tue, 16 Aug 2016 16:53:42 +0000 (18:53 +0200)]
core: New global flag "require-gnupg".

* src/gpgme.c (gpgme_set_global_flag): Add flag.
* src/engine.c (engine_minimal_version): New variable.
(_gpgme_set_engine_minimal_version): New function.
(gpgme_get_engine_info): Check that flag.

* tests/run-keylist.c (main): New option --require-gnupg.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Simplify setting of dummy versions.
Werner Koch [Tue, 16 Aug 2016 16:49:11 +0000 (18:49 +0200)]
core: Simplify setting of dummy versions.

* src/engine.c (_gpgme_engine_info_release): Do not assert but free
FILE_NAME.
(gpgme_get_engine_info): Provide default for VERSION and REQ_VERSION.
Use calloc instead of malloc.
(_gpgme_set_engine_info): Ditto.
* src/engine-assuan.c (llass_get_version): Return NULL.
(llass_get_req_version): Ditto.
* src/engine-spawn.c (engspawn_get_version): Ditto.
(engspawn_get_req_version): Ditto.
* src/engine-uiserver.c (uiserver_get_version): Ditto.
(uiserver_get_req_version): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoQt: Add test for progress signal of encryptjob
Andre Heinecke [Fri, 12 Aug 2016 14:55:51 +0000 (16:55 +0200)]
Qt: Add test for progress signal of encryptjob

* lang/qt/tests/t-encrypt.cpp (testProgress): New.

--
This tests that a ByteArray IODevice now gives proper progress
signals.

2 years agoCpp: Provide size-hint for seekable and mem data
Andre Heinecke [Fri, 12 Aug 2016 14:51:13 +0000 (16:51 +0200)]
Cpp: Provide size-hint for seekable and mem data

* lang/cpp/src/data.cpp (GpgME::Data::Data): Set size-hint for
mem and DataProvider based Data.

--
This fixes the case that QGpgME did not have a total value for
progress as the size was unknown.

2 years agocore: Make use of the "size-hint" in engine-gpg.
Werner Koch [Fri, 12 Aug 2016 13:24:46 +0000 (15:24 +0200)]
core: Make use of the "size-hint" in engine-gpg.

* src/engine-gpg.c: Include data.h.
(add_input_size_hint): New.
(gpg_decrypt, gpg_encrypt, gpg_encrypt_sign, gpg_sign)
(gpg_verify): Call new function,

* tests/run-encrypt.c (status_cb): Print to stderr.
(progress_cb): New.o
(main): Add option --progress.  Print full-status lines.  Provide a
size for the input data.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Add gpgme_data_set_flag to add more meta data to data objects.
Werner Koch [Fri, 12 Aug 2016 13:21:16 +0000 (15:21 +0200)]
core: Add gpgme_data_set_flag to add more meta data to data objects.

* src/gpgme.h.in (gpgme_data_set_flag): New public function.
* src/data.c (gpgme_data_set_flag): New.
(_gpgme_data_get_size_hint): New.
* src/data.h (strucy gpgme_data): Add field 'size_hint'.
* src/gpgme.def, src/libgpgme.vers: Add new function.
* src/conversion.c (_gpgme_string_to_off): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoAdd Python bindings to NEWS.
Justus Winter [Fri, 12 Aug 2016 10:28:03 +0000 (12:28 +0200)]
Add Python bindings to NEWS.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoQt: Fix defaultkeygenerationjob build
Andre Heinecke [Fri, 12 Aug 2016 06:17:18 +0000 (08:17 +0200)]
Qt: Fix defaultkeygenerationjob build

* lang/qt/src/defaultkeygenerationjob.cpp: Include moc.

2 years agoQt: Add DefaultKeyGenerationJob
Andre Heinecke [Thu, 11 Aug 2016 15:57:14 +0000 (17:57 +0200)]
Qt: Add DefaultKeyGenerationJob

* lang/qt/src/defaultkeygenerationjob.cpp,
lang/qt/src/defaultkeygenerationjob.h: New.
* lang/qt/src/Makefile.am: Update accordingly.

--
The defaultkeygenerationjob makes it easier to just generate a key
in the future this should probably use quick-gen key but since this
is not exposed in gpgme we hardcode the defaults and do it with
the params file.

This is also the first job that uses a new and better architecture
without backend abstraction and the pimpl pattern instead of
a specialized subclass.

This is an adoption of kde's libkleo commit f49b7157
Thanks dvratil@kde.org

2 years agoQt: Ensure all public classes are exported
Andre Heinecke [Thu, 11 Aug 2016 15:38:36 +0000 (17:38 +0200)]
Qt: Ensure all public classes are exported

* src/abstractimportjob.h,
src/cryptoconfig.h,
src/deletejob.h,
src/exportjob.h,
src/importfromkeyserverjob.h,
src/importjob.h,
src/keygenerationjob.h,
src/keylistjob.h,
src/listallkeysjob.h,
src/refreshkeysjob.h,
src/signencryptjob.h,
src/specialjob.h,
src/verifydetachedjob.h: Export classes.

--
This is an adoption of kde's libkleo commit: d6a71a4e
Thanks dvratil@kde.org

2 years agoQt: Add KeyForMailboxJob
Andre Heinecke [Thu, 11 Aug 2016 15:22:35 +0000 (17:22 +0200)]
Qt: Add KeyForMailboxJob

* lang/qt/src/job.cpp: Include moc and make subclass.
* lang/qt/src/keyformailboxjob.h,
lang/qt/src/qgpgmekeyformailboxjob.cpp,
lang/qt/src/qgpgmekeyformailboxjob.h: New.
* lang/qt/tests/run-keyformailboxjob.cpp: New manual test.
* lang/qt/tests/Makefile.am: Add run-keyformailboxjob.
* lang/qt/src/Makefile.am: Update accordingly.
* lang/qt/src/protocol.h, lang/qt/src/protocol_p.h: Add
keyformailboxjob.

--
The KeyForMailboxjob can be used to determine the best key to
use to encrypt something to a given mail address.

2 years agodoc: Get rid of version.texi
Werner Koch [Wed, 10 Aug 2016 14:33:20 +0000 (16:33 +0200)]
doc: Get rid of version.texi

* configure.ac (CC_FOR_BUILD): New.
* doc/mkdefsinc.c: New.  Taken from GnuPG and modified for gpgme.
* doc/Makefile.am (EXTRA_DIST): Add defsincdate and mkdefsinc.c
(BUILT_SOURCES): new.
(gpgme.texi): New dependency.
(mkdefsinc, defsincdate, defs.inc): New rules.
(dist-hook): New.
* doc/gpgme.texi: Include defs.inc.  Remove version.texi.
--

GnuPG-bug-id: 2352

That new system should also yield more approriate date infos for the
manual.

2 years agobuild: Declare all languages for make dist.
Werner Koch [Wed, 10 Aug 2016 14:28:36 +0000 (16:28 +0200)]
build: Declare all languages for make dist.

* lang/Makefile.am (DIST_SUBDIRS): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Do not identify PNG files as PGP signatures.
Werner Koch [Wed, 10 Aug 2016 13:31:25 +0000 (15:31 +0200)]
core: Do not identify PNG files as PGP signatures.

* src/data-identify.c (next_openpgp_packet): Blacklist PNG files.
--

GnuPG-bug-id: 2314
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoCpp: Handle empty recipients consistently
Andre Heinecke [Wed, 10 Aug 2016 12:12:33 +0000 (14:12 +0200)]
Cpp: Handle empty recipients consistently

* lang/cpp/src/context.cpp (Context::getKeysFromRecipients):
New helper.
(Context::encrypt, Context::startEncryption, Context::signAndEncrypt)
(Context::startCombinedSigningAndEncryption): Use new helper.
* lang/cpp/src/context.h (Context::getKeysFromRecipients): Add
as private helper.

--
bf776ce was incomplete as the code to handle recpients
was duplicated four times. This is now unified and constently
uses a nullptr instead of an empty array.

2 years agocore: Handle ENCRYPT_SYMMETRIC also for sig & enc
Andre Heinecke [Wed, 10 Aug 2016 12:01:38 +0000 (14:01 +0200)]
core: Handle ENCRYPT_SYMMETRIC also for sig & enc

* src/engine-gpg.c (gpg_encrypt_sign): Handle ENCRYPT_SYMMETRIC
flag.

2 years agoQt: Remove unused variable
Andre Heinecke [Wed, 10 Aug 2016 10:06:39 +0000 (12:06 +0200)]
Qt: Remove unused variable

* lang/qt/src/qgpgmerefreshkeysjob.cpp (slotStatus): Remove
unused variable typ.

2 years agoQt: Create TestPassphraseProvider on stack
Andre Heinecke [Wed, 10 Aug 2016 10:05:32 +0000 (12:05 +0200)]
Qt: Create TestPassphraseProvider on stack

* lang/qt/tests/t-encrypt.cpp, lang/qt/tests/t-tofuinfo.cpp: Create
TestPassphraseProvider on stack.

--
Context does not delete the provider. This fixes ASAN errors.

2 years agoCpp: Clarify ownership of provider classes
Andre Heinecke [Wed, 10 Aug 2016 10:04:16 +0000 (12:04 +0200)]
Cpp: Clarify ownership of provider classes

* lang/cpp/src/context.h: Note that the context does not take
ownership of providers.

2 years agotests: Fix memory leak.
Justus Winter [Wed, 10 Aug 2016 08:37:31 +0000 (10:37 +0200)]
tests: Fix memory leak.

* tests/gpg/t-encrypt-mixed.c (main): Free 'text2'.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocore: Ensure err is initalized in gpg_encrypt
Andre Heinecke [Wed, 10 Aug 2016 08:27:05 +0000 (10:27 +0200)]
core: Ensure err is initalized in gpg_encrypt

* src/engine-gpg.c (gpg_encrypt): Initialize err.

2 years agoQt: Fix t-keylist moc include
Andre Heinecke [Wed, 10 Aug 2016 07:50:26 +0000 (09:50 +0200)]
Qt: Fix t-keylist moc include

* lang/qt/tests/t-keylist.cpp: Don't include t-support.moc

--
Accidental leftover from trying to generate t-support moc from
another cpp file. This was solved instead by a new rule to generate
moc files from the header.

2 years agoQt: Clean up debug output in tests
Andre Heinecke [Tue, 9 Aug 2016 16:39:56 +0000 (18:39 +0200)]
Qt: Clean up debug output in tests

* lang/qt/tests/t-support.cpp: Remove accidentally commited
debug output.