1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-09 23:39:51 +02:00
Commit Graph

70 Commits

Author SHA1 Message Date
Werner Koch
c6dbfe8990
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>
2016-08-17 11:15:50 +02:00
Werner Koch
e23eec8c9a
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>
2016-08-17 11:03:07 +02:00
Werner Koch
93a96e3c0c 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 (http://cs.tau.ac.il/~tromer/acoustic) 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,
though.

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 <wk@gnupg.org>

CVE-id: CVE-2013-4576
2013-12-03 09:25:57 +01:00
Werner Koch
b1abc01d4a 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
2012-11-07 18:06:27 +01:00
Werner Koch
a74f05c32d Remove trailing white space from one file
--
2012-11-07 18:00:45 +01:00
Werner Koch
86a32a4b06 Fix typos in comments.
--
Fixes provided by Gilles Espinasse.
2012-01-24 09:48:17 +01:00
Werner Koch
aa29ba1689 Minor changes to help the VMS port 2010-09-28 10:07:30 +00:00
Werner Koch
9a2a818887 Switched to GPLv3.
Updated gettext.
2007-10-23 10:48:09 +00:00
Werner Koch
29f48b5fdc Preparing an RC 2006-11-29 15:42:28 +00:00
Werner Koch
b121d029b5 about to release 1.4.3rc1 2006-02-14 16:28:34 +00:00
Werner Koch
2410941461 Lock random seed file 2006-02-09 12:54:41 +00:00
Werner Koch
a1cdf3c75f Converted all m_free to xfree etc. 2005-07-27 18:10:56 +00:00
David Shaw
33f81c5bb6 * random.c: Fix prototype of the fast random gatherer. Noted by Joe
Vender.
2005-06-07 18:03:19 +00:00
Werner Koch
7d4043ca57 Updated FSF street address and preparations for a release candidate. 2005-05-31 08:39:18 +00:00
David Shaw
6eb9d6297f * idea-stub.c, random.c; s/__MINGW32__/_WIN32/ to help building on native
Windows compilers.  Requested by Brian Gladman.  From Werner on stable
branch.
2003-08-28 23:49:03 +00:00
David Shaw
5ad7dd7944 * random.c (getfnc_gather_random): Don't check NAME_OF_DEV_RANDOM twice.
Use NAME_OF_DEV_URANDOM.
2003-08-21 23:26:57 +00:00
David Shaw
29e6411a7b * bithelp.h, des.c, random.c, rndlinux.c, sha1.c, blowfish.c, elgamal.c,
rijndael.c, rndunix.c, sha256.c, cast5.c, idea-stub.c, rmd160.c, rndw32.c,
sha512.c, md5.c, rmd160test.c, rsa.c, tiger.c: Edit all preprocessor
instructions to remove whitespace before the '#'.  This is not required by
C89, but there are some compilers out there that don't like it.
2003-05-24 18:31:33 +00:00
David Shaw
0048ebcbae * cipher.c (setup_cipher_table): #ifdef IDEA.
* random.c (fast_random_poll): Only use times() if we HAVE_TIMES.

* sha512.c, tiger.c: Use the U64_C() macro to specify 64-bit constants.
U64_C is defined in include/types.h and uses the correct suffix depending
on the underlying type of u64.

* idea-stub.c (load_module): Catch an error if the idea module file is
unloadable for some reason (unreadable, bad permissions, etc.)

* md.c (string_to_digest_algo): Give a warning about TIGER192 not being
part of OpenPGP.
2003-05-15 05:29:05 +00:00
David Shaw
c4d58f14e0 * rndw32.c [__CYGWIN32__]: Don't include winioctl.h - it is not required
anymore. (From Werner)

* random.c (read_seed_file,update_random_seed_file): Use binary mode for
__CYGWIN__. (From Werner)

* blowfish.c (burn_stack), cast5.c (burn_stack), des.c (burn_stack), md5.c
(burn_stack), random.c (burn_stack, read_pool, fast_random_poll),
rijndael.c (burn_stack), rmd160.c (burn_stack), rndegd.c
(rndegd_gather_random), rndlinux.c (rndlinux_gather_random), sha1.c
(burn_stack), tiger.c (burn_stack), twofish.c (burn_stack): Replace
various calls to memset() with the more secure wipememory().
2002-11-06 17:32:37 +00:00
Werner Koch
0073d6865d * random.c: Automagically detect the entrop gatherer when
configure so.
* rndegd.c (rndegd_connect_socket): New.  Factored out from ..
(rndegd_gather_random): here and call it.
(do_read): Update the counter variables correctly.  This was not a
problem due to the way EGD works. Bug found by Christian Biere.
2002-08-30 16:33:55 +00:00
Stefan Bellon
582f0d5d98 RISC OS changes due to dynload removal 2002-08-03 18:35:16 +00:00
Werner Koch
85aa3e18c2 The big extension module removal. 2002-08-03 10:50:53 +00:00
David Shaw
36d5779e82 * random.c: "warning" -> "WARNING" 2002-07-25 18:05:48 +00:00
David Shaw
151ee2f47b Update head to match stable 1.0 2002-06-29 13:31:13 +00:00
Werner Koch
07ca4eaa9d Removed files from the HEAD revision, because they are now in another
repository
2000-12-19 17:20:22 +00:00
Werner Koch
986d928ce2 See ChangeLog: Mon Sep 18 16:35:45 CEST 2000 Werner Koch 2000-09-18 14:35:34 +00:00
Werner Koch
0bf44b072c See ChangeLog: Mon Jul 17 16:35:47 CEST 2000 Werner Koch 2000-07-17 14:32:21 +00:00
Werner Koch
92cd255508 See ChangeLog: Fri Jul 14 19:38:23 CEST 2000 Werner Koch 2000-07-14 17:34:53 +00:00
Werner Koch
4555c0be94 See ChangeLog: Wed Dec 8 21:58:32 CET 1999 Werner Koch 1999-12-08 21:03:03 +00:00
Werner Koch
2694bceb45 See ChangeLog: Fri Nov 19 17:15:20 CET 1999 Werner Koch 1999-11-19 16:11:37 +00:00
Werner Koch
37f3c09edb See ChangeLog: Mon Nov 15 21:36:02 CET 1999 Werner Koch 1999-11-15 20:32:25 +00:00
Werner Koch
881e513237 See ChangeLog: Sat Nov 13 17:44:23 CET 1999 Werner Koch 1999-11-13 16:43:23 +00:00
Werner Koch
86abac78a2 See ChangeLog: Fri Jul 2 11:45:54 CEST 1999 Werner Koch 1999-07-02 09:50:57 +00:00
Werner Koch
c7447e78e2 See ChangeLog: Sun May 23 14:20:22 CEST 1999 Werner Koch 1999-05-23 12:29:05 +00:00
Werner Koch
3983f30bd2 See ChangeLog: Mon May 17 21:54:43 CEST 1999 Werner Koch 1999-05-17 20:03:24 +00:00
Werner Koch
1feae2011c See ChangeLog: Sun Apr 18 10:11:28 CEST 1999 Werner Koch 1999-04-18 08:18:52 +00:00
Werner Koch
1b9a820c19 See ChangeLog: Tue Apr 6 19:58:12 CEST 1999 Werner Koch 1999-04-06 18:04:55 +00:00
Werner Koch
e1a1b3fc90 See ChangeLog: Tue Feb 16 14:10:02 CET 1999 Werner Koch 1999-02-16 13:16:33 +00:00
Werner Koch
9a4f506a18 See ChangeLog: Wed Feb 10 17:15:39 CET 1999 Werner Koch 1999-02-10 16:22:40 +00:00
Werner Koch
62957ff4e7 See ChangeLog: Tue Jan 12 11:17:18 CET 1999 Werner Koch 1999-01-12 10:20:24 +00:00
Werner Koch
11c378119d See ChangeLog: Sat Jan 9 18:54:57 CET 1999 Werner Koch 1999-01-09 17:59:58 +00:00
Werner Koch
002b1a8632 See ChangeLog: Sat Jan 9 16:02:23 CET 1999 Werner Koch 1999-01-09 15:06:59 +00:00
Werner Koch
6e08b235cb See ChangeLog: Tue Dec 29 14:41:47 CET 1998 Werner Koch 1998-12-29 13:47:31 +00:00
Werner Koch
750d74333c See ChangeLog: Wed Dec 23 13:34:22 CET 1998 Werner Koch 1998-12-23 12:41:40 +00:00
Werner Koch
7a7a5630af See ChangeLog: Mon Dec 14 21:18:49 CET 1998 Werner Koch 1998-12-14 20:22:42 +00:00
Werner Koch
e5666c8fef See ChangeLog: Sat Dec 12 18:40:32 CET 1998 Werner Koch 1998-12-12 17:44:34 +00:00
Werner Koch
af6e96e4f9 See ChangeLog: Thu Dec 10 20:15:36 CET 1998 Werner Koch 1998-12-10 19:20:47 +00:00
Werner Koch
2e494682b6 Restructured the RNG source and add support for loadable
random modules.
1998-11-25 11:52:41 +00:00
Werner Koch
3e0e8f884f bug fix release 1998-08-11 17:29:34 +00:00
Werner Koch
6d21f2838d chnages done at the train 1998-08-07 08:53:38 +00:00