gnupg.git
13 months agoindent: Fix indentation of an if block.
Werner Koch [Wed, 19 Jul 2017 08:12:00 +0000 (10:12 +0200)]
indent: Fix indentation of an if block.

--

13 months agogpg: Fix memory leak.
NIIBE Yutaka [Fri, 7 Jul 2017 12:53:12 +0000 (21:53 +0900)]
gpg: Fix memory leak.

* g10/textfilter.c (copy_clearsig_text): Free the buffer.

--

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

13 months agorsa: Reduce secmem pressure.
NIIBE Yutaka [Fri, 7 Jul 2017 12:51:42 +0000 (21:51 +0900)]
rsa: Reduce secmem pressure.

* cipher/rsa.c (secret): Don't keep secmem.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
13 months agorsa: Allow different build directory.
NIIBE Yutaka [Fri, 7 Jul 2017 12:20:56 +0000 (21:20 +0900)]
rsa: Allow different build directory.

* cipher/Makefile.am (AM_CPPFLAGS): Add mpi dirs.
* cipher/rsa.c: Change include file.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
13 months agorsa: Add exponent blinding.
Marcus Brinkmann [Fri, 7 Jul 2017 12:03:10 +0000 (21:03 +0900)]
rsa: Add exponent blinding.

* cipher/rsa.c (secret_core_crt): Blind secret D with randomized
nonce R for mpi_powm computation.

--

Backport of libgcrypt 8725c99ffa41778f382ca97233183bcd687bb0ce.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
13 months agompi: Minor fix for mpi_pow.
NIIBE Yutaka [Fri, 7 Jul 2017 06:12:00 +0000 (15:12 +0900)]
mpi: Minor fix for mpi_pow.

* mpi/mpi-pow.c (mpi_powm): Fix allocation size.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
13 months agompi: Same computation for square and multiply for mpi_pow.
NIIBE Yutaka [Fri, 7 Jul 2017 05:38:19 +0000 (14:38 +0900)]
mpi: Same computation for square and multiply for mpi_pow.

* mpi/mpi-pow.c (_gcry_mpi_powm): Compare msize for max_u_size.  Move
the assignment to base_u into the loop.  Copy content refered by RP to
BASE_U except the last of the loop.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(backport commit of libgcrypt master:
78130828e9a140a9de4dafadbc844dbb64cb709a)

13 months agompi: Simplify mpi_powm.
NIIBE Yutaka [Fri, 7 Jul 2017 05:26:39 +0000 (14:26 +0900)]
mpi: Simplify mpi_powm.

* mpi/mpi-pow.c (_gcry_mpi_powm): Simplify the loop.

--

(backport of libgcrypt master commit:
 719468e53133d3bdf12156c5bfdea2bf15f9f6f1)

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
13 months agompi: Fix ARM assembler in longlong.h.
Marcus Brinkmann [Tue, 4 Jul 2017 21:19:51 +0000 (23:19 +0200)]
mpi: Fix ARM assembler in longlong.h.

* mpi/longlong.h [__arm__] (add_ssaaaa, sub_ddmmss): Add __CLOBBER_CC.
[__arm__][__ARM_ARCH <= 3] (umul_ppmm): Add __AND_CLOBBER_CC.

--
This is a backport of libgcrypt 8aa4f2161 and 3b1cc9e6c.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3182

13 months agodoc: Fix typo.
Marcus Brinkmann [Mon, 3 Jul 2017 09:02:42 +0000 (11:02 +0200)]
doc: Fix typo.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3243

15 months agog10: Fix secmem leak.
Ineiev [Thu, 14 Apr 2016 15:42:25 +0000 (15:42 +0000)]
g10: Fix secmem leak.

* g10/keygen.c (proc_parameter_file): Fix secmem leak.

--

proc_parameter_file adds certain parameters to the list in the PARA
argument; however, these new entries are leaked because they
are added to head, while the PARA list is released by the caller
of proc_parameter_file.

GnuPG-bug-id: 1371
Signed-off-by: Ineiev <ineiev@gnu.org>
16 months agogpg: Fix exporting of zero length user ID packets.
Werner Koch [Thu, 30 Mar 2017 08:35:20 +0000 (10:35 +0200)]
gpg: Fix exporting of zero length user ID packets.

* g10/build-packet.c (do_user_id): Avoid indeterminate length header.
--

We are able to import such user ids but when exporting them the
exported data could not be imported again because the parser bails out
on invalid keyrings.  This is now fixed and should be backported.

Note that in 1.4 and 2.0 this is only an issue for attribute packets.
In 2.1 user IDs were also affected.a

Signed-off-by: Werner Koch <wk@gnupg.org>
21 months agospelling: Correct achived to achieved.
Daniel Kahn Gillmor [Mon, 29 Aug 2016 14:36:33 +0000 (10:36 -0400)]
spelling: Correct achived to achieved.

--
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
21 months agotools: Fix option parsing for gpg-zip.
Neal H. Walfield [Mon, 29 Aug 2016 14:56:16 +0000 (10:56 -0400)]
tools: Fix option parsing for gpg-zip.

* tools/gpg-zip.in: Correctly set GPG when --gpg is specified.
Correctly set TAR when --tar is specified.  Pass TAR_ARGS to tar.

(cherry-picked by dkg from master branch's
84ebf15b06e435453b2f58775f97a3a1c61a7e55)

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Co-authored-by: Michael Mönch <michael.moench@marktjagd.de>
GnuPG-bug-id 1351
GnuPG-bug-id 1442

2 years agopo: Update Norwegian translation
Åka Sikrom [Thu, 18 Aug 2016 14:46:37 +0000 (16:46 +0200)]
po: Update Norwegian translation

--

Minor change: Re-insert the old copyright year 2004. - wk

2 years agoPost release updates
Werner Koch [Wed, 17 Aug 2016 13:29:13 +0000 (15:29 +0200)]
Post release updates

--

2 years agoRelease 1.4.21 gnupg-1.4.21
Werner Koch [Wed, 17 Aug 2016 13:07:57 +0000 (15:07 +0200)]
Release 1.4.21

2 years agogpg: Add dummy option --with-subkey-fingerprint.
Werner Koch [Wed, 17 Aug 2016 12:50:35 +0000 (14:50 +0200)]
gpg: Add dummy option --with-subkey-fingerprint.

* g10/gpg.c (opts): Add dummy option.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopo: Auto update
Werner Koch [Wed, 17 Aug 2016 12:41:16 +0000 (14:41 +0200)]
po: Auto update

--

2 years agobuild: Create a swdb file during "make distcheck".
Werner Koch [Wed, 17 Aug 2016 12:39:26 +0000 (14:39 +0200)]
build: Create a swdb file during "make distcheck".

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

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agobuild: Update config.{guess,sub} to {2016-05-15,2016-06-20}.
Werner Koch [Wed, 17 Aug 2016 12:36:25 +0000 (14:36 +0200)]
build: Update config.{guess,sub} to {2016-05-15,2016-06-20}.

--

2 years agopo: Update Russian translation
Ineiev [Wed, 17 Aug 2016 12:31:12 +0000 (14:31 +0200)]
po: Update Russian translation

2 years agorandom: Hash continuous areas in the csprng pool.
Werner Koch [Wed, 17 Aug 2016 09:15:50 +0000 (11:15 +0200)]
random: Hash continuous areas in the csprng pool.

* cipher/random.c (mix_pool): Store the first hash at the end of the
pool.
--

This fixes a long standing bug (since 1998) in Libgcrypt and GnuPG.
An attacker who obtains 580 bytes of the random number from the
standard RNG can trivially predict the next 20 bytes of output.

This bug does not affect the default generation of
keys because running gpg for key creation creates at most 2 keys from
the pool: For a single 4096 bit RSA key 512 byte of random are
required and thus for the second key (encryption subkey), 20 bytes
could be predicted from the the first key.  However, the security of
an OpenPGP key depends on the primary key (which was generated first)
and thus the 20 predictable bytes should not be a problem.  For the
default key length of 2048 bit nothing will be predictable.

For the former default of DSA+Elgamal key it is complicate to give an
answer: For 2048 bit keys a pool of 30 non-secret candidate primes of
about 300 bits each are first created.  This reads at least 1140 bytes
from the pool and thus parts could be predicted.  At some point a 256
bit secret is read from the pool; which in the worst case might be
partly predictable.

The bug was found and reported by Felix Dörre and Vladimir Klebanov,
Karlsruhe Institute of Technology.  A paper describing the problem in
detail will shortly be published.

CVE-id: CVE-2016-6313
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocipher: Improve readability by using a macro.
Werner Koch [Wed, 17 Aug 2016 09:03:07 +0000 (11:03 +0200)]
cipher: Improve readability by using a macro.

* cipher/random.c (mix_pool): Use DIGESTLEN instead of 20.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agogpg: Avoid publishing the GnuPG version by default
Daniel Kahn Gillmor [Fri, 5 Aug 2016 14:46:43 +0000 (10:46 -0400)]
gpg: Avoid publishing the GnuPG version by default

* g10/gpg.c (main): initialize opt.emit_version to 0
* doc/gpg.texi: document different default for --emit-version

--

The version of GnuPG in use is not particularly helpful.  It is not
cryptographically verifiable, and it doesn't distinguish between
significant version differences like 2.0.x and 2.1.x.

Additionally, it leaks metadata that can be used to distinguish users
from one another, and can potentially be used to target specific
attacks if there are known behaviors that differ between major
versions.

It's probably better to take the more parsimonious approach to
metadata production by default.

(backport of master commit c9387e41db7520d176edd3d6613b85875bdeb32c)

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agoClean up "allow to"
Daniel Kahn Gillmor [Wed, 3 Aug 2016 15:56:56 +0000 (11:56 -0400)]
Clean up "allow to"

* README, cipher/cipher.c, cipher/pubkey.c, doc/gpg.texi: replace
  "allow to" with clearer text

In standard English, the normal construction is "${XXX} allows ${YYY}
to" -- that is, the subject (${XXX}) of the sentence is allowing the
object (${YYY}) to do something.  When the object is missing, the
phrasing sounds awkward, even if the object is implied by context.
There's almost always a better construction that isn't as awkward.

These changes should make the language a bit clearer.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agoFix spelling: "occured" should be "occurred"
Daniel Kahn Gillmor [Wed, 3 Aug 2016 15:56:55 +0000 (11:56 -0400)]
Fix spelling: "occured" should be "occurred"

* checks/armor.test, cipher/des.c, g10/ccid-driver.c, g10/pkclist.c,
  util/regcomp.c, util/regex_internal.c: correct the spelling of
  "occured" to "occurred"

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agog10: Fix checking key for signature validation.
NIIBE Yutaka [Thu, 4 Aug 2016 07:21:39 +0000 (16:21 +0900)]
g10: Fix checking key for signature validation.

* g10/sig-check.c (signature_check2): Not only subkey, but also primary
key should have flags.valid=1.

--

(backport of master
commit 6f284e6ed63f514b15fe610f490ffcefc87a2164)

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agoPartially revert "g10: Fix another race condition for trustdb access."
Justus Winter [Wed, 3 Aug 2016 15:17:50 +0000 (17:17 +0200)]
Partially revert "g10: Fix another race condition for trustdb access."

This amends db246f8b which accidentally included the compiled
translation files.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogpgv: Tweak default options for extra security.
NIIBE Yutaka [Sat, 9 Jul 2016 01:20:02 +0000 (10:20 +0900)]
gpgv: Tweak default options for extra security.

* g10/gpgv.c (main): Set opt.no_sig _cache, so that it doesn't depend on
cached status.  Similarly, set opt.flags.require_cross_cert for backsig
validation for subkey signature.

--

(backport of master
commit e32c575e0f3704e7563048eea6d26844bdfc494b)

It is common that an organization distributes binary keyrings with
signature cache (Tag 12, Trust Packet) and people use gpgv to validate
signature with such keyrings.  In such a use case, it is possible that
the key validation itself is skipped.

For the purpose of gpgv validation of signatures, we should not depend
on signature cache in keyrings (if any), but we should validate the key
by its self signature for primary key, and back signature for subkey.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: Fix keysize with --expert.
NIIBE Yutaka [Wed, 6 Jul 2016 02:45:05 +0000 (11:45 +0900)]
g10: Fix keysize with --expert.

* g10/keygen.c (ask_keysize): It's 768 only for DSA.

--

GnuPG-bug-id: 2238
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: Fix --list-packets.
NIIBE Yutaka [Tue, 28 Jun 2016 06:56:48 +0000 (15:56 +0900)]
g10: Fix --list-packets.

* g10/gpg.c (main): Call set_packet_list_mode after assignment of
opt.list_packets.
* g10/mainproc.c (do_proc_packets): Don't stop processing with
--list-packets as the comment says.
* g10/options.h (list_packets): Fix the comment.
* g10/parse-packet.c: Fix the condition for opt.list_packets.

--

(backport from 2.0 commit 4f336ed780cc2783395f3ff2b12b3ebb8e097f7b
which is backport of master
commit 52f65281f9743c42a48bf5a3354c9ab0ecdb681a)

Debian-bug-id: 828109
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 years agog10: Fix another race condition for trustdb access.
Niibe Yutaka [Tue, 14 Jun 2016 23:41:56 +0000 (08:41 +0900)]
g10: Fix another race condition for trustdb access.

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

--

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

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

2 years agodoc: Remove non-implemented option --skip-hidden-recipients.
Werner Koch [Wed, 8 Jun 2016 16:03:43 +0000 (18:03 +0200)]
doc: Remove non-implemented option --skip-hidden-recipients.

--

GnuPG-bug-id: 1394

Note that --try-secret-key was already removed with commit
2889a70c102271a1b6ff529bafb6748c4e773014

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agodoc: Explain that gpg-preset-passphrase can't be used.
Werner Koch [Fri, 22 Apr 2016 07:57:38 +0000 (09:57 +0200)]
doc: Explain that gpg-preset-passphrase can't be used.

--

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 agog10: Make sure to have the directory for trustdb.
NIIBE Yutaka [Fri, 12 Feb 2016 01:00:31 +0000 (10:00 +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 agoFix possible sign extension problem with newer compilers.
Werner Koch [Mon, 1 Feb 2016 17:06:14 +0000 (18:06 +0100)]
Fix possible sign extension problem with newer compilers.

* cipher/des.c (READ_64BIT_DATA): Cast to u32 before shifting by 24.
* cipher/blowfish.c (do_encrypt_block): Ditto.
(do_decrypt_block): Ditto.
* cipher/camellia.c (CAMELLIA_RR8): Ditto.
* cipher/cast5.c (do_encrypt_block): Ditto.
(do_decrypt_block): Ditto.
(do_cast_setkey): Ditto.
* cipher/twofish.c (INPACK): Ditto.
* util/iobuf.c (block_filter): Ditto.
--

For cipher/des.c
Reported-by: Balint Reczey <balint@balintreczey.hu>
See commit 57af33d9e7c9b20b413b96882e670e75a67a5e65 for details.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agog10: Fix iobuf API of filter function for alignment.
NIIBE Yutaka [Tue, 26 Jan 2016 06:38:27 +0000 (15:38 +0900)]
g10: Fix iobuf API of filter function for alignment.

* include/iobuf.h (struct iobuf_struct): Remove DESC.
* util/iobuf.c (iobuf_desc): New.
(print_chain, iobuf_close, iobuf_open, iobuf_fdopen, iobuf_sockopen)
(iobuf_create, iobuf_append, iobuf_openrw, iobuf_ioctl)
(iobuf_push_filter2, pop_filter, underflow): Use iobuf_desc.
(file_filter, sock_filter, block_filter): Fill the description.
* g10/armor.c, g10/cipher.c, g10/compress-bz2.c, g10/compress.c,
g10/encode.c, g10/encr-data.c, g10/mdfilter.c, g10/pipemode.c,
g10/progress.c, g10/textfilter.c: Likewise.

--

Newer GCC warns against possible alignment difference of pointers.
This change can silence those warnings.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(backported from 2.1 commit 3f52c7da3940ec06572270d511000dc7fe9c27d2)

2 years agoFix possible AIX problem with sysconf in rndunix.
Werner Koch [Fri, 15 Jan 2016 14:51:37 +0000 (15:51 +0100)]
Fix possible AIX problem with sysconf in rndunix.

* cipher/rndunix.c [HAVE_STDINT_H]: Include stdint.h.
(start_gatherer): Detect misbehaving sysconf.
--

See
GnuPG-bug-id: 1778
for the reason of this patch. There is no concrete bug report but this
chnage should not harm.

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 agopo: Update Japanese translation.
NIIBE Yutaka [Mon, 21 Dec 2015 12:27:53 +0000 (21:27 +0900)]
po: Update Japanese translation.

2 years agoPost release updates.
Werner Koch [Sun, 20 Dec 2015 08:01:18 +0000 (09:01 +0100)]
Post release updates.

--

2 years agoRelease 1.4.20 gnupg-1.4.20
Werner Koch [Sat, 19 Dec 2015 14:42:22 +0000 (15:42 +0100)]
Release 1.4.20

2 years agow32: Avoid warning when using newer mingw versions.
Werner Koch [Sat, 19 Dec 2015 15:54:57 +0000 (16:54 +0100)]
w32: Avoid warning when using newer mingw versions.

* g10/tdbio.c (ftruncate): Do not define if already defined.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopo: Auto-update
Werner Koch [Sat, 19 Dec 2015 14:39:45 +0000 (15:39 +0100)]
po: Auto-update

--

2 years agopo: Update German translation
Werner Koch [Sat, 19 Dec 2015 15:53:45 +0000 (16:53 +0100)]
po: Update German translation

--

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopo: Update Russian translation
Ineiev [Sat, 19 Dec 2015 14:32:58 +0000 (15:32 +0100)]
po: Update Russian translation

--

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agogpg: Add option --weak-digest to gpg and gpgv.
Daniel Kahn Gillmor [Tue, 27 Oct 2015 04:01:32 +0000 (00:01 -0400)]
gpg: Add option --weak-digest to gpg and gpgv.

* g10/options.h: Add weak_digests linked list to opts.
* g10/main.h: Declare weakhash linked list struct and
additional_weak_digest() function to insert newly-declared weak
digests into opts.
* g10/misc.c: (additional_weak_digest): New function.
(print_digest_algo_note): Check for deprecated digests.
* g10/sig-check.c: (do_check): Reject all weak digests.
* g10/gpg.c: Add --weak-digest option to gpg.
* doc/gpg.texi: Document gpg --weak-digest option.
* g10/gpgv.c: Add --weak-digest option to gpgv.
* doc/gpgv.texi: Document gpgv --weak-digest option.

--
gpg and gpgv treat signatures made over MD5 as unreliable, unless the
user supplies --allow-weak-digests to gpg.  Signatures over any other
digest are considered acceptable.

Despite SHA-1 being a mandatory-to-implement digest algorithm in RFC
4880, the collision-resistance of SHA-1 is weaker than anyone would
like it to be.

Some operators of high-value targets that depend on OpenPGP signatures
may wish to require their signers to use a stronger digest algorithm
than SHA1, even if the OpenPGP ecosystem at large cannot deprecate
SHA1 entirely today.

This changeset adds a new "--weak-digest DIGEST" option for both gpg
and gpgv, which makes it straightforward for anyone to treat any
signature or certification made over the specified digest as
unreliable.

This option can be supplied multiple times if the operator wishes to
deprecate multiple digest algorithms, and will be ignored completely
if the operator supplies --allow-weak-digests (as before).

MD5 is always considered weak, regardless of any further
--weak-digest options supplied.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
(this is a rough cherry-pick of applying the following commits to
 STABLE-BRANCH-1-4:
  76afaed65e3b0ddfa4923cb577ada43217dd4b18
  b98939812abf6c643c752ce7c325f98039a1a9e2
  91015d021b3dcbe21ad0e580a4f34c523abf9e72
)

2 years agogpg: Reject signatures made with MD5.
Werner Koch [Tue, 27 Oct 2015 04:01:31 +0000 (00:01 -0400)]
gpg: Reject signatures made with MD5.

* g10/gpg.c: Add option --allow-weak-digest-algos.
(main): Set option also in PGP2 mode.
* g10/options.h (struct opt): Add flags.allow_weak_digest_algos.
* g10/sig-check.c (do_check): Reject MD5 signatures.
* tests/openpgp/gpg.conf.tmpl: Add allow_weak_digest_algos.
--
(cherry picked from commit f90cfe6b66269de0154d810c5cee1fe9a5af475c)

Resolved conflicts:
g10/gpg.c - adjust.
tests/openpgp/defs.inc - no changes

2 years agogpg: Change default cipher for --symmetric from CAST5 to AES-128.
Werner Koch [Mon, 18 Aug 2014 09:45:00 +0000 (11:45 +0200)]
gpg: Change default cipher for --symmetric from CAST5 to AES-128.

* g10/main.h (DEFAULT_CIPHER_ALGO): Change to AES or CAST5 or 3DES
depending on configure options.
* g10/gpg.c (main): Set opt.s2k_cipher_algo to DEFAULT_CIPHER_ALGO.

--

(cherry picked from commit 57df1121c18b004dd763b35eabf7b51fc9e8ec38)
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoPass DBUS_SESSION_BUS_ADDRESS for gnome3
Daniel Kahn Gillmor [Tue, 18 Aug 2015 11:34:57 +0000 (13:34 +0200)]
Pass DBUS_SESSION_BUS_ADDRESS for gnome3

* g10/passphrase.c (stdenvnames): Add DBUS_SESSION_BUS_ADDRESS.
--

pinentry-gnome3 talks to the gcr prompter via dbus.  Without this
environment variable, it can't find the correct session to talk to.

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-1-4 from
b03a2647299a6c8764a2574590cbaccdff9e497d by dkg

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 agopo: Update Japanese translation.
NIIBE Yutaka [Thu, 17 Sep 2015 08:05:37 +0000 (17:05 +0900)]
po: Update Japanese translation.

2 years agopo: Fix Spanish translation
NIIBE Yutaka [Tue, 8 Sep 2015 00:14:20 +0000 (09:14 +0900)]
po: Fix Spanish translation

2 years agoObsolete option --no-sig-create-check.
Werner Koch [Mon, 31 Aug 2015 21:55:16 +0000 (23:55 +0200)]
Obsolete option --no-sig-create-check.

* cipher/rsa.c (rsa_sign): Verify after sign.
* g10/gpg.c (opts): Make --no-sig-create-check a NOP.
* g10/options.h (opt): Remove field "no_sig_create_check".
* g10/sign.c (do_sign): Do check only for DSA.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agog10: Fix a race condition initially creating trustdb.
NIIBE Yutaka [Tue, 16 Jun 2015 03:01:28 +0000 (12:01 +0900)]
g10: Fix a race condition initially creating trustdb.

* g10/tdbio.c (take_write_lock, tdbio_set_dbname): Fix message.

3 years agog10: Fix a race condition initially creating trustdb.
NIIBE Yutaka [Mon, 15 Jun 2015 05:38:05 +0000 (14:38 +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 dotlock_create.

--

(backported from 2.1 commit fe5c6edaed78839303d67e01e141cfc6b5de9aec)
GnuPG-bug-id: 1675

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

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

--

(backported 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.

--

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 agog10: fix cmp_public_key and cmp_secret_keys.
NIIBE Yutaka [Thu, 30 Apr 2015 08:20:08 +0000 (17:20 +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.
* mpi/mpi-cmp.c (mpi_cmp): Backport libgcrypt 1.5.0's semantics.

--

(backported from 2.0 commit 43429c7869152f301157e4b24790b3801dce0f0a)

GnuPG-bug-id: 1962

3 years agogpg: Fix DoS while parsing mangled secret key packets.
Werner Koch [Sun, 5 Apr 2015 17:42:59 +0000 (19:42 +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.0 commit 0aac920f23fd07e152fdb7385299c92bb9a4ade3)

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 [Fri, 27 Feb 2015 09:01:08 +0000 (10:01 +0100)]
Post release updates

--

3 years agoRelease 1.4.19. gnupg-1.4.19
Werner Koch [Fri, 27 Feb 2015 08:33:58 +0000 (09:33 +0100)]
Release 1.4.19.

3 years agopo: Auto-update
Werner Koch [Fri, 27 Feb 2015 08:06:46 +0000 (09:06 +0100)]
po: Auto-update

--

3 years agopo: Update German translation
Werner Koch [Fri, 27 Feb 2015 08:05:21 +0000 (09:05 +0100)]
po: Update German translation

3 years agopo: Update French translation
David Prévot [Mon, 3 Nov 2014 03:24:29 +0000 (23:24 -0400)]
po: Update French translation

3 years agopo: Update Czech translation
Roman Pavlik [Tue, 25 Nov 2014 20:22:30 +0000 (16:22 -0400)]
po: Update Czech translation

3 years agopo: Update Dutch translation
Frans Spiesschaert [Mon, 24 Nov 2014 20:28:08 +0000 (16:28 -0400)]
po: Update Dutch translation

3 years agopo: Update Spanish translation
Manuel \"Venturi\" Porras Peralta [Sat, 22 Nov 2014 19:42:36 +0000 (15:42 -0400)]
po: Update Spanish translation

3 years agopo: Update Polish translation
Jakub Bogusz [Fri, 21 Nov 2014 21:06:59 +0000 (17:06 -0400)]
po: Update Polish translation

3 years agopo: Update Russian translation
Ineiev [Thu, 26 Feb 2015 20:06:38 +0000 (21:06 +0100)]
po: Update Russian translation

3 years agopo: Update Ukrainian translation
Yuri Chornoivan [Thu, 26 Feb 2015 20:04:57 +0000 (21:04 +0100)]
po: Update Ukrainian translation

3 years agopo: Update Italian translation.
Milo Casagrande [Thu, 26 Feb 2015 20:02:57 +0000 (21:02 +0100)]
po: Update Italian translation.

3 years agoUpdate Chinese (traditional) translation
Jedi Lin [Fri, 21 Nov 2014 21:42:44 +0000 (17:42 -0400)]
Update Chinese (traditional) translation

3 years agoFix for building without DNS support.
Werner Koch [Thu, 26 Feb 2015 19:00:17 +0000 (20:00 +0100)]
Fix for building without DNS support.

* util/cert.c (get_cert) [!USE_DNS_CERT]: Add want_ipgp.

3 years agopo,intl: Update to 0.19.3.
Werner Koch [Thu, 26 Feb 2015 18:01:30 +0000 (19:01 +0100)]
po,intl: Update to 0.19.3.

3 years agoSwitch to a hash and CERT record based PKA system.
Werner Koch [Thu, 26 Feb 2015 15:34:44 +0000 (16:34 +0100)]
Switch to a hash and CERT record based PKA system.

* util/pka.c: Rewrite.
(get_pka_info): Add arg fprbuflen.  Change callers to pass this.
* util/strgutil.c (ascii_strlwr): New.
* configure.ac: Remove option --disable-dns-pka.
(USE_DNS_PKA): Remove ac_define.
* g10/getkey.c (parse_auto_key_locate): Always include PKA.
--

Note that although PKA is now always build, it will only work if
support for looking up via DNS has not been disabled.

The new PKA only works with the IPGP DNS certtype and shall be used
only to retrieve the fingerprint and optional the key for the first
time.  Due to the security problems with DNSSEC the former assumption
to validate the key using DNSSEC is not anymore justified.  Instead an
additional layer (e.g. Trust-On-First-Use) needs to be implemented to
track change to the key.  Having a solid way of getting a key matching
a mail address is however a must have.

More work needs to go into a redefinition of the --verify-options
pka-lookups and pka-trust-increase.  The auto-key-locate mechanism
should also be able to continue key fetching with another method once
the fingerprint has been retrieved with PKA.

Signed-off-by: Werner Koch <wk@gnupg.org>
This is a backport from master.
(backported from commit 2fc27c8696f5cf2ddf3212397ea49bff115d617b)

3 years agoMove two functions from g10/ to util/.
Werner Koch [Thu, 26 Feb 2015 15:08:02 +0000 (16:08 +0100)]
Move two functions from g10/ to util/.

* g10/misc.c (has_invalid_email_chars, is_valid_mailbox): Move to ...
* util/strgutil.c: here.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoAdd new function strconcat.
Werner Koch [Thu, 26 Feb 2015 15:05:19 +0000 (16:05 +0100)]
Add new function strconcat.

* include/util.h (GNUPG_GCC_A_SENTINEL): New.
* util/strgutil.c (do_strconcat, strconcat): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoAdd convenience function to hash a buffer.
Werner Koch [Thu, 26 Feb 2015 14:35:49 +0000 (15:35 +0100)]
Add convenience function to hash a buffer.

* cipher/sha1.c (sha1_hash_buffer): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoAllow requesting only an IPGP certtype with dns_cert().
Werner Koch [Thu, 26 Feb 2015 14:17:56 +0000 (15:17 +0100)]
Allow requesting only an IPGP certtype with dns_cert().

* util/cert.c (get_cert): Add arg want_ipgp.  Change callers.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodoc: Fix name of keep-ownertrust.
Werner Koch [Thu, 26 Feb 2015 14:06:00 +0000 (15:06 +0100)]
doc: Fix name of keep-ownertrust.

--

Reported-by: Guilhem Moulin <guilhem@fripost.org>
3 years agompi: Avoid data-dependent timing variations in mpi_powm.
NIIBE Yutaka [Thu, 26 Feb 2015 12:00:05 +0000 (21:00 +0900)]
mpi: Avoid data-dependent timing variations in mpi_powm.

* include/mpi.h, mpi/mpiutils.c (mpi_set_cond): New.
* mpi/mpi-pow.c (SIZE_PRECOMP): Rename from SIZE_B_2I3.
(mpi_powm): Access all data in the table and use mpi_set_cond.

--

Access to the precomputed table was indexed by a portion of EXPO,
which could be mounted by a side channel attack.  This change fixes
this particular data-dependent access pattern.

3 years agodoc: Add warning note about not acting as an oracle to --batch.
Werner Koch [Mon, 23 Feb 2015 12:10:57 +0000 (13:10 +0100)]
doc: Add warning note about not acting as an oracle to --batch.

--

3 years agoProtect against NULL return of mpi_get_opaque.
Werner Koch [Mon, 23 Feb 2015 10:04:35 +0000 (11:04 +0100)]
Protect against NULL return of mpi_get_opaque.

* g10/seckey-cert.c (do_check): Call BUG for NULL return of
get_opaque.
--

This is the suggested addition from commit 6f03218.  We better run
into an fatal error than into a segv.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Fix segv due to NULL value stored as opaque MPI
Daniel Kahn Gillmor [Sun, 22 Feb 2015 04:10:37 +0000 (23:10 -0500)]
gpg: Fix segv due to NULL value stored as opaque MPI

* 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-1-4

On the STABLE-BRANCH-1-4, 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
[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agogpg: Remove an unused variable.
Werner Koch [Sun, 22 Feb 2015 04:10:36 +0000 (23:10 -0500)]
gpg: Remove an unused variable.

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

[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agocurl-shim: clean up varargs
Daniel Kahn Gillmor [Sun, 22 Feb 2015 04:10:35 +0000 (23:10 -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

[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agogpg: Print better diagnostics for keyserver operations.
Werner Koch [Sun, 22 Feb 2015 04:10:34 +0000 (23:10 -0500)]
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>
[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agoUse inline functions to convert buffer data to scalars.
Werner Koch [Sun, 22 Feb 2015 04:10:32 +0000 (23:10 -0500)]
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>
[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agodoc: Change remaining http links to gnupg.org to https
Werner Koch [Sun, 22 Feb 2015 04:10:31 +0000 (23:10 -0500)]
doc: Change remaining http links to gnupg.org to https

--
GnuPG-bug-id: 1830

[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agogpg: Prevent an invalid memory read using a garbled keyring.
Werner Koch [Sun, 22 Feb 2015 04:10:30 +0000 (23:10 -0500)]
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)

[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agogpg: Fix a NULL-deref in export due to invalid packet lengths.
Werner Koch [Sun, 22 Feb 2015 04:10:29 +0000 (23:10 -0500)]
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)

[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agogpg: Fix a NULL-deref due to empty ring trust packets.
Werner Koch [Sun, 22 Feb 2015 04:10:28 +0000 (23:10 -0500)]
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)

[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agogpg: Limit the size of key packets to a sensible value.
Werner Koch [Sun, 22 Feb 2015 04:10:27 +0000 (23:10 -0500)]
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)

[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agogpg: Allow predefined names as answer to the keygen.algo prompt.
Werner Koch [Sun, 22 Feb 2015 04:10:26 +0000 (23:10 -0500)]
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)

[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agogpg: Print a warning if the subkey expiration may not be what you want.
Werner Koch [Sun, 22 Feb 2015 04:10:25 +0000 (23:10 -0500)]
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)

[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>