gnupg.git
2 years agocommon,gpg,sm: Move the compliance option parser.
Justus Winter [Wed, 7 Jun 2017 09:50:54 +0000 (11:50 +0200)]
common,gpg,sm: Move the compliance option parser.

* common/compliance.c (gnupg_parse_compliance_option): New function.
* common/compliance.h (struct gnupg_compliance_option): New type.
(gnupg_parse_compliance_option): New prototype.
* g10/gpg.c (parse_compliance_option): Remove function.
(compliance_options): New variable.
(main): Adapt callsite.
* sm/gpgsm.c (main): Use the new common function.
* sm/gpgsm.h (opt): New field 'compliance'.

GnuPG-bug-id: 3191
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpg: Improve compliance with CO_DE_VS.
Justus Winter [Thu, 1 Jun 2017 13:14:19 +0000 (15:14 +0200)]
gpg: Improve compliance with CO_DE_VS.

* g10/gpg.c (set_compliance_option): The specification, section 4.1.1,
forbids the use of encryption without integrity protection.

GnuPG-bug-id: 3191
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agospeedo: Fix a minor memleak in the installer
Andre Heinecke [Wed, 7 Jun 2017 13:30:14 +0000 (15:30 +0200)]
speedo: Fix a minor memleak in the installer

* build-aux/speedo/w32/g4wihelp.c (path_remove): Free path_new on
early return.

--
It's a weird condition in a once run function in a throwaway
process but -- yeah. It's a memleak and static analysis can
see it.

GnuPG-Bug-Id: T3197
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 years agospeedo: Fix source tar call ambiguity
Andre Heinecke [Tue, 6 Jun 2017 14:38:02 +0000 (16:38 +0200)]
speedo: Fix source tar call ambiguity

* build-aux/speedo.mk (dist-source): Expand exclude-vc to
exclude-vcs.

--
Tar 1.29 also has exclude-vcs-ignores so this became
ambiguous.

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 years agocommon,g10: Fix typos.
Justus Winter [Tue, 6 Jun 2017 12:48:01 +0000 (14:48 +0200)]
common,g10: Fix typos.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpg: Report compliance with CO_DE_VS.
Justus Winter [Tue, 30 May 2017 12:30:24 +0000 (14:30 +0200)]
gpg: Report compliance with CO_DE_VS.

* common/compliance.c (gnupg_pk_is_compliant): Add DSA with certain
parameters.
(gnupg_cipher_is_compliant): New function.
(gnupg_digest_is_compliant): Likewise.
* common/compliance.h (gnupg_cipher_is_compliant): New prototype.
(gnupg_digest_is_compliant): Likewise.
* common/status.h (STATUS_DECRYPTION_COMPLIANCE_MODE): New status.
(STATUS_VERIFICATION_COMPLIANCE_MODE): Likewise.
* doc/DETAILS: Document the new status lines.
* g10/mainproc.c (proc_encrypted): Compute compliance with CO_DE_VS
and report that using the new status line.
(check_sig_and_print): Likewise.
* sm/decrypt.c (gpgsm_decrypt): Likewise.
* sm/verify.c (gpgsm_verify): Likewise.
--

When decrypting data and verifying signatures, report whether the
operations are in compliance with the criteria for data classified as
VS-NfD.  This information will be picked up by the frontend and
presented to the user.

GnuPG-bug-id: 3059
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocommon: Improve checking for compliance with CO_DE_VS.
Justus Winter [Thu, 1 Jun 2017 09:56:42 +0000 (11:56 +0200)]
common: Improve checking for compliance with CO_DE_VS.

* common/compliance.c (gnupg_pk_is_compliant): Only certain RSA key
sizes are compliant.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpg,common: Move the compliance framework.
Justus Winter [Wed, 31 May 2017 12:33:45 +0000 (14:33 +0200)]
gpg,common: Move the compliance framework.

* common/Makefile.am (common_sources): Add new files.
* common/compliance.c: New file.  Move 'gnupg_pk_is_compliant' here,
and tweak it to not rely on types private to gpg.
* common/compliance.h: New file.  Move the compliance enum here.
* g10/keylist.c (print_compliance_flags): Adapt callsite.
* g10/main.h (gnupg_pk_is_compliant): Remove prototype.
* g10/misc.c (gnupg_pk_is_compliant): Remove function.
* g10/options.h (opt): Use the new compliance enum.
* sm/keylist.c (print_compliance_flags): Use the common functions.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpg: Fix compliance computation.
Justus Winter [Wed, 31 May 2017 12:24:04 +0000 (14:24 +0200)]
gpg: Fix compliance computation.

* g10/misc.c (gnupg_pk_is_compliant): Compare against CO_RFC2440, not
RFC2440 which is actually a predicate.

Fixes-commit: fe0b37e123ded51cc5f4cb5e3547fdfbce37a43e
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agosm: Simplify code.
Justus Winter [Wed, 31 May 2017 10:51:56 +0000 (12:51 +0200)]
sm: Simplify code.

* sm/verify.c (gpgsm_verify): Simplify by using a newer gcrypt
interface.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agosm: Fix typo.
Justus Winter [Wed, 31 May 2017 10:12:42 +0000 (12:12 +0200)]
sm: Fix typo.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agodoc: Improve documentation.
Justus Winter [Wed, 31 May 2017 10:11:56 +0000 (12:11 +0200)]
doc: Improve documentation.

* doc/gpgsm.texi: Mention that '--with-key-data' implies
'--with-colons'.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoagent: Fix error from do_encryption.
NIIBE Yutaka [Wed, 31 May 2017 09:42:55 +0000 (18:42 +0900)]
agent: Fix error from do_encryption.

* agent/protect.c (do_encryption): Don't mask failure of OUTBUF
allocation.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agoscd: Fix error code on failure at usb_init.
NIIBE Yutaka [Wed, 31 May 2017 01:05:36 +0000 (10:05 +0900)]
scd: Fix error code on failure at usb_init.

* scd/ccid-driver.c (ccid_dev_scan): Return GPG_ERR_ENODEV.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agoscd: Handle a failure of libusb_init.
NIIBE Yutaka [Wed, 31 May 2017 00:49:54 +0000 (09:49 +0900)]
scd: Handle a failure of libusb_init.

* scd/ccid-driver.c (ccid_get_reader_list, ccid_dev_scan): Handle
failure.

--

Reported-by: Yuriy M. Kaminskiy <yumkam@gmail.com>
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agogpg: Fix typos.
Justus Winter [Mon, 29 May 2017 13:23:36 +0000 (15:23 +0200)]
gpg: Fix typos.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpg: Disable keydb handle caching
Andre Heinecke [Tue, 30 May 2017 08:22:35 +0000 (10:22 +0200)]
gpg: Disable keydb handle caching

* g10/getkey.c (getkey_end): Disable caching of the open keydb
handle.

--
This created a big regression for Windows because the keyring
is only released after the global ctrl is released. So if an operation
does a getkey and then tries to modify the keyring it will fail on
Windows with a sharing violation. We need to modify all
keyring write operations to also take the ctrl and close the
cached_getkey_kdb handle to make writing work. See:
https://dev.gnupg.org/T3097

GnuPG-Bug-Id: T3097

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 years agoagent: Fix memory leaks.
NIIBE Yutaka [Tue, 30 May 2017 04:56:20 +0000 (13:56 +0900)]
agent: Fix memory leaks.

* agent/divert-scd.c (ask_for_card): Free WANT_KID and WANT_SN_DISP.
* agent/gpg-agent.c (create_server_socket): Free UNADDR.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: This towel should better detect a changed resolv.conf.
Werner Koch [Thu, 25 May 2017 18:26:54 +0000 (20:26 +0200)]
dirmngr: This towel should better detect a changed resolv.conf.

* dirmngr/dns-stuff.c (resolv_conf_changed_p): Fix initialization time
issue.
--

Fixes-commit: b5f356e9fba2d99909f8f54d7b7e6836bed87b68
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agodirmngr: Re-init libdns resolver on towel change of resolv.conf
Werner Koch [Thu, 25 May 2017 09:33:07 +0000 (11:33 +0200)]
dirmngr: Re-init libdns resolver on towel change of resolv.conf

* dirmngr/dns-stuff.c: Include sys/stat.h.
(RESOLV_CONF_NAME): New macro to replace a string.
(resolv_conf_changed_p): New.
(libdns_init): Call new function
(libdns_res_open): Ditto.
--

Don't panic.  This is a simple change
Suggested-by: Stefan B├╝hler <stbuehler@web.de>
to avoid complicated if-up.d hooks to reload resolv.conf.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoagent: Make digest algorithms for ssh fingerprints configurable.
Justus Winter [Wed, 24 May 2017 15:48:42 +0000 (17:48 +0200)]
agent: Make digest algorithms for ssh fingerprints configurable.

* agent/agent.h (opt): New field 'ssh_fingerprint_digest'.
* agent/command-ssh.c (data_sign, ssh_identity_register): Honor the
option for strings used to communicate with the user.
* agent/findkey.c (agent_modify_description): Likewise.
* agent/gpg-agent.c (cmd_and_opt_values): New value.
(opts): New option '--ssh-fingerprint-digest'.
(parse_rereadable_options): Set the default to MD5 for now.
(main): Handle the new option.
* doc/gpg-agent.texi: Document the new option.
--

OpenSSH has transitioned from using MD5 to compute key fingerprints to
SHA256.  This patch makes the digest used when communicating key
fingerprints to the user (e.g. in pinentry dialogs) configurable.
For now this patch conservatively defaults to MD5.

GnuPG-bug-id: 2106
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoagent: Write both ssh fingerprints to 'sshcontrol' file.
Justus Winter [Wed, 24 May 2017 15:29:31 +0000 (17:29 +0200)]
agent: Write both ssh fingerprints to 'sshcontrol' file.

* agent/command-ssh.c (add_control_entry): Hand in the key, write both
the MD5- and the SHA256-based fingerprint to the 'sshcontrol' file
when adding ssh keys.
(ssh_identity_register): Adapt callsite.

GnuPG-bug-id: 2106
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocommon: Correctly render SHA256-based ssh fingerprints.
Justus Winter [Wed, 24 May 2017 15:03:58 +0000 (17:03 +0200)]
common: Correctly render SHA256-based ssh fingerprints.

* common/ssh-utils.c (dummy_realloc): New function.
(dummy_free): Likewise.
(get_fingerprint): Prepend the fingerprint with the name of the digest
algorithm.  Correctly render SHA256-based ssh fingerprints.
* common/t-ssh-utils.c (sample_keys): Add SHA256 hashes for the keys.
(main): Add an option to dump the keys to gather fingerprints, also
print the SHA256 fingerprint for keys given as arguments, and check
the SHA256 fingerprints of the test keys.

GnuPG-bug-id: 2106
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocommon: Support different digest algorithms for ssh fingerprints.
Justus Winter [Fri, 4 Dec 2015 14:19:07 +0000 (15:19 +0100)]
common: Support different digest algorithms for ssh fingerprints.

* common/ssh-utils.c (get_fingerprint): Add and honor 'algo' parameter.
(ssh_get_fingerprint{,_string}): Likewise.
* common/ssh-utils.h (ssh_get_fingerprint{,_string}): Update prototypes.
* common/t-ssh-utils.c (main): Adapt accordingly.
* agent/command-ssh.c (agent_raw_key_from_file): Likewise.
(ssh_identity_register): Likewise.
* agent/command.c (do_one_keyinfo): Likewise.
* agent/findkey.c (modify_description): Likewise.
--
This lays the foundation to support other algorithms.

GnuPG-bug-id: 2106
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoRegister DCO for William L. Thomson Jr.
Justus Winter [Tue, 23 May 2017 13:47:29 +0000 (15:47 +0200)]
Register DCO for William L. Thomson Jr.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoagent: Add const qualifier for read-only table.
NIIBE Yutaka [Mon, 22 May 2017 21:42:44 +0000 (06:42 +0900)]
agent: Add const qualifier for read-only table.

* agent/call-pinentry.c (start_pinentry): Add const to tbl.
* agent/command-ssh.c (request_specs): Add const.
(ssh_key_types): Likewise.
(request_spec_lookup): Add const to the return value and SPEC.
(ssh_request_process): Likewise.
* agent/protect.c (protect_info): Add const.
(agent_unprotect): Add const to algotable.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: Fix default-key selection for signing, possibly by card.
NIIBE Yutaka [Mon, 22 May 2017 00:27:36 +0000 (09:27 +0900)]
g10: Fix default-key selection for signing, possibly by card.

* g10/call-agent.c (warn_version_mismatch): Revert.
(start_agent): Suppress version mismatch if relevant.
* g10/getkey.c (get_seckey_default_or_card): New.
* g10/skclist.c (build_sk_list): Use get_seckey_default_or_card.

--

The change of 97a2394, which prefers available card than default key
specified is too strong.

Fixes-commit: 97a2394ecafaa6f58e4a1f70ecfd04408dc15606
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodoc: Fix spellings.
Daniel Kahn Gillmor [Thu, 18 May 2017 20:34:37 +0000 (16:34 -0400)]
doc: Fix spellings.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agodocs: Point to https://dev.gnupg.org/ .
Daniel Kahn Gillmor [Thu, 18 May 2017 19:05:57 +0000 (15:05 -0400)]
docs: Point to https://dev.gnupg.org/ .

Replace mentions of bugs.gnupg.org with https://dev.gnupg.org/.  Since
the project has transitioned to a better workflow for supporting
contributions, we should ensure that our documentation points to the
right place.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agogpgscm: Fix checking for opcode arguments.
Justus Winter [Wed, 17 May 2017 14:10:37 +0000 (16:10 +0200)]
gpgscm: Fix checking for opcode arguments.

* tests/gpgscm/scheme.c (Eval_Cycle): Update 'pcd' after dispatching
an instruction.

Fixes-commit: 9c6407d17e0cb9f4a370b1b83e7816577ec7d29d
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Fix agent teardown in release builds.
Justus Winter [Wed, 17 May 2017 10:14:55 +0000 (12:14 +0200)]
tests: Fix agent teardown in release builds.

* tests/openpgp/defs.scm (start-agent,stop-agent): Use gpg-conf which
will properly use the '--build-prefix' argument to make gpgconf use
tools from the build directory.

GnuPG-bug-id: 3165
Fixes-commit: 2c9d9ac55ea455a5ec26428989dced0311ed46cc
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agog10: Fix gpgcompose.c.
NIIBE Yutaka [Wed, 17 May 2017 01:14:43 +0000 (10:14 +0900)]
g10: Fix gpgcompose.c.

* g10/gpgcompose.c (show_help): Check return value.

--

Fixes-commit: 00b7767bc6fe309aa20375c859ebf708cfc7b9ea
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: Suppress error for card availability check.
NIIBE Yutaka [Wed, 17 May 2017 00:46:06 +0000 (09:46 +0900)]
g10: Suppress error for card availability check.

* g10/call-agent.c (start_agent): Add semantics for card; Suppress
error for card check.
(warn_version_mismatch): Ignore an error for scdaemon.
(agent_scd_serialno): Call start_agent with
FLAG_FOR_CARD_SUPPRESS_ERRORS.

--

GnuPG-bug-id: 3165
Fixes-commit: 97a2394ecafaa6f58e4a1f70ecfd04408dc15606
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agotests: Configure the environments to use scdaemon from build tree.
Justus Winter [Tue, 16 May 2017 14:07:25 +0000 (16:07 +0200)]
tests: Configure the environments to use scdaemon from build tree.

* tests/gpgme/gpgme-defs.scm: Use the scdaemon from the build tree
when writing a 'gpg-agent.conf'.
* tests/gpgsm/gpgsm-defs.scm: Likewise.
* tests/openpgp/defs.scm: Likewise.
--

As of 97a2394ecafaa6f58e4a1f70ecfd04408dc15606 gpg may query the
scdaemon for a signing key to use.  To make sure that the agent calls
the right scdaemon, we provide the path explicitly in the
'gpg-agent.conf' that is used in the tests, similar to what we do for
the agent itself and the pinentry.

GnuPG-bug-id: 3165
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoPost release updates
Werner Koch [Mon, 15 May 2017 15:21:58 +0000 (17:21 +0200)]
Post release updates

--

2 years agoRelease 2.1.21 gnupg-2.1.21
Werner Koch [Mon, 15 May 2017 14:11:09 +0000 (16:11 +0200)]
Release 2.1.21

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopo: Auto-update
Werner Koch [Mon, 15 May 2017 14:04:06 +0000 (16:04 +0200)]
po: Auto-update

--

2 years agopo: Update German translation
Werner Koch [Mon, 15 May 2017 14:00:37 +0000 (16:00 +0200)]
po: Update German translation

2 years agogpg: Do not mark ", " translatable.
Werner Koch [Mon, 15 May 2017 13:56:46 +0000 (15:56 +0200)]
gpg: Do not mark ", " translatable.

* g10/tofu.c (ask_about_binding): Remove useless translation markers.
--

Translation and in particular punctuation marks can only be translated
with context.  Thus making a sole comma translatable is useless.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agodirmngr,w32: Fix ldap crl read on windows
Andre Heinecke [Wed, 26 Apr 2017 07:39:06 +0000 (09:39 +0200)]
dirmngr,w32: Fix ldap crl read on windows

Summary:
* dirmngr/ldap-wrapper-ce.c (outstream_cookie_s): Add buffer_read_pos.
(buffer_get_data): Use seperate read pos.

--
Using a single buffer pos for reading and writing caused the read
to return 0 as it read from the end of the buffer. Now we use
a seperate reader position.

Differential: D427

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 years agocommon: Let format_text return an error.
Werner Koch [Mon, 15 May 2017 07:58:27 +0000 (09:58 +0200)]
common: Let format_text return an error.

* common/stringhelp.c (format_text): Return NULL on error.
* common/t-stringhelp.c (test_format_text): Adjust for change.
* g10/gpgcompose.c (show_help): Abort on out of core.
* g10/tofu.c (ask_about_binding): Abort on format_text error.
(show_statistics): Ditto.
(show_warning): Ditto.
--

For better re-usability function in common/ shot  better not use
xmalloc functions.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotests: Also run all OpenPGP tests using keyrings.
Justus Winter [Thu, 11 May 2017 15:17:12 +0000 (17:17 +0200)]
tests: Also run all OpenPGP tests using keyrings.

* tests/openpgp/all-tests.scm: Run each test twice, once with public
keys stored in a keybox, once with a keyring.
* tests/openpgp/defs.scm (create-gpghome): Create a public keyring to
make GnuPG use that instead of creating a keybox if '--use-keyring' is
given.
* tests/openpgp/setup.scm: Fix flag handling and usage.
--

This parametrizes the OpenPGP tests.  With this change, the test suite
is able to detect problems with the keyring store, e.g. like the one
fixed in 22739433e98be80e46fe7d01d52a9627c1aebaae.

GnuPG-bug-id: 3080
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Make it possible to run all tests using our infrastructure.
Justus Winter [Mon, 20 Mar 2017 09:30:08 +0000 (10:30 +0100)]
tests: Make it possible to run all tests using our infrastructure.

* Makefile.am (TESTS_ENVIRONMENT): New variable.
(check-all): New phony target to run all tests.
* tests/gpgme/gpgme-defs.scm (have-gpgme?): New function that tests
whether the GPGME test suite is available instead of exiting the
process.
* tests/gpgscm/init.scm (export): New macro.
* tests/gpgscm/tests.scm (run-tests): New function.
(load-tests): Likewise.
* tests/gpgme/run-tests.scm: Simplify and move the parsing of the list
of tests to 'all-tests.scm'.
* tests/gpgsm/run-tests.scm: Likewise.
* tests/migrations/run-tests.scm: Likewise.
* tests/openpgp/run-tests.scm: Likewise.
* tests/gpgme/Makefile.am: To select the tests to run, use the
variable 'TESTS'.  This harmonizes the interface with the automake
test suite.
* tests/gpgsm/Makefile.am: Likewise.
* tests/migrations/Makefile.am: Likewise.
* tests/openpgp/Makefile.am: Likewise.
* tests/openpgp/README: Likewise.
* agent/all-tests.scm: New file.
* common/all-tests.scm: Likewise.
* g10/all-tests.scm: Likewise.
* g13/all-tests.scm: Likewise.
* tests/gpgme/all-tests.scm: Likewise.
* tests/gpgsm/all-tests.scm: Likewise.
* tests/migrations/all-tests.scm: Likewise.
* tests/openpgp/all-tests.scm: Likewise.
* tests/run-tests.scm: Likewise.
--

This change allows us to run all tests in parallel and write one XML
report capturing the results of every test.  It also lays the
foundation to parametrize test suites.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Move the makefile parser.
Justus Winter [Mon, 20 Mar 2017 09:21:06 +0000 (10:21 +0100)]
tests: Move the makefile parser.

* tests/gpgme/gpgme-defs.scm (parse-makefile, parse-makefile-expand):
Move...
* tests/gpgscm/makefile.scm: ... here.
* tests/gpgscm/Makefile.am (EXTRA_DIST): Add new file.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Make it possible to set the logfile name.
Justus Winter [Thu, 11 May 2017 12:44:33 +0000 (14:44 +0200)]
gpgscm: Make it possible to set the logfile name.

* tests/gpgscm/tests.scm (test): Only set the default log filename
when it has not been set before.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agodoc: Fix name of program.
Justus Winter [Thu, 11 May 2017 07:51:58 +0000 (09:51 +0200)]
doc: Fix name of program.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoRegister DCO for Ineiev.
NIIBE Yutaka [Wed, 10 May 2017 03:15:23 +0000 (12:15 +0900)]
Register DCO for Ineiev.

--

Real name is confirmed by private mail.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10, sm, dirmngr, common: Add comment for fall through.
NIIBE Yutaka [Wed, 10 May 2017 02:01:15 +0000 (11:01 +0900)]
g10, sm, dirmngr, common: Add comment for fall through.

* common/b64dec.c (b64dec_proc): Comment to clarify.
* dirmngr/cdblib.c (cdb_make_put): Use same pattern to clarify.
* dirmngr/dirmngr-client.c (read_pem_certificate): Likewise.
* dirmngr/ks-engine-hkp.c (ks_hkp_get): Likewise.
* g10/armor.c (unarmor_pump): Likewise.
* g10/gpg.c (main): Likewise.
* g10/import.c (read_block): Likewise.
* g10/keygen.c (make_backsig): Likewise.
* g10/pkclist.c (check_signatures_trust):  Likewise.
* sm/gpgsm.c (main): Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: Stop compiler warning for t-stutter.
NIIBE Yutaka [Wed, 10 May 2017 01:58:31 +0000 (10:58 +0900)]
g10: Stop compiler warning for t-stutter.

* g10/t-stutter.c (do_test): Refer current_test_group_failed.

--

Since this test does not follow the framework of TEST/TEST_P/ABORT,
the variable is not used.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agogpg: Properly account for ring trust packets.
Justus Winter [Mon, 8 May 2017 12:24:00 +0000 (14:24 +0200)]
gpg: Properly account for ring trust packets.

* g10/keyring.c (keyring_get_keyblock): Use the parser's packet count
instead of counting ourself.
* g10/packet.h (struct parse_packet_ctx_s): New field
'n_parsed_packets'.
(init_parse_packet): Initialize new field.
* g10/parse-packet.c (parse): Count packets.
--

The 'keyring' keystore depends on the number of packets for delete and
update operations.  With the rework of the ring trust packets, the
trust packets were no longer properly accounted for leading to keyring
corruptions.

The 'keybox' store was not affected.

GnuPG-bug-id: 3123
GnuPG-bug-id: 3135
GnuPG-bug-id: 3144
Fixes-commit: a8895c99a7d0750132477d80cd66caaf3a709113
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpg: Fix typo.
Justus Winter [Mon, 8 May 2017 11:52:39 +0000 (13:52 +0200)]
gpg: Fix typo.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Clarify comments.
Justus Winter [Mon, 8 May 2017 10:37:20 +0000 (12:37 +0200)]
tests: Clarify comments.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agodoc: Fix documentation.
Justus Winter [Mon, 8 May 2017 10:18:19 +0000 (12:18 +0200)]
doc: Fix documentation.

--
Fixes-commit: da4db172f6f8fb254b770e59770c531a488e2400
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Support tests that are expected to fail.
Justus Winter [Thu, 4 May 2017 13:12:49 +0000 (15:12 +0200)]
tests: Support tests that are expected to fail.

* tests/gpgscm/tests.scm (test-pool): Rework reporting.  Filter using
the computed test status instead of the return value.  Also print the
new categories 'failed expectedly' and 'passed unexpectedly'.
(test): If a test ends with a bang (!), it is expected to fail.  Adapt
status, status-string, and xml accordingly.
--

Allow tests to be marked as being expected to fail by appending a bang
(!) to the tests name.  If such a test fails, it will not be counted
as failure, but will still be prominently displayed in the report.  If
it succeeds unexpectedly, this is counted as a failure.

Fixes T3134.

GnuPG-bug-id: 3134
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Add function to dump packets.
Justus Winter [Thu, 4 May 2017 12:24:50 +0000 (14:24 +0200)]
tests: Add function to dump packets.

* tests/openpgp/defs.scm (gpg-dump-packets): New function.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agospeedo,w32: Fix silent user mode installation
Andre Heinecke [Wed, 3 May 2017 14:28:24 +0000 (16:28 +0200)]
speedo,w32: Fix silent user mode installation

* build-aux/speedo/w32/inst.nsi (AddToPath): Move account
check here.
(PrintNonAdminWarning): Remove is_user_install variable.

--
The PrintNonAdminWarning is not called in silent mode so the
variable was never set.

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 years agogpgscm: Create and re-use frame objects.
Justus Winter [Thu, 6 Apr 2017 09:52:36 +0000 (11:52 +0200)]
gpgscm: Create and re-use frame objects.

* tests/gpgscm/scheme-private.h (struct scheme): New field
'frame_freelist'.
* tests/gpgscm/scheme.c (enum scheme_types): New type 'T_FRAME'.
(type_to_string): Handle new type.
(settype): New macro.
(gc_disable): Make sure there is at least one frame in the free list.
(mark): Handle frame objects.
(finalize_cell): Likewise.
(dump_stack_initialize): Initialize free list.
(dump_stack_free): Simplify.
(frame_length): New variable.
(dump_stack_make_frame): New function.
(frame_slots): Likewise.
(frame_payload): New macro.
(dump_stack_allocate_frame): New function.
(dump_stack_deallocate_frame): Likewise.
(dump_stack_preallocate_frame): Likewise.
(_s_return): Unpack frame object and deallocate it.
(s_save): Wrap state in an frame object.
(dump_stack_mark): Mark the free list.
--

TinySCHEME being a SECD-machine needs to push frames onto the dump
stack.  Previously, the dump stack was a list.  This required four
cells for the spine, as well as up to one additional cell to encode
the current opcode.  This was quite inefficient despite the fact that
we recovered the spine as well as the integer cell.

We introduce frame objects, which are a special variant of vectors of
length four.  Since the length is fixed, this frees up the length
field of the vector object to store the unboxed opcode.  A frame
object now fits in two cells.

Saving two or three cells is a mere byproduct, the performance gain
comes from increased locality, unboxed opcode representation, and the
ability to easily put the objects in a free list, keeping the garbage
collector out of the continuous motion of the virtual machine.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Merge opexe_0.
Justus Winter [Wed, 5 Apr 2017 15:30:44 +0000 (17:30 +0200)]
gpgscm: Merge opexe_0.

* tests/gpgscm/scheme-private.h (struct scheme): Remove field 'op'.
* tests/gpgscm/scheme.c (opexe_0): Inline into 'Eval_Cycle'.
(_Error_1): Return the opcode to evaluate next.
(Error_1): Do not return, but set the opcode and goto dispatch.
(Error_0): Likewise.
(s_goto): Likewise.
(s_return): Likewise.
(s_return_enable_gc): Likewise.
(s_thread_to): Remove superfluous cast.
(_s_return): Return the opcode to evaluate next.
(scheme_init_custom_alloc): Adapt to removal of field 'op'.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agospeedo,w32: Allow installation as normal user
Andre Heinecke [Wed, 3 May 2017 12:40:16 +0000 (14:40 +0200)]
speedo,w32: Allow installation as normal user

* build-aux/speedo/w32/g4wihelp.c (ENV_HK_USER, ENV_REG_USER):
New defines.
(path_add): Handle is_user_install variable. Don't abort
if Path reg key does not exist. Fix crash if Path reg key
does not contain a semicolon.
(path_remove): Handle is_user_install variable. Fix crash
if Path reg key does not exist.
* build-aux/speedo/w32/inst.nsi: Remove obsolete HAVE_STARTMENU
this was double guarded with WITH_GUI. Add Multiuser plugin and
defines for this. Use SHCTX instead of HKLM / HKCU.
(PrintNonAdminWarning): Only Warn and don't abort.

--
The default is still to install as Adminstrator system wide
but the user now has the option to explicitly install GnuPG without
Administrator rights. A warning will be shown in that case but
a user may continue.

A per user install is by default under %LOCALAPPDATA%\GnuPG

Related Task: T2971

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 years agog10: Remove skeleton options files.
Daniel Kahn Gillmor [Mon, 17 Apr 2017 14:51:55 +0000 (10:51 -0400)]
g10: Remove skeleton options files.

* build-aux/speed/w32/inst.nsi: stop installing skeleton files.
* doc/gpg.texi: stop documenting skeleton files.
* g10/Makefile.am: stop installing skeleton files.
* g10/openfile.c (copy_options_file): Remove.
(try_make_homedir): do not call copy_options_file.

--

The defaults for gpg and dirmngr are good.  Both programs should work
fine for the simple case without any config file.  The skeleton config
files were being copied at first use (when the defaults are fine).
But when the user needs to fiddle with them (after they've become
sophisticated users), they're likely out of date because gpg has been
upgraded since then.  So they're used for documentation, but they're
stale documentation, which is probably worse than a clean empty file.

GnuPG-bug-id: 3086
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agoSpelling fixes in docs and comments.
NIIBE Yutaka [Fri, 28 Apr 2017 01:06:33 +0000 (10:06 +0900)]
Spelling fixes in docs and comments.

--

In addition, fix trailing spaces in tests/inittests.

GnuPG-bug-id: 3121
Reported-by: ka7 (klemens)
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: For signing, prefer available card key when no -u option.
NIIBE Yutaka [Thu, 27 Apr 2017 01:33:58 +0000 (10:33 +0900)]
g10: For signing, prefer available card key when no -u option.

* g10/skclist.c (build_sk_list): Ask gpg-agent if card is available.
Then, use the card key if any.

--

GnuPG-bug-id: 1983
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: Minor clean up.
NIIBE Yutaka [Wed, 26 Apr 2017 02:39:28 +0000 (11:39 +0900)]
g10: Minor clean up.

* g10/main.h (complete_sig): Remove declaration.
* g10/sign.c (complete_sig): Make it static.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: Fix aliasing problem in dns.c.
NIIBE Yutaka [Tue, 25 Apr 2017 12:00:41 +0000 (21:00 +0900)]
dirmngr: Fix aliasing problem in dns.c.

* dirmngr/dns.c (dns_ai_setent): Care about aliasing.

--

Co-authored-by: Tomas Mraz
GnuPG-bug-id: 3105
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agotests: Remove *.conf.tmpl from Makefile.
NIIBE Yutaka [Tue, 25 Apr 2017 02:39:59 +0000 (11:39 +0900)]
tests: Remove *.conf.tmpl from Makefile.

* tests/openpgp/Makefile.am (TEST_FILES): Remove gpg.conf.tmpl
and gpg-agent.conf.tmpl.

--

Fixes-commit: 06a177ceea529269a7404740c60416bd6a4567b1
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: invalidate the fd cache for keyring.
NIIBE Yutaka [Mon, 24 Apr 2017 22:48:51 +0000 (07:48 +0900)]
g10: invalidate the fd cache for keyring.

* g10/keyring.c (keyring_search_reset): Don't keep the FD cache.

--

GnuPG-bug-id: 3096
Fixes-commit: 5556eca5acd46983bff0b38a1ffbc2f07fbaba9f
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agow32: Enable wildcard expansion with mingw-w64
Andre Heinecke [Tue, 12 Aug 2014 19:22:23 +0000 (21:22 +0200)]
w32: Enable wildcard expansion with mingw-w64

* g10/gpg.c: Define _dowildcard = -1;

--
If this value is defined wildcard support in the c runtime
is enabled again. This fixes a regression caused by switching to
mingw 3.0

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 years agotests: Fix Python detection.
Justus Winter [Mon, 24 Apr 2017 15:32:41 +0000 (17:32 +0200)]
tests: Fix Python detection.

* tests/gpgme/gpgme-defs.scm (python): Fix Python detection.
--
In 25e6444b3f4601c7821beab06bc4520deacb007b we changed the way GPGME
creates the build directory for the Python bindings.  We now use the
basename of the interpreter as an identifier, that means we have to
get the base name right, a link to the same binary is not sufficient.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Refactor cell finalization.
Justus Winter [Thu, 20 Apr 2017 15:39:41 +0000 (17:39 +0200)]
gpgscm: Refactor cell finalization.

* tests/gpgscm/scheme.c (finalize_cell): Use switch, return whether
the cell may be freed.
(gc): Update callsite.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Tweak error message display.
Justus Winter [Thu, 20 Apr 2017 15:38:43 +0000 (17:38 +0200)]
gpgscm: Tweak error message display.

* tests/gpgscm/init.scm (throw'): If the first argument to the error
is a string, display it as such.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Deduplicate and simplify code.
Justus Winter [Thu, 20 Apr 2017 15:35:15 +0000 (17:35 +0200)]
tests: Deduplicate and simplify code.

* tests/gpgme/gpgme-defs.scm (create-file): Move...
* tests/gpgsm/gpgsm-defs.scm (create-file): ... likewise...
* tests/openpgp/defs.scm (create-file): Here.
(create-gpghome): Use 'create-file'.
* tests/openpgp/gpg-agent.conf.tmpl: Delete file.
* tests/openpgp/gpg.conf.tmpl: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Fix test.
Justus Winter [Thu, 20 Apr 2017 15:32:25 +0000 (17:32 +0200)]
gpgscm: Fix test.

* tests/gpgscm/t-child.scm: Use 'string-length' on the string.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Improve syntax checking.
Justus Winter [Thu, 20 Apr 2017 13:09:13 +0000 (15:09 +0200)]
gpgscm: Improve syntax checking.

* tests/gpgscm/scheme.c (opexe_0): Make sure closure arguments are
symbols.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Emit JUnit-style XML reports.
Justus Winter [Tue, 18 Apr 2017 16:51:06 +0000 (18:51 +0200)]
gpgscm: Emit JUnit-style XML reports.

* tests/gpgscm/Makefile.am (EXTRA_DIST): Add new file.
* tests/gpgscm/lib.scm (string-translate): New function.
* tests/gpgscm/main.c (main): Load new file.
* tests/gpgscm/tests.scm (dirname): New function.
(test-pool): Record execution times, emit XML report.
(test): Record execution times, record log file name, emit XML report.
(run-tests-parallel): Write XML report.
(run-tests-sequential): Likewise.
* tests/gpgscm/xml.scm: New file.
* tests/gpgme/Makefile.am (CLEANFILES): Add 'report.xml'.
* tests/gpgsm/Makefile.am: Likewise.
* tests/migrations/Makefile.am: Likewise.
* tests/openpgp/Makefile.am: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Make logging less verbose and more useful.
Justus Winter [Thu, 20 Apr 2017 09:49:17 +0000 (11:49 +0200)]
gpgscm: Make logging less verbose and more useful.

* tests/gpgscm/tests.scm (call-with-io): When being verbose, include
the pid in the output, and avoid duplicating the command arguments.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Make test framework less functional.
Justus Winter [Tue, 18 Apr 2017 10:27:49 +0000 (12:27 +0200)]
gpgscm: Make test framework less functional.

* tests/gpgscm/tests.scm (test-pool, tests): Previously, these methods
updated objects by creating new updated copies of the object being
manipulated.  This made the code awkward without any benefit,
therefore I change it to just update the object.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Locate resources and scripts relative to top source dir.
Justus Winter [Wed, 22 Mar 2017 11:40:42 +0000 (12:40 +0100)]
tests: Locate resources and scripts relative to top source dir.

--

Locate every resource and every script used in the tests using a path
relative to the top of the source tree.

This is a purely mechanical change, mostly done using regular
expressions, with a few manual fixups here and there.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Move 'trace' and 'stringify'.
Justus Winter [Wed, 19 Apr 2017 14:09:44 +0000 (16:09 +0200)]
gpgscm: Move 'trace' and 'stringify'.

* tests/gpgscm/tests.scm (trace, stringify): Move...
* tests/gpgscm/lib.scm: ... here.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgscm: Avoid fruitless garbage collection cycles.
Justus Winter [Thu, 20 Apr 2017 13:04:52 +0000 (15:04 +0200)]
gpgscm: Avoid fruitless garbage collection cycles.

* tests/gpgscm/scheme-private.h (CELL_MINRECOVER): New macro.
* tests/gpgscm/scheme.c (_get_cell): Move the heuristic to get more
cells...
(gc): ... here where every caller benefits from the optimization.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agog13: Fix for Solaris.
NIIBE Yutaka [Thu, 20 Apr 2017 11:43:29 +0000 (20:43 +0900)]
g13: Fix for Solaris.

* configure.ac: Check sys/mkdev.h.
* g13/sh-dmcrypt.c: Include sys/mkdev.h.

--

GnuPG-bug-id: 3098
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: Fix final close of LISTEN_FD.
NIIBE Yutaka [Tue, 18 Apr 2017 00:04:11 +0000 (09:04 +0900)]
dirmngr: Fix final close of LISTEN_FD.

* dirmngr/dirmngr.c (handle_connections): Close LISTEN_FD.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: Fix API difference for Windows.
NIIBE Yutaka [Tue, 18 Apr 2017 00:03:14 +0000 (09:03 +0900)]
dirmngr: Fix API difference for Windows.

* dirmngr/http.c (read_server, write_server): Use assuan_fd_t.
(http_wait_response): Use FD2INT to get unsigned integer fd.
(read_server, write_server): Likewise.
(simple_cookie_read, simple_cookie_write): Use assuan_fd_t.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agoagent: More minor change.
NIIBE Yutaka [Mon, 17 Apr 2017 11:03:36 +0000 (20:03 +0900)]
agent: More minor change.

* agent/command.c (cmd_pksign): Remove redundant assignment.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agoagent: Minor cleanup.
NIIBE Yutaka [Mon, 17 Apr 2017 07:43:36 +0000 (16:43 +0900)]
agent: Minor cleanup.

* agent/command-ssh.c (ssh_key_to_protected_buffer): Not touch ERR.
* agent/command.c (cmd_genkey, cmd_import_key): Clean up.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agotests: Minor memory fix.
NIIBE Yutaka [Mon, 17 Apr 2017 00:44:37 +0000 (09:44 +0900)]
tests: Minor memory fix.

* tests/openpgp/fake-pinentry.c (get_passphrase): Free the memory.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: Fix parse_ring_trust.
NIIBE Yutaka [Mon, 17 Apr 2017 00:33:19 +0000 (09:33 +0900)]
g10: Fix parse_ring_trust.

* g10/parse-packet.c (parse_ring_trust): Fix condition.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: Minor fixes.
NIIBE Yutaka [Mon, 17 Apr 2017 00:15:13 +0000 (09:15 +0900)]
g10: Minor fixes.

* g10/export.c (cleartext_secret_key_to_openpgp): No initialization.
(do_export_one_keyblock): Initialize with GPG_ERR_NOT_FOUND.
* g10/getkey.c (get_best_pubkey_byname): Add non-null check.
* g10/tofu.c (tofu_set_policy): ERR initialize to 0.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: Fix import/export filter property match.
NIIBE Yutaka [Mon, 17 Apr 2017 00:08:31 +0000 (09:08 +0900)]
g10: Fix import/export filter property match.

* g10/import.c (impex_filter_getval): Fix to "else if".

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agoagent: Clean up error initialize/return.
NIIBE Yutaka [Fri, 14 Apr 2017 03:54:06 +0000 (12:54 +0900)]
agent: Clean up error initialize/return.

* agent/call-pinentry.c (start_pinentry): Return RC.
* agent/command-ssh.c (ssh_handler_request_identities): Don't set ERR.
* agent/findkey.c (try_unprotect_cb): Return ERR.
(unprotect): Don't set RC.
* agent/gpg-agent.c (handle_connections): Don't set fd.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: More fix for test program.
NIIBE Yutaka [Fri, 14 Apr 2017 00:18:41 +0000 (09:18 +0900)]
dirmngr: More fix for test program.

* dirmngr/t-http.c (main): Care about no TLS.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: More fix for Windows.
NIIBE Yutaka [Thu, 13 Apr 2017 23:32:49 +0000 (08:32 +0900)]
dirmngr: More fix for Windows.

* dirmngr/http.c (simple_cookie_read, simple_cookie_write): Only
valid with HTTP_USE_NTBTLS.
(_my_socket_new): Simply cast to int since it's for debug.
(_my_socket_ref, _my_socket_unref): Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: Fix http.c for sockaddr_storage.
NIIBE Yutaka [Thu, 13 Apr 2017 05:46:57 +0000 (14:46 +0900)]
dirmngr: Fix http.c for sockaddr_storage.

dirmngr/http.c (use_socks): Use sockaddr_storage.
(my_sock_new_for_addr, connect_server): Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: Fix alignment of ADDR.
NIIBE Yutaka [Thu, 13 Apr 2017 05:33:33 +0000 (14:33 +0900)]
dirmngr: Fix alignment of ADDR.

* dirmngr/dns-stuff.h (dns_addrinfo_s): Use struct sockaddr_storage
for size and alignment.
* dirmngr/dns-stuff.c (resolve_name_libdns): Follow the change.
(resolve_dns_name): Use struct sockaddr_storage.
(resolve_addr_standard, resolve_dns_addr): Likewise.
(resolve_dns_addr): Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: Fix thread key type.
NIIBE Yutaka [Thu, 13 Apr 2017 04:06:38 +0000 (13:06 +0900)]
dirmngr: Fix thread key type.

* dirmngr/dirmngr.c (my_tlskey_current_fd): Use npth_key_t.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agocommon, g10: Fix enumeration types.
NIIBE Yutaka [Thu, 13 Apr 2017 03:54:52 +0000 (12:54 +0900)]
common, g10: Fix enumeration types.

* common/openpgpdefs.h (CIPHER_ALGO_PRIVATE10, PUBKEY_ALGO_PRIVATE10)
(DIGEST_ALGO_PRIVATE10, COMPRESS_ALGO_PRIVATE10): New.
* g10/misc.c (map_pk_gcry_to_openpgp): Add type conversion.
(map_cipher_openpgp_to_gcry, openpgp_cipher_algo_name)
(openpgp_pk_test_algo2, map_md_openpgp_to_gcry)
(pubkey_get_npkey): Add default handling.

--

Compilers may emit code assuming the maximum value of enum type.
According to OpenPGP specification, there are cases for private uses.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: More fix for Windows.
NIIBE Yutaka [Thu, 13 Apr 2017 00:52:19 +0000 (09:52 +0900)]
dirmngr: More fix for Windows.

* dirmngr/dns.c (socket_fd_t, STDCALL): New.
(dns_te_initname): Use.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: Fix type of sock.
NIIBE Yutaka [Wed, 12 Apr 2017 11:50:50 +0000 (20:50 +0900)]
dirmngr: Fix type of sock.

* dirmngr/http.c (send_request): Use assuan_fd_t for SOCK.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agotools: Fix condition for gpg-connect-agent.
NIIBE Yutaka [Wed, 12 Apr 2017 07:01:16 +0000 (16:01 +0900)]
tools: Fix condition for gpg-connect-agent.

* tools/gpg-connect-agent.c (start_agent): Add paren.

--

The intention is comparing the error code depending opt.use_dirmngr.
Considering C Operator Precedence, we should have paren here.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agodirmngr: Fix possible null reference.
NIIBE Yutaka [Wed, 12 Apr 2017 06:58:11 +0000 (15:58 +0900)]
dirmngr: Fix possible null reference.

* dirmngr/dns.c (dns_error_t dns_trace_fput): Check NULL.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agocommon: Simplify format_text.
NIIBE Yutaka [Wed, 12 Apr 2017 05:47:30 +0000 (14:47 +0900)]
common: Simplify format_text.

* common/stringhelp.c (format_text): Don't allow IN_PLACE formatting.
* common/stringhelp.h: Change the API with no IN_PLACE.
* common/t-stringhelp.c (test_format_text): Follow the change.
* g10/gpgcompose.c (show_help): Likewise.
* g10/tofu.c (format_conflict_msg_part1, ask_about_binding)
(show_statistics, show_warning): Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>