gnupg.git
9 days agodoc: Note pinentry-mode for passphrase opts STABLE-BRANCH-2-2
Andre Heinecke [Mon, 8 Jan 2018 18:09:28 +0000 (19:09 +0100)]
doc: Note pinentry-mode for passphrase opts

* doc/gpg.texi (--passphrase, --passphrase-file, --passphrase-fd):
Note that pinentry-mode needs to be loopback.

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
10 days agogpg: Print all keys with --decrypt --list-only.
Werner Koch [Mon, 8 Jan 2018 08:30:31 +0000 (09:30 +0100)]
gpg: Print all keys with --decrypt --list-only.

* g10/mainproc.c (proc_pubkey_enc): Use dedicated error code for
list-only and put the key into PKENC_LIST.
(print_pkenc_list): Take care of the new error code.
--

If the secret keys exist in --list-only mode it was not printed in
--list-only mode.

GnuPG-bug-id: 3718
Signed-off-by: Werner Koch <wk@gnupg.org>
2 weeks agogpg: Allow "futuredefault" as alias for "future-default".
Werner Koch [Mon, 1 Jan 2018 13:59:30 +0000 (14:59 +0100)]
gpg: Allow "futuredefault" as alias for "future-default".

* g10/keygen.c (parse_key_parameter_string): Allow "futuredefault" and
use case-insensitive matching
(quick_generate_keypair): Ditto.
(parse_algo_usage_expire): Ditto.
--

The man page is sometimes rendered in a way that the hyphen may be
not be considered as part of the string.  And while at it we also
allow case-insensitivity.

GnuPG-bug-id: 3655
Signed-off-by: Werner Koch <wk@gnupg.org>
2 weeks agogpg: Allow the use of "cv25519" and "ed25519" in the keygen parms.
Werner Koch [Fri, 29 Dec 2017 19:18:20 +0000 (20:18 +0100)]
gpg: Allow the use of "cv25519" and "ed25519" in the keygen parms.

* g10/keygen.c (gen_ecc): Map curve names.
--

See
https://lists.gnupg.org/pipermail/gnupg-users/2017-December/059619.html

Signed-off-by: Werner Koch <wk@gnupg.org>
3 weeks agoscd: Fix for inactive card at start by internal CCID driver.
NIIBE Yutaka [Wed, 27 Dec 2017 08:20:03 +0000 (17:20 +0900)]
scd: Fix for inactive card at start by internal CCID driver.

* scd/ccid-driver.c (do_close_reader): Set NULL on close.
(bulk_in): Move DEBUGOUT and check by EP_INTR.
(ccid_get_atr): Clear powered_off flag after initial status check.

--

Many card readers automatically turn on inserted card, but some
defaults to turning off at start.

GnuPG-bug-id: 3508
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 weeks agobuild: Increase libassuan min version to 2.5.0
Kristian Fiskerstrand [Wed, 20 Dec 2017 20:12:01 +0000 (21:12 +0100)]
build: Increase libassuan min version to 2.5.0

--
assuan_sock_set_system_hooks is used unconditionally in gnupg since
commit 9f641430dcdecbd7ee205d407cb19bb4262aa95d, and as such it requires
libassuan 2.5.0 (function introduced in
commit 90dc81682b13a7cf716a8a26b891051cbd4b0caf)

For a detailed description see:
https://lists.gnupg.org/pipermail/gnupg-devel/2017-December/033323.html

3 weeks agokbx: Simplify by removing custom memory functions.
Werner Koch [Fri, 22 Dec 2017 11:55:32 +0000 (12:55 +0100)]
kbx: Simplify by removing custom memory functions.

* kbx/keybox-util.c (keybox_set_malloc_hooks): Remove.
(_keybox_malloc, _keybox_calloc, keybox_realloc)
(_keybox_free): Remove.
(keybox_file_rename): Remove.  Was not used.
* sm/gpgsm.c (main): Remove call to keybox_set_malloc_hooks.
* kbx/kbxutil.c (main): Ditto.
* kbx/keybox-defs.h: Remove all separate includes.  Include util.h.
remove convenience macros.
* common/logging.h (return_if_fail): New.  Originally from
keybox-defs.h but now using log_debug.
(return_null_if_fail): Ditto.
(return_val_if_fail): Ditto.
(never_reached): Ditto.
--

Originally the KBX code was written to allow standalone use.  However
this required lot of ugliness like separate memory allocators and
such.  It also precludes the use of some standard functions from
common due to their use of the common gnupg malloc functions.
Dropping all that makes things easier.  Minor disadvantages: the kbx
call done for gpg will now use gcry malloc fucntions and not the
standard malloc functions.  This might be a bit slower but removing
them even fixes a possible bug in keybox_tmp_names which is used in
gpg and uses gpg's xfree which is actually gcry_free.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 weeks agocommon: Use larger buffer for homedir in case of 64 bit UIDs.
Werner Koch [Wed, 20 Dec 2017 14:37:29 +0000 (15:37 +0100)]
common: Use larger buffer for homedir in case of 64 bit UIDs.

* common/homedir.c (_gnupg_socketdir_internal): Enlarge PREFIX by 6
bytes for "/gnupg".
--

The temporary buffer was to short for the extra "/gnupg".  However the
20 bytes for the UID is large enough for all 32 bit UIDs and would
only fail (detected) if  a 64 bit UID is used.

Fixes-commit: 17efcd2a2acdc3b7f00711272aa51e5be2476921
Reported-by: Rainer Perske.
Signed-off-by: Werner Koch <wk@gnupg.org>
4 weeks agoPost release updates
Werner Koch [Wed, 20 Dec 2017 09:13:54 +0000 (10:13 +0100)]
Post release updates

--

4 weeks agoRelease 2.2.4 gnupg-2.2.4
Werner Koch [Wed, 20 Dec 2017 07:31:22 +0000 (08:31 +0100)]
Release 2.2.4

4 weeks agopo: Auto-update
Werner Koch [Wed, 20 Dec 2017 07:30:40 +0000 (08:30 +0100)]
po: Auto-update

--

4 weeks agopo: Update Czech translation
Petr Pisar [Tue, 19 Dec 2017 18:50:30 +0000 (19:50 +0100)]
po: Update Czech translation

Signed-off-by: Werner Koch <wk@gnupg.org>
4 weeks agopo: Update Russian translation
Ineiev [Wed, 13 Dec 2017 13:40:02 +0000 (13:40 +0000)]
po: Update Russian translation

4 weeks agowks: New server options --check, --with-dir, with-file.
Werner Koch [Tue, 19 Dec 2017 16:42:10 +0000 (17:42 +0100)]
wks: New server options --check, --with-dir, with-file.

* tools/gpg-wks-server.c (aCheck, oWithDir, oWithFile): New const.
(opts): New options --check, --with-dir, and --with-file.
(main): Call command_check_key.
(command_list_domains): Implement option --with-dir.
(fname_from_userid): New.
(command_check_key): New.
(command_remove_key): Implement existsing command.
(command_revoke_key): Call command_remove_key as a simple
implementation.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 weeks agopo: Auto-update
Werner Koch [Tue, 19 Dec 2017 11:39:25 +0000 (12:39 +0100)]
po: Auto-update

--

Mainly due to removed translations in debug messages.

4 weeks agopo: Fix a string in de and nl. Mark a string in ro and sk fuzzy.
Werner Koch [Tue, 19 Dec 2017 11:36:49 +0000 (12:36 +0100)]
po: Fix a string in de and nl.  Mark a string in ro and sk fuzzy.

--

These wrong translations are propably due to accidently removing a
fuzzy mark.

A German translation (gpgsm audit feature) was actually reversed.

A Dutch translation has an unused ": %s" at the end.

I am not 100% of the Romanian and Slovak strings, thus I marked them
as fuzzy.

GnuPG-bug-id: 3619
Signed-off-by: Werner Koch <wk@gnupg.org>
4 weeks agoconf: New option --status-fd.
Werner Koch [Mon, 18 Dec 2017 16:46:05 +0000 (17:46 +0100)]
conf: New option --status-fd.

* tools/gpgconf.c (oStatusFD): New const.
(opts): New option --status-fd.
(statusfp): New var.
(set_status_fd): New.
(gpgconf_write_status): New.
(gpgconf_failure): New.
(main): Set status fd and replace exit by gpgconf_failure.
* tools/gpgconf-comp.c: Repalce exit by gpgconf_failure.
(gc_process_gpgconf_conf): Print a few warning status messages.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 weeks agogpgconf: Show --compliance in expert mode.
Werner Koch [Mon, 18 Dec 2017 15:31:54 +0000 (16:31 +0100)]
gpgconf: Show --compliance in expert mode.

* tools/gpgconf-comp.c (gc_options_gpg): Set compliance to expert.
(gc_options_gpgsm): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 weeks agosm: Allow explicit setting of the default --compliance=gnupg
Werner Koch [Mon, 18 Dec 2017 11:05:02 +0000 (12:05 +0100)]
sm: Allow explicit setting of the default --compliance=gnupg

* sm/gpgsm.c (main): Allow setting of the default compliance.
* tools/gpgconf-comp.c (gc_options_gpgsm): Add "compliance".
--

This is required so that we can use this option in in gpgconf.conf.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 weeks agopo: Update Japanese translation.
NIIBE Yutaka [Mon, 18 Dec 2017 05:09:53 +0000 (14:09 +0900)]
po: Update Japanese translation.

* po/ja.po: Fix message with no "%s".

--

Backport of master commit from: 77e2fcb4ffbad8577a2cf41f17bf92dec6a93ad8

The wrong message caused segmentation fault for key generation when
no expiration is specified.

GnuPG-bug-id: 3619
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 weeks agogpg: Print a warning for too much data encrypted with 3DES et al.
Werner Koch [Wed, 13 Dec 2017 12:02:34 +0000 (13:02 +0100)]
gpg: Print a warning for too much data encrypted with 3DES et al.

* g10/filter.h (cipher_filter_context_t): Remove unused filed
'create_mdc'.  Turn field 'header' into a bit field.  Add new fields
'short_blklen_warn' and 'short_blklen_count'.
* g10/cipher.c (write_header): Print a warning if MDC is not used.
(cipher_filter): Print a warning for long messages encrypted with a
short block length algorithm.
--

Note that to test this warning in a reliable way compression needs to
be disabled.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agogpg: Simplify cipher:write_header.
Werner Koch [Wed, 13 Dec 2017 10:58:51 +0000 (11:58 +0100)]
gpg: Simplify cipher:write_header.

* g10/cipher.c (write_header): Use write_status_printf.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agoindent: Re-indent g10/cipher.c
Werner Koch [Wed, 13 Dec 2017 10:56:28 +0000 (11:56 +0100)]
indent: Re-indent g10/cipher.c

--

5 weeks agogpg: Simplify default_recipient().
Werner Koch [Wed, 13 Dec 2017 10:00:24 +0000 (11:00 +0100)]
gpg: Simplify default_recipient().

* g10/pkclist.c (default_recipient): Use hexfingerprint.
--

Note that on malloc failure this function now returns NULL instead of
terminating the process.  However, under memory pressure any function
called latter will very likely fail as well.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agogpg: Return an error from hexfingerprint on malloc error.
Werner Koch [Wed, 13 Dec 2017 09:52:34 +0000 (10:52 +0100)]
gpg: Return an error from hexfingerprint on malloc error.

* g10/keyid.c (hexfingerprint): Return NULL on malloc failure.  Chnage
all callers.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agogpg: Remove some xmallocs.
Werner Koch [Wed, 13 Dec 2017 09:06:37 +0000 (10:06 +0100)]
gpg: Remove some xmallocs.

* g10/getkey.c (get_pubkeys): Do not use xmalloc.
--

We eventually need to get rid of all xmallocs so that gpg won't fail
easily when we make more use of the s server mode.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agoindent: Re-indent get_pubkeys.
Werner Koch [Wed, 13 Dec 2017 08:54:39 +0000 (09:54 +0100)]
indent: Re-indent get_pubkeys.

--

5 weeks agogpg: default-preference-list: prefer SHA512.
Daniel Kahn Gillmor [Thu, 28 Sep 2017 12:32:26 +0000 (08:32 -0400)]
gpg: default-preference-list: prefer SHA512.

* g10/keygen.c (keygen_set_std_prefs): when producing default internal
personal-digest-preferences, keep the same order.  When publishing
external preferences, state preference for SHA512 first.

--

SHA-512 has a wider security margin than SHA-256.  It is also slightly
faster on most of the architectures on which GnuPG runs today.  New
keys should publish defaults that indicate we prefer the stronger,
more performant digest.

Specifically, this changes --default-preference-list from:

   SHA256 SHA384 SHA512 SHA224

to:

   SHA512 SHA384 SHA256 SHA224

This patch deliberately avoids touching --personal-digest-preferences
(which itself would affect the default of --digest-algo and
--cert-digest-algo), so that public-facing cleartext signatures and
identity certifications will continue to be made with SHA256 by
default.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
5 weeks agoChange backlog from 5 to 64 and provide option --listen-backlog.
Werner Koch [Tue, 12 Dec 2017 13:14:40 +0000 (14:14 +0100)]
Change backlog from 5 to 64 and provide option --listen-backlog.

* agent/gpg-agent.c (oListenBacklog): New const.
(opts): New option --listen-backlog.
(listen_backlog): New var.
(main): Parse new options.
(create_server_socket): Use var instead of 5.
* dirmngr/dirmngr.c: Likewise.
* scd/scdaemon.c: Likewise.
--

GnuPG-bug-id: 3473
Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agobuild: New configure option --enable-run-gnupg-user-socket.
Werner Koch [Tue, 12 Dec 2017 08:42:43 +0000 (09:42 +0100)]
build: New configure option --enable-run-gnupg-user-socket.

* configure.ac: (USE_RUN_GNUPG_USER_SOCKET): New ac_define.
* common/homedir.c (_gnupg_socketdir_internal): Add extra directories.
--

This allows to build GnuPG with an extra socketdir below /run.  See
https://lists.gnupg.org/pipermail/gnupg-devel/2017-November/033250.html
for a longer explanation why this is sometimes useful.

Suggested-by: Rainer Perske
Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agodirmngr: Check for WKD support at session end
Werner Koch [Tue, 14 Nov 2017 15:24:12 +0000 (16:24 +0100)]
dirmngr: Check for WKD support at session end

* dirmngr/domaininfo.c (insert_or_update): Copy the name.
* dirmngr/misc.c (copy_stream): Allow arg OUT to be NULL.
* dirmngr/server.c (set_error): Protect CTX.
(dirmngr_status): Protect against missing ASSUAN_CTX.
(dirmngr_status_help): Ditto.
(dirmngr_status_printf): Ditto.
(cmd_wkd_get): Factor code out to ...
(proc_wkd_get): new func.  Support silent operation with no CTX.
(task_check_wkd_support): New.
--

This finalizes the feature to efficiently cache WKD checks.  If a
standard WKD query returns no data, we queue a test to be run after
the end of the session (so that we do not delay the calling client).
This check tests whether the server responsible for the queried
address has WKD at all enabled.  The test is done by checking whether
the "policy" file exists.  We do not check the "submission-address"
file because that is not necessary for the web key operation.  The
policy file is now required.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit d4e2302d8f4a1ff52d56da4f8e3a5d1c6303822d)

5 weeks agodirmngr: Add a background task framework.
Werner Koch [Tue, 14 Nov 2017 12:42:18 +0000 (13:42 +0100)]
dirmngr: Add a background task framework.

* dirmngr/workqueue.c: New.
* dirmngr/Makefile.am (dirmngr_SOURCES): Add new file.
* dirmngr/server.c (server_local_s): New field session_id.
(cmd_wkd_get): Add a task.
(task_check_wkd_support): New stub function.
(cmd_getinfo): New sub-commands "session_id" and "workqueue".
(start_command_handler): Add arg session_id and store it in
SERVER_LOCAL.
(dirmngr_status_helpf): New.
* dirmngr/dirmngr.h (wqtask_t): New type.
* dirmngr/dirmngr.c (main): Pass 0 as session_id to
start_command_handler.
(start_connection_thread): Introduce a session_id and pass it to
start_command_handler.  Run post session tasks.
(housekeeping_thread): Run global workqueue tasks.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 96a4fbecd1acf946dcde20bef4752c539dae196b)

5 weeks agodirmngr: Limit the number of cached domains for WKD.
Werner Koch [Tue, 14 Nov 2017 07:37:27 +0000 (08:37 +0100)]
dirmngr: Limit the number of cached domains for WKD.

* dirmngr/domaininfo.c (MAX_DOMAINBUCKET_LEN): New.
(insert_or_update): Limit the length of a bucket chain.
(domaininfo_print_stats): Print just one summary line.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 26f08343fbccdbaa177c3507a3c5e24a5cf94a2d)

5 weeks agodirmngr: Keep track of domains used for WKD queries
Werner Koch [Mon, 13 Nov 2017 15:09:32 +0000 (16:09 +0100)]
dirmngr: Keep track of domains used for WKD queries

* dirmngr/domaininfo.c: New file.
* dirmngr/Makefile.am (dirmngr_SOURCES): Add file.
* dirmngr/server.c (cmd_wkd_get): Check whether the domain is already
known and tell domaininfo about the results.
--

This adds a registry for domain information to eventually avoid
useless queries for domains which do not support WKD.  The missing
part is a background task to check whether a queried domain supports
WKD at all and to expire old entries.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 65038e6852185c20413d8f6602218ee636413b77)

5 weeks agodoc: Typo fix
Werner Koch [Mon, 11 Dec 2017 09:17:59 +0000 (10:17 +0100)]
doc: Typo fix

--

5 weeks agoRevert: build: Do not define logging.h constants for ...
Werner Koch [Fri, 8 Dec 2017 12:27:06 +0000 (13:27 +0100)]
Revert: build: Do not define logging.h constants for ...

---

This reverts commit 2fedf8583bcc493f587c90bc9632d25dfd10bd10.

We better solve this on the libgpg-error side.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agodoc: Fix Dijkstra
Werner Koch [Fri, 8 Dec 2017 06:38:18 +0000 (07:38 +0100)]
doc: Fix Dijkstra

--

Edsger Wybe Dijkstra (1930 --2002)
  - Dutch computer scientist

5 weeks agoagent: Fix description of shadow format.
NIIBE Yutaka [Fri, 8 Dec 2017 00:19:50 +0000 (09:19 +0900)]
agent: Fix description of shadow format.

* agent/keyformat.txt, agent/protect.c, agent/t-protect.c: Fix.

--

https://lists.gnupg.org/pipermail/gnupg-devel/2015-April/029680.html

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 weeks agospeedo,w32: Disable FLTK pinentry.
Werner Koch [Thu, 7 Dec 2017 15:29:29 +0000 (16:29 +0100)]
speedo,w32: Disable FLTK pinentry.

--

5 weeks agobuild: Do not define logging.h constants for libgpg-error dev versions.
Werner Koch [Thu, 7 Dec 2017 13:53:49 +0000 (14:53 +0100)]
build: Do not define logging.h constants for libgpg-error dev versions.

* common/logging.h [GPGRT_LOG_WITH_PREFIX]: Do not define the log
constants.
--

logging.h uses constants we plan to use for future versions of
libgpg-error.  My dev version already has the logging functions and
thus I run into a conflict.  This patch protects against this and make
the GnuPG work with later libgpg-error versions.

It was not the best idea to use constants from a planned libgpg-error
in the first place.  The actual problem are the enums, the macros
won't harm.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agoagent: Change intialization of assuan socket system hooks.
NIIBE Yutaka [Thu, 7 Dec 2017 13:33:58 +0000 (14:33 +0100)]
agent: Change intialization of assuan socket system hooks.

* agent/gpg-agent.c (initialize_modules): Add hook again.
(main): Remove setting of the system houk but add scoket system hook
setting after assuan initialization.
--

Thread initialization is better to be deferred after fork (in case of
UNIX).  assuan_sock_init should be earlier.  Thus, we need to change
system hooks for assuan_sock_* interface.  Or else, on Windows, it may
cause hang on server.

Updates-commit: 1524ba9656f0205d8c6ef504f773b832a7a12ab9
GnuPG-bug-id: 3378
Signed-off-by: Werner Koch <wk@gnupg.org>
6 weeks agoagent: Set assuan system hooks before call of assuan_sock_init.
NIIBE Yutaka [Wed, 6 Dec 2017 02:20:51 +0000 (11:20 +0900)]
agent: Set assuan system hooks before call of assuan_sock_init.

* agent/gpg-agent.c (initialize_modules): Move assuan_set_system_hooks.
(main): ... here, just before assuan_sock_init.

--

In Assuan, global variable SOCK_CTX is used internally, which is
initialized by assuan_sock_init.  When initialized, system hooks
are copied into SOCK_CTX structure.  Thus, system hooks should
be set, before the call of assuan_sock_init.

GnuPG-bug-id: 3378
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
6 weeks agog10: Fix regexp sanitization.
NIIBE Yutaka [Thu, 9 Nov 2017 05:03:22 +0000 (14:03 +0900)]
g10: Fix regexp sanitization.

* g10/trustdb.c (sanitize_regexp): Only escape operators.

--

Backport from master commit:
ccf3ba92087e79abdeaa0208795829b431c6f201

To sanitize a regular expression, quoting by backslash should be only
done for defined characters.  POSIX defines 12 characters including
dot and backslash.

Quoting other characters is wrong, in two ways; It may build an
operator like: \b, \s, \w when using GNU library.  Case ignored match
doesn't work, because quoting lower letter means literally and no
much to upper letter.

GnuPG-bug-id: 2923
Co-authored-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
6 weeks agodoc: clarify that --encrypt refers to public key encryption
Daniel Kahn Gillmor [Fri, 17 Nov 2017 02:17:08 +0000 (10:17 +0800)]
doc: clarify that --encrypt refers to public key encryption

--

A simple read of gpg(1) is ambiguous about whether --encrypt could be
for either symmetric or pubkey encryption.  Closer inference suggests
that --encrypt is about pubkey encryption only.  Make that clearer on
a first read.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
7 weeks agogpg: Do not read from uninitialized memory with --list-packets.
Werner Koch [Sun, 26 Nov 2017 17:33:49 +0000 (18:33 +0100)]
gpg: Do not read from uninitialized memory with --list-packets.

* g10/parse-packet.c (parse_plaintext): Fill up the allocated NAME.
--

This actually does not harm because we merely display a buffer
allocated by ourselves.  However, we better tell Valgrind about it so
that we don't need to track this thing down ever again.

Test using a corrupted literal data packet:

  echo cb 0a 75 ff 59 ae 90 d5  74 65 73 74 | \
    undump |\
    valgrind gpg --list-packets >/dev/null

Reported-by: Sebastian Schinzel
Signed-off-by: Werner Koch <wk@gnupg.org>
7 weeks agoagent: New option --auto-expand-secmem.
Werner Koch [Fri, 24 Nov 2017 09:30:25 +0000 (10:30 +0100)]
agent: New option --auto-expand-secmem.

* agent/gpg-agent.c (oAutoExpandSecmem): New enum value.
(opts): New option --auto-expand-secmem.
(main): Implement that option.
--

Note that this option has an effect only if Libgcrypt >= 1.8.2 is
used.

GnuPG-bug-id: 3530

8 weeks agobuild: Update distsigkey.gpg
Werner Koch [Wed, 22 Nov 2017 19:54:39 +0000 (20:54 +0100)]
build: Update distsigkey.gpg

--

8 weeks agogpg: Fix memory leaking for long inputs via --command-fd.
Werner Koch [Wed, 22 Nov 2017 19:54:07 +0000 (20:54 +0100)]
gpg: Fix memory leaking for long inputs via --command-fd.

* g10/cpr.c (do_get_from_fd): Free the old buffer.
--

If the received input is longer than 200 characters we used to leak
the previous allocated buffer.

GnuPG-bug-id: 3528
Signed-off-by: Werner Koch <wk@gnupg.org>
8 weeks agoscd: Enable card removal check after select_application.
NIIBE Yutaka [Tue, 21 Nov 2017 02:52:54 +0000 (11:52 +0900)]
scd: Enable card removal check after select_application.

* scd/apdu.c (open_ccid_reader): Fix error handling of ccid_get_atr.
* scd/app.c (select_application): Always kick the loop if new APP.
* scd/ccid-driver.c (ccid_open_usb_reader): Don't setup at open.
(ccid_slot_status): Setup interrupt transfer when !ON_WIRE.

--

We can use the interrupt transfer to be notified about card status
change.  In this case, we don't need to issue PC_to_RDR_GetSlotStatus
command.  This change improve the setup the notification; it should be
done after registration of APP.

When the setup is done just after opening the USB connection (before
issuing PC_to_RDR_IccPowerOn), a reader might notifies about no card
availability (because of not yet powered on), even though the card is
ready to be powered on.

GnuPG-bug-id: 3508
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
8 weeks agoPost release updates
Werner Koch [Mon, 20 Nov 2017 12:35:36 +0000 (13:35 +0100)]
Post release updates

--

8 weeks agoRelease 2.2.3 gnupg-2.2.3
Werner Koch [Mon, 20 Nov 2017 11:39:16 +0000 (12:39 +0100)]
Release 2.2.3

8 weeks agobuild: Use -Werror only for the check.
Werner Koch [Mon, 20 Nov 2017 11:32:31 +0000 (12:32 +0100)]
build: Use -Werror only for the check.

* configure.ac: Do not add -Werror to mycflags.
--

On Windows and possible also on other platforms we expect to a get a
few errors or warnins.  Thus we can't use -Werror by default.  This is
why we have a separate configure options --enable-werror ;-).

Fixes-commit: 3ecd1a41be7c880976987d13e88342c98f37e064
Signed-off-by: Werner Koch <wk@gnupg.org>
8 weeks agogpg-agent: Avoid getting stuck in shutdown pending state.
Werner Koch [Mon, 13 Nov 2017 09:52:36 +0000 (10:52 +0100)]
gpg-agent: Avoid getting stuck in shutdown pending state.

* agent/gpg-agent.c (handle_connections): Always check inotify fds.
--

I noticed a gpg-agent processed, probably in shutdown_pending state,
which was selecting on only these two inotify fds.  The select
returned immediately but because we did not handle the fds in
shutdown_pending state they were not read and the next select call
returned one of them immediately again.  Actually that should not
hanppen because the

          if (active_connections == 0)
            break; /* ready */

should have terminated the loop.  For unknown reasons (maybe be just a
connection thread terminated in a gdb session) that did not happen.
By moving the check outside of the shutdown_pending condition and
closing the fd after they have been triggered the code should be more
robust.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 5d83eb9226c0ce608ec284d8c9bc22ce84a00c25)

8 weeks agoagent: Use clock or clock_gettime for calibration.
NIIBE Yutaka [Tue, 7 Nov 2017 01:49:36 +0000 (10:49 +0900)]
agent: Use clock or clock_gettime for calibration.

* agent/protect.c (calibrate_get_time): Use clock or clock_gettime.

--

For calibration, clock(3) is better than times(3) among UNIXen.
Tested on NetBSD 7.1 and FreeBSD 11.1, using QEMU.

Thanks to Damien Goutte-Gattat for the information of use of
CLOCKS_PER_SEC;  The old code with times(3) is not 100% correct,
in terms of POSIX.  It should have used sysconf (_SC_CLK_TCK) instead
of CLOCKS_PER_SEC.  CLOCKS_PER_SEC is specifically for clock(3).

GnuPG-bug-id: 3056, 3276, 3472
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit 380bce13d94ff03c96e39ac1d834f382c5c730a1)

8 weeks agobuild: Check -Wlogical-op flag availability with -Werror.
NIIBE Yutaka [Mon, 20 Nov 2017 03:01:31 +0000 (12:01 +0900)]
build: Check -Wlogical-op flag availability with -Werror.

* configure.ac: Use -Werror.

--

Using clang, -Wlogical-op doesn't fail but generates warning.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
8 weeks agobuild: BSD make support for yat2m.
NIIBE Yutaka [Mon, 20 Nov 2017 02:33:26 +0000 (11:33 +0900)]
build: BSD make support for yat2m.

* configure.ac (YAT2M): Only define when found.
* doc/Makefile.am: Portability fix.

--

This is not intended to apply to master, but 2.2 branch only.  When
new libgpg-error is required, installation of yat2m can be assumed.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 months agodirmngr: Fix double free of a hash context in the error case.
Werner Koch [Fri, 17 Nov 2017 09:34:40 +0000 (10:34 +0100)]
dirmngr: Fix double free of a hash context in the error case.

* dirmngr/crlcache.c: Clearly document that this fucntions takes
ownership of MD.
(abort_sig_check): Allow NULL for MD.
(crl_parse_insert): Immediately set MD to NULL.  Remove check for md
before a calling abort_sig_check.
--

GnuPG-bug-id: 3510
Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agow32: Fix default registry path
Andre Heinecke [Wed, 15 Nov 2017 10:41:54 +0000 (11:41 +0100)]
w32: Fix default registry path

* configure.ac (GNUPG_REGISTRY_DIR): Remove leading backslash.

--
Windows does not like the leading backslash and won't read
the key.
Problem reported in the Gpg4win Message boards.

This bug was introduced by rev. 75ba215e

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 months agodoc: Add man page for gpgtar
Werner Koch [Wed, 15 Nov 2017 09:17:17 +0000 (10:17 +0100)]
doc: Add man page for gpgtar

--

This also removes the documentation for gpg-zip which is not
distributed anymore.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agogpgtar: Prefer --set-filename over implicit name
Andre Heinecke [Wed, 15 Nov 2017 08:54:05 +0000 (09:54 +0100)]
gpgtar: Prefer --set-filename over implicit name

* tools/gpgtar-extract.c: Prefer opt.filename over filename
for the directory prefix.

--
If you would extract from stdin (filename -) and use set-filename
to provide a real filename the "-" would be used for the directory
name. With this change an explicit filename is prefered.

GnuPG-Bug-Id: T3500
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 months agodoc: fix NEWSIG documentation
Will Thompson [Tue, 14 Nov 2017 15:34:34 +0000 (15:34 +0000)]
doc: fix NEWSIG documentation

--
08c82b1 introduced one optional argument for this status message. Due to
an apparent editing error, the sentence fragment "arguments are
currently defined." was left in the documentation.

Signed-off-by: Will Thompson <wjt@endlessm.com>
2 months agodoc: expand documentation of PROGRESS message
Will Thompson [Tue, 14 Nov 2017 15:30:34 +0000 (15:30 +0000)]
doc: expand documentation of PROGRESS message

--
This answers two questions that I was only able to answer by examining
each site where PROGRESS messages are emitted, and fixes a typo.

Signed-off-by: Will Thompson <wjt@endlessm.com>
2 months agogpg: Print AKL info only in verbose mode.
Werner Koch [Wed, 15 Nov 2017 07:47:32 +0000 (08:47 +0100)]
gpg: Print AKL info only in verbose mode.

* g10/getkey.c (get_pubkey_byname): Print info only in verbose mode.
--

GnuPG-bug-id: 3504
Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agosm, w32: Fix initial keybox creation
Andre Heinecke [Tue, 14 Nov 2017 11:24:52 +0000 (12:24 +0100)]
sm, w32: Fix initial keybox creation

* sm/keydb.c (maybe_create_keybox): Open new keybox in bin mode.

--
As the header contains a timestamp we will have the conversion
problems if the keybox is not opened in binary mode.

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 months agopo/da: Fix Danish confusion between "compressed" and "compromised"
Daniel Kahn Gillmor [Sat, 11 Nov 2017 10:42:06 +0000 (18:42 +0800)]
po/da: Fix Danish confusion between "compressed" and "compromised"

--
In https://bugs.debian.org/881393 , Jonas Smedegaard reports:

> In option number 1, the word "komprimeret" means "compressed".
>
> I am pretty sure it should say "kompromitteret" instead, which means
> "compromised".

Debian-Bug-Id: 881393
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 months agoPost release updates.
Werner Koch [Tue, 7 Nov 2017 10:04:44 +0000 (11:04 +0100)]
Post release updates.

--

2 months agoRelease 2.2.2 gnupg-2.2.2
Werner Koch [Tue, 7 Nov 2017 09:23:01 +0000 (10:23 +0100)]
Release 2.2.2

Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agodirmngr: Reduce default LDAP timeout to 15 seconds.
Werner Koch [Tue, 7 Nov 2017 09:02:53 +0000 (10:02 +0100)]
dirmngr: Reduce default LDAP timeout to 15 seconds.

* dirmngr/dirmngr.c (DEFAULT_LDAP_TIMEOUT): Change to 15.
* dirmngr/dirmngr_ldap.c (DEFAULT_LDAP_TIMEOUT): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit ab7ac827041b5cd97bbca7a75b0930072dd6611f)
GnuPG-bug-id: 3487

2 months agospeedo: Include software versions in the W32 README
Werner Koch [Tue, 7 Nov 2017 08:21:10 +0000 (09:21 +0100)]
speedo: Include software versions in the W32 README

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit f9f72ffbfa9fd7d1a7a1823697d116d76155b407)

2 months agopo: Update Russian translation
Ineiev [Tue, 7 Nov 2017 08:28:04 +0000 (09:28 +0100)]
po: Update Russian translation

2 months agopo: Update Japanese translation
NIIBE Yutaka [Tue, 7 Nov 2017 02:16:02 +0000 (11:16 +0900)]
po: Update Japanese translation

2 months agoagent: New GETINFO sub-commands "s2k_count_cal" and "s2k_time".
Werner Koch [Mon, 6 Nov 2017 13:20:03 +0000 (14:20 +0100)]
agent: New GETINFO sub-commands "s2k_count_cal" and "s2k_time".

* agent/command.c (cmd_getinfo): New sub-commands.
* agent/protect.c (get_standard_s2k_count): Factor some code out to ...
(get_calibrated_s2k_count): new.
(get_standard_s2k_time): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 52d41c8b0f4af6278d18d8935399ddad16a26856)

2 months agoagent: New option --s2k-count.
Werner Koch [Mon, 6 Nov 2017 12:57:30 +0000 (13:57 +0100)]
agent: New option --s2k-count.

* agent/agent.h (opt): New field 's2k_count'.
* agent/gpg-agent.c (oS2KCount): New enum value.
(opts): New option --s2k-count.
(parse_rereadable_options): Set opt.s2k_count.
--

This option is useful to speed up the starting of gpg-agent and in
cases where the auto-calibration runs into problems due to a broken
time measurement facility.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit f7212f1d11aad5d910d2c77b2e5c6ab31a0e786e)

2 months agog10: Unattended key generation "Key-Grip" and "Subkey-Grip".
NIIBE Yutaka [Wed, 1 Nov 2017 01:19:35 +0000 (10:19 +0900)]
g10: Unattended key generation "Key-Grip" and "Subkey-Grip".

* g10/keygen.c (pSUBKEYGRIP): New.
(read_parameter_file): Add "Key-Grip" and "Subkey-Grip".
(do_generate_keypair): Support pSUBKEYGRIP.

--

In the manual, it says "Key-Grip".  gpgsm also supports "Key-Grip".
Adding "Subkey-Grip" now, adding "Key-Grip" makes sense.

GnuPG-bug-id: 3478
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit 6c63a04569c07c9c2817c7c530a92ccfa58155cc)

2 months agog10: Simplify "factory-reset" procedure.
NIIBE Yutaka [Mon, 30 Oct 2017 02:59:11 +0000 (11:59 +0900)]
g10: Simplify "factory-reset" procedure.

* g10/card-util.c (factory_reset): Simplify.

--

In this summer, I got report about old code before this change didn't
work with newer Yubikey.  I got another report test version of OpenPGP
card V3.3 implementation didn't work, either.  Then, I confirmed that
according to the OpenPGP card specification, the procedure of old code
is not expected by its author.

This change simplify "factory-reset" as simple.

Only versions of Gnuk 1.2.2, 1.2.3, 1.2.4, won't work with this
change.  That's because the factory-reset feature of Gnuk was
introduced by reading the implementation of GnuPG, instead of reading
the specification.  Gnuk 1.2.5 and later works well.  All OpenPGPcard
implementations I have work well (2.0, 2.1, 2.2, test version of 3).

GnuPG-bug-id: 3286
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit d63b7966cdd72548c60466c620de5cd6104a779e)

2 months agopo: Update Russian translation
Ineiev [Tue, 31 Oct 2017 11:22:51 +0000 (14:22 +0300)]
po: Update Russian translation

2 months agopo: Fixed one string wrongly marked as fuzzy.
Werner Koch [Thu, 2 Nov 2017 16:43:21 +0000 (17:43 +0100)]
po: Fixed one string wrongly marked as fuzzy.

--

These seems to a a small gettext bug which claimed that
 "NOTE: There is no guarantee that the card supports[...]"
was changed.  Also committed changes due to msgmerge.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agopo: Update German translation
Werner Koch [Thu, 2 Nov 2017 16:38:02 +0000 (17:38 +0100)]
po: Update German translation

--

2 months agogpg: Introduce magic value 25519 to switch a card to ECC.
Werner Koch [Thu, 2 Nov 2017 16:11:03 +0000 (17:11 +0100)]
gpg: Introduce magic value 25519 to switch a card to ECC.

* g10/card-util.c (ask_card_keyattr): Handle special value 25519.
(do_change_keyattr): Allow changing to cv25519/ed25519.
(generate_card_keys): Ditto.
(card_generate_subkey): Ditto.
--

This is kludge to make it easier for gnuk to be switched into ECC
mode.  This is basically the same change as
commit ea09b6cded9d31a8ebd91878553c3eaa2b76e817
but without the string change in show_keysize_warning.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agogpg: Rename two card related functions in card-util.
Werner Koch [Fri, 27 Oct 2017 12:44:53 +0000 (14:44 +0200)]
gpg: Rename two card related functions in card-util.

* g10/card-util.c (ask_card_rsa_keysize): Rename to ask_card_keyattr.
(do_change_rsa_keysize): Rename to do_change_keyattr.
--

We want to support other algos than RSA and thus we need a better name
for the functions.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit f795f4529d8ab5a05db1cc1960abd34390bfae1b)

2 months agoagent: Fix returning GPG_ERR_NOT_FOUND wrongly.
NIIBE Yutaka [Thu, 2 Nov 2017 07:23:10 +0000 (16:23 +0900)]
agent: Fix returning GPG_ERR_NOT_FOUND wrongly.

* agent/learncard.c (agent_handle_learn): Find SERIALNO.

--

Bug is: "gpg-connect-agent learn /bye" just fails wrongly.

Fixes-commit: 8c8ce8711d9c938fcb982b0341e6b052742cb887
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit 5e96fe72e477d09e35ccee48af0fd9ab2b3ae409)

2 months agocommon: Accept the Z-suffix for yymmddThhmmssZ format.
NIIBE Yutaka [Tue, 19 Sep 2017 07:09:05 +0000 (16:09 +0900)]
common: Accept the Z-suffix for yymmddThhmmssZ format.

* common/gettime.c (isotime_p): Accept the Z suffix.

--

The intention is use for human interface.

GnuPG-bug-id: 3278
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit ba8afc4966cca1f6aaf9b2a9bfc3220782306c2b)

2 months agoagent: Clean up pinentry access locking.
NIIBE Yutaka [Fri, 27 Oct 2017 00:54:48 +0000 (09:54 +0900)]
agent: Clean up pinentry access locking.

* agent/agent.h (struct server_control_s): Rename PINENTRY_ACTIVE.
* agent/call-pinentry.c (entry_owner): Remove.
(agent_reset_query): Use thread private object of PINENTRY_ACTIVE.
(unlock_pinentry): Add CTRL to arguments to access thread private.
Check and decrement PINENTRY_ACTIVE for recursive use.
(start_pinentry): Check and increment PINENTRY_ACTIVE for recursion.
(agent_askpin): Follow the change of unlock_pinentry API.
(agent_get_passphrase, agent_get_confirmation): Likewise.
(agent_show_message, agent_popup_message_start): Likewise.
(agent_popup_message_stop, agent_clear_passphrase): Likewise.

--

We use the member PINENTRY_ACTIVE as a thread private object.
It's only valid for a single thread at a time.

It would be possible to have a thread shared object of
PINENTRY_ACTIVE, keeping ENTRY_OWNER for distinguishing its
owner (which is also a thread shared object).  But, in this case,
access to ENTRY_OWNER is tricky (only comparison to accessing thread
would be OK with no lock), or we need to introduce another lock for
accessing ENTRY_OWNER, which complicates the code too much.

So, simply have a thread private object for recursive pinentry access.

GnuPG-bug-id: 3190
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit fb7828676cc2c01047498898378711e049f73fee)

2 months agoagent: Allow recursive use of pinentry.
NIIBE Yutaka [Thu, 26 Oct 2017 05:40:38 +0000 (14:40 +0900)]
agent: Allow recursive use of pinentry.

* agent/agent.h (struct server_control_s): Add pinentry_level.
* agent/call-pinentry.c (agent_popup_message_stop): Not clear
ENTRY_CTX here.
(unlock_pinentry): Handle recursion.  Clear ENTRY_CTX here.
(start_pinentry): Allow recursive use.

--

GnuPG-bug-id: 3190
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit 3b66a256e3760e88066ca11b7b49d924e42aa46b)

2 months agoagent, tests: Support --disable-scdaemon build case.
NIIBE Yutaka [Thu, 26 Oct 2017 02:24:39 +0000 (11:24 +0900)]
agent, tests: Support --disable-scdaemon build case.

* agent/command.c (cmd_scd): Support !BUILD_WITH_SCDAEMON.
* tests/openpgp/defs.scm (create-gpghome): Likewise.
* tests/gpgsm/gpgsm-defs.scm (create-gpgsmhome): Likewise.

--

We could modify gpg-agent to remove all support of scdaemon, with no
inclusion of call-scd.c, divert-scd.c, and learncard.c, but it would
not be worth to do that.

GnuPG-bug-id: 3316
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 months agoFix comment of configure.
NIIBE Yutaka [Thu, 26 Oct 2017 02:19:45 +0000 (11:19 +0900)]
Fix comment of configure.

* configure.ac (BUILD_WITH_DIRMNGR): Comment fix.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 months agogpg: Avoid superfluous sig check info during import.
Werner Koch [Tue, 24 Oct 2017 19:11:38 +0000 (21:11 +0200)]
gpg: Avoid superfluous sig check info during import.

* g10/key-check.c (print_info): New.
(key_check_all_keysigs): Print sig checking results only in debug
mode.  Prettify the stats info and suppress them in quiet mode.

--

This also makes usable stats by prefixing them with the key and the
program name.

GnuPG-bug-id: 3397
Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agobuild: New configure option --enable-werror
Werner Koch [Tue, 24 Oct 2017 16:42:37 +0000 (18:42 +0200)]
build: New configure option --enable-werror

* configure.ac: Implement that option.
--

This can be used as a workaround in case of bogus autoconf tests.

GnuPG-bug-id: 2423
Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agobuild: Do not mess with CFLAGS in configure.
Werner Koch [Tue, 24 Oct 2017 16:34:28 +0000 (18:34 +0200)]
build: Do not mess with CFLAGS in configure.

* configure.ac: Do not mess with the user provided CFLAGS.
--

A problem was claimed with some configure tests if the user provided
CFLAGS=-Werror.  The commit introducing this

Fixes-commit: 02eb9fc9d5863abcfed6af704e618f8cac7cc2e8

does not mention a concrete case.  Anyway, messing with CFLAGS is a
bad idea because configure tests will then test something different
than what is used later (cf. autoconf manual).  Tests which depend on
the whether -Werror is used needsto be fixed.

Note that in certain cases we modify CFLAGS.  This is only done for
some configure options or if the platform requires the use of special
compiler flags (e.g. on HP/UX).

GnuPG-bug-id: 2423

2 months agosm: Do not expect X.509 keyids to be unique
Rainer Perske [Tue, 24 Oct 2017 15:29:04 +0000 (17:29 +0200)]
sm: Do not expect X.509 keyids to be unique

* sm/certlist.c (gpgsm_find_cert): Add arg allow_ambiguous and use it.
* sm/call-dirmngr.c (inq_certificate): Pass true to ALLOW_AMBIGUOUS
(run_command_inq_cb): Ditto.
* sm/gpgsm.c (main): Pass false.
* sm/server.c (cmd_passwd): Pass false.

--

As described in my report T1644, it is possible that multiple
certificates exist with the same Distinguished Name and the same key.
In this case, verifying S/MIME signatures and other actions fail with
"certificate not found: Ambiguous name". For details see the bug
report.

To circumvent the problem, I am patching GnuPG since 2014 so that in
this case the newest of the ambiguous certificates is used.

This is not an ultimate solution of the problem: You should try every
certificate with the same DN until verification succeeds or until all
certificates fail, and if multiple certificates of a chain are
ambiguous you even have to check every combination. You may even
consider checking the keyUsage attributes of the ambiguous certificates
to reduce the number of combinations.

But in the existing case of the certificates in the German Research
Network (DFN) PKI where the newest one is the valid one and all
ambiguous certificates have the same keyUsage attributes, this patch
has proven to be sufficient over the last three years.

With every GnuPG update, I have adapted the patch, luckily I never
needed to change anything except line numbers.

GnuPG-bug-id: 1644

ChangeLog log written by wk, comment taken from mail.  Signed-off line
was missing in the plain diff.  However the mail with the patch and
the DCO posted as reply to that mail were both signed.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agogpgconf: Ignore non-installed components with --apply-profile.
Werner Koch [Tue, 24 Oct 2017 10:01:07 +0000 (12:01 +0200)]
gpgconf: Ignore non-installed components with --apply-profile.

* tools/gpgconf-comp.c (retrieve_options_from_program): Add arg
only_installed.
(gc_component_retrieve_options): Use this if we want to process all
components.
--

Note that this also also ignores them in --with-defaults.  This is
useful for systems which come without scdaemon.

GnuPG-bug-id: 3313
Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agogpg: Improve the "secret key available" notice in keyedit.c
Werner Koch [Tue, 24 Oct 2017 08:56:13 +0000 (10:56 +0200)]
gpg: Improve the "secret key available" notice in keyedit.c

* g10/keyedit.c (KEYEDIT_NEED_SUBSK): New.
(cmds): Add this flag to keytocard, bkuptocard, expire, and passwd.
(keyedit_menu): Check whether only subkeys are available and take care
of that in the command check and in the HELP listing.  Also print a
different notice if only subkeys are available.
--

Print "Secret key is available" and the bailing out in all commands
which require the _primary_ secret key was surprising.  Now we print
another notice and adjust the checks.

GnuPG-bug-id: 3463
Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agogpg: Remove unused flags from keyedit.c.
Werner Koch [Tue, 24 Oct 2017 07:31:49 +0000 (09:31 +0200)]
gpg: Remove unused flags from keyedit.c.

* g10/keyedit.c (KEYEDIT_NOT_SK, KEYEDIT_ONLY_SK): Remove.
(cmds): Remove them.
--

These flags were cruft from the time we had to switch between secret
and public key view.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agodoc: Fix "SEE ALSO" section of gpgv.
Werner Koch [Fri, 20 Oct 2017 06:56:39 +0000 (08:56 +0200)]
doc: Fix "SEE ALSO" section of gpgv.

--

2 months agogpg: Fix creating on-disk subkey with on-card primary key.
Werner Koch [Thu, 19 Oct 2017 16:10:37 +0000 (18:10 +0200)]
gpg: Fix creating on-disk subkey with on-card primary key.

* g10/keygen.c (generate_subkeypair): Ignore error code issued for
trying to verify a card based key.
--

We try to verify the primary key and thus seed the passphrase cache
before generating the subkey.  However, the verification does not yet
work for on-card keys and thus the PASSWD --verify send to the agent
returns an error.  This patch detects this error and continues without
a seeded passphrase cache.  After all that pre-seeding is just a
convenience.

GnuPG-bug-id: 3280
Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agogpg: Print sec/sbb with --import-option import-show or show-only.
Werner Koch [Thu, 19 Oct 2017 15:12:36 +0000 (17:12 +0200)]
gpg: Print sec/sbb with --import-option import-show or show-only.

* g10/import.c (import_one): Pass FROM_SK to list_keyblock_direct.
--

Note that this will likely add the suffix '#' top "sec" because the
secret key has not yet (or will not be) imported.  If the secret key
already exists locally another suffix might be printed.  The upshot is
that the suffix has no usefulness.

GnuPG-bug-id: 3431
Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agogpg: Make --dry-run and show-only work for secret keys.
Werner Koch [Thu, 19 Oct 2017 15:05:39 +0000 (17:05 +0200)]
gpg: Make --dry-run and show-only work for secret keys.

* g10/import.c (import_secret_one): Check for dry-run before
transferring keys.
--

The use of --dry-run or --import-option show-only had no effect when
importing a secret key and the public key already existed.  If the
public key did not exist an error message inhibited the import of the
secret key.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 months agodirmngr: Do not follow https-to-http redirects.
Damien Goutte-Gattat [Sun, 8 Oct 2017 16:30:52 +0000 (17:30 +0100)]
dirmngr: Do not follow https-to-http redirects.

* dirmngr/ks-engine-http.c (ks_http_fetch): Forbid redirects from
a https URI to a http URI.
--

GnuPG-bug-id: 3436
Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
2 months agog10: Fix find_and_check_key for multiple keyrings.
NIIBE Yutaka [Thu, 19 Oct 2017 02:08:24 +0000 (11:08 +0900)]
g10: Fix find_and_check_key for multiple keyrings.

* g10/pkclist.c (find_and_check_key): Call get_validity on a specific
keyblock.

--

When we have multiple keyrings, get_validity after
get_best_pubkey_byname should access same keyring.  Or else, the
situation of an expired key in keyring A but valid key in keyring B
causes SEGV.

Thanks to Guido G√ľnther for the use case and the log.

Debian-bug-id: 878812
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 months agogpg: Keep a lock during the read-update/insert cycle in import.
Werner Koch [Wed, 18 Oct 2017 16:28:52 +0000 (18:28 +0200)]
gpg: Keep a lock during the read-update/insert cycle in import.

* g10/keydb.c (keydb_handle): New field 'keep_lock'.
(keydb_release): Clear that flag.
(keydb_lock): New function.
(unlock_all): Skip if KEEP_LOCK is set.
* g10/getkey.c (get_keyblock_byfprint_fast): Call keep_lock if
requested.
--

That change is straightforward.  It helps to avoid the race condition
that another gpg process inserts a key while the first process is
between the search and the insert.

A similar change is due for gpgsm.

Note that the key edit operations may still suffer from a race.

GnuPG-bug-id: 3446