gnupg.git
22 months agoRelease 2.1.15 gnupg-2.1.15
Werner Koch [Thu, 18 Aug 2016 15:14:48 +0000 (17:14 +0200)]
Release 2.1.15

22 months agoUpdate NEWS.
Werner Koch [Thu, 18 Aug 2016 14:58:19 +0000 (16:58 +0200)]
Update NEWS.

--

22 months agopo: Auto update
Werner Koch [Thu, 18 Aug 2016 14:57:40 +0000 (16:57 +0200)]
po: Auto update

--

22 months agopo: Add init.c to POTFILES.in
Werner Koch [Thu, 18 Aug 2016 14:56:41 +0000 (16:56 +0200)]
po: Add init.c to POTFILES.in

--

22 months agopo: Update German translation
Werner Koch [Thu, 18 Aug 2016 14:52:58 +0000 (16:52 +0200)]
po: Update German translation

22 months agopo: Update Norwegian translation.
Åka Sikrom [Thu, 18 Aug 2016 14:40:59 +0000 (16:40 +0200)]
po: Update Norwegian translation.

22 months agopo: Update Russian translation
Ineiev [Thu, 18 Aug 2016 14:36:34 +0000 (16:36 +0200)]
po: Update Russian translation

22 months agogpg: Add import filter "drop-sig".
Werner Koch [Thu, 18 Aug 2016 14:15:49 +0000 (16:15 +0200)]
gpg: Add import filter "drop-sig".

* g10/import.c (import_drop_sig): New variable.
(cleanup_import_globals): Release that.
(parse_and_set_import_filter): Add filter "drop-sig".
(filter_getval): Implement properties for drop-sig.
(apply_drop_sig_filter): New.
(import_one): Apply that filter.

Signed-off-by: Werner Koch <wk@gnupg.org>
22 months agodoc: Add comments on how to parse --list-colons output.
Werner Koch [Thu, 18 Aug 2016 10:41:55 +0000 (12:41 +0200)]
doc: Add comments on how to parse --list-colons output.

--

GnuPG-bug-id: 2437

22 months agodirmngr: Remove all system daemon features.
Werner Koch [Thu, 18 Aug 2016 09:23:40 +0000 (11:23 +0200)]
dirmngr: Remove all system daemon features.

* dirmngr/dirmngr.h (opts): Remove fields 'system_service' and
'system_daemon'.
* common/homedir.c (dirmngr_sys_socket_name): Remove.
(dirmngr_user_socket_name): Rename to ...
(dirmngr_socket_name): this.  Change call callers.
* common/asshelp.c (start_new_dirmngr): Remove the system socket
feature.
* tools/gpgconf.c (list_dirs): Do not print "dirmngr-sys-socket".
* sm/server.c (gpgsm_server): Adjust for removed system socket feature.
* dirmngr/server.c (cmd_getinfo): Ditto.
(cmd_killdirmngr): Remove check for system daemon.
(cmd_reloaddirmngr): Ditto.
* dirmngr/dirmngr.c (USE_W32_SERVICE): Remove macro.
(aService): Remove.
(opts): Remove --service.
(w32_service_control): Remove.
(real_main, call_real_main) [W32]: Remove wrapper.
(main): Remove Windows system service feature.  Remove system dameon
feature.  Use only the "~/.gnupg/dirmngr_ldapservers.conf" file.
* dirmngr/certcache.c (load_certs_from_dir): Remove warning in the
system dameon case.
* dirmngr/crlcache.c (DBDIR_D): Always use "~/.gnupg/crls.d".
* dirmngr/ocsp.c (validate_responder_cert): Do not call
validate_cert_chain which was used only in system daemon mode.
* dirmngr/validate.c (validate_cert_chain): Always use the code.
--

We are now starting dirmngr as needed as a user daemon.  The
deprecated system daemon mode does not anymore make sense.  In case a
system wide daemon is required, it is better to setup a dedicated
account to run dirmngr and tweak socket permissions accordingly.

Signed-off-by: Werner Koch <wk@gnupg.org>
22 months agogpg: New option --sender
Werner Koch [Thu, 18 Aug 2016 08:08:34 +0000 (10:08 +0200)]
gpg: New option --sender

* g10/options.h (struct opt): Add field 'sender_list'.
* g10/gpg.c: Include mbox-util.h.
(oSender): New.
(opts): Add option "--sender".
(main): Parse option.
--

This option will eventually be used for more advanced purposes.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agoagent: Allow import of overly large keys.
Werner Koch [Tue, 16 Aug 2016 17:06:28 +0000 (19:06 +0200)]
agent: Allow import of overly large keys.

* agent/command.c (MAXLEN_KEYDATA): Double the size.
--

Debian-bug-id: 834447
Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agog13: Allow the use of a g13tab label for --mount.
Werner Koch [Sun, 14 Aug 2016 18:23:12 +0000 (20:23 +0200)]
g13: Allow the use of a g13tab label for --mount.

* g13/mount.c (g13_mount_container): Do not run the first access check
if syshelp is required.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agog13: Implement --umount for dm-crypt.
Werner Koch [Sun, 14 Aug 2016 18:17:51 +0000 (20:17 +0200)]
g13: Implement --umount for dm-crypt.

* g13/g13.c (main): Implement command --umount.
* g13/mount.c (g13_umount_container): use the syshelper if needed.
* g13/backend.c (be_umount_container): New.
* g13/be-dmcrypt.c (be_dmcrypt_umount_container): New.
* g13/call-syshelp.c (call_syshelp_run_umount): New.
* g13/sh-cmd.c (cmd_umount): New.
(register_commands): Register UMOUNT.
* g13/sh-dmcrypt.c (sh_dmcrypt_umount_container): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agog13: Fix double free bug.
Werner Koch [Sat, 13 Aug 2016 17:42:18 +0000 (19:42 +0200)]
g13: Fix double free bug.

* g13/sh-cmd.c (cmd_mount, cmd_resume): Do not xfree TIUPLES.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agog13: Consider g13tab for a mount command.
Werner Koch [Sat, 13 Aug 2016 17:27:28 +0000 (19:27 +0200)]
g13: Consider g13tab for a mount command.

* g13/sh-cmd.c (cmd_getkeyblob): New.
(register_commands): Register it.
* g13/call-syshelp.c (getkeyblob_data_cb): New.
(call_syshelp_get_keyblob): New.
* g13/mount.c: Include callsyshelp.h.
(g13_mount_container): Ask syshelp whether the filename is managed by
g13tab.  Call syshelp to get the encrypted keyblob in this case.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agog13: Move some function around.
Werner Koch [Sat, 13 Aug 2016 15:39:28 +0000 (17:39 +0200)]
g13: Move some function around.

* g13/keyblob.c (g13_keyblob_decrypt): Move to ...
* g13/server.c: to here.
* g13/suspend.c, g13/mount.c: Include server.h.
* g13/Makefile.am (g13_syshelp_SOURCES): Add keyblob.c
--

This is done to be able to use keyblob read code in syshelp w/o
requiring linking to call-gpg.c

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agog13: New command --find-device.
Werner Koch [Sat, 13 Aug 2016 10:49:54 +0000 (12:49 +0200)]
g13: New command --find-device.

* common/status.h (STATUS_BLOCKDEV: New.
* g13/call-syshelp.c: Include "call-syshelp.h".
(finddevice_status_cb, call_syshelp_find_device): New.
* g13/g13.c (aFindDevice): New.
(opts): Add "--find-device".
(main): Implement --find-device.
* g13/sh-cmd.c (cmd_finddevice): New.
(register_commands): Register new command.
--

This might be useful for scripting.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agoAvoid leading ": " in the log output when there are no prefixes.
Daniel Kahn Gillmor [Fri, 12 Aug 2016 05:37:58 +0000 (01:37 -0400)]
Avoid leading ": " in the log output when there are no prefixes.

* common/logging.c (do_logv): When no prefixes have been requested,
omit the ": " separator, since there is nothing on the left-hand
side of it.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
23 months agoCall log_set_prefix() with human-readable labels.
Daniel Kahn Gillmor [Fri, 12 Aug 2016 05:37:57 +0000 (01:37 -0400)]
Call log_set_prefix() with human-readable labels.

* agent/preset-passphrase.c, agent/protect-tool.c, dirmngr/dirmngr.c
* dirmngr/t-http.c, g10/gpg.c, g10/gpgv.c, g13/g13-syshelp.c
* g13/g13.c, kbx/kbxutil.c, scd/scdaemon.c, sm/gpgsm.c
* tests/gpgscm/main.c, tools/gpg-check-pattern.c
* tools/gpg-connect-agent.c, tools/gpgconf.c, tools/gpgtar.c
* tools/symcryptrun.c: Invoke log_set_prefix() with
human-readable labels.

--

Some invocations of log_set_prefix() were done with raw numeric values
instead of values that humans can understand.  Use symbolic
representations instead of numeric for better readability.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
23 months agogpg: New option --input-size-hint.
Werner Koch [Thu, 11 Aug 2016 19:31:12 +0000 (21:31 +0200)]
gpg: New option --input-size-hint.

* g10/options.h: Include stdint.h.
(struct opt): Add field 'input_size_hint'.
* g10/gpg.c (oInputSizeHint): New.
(opts): Add --input-size-hint.
(main): Set opt.input_size_hint.
* g10/progress.c (write_status_progress): Use the hint.
--

This is a prerequisite to fix
GnuPG-bug-id: 2368

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agocommon: New function string_to_u64.
Werner Koch [Thu, 11 Aug 2016 18:46:51 +0000 (20:46 +0200)]
common: New function string_to_u64.

* common/stringhelp.c (string_to_u64): New.
* dirmngr/http.c (longcounter_t): Remove.
(struct cookie_s): Change content_length to uint64_t.
(parse_response): Use string_to_u64.
--

Meanwhile we allow some C99 features including stdint.h.  Thus we can
simplify things now.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agocommon: Remove compatibility code.
Justus Winter [Thu, 11 Aug 2016 11:03:16 +0000 (13:03 +0200)]
common: Remove compatibility code.

* common/Makefile.am: Drop deleted files.
* common/w32-afunix.c: Delete file.
* common/w32-afunix.h: Likewise.

GnuPG-bug-id: 2408
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agocommon: Rework the simple password query module.
Justus Winter [Thu, 11 Aug 2016 10:26:09 +0000 (12:26 +0200)]
common: Rework the simple password query module.

* common/simple-pwquery.c (writen, readline): Drop.
(agent_send_option, agent_send_all_options, agent_open): Just use
libassuan.
(simple_pw_set_socket): Simplify.
(default_inq_cb): New function.
(simple_pwquery, simple_query): Just use libassuan.
* agent/Makefile.am (gpg_preset_passphrase_LDADD): Add libassuan.
* tools/Makefile.am (symcryptrun_LDADD): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agocommon: Remove simple password query error codes.
Justus Winter [Thu, 11 Aug 2016 07:52:08 +0000 (09:52 +0200)]
common: Remove simple password query error codes.

* common/simple-pwquery.h: Remove mapping function.  Move all
definitions of status codes...
* common/simple-pwquery.c: ... here, and define them to meaningful gpg
error values.
* agent/preset-passphrase.c (preset_passphrase): Use error code as-is.
(forget_passphrase): Likewise.
* tools/symcryptrun.c (confucius_get_pass): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agogpg: Print the signer's UID during verification.
Werner Koch [Wed, 10 Aug 2016 17:51:54 +0000 (19:51 +0200)]
gpg: Print the signer's UID during verification.

* g10/parse-packet.c (parse_signature): Sanitize the value stored in
SIGNERS_UID.
* g10/mainproc.c (issuer_fpr_string): New.
(check_sig_and_print): Print the signers' UID.  Print the issuer
fingerprint in --rfc4880bis mode.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agocommon: New function try_make_printable_string.
Werner Koch [Wed, 10 Aug 2016 17:04:43 +0000 (19:04 +0200)]
common: New function try_make_printable_string.

* common/stringhelp.c (sanitize_buffer): Remove.  Move code to ...
* common/miscellaneous.c (try_make_printable_string): new.
(make_printable_string): Call try_make_printable_string.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agotests: Fix distcheck.
Justus Winter [Wed, 10 Aug 2016 15:57:32 +0000 (17:57 +0200)]
tests: Fix distcheck.

* tests/openpgp/issue2417.scm: Copy configuration.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agogpg: Remove tofu database format "split".
Werner Koch [Fri, 5 Aug 2016 12:40:36 +0000 (14:40 +0200)]
gpg: Remove tofu database format "split".

* g10/options.h (struct opt): Remove field tofu_db_format.
* g10/gpg.h (server_control_s): Add fields tofu.batch_update_ref and
tofu.batch_update_started.
* g10/gpg.c (parse_tofu_db_format): Remove.
(main): Make option --tofu-db-format obsolete.
* g10/tofu.c: Major rework.  Remove the pretty complicated and slower
split format and with that all the caching.  Use the dbs struct
directly.  Move global vars for batch update into CTRL.  Change
calling conventions of some function to take CTRL or DBS pointers
instead of  the former low-level database pointer.
--

The split database format might have been nice for use with Unison but
it bypasses the concept of a relational database by doing parts of
this itself and also risking deadlocks.  Working with the Tofu
database for debugging or experiments is also not possible with parts
of the database logic implemented in gpg.

The Tofu support is quite new and we can assume that it is not in real
use now.  Thus we better remove that now so that we do not need to
maintain it for all future.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agog10: Fix opening of trust database.
Justus Winter [Wed, 10 Aug 2016 14:41:22 +0000 (16:41 +0200)]
g10: Fix opening of trust database.

* g10/tdbio.c (tdbio_set_dbname): This function explicitly checks for
the file size, but handled the case of a zero-sized file incorrectly
by returning success.  Fix this by initializing the database in that
case.
* tests/openpgp/Makefile.am (XTESTS): Add new test.
* tests/openpgp/issue2417.scm: New file.

GnuPG-bug-id: 2417
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agotests: Fix distcheck.
Justus Winter [Wed, 10 Aug 2016 09:52:49 +0000 (11:52 +0200)]
tests: Fix distcheck.

* tests/openpgp/Makefile.am (EXTRA_DIST): Explicitly add setup and
teardown scripts now that they no longer are included in the list of
tests.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agotests: Improve temporary directory handling.
Justus Winter [Wed, 10 Aug 2016 09:54:11 +0000 (11:54 +0200)]
tests: Improve temporary directory handling.

* tests/gpgscm/ffi.c (ffi_init): Rename 'mkdtemp'.
* tests/gpgscm/tests.scm (mkdtemp): New function that uses a sensible
location and template if no arguments are given.
(with-temporary-working-directory): Simplify accordingly.
(make-temporary-file): Likewise.
* tests/openpgp/run-tests.scm (run-tests-parallel-isolated): Likewise.
(run-tests-sequential-isolated): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agogpgscm: Make the name of foreign functions more unique.
Justus Winter [Wed, 10 Aug 2016 09:50:12 +0000 (11:50 +0200)]
gpgscm: Make the name of foreign functions more unique.

* tests/gpgscm/ffi-private.h (ffi_define_function_name): Add another
underscore.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agotests: Run each test in a clean environment.
Justus Winter [Wed, 10 Aug 2016 07:32:53 +0000 (09:32 +0200)]
tests: Run each test in a clean environment.

* tests/openpgp/Makefile.am (TESTS_ENVIRONMENT): Drop obsolete
variables, add 'srcdir', use absolute paths.
(TESTS): Rename to 'XTESTS' to avoid emitting the automake test
runner.  Drop 'setup.scm' and 'finish.scm'.
(xcheck): New target that runs 'run-tests.scm', our Scheme test suite
runner.  It will run each test in a clean environment, isolated from
the other tests.
(EXTRA_DIST): Adapt accordingly.
* tests/openpgp/README: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agotests: Make ssh test more robust.
Justus Winter [Wed, 10 Aug 2016 05:58:24 +0000 (07:58 +0200)]
tests: Make ssh test more robust.

* tests/openpgp/ssh.scm: Drop the 'MD5:' which was not printed by
previous ssh versions.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agoagent: SSH support fix.
NIIBE Yutaka [Wed, 10 Aug 2016 04:51:14 +0000 (13:51 +0900)]
agent: SSH support fix.

* agent/command-ssh.c (ssh_handler_request_identities): Keep error
message same.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
23 months agoagent: Fix regression in recent ssh changes.
Werner Koch [Tue, 9 Aug 2016 15:44:54 +0000 (17:44 +0200)]
agent: Fix regression in recent ssh changes.

* agent/command-ssh.c (sexp_key_construct): Lowercase the algo name.
--

We need to use a lowercase version of the algo in S-expression.
Unfortunately Libgcrypt has no function for this, thus we need to
malloc and first.

Fixes-commit: ebf24e3
Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agogpg: Extend the PROGRESS line to give the used unit.
Werner Koch [Tue, 9 Aug 2016 14:22:24 +0000 (16:22 +0200)]
gpg: Extend the PROGRESS line to give the used unit.

* g10/progress.c (write_status_progress): Print the units parameter.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agoCleanup initialization of libgcrypt.
Ben Kibbey [Mon, 8 Aug 2016 22:40:03 +0000 (18:40 -0400)]
Cleanup initialization of libgcrypt.

* common/init.c (init_common_subsystems): Initialize libgcrypt.
* dirmngr/Makefile.am (dirmngr_ldap): Link with libgcrypt.

--
Most other modules already call gcry_check_version() after
init_common_subsystems() so may as well move initialization of libgcrypt
to here. Also fixes a warning in the system log from gpgconf --homedir.

Signed-off-by: Ben Kibbey <bjk@luxsci.net>
23 months agoagent: SSH support improvement.
NIIBE Yutaka [Tue, 9 Aug 2016 02:42:20 +0000 (11:42 +0900)]
agent: SSH support improvement.

* agent/command-ssh.c (ssh_handler_request_identities): Skip a key with
error, not giving up to handle the request itself.
* agent/cvt-openpgp.c (extract_private_key): Support "ecdsa" key.

--

Note that "ecdsa" key is still in use by old versions of gpg-agent
through its SSH handling (until 2.1.14).  With old versions of
gpg-agent, adding ECDSA key by ssh-add command, "ecdsa" key will be
created.  So, "ecdsa" key should be supported.

For g10/gpg, "ecdsa" and "ecdh" was only used in some experimental
versions of libgcrypt, with parameters.  We now use "ecc" for all cases
in released versions.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
23 months agogpg: Cleanup of dek_to_passphrase function (part 2).
Werner Koch [Mon, 8 Aug 2016 16:45:29 +0000 (18:45 +0200)]
gpg: Cleanup of dek_to_passphrase function (part 2).

* g10/passphrase.c (passphrase_get): Remove arg KEYID.  Change arg
MODE to NOCACHE.
(passphrase_to_dek): Remove args KEYID and PUBKEY_ALGO.  Split arg
MODE into CREATE and NOCACHE.  Change all callers and adjust stubs.
(passphrase_clear_cache): Remove args KEYID and ALGO.  They are not
used.  Change caller.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agogpg: Cleanup of dek_to_passphrase function (part 1).
Werner Koch [Mon, 8 Aug 2016 15:42:37 +0000 (17:42 +0200)]
gpg: Cleanup of dek_to_passphrase function (part 1).

* g10/passphrase.c (passphrase_to_dek_ext): Remove args CUSTDESC and
CUSTPROMPT.  Merge into the passphrase_to_dek wrapper.
(passphrase_get): Remove args CUSTOM_DESCRIPTION and CUSTOM_PROMPT.
--

The function is nowadays only used for symmetric encryption.  Thus we
do not need all the former advanced stuff.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agoagent: More clean up of SSH support.
NIIBE Yutaka [Mon, 8 Aug 2016 09:46:44 +0000 (18:46 +0900)]
agent: More clean up of SSH support.

* common/util.h (get_pk_algo_from_key): New.
* common/sexputil.c (get_pk_algo_from_key): The implementation.
* agent/gpg-agent.c: Remove include of openpgpdefs.h.
* agent/command-ssh.c (struct ssh_key_type_spec): Use integer ALGO.
(ssh_key_types): Update with GCRY_PK_*.
(make_cstring, sexp_extract_identifier): Remove.
(sexp_key_construct): Use gcry_pk_algo_name to get ALGO string.
(ssh_key_to_blob): Use cadr to get value list.
(ssh_key_type_lookup): Lookup with integer ALGO.
(ssh_receive_key): Follow the change of ssh_key_type_lookup.
(ssh_send_key_public): Likewise.  Use get_pk_algo_from_key to get ALGO.

--

This fixes the regresson introduced by the commit
894789c3299dc47a8c1ccaaa7070382f0fae0262.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
23 months agotests: Add openpgp/gpgv-forged-keyring.scm.
NIIBE Yutaka [Mon, 8 Aug 2016 04:24:02 +0000 (13:24 +0900)]
tests: Add openpgp/gpgv-forged-keyring.scm.

* tests/openpgp/gpgv-forged-keyring.scm: New.
* tests/openpgp/forged-keyring.gpg: New.
* tests/openpgp/Makefile.am (TESTS): Add gpgv-forged-keyring.scm.
* tests/openpgp/defs.scm (tools): Add GPGV.
(GPGV): New.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
23 months agoagent: Fix long standing regression tracking the connection count.
Werner Koch [Sat, 6 Aug 2016 08:14:17 +0000 (10:14 +0200)]
agent: Fix long standing regression tracking the connection count.

* agent/gpg-agent.c (get_agent_active_connection_count): New.
(do_start_connection_thread, start_connection_thread_ssh): Bump
ACTIVE_CONNECTIONS up and down.
* agent/command.c (cmd_getinfo): Add subcommand "connections".
--

The variable ACTIVE_CONNECTIONS is used to shutdown gpg-agent in a
friendly way.  Before we switched to nPth a Pth provided count of
threads was used for this.  During the migration to nPth
ACTIVE_CONNECTIONS was introduced and checked but never set.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agoagent: Clean up SSH support.
NIIBE Yutaka [Sat, 6 Aug 2016 05:47:29 +0000 (14:47 +0900)]
agent: Clean up SSH support.

* agent/command-ssh.c (file_to_buffer): Remove.
(ssh_handler_request_identities): Use agent_public_key_from_file.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
23 months agogpg: Avoid publishing the GnuPG version by default
Daniel Kahn Gillmor [Thu, 4 Aug 2016 20:58:13 +0000 (16:58 -0400)]
gpg: Avoid publishing the GnuPG version by default

* g10/gpg.c (main): initialize opt.emit_version to 0
* doc/gpg.texi: document different default for --emit-version

--

The version of GnuPG in use is not particularly helpful.  It is not
cryptographically verifiable, and it doesn't distinguish between
significant version differences like 2.0.x and 2.1.x.

Additionally, it leaks metadata that can be used to distinguish users
from one another, and can potentially be used to target specific
attacks if there are known behaviors that differ between major
versions.

It's probably better to take the more parsimonious approach to
metadata production by default.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
23 months agogpg: Make sure that keygrips are printed for each subkey.
Werner Koch [Thu, 4 Aug 2016 13:34:14 +0000 (15:34 +0200)]
gpg: Make sure that keygrips are printed for each subkey.

* g10/keylist.c (list_keyblock_colon): Print an emprty grip in case of
an error.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agogpg: Always print the fingerprint in colons mode.
Werner Koch [Thu, 4 Aug 2016 13:01:42 +0000 (15:01 +0200)]
gpg: Always print the fingerprint in colons mode.

* g10/keylist.c (list_keyblock_colon): Remove arg FPR.  Always print
fingerprint records.  For secret keys always print keygrip records.
--

The fingerprint should always be used thus we should always print it.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agotests: Use gpgconf to set the ssh socket envvar.
Werner Koch [Thu, 4 Aug 2016 11:04:28 +0000 (13:04 +0200)]
tests: Use gpgconf to set the ssh socket envvar.

* tests/openpgp/ssh.scm ("SSH_AUTH_SOCK"): Use gpgconf.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agogpgconf: Add limited support for -0.
Werner Koch [Thu, 4 Aug 2016 11:02:37 +0000 (13:02 +0200)]
gpgconf: Add limited support for -0.

* tools/gpgconf.h (opt): Add field 'null'.
* tools/gpgconf.c: Add option --null/-0.
(list_dirs): Use it here.
--

This option changes the delimites for --list-dir with arguments from
LF to Nul.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agotests: Update list of tests in Scheme test runner.
Justus Winter [Thu, 4 Aug 2016 10:10:47 +0000 (12:10 +0200)]
tests: Update list of tests in Scheme test runner.

* tests/openpgp/run-tests.scm: Add missing tests.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agotests: Fix path to fake-pinentry.
Justus Winter [Thu, 4 Aug 2016 10:09:52 +0000 (12:09 +0200)]
tests: Fix path to fake-pinentry.

* tests/openpgp/defs.scm: Correctly compute the path to fake-pinentry.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agopo: Update Japanese translation.
NIIBE Yutaka [Thu, 4 Aug 2016 08:31:13 +0000 (17:31 +0900)]
po: Update Japanese translation.

23 months agopo: update Japanese translation.
NIIBE Yutaka [Thu, 4 Aug 2016 08:02:20 +0000 (17:02 +0900)]
po: update Japanese translation.

23 months agog10: Fix checking key for signature validation.
NIIBE Yutaka [Thu, 4 Aug 2016 07:21:39 +0000 (16:21 +0900)]
g10: Fix checking key for signature validation.

* g10/sig-check.c (check_signature2): Not only subkey, but also primary
key should have flags.valid=1.

--

The tweak of gpgv in e32c575e0f3704e7563048eea6d26844bdfc494b only makes
sense with this change.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
23 months agoReword feature description.
Justus Winter [Wed, 3 Aug 2016 15:00:40 +0000 (17:00 +0200)]
Reword feature description.

--
Suggested-by: Peter Gutmann
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agokbx: Add missing header file.
Justus Winter [Wed, 3 Aug 2016 14:58:32 +0000 (16:58 +0200)]
kbx: Add missing header file.

* kbx/keybox-update.c: Add missing header file.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agoMore cleanup of "allow to".
Daniel Kahn Gillmor [Tue, 2 Aug 2016 02:19:17 +0000 (22:19 -0400)]
More cleanup of "allow to".

* README, agent/command.c, agent/keyformat.txt, common/i18n.c,
  common/iobuf.c, common/keyserver.h, dirmngr/cdblib.c,
  dirmngr/ldap-wrapper.c, doc/DETAILS, doc/TRANSLATE,
  doc/announce-2.1.txt, doc/gpg.texi, doc/gpgsm.texi,
  doc/scdaemon.texi, doc/tools.texi, doc/whats-new-in-2.1.txt,
  g10/export.c, g10/getkey.c, g10/import.c, g10/keyedit.c, m4/ksba.m4,
  m4/libgcrypt.m4, m4/ntbtls.m4, po/ca.po, po/cs.po, po/da.po,
  po/de.po, po/el.po, po/eo.po, po/es.po, po/et.po, po/fi.po,
  po/fr.po, po/gl.po, po/hu.po, po/id.po, po/it.po, po/ja.po,
  po/nb.po, po/pl.po, po/pt.po, po/ro.po, po/ru.po, po/sk.po,
  po/sv.po, po/tr.po, po/uk.po, po/zh_CN.po, po/zh_TW.po,
  scd/app-p15.c, scd/ccid-driver.c, scd/command.c, sm/gpgsm.c,
  sm/sign.c, tools/gpgconf-comp.c, tools/gpgtar.h: replace "Allow to"
  with clearer text.

In standard English, the normal construction is "${XXX} allows ${YYY}
to" -- that is, the subject (${XXX}) of the sentence is allowing the
object (${YYY}) to do something.  When the object is missing, the
phrasing sounds awkward, even if the object is implied by context.
There's almost always a better construction that isn't as awkward.

These changes should make the language a bit clearer.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
23 months agodirmngr: Emit correct spelling of "superseded".
Daniel Kahn Gillmor [Tue, 2 Aug 2016 02:19:16 +0000 (22:19 -0400)]
dirmngr: Emit correct spelling of "superseded".

* dirmngr/crlcache.c (list_one_crl_entry): Spell superseded correctly.
* dirmngr/ocsp.c (ocsp_invalid): Likewise.

This might break some tools which parse the existing output and expect
misspellings, but i'm not sure there are many such tools, and we
should use standardized orthography going forward.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
23 months agoFix spelling and grammar.
Daniel Kahn Gillmor [Tue, 2 Aug 2016 02:19:15 +0000 (22:19 -0400)]
Fix spelling and grammar.

* agent/learncard.c: s/coccured/occurred/
* doc/dirmngr.texi: s/ommitted/omitted/, s/orginally/originally/,
  s/reponses/responses/i
* doc/gpg-agent.texi, doc/dirmngr.texi, doc/gpg.texi: Fix "allows
  to" to more conventional english usage.
* doc/tools.texi, g10/gpgcommpose.c, tests/openpgp/armor.scm,
  tests/openpgp/armor.test: s/occured/occurred/
* tools/gpgsplit.c: s/calcualting/calculating/
* sm/server.c: s/formated/formatted/

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
23 months agogpg,gpgsm: Block signals during keyring/keybox update.
Werner Koch [Wed, 3 Aug 2016 13:31:27 +0000 (15:31 +0200)]
gpg,gpgsm: Block signals during keyring/keybox update.

* kbx/keybox-util.c (keybox_file_rename): Add arg BLOCK_SIGNALS.
* kbx/keybox-update.c (rename_tmp_file): Block all signals when doing
a double rename.
* g10/keyring.c (rename_tmp_file): Block all signals during the double
rename.
--

This might fix
Debian-bug-id: 831510

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agocommon: New file utilproto.c
Werner Koch [Wed, 3 Aug 2016 13:27:03 +0000 (15:27 +0200)]
common: New file utilproto.c

* common/util.h: Factor prototypes from signal.c out to ...
* common/utilproto.h: new.
* common/Makefile.am (common_sources): Add new file.

Signed-off-by: Werner Koch <wk@gnupg.org>
23 months agogpgsm: Fix machine-readable key listing.
Justus Winter [Mon, 1 Aug 2016 10:32:36 +0000 (12:32 +0200)]
gpgsm: Fix machine-readable key listing.

* sm/keylist.c (list_cert_colon): Drop superfluous colon.

GnuPG-bug-id: 2432
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agotests: Distribute standalone test runner.
Justus Winter [Mon, 1 Aug 2016 09:08:43 +0000 (11:08 +0200)]
tests: Distribute standalone test runner.

* tests/openpgp/Makefile.am (EXTRA_DIST): Add missing file
'run-tests.scm'.

GnuPG-bug-id: 2431
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agotests: Fix distcheck.
Justus Winter [Thu, 28 Jul 2016 16:11:50 +0000 (18:11 +0200)]
tests: Fix distcheck.

* tests/openpgp/Makefile.am (sample_msgs): New variable.
(EXTRA_DIST): Also ship the sample msgs.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agobuild: Fix check for Android.
Fredrik Fornwall [Wed, 27 Jul 2016 10:31:19 +0000 (12:31 +0200)]
build: Fix check for Android.

* configure.ac: Match other Android targets as well.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agocommon: Fix iobuf_peek corner case.
Justus Winter [Tue, 26 Jul 2016 16:29:01 +0000 (18:29 +0200)]
common: Fix iobuf_peek corner case.

Previously, iobuf_peek on a file smaller than 'buflen' would hang.

* common/iobuf.c (underflow): Generalize by adding a target parameter.
(iobuf_peek): Use this to prevent looping here.
* tests/openpgp/Makefile.am (TESTS): Add new test.
* tests/openpgp/setup.scm (dearmor): Move function...
* tests/openpgp/defs.scm (dearmor): ... here.
* tests/openpgp/issue2419.scm: New file.
* tests/openpgp/samplemsgs/issue2419.asc: Likewise.

GnuPG-bug-id: 2419
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agogpgscm: Do not shadow common function name in catch macro.
Justus Winter [Tue, 26 Jul 2016 16:35:58 +0000 (18:35 +0200)]
gpgscm: Do not shadow common function name in catch macro.

* tests/gpgscm/init.scm (catch): Do not shadow 'exit'.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agotests: Fix distcheck.
Justus Winter [Tue, 26 Jul 2016 14:03:06 +0000 (16:03 +0200)]
tests: Fix distcheck.

* tests/openpgp/Makefile.am (samplekeys): Add missing key.

Fixes-commit: 4ba11251
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agogpgscm: Make the verbose setting more useful.
Justus Winter [Tue, 26 Jul 2016 13:53:50 +0000 (15:53 +0200)]
gpgscm: Make the verbose setting more useful.

* tests/gpgscm/ffi.c (do_get_verbose): New function.
(do_set_verbose): Likewise.
(ffi_init): Turn *verbose* into a function, add *set-verbose!*.
* tests/gpgscm/tests.scm (call): Adapt accordingly.
(call-with-io): Dump output if *verbose* is high.
(pipe-do): Adapt accordingly.
* tests/openpgp/defs.scm: Set verbosity according to environment.
* tests/openpgp/run-tests.scm (test): Adapt accordingly.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agocommon: Avoid excessive stack use.
Justus Winter [Tue, 26 Jul 2016 12:49:02 +0000 (14:49 +0200)]
common: Avoid excessive stack use.

* common/exectool.c (copy_buffer_shred): Make passing NULL a nop.
(gnupg_exec_tool_stream): Allocate copy buffers from the heap.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agocommon: Rework resource cleanup when handling errors.
Justus Winter [Tue, 26 Jul 2016 12:31:11 +0000 (14:31 +0200)]
common: Rework resource cleanup when handling errors.

* common/exectool.c (gnupg_exec_tool_stream): Rework error handling.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agocommon: Add unit test for exectool.
Justus Winter [Tue, 26 Jul 2016 12:29:12 +0000 (14:29 +0200)]
common: Add unit test for exectool.

* common/Makefile.am: Build new test.
* common/t-exectool.c: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agog10: Fix key import statistics.
Justus Winter [Mon, 25 Jul 2016 10:41:28 +0000 (12:41 +0200)]
g10: Fix key import statistics.

'transfer_secret_keys' collects statistics on a subkey-basis, while
the other code does not.  This leads to inflated numbers when
importing secret keys.  E.g. 'count' is incremented by the main
parsing loop in 'import', and again in 'transfer_secret_keys', leading
to a total of 3 if one key with two secret subkeys is imported.

* g10/import.c (import_secret_one): Adjust to the fact that
'transfer_secret_keys' collects subkey statistics.
* tests/openpgp/Makefile.am (TESTS): Add new test.
* tests/openpgp/issue2346.scm: New file.
* tests/openpgp/samplekeys/issue2346.gpg: Likewise.

GnuPG-bug-id: 2346
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agogpgscm: Make function more general.
Justus Winter [Fri, 22 Jul 2016 15:42:17 +0000 (17:42 +0200)]
gpgscm: Make function more general.

* tests/gpgscm/tests.scm (in-srcdir): Accept more path fragments.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agog10: Properly ignore legacy keys in the keyring cache.
Justus Winter [Fri, 22 Jul 2016 11:29:26 +0000 (13:29 +0200)]
g10: Properly ignore legacy keys in the keyring cache.

* g10/keyring.c (keyring_rebuild_cache): Properly ignore legacy keys
in the keyring cache.
* tests/migrations/Makefile.am (TESTS): Add new test.
* tests/migrations/common.scm (GPG-no-batch): New variable.
(run-test): New function.
* tests/migrations/issue2276.scm: New file.
* tests/migrations/issue2276.tar.asc: Likewise.

GnuPG-bug-id: 2276
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agog10: Fix error handling.
Justus Winter [Thu, 21 Jul 2016 16:22:18 +0000 (18:22 +0200)]
g10: Fix error handling.

* g10/tofu.c (show_statistics): Fix error handling, 0 is a valid
duration.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agog10: Drop superfluous begin transaction.
Justus Winter [Thu, 21 Jul 2016 16:07:22 +0000 (18:07 +0200)]
g10: Drop superfluous begin transaction.

* g10/tofu.c (record_binding): We only need a transaction for the
split format.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agogpgscm: Make assert macro more accurate.
Justus Winter [Thu, 21 Jul 2016 16:05:58 +0000 (18:05 +0200)]
gpgscm: Make assert macro more accurate.

* tests/gpgscm/lib.scm (assert): Print the representation of the
failed expression.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agogpgscm: Make error message more useful.
Justus Winter [Thu, 21 Jul 2016 16:04:57 +0000 (18:04 +0200)]
gpgscm: Make error message more useful.

* tests/gpgscm/scheme.c (opexe_0): Include names of missing function
parameters in the error message.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agog10: Fix crash.
Justus Winter [Thu, 21 Jul 2016 09:49:33 +0000 (11:49 +0200)]
g10: Fix crash.

* g10/tofu.c (tofu_closedbs): Fix freeing database handles up to the
cache limit.  Previously, this would crash if db_cache_count == count.

Reported-by: Ben Kibbey <bjk@luxsci.net>
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agoscd: Fix card removal/reset on multiple contexts.
NIIBE Yutaka [Wed, 20 Jul 2016 02:35:05 +0000 (11:35 +0900)]
scd: Fix card removal/reset on multiple contexts.

* scd/app.c (application_notify_card_reset): Add message for debug.
*scd/command.c (update_card_removed): Call release_application and set
SLOT -1 here.
(struct server_local_s): Remove app_ctx_marked_for_release.
(do_reset): Don't mark release but call release_application here.
(open_card): Remove app_ctx_marked_for_release handling.
(update_reader_status_file): Don't set SLOT here, so that it can be
released the APP by application_notify_card_reset in
update_card_removed.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
23 months agoagent: Add known keys to sshcontrol.
Justus Winter [Tue, 19 Jul 2016 14:48:38 +0000 (16:48 +0200)]
agent: Add known keys to sshcontrol.

* agent/command-ssh.c (ssh_identity_register): Add a key to sshcontrol
even if it is already in the private key store.
* tests/openpgp/ssh.scm: Test this.

GnuPG-bug-id: 2316
Signed-off-by: Justus Winter <justus@g10code.com>
23 months agotests: Add test for ssh support.
Justus Winter [Tue, 19 Jul 2016 14:17:22 +0000 (16:17 +0200)]
tests: Add test for ssh support.

* tests/gpgscm/tests.scm (path-expand): New function.
* tests/openpgp/Makefile.am (TESTS): Add new test.
(sample_keys): Add new keys.
(CLEANFILES): Clean ssh socket and control file.
* tests/openpgp/fake-pinentry.c (main): Add a default passphrase.
* tests/openpgp/gpg-agent.conf.tmpl: Enable ssh support.
* tests/openpgp/samplekeys/ssh-dsa.key: New file.
* tests/openpgp/samplekeys/ssh-ecdsa.key: Likewise.
* tests/openpgp/samplekeys/ssh-ed25519.key: Likewise.
* tests/openpgp/samplekeys/ssh-rsa.key: Likewise.
* tests/openpgp/ssh.scm: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
23 months agoscd: Fix race conditions for release_application.
NIIBE Yutaka [Tue, 19 Jul 2016 01:53:39 +0000 (10:53 +0900)]
scd: Fix race conditions for release_application.

* scd/command.c (do_reset, cmd_restart): Reset app_ctx before calling
release_application.

--

Thanks to Ben Warren for the report.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
23 months agoagent: Fix passphrase cache lookups.
Justus Winter [Mon, 18 Jul 2016 10:51:38 +0000 (12:51 +0200)]
agent: Fix passphrase cache lookups.

CACHE_MODE_ANY is supposed to match any cache mode except
CACHE_MODE_IGNORE, but the code used '==' to compare cache modes.

* agent/cache.c (cache_mode_equal): New function.
(agent_set_cache): Use the new function to compare cache modes.
(agent_get_cache): Likewise.
* tests/openpgp/Makefile.am (TESTS): Add new test.
* tests/openpgp/issue2015.scm: New file.

GnuPG-bug-id: 2015
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agobuild: Always build gpgtar.
Justus Winter [Fri, 15 Jul 2016 15:20:18 +0000 (17:20 +0200)]
build: Always build gpgtar.

We use gpgtar to unpack test data, hence we always build it.  If the
user opts out, we simply don't install it.

* configure.ac: Add comment.
* tests/migrations/Makefile.am (required_pgms): Make sure gpgtar is
built.
* tools/Makefile.am: Always build gpgtar, but do not install it if the
user used '--disable-gpgtar'.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agowks: Publish as binary file.
Werner Koch [Fri, 15 Jul 2016 15:20:43 +0000 (17:20 +0200)]
wks: Publish as binary file.

* tools/gpg-wks-server.c (copy_key_as_binary): New.
(check_and_publish): Use new function instead of rename.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agogpgscm: Fix linking.
Justus Winter [Fri, 15 Jul 2016 10:28:46 +0000 (12:28 +0200)]
gpgscm: Fix linking.

* tests/gpgscm/Makefile.am: Add -lintl.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agog10: Fix building without trust models.
Justus Winter [Fri, 15 Jul 2016 10:12:34 +0000 (12:12 +0200)]
g10: Fix building without trust models.

* g10/pkclist.c (write_trust_status): Fall back to the previous
behavior.

Fixes-commit: ae188932
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Check for gpgtar.
Justus Winter [Fri, 15 Jul 2016 09:59:57 +0000 (11:59 +0200)]
tests: Check for gpgtar.

* tests/migrations/extended-pkf.scm: Skip test if gpgtar is not built.
* tests/migrations/from-classic.scm: Likewise.
* tests/openpgp/gpgtar.scm: Fix check for gpgtar.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agodoc: Update whats-new-in-2.1.txt
Werner Koch [Thu, 14 Jul 2016 16:55:00 +0000 (18:55 +0200)]
doc: Update whats-new-in-2.1.txt

--

Update it now so I won't forget to do it for the next release.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoPost release updates
Werner Koch [Thu, 14 Jul 2016 15:07:27 +0000 (17:07 +0200)]
Post release updates

--

2 years agoRelease 2.1.14 gnupg-2.1.14
Werner Koch [Thu, 14 Jul 2016 14:00:06 +0000 (16:00 +0200)]
Release 2.1.14

2 years agoMerge branch 'master' into STABLE-BRANCH-2-2
Werner Koch [Thu, 14 Jul 2016 13:58:56 +0000 (15:58 +0200)]
Merge branch 'master' into STABLE-BRANCH-2-2

2 years agopo: Auto-update translations
Werner Koch [Thu, 14 Jul 2016 13:56:26 +0000 (15:56 +0200)]
po: Auto-update translations

--

2 years agopo: Update the German translation
Werner Koch [Thu, 14 Jul 2016 13:55:40 +0000 (15:55 +0200)]
po: Update the German translation

2 years agodirmngr: fix handling of HTTP redirections
Damien Goutte-Gattat [Sun, 29 May 2016 14:55:42 +0000 (16:55 +0200)]
dirmngr: fix handling of HTTP redirections

* dirmngr/ks-engine-http.c (ks_http_fetch): Reinitialize HTTP session
when following a HTTP redirection.

Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
2 years agogpg: Remove options --print-dane-records and --print-pka-records.
Werner Koch [Thu, 14 Jul 2016 13:19:36 +0000 (15:19 +0200)]
gpg: Remove options --print-dane-records and --print-pka-records.

* g10/gpg.c (main): Remove options but print a dedicated warning.
* g10/options.h (struct opt): Remove fields 'print_dane_records' and
'print_pka_records'.
* g10/keylist.c (list_keyblock): Do not call list_keyblock_pka.
(list_keyblock_pka): Remove.

Signed-off-by: Werner Koch <wk@gnupg.org>