Commit Graph

8016 Commits

Author SHA1 Message Date
Werner Koch 3f2b7a53dd
Release GnuPG 2.2.16
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-28 17:01:00 +02:00
Werner Koch 626e05f07a
po: Auto-update
--
2019-05-28 16:58:38 +02:00
Werner Koch 5281ecbe3a
dirmngr: Allow for other hash algorithms than SHA-1 in OCSP.
* dirmngr/ocsp.c (do_ocsp_request): Remove arg md.  Add args r_sigval,
r_produced_at, and r_md.  Get the hash algo from the signature and
create the context here.
(check_signature): Allow any hash algo.  Print a diagnostic if the
signature does not verify.
--

GnuPG-bug-id: 3966
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-28 12:31:41 +02:00
Werner Koch 582dee2418
Prepare NEWS for the release
--
2019-05-27 19:59:56 +02:00
Werner Koch a7a327d026
po: Update Polish translation
--
2019-05-27 17:31:34 +02:00
Petr Pisar 3bf796aa0a
po: Update Czech translation
--
2019-05-27 17:27:15 +02:00
Werner Koch 32210e855c
sm: Avoid confusing diagnostic for the default key.
* sm/certlist.c (cert_usage_p): Add arg 'silent' and change all
callers.
(gpgsm_cert_use_sign_p): Add arg 'silent' and pass to cert_usage_p.
Change all callers.
* sm/sign.c (gpgsm_get_default_cert): Set SILENT when calling
gpgsm_cert_use_sign_p
--

GnuPG-bug-id: 4535
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-27 15:48:41 +02:00
Werner Koch 190eeb7cce
po: Update the German translation
--
2019-05-27 12:53:34 +02:00
Werner Koch ab5d7142a7
gpg: Fixed i18n markup of some strings.
* g10/tofu.c: Removed some translation markups which either make no
sense or are not possble.
--

Error message which are not helpful for the user but indicate a
problem of the installation or the code do not need a translation.
The translator may not understand them correctly and the use support
can't immediately locate the problem because it needs to be reverse
translated.

There is also one case where certain grammar constructs are
assumed (concatenating parts of a sentence at runtime).  Better do not
translate that than getting weird sentences.
2019-05-27 12:52:58 +02:00
Werner Koch d9b31d3a20
gpg: Allow deletion of subkeys with --delete-[secret-]key.
* common/userids.c (classify_user_id): Do not set the EXACT flag in
the default case.
* g10/export.c (exact_subkey_match_p): Make static,
* g10/delkey.c (do_delete_key): Implement subkey only deleting.
--

GnuPG-bug-id: 4457
2019-05-27 11:41:35 +02:00
NIIBE Yutaka 9ccdd59e4e
agent: Stop scdaemon after reload when disable_scdaemon.
* agent/call-scd.c (agent_card_killscd): New.
* agent/gpg-agent.c (agent_sighup_action): Call agent_card_killscd.

--

GnuPG-bug-id: 4326
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-05-27 09:01:55 +02:00
Werner Koch 30f44957cc
gpg: Do not bail on an invalid packet in the local keyring.
* g10/keydb.c (parse_keyblock_image): Treat invalid packet special.
--

This is in particular useful to run --list-keys on a keyring with
corrupted packets.  The extra flush is to keep the diagnostic close to
the regular --list-key output.

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

This is a backport from master with support for the unsupported v5 key
handling.
2019-05-21 17:40:41 +02:00
Werner Koch d32963eeb3
gpg: Do not allow creation of user ids larger than our parser allows.
* g10/parse-packet.c: Move max packet lengths constants to ...
* g10/packet.h: ... here.
* g10/build-packet.c (do_user_id): Return an error if too data is too
large.
* g10/keygen.c (write_uid): Return an error for too large data.
--

This can lead to keyring corruption becuase we expect that our parser
is abale to parse packts created by us.  Test case is

  gpg --batch --passphrase 'abc' -v  \
      --quick-gen-key $(yes 'a'| head -4000|tr -d '\n')

GnuPG-bug-id: 4532
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-21 16:28:11 +02:00
NIIBE Yutaka 6e39541f4f
agent: For SSH key, don't put NUL-byte at the end.
* agent/command-ssh.c (ssh_key_to_protected_buffer): Update
the length by the second call of gcry_sexp_sprint.

--

GnuPG-bug-id: 4502
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-05-21 09:15:41 +02:00
Werner Koch 5c46c5f745
gpg: Do not delete any keys if --dry-run is passed.
* g10/delkey.c (do_delete_key): Don't delete the keyblock on dry runs.
Do not clear the ownertrust.  Do not let the agent delete the key.
--

Co-authored-by: Matheus Afonso Martins Moreira
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-20 12:52:22 +02:00
Werner Koch 1702179d91
gpg: Fix using --decrypt along with --use-embedded-filename.
* g10/options.h (opt): Add flags.dummy_outfile.
* g10/decrypt.c (decrypt_message): Set this global flag instead of the
fucntion local flag.
* g10/plaintext.c (get_output_file): Ignore opt.output if that was
used as a dummy option aslong with --use-embedded-filename.
--

The problem here was that an explicit specified --decrypt, as
meanwhile suggested, did not work with that dangerous
--use-embedded-filename.  In contrast it worked when gpg decrypted as
a side-effect of parsing the data.

GnuPG-bug-id: 4500
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-17 13:42:42 +02:00
Werner Koch cd5f040a53
gpg: Improve the photo image viewer selection.
* g10/exec.c (w32_system): Add "!ShellExecute" special.
* g10/photoid.c (get_default_photo_command): Use the new ShellExecute
under Windows and fallbac to 'display' and 'xdg-open' in the Unix
case.
(show_photos): Flush stdout so that the output is shown before the
image pops up.
--

For Unix this basically syncs the code with what we have in gpg 1.4.
Note that xdg-open may not be used when running as root which we
support here.

For Windows we now use ShellExecute as this seems to be preferred over
"cmd /c start"; however this does not solve the actual problem we had
in the bug report.  To solve that problem we resort to a wait
parameter which defaults to 400ms.  This works on my Windows-10
virtualized test box.  If we can figure out which simple viewers are
commonly installed on Windows we should enhance this patch to test for
them.

GnuPG-bug-id: 4334
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-17 12:46:16 +02:00
Werner Koch 0fff927889
kbx: Fix an endless loop under Windows due to an incomplete fix.
* kbx/keybox-search.c (keybox_search):  We need to seek to the last
position in all cases not just when doing a NEXT.
--

This is because search from the beginning needs a keybox_search_reset.
We can only make an exception for KEYDB_SEARCH_MODE_FIRST..

Fixes-commit: 6f72aa8214
GnuPG-bug-id: 4505
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-16 14:03:00 +02:00
Werner Koch 6f72aa8214
kbx: Fix deadlock in gpgsm on Windows due to a sharing violation.
* kbx/keybox-init.c (keybox_lock) [W32]: Use _keybox_close_file
instead of fclose so that a close is done if the file is opened by
another handle.
* kbx/keybox-search.c (keybox_search): Remember the last offset and
use that in NEXT search mode if we had to re-open the file.
--

GnuPG-bug-id: 4505
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-16 14:01:57 +02:00
Werner Koch 3a28706cfd
gpgconf: Before --launch check that the config file is fine.
* tools/gpgconf-comp.c (gc_component_launch): Check the conf file.
* tools/gpgconf.c (gpgconf_failure): Call log_flush.
--
GnuPG-bug-id: 4497
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-16 12:27:03 +02:00
Werner Koch 0d669a360c
doc: Do not mention gpg's deprecated --keyserver option.
--
GnuPG-bug-id: 4466
2019-05-15 09:19:43 +02:00
Daniel Kahn Gillmor 9c704d9d46
gpg: enable OpenPGP export of cleartext keys with comments
* g10/export.c (cleartext_secret_key_to_openpgp): ignore trailing
sublists in private-key S-expression.

--

When gpg-agent learns about a private key from its ssh-agent
interface, it stores its S-expression with the comment attached.  The
export mechanism for OpenPGP keys already in cleartext was too brittle
because it would choke on these comments.  This change lets it ignore
any additional trailing sublists.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Gnupg-Bug-Id: 4490
2019-05-15 09:03:13 +02:00
Werner Koch 31e26037bd
gpgconf: Support --homedir for --launch.
* tools/gpgconf-comp.c (gpg_agent_runtime_change): Simplify because
gnupg_homedir already returns abd absolute name.
(scdaemon_runtime_change): Ditto.
(dirmngr_runtime_change): Ditto.
(gc_component_launch): Support --homedir.
--

GnuPG-bug-id: 4496
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-15 08:53:20 +02:00
Daniel Kahn Gillmor 110932925b
agent: correct length for uri and comment on 64-bit big-endian platforms
* agent/findkey.c (agent_public_key_from_file): pass size_t as int to
gcry_sexp_build_array's %b.

--

This is only a problem on big-endian systems where size_t is not the
same size as an int.  It was causing failures on debian's s390x,
powerpc64, and sparc64 platforms.

There may well be other failures with %b on those platforms in the
codebase, and it probably needs an audit.

Once you have a key in private-keys-v1.d/$KEYGRIP.key with a comment
or a uri of reasonable length associated with it, this fix can be
tested with:

   gpg-agent --server <<<"READKEY $KEYGRIP"

On the failing platforms, the printed comment will be of length 0.

Gnupg-bug-id: 4501
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-14 10:34:13 +02:00
Werner Koch 49a679eb35
doc: Minor edit for a gpg option.
--
GnuPG-bug-id: 4507
2019-05-14 10:07:28 +02:00
Werner Koch 8d645f1d1f
gpg: Do not print a hint to use the deprecated --keyserver option.
* g10/keyserver.c (keyserver_search): Remove a specialized error
message.
--

Dirmngr comes with a default keyserver and the suggestion to use
gpg --keyserver
is not good because that option is deprecated.  An error message
"No keyserver available" is sufficient.

GnuPG-bug-id: 4512
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-14 07:57:07 +02:00
NIIBE Yutaka 5b22d2c400 g10: Fix possible null dereference.
* g10/armor.c (armor_filter): Access ->d in the internal loop.

--

Cherry-picked master commit of:
	802a2aa300

GnuPG-bug-id: 4494
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-05-14 11:24:35 +09:00
NIIBE Yutaka cf73c82e95 build: Update m4/iconv.m4.
* m4/iconv.m4: Update from gettext 0.20.1.

--

Cherry-picked from master commit:
       1cd2aca03b

This includes fixes of file descriptor leaks.

GnuPG-bug-id: 4504
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-05-14 08:57:37 +09:00
Werner Koch c1dc7a8329
gpg: Change update_keysig_packet to replace SHA-1 by SHA-256.
* g10/sign.c (update_keysig_packet): Convert digest algo when needed.
--

Several gpg commands try to keep most properties of a key signature
when updating (i.e. creating a new version of a key signature).  This
included the use of the current hash-algorithm.  This patch changes
this so that SHA-1 or RMD160 are replaced by SHA-256 if
possible (i.e. for RSA signatures).  Affected commands are for example
--quick-set-expire and --quick-set-primary-uid.

GnuPG-bug-id: 4508
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-13 19:29:34 +02:00
Werner Koch 8d0d61aca3
sm: Fix a warning in an es_fopencooie function.
* sm/certdump.c (format_name_writer): Take care of a flush request.
--

We won't see a flush here so that fix does not solve a real bug but we
want to be correct.  Note that this function seems to predate the
es_fopenmem function and thus in master (2.3) we should replace it
entirely.

GnuPG-bug-id: 4495
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-12 20:41:32 +02:00
Daniel Kahn Gillmor be116f871d doc: correct documentation for gpgconf --kill
* doc/tools.texi(gpgconf): Correct documentation for gpgconf --kill.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
(cherry picked from commit 9662538be6)
2019-05-10 12:43:01 -04:00
Werner Koch 7c4029110a
dirmngr: Add a CSRF expection for pm.me
--

Also comment typo fix.
2019-05-09 14:51:49 +02:00
Werner Koch e6901c2bc8
build: Sign all Windows binaries.
* build-aux/speedo.mk (AUTHENTICODE_SIGNHOST): New.
(AUTHENTICODE_TOOL): New.
(AUTHENTICODE_FILES): New.
(installer): Sign listed files.
(AUTHENTICODE_SIGNHOST): New macro.
(sign-installer): Use that macro instead of direct use of osslsigncode.
--

This also adds code to support signing via a Token.  Because there is
no specification of that token, I was not able to write a free driver
for it.  Thus we resort to use a running Windows-10 instance with an
enabled ssh server to do the code signing.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-09 14:23:59 +02:00
Werner Koch 781d2c5c89
doc: Minor doc fix to dirmngr.
--

Reported-by: dkg
2019-05-03 16:15:54 +02:00
Werner Koch 05204b7249
gpg: Use just the addrspec from the Signer's UID.
* g10/parse-packet.c (parse_signature): Take only the addrspec from a
Signer's UID subpacket.
--

This is to address a problem in the currentr OpenKeychain which put
the entire UID into the subpacket.  For example our Tofu code can only
use the addrspec and not the entire UID.

Reported-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-03 15:57:10 +02:00
NIIBE Yutaka caa61fb7da po: Update Japanese Translation.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-04-23 12:55:21 +09:00
Andre Heinecke 35899dc290 g10: Fix double free when locating by mbox
* g10/getkey.c (get_best_pubkey_byname): Set new.uid always
to NULL after use.

--
pubkey_cmp is not guranteed to set new.uid.
So if the diff < 0 case is reached best is set to new.

If then diff > 0 is reached without modifying new.uid
e.g. if the key has no matching mboxes. new.uid is
free'd even though the uid is still referenced in
best.

GnuPG-Bug-Id: T4462
(cherry picked from commit e57954ed27)
2019-04-18 14:26:42 +02:00
NIIBE Yutaka ee766b2b5d common: Fix AWK portability.
* common/Makefile.am: Use pkg_namespace.
* common/mkstrtable.awk: Use pkg_namespace.  Regexp fix.

--

Cherry-picked from master commit:
	b6f0b0efa1

GnuPG-bug-Bug: 4459
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-04-16 13:27:44 +09:00
Werner Koch dc4c7f65e3
gpg: Accept also armored data from the WKD.
* g10/keyserver.c (keyserver_import_wkd): Clear NO_ARMOR.
--

We may even adjust the specs to allow that.  It should not be a
problem for any OpenPGP implementation because armored keys are very
common and de-armoring code is de-facto a mandatory feature.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-04-11 10:05:08 +02:00
Werner Koch e9fcb0361a
gpg: Set a limit of 5 to the number of keys imported from the WKD.
* g10/import.c (import): Limit the number of considered keys to 5.
(import_one): Return the first fingerprint in case of WKD.
--

The Web Key Directory should carry only one key.  However, some
providers like to put old or expired keys also into the WKD.  I don't
thunk that this is a good idea but I heard claims that this is needed
for them to migrate existing key data bases.

This patch puts a limit on 5 on it (we had none right now) and also
fixes the issue that gpg could not work immediately with the requested
key because the code uses the fingerprint of the key to use the
imported key.  Now the first key is used.  On a second try (w/o
accessing the WKD) the regular key selection mechanism would be in
effect.  I think this is the most conservative approach.  Let's see
whether it helps.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-04-11 10:05:05 +02:00
Werner Koch cb20659674
scd: Add dummy option --application-priority.
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-04-02 13:32:25 +02:00
Werner Koch 48e7977709
dirmngr: Improve domaininfo cache update algorithm.
* dirmngr/domaininfo.c (struct domaininfo_s): Add field keepmark.
(insert_or_update): Implement new update algorithm.

--

The old algorithm limited the length of a bucket chain by purging the
last 50% or the entries.  Thus the first domains entered into the
cache were never purged.  The new algorithm is a bit better: It also
limits the chain length on overflow to 50% but tries to keep the
entries indicating that a WKD is available in the cache.  If there is
still space to keep more, those which clearly do not support WKD are
also kept.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-04-02 13:25:48 +02:00
Werner Koch 0a30ce036a
dirmngr: Better error code for http status 413.
* dirmngr/ks-engine-hkp.c (send_request): New case for 413.
* dirmngr/ks-engine-http.c (ks_http_fetch): Ditto.
* dirmngr/ocsp.c (do_ocsp_request): Ditto.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-04-02 13:25:31 +02:00
Daniel Kahn Gillmor 5b1b5be65f NEWS: correct typo in header 2019-04-01 10:25:11 -04:00
NIIBE Yutaka 38c2a9a644
g10: Fix symmetric cipher algo constant for ECDH.
* g10/ecdh.c (kek_params_table): Use CIPHER_ALGO_AES192 for
ECC strength 384, according to RFC-6637.

--

Reported-by: Trevor Bentley
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit af3efd149f)
2019-03-27 12:29:45 +01:00
Trevor Bentley 2f455d18ab gpg: Don't use EdDSA algo ID for ECDSA curves.
* g10/keygen.c (ask_curve): Change algo ID to ECDSA if it changed from
an EdDSA curve.

--

(cherry picked from commit 4324560b2c)

This change matters when it is called from ask_card_keyattr.

Some-comments-by: NIIBE Yutaka <gniibe@fsij.org>
2019-03-27 11:10:30 +09:00
Werner Koch 644cabc6b3
Post release updates
--
2019-03-26 15:10:38 +01:00
Werner Koch dc93e57226
Release 2.2.15 2019-03-26 14:27:25 +01:00
Werner Koch 30972d2182
sm: Allow decryption even if expired other keys are configured.
* sm/gpgsm.c (main): Add special handling for bad keys in decrypt
mode.
--

The problem can easily be tested by adding --encrypt-to EXPIRED_KEY to
a decryption command.  With that patch the errors are printed but
decryption continues and the process returns success unless other
errors occur.

GnuPG-bug-id: 4431
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-03-26 13:35:18 +01:00
Werner Koch 1c2fa8b6d7
agent: Allow other ssh fingerprint algos in KEYINFO.
* agent/command.c (cmd_keyinfo): Allow for --ssh-fpr=ALGO.  Default to
the standard algo.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-03-26 09:04:53 +01:00