gnupg.git
3 years agotests/gpgscm: Nicer error message.
Justus Winter [Fri, 22 Jan 2016 10:13:14 +0000 (11:13 +0100)]
tests/gpgscm: Nicer error message.

* tests/gpgscm/scheme.c (opexe_0): Include the value that we tried to
evaluate as function-like in the error message.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotests/gpgscm: Fix error hook.
Justus Winter [Thu, 7 Jan 2016 15:53:06 +0000 (16:53 +0100)]
tests/gpgscm: Fix error hook.

* tests/gpgscm/init.scm (*error-hook*): Fix error hook so that the
whole error message is displayed.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotests/gpgscm: Handle unhandled enumeration values.
Justus Winter [Thu, 7 Jan 2016 13:07:20 +0000 (14:07 +0100)]
tests/gpgscm: Handle unhandled enumeration values.

* tests/gpgscm/scheme.c (opexe_{3,4}): Handle unhandled enumeration
values in the opcode dispatching code.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotests/gpgscm: Verbatim import of latest TinySCHEME.
Justus Winter [Wed, 6 Jan 2016 10:54:03 +0000 (11:54 +0100)]
tests/gpgscm: Verbatim import of latest TinySCHEME.

Revision 110 from svn://svn.code.sf.net/p/tinyscheme/code/trunk

* tests/gpgscm/COPYING: New file.
* tests/gpgscm/Manual.txt: Likewise.
* tests/gpgscm/init.scm: Likewise.
* tests/gpgscm/opdefines.h: Likewise.
* tests/gpgscm/scheme-private.h: Likewise.
* tests/gpgscm/scheme.c: Likewise.
* tests/gpgscm/scheme.h: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agoscd: Make option --homedir work.
Werner Koch [Fri, 17 Jun 2016 06:36:07 +0000 (08:36 +0200)]
scd: Make option --homedir work.

* scd/scdaemon.c (opts): Add --homedir.
--

Without that entry the homedir setting won't work.

GnuPG-bug-id: 2386
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodoc: Add more strong hints towards --with-colons.
Werner Koch [Thu, 16 Jun 2016 17:53:14 +0000 (19:53 +0200)]
doc: Add more strong hints towards --with-colons.

--

3 years agospeedo: New target w32-release-offline
Werner Koch [Thu, 16 Jun 2016 17:12:00 +0000 (19:12 +0200)]
speedo: New target w32-release-offline

--

As long as a current swdb.lst is available and all directories below
~/b carry the appropriate tarballs this target can be used to build a
w32-installer w/0 any network access.

3 years agoMerge branch 'master' of git+ssh://playfair.gnupg.org/git/gnupg
Werner Koch [Thu, 16 Jun 2016 16:44:05 +0000 (18:44 +0200)]
Merge branch 'master' of git+ssh://playfair.gnupg.org/git/gnupg

3 years agoPost release updates
Werner Koch [Thu, 16 Jun 2016 16:10:08 +0000 (18:10 +0200)]
Post release updates

--

3 years agoRelease 2.1.13 gnupg-2.1.13
Werner Koch [Thu, 16 Jun 2016 15:21:01 +0000 (17:21 +0200)]
Release 2.1.13

3 years agopo: Auto-update
Werner Koch [Thu, 16 Jun 2016 15:19:42 +0000 (17:19 +0200)]
po: Auto-update

--

3 years agopo: Update Ukrainian translation
Yuri Chornoivan [Tue, 10 May 2016 15:23:04 +0000 (18:23 +0300)]
po: Update Ukrainian translation

3 years agopo: Update Russian translation.
Ineiev [Sun, 8 May 2016 08:07:50 +0000 (08:07 +0000)]
po: Update Russian translation.

3 years agopo: Update German translation
Werner Koch [Thu, 16 Jun 2016 15:05:40 +0000 (17:05 +0200)]
po: Update German translation

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agospeedo,w32: Take gpg-preset-passphrase from libexec.
Werner Koch [Thu, 16 Jun 2016 14:59:15 +0000 (16:59 +0200)]
speedo,w32: Take gpg-preset-passphrase from libexec.

--

3 years agoAdd missing files so that make distcheck works again,
Werner Koch [Thu, 16 Jun 2016 14:56:42 +0000 (16:56 +0200)]
Add missing files so that make distcheck works again,

* tests/openpgp/Makefile.am (CLEANFILES): Add created file
"passphrases".
* tools/Makefile.am (EXTRA_DIST): Add no-libgcrypt.c.
--

dirmngr/Makefile uses a copy no-libgcrypt.c from tools/.  tools/ does
not anymore require no-libgcrypt.c but we keep it there in case we
eventually make use of it again.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agotools: Fix typo in function name of symcryptrun.
Werner Koch [Thu, 16 Jun 2016 09:23:59 +0000 (11:23 +0200)]
tools: Fix typo in function name of symcryptrun.

* tools/symcryptrun.c (main): Fix typo.
--

Fixes-commit: 36550dde998fa1d497098050ca2d4e1a952ed6b6
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agog10: Fix another race condition for trustdb access.
Niibe Yutaka [Tue, 14 Jun 2016 23:41:56 +0000 (08:41 +0900)]
g10: Fix another race condition for trustdb access.

* g10/tdbio.c (create_version_record): Call create_hashtable to always
make hashtable, together with the version record.
(get_trusthashrec): Remove call to create_hashtable.

--

GnuPG-bug-id: 1675
Thanks to Scott Moser for a reproducible script and patience.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 years agogpg: Print the subkey's curve and not the primary key curve.
Werner Koch [Tue, 14 Jun 2016 21:15:32 +0000 (23:15 +0200)]
gpg: Print the subkey's curve and not the primary key curve.

* g10/keylist.c (list_keyblock_colon): Use PK2 for the subkey's curve.
--

Reported-by: mantorix at vollbio punkt de
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoldap: Improve info output for v3 fallback
Werner Koch [Tue, 14 Jun 2016 18:51:22 +0000 (20:51 +0200)]
ldap: Improve info output for v3 fallback

* dirmngr/dirmngr_ldap.c (fetch_ldap): Do not use log_debug in an
unprotected section.  Replace log_debug by log_info in verbose mode.
--

GnuPG-bug-id: 2376

3 years agodirmngr: Try ldap protocol V3 as fallback
Andre Heinecke [Tue, 14 Jun 2016 17:22:52 +0000 (19:22 +0200)]
dirmngr: Try ldap protocol V3 as fallback

* dirmngr/dirmngr_ldap.c (fetch_ldap): Try V3 Protocol in case
default Protocol gives error.

--
Servers may have blocked V2 Protocol, in which case the
bind will result in a Protocol Error. In that case we try
again with v3 Protocol if the ldap libarary used to compile
dirmngr supports V3.

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
3 years agodirmngr: Print ldap error if bind fails
Andre Heinecke [Tue, 14 Jun 2016 17:20:31 +0000 (19:20 +0200)]
dirmngr: Print ldap error if bind fails

* dirmngr/dirmngr_ldap.c (fetch_ldap): Use ldap_err2string on bind
return.

--
ldap_simple_bind_s does not set errno.

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
3 years agogpgsm: Allow ciphers AES192 and SERPENT256
Werner Koch [Tue, 14 Jun 2016 13:57:57 +0000 (15:57 +0200)]
gpgsm: Allow ciphers AES192 and SERPENT256

* sm/gpgsm.c (main): Add AES192 cipher.  Allow SERPENT256.
--

Note that currently released Libcgrypt versions miss OIDs for Serpent
and thus Serpent can only be used with tye forthcoming Libgcrypt
1.7.1.

GnuPG-bug-id: 2273
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodoc: Add files and envvars to a new index.
Werner Koch [Tue, 14 Jun 2016 12:57:49 +0000 (14:57 +0200)]
doc: Add files and envvars to a new index.

* doc/gnupg.texi: Define new index "ef".
(Environment Index): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Avoid endless loop in a tofu error case.
Werner Koch [Tue, 14 Jun 2016 10:04:01 +0000 (12:04 +0200)]
gpg: Avoid endless loop in a tofu error case.

* g10/tofu.c (get_trust): Do not jump to out.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Split tofu's get_trust function into several smaller ones.
Werner Koch [Tue, 14 Jun 2016 10:02:22 +0000 (12:02 +0200)]
gpg: Split tofu's get_trust function into several smaller ones.

* g10/tofu.c (get_trust): Factor code out to ...
(format_conflict_msg_part1): new and to ...
(ask_about_binding): new.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodoc: Consistently use 'keyserver'.
Werner Koch [Tue, 14 Jun 2016 07:06:44 +0000 (09:06 +0200)]
doc: Consistently use 'keyserver'.

--
GnuPG-bug-id: 2383

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agospeedo,w32: Add gpg-preset-passphrase also to the uninstaller.
Werner Koch [Mon, 13 Jun 2016 09:34:16 +0000 (11:34 +0200)]
speedo,w32: Add gpg-preset-passphrase also to the uninstaller.

--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Un-deprecate option --auto-key-retrieve.
Werner Koch [Mon, 13 Jun 2016 09:32:38 +0000 (11:32 +0200)]
gpg: Un-deprecate option --auto-key-retrieve.

* g10/gpg.c (main): Remove deprecation warning.
--

Most options for the keyserver have been moved to dirmngr and thus it
does not make sense to favor "--keyserver-options auto-key-retrieve"
over the direct options --auto-key-retrieve and --no-auto-key-retrieve.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: New option --disable-signer-uid, create Signer's UID sub-packet.
Werner Koch [Mon, 13 Jun 2016 09:24:09 +0000 (11:24 +0200)]
gpg: New option --disable-signer-uid, create Signer's UID sub-packet.

* g10/gpg.c (oDisableSignerUID): New.
(opts): New option '--disable-signer-uid'.
(main): Set option.
* g10/options.h (opt): Add field flags.disable_signer_uid.
* g10/sign.c: Include mbox-util.h.
(mk_notation_policy_etc): Embed the signer's uid.
* g10/mainproc.c (check_sig_and_print): Do not use WKD for auto key
retrieval if --disable-signer-uid is used.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Try Signer's User ID sub-packet with --auto-key-retrieve.
Werner Koch [Mon, 13 Jun 2016 08:40:34 +0000 (10:40 +0200)]
gpg: Try Signer's User ID sub-packet with --auto-key-retrieve.

* g10/packet.h (PKT_signature): Add field 'signers_uid'.
* g10/parse-packet.c (parse_signature): Set this field.
* g10/free-packet.c (free_seckey_enc): Free field.
(copy_signature): Copy field.
* g10/mainproc.c (akl_has_wkd_method): New.
(check_sig_and_print): Extend NEWSIG status.  If WKD is enabled try to
locate a missing key via the signature's Signer's User ID sub-packet.
Do this right before trying a keyserver lookup.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg,indent: Re-indent and chnage var names in sign.c
Werner Koch [Mon, 13 Jun 2016 07:37:53 +0000 (09:37 +0200)]
gpg,indent: Re-indent and chnage var names in sign.c

--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Fix bad printf format in t-stringhelp.c
Werner Koch [Sun, 12 Jun 2016 11:43:55 +0000 (13:43 +0200)]
common: Fix bad printf format in t-stringhelp.c

--

3 years agogpg: Remove C-99ism, re-indent, and simplify one function.
Werner Koch [Sat, 11 Jun 2016 18:42:28 +0000 (20:42 +0200)]
gpg: Remove C-99ism, re-indent, and simplify one function.

* g10/call-agent.c (struct keyinfo_data): Rename to
keyinfo_data_parm_s.
(agent_get_keyinfo): Replace C-99 style init.
(keyinfo_status_cb): Use new fucntion split_fields.
* g10/export.c (match_curve_skey_pk): Add missings returns error
cases.
(cleartext_secret_key_to_openpgp): Better clear PK->PKEY first.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: New function split_fields.
Werner Koch [Sat, 11 Jun 2016 10:09:48 +0000 (12:09 +0200)]
common: New function split_fields.

* common/stringhelp.c (split_fields): New.
* common/t-stringhelp.c: Include assert.h.
(test_split_fields): New.
(main): Call test.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agog10: Export cleartext keys as cleartext
Daniel Kahn Gillmor [Fri, 10 Jun 2016 20:15:36 +0000 (16:15 -0400)]
g10: Export cleartext keys as cleartext

* g10/export.c (do_export_stream): If a key is stored by the agent in
cleartext, then try to export it as cleartext.
* tests/openpgp/export.test: For secret keys that are stored in
cleartext, test should try to export without pinentry interaction.
--

This restores the behavior of GnuPG 2.0 and 1.4 when exporting
passphraseless secret keys, and fixes the test suite accordingly.

GnuPG-bug-id: 2070, 2324
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agog10: Allow receiving cleartext secret keys from agent
Daniel Kahn Gillmor [Fri, 10 Jun 2016 20:15:35 +0000 (16:15 -0400)]
g10: Allow receiving cleartext secret keys from agent

* g10/export.c (match_curve_skey_pk): New function, testing whether an
OpenPGP public key and an S-expression use the same curve.
* g10/export.c (cleartext_secret_key_to_openpgp): New function,
filling in the secret key parameters of a PKT_public_key object from
a corresponding cleartext S-expression.
* g10/export.c, g10/main.h (receive_seckey_from_agent): Add cleartext
parameter, enabling retrieval of the secret key, unlocked.
* g10/export.c (do_export_stream): Send cleartext as 0, keeping current
behavior.
* g10/keygen.c (card_store_key_with_backup): Use cleartext=0 to ensure
that smartcard backups are all passphrase-locked.
--

This sets up internal functionality to be capable of exporting
cleartext secret keys, but does not change any existing behavior.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agog10: Add openpgp_protected flag to agent secret key export functions
Daniel Kahn Gillmor [Fri, 10 Jun 2016 20:15:34 +0000 (16:15 -0400)]
g10: Add openpgp_protected flag to agent secret key export functions

* g10/call-agent.c, g10/call-agent.h (agent_export_key): Add
openpgp_protected flag.
* g10/export.c (receive_seckey_from_agent): Request openpgp_protected
secret keys from agent.
* agent/command.c (hlp_export_key): EXPORT_KEY help text: add a
brief description of the effect of --openpgp.
--

The --openpgp flag for gpg-agent's EXPORT_KEY actually forces
encryption in a certain (RFC 4880-compatible format).  This changeset
exposes that functionality in internal functions, and clarifies
functionality in the agent's help text.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agog10: report whether key in agent is passphrase-protected or not
Daniel Kahn Gillmor [Fri, 10 Jun 2016 20:15:33 +0000 (16:15 -0400)]
g10: report whether key in agent is passphrase-protected or not

* g10/call-agent.c, g10/call-agent.h (agent_get_keyinfo): add
  r_cleartext parameter to report whether a key is stored without
  passphrase protection.
* g10/gpgv.c, g10/test-stubs.c: augment dummy agent_get_keyinfo to
  match new API.
* g10/export.c, g10/keyedit.c, g10/keygen.c, g10/keylist.c,
  g10/sign.c: pass NULL to agent_get_keyinfo since we do not yet
  need to know whether agent is passphrase-protected.

--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agospeedo,w32: Distribute gpg-preset-passphrase.
Werner Koch [Sat, 11 Jun 2016 09:08:30 +0000 (11:08 +0200)]
speedo,w32: Distribute gpg-preset-passphrase.

--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoExplicitly restrict socket permissions.
Werner Koch [Wed, 8 Jun 2016 14:18:02 +0000 (16:18 +0200)]
Explicitly restrict socket permissions.

* agent/gpg-agent.c (create_server_socket): Call chmod before listen.
* scd/scdaemon.c (create_server_socket): Ditto.
* dirmngr/dirmngr.c (main): Ditto.
--

This is just in case of a improperly set umask.  Note that a connect
requires a write permissions.

3 years agow32: Fix recent build regression.
Werner Koch [Wed, 8 Jun 2016 13:14:06 +0000 (15:14 +0200)]
w32: Fix recent build regression.

* common/homedir.c (_gnupg_socketdir_internal) [W32]: Add definition
for NAME.
* g10/gpg.c (main) [W32]:  Fix use og gnupg_homedir.

* agent/gpg-agent.c (remove_socket): Remove unused var P.
* scd/scdaemon.c (cleanup): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpgconf: New commands --create-socketdir and --remove-socketdir.
Werner Koch [Wed, 8 Jun 2016 12:04:47 +0000 (14:04 +0200)]
gpgconf: New commands --create-socketdir and --remove-socketdir.

* tools/gpgconf.c: Include unistd.h.
(aCreateSocketDir, aRemoveSocketDir): New.
(opts): Add --create-socketdir and --remove-socketdir.
(main): Implement them.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoImplement /run/user/UID/gnupg based sockets.
Werner Koch [Wed, 8 Jun 2016 08:12:32 +0000 (10:12 +0200)]
Implement /run/user/UID/gnupg based sockets.

* common/homedir.c: Include sys/stat.h and zb32.h.
(w32_portable_app, w32_bin_is_bin): Change type from int to byte.
(non_default_homedir): New.
(is_gnupg_default_homedir): New.
(default_homedir): Set non_default_homedir.
(gnupg_set_homedir): Set non_default_homedir and make
the_gnupg_homedir and absolute directory name.
(gnupg_homedir): Return an absolute directory name.
(_gnupg_socketdir_internal): New.
(gnupg_socketdir): Implement /run/user/ based sockets.
* tools/gpg-connect-agent.c (get_var_ext): Replace now obsolete
make_filename by xstrdup.
* tools/gpgconf.c (main): Sue gnupg_homedir for the "homedir:" output.
--

If a [/var]/run/user/$(id -u)/ directory exists, a gnupg subdir is
created as needed and the permissions of the directories are checked.
If that all matches that directory name is returned instead of the
homedir.

To cope with non standard homedirs (via GNUPGHOME or --homedir) the
SHA-1 hash of the homedir is computed, left truncated to 120 bits,
zBase-32 encoded, prefixed with "d.", and appended to
"[/var]/run/user/$(id -u)/gnupg/".  If that directory exists and has
proper permissions it is returned as socket dir - if not the homedir
is used.  Due to cleanup issues, this directory will not be
auto-created but needs to be created by the user in advance.

The required permissions are: directory owned by the user, group and
others bits not set.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpgconf: Add option --homedir
Werner Koch [Wed, 8 Jun 2016 07:54:09 +0000 (09:54 +0200)]
gpgconf: Add option --homedir

* tools/gpgconf.c (opts): Add --homedir.
(main): Set homedir.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoDo not use no-libgcrypt dummy for tools
Werner Koch [Wed, 8 Jun 2016 07:17:49 +0000 (09:17 +0200)]
Do not use no-libgcrypt dummy for tools

* tools/Makefile.am (gpgconf_SOURCES): Remove no-libgcrypt.c.
(gpgconf_LDADD): Add LIBGCRYPT_LIBS.
(gpg_connect_agent_LDADD): Ditto.
(gpgtar_LDADD): Ditto.
* dirmngr/Makefile.am (dirmngr_client_LDADD): Ditto.
(t_common_ldadd): Ditto.  Remove no-libgcrypt.o.
--

We need this change so that a future code in common/ can use Libgcrypt
functions; in particular hashing.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoDo not try to remove the enclosing directory of sockets.
Werner Koch [Wed, 8 Jun 2016 07:04:29 +0000 (09:04 +0200)]
Do not try to remove the enclosing directory of sockets.

* agent/gpg-agent.c (remove_socket): Do not remove the enclosing
directory.
* scd/scdaemon.c (cleanup): Ditto.

--

The socket directory is now below /run or at ~/.gnupg.  Thus we should
not try to remove the directory of the socket.  The auto-removal was
introduced at a time we used a temporary directory for the sockets.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: New function gnupg_socketdir.
Werner Koch [Tue, 7 Jun 2016 11:48:46 +0000 (13:48 +0200)]
common: New function gnupg_socketdir.

* common/homedir.c (gnupg_socketdir): New.
* agent/gpg-agent.c (create_socket_name): Use new function instead of
gnupg_homedir.
(check_own_socket): Ditto.
(check_for_running_agent): Ditto.
* agent/preset-passphrase.c (main): Ditto.
* common/asshelp.c (start_new_gpg_agent): Ditto.
* scd/scdaemon.c (create_socket_name): Ditto.
* tools/gpgconf.c (main): Ditto.
* tools/symcryptrun.c (main): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Remove homedir arg from start_new_{dirmngr,gpg_agent}.
Werner Koch [Tue, 7 Jun 2016 11:09:00 +0000 (13:09 +0200)]
common: Remove homedir arg from start_new_{dirmngr,gpg_agent}.

* common/asshelp.c (start_new_gpg_agent): Remove arg 'homedir' in
favor of gnupg_homedir ().  Change all callers.
(start_new_dirmngr): Ditto.
* common/get-passphrase.c (gnupg_prepare_get_passphrase): Remove arg
'homedir'.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoReplace use of opt.homedir by accessor functions.
Werner Koch [Tue, 7 Jun 2016 08:59:46 +0000 (10:59 +0200)]
Replace use of opt.homedir by accessor functions.

* common/homedir.c (the_gnupg_homedir): New var.
(gnupg_set_homedir): New.
(gnupg_homedir): New.
* g10/options.h (struct opt): Remove 'homedir' and replace all users
by the new accessor functions.
* g13/g13-common.h (struct opt): Ditto.
* scd/scdaemon.h (struct opt): Ditto.
* sm/gpgsm.h (struct opt): Ditto.
* dirmngr/dirmngr.h (struct opt): Ditto.
* agent/preset-passphrase.c (opt_homedir): Ditto.
* agent/protect-tool.c (opt_homedir): Ditto.
--

This will make detection of a non-default homedir easier.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agopo: Update Japanese translation.
NIIBE Yutaka [Tue, 7 Jun 2016 05:27:41 +0000 (14:27 +0900)]
po: Update Japanese translation.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 years agogpg: Fix command line parsing of --quick-addkey and --quick-gen-key.
NIIBE Yutaka [Tue, 7 Jun 2016 05:16:32 +0000 (14:16 +0900)]
gpg: Fix command line parsing of --quick-addkey and --quick-gen-key.

* g10/gpg.c (main): Compose a block by curly braces.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 years agogpg: Use --keyid-format=none by default.
Werner Koch [Mon, 6 Jun 2016 15:03:47 +0000 (17:03 +0200)]
gpg: Use --keyid-format=none by default.

* g10/gpg.c (main): Init keyid_format to KF_NONE.
* g10/keyid.c (format_keyid): Ditto.
(keystrlen): Ditto.
--

GnuPG-bug-id: 2379
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Add option --with-subkey-fingerprint.
Werner Koch [Mon, 6 Jun 2016 14:55:03 +0000 (16:55 +0200)]
gpg: Add option --with-subkey-fingerprint.

* g10/gpg.c (oWithSubkeyFingerprint): New.
(opts): Add --with-subkey-fingerprint[s].
(main): Set that option.
* g10/options.h (struct opt): Add 'with_subkey_fingerprint'.
* g10/keylist.c (list_keyblock_print): Print subkey fingerprint.
(print_fingerprint): Tweak printing to use compact format if
desirable.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Implement --keyid-format=none.
Werner Koch [Mon, 6 Jun 2016 14:00:50 +0000 (16:00 +0200)]
gpg: Implement --keyid-format=none.

* g10/gpg.c (main): Add option "none" to --keyid-format.
* g10/options.h (KF_NONE): New.
* g10/keyid.c (format_keyid): Implement that.
(keystr): Use format "long" is KF_NONE is in use.
(keystr_with_sub): Ditto.
* g10/keylist.c (list_keyblock_print): Adjust indentaion for KF_NONE.
Factor some code out to ...
(print_key_line): new.
(print_fingerprint): Add mode 20.
* g10/mainproc.c (list_node): Use print_key_line.  Replace MAINKEY by
flags.primary in the PK.  Fix putting a " revoked..." string into the
colons format.
* g10/pkclist.c (do_edit_ownertrust): Use print_key_line.  This
slightly changes the putput format.
* g10/revoke.c (gen_standard_revoke): Use print_key_line.  This may
also put "expires: " into the output.
--

Due to user experience problems with the keyid and we better allow to
show the fingerprint instead.  Note that we do not support v3 keys
anymore and thus there is no technical need for a user to know the
keyid.

GnuPG-bug-id: 2379
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoindent: Wrap strings in debug messages.
Werner Koch [Mon, 6 Jun 2016 10:24:53 +0000 (12:24 +0200)]
indent: Wrap strings in debug messages.

--

3 years agow32: Require --enable-build-timestamp for the BUILD_HOSTNAME.
Werner Koch [Sat, 4 Jun 2016 16:45:37 +0000 (18:45 +0200)]
w32: Require --enable-build-timestamp for the BUILD_HOSTNAME.

* configure.ac (BUILD_HOSTNAME): Set to "<anon>" bey default.
* build-aux/speedo.mk (speedo_pkg_gnupg_configure): Add
  --enable-build-timestamp.
--

Debian-bug-id: 826309
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Add the fingerprint to KEY_CREATED for subkeys.
Werner Koch [Thu, 2 Jun 2016 20:01:51 +0000 (22:01 +0200)]
gpg: Add the fingerprint to KEY_CREATED for subkeys.

* g10/keygen.c (print_status_key_created): Make more robust by
allowing a NULL for PK.
(generate_subkeypair): Use print_status_key_created.
(generate_card_subkeypair): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Try to use the passphrase from the primary for --quick-addkey.
Werner Koch [Thu, 2 Jun 2016 19:21:08 +0000 (21:21 +0200)]
gpg: Try to use the passphrase from the primary for --quick-addkey.

* agent/command.c (cmd_genkey): Add option --passwd-nonce.
(cmd_passwd): Return a PASSWD_NONCE in verify mode.
* g10/call-agent.c (agent_genkey): Add arg 'passwd_nonce_addr' and do
not send a RESET if given.
(agent_passwd): Add arg 'verify'.
* g10/keygen.c (common_gen): Add optional arg 'passwd_nonce_addr'.
(gen_elg, gen_dsa, gen_ecc, gen_rsa, do_create): Ditto.
(generate_subkeypair): Use sepeare hexgrip var for the to be created
for hexgrip feature.  Verify primary key first.  Make use of the
passwd nonce.  Allow for a static passphrase.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Extend the --quick-gen-key command.
Werner Koch [Thu, 2 Jun 2016 16:38:10 +0000 (18:38 +0200)]
gpg: Extend the --quick-gen-key command.

* g10/keygen.c (quickgen_set_para): Add arg 'use'.
(quick_generate_keypair): Add args 'algostr', 'usagestr', and
'expirestr'.  Implement primary only key mode.
(parse_algo_usage_expire): Set NBITS for the default algo.
* g10/gpg.c (main): Extend --quick-gen-key command.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Improve the new parse_subkey_algostr_usagestr fucntion.
Werner Koch [Thu, 2 Jun 2016 15:01:54 +0000 (17:01 +0200)]
gpg: Improve the new parse_subkey_algostr_usagestr fucntion.

* g10/keygen.c (parse_usagestr): Allow "cert".
(generate_subkeypair): Factor expire parsing out to ...
(parse_subkey_algostr_usagestr): here.  Rename to ...
(parse_algo_usage_expire): this.  Add arg 'for_subkey'.  Set CERT for
primary key and check that it is not set for subkeys.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: New command --quick-addkey.
Werner Koch [Thu, 2 Jun 2016 13:54:48 +0000 (15:54 +0200)]
gpg: New command --quick-addkey.

* g10/keygen.c (DEFAULT_STD_SUBKEYUSE): New.
(ask_keysize): Factor code out to ...
(get_keysize_range, fixup_keysize): new.
(parse_parameter_usage): Factor parsing out to  ...
(parse_usagestr): new.  Allow use of "encr" as alias for "encrypt".
(parse_subkey_algostr_usagestr): New.
(generate_subkeypair): Add new args.  Implement unattended mode.

* g10/keyedit.c (keyedit_quick_sign): Factor some code out to ...
(find_by_primary_fpr): new.
(keyedit_quick_addkey): New.
* g10/gpg.c (aQuickAddKey): New.
(opts): Add --quick-addkey.
(main): Implement.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Do not abort on certain invalid packets.
Werner Koch [Thu, 2 Jun 2016 13:14:49 +0000 (15:14 +0200)]
gpg: Do not abort on certain invalid packets.

* g10/build-packet.c (write_fake_data): Check for non-opaque data.
* g10/seskey.c (do_encode_md): Return NULL instead of abort.
--

The first may happen if the usage flags of an algorithm do not match
the allowed usage.  When writing a backsig this would lead to a
log_bug in libgcrypt due to the use of a regular MPI as opaque data.

The second may happen with all kind of invalid data.  It is easy to
avoid an abort, though.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: New function openpgp_is_curve_supported.
Werner Koch [Thu, 2 Jun 2016 13:10:52 +0000 (15:10 +0200)]
common: New function openpgp_is_curve_supported.

* common/openpgp-oid.c: Include openpgpdefs.h.
(oidtable): Add field pubkey_algo.
(openpgp_is_curve_supported): New.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Add comments on how to enable backtrace().
Werner Koch [Thu, 2 Jun 2016 13:09:42 +0000 (15:09 +0200)]
common: Add comments on how to enable backtrace().

--

3 years agog10: Allow User ID length >= 256.
NIIBE Yutaka [Wed, 1 Jun 2016 11:59:09 +0000 (20:59 +0900)]
g10: Allow User ID length >= 256.

* build-packet.c (do_user_id): Call write_header2 with HDRLEN not set.

--

Reported-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
GnuPG-bug-id: 2374
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 years agogpg: New status code NOTATION_FLAGS.
Werner Koch [Tue, 31 May 2016 13:43:51 +0000 (15:43 +0200)]
gpg: New status code NOTATION_FLAGS.

* common/status.h (STATUS_NOTATION_FLAGS: New.
* g10/packet.h (struct notation): Add flags.human.
(notation_t): New typedef.
* g10/build-packet.c (sig_to_notation): Set flags.human.
* g10/keylist.c (show_notation): Write STATUS_NOTATION_FLAGS.

3 years agobuild: Fix URL.
Justus Winter [Tue, 31 May 2016 09:03:18 +0000 (11:03 +0200)]
build: Fix URL.

--
Signed-off-by: Justus Winter <justus@g10code.com>
3 years agocommon: Add a status callback to gnupg_exec_tool_stream.
Werner Koch [Fri, 27 May 2016 22:07:09 +0000 (00:07 +0200)]
common: Add a status callback to gnupg_exec_tool_stream.

* common/exectool.h (exec_tool_status_cb_t): New.
* common/exectool.c: Include missing exectool.h.
(read_and_log_buffer_t): Replace array by pointer.
(gnupg_exec_tool_stream): Add args 'status_cb' and 'status_cb_value'.
Change all callers to pass NULL for them.  Malloc buffer for
FDERRSTATE.
(read_and_log_stderr): Implement status_fd feature.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Allow a second input stream for gnupg_exec_tool_stream.
Werner Koch [Fri, 27 May 2016 20:48:04 +0000 (22:48 +0200)]
common: Allow a second input stream for gnupg_exec_tool_stream.

* common/exechelp-posix.c (do_exec): Add arg 'except' and pass to
close_all_fds.
(gnupg_spawn_process): Add arg 'except'.  Change callers to pass NULL
for it.
* common/exechelp-w32.c (gnupg_spawn_process): Add dummy arg 'except'.
* common/exechelp-w32ce.c (gnupg_spawn_process): Ditto.
* common/exectool.c (copy_buffer_do_copy): Allow NULL for SINK.
(gnupg_exec_tool_stream): Add arg 'inextra'. Change callers to pass
NULL for it.  Allow NULL for OUTPUT.
--

This hack is a first step to allow calling gpg for verification of
signatures.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Simplify the fd closing patch 512c56a.
Werner Koch [Fri, 27 May 2016 20:22:37 +0000 (22:22 +0200)]
common: Simplify the fd closing patch 512c56a.

* common/exechelp-posix.c (get_max_fds): Use /proc/self.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Speedup closing fds before an exec.
Werner Koch [Fri, 27 May 2016 20:02:54 +0000 (22:02 +0200)]
common: Speedup closing fds before an exec.

* common/exechelp-posix.c [__linux__]: Include dirent.h.
(get_max_fds) [__linux__]: Return the actual used highest fd.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agotools: Improve debug output of rfc822parse.
Werner Koch [Fri, 27 May 2016 13:51:25 +0000 (15:51 +0200)]
tools: Improve debug output of rfc822parse.

* tools/rfc822parse.c (show_event): Add missing events.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agobuild: Remove obsolete tests for funopen and fopencookie.
Werner Koch [Fri, 27 May 2016 13:50:30 +0000 (15:50 +0200)]
build: Remove obsolete tests for funopen and fopencookie.

* configure.ac (AC_CHECK_FUNCS): Remove tests for funopen.
--

Meanwhile we are using the portable functions from libgpg-error.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Extend gnupg_create_inbound_pipe et al.
Werner Koch [Fri, 27 May 2016 13:41:55 +0000 (15:41 +0200)]
common: Extend gnupg_create_inbound_pipe et al.

* common/exechelp-posix.c (gnupg_create_inbound_pipe): Add args 'r_fp'
and 'nonblock'.
(gnupg_create_outbound_pipe): Ditto.
* common/exechelp-w32.c (gnupg_create_inbound_pipe): Add non yet
functional args 'r_fp' and 'nonblock'.
(gnupg_create_outbound_pipe): Ditto.
* common/exechelp-w32ce.c (gnupg_create_inbound_pipe): Ditto.
(gnupg_create_outbound_pipe): Ditto.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Make use of default_errsource in exechelp.
Werner Koch [Fri, 27 May 2016 13:25:03 +0000 (15:25 +0200)]
common: Make use of default_errsource in exechelp.

* common/exechelp-posix.c (my_error_from_syserror, my_error): New.
Use them instead of gpg_error and gpg_error_from_syserror.
(create_pipe_and_estream): Remove arg ERRSOURCE and fix use of
OUTBOUND which has a wrong name.  Adjust callers.
(gnupg_spawn_process): Remove arg ERRSOURCE and replace by use of
DEFAULT_ERRSOURCE.
* common/exechelp-w32.c (gnupg_spawn_process): Ditto.
* common/exechelp-w32ce.c (gnupg_spawn_process): Ditto.
* common/exectool.c (gnupg_exec_tool_stream):  Do not pass
GPG_ERROR_FROM_SYSERROR.
* tools/gpgconf-comp.c (gc_component_check_options): Ditto.
(retrieve_options_from_program): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Keep current and total of PROGESS status lines small enough.
Werner Koch [Fri, 27 May 2016 09:28:22 +0000 (11:28 +0200)]
gpg: Keep current and total of PROGESS status lines small enough.

* g10/progress.c (progress_filter): Factor status wrote out to...
(write_status_progress): New.  Scale values down.
--

GnuPG-bug-id: 2368
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoconfigure: Detection of libusb on FreeBSD.
NIIBE Yutaka [Thu, 26 May 2016 23:48:04 +0000 (08:48 +0900)]
configure: Detection of libusb on FreeBSD.

* configure.ac (LIBUSB_LIBS): Use LIBUSB_NAME for AC_CHECK_LIB.

--

Thanks to Michael Sinatra.

GnuPG-bug-id: 2367
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 years agobuild: Switch to new URL for swdb.lst
Werner Koch [Wed, 25 May 2016 12:44:50 +0000 (14:44 +0200)]
build: Switch to new URL for swdb.lst

3 years agogpgtar: Simplify code by using ccparray.
Werner Koch [Tue, 24 May 2016 13:54:48 +0000 (15:54 +0200)]
gpgtar: Simplify code by using ccparray.

* tools/gpgtar-create.c (gpgtar_create): Use ccparray functions.
* tools/gpgtar-extract.c (gpgtar_extract): Ditto.
* tools/gpgtar-list.c (gpgtar_list): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Add simple dynamic array function.
Werner Koch [Tue, 24 May 2016 13:43:16 +0000 (15:43 +0200)]
common: Add simple dynamic array function.

* common/ccparray.c: New.
* common/ccparray.h: New.
* common/t-ccparray.c: New.
* common/Makefile.am (common_sources): Add files.
(module_tests): Add test file.
(t_ccparray_LDADD): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon,w32: Silence an unused arg warning message.
Werner Koch [Tue, 24 May 2016 11:02:14 +0000 (13:02 +0200)]
common,w32: Silence an unused arg warning message.

--

3 years agogpg, w32: Fix build regression.
Werner Koch [Tue, 24 May 2016 11:01:27 +0000 (13:01 +0200)]
gpg, w32: Fix build regression.

--

Fixes-commit: 754b1c463034a634a678d8efc76c27fd46aad9b9

3 years agotests: Test the pinentry interactions when exporting keys.
Justus Winter [Tue, 19 Apr 2016 14:23:42 +0000 (16:23 +0200)]
tests: Test the pinentry interactions when exporting keys.

* tests/openpgp/export.test: Test pinentry interactions.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotests: Add support for a passphrase queue to fake pinentry.
Justus Winter [Tue, 19 Apr 2016 13:44:23 +0000 (15:44 +0200)]
tests: Add support for a passphrase queue to fake pinentry.

* tests/openpgp/fake-pinentry.c (get_passphrase): New function.
(main): Add option --passphrasefile and read passphrases from it.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotests: Add logging to fake pinentry.
Justus Winter [Tue, 19 Apr 2016 12:21:10 +0000 (14:21 +0200)]
tests: Add logging to fake pinentry.

* tests/openpgp/fake-pinentry.c (log_stream): New variable.
(reply): New function.
(spacep,skip_options,option_value): Copy from common.
(main): Parse arguments, add --logfile option, write logfile.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotests: Add export test.
Justus Winter [Tue, 19 Apr 2016 11:40:46 +0000 (13:40 +0200)]
tests: Add export test.

* tests/openpgp/Makefile.am (TESTS): Add new file.
* tests/openpgp/export.test: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agog10: Fix typo in comment.
Daniel Kahn Gillmor [Fri, 20 May 2016 14:21:38 +0000 (07:21 -0700)]
g10: Fix typo in comment.

--
Signed-off-by: Justus Winter <justus@g10code.com>
3 years agogpg: Speed up key listing in Tofu mode.
Werner Koch [Sat, 21 May 2016 18:38:18 +0000 (20:38 +0200)]
gpg: Speed up key listing in Tofu mode.

* g10/tofu.c (get_trust): Add arg PK.  Uses this instead of a an extra
lookup of the public key by fingerrpint.
(tofu_register): Pass PK to get_trust.
(tofu_get_validity): Ditto.

*g10/tofu.c (tofu_register): Remove unused FINGERPRINT_PP.
--

With my test keybox I see a speedup of 10 times (33s to 3.1s).  The
reason for this was the extra key lookup which I hacked in at some
point to make the extraction of a keyid correct also for non v4 keys.
However our caller already has the public key and thus can easily pass
it to get_trust along with the fingerprint.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Avoid name spaces clash with future sqlite versions.
Werner Koch [Sat, 21 May 2016 18:06:59 +0000 (20:06 +0200)]
gpg: Avoid name spaces clash with future sqlite versions.

* g10/sqlite.c: Rename to gpgsql.c.  Change function prefixes to
gpgsql_.
* g10/sqlite.h: Rename to gpgsql.h.
* g10/tofu.c: Adjust for changes.
--

We used for our own extensions symbols with an sqlite_ names prefix.
This may in theory lead to duplicated symbols but more important, it
is harder to understand what is from gpg and what is from libsqlite.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Explicitly close a combined Tofu DB.
Werner Koch [Sat, 21 May 2016 10:49:12 +0000 (12:49 +0200)]
gpg: Explicitly close a combined Tofu DB.

* g10/tofu.c (tofu_closedbs): Close combined DB.

3 years agogpg: Remove debug output accidently introduced with 027c4e5.
Werner Koch [Sat, 21 May 2016 10:33:41 +0000 (12:33 +0200)]
gpg: Remove debug output accidently introduced with 027c4e5.

--

Fixes-commit: 027c4e55522b8e18711a3331932a9869ab89ca26
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Store the Tofu meta handle for databases in CTRL.
Werner Koch [Sat, 21 May 2016 10:26:44 +0000 (12:26 +0200)]
gpg: Store the Tofu meta handle for databases in CTRL.

* g10/gpg.h (struct tofu_dbs_s, tofu_dbs_t): New declarations.
(struct server_control_s): Add field tofu.dbs.
* g10/tofu.c (struct dbs): Rename to tofu_dbs_s.  Replace all users by
by tofu_dbs_t.
(opendbs):  Add arg CTRL.  Cache the DBS in CTRL.
(closedbs): Rename to tofu_closedbs and make global.  Add arg CTRL.
(tofu_register): Add arg CTRL.  Change all callers.  Do not call
closedbs.
(tofu_get_validity): Ditto.
(tofu_set_policy): Ditto.
(tofu_get_policy): Ditto.
(tofu_set_policy_by_keyid): Add arg CTRL.
* g10/gpg.c (gpg_deinit_default_ctrl): Call tofu_closedbs.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Pass CTRL object down to the trust functions
Werner Koch [Sat, 21 May 2016 09:41:49 +0000 (11:41 +0200)]
gpg: Pass CTRL object down to the trust functions

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Fix the TOFU_STATS_LONG status.
Werner Koch [Sat, 21 May 2016 09:06:24 +0000 (11:06 +0200)]
gpg: Fix the TOFU_STATS_LONG status.

* g10/tofu.c (show_statistics): Print TOFU STATS with formatting
characters.
--

We better leave the non-breaking space character in the status
messages so that the caller can make use of them.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Print "[ never ]" instead of err for validity.
Werner Koch [Thu, 19 May 2016 07:35:20 +0000 (09:35 +0200)]
gpg: Print "[  never ]" instead of err for validity.

* g10/trust.c (uid_trust_string_fixed): Handle NEVER.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Add --weak-digest to gpgv's help screen.
Werner Koch [Wed, 18 May 2016 15:00:03 +0000 (17:00 +0200)]
gpg: Add --weak-digest to gpgv's help screen.

--

Suggested-by: Daniel Kahn Gillmor
3 years agodirmngr: Adjust the WKD lookup to specs version -01.
Werner Koch [Wed, 18 May 2016 07:46:22 +0000 (09:46 +0200)]
dirmngr: Adjust the WKD lookup to specs version -01.

* dirmngr/server.c (cmd_wkd_get): Remove second occurrence of the
domain part.
--

This change updates gnupg to comply with
draft-koch-openpgp-webkey-service-01

3 years agogpg: Emit new status line KEY_CONSIDERED.
Werner Koch [Fri, 13 May 2016 14:24:59 +0000 (16:24 +0200)]
gpg: Emit new status line KEY_CONSIDERED.

* common/status.h (STATUS_KEY_CONSIDERED): New.
* g10/getkey.c: Include status.h.
(LOOKUP_NOT_SELECTED, LOOKUP_ALL_SUBKEYS_EXPIRED): New.
(finish_lookup): Add arg R_FLAGS.  Count expired and revoked keys and
set flag.  Check a requested usage before checking for expiraion or
revocation.
(print_status_key_considered): New.
(lookup): Print new status.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agog10: Fix signature checking.
NIIBE Yutaka [Wed, 11 May 2016 10:27:03 +0000 (19:27 +0900)]
g10: Fix signature checking.

* g10/sig-check.c (check_signature_over_key_or_uid): Fix call to
walk_kbnode.

--

Thanks to Vincent Brillault (Feandil).

GnuPG-bug-id: 2351
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>