5 years agogpg: Use more specific reason codes for INV_RECP.
Werner Koch [Tue, 10 Jun 2014 12:54:55 +0000 (14:54 +0200)]
gpg: Use more specific reason codes for INV_RECP.

* g10/pkclist.c (build_pk_list): Use more specific reasons codes for

GnuPG-bug-id: 1650

Note that this patch is a bit more limited than the one in 2.1.

5 years agodoc: Remove outdated Russian man page.
Werner Koch [Mon, 23 Jun 2014 06:52:29 +0000 (08:52 +0200)]
doc: Remove outdated Russian man page.

* (DOCBOOK_TO_MAN): Remove.
* doc/ Remove.
* doc/ Remove all related code.

The man page is outdated and we do not use docbook for a long time
now.  If someone wants to revive such a man page, it would be best to
translate the respective parts of the GnuPG manual in git master.

GnuPG-bug-id: 1652

5 years agogpg: Avoid infinite loop in uncompressing garbled packets.
Werner Koch [Fri, 20 Jun 2014 08:39:26 +0000 (10:39 +0200)]
gpg: Avoid infinite loop in uncompressing garbled packets.

* g10/compress.c (do_uncompress): Limit the number of extra FF bytes.

A packet like (a3 01 5b ff) leads to an infinite loop.  Using
--max-output won't help if it is a partial packet.  This patch
actually fixes a regression introduced on 1999-05-31 (c34c6769).
Actually it would be sufficient to stuff just one extra 0xff byte.
Given that this problem popped up only after 15 years, I feel safer to
allow for a very few FF bytes.

Thanks to Olivier Levillain and Florian Maury for their detailed

5 years agogpg: Need to init the trustdb for import.
Werner Koch [Thu, 6 Mar 2014 15:11:34 +0000 (16:11 +0100)]
gpg: Need to init the trustdb for import.

* g10/trustdb.c (clear_ownertrusts): Init trustdb.

This is actually a hack to fix a bug introduced with commit 2528178.
Debian uses it and thus we should do too.

GnuPG-bug-id: 1622

5 years agoSupport building using the latest mingw-w64 toolchain.
Werner Koch [Thu, 23 Jan 2014 14:19:35 +0000 (15:19 +0100)]
Support building using the latest mingw-w64 toolchain.

* acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Change mingw detection.

  From: Stephen Kitt <>

  All MinGW targets require underscores when linking. This patch fixes
  acinclude.m4 and the resulting configure so they don't limit the use
  of underscores to the old mingw32msvc targets.

Debian-bug-id: 730271
Signed-off-by: Werner Koch <>
5 years agoPost release version number bump.
Werner Koch [Fri, 13 Dec 2013 09:03:19 +0000 (10:03 +0100)]
Post release version number bump.


5 years agoRelease 1.4.16 gnupg-1.4.16
Werner Koch [Fri, 13 Dec 2013 08:07:11 +0000 (09:07 +0100)]
Release 1.4.16

5 years agoChange --show-session-key to print the session key earlier.
Werner Koch [Wed, 11 Dec 2013 09:20:15 +0000 (10:20 +0100)]
Change --show-session-key to print the session key earlier.

* g10/mainproc.c (proc_encrypted): Move show_session_key code to ...
* g10/decrypt-data.c (decrypt_data): here.

This feature can be used to return the session key for just a part of
a file.  For example to downloading just the first 32k of a huge file,
decrypting that incomplete part and while ignoring all the errors
break out the session key.  The session key may then be used on the
server to decrypt the entire file without the need to have the private
key on the server.

This is the same feature as
commit 101a54add351ff62793cbfbf3877787c4791f833 for 2.1 and
commit 3ae90ff28c500967cb90b1176299d2ca01ef450f for 2.0.

GnuPG-bug-id: 1389
Signed-off-by: Werner Koch <>
5 years agoUpdate config.{guess,sub} and some copyright notices.
Werner Koch [Tue, 10 Dec 2013 19:33:48 +0000 (20:33 +0100)]
Update config.{guess,sub} and some copyright notices.

* scripts/config.guess, scripts/config.sub: Update to version

Signed-off-by: Werner Koch <>
5 years agoPrepare for newer automakes which default to parallel tests.
Werner Koch [Tue, 22 Oct 2013 12:26:53 +0000 (14:26 +0200)]
Prepare for newer automakes which default to parallel tests.

* checks/ Add a list of test dependencies.

We want to keep the tests in a specific order because that helps to
compare tests and some tests rely on others anyway.

Signed-off-by: Werner Koch <>
5 years agoNormalize the MPIs used as input to secret key functions.
Werner Koch [Wed, 27 Nov 2013 13:22:10 +0000 (14:22 +0100)]
Normalize the MPIs used as input to secret key functions.

* cipher/rsa.c (secret): Normalize the INPUT.
(rsa_decrypt): Pass reduced data to secret.
* cipher/elgamal.c (decrypt): Normalize A and B.
* cipher/dsa.c (sign): Normalize HASH.

mpi_normalize is in general not required because extra leading zeroes
do not harm the computation.  However, adding extra all zero limbs or
padding with multiples of N may be useful in side-channel attacks. In
particular they are used by the acoustic crypt-analysis.  This is an
extra pre-caution which alone would not be sufficient to mitigate the
described attack.

CVE-id: CVE-2013-4576

Signed-off-by: Werner Koch <>
5 years agoUse blinding for the RSA secret operation.
Werner Koch [Tue, 22 Oct 2013 12:26:53 +0000 (14:26 +0200)]
Use blinding for the RSA secret operation.

* cipher/random.c (randomize_mpi): New.
* g10/gpgv.c (randomize_mpi): New stub.
* cipher/rsa.c (USE_BLINDING): Define macro.
(secret): Implement blinding.

GPG 1.x has never used any protection against timing attacks on the
RSA secret operation.  The rationale for this has been that there was
no way to mount a remote timing attack on GnuPG.  With the turning up
of Acoustic Cryptanalysis ( this
assumption no longer holds true and thus we need to do do something
about it.  Blinding seems to be a suitable mitigation to the threat of
key extraction.  It does not help against distinguishing used keys,

Note that GPG 2.x uses Libgcrypt which does blinding by default.

The performance penalty is negligible: Modifying the core pubkey_sign
or pubkey_decrypt function to run 100 times in a loop, the entire
execution times for signing or decrypting a small message using a 4K
RSA key on a Thinkpad X220 are

  Without blinding:  5.2s  (8.9s)
  With blinding:     5.6s  (9.3s)

The numbers in parentheses give the values without the recently
implemented k-ary exponentiation code.  Thus for the next release the
user will actually experience faster signing and decryption.  A
drawback of blinding is that we need random numbers even for
decryption (albeit at low quality).

Signed-off-by: Werner Koch <>
CVE-id: CVE-2013-4576

5 years agogpg: Change armor Version header to emit only the major version.
Werner Koch [Wed, 27 Nov 2013 08:20:02 +0000 (09:20 +0100)]
gpg: Change armor Version header to emit only the major version.

* g10/options.h (opt): Rename field no_version to emit_version.
* g10/gpg.c (main): Init opt.emit_vesion to 1.  Change --emit-version
to bump up opt.emit_version.
* g10/armor.c (armor_filter): Implement different --emit-version

GnuPG-bug-id: 1572
Signed-off-by: Werner Koch <>
(cherry picked from commit e951782e937ce290be0d89d83e84b3daea997587)

Resolved conflicts:

5 years agompi: mpi-pow improvements
Werner Koch [Fri, 18 Oct 2013 08:54:55 +0000 (10:54 +0200)]
mpi: mpi-pow improvements

(mpi_powm) [!USE_ALGORITHM_SIMPLE_EXPONENTIATION]: New implementation
of left-to-right k-ary exponentiation.

This is a backport from Libgcrypt commit

Signed-off-by: NIIBE Yutaka <>
    For the Yarom/Falkner flush+reload cache side-channel attack, we
    changed the code so that it always calls the multiplication
    routine (even if we can skip it to get result).  This results some
    performance regression.

    This change is for recovering performance with efficient

Signed-off-by: Werner Koch <>
5 years agoPrint the keyid for key packets with --list-packets.
Werner Koch [Fri, 18 Oct 2013 08:24:32 +0000 (10:24 +0200)]
Print the keyid for key packets with --list-packets.

* g10/parse-packet.c (parse_key): Add keyid printing.

This is backport from GnuPG-2.  Note that the --list-packets command
is for debugging only and not part iof the stable API.

Signed-off-by: Werner Koch <>
5 years agompi: Fix syntax error for mips64 and gcc < 4.4
Werner Koch [Fri, 11 Oct 2013 12:11:43 +0000 (14:11 +0200)]
mpi: Fix syntax error for mips64 and gcc < 4.4

* mpi/longlong.h [__mips && gcc < 4.4]: Fix cpp syntax error.

GnuPG-bug-id: 1465

5 years agogpg: Do not require a trustdb with --always-trust.
Werner Koch [Fri, 11 Oct 2013 07:25:58 +0000 (09:25 +0200)]
gpg: Do not require a trustdb with --always-trust.

* g10/tdbio.c (tdbio_set_dbname): Add arg R_NOFILE.
* g10/trustdb.c (trustdb_args): Add field no_trustdb.
(init_trustdb): Set that field.
(revalidation_mark):  Take care of a nonexistent trustdb file.
(read_trust_options): Ditto.
(get_ownertrust): Ditto.
(get_min_ownertrust): Ditto.
(update_ownertrust): Ditto.
(update_min_ownertrust): Ditto.
(clear_ownertrusts): Ditto.
(cache_disabled_value): Ditto.
(check_trustdb_stale): Ditto.
(get_validity): Ditto.
* g10/gpg.c (main): Do not create a trustdb with most commands for
trust-model always.

This slightly changes the semantics of most commands in that they
won't create a trustdb if --trust-model=always is used.  It just does
not make sense to create a trustdb if there is no need for it.

Signed-off-by: Werner Koch <>
(cherry picked from commit 1a0eeaacd1bf09fe5125dbc3f56016bc20f3512e)

Resolved conflicts:
 (indentation fixes)

5 years agoPost release updates.
Werner Koch [Fri, 4 Oct 2013 19:29:50 +0000 (21:29 +0200)]
Post release updates.


5 years agoRelease 1.4.15 gnupg-1.4.15
Werner Koch [Fri, 4 Oct 2013 19:10:52 +0000 (21:10 +0200)]
Release 1.4.15

5 years agopo: Autoupdate due to changed order of strings.
Werner Koch [Fri, 4 Oct 2013 19:03:40 +0000 (21:03 +0200)]
po: Autoupdate due to changed order of strings.


5 years agodoc: Update from master.
Werner Koch [Fri, 4 Oct 2013 19:01:16 +0000 (21:01 +0200)]
doc: Update from master.

5 years agogpg: Print a "not found" message for an unknown key in --key-edit.
Werner Koch [Fri, 4 Oct 2013 16:34:56 +0000 (18:34 +0200)]
gpg: Print a "not found" message for an unknown key in --key-edit.

* g10/keyedit.c (keyedit_menu): Print message.

GnuPG-bug-id: 1420
Signed-off-by: Werner Koch <>
(cherry picked from commit 0bf54e60d31389812d05c3fd29bece876204561d)

5 years agogpg: Protect against rogue keyservers sending secret keys.
Werner Koch [Fri, 4 Oct 2013 11:44:39 +0000 (13:44 +0200)]
gpg: Protect against rogue keyservers sending secret keys.

* g10/options.h (IMPORT_NO_SECKEY): New.
* g10/keyserver.c (keyserver_spawn, keyserver_import_cert): Set new
* g10/import.c (import_secret_one): Deny import if flag is set.

By modifying a keyserver or a DNS record to send a secret key, an
attacker could trick a user into signing using a different key and
user id.  The trust model should protect against such rogue keys but
we better make sure that secret keys are never received from remote

Suggested-by: Stefan Tomanek
Signed-off-by: Werner Koch <>
(cherry picked from commit e7abed3448c1c1a4e756c12f95b665b517d22ebe)

Resolved conflicts:

5 years agogpg: Allow setting of all zero key flags
Daniel Kahn Gillmor [Tue, 19 Mar 2013 15:25:25 +0000 (11:25 -0400)]
gpg: Allow setting of all zero key flags

* g10/keygen.c (do_add_key_flags): Do not check for empty key flags.
(cherry picked from commit b693ec02c467696bf9d7324dd081e279f9965151)
(cherry picked from commit dd868acb0d13a9f119c0536777350a6c237a66a1)

5 years agogpg: Distinguish between missing and cleared key flags.
Werner Koch [Fri, 15 Mar 2013 14:46:03 +0000 (15:46 +0100)]
gpg: Distinguish between missing and cleared key flags.

* include/cipher.h (PUBKEY_USAGE_NONE): New.
* g10/getkey.c (parse_key_usage): Set new flag.

We do not want to use the default capabilities (derived from the
algorithm) if any key flags are given in a signature.  Thus if key
flags are used in any way, the default key capabilities are never

This allows to create a key with key flags set to all zero so it can't
be used.  This better reflects common sense.
(cherry picked from commit 4bde12206c5bf199dc6e12a74af8da4558ba41bf)
(cherry picked from commit 0a805ed1604ef3e9b27f3e22a936a2d439300e9f)

Resolved conflicts:

5 years agokeyserver: Allow use of cURL's default CA store.
Werner Koch [Fri, 4 Oct 2013 06:28:12 +0000 (08:28 +0200)]
keyserver: Allow use of cURL's default CA store.

* keyserver/gpgkeys_curl.c (main): Set CURLOPT_CAINFO only if a file
has been given.
* keyserver/gpgkeys_hkp.c (main): Ditto.

GnuPG-bug-id: 1542
Signed-off-by: Werner Koch <>
(cherry picked from commit e957b9b3f408491f36660499b215aebcf2633a95)

5 years agogpg: Limit the nesting level of I/O filters.
Werner Koch [Fri, 4 Oct 2013 06:20:49 +0000 (08:20 +0200)]
gpg: Limit the nesting level of I/O filters.

* until/iobuf.c (MAX_NESTING_FILTER): New.
(iobuf_push_filter2): Limit the nesting level.

This is a more general fix for the nested compression packet bug.  In
particular this helps g10/import.c:read_block to stop pushing
compression filters onto an iobuf stream.

Signed-off-by: Werner Koch <>
5 years agogpg: Fix bug with deeply nested compressed packets.
Werner Koch [Wed, 2 Oct 2013 07:11:43 +0000 (09:11 +0200)]
gpg: Fix bug with deeply nested compressed packets.

* g10/mainproc.c (MAX_NESTING_DEPTH): New.
(proc_compressed): Return an error code.
(check_nesting): New.
(do_proc_packets): Check packet nesting depth.  Handle errors from

Signed-off-by: Werner Koch <>
5 years agoFix bug in mpi_tdiv_q_2exp.
Werner Koch [Mon, 16 Sep 2013 13:57:01 +0000 (15:57 +0200)]
Fix bug in mpi_tdiv_q_2exp.

* mpi/mpi-internal.h (MPN_COPY_INCR): Make it work.

This bug has been with us since the version 0.0.0 of GnuPG.
Fortunately it only affects an optimized code path which is rarely
used in practice: If the shift size matches the size of a
limb (i.e.. 32 or 64); this is is_prime in primegen.c.  Over there the
Rabin-Miller test may fail with a probability of 2^-31 (that is if the
to be tested prime - 1 has the low 32 bits cleared).  In practice the
probability is even much less because we first do a Fermat test on the
randomly generated candidates which sorts out the majority of
composite numbers.

The bug in MPN_COPY_INCR was found by Sven Bjorn.

Signed-off-by: Werner Koch <>
(back ported from Libgcrypt
 commit 7f7a5ef59962ae1a819b5060f9b781469bfe27d5)

5 years agompicalc: Change copyright notice.
Werner Koch [Wed, 4 Sep 2013 13:25:18 +0000 (15:25 +0200)]
mpicalc: Change copyright notice.


Except for a minor change by David Shaw, all code has been written by
me.  After termination of my copyright assignment, I change that
notice to reflect the new legal state.

Signed-off-by: Werner Koch <>
5 years agogpg: Use 2048 as the default keysize in batch mode.
Werner Koch [Fri, 30 Aug 2013 08:19:14 +0000 (10:19 +0200)]
gpg: Use 2048 as the default keysize in batch mode.

* g10/keygen.c (gen_elg, gen_dsa, gen_rsa): Set default keysize to

Signed-off-by: Werner Koch <>
6 years agogpg: No need to create a trustdb when encrypting with --always-trust.
Werner Koch [Fri, 2 Aug 2013 07:17:52 +0000 (09:17 +0200)]
gpg: No need to create a trustdb when encrypting with --always-trust.

* g10/gpg.c (main): Special case setup_trustdb for --encrypt.

(back ported from commit 498b9a95dc65c43240835d64cc92d8fb43014d53)

Signed-off-by: Werner Koch <>
6 years agoPost release updates.
Werner Koch [Thu, 25 Jul 2013 09:00:04 +0000 (11:00 +0200)]
Post release updates.


6 years agoRelease 1.4.14. gnupg-1.4.14
Werner Koch [Thu, 25 Jul 2013 07:33:23 +0000 (09:33 +0200)]
Release 1.4.14.

6 years agoAutoupdate a translation.
Werner Koch [Thu, 25 Jul 2013 08:44:01 +0000 (10:44 +0200)]
Autoupdate a translation.


6 years agoUpdate Chinese translation.
Jedi Lin [Thu, 25 Jul 2013 07:30:05 +0000 (09:30 +0200)]
Update Chinese translation.

6 years agoUpdate to modern beta release numbering scheme.
Werner Koch [Thu, 25 Jul 2013 07:21:46 +0000 (09:21 +0200)]
Update to modern beta release numbering scheme.

* s/my_/mym4_/.  Add new release building code.

6 years agoPrepare for a forthcoming new algorithm id.
Werner Koch [Thu, 25 Jul 2013 07:11:08 +0000 (09:11 +0200)]
Prepare for a forthcoming new algorithm id.

* include/cipher.h (PUBKEY_ALGO_ECC): New.
* g10/keyid.c (pubkey_letter): Add letter 'C'.

ID 22 will be used for generic ECC, i.e. one which can be used for
ECDSA and ECDH.  The only support in 1.4 will pretty printing the
algorithm id.

6 years agoMitigate a flush+reload cache attack on RSA secret exponents.
Werner Koch [Fri, 19 Jul 2013 11:49:23 +0000 (13:49 +0200)]
Mitigate a flush+reload cache attack on RSA secret exponents.

* mpi/mpi-pow.c (mpi_powm): Always perform the mpi_mul for exponents
hold in secure memory.

The attack is described in a paper to be pusblished at

Flush+Reload: a High Resolution, Low Noise, L3 Cache Side-Channel
Attack by Yuval Yarom and Katrina Falkner. 18 July 2013.

  Flush+Reload is a cache side-channel attack that monitors access to
  data in shared pages. In this paper we demonstrate how to use the
  attack to extract private encryption keys from GnuPG.  The high
  resolution and low noise of the Flush+Reload attack enables a spy
  program to recover over 98% of the bits of the private key in a
  single decryption or signing round. Unlike previous attacks, the
  attack targets the last level L3 cache. Consequently, the spy
  program and the victim do not need to share the execution core of
  the CPU. The attack is not limited to a traditional OS and can be
  used in a virtualised environment, where it can attack programs
  executing in a different VM.

Signed-off-by: Werner Koch <>
6 years agoFix git revision parsing.
Werner Koch [Fri, 19 Jul 2013 11:56:24 +0000 (13:56 +0200)]
Fix git revision parsing.

* Use git rev-parse to retrieve the revision.

Signed-off-by: Werner Koch <>
6 years agogpg: fix previous change
NIIBE Yutaka [Tue, 16 Jul 2013 00:21:54 +0000 (09:21 +0900)]
gpg: fix previous change

* g10/gpgv.c: Fix void dotlock_remove_lockfiles.

6 years agogpg: signal handling fix
NIIBE Yutaka [Fri, 12 Jul 2013 08:26:55 +0000 (17:26 +0900)]
gpg: signal handling fix

* include/dotlock.h (dotlock_remove_lockfiles_reclaim): New.
  (dotlock_destroy, dotlock_remove_lockfiles): Add a flag to reclaim
  memory or not.
* util/dotlock.c (dotlock_create): Use
  dotlock_remove_lockfiles_reclaim for atexit.
  (dotlock_destroy_unix, dotlock_destroy)
  (dotlock_remove_lockfiles): Add a reclaim flag.
  (dotlock_remove_lockfiles_reclaim): New.
* g10/signal.c (got_fatal_signal): Disable flag of reclaim memory to
  avoid non-async-face call.
* g10/keydb.c (maybe_create_keyring): Follow the API change.
* g10/gpgv.c: Follow the API change.


signal handler got_fatal_signal should not call non-async-signal-safe
functions.  When malloc is interrupted by a signal, it screws up.

This issue is reported:

6 years agoDifferentiate between success (full or partial), not-found, and failure.
David Shaw [Sun, 3 Mar 2013 01:39:48 +0000 (20:39 -0500)]
Differentiate between success (full or partial), not-found, and failure.

* keyserver/gpgkeys_hkp.c (get_key): Use curl_easy_setinfo to get the
  HTTP status code so we can tell the difference between a successful
  retrieval, a partial retrieval, a not-found, or a server failed.

6 years agoEmulate curl_easy_getinfo and CURLINFO_RESPONSE_CODE in curl-shim.
David Shaw [Sun, 3 Mar 2013 01:07:27 +0000 (20:07 -0500)]
Emulate curl_easy_getinfo and CURLINFO_RESPONSE_CODE in curl-shim.

* keyserver/curl-shim.h, keyserver/curl-shim.c (curl_easy_getinfo):
  New. Return the HTTP status code for the last transfer.

6 years agoFix DNS check for recent OS X releases
David Shaw [Wed, 30 Jan 2013 01:31:01 +0000 (20:31 -0500)]
Fix DNS check for recent OS X releases

* OS X now needs BIND_8_COMPAT and -lresolv

6 years agoAutomake 1.13 compatibility fix.
Werner Koch [Fri, 11 Jan 2013 14:42:32 +0000 (15:42 +0100)]
Automake 1.13 compatibility fix.

GnuPG-bug-id: 1459

6 years agoFix idea.c for big endian CPUs.
Werner Koch [Fri, 11 Jan 2013 14:10:38 +0000 (15:10 +0100)]
Fix idea.c for big endian CPUs.

* cipher/idea.c: Replace use of WORDS_BIGENDIAN by BIG_ENDIAN_HOST.
GnuPG-bug-id: 1461

6 years agoFix honoring --cert-digest-algo when recreating a cert
Christian Aistleitner [Sun, 14 Oct 2012 18:33:00 +0000 (20:33 +0200)]
Fix honoring --cert-digest-algo when recreating a cert

* g10/sign.c (update_keysig_packet): Override original signature's
digest algo in hashed data.

6 years agoPost release updates
Werner Koch [Thu, 20 Dec 2012 20:25:07 +0000 (21:25 +0100)]
Post release updates


6 years agoRelease 1.4.13. gnupg-1.4.13
Werner Koch [Thu, 20 Dec 2012 19:30:15 +0000 (20:30 +0100)]
Release 1.4.13.

6 years agoLast fix for the SRV record patches.
Werner Koch [Thu, 20 Dec 2012 19:28:21 +0000 (20:28 +0100)]
Last fix for the SRV record patches.

* keyserver/gpgkeys_hkp.c (srv_replace): Make sure SRVCOUNT is
always initialized.

See commit 5c557a51.

6 years agoUpdate manuals from master
Werner Koch [Thu, 20 Dec 2012 19:12:50 +0000 (20:12 +0100)]
Update manuals from master

* doc/ (update-source): Copy from Git master.
(update-source-from-gnupg-2): Remove.
* doc/gpg.texi: Fix minor typos and grammar bugs.
* doc/yat2m.c: Change diagnostics to updated coding standards.

6 years agoUpdate config.{guess,sub} to version 2012-07-31.
Werner Koch [Thu, 20 Dec 2012 18:53:58 +0000 (19:53 +0100)]
Update config.{guess,sub} to version 2012-07-31.

* scripts/config.guess, scripts/config.sub: Update.

6 years agopo: Update Danish translation.
Joe Hansen [Thu, 1 Nov 2012 15:44:29 +0000 (11:44 -0400)]
po: Update Danish translation.

* po/da.po: Update.

6 years agopo: Update zh_TW.po.
Werner Koch [Thu, 20 Dec 2012 17:36:27 +0000 (18:36 +0100)]
po: Update zh_TW.po.


Applied changes from Jedi Lin as received in May and fixed fuzzies due
to English typo corrections.

6 years agogpg: Suppress "public key already present" in quiet mode.
Werner Koch [Wed, 19 Dec 2012 10:21:26 +0000 (11:21 +0100)]
gpg: Suppress "public key already present" in quiet mode.

* g10/pkclist.c (build_pk_list): Print two diagnostics only in
non-quiet mode.

(back-ported from commit 8325d616593187ff227853de0295e3269b96edcb)

6 years agoImport only packets which are allowed in a keyblock.
Werner Koch [Thu, 20 Dec 2012 08:43:41 +0000 (09:43 +0100)]
Import only packets which are allowed in a keyblock.

* g10/import.c (valid_keyblock_packet): New.
(read_block): Store only valid packets.

A corrupted key, which for example included a mangled public key
encrypted packet, used to corrupt the keyring.  This change skips all
packets which are not allowed in a keyblock.

GnuPG-bug-id: 1455

6 years agoIssue 1447: Pass proper Host header and SNI when SRV is used with curl.
David Shaw [Wed, 19 Dec 2012 18:54:27 +0000 (13:54 -0500)]
Issue 1447: Pass proper Host header and SNI when SRV is used with curl.

* Check for inet_ntop.

* m4/libcurl.m4: Provide a #define for the version of the curl

* keyserver/gpgkeys_hkp.c (main, srv_replace): Call getaddrinfo() on
  each target.  Once we find one that resolves to an address (whether
  IPv4 or IPv6), pass it into libcurl via CURLOPT_RESOLVE using the
  SRV name as the "host".  Force the HTTP Host header to be the same.

Backported from 6b1f71055ebab36989e2089cfde319d2ba40ada7

* keyserver/gpgkeys_hkp.c (main): Only default try-dns-srv to on if we
  have SRV support in the first place.

Backported from 732f3d1d4786239db5f31f82cc04ec79326cc13c

6 years agoPart of issue 1447: Pass proper Host header when SRV is used.
David Shaw [Wed, 19 Dec 2012 16:43:28 +0000 (11:43 -0500)]
Part of issue 1447: Pass proper Host header when SRV is used.

* common/http.c (send_request, connect_server): Set proper Host header
  (no :port, host is that of the SRV) when SRV is used in the

Backported from cbe98b2cb1e40ba253300e604996681ae191e363

6 years agoRemove trailing white space from some files
Werner Koch [Wed, 19 Dec 2012 13:05:56 +0000 (14:05 +0100)]
Remove trailing white space from some files


6 years agoAdjust to GNU coding standards
Werner Koch [Wed, 19 Dec 2012 13:03:25 +0000 (14:03 +0100)]
Adjust to GNU coding standards


A variable definition with initialization shall have only one variable
per type.

6 years agoFix last commit
Werner Koch [Wed, 19 Dec 2012 12:57:29 +0000 (13:57 +0100)]
Fix last commit

* util/http.c (connect_server): Bump SRVINDEX and not SRV.

6 years agoFix issue 1446: honor ports given in SRV responses.
David Shaw [Wed, 19 Dec 2012 02:58:53 +0000 (21:58 -0500)]
Fix issue 1446: honor ports given in SRV responses.

* common/http.c (send_request, connect_server, http_open): Use a
  struct srv instead of a single srvtag so we can pass the chosen host
  and port back to the caller.
  (connect_server): Use the proper port in the HAVE_GETADDRINFO case.

* keyserver/curl-shim.c (curl_easy_perform): Use struct srv and log
  chosen host and port.

* keyserver/gpgkeys_hkp.c (main): Properly take the port given by SRV.

Backported from ba9e974f1fd85b3dbbfb5e26d7a14f71d07c7cf2

6 years ago.gitignore: Add cruft from other branches.
Werner Koch [Tue, 18 Dec 2012 19:03:21 +0000 (20:03 +0100)]
.gitignore: Add cruft from other branches.


6 years agoState that disclaimers are not anymore needed for translations.
Werner Koch [Tue, 18 Dec 2012 18:54:23 +0000 (19:54 +0100)]
State that disclaimers are not anymore needed for translations.


6 years agoAdd meta option ignore-invalid-option.
Werner Koch [Tue, 18 Dec 2012 17:26:56 +0000 (18:26 +0100)]
Add meta option ignore-invalid-option.

* util/argparse.c (iio_item_def_s, IIO_ITEM_DEF): New.
(initialize): Init field IIO_LIST.
(ignore_invalid_option_p): New.
(ignore_invalid_option_add): New.
(ignore_invalid_option_clear): New.
(optfile_parse): Implement meta option.

This option is currently of no use.  However, as soon as it has been
deployed in all stable versions of GnuPG, it will allow the use of the
same configuration file with an old and a new version of GnuPG.  For
example: If a new version implements the option "foobar", and a user
uses it in gpg.conf, an old version of gpg would bail out with the
error "invalid option".  To avoid that the following line can be put
above that option in gpg.conf

  ignore-invalid-option foobar

This meta option may be given several times or several option names
may be given as arguments (space delimited).  Note that this option is
not available on the command line.

(backported from commit 41d564333d35c923f473aa90625d91f8fe18cd0b)

6 years agoFix potential heap corruption in "gpg -v --version"
Werner Koch [Sat, 15 Dec 2012 10:28:00 +0000 (11:28 +0100)]
Fix potential heap corruption in "gpg -v --version"

* g10/gpg.c (build_list): Rewrite to cope with buffer overflow in
certain locales.
* util/membuf.c (put_membuf_str): New.
(get_membuf): Make LEN optional.

This fixes an obvious bug in locales where the translated string is
longer than the original.  The bug could be exhibited by using
LANG=ru_RU.utf8 gpg -v --version.

En passant we also removed the trailing white space on continued

Reported-by: Dmitry V. Levin" <ldv at>
6 years agoUpdate README and po files for a release
Werner Koch [Fri, 14 Dec 2012 17:24:02 +0000 (18:24 +0100)]
Update README and po files for a release


6 years agoWorkaround for a gettext problem during "make distcheck".
Werner Koch [Fri, 14 Dec 2012 17:22:34 +0000 (18:22 +0100)]
Workaround for a gettext problem during "make distcheck".

* Add comment string "GNU gnupg".

We already use this kludge in 2.x.

6 years agogettext: Upgrade to version 0.18
Werner Koch [Fri, 14 Dec 2012 15:08:23 +0000 (16:08 +0100)]
gettext: Upgrade to version 0.18

* (AM_GNU_GETTEXT_VERSION): Bump to 0.18.
* po/ Upgrade to gettext-0.18.  Keep option --previous
of msgmerge.
* intl/: Upgrade to gettext-0.18.
* m4/gettext.m4: Upgrade to gettext-0.18.1.
* m4/iconv.m4: Upgrade to gettext-0.18.1.
* m4/lib-ld.m4: Upgrade to gettext-0.18.1.
* m4/lib-link.m4: Upgrade to gettext-0.18.1.
* m4/lib-prefix.m4: Upgrade to gettext-0.18.1.
* m4/nls.m4: Upgrade to gettext-0.18.1.
* m4/po.m4: Upgrade to gettext-0.18.1.
* m4/progtest.m4: Upgrade to gettext-0.18.1.
* m4/codeset.m4: Upgrade to gettext-0.18.1.
* m4/fcntl-o.m4: New file, from gettext-0.18.1.
* m4/glibc2.m4: Upgrade to gettext-0.18.1.
* m4/glibc21.m4: Upgrade to gettext-0.18.1.
* m4/intdiv0.m4: Upgrade to gettext-0.18.1.
* m4/intl.m4: Upgrade to gettext-0.18.1.
* m4/intldir.m4: Upgrade to gettext-0.18.1.
* m4/intlmacosx.m4: Upgrade to gettext-0.18.1.
* m4/intmax.m4: Upgrade to gettext-0.18.1.
* m4/inttypes_h.m4: Upgrade to gettext-0.18.1.
* m4/inttypes-pri.m4: Upgrade to gettext-0.18.1.
* m4/lcmessage.m4: Upgrade to gettext-0.18.1.
* m4/lock.m4: Upgrade to gettext-0.18.1.
* m4/longlong.m4: Upgrade to gettext-0.18.1.
* m4/printf-posix.m4: Upgrade to gettext-0.18.1.
* m4/size_max.m4: Upgrade to gettext-0.18.1.
* m4/stdint_h.m4: Upgrade to gettext-0.18.1.
* m4/threadlib.m4: New file, from gettext-0.18.1.
* m4/uintmax_t.m4: Upgrade to gettext-0.18.1.
* m4/visibility.m4: Upgrade to gettext-0.18.1.
* m4/wchar_t.m4: Upgrade to gettext-0.18.1.
* m4/wint_t.m4: Upgrade to gettext-0.18.1.
* m4/xsize.m4: Upgrade to gettext-0.18.1.
* m4/ (EXTRA_DIST): Add the new files.

6 years agoSupport NetBSD m68K ELF targets
Werner Koch [Thu, 13 Dec 2012 17:15:38 +0000 (18:15 +0100)]
Support NetBSD m68K ELF targets

* mpi/config.links (m68k*-*-netbsdelf): New.


The original patch from NetBSD had this additional code:

if ! test x$M68060 = xYES; then
    path="m68k/mc68020 m68k"

However, this bypasses the config system.  It would be better to add
proper support for this CPU to config.sub.

6 years agoCard: Fix the process of writing key or generating key.
NIIBE Yutaka [Thu, 13 Dec 2012 04:36:23 +0000 (13:36 +0900)]
Card: Fix the process of writing key or generating key.

* g10/app-openpgp.c (store_fpr): Flush KEY-FPR and KEY-TIME.

(cherry picked from commit e7dca3e83ebd6df0a7ea55e97c3cd6e91be90af5)

6 years agoFix mksamplekeys awk to not leave out the whitespace altogether
David Shaw [Fri, 30 Nov 2012 17:39:05 +0000 (12:39 -0500)]
Fix mksamplekeys awk to not leave out the whitespace altogether

6 years agoRefresh sample keys
David Shaw [Fri, 30 Nov 2012 17:21:45 +0000 (12:21 -0500)]
Refresh sample keys

* mksamplekeys: Tweak awk script to not add trailing whitespace to
  blank lines (makes git pre-commit hook unhappy).

* samplekeys.asc: Refresh.

6 years agoThe keyserver search menu should honor --keyid-format
David Shaw [Thu, 29 Nov 2012 17:00:46 +0000 (12:00 -0500)]
The keyserver search menu should honor --keyid-format

* keyserver.c (print_keyrec): Honor --keyid-format when getting back
  full fingerprints from the keyserver (the comment in the code was
  correct, the code was not).

6 years agotests: Skip secret key import check in SELinux mode
Werner Koch [Thu, 8 Nov 2012 16:16:40 +0000 (17:16 +0100)]
tests: Skip secret key import check in SELinux mode

* (ENABLE_SELINUX_HACKS): New am_conditional.
* checks/ (prepared.stamp): Replace by
( Create and set enable_selinux_hacks variable.
* checks/ Include

* checks/armor.test: Do not run the last test in selinux mode.

GnuPG-bug-id: 1390

6 years agode.po: Grammar fix
Werner Koch [Thu, 8 Nov 2012 15:31:22 +0000 (16:31 +0100)]
de.po: Grammar fix

* po/de.po: Grammar fix by Daniel Leidert

GnuPG-bug-id: 1276

6 years agoCreate off-line card encryption key with the right size.
Werner Koch [Thu, 8 Nov 2012 14:59:47 +0000 (15:59 +0100)]
Create off-line card encryption key with the right size.

* g10/keygen.c (gen_card_key_with_backup): Get the size of the key
from the card.

Formerly the off-line encryption key was created with a fixed length
of 1024 bit.  With this change the key is created as expected.

GnuPG-bug-id: 1230

6 years agoSupport the not anymore patented IDEA cipher algorithm.
Werner Koch [Thu, 8 Nov 2012 12:25:02 +0000 (13:25 +0100)]
Support the not anymore patented IDEA cipher algorithm.

* cipher/idea.c: New.  Take from Libgcrypt master and adjust for
direct use in GnuPG.
* cipher/idea-stub.c: Remove.
* cipher/ Add idea.c and remove idea-stub.c rules.
* Remove idea-stub code.
* g10/gpg.c (check_permissions): Remove code path for ITEM==2.
(main): Make --load-extension a dummy option.
* g10/keygen.c (keygen_set_std_prefs): Include IDEA only in PGP2
compatibility mode.
* g10/misc.c (idea_cipher_warn): Remove.  Also remove all callers.
* g10/seckey-cert.c (do_check): Remove emitting of STATUS_RSA_OR_IDEA.
* g10/status.c (get_status_string): Remove STATUS_RSA_OR_IDEA.
* g10/status.h (STATUS_RSA_OR_IDEA): Remove.


To keep the number of actually used algorithms low, we support IDEA
only in a basically read-only way (unless --pgp2 is used during key
generation).  It does not make sense to suggest the use of this old 64
bit blocksize algorithm.  However, there is old data available where
it might be helpful to have IDEA available.

6 years agoFix usage of dlerror to conform to POSIX.
Werner Koch [Wed, 7 Nov 2012 20:38:27 +0000 (21:38 +0100)]
Fix usage of dlerror to conform to POSIX.

* cipher/idea-stub.c: Clear last error before dlsym.

This is required for NetBSD.

Reported-by: Thomas Klausner
6 years agoImprove handling of random_seed read errors.
Werner Koch [Wed, 7 Nov 2012 17:06:27 +0000 (18:06 +0100)]
Improve handling of random_seed read errors.

* cipher/random.c (read_seed_file): Distinguish between errors and
short reads.

This should help to avoid program aborts due to races.  Nevertheless a
better and cross-platform locking would be a more solid solution.

GnuPG-bug-id: 1439

6 years agoRemove trailing white space from one file
Werner Koch [Wed, 7 Nov 2012 17:00:45 +0000 (18:00 +0100)]
Remove trailing white space from one file


6 years agoHandle systems which have uint64_t but not the UINT64_C macro.
Thomas Klausner [Sat, 27 Oct 2012 17:56:11 +0000 (19:56 +0200)]
Handle systems which have uint64_t but not the UINT64_C macro.

* include/types.h (U64_C) [!UINT64_C]: Add simple replacement.

This could happen with UNIX98-type systems, such as the code on
the netbsd-1-5 branch, and would prevent this package from building
on such systems.

6 years agoIndent nested cpp directives for better readability.
Werner Koch [Tue, 6 Nov 2012 16:44:11 +0000 (17:44 +0100)]
Indent nested cpp directives for better readability.


6 years agoFix extern inline use for gcc > 4.3 in c99 mode
Werner Koch [Tue, 6 Nov 2012 16:14:04 +0000 (17:14 +0100)]
Fix extern inline use for gcc > 4.3 in c99 mode

* mpi/mpi-inline.h [!G10_MPI_INLINE_DECL]: Take care of changed extern
inline semantics in gcc.

I am not use how this will work out with non-gcc. However, we had no
problems in the past and thus this change is the least invasive for
non-gcc compilers.

6 years Do not use -c with chmod.
Werner Koch [Tue, 6 Nov 2012 15:21:52 +0000 (16:21 +0100)] Do not use -c with chmod.


6 years agoUpdate translations to adjust for typo fixes
Werner Koch [Fri, 24 Aug 2012 15:29:28 +0000 (17:29 +0200)]
Update translations to adjust for typo fixes

6 years agoUpdate French translation.
David Prévot [Sun, 5 Aug 2012 22:43:02 +0000 (18:43 -0400)]
Update French translation.

* po/fr.po: Update.

6 years agoFix typos spotted during translations
Werner Koch [Fri, 24 Aug 2012 14:37:44 +0000 (16:37 +0200)]
Fix typos spotted during translations

* g10/gpg.c: uppercase after Syntax
* util/secmem.c (print_warn): Update URL.

6 years agoActually show translators comments in PO files
David Prévot [Sun, 5 Aug 2012 22:22:46 +0000 (18:22 -0400)]
Actually show translators comments in PO files


Note that strings marked for gettext need to immediately follow a
TRANSLATOR comment block.

6 years agoKeep previous msgids of translated messages
David Prévot [Tue, 31 Jul 2012 23:27:44 +0000 (19:27 -0400)]
Keep previous msgids of translated messages

* po/ Use option --previous with msgmerge.

7 years agoWith --quiet do not print reading passphrase from fd message.
Werner Koch [Sun, 29 Apr 2012 09:54:28 +0000 (11:54 +0200)]
With --quiet do not print reading passphrase from fd message.

Fix for bug#1403.
* g10/passphrase.c (read_passphrase_from_fd): Act on --quiet.

7 years agoHonor --cert-digest-algo when recreating a cert.
David Shaw [Wed, 1 Feb 2012 02:30:05 +0000 (21:30 -0500)]
Honor --cert-digest-algo when recreating a cert.

* g10/sign.c (update_keysig_packet): Honor --cert-digest-algo when
  recreating a cert.

This is used by various things in --edit-key like setpref, primary,
etc.  Suggested by Christian Aistleitner.

7 years agoRelease 1.4.12 gnupg-1.4.12
Werner Koch [Mon, 30 Jan 2012 12:42:13 +0000 (13:42 +0100)]
Release 1.4.12

7 years agoFix ChangeLog creation rule.
Werner Koch [Mon, 30 Jan 2012 14:11:54 +0000 (15:11 +0100)]
Fix ChangeLog creation rule.

* (gen-ChangeLog): Use set -e.  Fixes commit b99e77d5.

7 years agoAuto update of uk.po
Werner Koch [Mon, 30 Jan 2012 14:12:31 +0000 (15:12 +0100)]
Auto update of uk.po


7 years agoAdd Ukrainian translation.
Werner Koch [Mon, 30 Jan 2012 12:39:31 +0000 (13:39 +0100)]
Add Ukrainian translation.

* po/uk.po: New.
* po/LINGUAS: Add uk.po.

7 years agoUpdate GNU helper files.
Werner Koch [Mon, 30 Jan 2012 09:47:23 +0000 (10:47 +0100)]
Update GNU helper files.

* scripts/config.guess, scripts/config.rpath: Update to version
* scripts/config.rpath, scripts/compile, scripts/depcomp: Update to
modern version.
* scripts/texinfo.tex: Update from current gnulib.

7 years agoUpdate sample keys.
Werner Koch [Mon, 30 Jan 2012 09:42:34 +0000 (10:42 +0100)]
Update sample keys.


7 years agoUpdate documentation.
Werner Koch [Mon, 30 Jan 2012 09:40:31 +0000 (10:40 +0100)]
Update documentation.

* doc/gpg.texi, doc/specify-user-id.texi, doc/yat2m.c: Update from
current GnuPG master (commit bdde44a).