gnupg.git
2 years agopo: Fix misleading german translation.
Justus Winter [Fri, 1 Apr 2016 14:38:24 +0000 (16:38 +0200)]
po: Fix misleading german translation.

--
GnuPG-bug-id: 2239
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoPost release updates
Werner Koch [Thu, 31 Mar 2016 10:58:31 +0000 (12:58 +0200)]
Post release updates

--

2 years agoRelease 2.0.30 gnupg-2.0.30
Werner Koch [Thu, 31 Mar 2016 10:47:24 +0000 (12:47 +0200)]
Release 2.0.30

2 years agopo: Auto update
Werner Koch [Thu, 31 Mar 2016 09:48:35 +0000 (11:48 +0200)]
po: Auto update

--

2 years agodoc: Update help.ru.text
Ineiev [Thu, 31 Mar 2016 08:51:39 +0000 (10:51 +0200)]
doc: Update help.ru.text

2 years agobuild: Create *.swdb file during make distcheck.
Werner Koch [Thu, 31 Mar 2016 08:36:48 +0000 (10:36 +0200)]
build: Create *.swdb file during make distcheck.

* Makefile.am (distcheck-hook): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agogpg: Silence trustdb messages with --quiet.
Werner Koch [Thu, 31 Mar 2016 08:33:30 +0000 (10:33 +0200)]
gpg: Silence trustdb messages with --quiet.

* g10/trustdb.c (validate_keys): Silence messages

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoagent: Do not remove the ssh socket.
Justus Winter [Wed, 2 Mar 2016 15:41:04 +0000 (16:41 +0100)]
agent: Do not remove the ssh socket.

* agent/gpg-agent.c (create_server_socket): Also inhibit the removal
of the ssh socket if another agent process is already running.

GnuPG modern is not affected.

GnuPG-bug-id: 2258
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agog10: Make sure to have the directory for trustdb.
NIIBE Yutaka [Fri, 12 Feb 2016 01:15:52 +0000 (10:15 +0900)]
g10: Make sure to have the directory for trustdb.

* g10/tdbio.c (tdbio_set_dbname): Return earlier if !CREATE.  Check
the directory and create it if none before calling take_write_lock.

--

Thanks to Marc Deslauriers for the bug report and his patch.

GnuPG-bug-id: 2246

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(backport from master
 commit 2f3e42047d17313eeb38d354048f343158402a8d)

2 years agocommon: Cope with AIX problem on number of open files.
Werner Koch [Fri, 15 Jan 2016 14:32:18 +0000 (15:32 +0100)]
common: Cope with AIX problem on number of open files.

* common/exechelp.c: Limit returned value for too hight values.
--

GnuPG-bug-id: 1778

(backport from master commit 987532b038a2d9b9e76c0de425ee036ca2bffa1b)

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoFix to support git worktree.
NIIBE Yutaka [Wed, 13 Jan 2016 08:22:37 +0000 (17:22 +0900)]
Fix to support git worktree.

* Makefile.am: Use -e for testing .git.

--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(backport commit of 96237b9a63a50aed1884cb06f84279b977d6a8fa)

2 years agosm: Handle gcry_pk_encrypt return value.
NIIBE Yutaka [Tue, 15 Dec 2015 03:38:25 +0000 (12:38 +0900)]
sm: Handle gcry_pk_encrypt return value.

* sm/encrypt.c (encrypt_dek): Don't ignore failure of gcry_pk_encrypt.

--

Thanks to Sami Farin.

GnuPG-bug-id: 2154

(backport commit of 4ee881bff4c8fdfa4b3b7a4b7afab611471e97f1)

2 years agoscd: Fix commit 9a9bfd77.
NIIBE Yutaka [Tue, 15 Dec 2015 00:56:08 +0000 (09:56 +0900)]
scd: Fix commit 9a9bfd77.

* scd/app.c (check_application_conflict): Get SLOT.

2 years agoscd: Fix removal of unplugged usb readers on Windows.
Daniel Hoffend [Sun, 6 Dec 2015 23:13:59 +0000 (00:13 +0100)]
scd: Fix removal of unplugged usb readers on Windows.

* scd/apdu.c (pcsc_error_to_sw): map PCSC_E_NO_SERVICE and
PCSC_E_SERVICE_STOPPED to the internal SW_HOST_NO_READER error code.

--

Signed-off-by: Daniel Hoffend <dh@dotlan.net>
GnuPG-bug-id: 2167

In Windows 8 (and later), PC/SC service only runs when reader/token is
plugged in.  After its removal, it returns PCSC_E_NO_SERVICE error.
This error should be handled as no reader.  This comment is by gniibe.

(backport of commit d1a97585c5e73fbc7d4cf90e38f76ffc5aea305f)

2 years agoscd: Simplify saving application context.
NIIBE Yutaka [Fri, 4 Dec 2015 05:13:23 +0000 (14:13 +0900)]
scd: Simplify saving application context.

* scd/app.c (lock_table): Remove LAST_APP field.
(lock_reader, app_dump_state, application_notify_card_reset)
(release_application): Follow the change.
(check_conflict): New.
(check_application_conflict): Lock the slot and call check_conflict.
(select_application): Call check_conflict and not use LAST_APP.

--

We don't need LAST_APP field but just keep the application context by
APP field.  Since we have a reference counter, it is possible if we
can deallocate or not.

(backport of commit 9639af5f16a7ed908cbce2415330b9fcd88edc90)

2 years agoscd: Fix "Conflicting usage" bug.
NIIBE Yutaka [Thu, 3 Dec 2015 02:26:24 +0000 (11:26 +0900)]
scd: Fix "Conflicting usage" bug.

* scd/apdu.c (apdu_close_reader): Call CLOSE_READER method even if we
  got an error from apdu_disconnect.
* scd/app-common.h (no_reuse): Remove.
* scd/app.c (application_notify_card_reset): Deallocate APP here.
(select_application, release_application): Don't use NO_REUSE.

--

Reproducible scenario: Invoke gpg --card-edit session from a terminal.
Invoke another gpg --card-edit session from another.  Remove a token.
Insert a token again.  Type RET on both terminals.  One of terminal
answers "Conflicting usage".

Perhaps, having NO_REUSE field was to avoid race conditions.  Now,
APP can be safely deallocated by application_notify_card_reset.

Thanks to the2nd.

(backport of commit f42c50dbf00c2e6298ca6830cbe6d36805fa54a3)

2 years agodoc: Don't install gpg-zip.1.
NIIBE Yutaka [Thu, 29 Oct 2015 01:26:04 +0000 (10:26 +0900)]
doc: Don't install gpg-zip.1.

* doc/Makefile.am (myman_pages): Remove gpg-zip.1.
(DISTCLEANFILES): Add gpg-zip.1.

--

(backport of commit d25e29ad9374da1c11ccfc38f392dbab2d707042)

Thanks to Thomas Klausner.

GnuPG-bug-id: 2095

2 years agoagent: Fix alignment problem with the second passphrase struct.
Werner Koch [Thu, 1 Oct 2015 11:21:25 +0000 (13:21 +0200)]
agent: Fix alignment problem with the second passphrase struct.

* agent/genkey.c (agent_ask_new_passphrase): Use a separate malloc for
PI2.  Check return value of the malloc function.
* agent/command-ssh.c (ssh_identity_register): Use a separate malloc
for PI2.  Wipe PI2.
--

For whatever stupid reasons I once allocated only one memory area and
split that into PI and PI2.  This is actually a common pattern with
malloc but here we used a made up object size and do not take the
extra alignment required into account.  One of these not yet hit by
a (sig)bus PC/VAX hacker bugs.

Instead of trying to fix the alignment, it is better to use a second
calloc for the second struct.

GnuPG-bug-id: 2112
Signed-off-by: Werner Koch <wk@gnupg.org>
Resolved conflicts:
agent/command-ssh.c
agent/genkey.c

(backport master commit ddf9dd135acd2b3635bb986f6dfc0e4e446d5fad)

2 years agogpg: Silence a compiler warning.
Werner Koch [Thu, 18 Sep 2014 13:08:51 +0000 (15:08 +0200)]
gpg: Silence a compiler warning.

* g10/parse-packet.c (enum_sig_subpkt): Replace hack.

--

GCC 5 failure reported by Kevin Locke <kevin@kevinlocke.name>

(backport from master commit 6a0c3fa19cfcdd590b96691e8a8ffb48fb5e0ec4)

2 years agogpg: Improve 'General key info' line of --card-status.
NIIBE Yutaka [Tue, 29 Sep 2015 04:45:20 +0000 (13:45 +0900)]
gpg: Improve 'General key info' line of --card-status.

* g10/keylist.c (print_pubkey_info): Print either "pub" or "sub".

--

This now prints "sub" if the first used card key is actually a subkey.

Signed-off-by: Werner Koch <wk@gnupg.org>
GnuPG-bug-id: 2079

(backported from master 874ef16e70ab750db7b153f17a7e859a0db6a2f1)

2 years agossh: Fix fingerprint computation for 384 bit ECDSA keys.
Werner Koch [Tue, 22 Sep 2015 07:34:05 +0000 (09:34 +0200)]
ssh: Fix fingerprint computation for 384 bit ECDSA keys.

* common/ssh-utils.c (get_fingerprint): Fix hashed string.
--

That was an obvious c+p bug which should have been caught by a test
case.

GnuPG-bug-id: 2075
Debian-bug-id: 795636

(backported from master 2167951b275bae51cf669c02547e2e7ea8fbe2ee)

2 years agopo: Update Japanese translation.
NIIBE Yutaka [Thu, 17 Sep 2015 08:07:29 +0000 (17:07 +0900)]
po: Update Japanese translation.

2 years agoscd: Fix ccid-driver timeout for OpenPGPcard v2.1.
NIIBE Yutaka [Thu, 17 Sep 2015 02:21:44 +0000 (11:21 +0900)]
scd: Fix ccid-driver timeout for OpenPGPcard v2.1.

* scd/ccid-driver.c (CCID_CMD_TIMEOUT): New.
(ccid_transceive_apdu_level, ccid_transceive): Use.

--

It is reported that key generation causes timeout with OpenPGPcard
v2.1.  Ideally, timeout value could be determined at run-time by
examining card's ATR.  Compile-time fixed value is OK for internal
CCID driver.

(cherry-picked from 2.1 6510df3a7cd2b5bf44fac1e4d50ee54b8c897daa)

2 years agopo: Update Japanese translation.
NIIBE Yutaka [Tue, 15 Sep 2015 06:14:50 +0000 (15:14 +0900)]
po: Update Japanese translation.

2 years agopo: Update Japanese Translation.
NIIBE Yutaka [Thu, 10 Sep 2015 02:03:31 +0000 (11:03 +0900)]
po: Update Japanese Translation.

2 years agogpgconf: Fix scdaemon reload.
NIIBE Yutaka [Thu, 10 Sep 2015 01:00:03 +0000 (10:00 +0900)]
gpgconf: Fix scdaemon reload.

* tools/gpgconf-comp.c (scdaemon_runtime_change): Add "scd bye".

--

In GnuPG 2.0.x, it doesn't require newer libassuan which has
ASSUAN_FORCE_CLOSE feature.  We need to send "scd bye" to let
the control finish from command loop.

2 years agopo: Update Dutch translation
Frans Spiesschaert [Wed, 9 Sep 2015 13:58:40 +0000 (15:58 +0200)]
po: Update Dutch translation

--

2 years agodoc: Allow uploading of a 2.0 manual
Werner Koch [Tue, 8 Sep 2015 15:39:46 +0000 (17:39 +0200)]
doc: Allow uploading of a 2.0 manual

--

2 years agoPost release updates.
Werner Koch [Tue, 8 Sep 2015 14:41:38 +0000 (16:41 +0200)]
Post release updates.

--

2 years agoRelease 2.0.29. gnupg-2.0.29
Werner Koch [Tue, 8 Sep 2015 13:59:00 +0000 (15:59 +0200)]
Release 2.0.29.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopo: Auto-update.
Werner Koch [Tue, 8 Sep 2015 13:58:28 +0000 (15:58 +0200)]
po: Auto-update.

--

2 years agopo: Update German translation
Werner Koch [Tue, 8 Sep 2015 13:57:44 +0000 (15:57 +0200)]
po: Update German translation

--

2 years agopo: Update Russian translation.
Ineiev [Tue, 8 Sep 2015 13:54:38 +0000 (15:54 +0200)]
po: Update Russian translation.

--

2 years agogpg: Print a new FAILURE status after most commands.
Werner Koch [Tue, 8 Sep 2015 13:29:59 +0000 (15:29 +0200)]
gpg: Print a new FAILURE status after most commands.

* common/status.h (STATUS_FAILURE): New.
* g10/cpr.c (write_status_failure): New.
* g10/gpg.c (main): Call write_status_failure for all commands which
print an error message here.
--

This status line can be used similar to the error code returned by
commands send over the Assuan interface in gpgsm.  We don't emit them
in gpgsm because there we already have that Assuan interface to return
proper error code.  This change helps GPGME to return better error
codes.

(backported from master 9cdff09743c473a12359bfdb914578ede0e4e3e2)

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agogpg: Avoid cluttering stdout with trustdb info in verbose mode.
Werner Koch [Fri, 8 May 2015 14:30:04 +0000 (16:30 +0200)]
gpg: Avoid cluttering stdout with trustdb info in verbose mode.

* g10/trustdb.c (validate_keys): Call dump_key_array only in debug
mode.
--

I guess that is a left-over from an early attempt to output
information on the trustdb for use by other tools.  Maybe related to
the former --list-trust-path command.  Sending it to stdout is
probably useful so we do this now only in debug mode.

Signed-off-by: Werner Koch <wk@gnupg.org>
Backported to STABLE-BRANCH-2-0 from
b03a2647299a6c8764a2574590cbaccdff9e497d by dkg

2 years agogpg: Obsolete --no-sig-create-check.
Werner Koch [Mon, 31 Aug 2015 21:35:32 +0000 (23:35 +0200)]
gpg: Obsolete --no-sig-create-check.

* g10/gpg.c (opts): Make --no-sig-create-check a NOP.
* g10/options.h (struct opt): Remove field "no_sig_create_check".
* g10/sign.c (do_sign): Do not run the create check for Libgcrypt 1.7.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agog10: fix --card-status creating stub.
NIIBE Yutaka [Wed, 12 Aug 2015 01:23:40 +0000 (10:23 +0900)]
g10: fix --card-status creating stub.

* g10/getkey.c (get_seckeyblock_byfprint): Require exact match.

2 years agosm: Revert to use SHA-1 for CSR generation.
Werner Koch [Mon, 27 Jul 2015 09:28:31 +0000 (11:28 +0200)]
sm: Revert to use SHA-1 for CSR generation.

* sm/certreqgen.c (create_request): Revert to use SHA-1 but change to
set it only at one place.
--

Regression-due-to: bdf439035d123e4751e133ad42982673b0c86b75
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoDon't segfault if the first 'auto-key-locate' option is 'clear'.
Neal H. Walfield [Thu, 16 Jul 2015 07:57:27 +0000 (09:57 +0200)]
Don't segfault if the first 'auto-key-locate' option is 'clear'.

* g10/getkey.c (free_akl): If AKL is NULL, just return.

--
Backported from f2ee673c99825d5189631031ddec2dbf54dbd482.  Note:
unlike in 2.1, in 2.0 this bug is not (currently) triggered since
parse_auto_key_locate doesn't recognize "clear".

Signed-off-by: Neal H. Walfield <neal@g10code.com>.
Reported-by: Sami Farin.
GnuPG-bug-id: 2045

2 years agoscd: pinpad workaround for PC/SC implementations.
NIIBE Yutaka [Tue, 23 Jun 2015 01:10:15 +0000 (10:10 +0900)]
scd: pinpad workaround for PC/SC implementations.

* scd/adpu.c (pcsc_pinpad_verify, pcsc_pinpad_modify): Bigger buffer
for TPDU card reader.

--

(backport from 2.1 commit 5e1d2fe6555d06f9dcd2daac713b2edfbc0428a5)

GnuPG-bug-id: 2003, 2004

This is needed for PC/SC on Debian Jessie.  Note that it's not only
for Cherry ST-2000, but also, for any TPDU card readers.

2 years agoscd: Fix Cherry ST-2000 support for pinpad input.
NIIBE Yutaka [Mon, 22 Jun 2015 05:31:25 +0000 (14:31 +0900)]
scd: Fix Cherry ST-2000 support for pinpad input.

* scd/apdu.c (pcsc_vendor_specific_init): Set pinmax to 15.
* scd/ccid-driver.c (ccid_transceive_secure): Add zero for the
template of APDU.

--

(backport from 2.1 commit 444e9232aa9e00aacd939cbf7bdb881b550dfebe)

GnuPG-bug-id: 2003, 2004

3 years agogpg: Print PGP-2 fingerprint instead of all zeroes.
Werner Koch [Wed, 17 Jun 2015 06:37:02 +0000 (08:37 +0200)]
gpg: Print PGP-2 fingerprint instead of all zeroes.

* g10/keyid.c (fingerprint_from_pk): Allow PGP-2 fingerprints.
* g10/keylist.c (print_fingerprint): Print a warning after a PGP-2
fingerprint.
--

Printing all zeroes for a PGP-2 (v3 key) fingerprint has the problem
that frontends (or the user) may use that fingerprint to lookup a key
and gpg will return all PGP2 keys.  They may then show a different
PGP-2 key than the one actually used for a signature.  This is worse
than displaying a weak fingerprint.

GnuPG-bug-id: 2000
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agopo: Update Japanese Translation.
NIIBE Yutaka [Tue, 16 Jun 2015 03:52:19 +0000 (12:52 +0900)]
po: Update Japanese Translation.

3 years agog10: Fix a race condition initially creating trustdb.
NIIBE Yutaka [Thu, 28 May 2015 08:08:37 +0000 (17:08 +0900)]
g10: Fix a race condition initially creating trustdb.

* g10/tdbio.c (take_write_lock, release_write_lock): New.
(put_record_into_cache, tdbio_sync, tdbio_end_transaction): Use
new lock functions.
(tdbio_set_dbname): Fix the race.
(open_db): Don't call create_dotlock.

--

(backported from commit fe5c6edaed78839303d67e01e141cfc6b5de9aec)

GnuPG-bug-id: 1675

3 years agopo:Update Japanese translation.
NIIBE Yutaka [Mon, 15 Jun 2015 04:58:07 +0000 (13:58 +0900)]
po:Update Japanese translation.

3 years agodoc: Replace "conventional encryption" by "symmetric encryption".
Werner Koch [Tue, 2 Jun 2015 15:46:42 +0000 (17:46 +0200)]
doc: Replace "conventional encryption" by "symmetric encryption".

--

Suggested-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agogpg: Consider that gcry_mpi_get_opaque may return NULL.
Werner Koch [Tue, 2 Jun 2015 15:41:30 +0000 (17:41 +0200)]
gpg: Consider that gcry_mpi_get_opaque may return NULL.

* g10/seckey-cert.c (do_check): Handle a NULL opaque MPI.
--

This patch extends b2d9d10 for secret keys.  The problem is that we
changed the semantics so that opaque MPIs may be NULL with a bit
length.  This patch is not required in GnuPG 2 because we do not use
secret keys there.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Fix segv due to NULL value stored as opaque MPI (BRANCH 2.0)
Daniel Kahn Gillmor [Sat, 21 Feb 2015 23:23:44 +0000 (18:23 -0500)]
gpg: Fix segv due to NULL value stored as opaque MPI (BRANCH 2.0)

* g10/build-packet.c (do_secret_key): Check for NULL return from
gcry_mpi_get_opaque.
* g10/keyid.c (hash_public_key): Ditto.
--

This is a backport of 76c8122adfed0f0f443cce7bda702ba2b39661b3 from
master to the STABLE-BRANCH-2-0

On the STABLE-BRANCH-2-0, we may also want to patch g10/seckey-cert.c,
but that has not been done in this patch.

This fix extends commmit 0835d2f44ef62eab51fce6a927908f544e01cf8f.

  gpg2 --export --no-default-keyring --keyring TESTDATA

With TESTDATA being below after unpacking.

-----BEGIN PGP ARMORED FILE-----

mBMEhdkMmS8BcX8F//8F5voEhQAQmBMEnAAAZwAAo4D/f/8EhQAAAIAEnP8EhQAQ
iBMEnP8AAAAABf8jIID///8EhQYQmBMEnIUAEIgTBKT/AAAAAAUAACCA/f//BIUA
EJgTBJx/AP8ABPPzBJx/AP8ABPPz
=2yE0
-----END PGP ARMORED FILE-----

Reported-by: Jodie Cunningham
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agodoc: Typo fix for "Creation-Date".
Werner Koch [Tue, 2 Jun 2015 15:20:56 +0000 (17:20 +0200)]
doc: Typo fix for "Creation-Date".

--

Debian-bug-id: 760273

This has already been fixed in master.

3 years agoPost release updates
Werner Koch [Tue, 2 Jun 2015 13:12:04 +0000 (15:12 +0200)]
Post release updates

--

The fuzzy entries of ru.po are not in the release.  Does not matter.

3 years agoRelease 2.0.28 gnupg-2.0.28
Werner Koch [Tue, 2 Jun 2015 12:31:13 +0000 (14:31 +0200)]
Release 2.0.28

3 years agopo: Auto-update
Werner Koch [Tue, 2 Jun 2015 12:30:36 +0000 (14:30 +0200)]
po: Auto-update

--

3 years agopo: Update Russian translation
Ineiev [Tue, 2 Jun 2015 11:24:22 +0000 (13:24 +0200)]
po: Update Russian translation

--

This pacth was missed for 2.0.27.
I fixed a typo in the PO-Revision-Date.
  - wk

3 years agopo: Update the German translation
Werner Koch [Tue, 2 Jun 2015 11:15:13 +0000 (13:15 +0200)]
po: Update the German translation

--

3 years agopo: Fix a LF mismatch in ja.po.
Werner Koch [Tue, 2 Jun 2015 11:06:08 +0000 (13:06 +0200)]
po: Fix a LF mismatch in ja.po.

--

3 years agoagent: Make --allow-external-password-cache work.
Werner Koch [Tue, 2 Jun 2015 08:36:21 +0000 (10:36 +0200)]
agent: Make --allow-external-password-cache work.

* agent/call-pinentry.c (start_pinentry): Remove first instance of
sending the option.
--

That option to tell Pinentry about an external password cache was send
twice and the first one unconditionally.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoagent: Add strings for use by future Pinentry versions.
Werner Koch [Mon, 11 May 2015 08:25:09 +0000 (10:25 +0200)]
agent: Add strings for use by future Pinentry versions.

* agent/call-pinentry.c (start_pinentry): Add more strings.
--

We do this so that translations of these strings will be available at
the time a pinentry implements features which require these strings.

Signed-off-by: Werner Koch <wk@gnupg.org>
This is a backport from master
commit 02d5e1205489aa5027a87a64552eaf15984dc22d
without the mode flag in the table.

3 years agoagent: Cleanup caching code for command GET_PASSPHRASE.
Werner Koch [Wed, 20 May 2015 14:13:55 +0000 (16:13 +0200)]
agent: Cleanup caching code for command GET_PASSPHRASE.

* agent/command.c (cmd_get_passphrase): Read from the user cache.
--

We used to read the passphrase with mode CACHE_MODE_NORMAL but we put
it into the cache with CACHE_MODE_USER.  However, agent_get_cache does
not yet distinguish between them and thus this does not change
anything.

(backported from commit 23d2ef83cda644c6a83499f9327350d3371e8a17)

3 years agoagent: Backport changes from 2.1 to support an external password manager.
Neal H. Walfield [Tue, 19 May 2015 11:53:43 +0000 (13:53 +0200)]
agent: Backport changes from 2.1 to support an external password manager.

* agent/agent.h (agent_askpin): Add arguments keyinfo and cache_mode.
Update callers.
(agent_get_passphrase): Likewise.
(agent_clear_passphrase): New function.
(opt): Add field allow_external_cache.
* agent/call-pinentry.c (start_pinentry): Send "OPTION
allow-external-password-cache" to the pinentry.
(PINENTRY_STATUS_PASSWORD_FROM_CACHE): New constant.
(pinentry_status_cb): New function.
(agent_askpin): Add arguments keyinfo and cache_mode.  If KEYINFO and
CACHE_MODE describe a cachable key, then send SETKEYINFO to the
pinentry.  Pass PINENTRY_STATUS_CB to the "GETPIN" invocation.  If the
passphrase was incorrect and PINENTRY_STATUS_PASSWORD_FROM_CACHE is
set, decrement PININFO->FAILED_TRIES.
(agent_get_passphrase): Add arguments keyinfo and cache_mode.  If
KEYINFO and CACHE_MODE describe a cachable key, then send SETKEYINFO
to the pinentry.
(agent_clear_passphrase): New function.
* agent/call-pinentry.c (start_pinentry): Act upon new var,
allow_external_cache.
* agent/command.c (cmd_clear_passphrase): Call agent_clear_passphrase.
* agent/gpg-agent.c (oNoAllowExternalCache): New.
(opts): Add option --no-allow-external-cache.
(parse_rereadable_options): Set this option.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Based on commits:

3a9305439b75ccd4446378d4fd87da087fd9c892
e201c20f25e7bed29088186c5f717d43047a0f4b
d7293cb317acc40cc9e5189cef33fe9d8b47e62a
56b5c9f94f2e55d096be585ed061ccf1c9ec0de6
d3b5cad2346bd5747789dc62d7804fa5c15f4f3b
2180845959839705200e3172dbafc94b70b9007f

3 years agog10: detects public key encryption packet error properly.
NIIBE Yutaka [Tue, 19 May 2015 01:32:07 +0000 (10:32 +0900)]
g10: detects public key encryption packet error properly.

g10/mainproc.c (proc_pubkey_enc): Only allow relevant algorithms for
encryption.

--

(backport from 2.1 commit c771963140cad7c1c25349bcde27e427effc0058)

3 years agog10: Improve handling of no corresponding public key.
NIIBE Yutaka [Tue, 19 May 2015 01:14:09 +0000 (10:14 +0900)]
g10: Improve handling of no corresponding public key.

* g10/getkey.c (get_seckey): Return G10ERR_NO_PUBKEY when it's not
exact match.

--

(ported from 1.4 commit b3fd30451a5464b124b0296afbc341cb98b3977c)

In the situation of corrupted .gnupg/ where only private subkey is
available but no corresponding public key of the subkey, the code
returned public primary key which caused mysterious error (for a
user).  This fix detects an error earlier.

GnuPG-bug-id: 1422
Debian-Bug-Id: #638619

3 years agogpg-connect-agent: Fix quoting of internal percent+ function.
Werner Koch [Mon, 11 May 2015 17:38:07 +0000 (19:38 +0200)]
gpg-connect-agent: Fix quoting of internal percent+ function.

* tools/gpg-connect-agent.c (get_var_ext) <percent, percent+): Also
escape '+'.
--

GnuPG-bug-id: 1841
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoscd: PC/SC reader selection by partial string match.
NIIBE Yutaka [Thu, 30 Apr 2015 03:36:38 +0000 (12:36 +0900)]
scd: PC/SC reader selection by partial string match.

* scd/apdu.c (open_pcsc_reader_direct): Partial string match.
* scd/pcsc-wrapper.c (handle_open): Likewise.

--

(backport from 2.1 commit 01a2a61bc4b34817c4216888265f65d59a33dad3)

The card reader name by PC/SC service might include USB bus,
which varies (on some platform like GNU/Linux).  Thus, it's
better to match partial string.

Original patch was submitted by anstein.  I changed it to fallback to
the first reader if no match found.

GnuPG-bug-id: 1618, 1930

3 years agog10: fix cmp_public_key and cmp_secret_keys.
NIIBE Yutaka [Thu, 30 Apr 2015 08:02:42 +0000 (17:02 +0900)]
g10: fix cmp_public_key and cmp_secret_keys.

* g10/free-packet.c (cmp_public_keys, cmp_secret_keys): Compare opaque
data at the first entry of the array when it's unknown algo.
* configure.ac (NEED_LIBGCRYPT_VERSION): Require 1.5.0.

--

GnuPG-bug-id: 1962

3 years agogpg: Emit status line NEWSIG before signature verification starts.
Werner Koch [Thu, 19 Mar 2015 19:38:25 +0000 (20:38 +0100)]
gpg: Emit status line NEWSIG before signature verification starts.

* g10/mainproc.c (check_sig_and_print): Emit STATUS_NEWSIG.
--

gpgsm does this for a long time but somehow it never made it into gpg.

Signed-off-by: Werner Koch <wk@gnupg.org>
(backported from 2.1 commit e7ddaad0fd2c8774a1d3367adfaa68014eaf65de)

3 years agoscd: better handling of extended APDU.
NIIBE Yutaka [Tue, 14 Apr 2015 05:17:03 +0000 (14:17 +0900)]
scd: better handling of extended APDU.

* scd/apdu.c (send_le): Bug fix for not append Z when lc<0&&le<0.
* scd/app-common.h (struct app_ctx_s): Use bit fields for flags.
* scd/ccid-driver.c (CCID_MAX_BUF): New.  Only for OpenPGPcard.
(struct ccid_driver_s): New field of max_ccid_msglen.
 Remove ifsd field.
(parse_ccid_descriptor): Initialize max_ccid_msglen.
(ccid_transceive_apdu_level): Implement sending extended APDU in
chain of CCID message.

--

With this patch, we won't need PC/SC library/service any more.
GnuPG-bug-id: 1947
(backported from 2.1 commit 971d558e862db878a7310e06ed7116dbe36886ab)

3 years agogpgparsemail: Fix last commit (3f2bdac)
Werner Koch [Fri, 10 Apr 2015 06:34:35 +0000 (08:34 +0200)]
gpgparsemail: Fix last commit (3f2bdac)

* tools/rfc822parse.c (parse_field): Replace break by goto.
--

Brown paper bag bug: Changing an IF to a WHILE inside another loop
requires to fix the inner break.

Reported-by: Hanno Böck
Signed-off-by: Werner Koch <wk@gnupg.org>
(backported from 2.1 commit 9433661419043431a6cfc7d84c8450e0b2f6c353)

3 years agogpgparsemail: Fix case of zero length continuation lines.
Werner Koch [Thu, 9 Apr 2015 17:06:33 +0000 (19:06 +0200)]
gpgparsemail: Fix case of zero length continuation lines.

* tools/rfc822parse.c (parse_field): Loop after continuation line.
--

Using header lines like

  Name:[lf]
  [space][lf]
  [lf]

resulted in running into the "(s2 = strchr (delimiters2, *s)" branch
and inserting a new token for the empty continuation line.  This also
led to one byte read after the string which is what Hanno figured.
The new code should handle empty continuation lines correct.

Reported-by: Hanno Böck
Signed-off-by: Werner Koch <wk@gnupg.org>
(backported from 2.1 commit 3fbeba64a8bfb2b673230c124a3d616b6568fd2f)

3 years agoagent: Fix length test in sshcontrol parser.
Werner Koch [Sun, 15 Mar 2015 12:04:48 +0000 (13:04 +0100)]
agent: Fix length test in sshcontrol parser.

* agent/command-ssh.c (ssh_search_control_file): Check S before
upcasing it.
--

In contradiction to the comment we did not check the length of HEXGRIP
and thus the GPG_ERR_INV_LENGTH was never triggered.

Detected by Stack 0.3:

  bug: anti-simplify
  model: |
    %cmp8 = icmp ne i32 %i.0, 40, !dbg !986
    -->  false
  stack:
    - /home/wk/s/gnupg/agent/command-ssh.c:1226:0
  ncore: 2
  core:
    - /home/wk/s/gnupg/agent/command-ssh.c:1225:0
      - buffer overflow
    - /home/wk/s/gnupg/agent/command-ssh.c:1225:0
      - buffer overflow

(backported from 2.1 commit 3529dd8bb5bafc4e02915648d5f409bd27a9cc37)

3 years agoscd: Fix possible NULL deref in apdu.c
Werner Koch [Sun, 15 Mar 2015 11:15:55 +0000 (12:15 +0100)]
scd: Fix possible NULL deref in apdu.c

* scd/apdu.c (control_pcsc_direct): Take care of BUFLEN being NULL.
(control_pcsc_wrapped): Ditto.
--

pcsc_vendor_specific_init calls the above with BUFFER and BUFLEN as
NULL.

Reported by Stack 0.3:

  bug: anti-dce
  model: |
    control_pcsc.exit77:
    %retval.0.i.i76 = phi i32 [ %rc.0.i.i.i73, \
            %pcsc_error_to_sw.exit.i.i74 ], [ 0, %if.end.i.i75 ]
    %tobool198 = icmp ne i32 %retval.0.i.i76, 0, !dbg !728
    br i1 %tobool198, label %if.then199, label %if.end200, !dbg !728
  stack:
    - /home/wk/s/gnupg/scd/apdu.c:1882:0
  ncore: 1
  core:
    - /home/wk/s/gnupg/scd/apdu.c:1309:0
      - buffer overflow

(backported from 2.1 commit ef0a3abf7305133d071bf1a94a7f461082f9a9aa)

3 years agopo: Update Japanese translation.
NIIBE Yutaka [Wed, 15 Apr 2015 04:41:48 +0000 (13:41 +0900)]
po: Update Japanese translation.

3 years agogpg: Fix DoS while parsing mangled secret key packets.
Werner Koch [Sun, 5 Apr 2015 17:33:36 +0000 (19:33 +0200)]
gpg: Fix DoS while parsing mangled secret key packets.

* g10/parse-packet.c (parse_key): Check PKTLEN before calling mpi_read
et al.
--

Due to the missing length checks PKTLEN may turn negative.  Because
PKTLEN is an unsigned int the malloc in read_rest would try to malloc
a too large number and terminate the process with "error reading rest
of packet: Cannot allocate memory".

Reported-by: Hanno Böck.
Signed-off-by: Werner Koch <wk@gnupg.org>
(backported from 2.1 commit d901efcebaefaf6eae4a9b9aa8f0c2c055d3518a)

3 years agodoc: Document the changed default algos for gpgsm.
Werner Koch [Wed, 25 Mar 2015 09:16:37 +0000 (10:16 +0100)]
doc: Document the changed default algos for gpgsm.

--

3 years agosm: Change default algos to SHA256 (CSR) and AES128 (bulk encryption).
Werner Koch [Wed, 25 Mar 2015 09:12:11 +0000 (10:12 +0100)]
sm: Change default algos to SHA256 (CSR) and AES128 (bulk encryption).

* sm/certreqgen.c (create_request): Change default hash algo.
* sm/gpgsm.c (main): Change default bulk cipher algo.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpgtar: Fix extracting files with !(size % 512)
Andre Heinecke [Tue, 17 Mar 2015 09:48:09 +0000 (10:48 +0100)]
gpgtar: Fix extracting files with !(size % 512)

* tools/gpgtar-extract.c (extract_regular): Handle size multiples
  of RECORDSIZE.

--
  If a hdr->size was a multiple of 512 the last record would
  not have been written and the files corrupted accordingly.

GnuPG-bug-id: 1926

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
Changed to use only if-else.

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

3 years agocommon: Check option arguments for a valid range
Werner Koch [Thu, 5 Mar 2015 01:33:47 +0000 (02:33 +0100)]
common: Check option arguments for a valid range

* common/argparse.h (ARGPARSE_INVALID_ARG): New.
* common/argparse.c: Include limits h and errno.h.
(initialize): Add error strings for new error constant.
(set_opt_arg): Add range checking.
--
Signed-off-by: Werner Koch <wk@gnupg.org>
[ This is a backport of 0d73a242cb53522669cf712b5ece7d1ed05d003a from
  master to STABLE-BRANCH-2-0 ]

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agogpg: New command --list-gcrypt-config.
Werner Koch [Wed, 11 Mar 2015 13:58:38 +0000 (14:58 +0100)]
gpg: New command --list-gcrypt-config.

* g10/gpg.c (aListGcryptConfig): New.
(main): Implement command.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Remove left-over debug message.
Werner Koch [Thu, 26 Feb 2015 08:38:58 +0000 (09:38 +0100)]
gpg: Remove left-over debug message.

* g10/armor.c (check_input): Remove log_debug.

3 years agoPost release updates.
Werner Koch [Wed, 18 Feb 2015 13:32:11 +0000 (14:32 +0100)]
Post release updates.

--

3 years agoRelease 2.0.27 gnupg-2.0.27
Werner Koch [Wed, 18 Feb 2015 13:10:57 +0000 (14:10 +0100)]
Release 2.0.27

3 years agogpg: Remove an unused variable.
Werner Koch [Wed, 18 Feb 2015 13:19:46 +0000 (14:19 +0100)]
gpg: Remove an unused variable.

* g10/import.c (import): Remove need_armor.

3 years agopo: Auto update
Werner Koch [Wed, 18 Feb 2015 11:53:39 +0000 (12:53 +0100)]
po: Auto update

--

3 years agopo: Update German translation
Werner Koch [Wed, 18 Feb 2015 11:52:55 +0000 (12:52 +0100)]
po: Update German translation

3 years agocurl-shim: clean up varargs
Daniel Kahn Gillmor [Wed, 18 Feb 2015 09:11:31 +0000 (04:11 -0500)]
curl-shim: clean up varargs

* keyserver/curl-shim.c (curl_easy_setopt) : ensure that va_end is
  called.

--

stdarg(3) says:
      Each invocation of va_start() must be matched by a
      corresponding invocation of va_end() in the same function.

Observed by Joshua Rogers <honey@internot.info>

Debian-Bug-Id: #773475

3 years agogpg: Print better diagnostics for keyserver operations.
Werner Koch [Wed, 18 Feb 2015 11:14:22 +0000 (12:14 +0100)]
gpg: Print better diagnostics for keyserver operations.

* g10/armor.c (parse_key_failed_line): New.
(check_input): Watch out for gpgkeys_ error lines.
* g10/filter.h (armor_filter_context_t): Add field key_failed_code.
* g10/import.c (import): Add arg r_gpgkeys_err.
(import_keys_internal): Ditto.
(import_keys_stream): Ditto.
* g10/keyserver.c (keyserver_errstr): New.
(keyserver_spawn): Detect "KEY " lines while sending.  Get gpgkeys_err
while receiving keys.
(keyserver_work): Add kludge for better error messages.
--

GnuPG-bug-id: 1832

Note that these changes can be backported to 1.4 but they don't make
sense for 2.1 due to the removal of the keyserver helpers.  The error
reporting could be improved even more but given that this is an old
GnuPG branch it is not justified to put too much effort into it.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agokeyserver: Show log prefix when not build with cURL.
Werner Koch [Fri, 13 Feb 2015 10:37:17 +0000 (11:37 +0100)]
keyserver: Show log prefix when not build with cURL.

* keyserver/ksutil.c (init_ks_options) [!HAVE_LIBCURL]: Set logging
prefix.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoUse inline functions to convert buffer data to scalars.
Werner Koch [Thu, 12 Feb 2015 19:34:44 +0000 (20:34 +0100)]
Use inline functions to convert buffer data to scalars.

* include/host2net.h (buf16_to_ulong, buf16_to_uint): New.
(buf16_to_ushort, buf16_to_u16): New.
(buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New.
--

This fixes sign extension on shift problems.  Hanno Böck found a case
with an invalid read due to this problem.  To fix that almost all uses
of "<< 24" and "<< 8" are changed by this patch to use an inline
function from host2net.h.

(back ported from commit 2183683bd633818dd031b090b5530951de76f392)

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agobuild: Update standard build-aux files.
Werner Koch [Wed, 11 Feb 2015 17:51:00 +0000 (18:51 +0100)]
build: Update standard build-aux files.

--

3 years agodoc: Change remaining http links to gnupg.org to https
Werner Koch [Thu, 12 Feb 2015 18:32:19 +0000 (19:32 +0100)]
doc: Change remaining http links to gnupg.org to https

--
GnuPG-bug-id: 1830

3 years agogpg: Prevent an invalid memory read using a garbled keyring.
Werner Koch [Thu, 12 Feb 2015 17:58:36 +0000 (18:58 +0100)]
gpg: Prevent an invalid memory read using a garbled keyring.

* g10/keyring.c (keyring_get_keyblock): Whitelist allowed packet
types.
--

The keyring DB code did not reject packets which don't belong into a
keyring.  If for example the keyblock contains a literal data packet
it is expected that the processing code stops at the data packet and
reads from the input stream which is referenced from the data packets.
Obviously the keyring processing code does not and cannot do that.
However, when exporting this messes up the IOBUF and leads to an
invalid read of sizeof (int).

We now skip all packets which are not allowed in a keyring.

Reported-by: Hanno Böck <hanno@hboeck.de>
(back ported from commit f0f71a721ccd7ab9e40b8b6b028b59632c0cc648)

3 years agogpg: Fix a NULL-deref in export due to invalid packet lengths.
Werner Koch [Thu, 12 Feb 2015 17:54:17 +0000 (18:54 +0100)]
gpg: Fix a NULL-deref in export due to invalid packet lengths.

* g10/build-packet.c (write_fake_data): Take care of a NULL stored as
opaque MPI.
--

Reported-by: Hanno Böck <hanno@hboeck.de>
(back ported from commit 0835d2f44ef62eab51fce6a927908f544e01cf8f)

3 years agogpg: Fix a NULL-deref due to empty ring trust packets.
Werner Koch [Thu, 12 Feb 2015 17:52:07 +0000 (18:52 +0100)]
gpg: Fix a NULL-deref due to empty ring trust packets.

* g10/parse-packet.c (parse_trust): Always allocate a packet.
--

Reported-by: Hanno Böck <hanno@hboeck.de>
Signed-off-by: Werner Koch <wk@gnupg.org>
(back ported from commit 39978487863066e59bb657f5fe4e8baab510da7e)

3 years agokbx: Fix resource leak.
Joshua Rogers [Fri, 30 Jan 2015 02:42:52 +0000 (11:42 +0900)]
kbx: Fix resource leak.

* kbx/keybox-update.c (blob_filecopy): Fix resource leak.  On error
return, 'fp' and 'newfp' was never closed.

--

Signed-off-by: Joshua Rogers <git@internot.info>
[Log entry reformatted, and added more fixes - gniibe]

(cherry picked from commit 7db6c82cec49b7c56c403a8ea98364086baf75f3)

3 years agogpg: Limit the size of key packets to a sensible value.
Werner Koch [Thu, 12 Feb 2015 17:45:08 +0000 (18:45 +0100)]
gpg: Limit the size of key packets to a sensible value.

* g10/parse-packet.c (MAX_KEY_PACKET_LENGTH): New.
(MAX_UID_PACKET_LENGTH): New.
(MAX_COMMENT_PACKET_LENGTH): New.
(MAX_ATTR_PACKET_LENGTH): New.
(parse_key): Limit the size of a key packet to 256k.
(parse_user_id): Use macro for the packet size limit.
(parse_attribute): Ditto.
(parse_comment): Ditto.
--

Without that it is possible to force gpg to allocate large amounts of
memory by using a bad encoded MPI.  This would be an too easy DoS.
Another way to mitigate would be to change the MPI read function to
allocate memory dynamically while reading the MPI.  However, that
complicates and possibly slows down the code.  A too large key packet
is in any case a sign for broken data and thus gpg should not use it.

Reported-by: Hanno Böck
GnuPG-bug-id: 1823
Signed-off-by: Werner Koch <wk@gnupg.org>
(back ported from commit 382ba4b137b42d5f25a7e256bb7c053ee5ac7b64)

3 years agoAvoid double-close in unusual dotlock situations.
Werner Koch [Thu, 12 Feb 2015 17:26:58 +0000 (18:26 +0100)]
Avoid double-close in unusual dotlock situations.

* jnlib/dotlock.c (create_dotlock): Avoid double close due to EINTR.
--

close(2) says:

  close() should not be retried after an EINTR since this may cause a
  reused descriptor from another thread to be closed.

(backported from commit 628b111fa679612e23c0d46505b1ecbbf091897d)

Debian-Bug-Id: 773423
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Allow predefined names as answer to the keygen.algo prompt.
Werner Koch [Wed, 28 Jan 2015 08:11:02 +0000 (09:11 +0100)]
gpg: Allow predefined names as answer to the keygen.algo prompt.

* g10/keygen.c (ask_algo): Add list of strings.

--
Signed-off-by: Werner Koch <wk@gnupg.org>
(backported from commit b1d5ed6ac842469afcb84868d0f6641dc286a6c7)

3 years agogpg: Print a warning if the subkey expiration may not be what you want.
Werner Koch [Mon, 26 Jan 2015 13:55:24 +0000 (14:55 +0100)]
gpg: Print a warning if the subkey expiration may not be what you want.

* g10/keyedit.c (subkey_expire_warning): New.
keyedit_menu): Call it when needed.
--
GnuPG-bug-id: 1715

The heuristic to detect a problem is not very advanced but it should
catch the most common cases.

(backported from commit ae3d1bbb65b65cf3c57bb14886be120f5e31635d)

3 years agobuild: Update to gettext 0.19.3.
Werner Koch [Mon, 26 Jan 2015 13:27:46 +0000 (14:27 +0100)]
build: Update to gettext 0.19.3.

3 years agobuild: Require automake 1.14.
Werner Koch [Mon, 26 Jan 2015 13:31:01 +0000 (14:31 +0100)]
build: Require automake 1.14.

* Makefile.am (AUTOMAKE_OPTIONS): Move to ...
* configure.ac (AM_INIT_AUTOMAKE): here.  Add option serial-tests.
* kbx/Makefile.am (INCLUDES): Remove.  Include ../am/cmacros.

3 years agopo: Yet another update for Chinese (traditional)
Jedi Lin [Wed, 26 Nov 2014 10:58:03 +0000 (11:58 +0100)]
po: Yet another update for Chinese (traditional)