Commit Graph

8386 Commits

Author SHA1 Message Date
Andre Heinecke 0b7088dc80 speedo, w32: Add w32-wixlib target for MSI package
* Makefile.am (EXTRA_DIST): Add wixlib.wxs
* build-aux/speedo.mk (w32-wixlib): New target.
(w32-release): Build wixlib if WIXPREFIX is set.
(help): Add documentation.
* build-aux/speedo/w32/wixlib.wxs

--
This build a wixlib of the Windows binaries of GnuPG.
A wixlib is a module that can be linked into another
wix project to create an installer including this
module. Gpg4win uses the wixlib from GnuPG for
it's MSI Package.

To build the wixlib you need wine with wine-mono installed
and the wixtoolset.

When calling speedo set the variable WIXPREFIX to
the location containing the extracted toolset.

e.g.:

    make -f build-aux/speedo.mk w32-wixlib WIXPREFIX=~/wix
2019-08-08 13:08:22 +02:00
Werner Koch 4964691861 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>
(cherry picked from commit e6901c2bc8)
2019-08-08 13:05:23 +02:00
NIIBE Yutaka 100642e776 scd: Remove fallback mechanism to PC/SC.
* scd/apdu.c [HAVE_LIBUSB] (apdu_open_reader): Simply let it fail.

GnuPG-bug-id: 4673
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-08-07 08:50:19 +09:00
NIIBE Yutaka bb82ad018a agent: Fix an error path of agent_get_confirmation.
* agent/call-pinentry.c (agent_get_confirmation): Make sure
unlock_pinentry is always called.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-08-07 05:38:30 +09:00
NIIBE Yutaka f588dd8d17 common: Fix line break handling, finding a space.
* common/name-value.c (assert_raw_value): Correctly find a space.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-08-06 13:14:58 +09:00
NIIBE Yutaka d8a49bbcd1 gpg: Don't report NO_SECKEY for valid key.
* g10/mainproc.c (proc_encrypted): Report status of STATUS_NO_SECKEY
only when some error occurred.

--

Fixes-commit: 6cc4119ec0
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-08-06 11:12:07 +09:00
NIIBE Yutaka ef2424144a sm: Support AES-256 key.
* sm/decrypt.c (prepare_decryption): Handle a case for AES-256.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-08-05 10:15:08 +09:00
NIIBE Yutaka 15fe78184c sm: Fix error checking of decryption result.
* sm/call-agent.c (gpgsm_agent_pkdecrypt): Fix condition.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-26 10:03:36 +09:00
Daniel Kahn Gillmor 3ba091ab8c gpg,gpgsm: Handle pkdecrypt responses with/without NUL terminators.
* g10/call-agent.c (agent_pkdecrypt): accept but do not require
NUL-terminated data from the agent.
* sm/call-agent.c (gpgsm_agent_pkdecrypt): accept but do not require
NUL-terminated data from the agent.

GnuPG-bug-id: 4652
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-07-26 09:53:33 +09:00
NIIBE Yutaka fd9e6ae22e gpg: photoid: Use standard spawn API.
* g10/photoid.c (exec_write, exec_read, exec_finish): Remove.
(setup_input_file): Rename from make_tempdir.
(expand_args): Drop support of 'o' and 'O'.
(fill_command_argv, run_with_pipe, create_temp_file) New.
(show_photo): New with gnupg_spawn_process_fd and gnupg_wait_process.
(show_photos): Call show_photo.

GnuPG-bug-id: 4362
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-25 11:41:37 +09:00
NIIBE Yutaka c57c5004ec gpg: photoid: Move functions from exec.c.
* g10/exec.c (w32_system): Expose to public.
(exec_write, exec_read, exec_finish, make_tempdir, expand_args): Move
to photoid.c.
* g10/exec.h: Likewise.
* g10/photoid.c (exec_write, exec_read, exec_finish, make_tempdir)
(expand_args): Move here.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-25 11:21:58 +09:00
NIIBE Yutaka 996c497a86 scd: Handle CCID bwi of time extension.
* scd/ccid-driver.c (bulk_in): Increase timeout by the multiplier
value as defined section 6.2.6 in CCID specification.

--

For TPDU level transfer, it was handled.  This is fix for APDU level
transfer.

GnuPG-bug-id: 4646
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-25 09:16:46 +09:00
NIIBE Yutaka 858dc95643 scd: Fix bBWI value.
* scd/ccid-driver.c (ccid_transceive_apdu_level): Use bBWI=0 for APDU
level transfer.
(ccid_transceive): Use bBWI=0 or the value returend by WTX for TPDU
level transfer.

GnuPG-bug-id: 4654
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-25 09:15:12 +09:00
NIIBE Yutaka 044379772f common: Fix the previous commit.
* common/asshelp.c [HAVE_W32_SYSTEM] (start_new_gpg_agent): Use
gnupg_spawn_process_detached.
(start_new_dirmngr): Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-24 15:32:13 +09:00
NIIBE Yutaka b1c56cf9e2 common: Use gnupg_spawn_process_fd to invoke gpg-agent/dirmngr.
* common/asshelp.c (start_new_gpg_agent): Call gnupg_spawn_process_fd
and gnupg_wait_process.
(start_new_dirmngr): Likewise.

--

With --daemon option, gpg-agent/dirmngr detaches by itself.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-24 15:15:32 +09:00
NIIBE Yutaka a64411c607 common,w32: Fix cast from gnupg_fd_t to call _open_osfhandle.
* common/sysutils.c (translate_sys2libc_fd): Use intptr_t.
(gnupg_tmpfile): Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-24 14:27:47 +09:00
NIIBE Yutaka 7bfbb9fa7e gpg: A little clean up.
* g10/keyserver.c: Don't include exec.h.
* g10/photoid.c (image_type_to_string): It's constant.
* g10/photoid.h (image_type_to_string): Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-23 12:04:21 +09:00
NIIBE Yutaka 13bc0431ff scd: Error code map fix for older Yubikey.
* scd/iso7816.c (map_sw): Recognize 6A86.

Fixes-commit: ec56996029
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-22 10:14:21 +09:00
NIIBE Yutaka fcd766719a gpg: The option --passphrase= can be empty.
* g10/gpg.c (opts): Use ARGPARSE_o_s for oPassphrase to allow
empty string.

GnuPG-bug-id: 4633
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-19 17:17:15 +09:00
NIIBE Yutaka 98f4eff7ff card: Fix showing KDF object attribute.
* g10/call-agent.c (learn_status_cb): Parse the KDF DO.
* g10/card-util.c (current_card_status): Show it correctly.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-19 13:26:49 +09:00
NIIBE Yutaka 57565d5f97 scd: Support "[CHV3]" attribute for keyid string.
* scd/app-openpgp.c (check_keyidstr0: Relax the check.

Fixes-commit: b0f0791e4a
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-19 13:23:59 +09:00
NIIBE Yutaka 9c0cd9d075 card: Support disabling KDF functionality.
* g10/card-util.c (kdf_setup): Can be "off".

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-19 13:23:54 +09:00
Werner Koch e07584b523
doc: Fix a debug hint on the keybox format.
--
2019-07-18 14:11:55 +02:00
Werner Koch 824ca6f042
kbx: Allow "gpgsm --faked-system-time" to kick off a compression run.
* kbx/keybox-update.c (keybox_compress): Use make_timestamp.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-07-18 13:59:52 +02:00
NIIBE Yutaka 44be675b75 gpg: More check for symmetric key encryption.
* g10/dek.h (DEK): Use debugger friendly type of unsigned int.
* g10/mainproc.c (symkey_decrypt_seskey): Add another check.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-18 11:02:34 +09:00
NIIBE Yutaka 4195ce15f4 doc: Fix description of the field 11.
* doc/DETAILS: Fix.

GnuPG-bug-id: 4105
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-16 16:54:03 +09:00
NIIBE Yutaka 75e0ec6517 dirmngr: Don't add system CAs for SKS HKPS pool.
* dirmngr/http.c [HTTP_USE_GNUTLS] (http_session_new): Clear
add_system_cas.

GnuPG-bug-id: 4594
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-16 10:10:52 +09:00
Werner Koch fb1c8978f5
scd: Remove useless GNUPG_SCD_MAIN_HEADER macro.
* scd/apdu.c (): Remove never set and useless macro.
* scd/ccid-driver.c: Ditto.
* scd/iso7816.c: Ditto.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-07-12 13:39:47 +02:00
NIIBE Yutaka 58bab1a878 doc: Dependencies for figures are only for maintainers.
* doc/Makefile.am [MAINTAINER_MODE] (.svg.eps, etc.): Enable only
when maintainer-mode.

GnuPG-bug-id: 4280
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-12 17:24:26 +09:00
NIIBE Yutaka 4e601c7643 Fix a reference in comment.
* common/openpgp-s2k.c: Fix.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-12 12:11:26 +09:00
NIIBE Yutaka 89303b9998 gpg: Don't try decryption by session key when NULL.
* g10/mainproc.c (proc_encrypted): Only call get_session_key when
PKENC_LIST is not NULL.
Return GPG_ERR_BAD_KEY, instead of GPG_ERR_NO_SECKEY, when
it's encrypted only by symmetric key.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-12 09:26:00 +09:00
NIIBE Yutaka 02d8b38383 agent: Relax the handling of pinentry error for keyboard grab.
* agent/call-pinentry.c (start_pinentry): It's not fatal when
pinentry doesn't support no-grab/grab option.

GnuPG-bug-id: 4587
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-11 14:55:28 +09:00
NIIBE Yutaka b310604252 scd: Fix internal CCID driver, so that -DTEST works.
* scd/ccid-driver.c: Support a test program by ccid-driver.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-11 14:37:27 +09:00
NIIBE Yutaka 2536bf2761 scd: Fix debug logging of the internal CCID driver.
* scd/ccid-driver.c [GNUPG_MAJOR_VERSION] (DEBUGOUT): Use log_debug.

Fixes-commit: 79c99921e3
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-11 13:21:48 +09:00
NIIBE Yutaka 29c7fb4053 gpg: Fix getting User ID.
* g10/getkey.c (user_id_db): Remove, as no use anymore.
(get_user_id_string): Use cache_get_uid_bykid.
(get_user_id_byfpr): Use cache_get_uid_byfpr.
* g10/objcache.c (cache_get_uid_byfpr): New.
* g10/objcache.h (cache_get_uid_byfpr): New.

Fixes-commit: 64a5fd3727
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-11 12:32:44 +09:00
NIIBE Yutaka 33c17a8008 gpg: Improve import slowness.
* g10/import.c (read_block): Avoid O(N^2) append.
(sec_to_pub_keyblock): Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-10 15:42:07 +09:00
NIIBE Yutaka a7a043e825 gpg: Fix keyring retrieval.
* g10/keyring.c (keyring_get_keyblock): Avoid O(N^2) append.

GnuPG-bug-id: 4592
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-10 15:06:54 +09:00
Werner Koch a29156d5a6
gpg: Do not try the import fallback if the options are already used.
* g10/import.c (import_one): Check options.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-07-09 11:13:51 +02:00
Werner Koch eec150eca7
gpg: Fix regression in option "self-sigs-only".
* g10/import.c (read_block): Make sure KEYID is availabale also on a
pending packet.
--

Reported-by: Phil Pennock
Fixes-commit: 2e349bb617
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-07-09 11:12:20 +02:00
NIIBE Yutaka 37d758e5f2 sm: Fix card access.
* sm/call-agent.c (gpgsm_scd_pksign): Cast to integer for %b.

--

This fix is needed on big endian machine where size_t is bigger
than integer.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-09 16:59:56 +09:00
NIIBE Yutaka c51a568555 scd: ccid-driver: Initial getting ATR more robustly.
* scd/ccid-driver.c (send_power_off): New.
(do_close_reader): Use send_power_off.
(ccid_get_atr): Add error recovery.

GnuPG-bug-id: 4616
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-09 10:56:09 +09:00
NIIBE Yutaka 39c40e572c scd: Fix keygrip search.
* scd/app.c (app_do_with_keygrip): Break the entire loop.

Fixes-commit: 5a5288d051
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-08 12:26:51 +09:00
Werner Koch 96bf8f4778
gpg: With --auto-key-retrieve prefer WKD over keyservers.
* g10/mainproc.c (check_sig_and_print): Print a hint on how to make
use of the preferred keyserver.  Remove keyserver lookup just by the
keyid.  Try a WKD lookup before a keyserver lookup.
--

The use of the the keyid for lookups does not make much sense anymore
since for quite some time we do have the fingerprint as part of the
signature.

GnuPG-bug-id: 4595
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-07-05 10:33:13 +02:00
Werner Koch b0e8724b10
wkd: Change client/server limit back to 64 KiB
* tools/wks-receive.c (decrypt_data): Change limit.
--

The former limit ~1MiB of was used during development.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-07-05 10:33:13 +02:00
NIIBE Yutaka 38b9da7de3 sm: Return the last error for pubkey decryption.
* sm/decrypt.c: Use TMP_RC for ksba_cms_get_issuer_serial,
and return the last error when no key is available.
Fix the error report with TMP_RC for second call of
ksba_cms_get_issuer_serial.

GnuPG-bug-id: 4561
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-05 15:46:19 +09:00
NIIBE Yutaka 6cc4119ec0 gpg: Return the last error for pubkey decryption.
* g10/mainproc.c (proc_encrypted): Check ->result against -1.
When c->dek == NULL, put GPG_ERR_NO_SECKEY only when not set.
* g10/pubkey-enc.c (get_session_key): Set k->result by the result of
get_it.
When no secret key is available for some reasons, return the last
specific error, if any.

GnuPG-bug-id: 4561
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-05 15:16:08 +09:00
Daniel Kahn Gillmor 064aeb14c9
dirmngr: fix handling of HTTPS redirections during HKP
* dirmngr/ks-engine-hkp.c (send_request): Reinitialize HTTP session when
following a HTTP redirection.

--
inspired by patch from Damien Goutte-Gattat <dgouttegattat@incenp.org>

GnuPG-Bug_id: 4566
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>

Originally applied to 2.2.  Here a minor conflict fix was needed.
2019-07-04 16:36:18 +02:00
Werner Koch 23c9786408
gpg: Add "self-sigs-only" and "import-clean" to the keyserver options.
* g10/gpg.c (main): Change default.
--

Due to the DoS attack on the keyeservers we do not anymore default to
import key signatures.  That makes the keyserver unsuable for getting
keys for the WoT but it still allows to retriev keys - even if that
takes long to download the large keyblocks.

To revert to the old behavior add

  keyserver-optiions  no-self-sigs-only,no-import-clean

to gpg.conf.

GnuPG-bug-id: 4607
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-07-04 15:45:39 +02:00
Werner Koch 91a6ba3234
gpg: Avoid printing false AKL error message.
* g10/getkey.c (get_pubkey_byname): Add special traeatment for default
and skipped-local.
--

This change avoids error message like

  gpg: error retrieving 'foo@example.org' via None: No public key

A 'None' mechanism is something internal.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-07-04 15:21:39 +02:00
Werner Koch d00c8024e5
gpg: New command --locate-external-key.
* g10/gpg.c (aLocateExtKeys): New.
(opts): Add --locate-external-keys.
(main): Implement that.
* g10/getkey.c (get_pubkey_byname): Implement GET_PUBKEY_NO_LOCAL.
(get_best_pubkey_byname): Add arg 'mode' and pass on to
get_pubkey_byname.  Change callers.
* g10/keylist.c (public_key_list): Add arg 'no_local'.
(locate_one): Ditto.  Pass on to get_best_pubkey_byname.
--

This new command is a shortcut for

  --auto-key-locate nodefault,clear,wkd,... --locate-key

and uses the default or configured AKL list but does so without local.

See also
GnuPG-bug-id: 4599

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-07-04 15:13:26 +02:00