diffstat for gnupg_1.4.11-3 gnupg_1.4.11-3ubuntu2.10 debian/gpgv-win32.dirs | 1 debian/gpgv-win32.install | 1 debian/patches/0001-Screen-keyserver-responses.dpatch | 398 +++++ debian/patches/0002-Make-screening-of-keyserver-result-work-with-multi-k.dpatch | 120 + debian/patches/0003-Add-kbnode_t-for-easier-backporting.dpatch | 18 debian/patches/0004-gpg-Fix-regression-due-to-the-keyserver-import-filte.dpatch | 215 +++ debian/patches/Add-build-and-runtime-support-for-larger-RSA-key.dpatch | 193 ++ debian/patches/CVE-2012-6085.dpatch | 47 debian/patches/CVE-2013-4242.dpatch | 95 + debian/patches/CVE-2013-4351.dpatch | 54 debian/patches/CVE-2013-4402.dpatch | 154 ++ debian/patches/CVE-2013-4576.dpatch | 253 +++ debian/patches/CVE-2014-3591.dpatch | 92 + debian/patches/CVE-2014-4617.dpatch | 59 debian/patches/CVE-2014-5270.dpatch | 464 ++++++ debian/patches/CVE-2015-0837.dpatch | 217 +++ debian/patches/CVE-2015-1606.dpatch | 48 debian/patches/CVE-2015-1607.dpatch | 694 ++++++++++ debian/patches/CVE-2016-6313.dpatch | 50 debian/patches/disable_mlock_test.dpatch | 23 debian/patches/long-keyids.dpatch | 48 debian/patches/use_agent_default.dpatch | 25 gnupg-1.4.11/debian/changelog | 504 +++++++ gnupg-1.4.11/debian/control | 28 gnupg-1.4.11/debian/patches/00list | 20 gnupg-1.4.11/debian/rules | 39 26 files changed, 3805 insertions(+), 55 deletions(-) reverted: --- gnupg-1.4.11/debian/gpgv-win32.install +++ gnupg-1.4.11.orig/debian/gpgv-win32.install @@ -1 +0,0 @@ -build-win32/g10/gpgv.exe usr/share/win32/ diff -u gnupg-1.4.11/debian/rules gnupg-1.4.11/debian/rules --- gnupg-1.4.11/debian/rules +++ gnupg-1.4.11/debian/rules @@ -22,7 +22,7 @@ CONFARGS = --prefix=/usr --libexecdir=/usr/lib/ \ --enable-mailto --with-mailprog=/usr/sbin/sendmail \ - --enable-noexecstack + --enable-noexecstack --enable-large-secmem ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) HOSTARG += --host=$(DEB_HOST_GNU_TYPE) @@ -48,16 +48,10 @@ build-udeb/config.status: dh_testdir - (mkdir -p $(@D); cd $(@D); CFLAGS="-g -Os" \ + (mkdir -p $(@D); cd $(@D); CFLAGS="-g $(if $(filter powerpc,$(DEB_BUILD_ARCH)),-O2,-Os)" \ ../configure $(CONFARGS) $(HOSTARG) \ --without-bzip2 --without-readline --without-libcurl) -build-win32/config.status: - dh_testdir - (mkdir -p $(@D); cd $(@D); CFLAGS="-g -Os" \ - ../configure $(CONFARGS) --host i586-mingw32msvc \ - --disable-gnupg-iconv --without-bzip2 --without-readline --without-libcurl) - ##################################### build ################################## build-deb-stamp: patch-stamp build-deb/config.status @@ -81,22 +75,16 @@ $(MAKE) -C build-udeb/ touch $@ -build-win32-stamp: patch-stamp build-win32/config.status - dh_testdir - $(MAKE) -C build-win32/ - touch $@ - build: build-deb-stamp build-deb-curl-stamp build-udeb-stamp -build-indep: build-win32-stamp ##################################### clean ################################## clean: unpatch dh_testdir dh_testroot - rm -rf build-udeb/ build-deb-curl/ build-deb/ build-win32/ + rm -rf build-udeb/ build-deb-curl/ build-deb/ # find . -name \*~ | xargs rm -vf - dh_clean build-deb-stamp build-deb-curl-stamp build-udeb-stamp build-win32-stamp patch-stamp + dh_clean build-deb-stamp build-deb-curl-stamp build-udeb-stamp patch-stamp #################################### install ################################# @@ -119,20 +107,7 @@ #################################### binary ################################## -binary-indep: build-indep - dh_testdir -i - dh_testroot -i - dh_installchangelogs -i NEWS - dh_installdocs -i - dh_install -i - dh_link -i - dh_strip -i - dh_compress -i - dh_fixperms -i - dh_installdeb -i - dh_gencontrol -i - dh_md5sums -i - dh_builddeb -i +binary-indep: build install binary-arch: build install dh_testdir -a @@ -170,3 +145,3 @@ -binary: binary-indep binary-arch +binary: binary-arch -.PHONY: build binary binary-arch binary-indep clean +.PHONY: build binary binary-arch clean reverted: --- gnupg-1.4.11/debian/gpgv-win32.dirs +++ gnupg-1.4.11.orig/debian/gpgv-win32.dirs @@ -1 +0,0 @@ -usr/share/win32 diff -u gnupg-1.4.11/debian/changelog gnupg-1.4.11/debian/changelog --- gnupg-1.4.11/debian/changelog +++ gnupg-1.4.11/debian/changelog @@ -1,3 +1,135 @@ +gnupg (1.4.11-3ubuntu2.10) precise-security; urgency=medium + + * SECURITY UPDATE: random number generator prediction + - debian/patches/CVE-2016-6313.dpatch: improve readability by using a + macro and hash continuous areas in the csprng pool in + cipher/random.c. + - CVE-2016-6313 + + -- Marc Deslauriers Wed, 17 Aug 2016 13:37:00 -0400 + +gnupg (1.4.11-3ubuntu2.9) precise-security; urgency=medium + + * Screen responses from keyservers (LP: #1409117) + - d/p/0001-Screen-keyserver-responses.dpatch + - d/p/0002-Make-screening-of-keyserver-result-work-with-multi-k.dpatch + - d/p/0003-Add-kbnode_t-for-easier-backporting.dpatch + - d/p/0004-gpg-Fix-regression-due-to-the-keyserver-import-filte.dpatch + * Fix large key size regression from CVE-2014-5270 changes (LP: #1371766) + - d/p/Add-build-and-runtime-support-for-larger-RSA-key.dpatch + - debian/rules: build with --enable-large-secmem + * SECURITY UPDATE: sidechannel attack on Elgamal + - debian/patches/CVE-2014-3591.dpatch: use ciphertext blinding in + cipher/elgamal.c. + - CVE-2014-3591 + * SECURITY UPDATE: sidechannel attack via timing variations in mpi_powm + - debian/patches/CVE-2015-0837.dpatch: avoid timing variations in + include/mpi.h, mpi/mpi-pow.c, mpi/mpiutil.c. + - CVE-2015-0837 + * SECURITY UPDATE: invalid memory read via invalid keyring + - debian/patches/CVE-2015-1606.dpatch: skip all packets not allowed in + a keyring in g10/keyring.c. + - CVE-2015-1606 + * SECURITY UPDATE: memcpy with overlapping ranges + - debian/patches/CVE-2015-1607.dpatch: use inline functions to convert + buffer data to scalars in g10/apdu.c, g10/app-openpgp.c, + g10/build-packet.c, g10/ccid-driver.c, g10/getkey.c, g10/keygen.c, + g10/keyid.c, g10/misc.c, g10/parse-packet.c, g10/tdbio.c, + g10/trustdb.c, include/host2net.h. + - CVE-2015-1607 + + -- Marc Deslauriers Fri, 27 Mar 2015 08:24:00 -0400 + +gnupg (1.4.11-3ubuntu2.7) precise-security; urgency=medium + + * SECURITY UPDATE: side-channel attack on Elgamal encryption subkeys + - debian/patches/CVE-2014-5270.dpatch: use sliding window method for + exponentiation algorithm in mpi/mpi-pow.c. + - CVE-2014-5270 + + -- Marc Deslauriers Tue, 19 Aug 2014 09:41:45 -0400 + +gnupg (1.4.11-3ubuntu2.6) precise-security; urgency=medium + + * SECURITY UPDATE: denial of service via uncompressing garbled packets + - debian/patches/CVE-2014-4617.dpatch: limit number of extra bytes in + g10/compress.c. + - CVE-2014-4617 + + -- Marc Deslauriers Thu, 26 Jun 2014 08:30:14 -0400 + +gnupg (1.4.11-3ubuntu2.5) precise-security; urgency=low + + * SECURITY UPDATE: RSA Key Extraction via Low-Bandwidth Acoustic + Cryptanalysis attack + - debian/patches/CVE-2013-4576.dpatch: Use blinding for the RSA secret + operation in cipher/random.*, cipher/rsa.c, g10/gpgv.c. Normalize the + MPIs used as input to secret key functions in cipher/dsa.c, + cipher/elgamal.c, cipher/rsa.c. + - CVE-2013-4576 + + -- Marc Deslauriers Wed, 18 Dec 2013 11:17:02 -0500 + +gnupg (1.4.11-3ubuntu2.4) precise-security; urgency=low + + * SECURITY UPDATE: incorrect no-usage-permitted flag handling + - debian/patches/CVE-2013-4351.dpatch: correctly handle empty key flags + in g10/getkey.c, g10/keygen.c, include/cipher.h. + - CVE-2013-4351 + * SECURITY UPDATE: denial of service via infinite recursion + - debian/patches/CVE-2013-4402.dpatch: set limits on number of filters + and nested packets in util/iobuf.c, g10/mainproc.c. + - CVE-2013-4402 + + -- Marc Deslauriers Tue, 08 Oct 2013 07:49:58 -0400 + +gnupg (1.4.11-3ubuntu2.3) precise-security; urgency=low + + * SECURITY UPDATE: The path of execution in an exponentiation function may + depend upon secret key data, allowing a local attacker to determine the + contents of the secret key through a side-channel attack. + - debian/patches/CVE-2013-4242.dpatch: always perform the mpi_mul for + exponents in secure memory. Based on upstream patch. + - CVE-2013-4242 + + -- Seth Arnold Tue, 30 Jul 2013 15:51:17 -0700 + +gnupg (1.4.11-3ubuntu2.2) precise-security; urgency=low + + * SECURITY UPDATE: keyring corruption via malformed key import + - debian/patches/CVE-2012-6085.dpatch: validate PKTTYPE in g10/import.c. + - CVE-2012-6085 + + -- Marc Deslauriers Tue, 08 Jan 2013 10:52:55 -0500 + +gnupg (1.4.11-3ubuntu2.1) precise-security; urgency=low + + * debian/patches/long-keyids.dpatch: Use the longest key ID available + when requesting a key from a key server. + + -- Marc Deslauriers Tue, 14 Aug 2012 08:34:24 -0400 + +gnupg (1.4.11-3ubuntu2) precise; urgency=low + + * Mark gnupg, gnupg-curl, and gpgv Multi-Arch: foreign. + + -- Colin Watson Mon, 21 Nov 2011 13:42:07 +0000 + +gnupg (1.4.11-3ubuntu1) natty; urgency=low + + * Resynchronise with Debian (LP: #720905). Remaining changes: + - Disable mlock() test since it fails with ulimit 0 (on buildds). + - Set gpg (or gpg2) and gpgsm to use a passphrase agent by default. + - Fix udeb build failure on powerpc, building with -O2 instead of -Os. + - Only suggest gnupg-curl and libldap; recommendations are pulled into + minimal, and we don't need the keyserver utilities in a minimal Ubuntu + system. + * debian/{control,rules}: Remove the Win32 build (and mingw32 + build-dependency), since mingw32 is in universe, and will remain so for + the forseeable future. + + -- Rico Tzschichholz Tue, 22 Feb 2011 11:00:25 +0100 + gnupg (1.4.11-3) unstable; urgency=low * Install gpg setuid root again on kFreeBSD. We dropped this @@ -40,6 +172,24 @@ -- Thijs Kinkhorst Tue, 26 Oct 2010 20:14:12 +0200 +gnupg (1.4.10-4ubuntu2) natty; urgency=low + + * No-change rebuild to drop upstream changelog. + + -- Martin Pitt Fri, 03 Dec 2010 08:31:25 +0100 + +gnupg (1.4.10-4ubuntu1) natty; urgency=low + + * Resynchronise with Debian. Remaining changes: + - Disable mlock() test since it fails with ulimit 0 (on buildds). + - Set gpg (or gpg2) and gpgsm to use a passphrase agent by default. + - Fix udeb build failure on powerpc, building with -O2 instead of -Os. + - Only suggest gnupg-curl and libldap; recommendations are pulled into + minimal, and we don't need the keyserver utilities in a minimal Ubuntu + system. + + -- Colin Watson Wed, 13 Oct 2010 11:48:06 +0100 + gnupg (1.4.10-4) unstable; urgency=high * debian/patches/mips_gcc4.4: added to fix build failure on @@ -83,6 +233,25 @@ -- Thijs Kinkhorst Mon, 22 Mar 2010 20:12:42 +0100 +gnupg (1.4.10-2ubuntu2) maverick; urgency=low + + * Only suggest gnupg-curl and libldap; recommendations are pulled into + minimal, and we don't need the keyserver utilities in a minimal Ubuntu + system. + + -- Colin Watson Mon, 14 Jun 2010 14:40:00 +0100 + +gnupg (1.4.10-2ubuntu1) lucid; urgency=low + + * Merge from Debian testing (lp: #503064, #477818). Remaining changes: + - Add 'debian/patches/50_disable_mlock_test.dpatch': Disable mlock() test + since it fails with ulimit 0 (on buildds). + - Add 'debian/patches/61_use_agent_default.dpatch': Patch to set gpg + (or gpg2) and gpgsm to use a passphrase agent by default (lp: 15485) + - Fix udeb build failure on powerpc, building with -O2 instead of -Os. + + -- Michael Bienia Mon, 04 Jan 2010 20:06:01 +0100 + gnupg (1.4.10-2) unstable; urgency=low [ Thijs Kinkhorst ] @@ -187,6 +356,64 @@ -- Thijs Kinkhorst Sat, 15 Aug 2009 18:43:03 +0200 +gnupg (1.4.9-4ubuntu7) karmic; urgency=low + + * Fix udeb build failure on powerpc, building with -O2 instead of -Os. + + -- Matthias Klose Sun, 27 Sep 2009 13:49:46 +0200 + +gnupg (1.4.9-4ubuntu6) karmic; urgency=low + + * Build-depend on libreadline-dev instead of libreadline5-dev. + + -- Matthias Klose Sat, 19 Sep 2009 22:52:53 +0200 + +gnupg (1.4.9-4ubuntu5) karmic; urgency=low + + * debian/gnupg.udev: + Add udev rules to set ACLs on SCM smartcard readers. They replace the hal + rules for the same purpose. (LP: #57755) + * debian/rules: + Call dh_installudev. + + -- Michael Bienia Fri, 03 Jul 2009 15:38:40 +0200 + +gnupg (1.4.9-4ubuntu4) karmic; urgency=low + + * Undo the last change. A GnuPG bug with handling multiple keyservers + makes this break + + -- Mackenzie Morgan Sat, 20 Jun 2009 18:04:47 -0400 + +gnupg (1.4.9-4ubuntu3) karmic; urgency=low + + * deian/patches/100_ubuntu_default_keyserver.dpatch: (LP: #380093) + - Add keyserver.ubuntu.com as a default keyserver in g10/options.skel + + -- Mackenzie Morgan Mon, 25 May 2009 13:10:51 -0400 + +gnupg (1.4.9-4ubuntu2) karmic; urgency=low + + * debian/rules: add --enable-noexecstack to configure to avoid needless + executable stacks on i386 (LP: #49323, debian bug 527630). + * debian/rules: fix "nocheck" logic to run tests (debian bug 521884). + + -- Kees Cook Fri, 08 May 2009 09:12:18 -0700 + +gnupg (1.4.9-4ubuntu1) karmic; urgency=low + + * Merge from debian unstable, remaining changes: + - Add 'debian/patches/50_disable_mlock_test.dpatch': Disable mlock() test + since it fails with ulimit 0 (on buildds). + - Add 'debian/patches/61_use_agent_default.dpatch': Patch to set gpg + (or gpg2) and gpgsm to use a passphrase agent by default (lp: 15485) + - Add libcurl4-gnutls-dev to Build-Depends to fix gpg running into a + timeout updating the keyring (lp: 62864) + - Add 'debian/patches/55_curl_typefix.dpatch': Fix a build error with recent + curl and gcc 4.3 + + -- Nicolas Valcárcel Scerpella Tue, 05 May 2009 16:02:14 -0500 + gnupg (1.4.9-4) unstable; urgency=low [ Daniel Leidert (dale) ] @@ -213,6 +440,24 @@ -- Thijs Kinkhorst Mon, 16 Feb 2009 18:35:15 +0100 +gnupg (1.4.9-3ubuntu1) intrepid; urgency=low + + * Merge from debian unstable (lp: #225005), remaining changes: + - Add 'debian/patches/50_disable_mlock_test.dpatch': Disable mlock() test + since it fails with ulimit 0 (on buildds). + - Add 'debian/patches/61_use_agent_default.dpatch': Patch to set gpg + (or gpg2) and gpgsm to use a passphrase agent by default (lp: 15485) + - Add libcurl4-gnutls-dev to Build-Depends to fix gpg running into a + timeout updating the keyring (lp: 62864) + * Dropped Ubuntu patches, applied upstream: + - 50_show_primary_only.dpatch + - 60_install_options_skel.dpatch + * Add 'debian/patches/55_curl_typefix.dpatch': Fix a build error with recent + curl and gcc 4.3 (lp: #247679). Patch taken from upstream: + http://lists.gnupg.org/pipermail/gnupg-devel/2008-April/024344.html + + -- Michael Bienia Mon, 21 Jul 2008 02:02:14 +0200 + gnupg (1.4.9-3) unstable; urgency=low * Add Package-Type: udeb to μdebs. @@ -305,6 +550,56 @@ -- Bastian Blank Sat, 23 Feb 2008 19:59:18 +0100 +gnupg (1.4.6-2ubuntu5) hardy; urgency=low + + * No-change rebuild against libldap-2.4-2. + + -- Steve Langasek Wed, 23 Jan 2008 10:49:38 +0000 + +gnupg (1.4.6-2ubuntu4) gutsy; urgency=low + + * debian/patches/70_trust_error.dpatch: Removed as it broke setting the + trust level to 1 (LP: #147343). + + -- Michael Bienia Mon, 01 Oct 2007 21:52:52 +0200 + +gnupg (1.4.6-2ubuntu3) gutsy; urgency=low + + [ Scott Kitterman ] + * Add 'debian/patches/60_install_options_skel.dpatch': Patch to + install options file from upstream (LP: #76983) + * Add 'debian/patches/61_use_agent_default.dpatch': Patch to set gpg + (or gpg2) and gpgsm to use a passphrase agent by default (LP: #15485) + * Add 'debian/patches/70_trust_error.dpatch': Patch to disallow illegal + zero response for trust level changes (LP: #39459) + + [ Michael Bienia ] + * Add libcurl4-gnutls-dev to Build-Depends to fix gpg running into a timeout + updating the keyring (LP: #62864) + + -- Michael Bienia Fri, 06 Jul 2007 20:56:05 +0200 + +gnupg (1.4.6-2ubuntu2) gutsy; urgency=low + + * Add 'debian/patches/50_show_primary_only.dpatch': add + 'show-primary-uid-only' to verify options, to suppress 'aka' output + in key verifications, backported from 1.4.7 upstream. + + -- Kees Cook Tue, 15 May 2007 12:09:41 -0700 + +gnupg (1.4.6-2ubuntu1) gutsy; urgency=low + + * Merge from debian unstable, remaining changes: + - config.h.in: Disable mlock() test since it fails with ulimit 0 (on + buildds). + - debian/rules: + + Do not install gpg as suid root, since that is not necessary with + kernels 2.6.8+. + + Make the build fail if the test suite fails. + - debian/control: Maintainer field update. + + -- Kees Cook Tue, 08 May 2007 02:21:26 -0700 + gnupg (1.4.6-2) unstable; urgency=medium * 28_multiple_message.dpatch: new patch from upstream to fix problems @@ -313,6 +608,28 @@ -- James Troup Wed, 7 Mar 2007 21:47:35 +0000 +gnupg (1.4.6-1ubuntu2) feisty; urgency=low + + * SECURITY UPDATE: without --status-fd, forged inline sigs can appear valid. + * debian/patches/50_stop_multiple_messages.dpatch: upstream patch. + * References + ftp://ftp.gnupg.org/gcrypt/gnupg/patches/gnupg-1.4.6-multiple-message.patch + CVE-2007-1263 + + -- Kees Cook Wed, 7 Mar 2007 11:53:20 -0800 + +gnupg (1.4.6-1ubuntu1) feisty; urgency=low + + * Merge from debian unstable, remaining changes: + - config.h.in: Disable mlock() test since it fails with ulimit 0 (on + buildds). + - debian/rules: + + Do not install gpg as suid root, since that is not necessary with + kernels 2.6.8+. + + Make the build fail if the test suite fails. + + -- Kees Cook Tue, 12 Dec 2006 15:56:56 -0800 + gnupg (1.4.6-1) unstable; urgency=high * New upstream release. @@ -331,6 +648,29 @@ -- James Troup Thu, 7 Dec 2006 02:54:51 +0000 +gnupg (1.4.5-3ubuntu2) feisty; urgency=low + + * SECURITY UPDATE: unwound stack data use, leading to arbitrary code + execution. + * Add debian/patches/29_dxf_context_stack.dpatch: upstream patch, use heap + for allocation instead. + * References + CVE-2006-6235 + + -- Kees Cook Wed, 6 Dec 2006 11:46:44 -0800 + +gnupg (1.4.5-3ubuntu1) feisty; urgency=low + + * Merge to Debian unstable. Remaining Ubuntu changes: + - config.h.in: Disable mlock() test since it fails with ulimit 0 (on + buildds). + - debian/rules: + + Do not install gpg as suid root, since that is not necessary with + kernels 2.6.8+. + + Make the build fail if the test suite fails. + + -- Martin Pitt Tue, 28 Nov 2006 19:06:47 +0100 + gnupg (1.4.5-3) unstable; urgency=high * 27_filename_overflow.dpatch: new patch from upstream to fix buffer @@ -338,6 +678,18 @@ -- James Troup Mon, 27 Nov 2006 21:23:37 +0000 +gnupg (1.4.5-2ubuntu1) feisty; urgency=low + + * Merge to Debian unstable. Remaining Ubuntu changes: + - config.h.in: Disable mlock() test since it fails with ulimit 0 (on + buildds). + - debian/rules: + + Do not install gpg as suid root, since that is not necessary with + kernels 2.6.8+. + + Make the build fail if the test suite fails. + + -- Martin Pitt Fri, 3 Nov 2006 09:18:26 +0100 + gnupg (1.4.5-2) unstable; urgency=low * debian/control: add gpgv package. Make gnupg package depend on it. @@ -361,6 +713,42 @@ -- James Troup Tue, 1 Aug 2006 22:50:09 +0100 +gnupg (1.4.3-2ubuntu3) edgy; urgency=low + + * SECURITY UPDATE: Local arbitrary code execution. + * Add debian/patches/27_comment_control_overflow.dpatch: + - Fix buffer overflows in parse_comment() and parse_gpg_control(). + - Patch extracted from stable 1.4.5 release. + - Reproducer: + perl -e 'print "\xfd\xff\xff\xff\xff\xfe"'| gpg --no-armor + - Credit: Evgeny Legerov + - CVE-2006-3746 + + -- Martin Pitt Thu, 3 Aug 2006 08:11:46 +0200 + +gnupg (1.4.3-2ubuntu2) edgy; urgency=low + + * Rebuild with current zlib1g-dev to fix udeb shlibdeps. Thanks to Evan + Dandrea for noticing. + + -- Colin Watson Mon, 31 Jul 2006 11:21:55 +0100 + +gnupg (1.4.3-2ubuntu1) edgy; urgency=low + + * Sync with Debian: + Remaining Ubuntu changes: + + config.h.in: Disable mlock() test since it fails with ulimit 0 (on + buildds). + + debian/patches/20_no_tty_fix.dpatch: + - dropped, upstream now + + debian/rules: + - don't use the included gettext + - Don't install gpg as suid root, since that is not necessary with + kernels 2.6.8+ + - Make the build fail if the test suite fails + + -- Sebastian Dröge Wed, 28 Jun 2006 21:11:14 +0200 + gnupg (1.4.3-2) unstable; urgency=low * 26_user_id_overflow.dpatch: new patch pulled from upstream SVN to fix @@ -426,6 +814,32 @@ -- James Troup Wed, 5 Apr 2006 02:45:56 +0100 +gnupg (1.4.2.2-1ubuntu2) dapper; urgency=low + + * debian/rules: + - Remove --with-included-gettext configure option; use libc's gettext to + get language pack support. Closes: LP#25609 + - rm'ing locale.alias is not necessary with this change, so change it to + rm -f to not break the build. + + -- Martin Pitt Mon, 3 Apr 2006 18:21:19 +0200 + +gnupg (1.4.2.2-1ubuntu1) dapper; urgency=low + + * Resynchronize with Debian, UVF exception approved by Matt. 1.4.2.2 only + contains a security fix, updated test cases, and updated translations. + * For reference and to ease future merges, these are the remaining Ubuntu + changes: + - debian/rules: Make the build fail if the test suite fails. + - debian/changelog: Add missing CVE number. + - Don't install gpg as suid root, since that is not necessary with kernels + 2.6.8+. + - config.h.in: Disable mlock() test since it fails with ulimit 0 (on + buildds). + - debian/patches/20_no_tty_fix.dpatch: Malone #5570 + + -- Martin Pitt Mon, 13 Mar 2006 12:42:00 +0100 + gnupg (1.4.2.2-1) unstable; urgency=low * New upstream release. @@ -434,6 +848,41 @@ -- James Troup Fri, 10 Mar 2006 04:27:12 +0000 +gnupg (1.4.2.1-0ubuntu1) dapper; urgency=low + + * New upstream security bugfix release, only contains the following changes: + - Security fix for a verification weakness in gpgv. Some input + could lead to gpgv exiting with 0 even if the detached signature + file did not carry any signature. This is not as fatal as it + might seem because the suggestion as always been not to rely on + th exit code but to parse the --status-fd messages. However it + is likely that gpgv is used in that simplified way and thus we + do this release. Same problem with "gpg --verify" but nobody + should have used this for signature verification without + checking the status codes anyway. [CVE-2006-0455] + - Added a test case for above vulnerability. + * debian/rules: Call the test suite during build. (Will fail the build + if the test suite fails.) + + -- Martin Pitt Fri, 17 Feb 2006 11:18:27 +0100 + +gnupg (1.4.2-2ubuntu2) dapper; urgency=low + + * Add 20_no_tty_fix.dpatch: + - Do not open /dev/tty if --no-tty is specified, since this breaks + programs like seahorse. + - Patch also accepted upstream. + - Thanks to Ryan Lortie for the patch. + - Malone #5570 + + -- Martin Pitt Fri, 16 Dec 2005 16:57:39 +0100 + +gnupg (1.4.2-2ubuntu1) dapper; urgency=low + + * Resynchronise with Debian. + + -- Martin Pitt Thu, 10 Nov 2005 16:13:10 -0500 + gnupg (1.4.2-2) unstable; urgency=low * 22_zero_length_mpi_fix.dpatch: new patch; pull in upstream patch to @@ -453,6 +902,20 @@ -- James Troup Sat, 24 Sep 2005 03:31:37 +0100 +gnupg (1.4.1-1ubuntu2) dapper; urgency=low + + * debian/rules: Stop calling pkgstriptranslations, we now get it + for free with the new and improved dpkg-deb diversion hack. + + -- Adam Conrad Wed, 26 Oct 2005 10:42:17 +1000 + +gnupg (1.4.1-1ubuntu1) breezy; urgency=low + + * Resynchronise with Debian, fixing changelog ordering. + * Added CAN number to previous changelog entry. + + -- Martin Pitt Fri, 10 Jun 2005 10:36:38 +0200 + gnupg (1.4.1-1) unstable; urgency=low * New upstream release. Closes: #307203 @@ -466,6 +929,12 @@ -- James Troup Mon, 9 May 2005 23:41:50 +0100 +gnupg (1.4.0-3ubuntu1) breezy; urgency=low + + * Merge Debian changes (#9358). + + -- Martin Pitt Fri, 15 Apr 2005 09:35:41 +0200 + gnupg (1.4.0-3) unstable; urgency=low * debian/rules (binary-arch): move Russian manpage to correct (FHS) @@ -526,6 +995,41 @@ -- Colin Watson Fri, 24 Dec 2004 13:42:23 +0000 +gnupg (1.2.5-3ubuntu5) hoary; urgency=low + + * debian/rules: Call pkgstriptranslations if present (the package does not + use debhelper, thus it does not happen automatically). + + -- Martin Pitt Fri, 18 Mar 2005 13:04:50 +0000 + +gnupg (1.2.5-3ubuntu4) hoary; urgency=low + + * debian/control, debian/rules: Build gpgv-udeb, containing just + /usr/bin/gpgv built without bzip2 support and with -Os, for use in the + installer. + + -- Colin Watson Wed, 12 Jan 2005 14:52:51 +0000 + +gnupg (1.2.5-3ubuntu3) hoary; urgency=low + + * Disable HAVE_BROKEN_MLOCK, since the test fails if ulimit -l 0. + + -- LaMont Jones Tue, 30 Nov 2004 22:35:20 -0700 + +gnupg (1.2.5-3ubuntu2) hoary; urgency=low + + * No-change upload to get mlock test correct. + + -- LaMont Jones Tue, 30 Nov 2004 21:25:26 -0700 + +gnupg (1.2.5-3ubuntu1) hoary; urgency=low + + * Resynced to Debian; automatic sync result was a mess, redid from scratch. + * Do not install gnupg as suid root since the Ubuntu kernel now supports + calling mlock() as user. + + -- Martin Pitt Thu, 11 Nov 2004 11:08:42 +0100 + gnupg (1.2.5-3) unstable; urgency=low * debian/rules (build): drop --with-capabilites for now. diff -u gnupg-1.4.11/debian/control gnupg-1.4.11/debian/control --- gnupg-1.4.11/debian/control +++ gnupg-1.4.11/debian/control @@ -1,7 +1,8 @@ Source: gnupg Section: utils Priority: important -Maintainer: Debian GnuPG-Maintainers +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian GnuPG-Maintainers Uploaders: Sune Vuorela , Daniel Leidert (dale) , Thijs Kinkhorst @@ -10,16 +11,15 @@ libusb-dev [!hurd-i386], libreadline-dev, file, gettext, dpatch, libcurl4-gnutls-dev -Build-Depends-Indep: mingw32 Homepage: http://www.gnupg.org Vcs-Browser: http://svn.debian.org/wsvn/pkg-gnupg/gnupg/ Vcs-Svn: svn://svn.debian.org/svn/pkg-gnupg/gnupg/trunk/ Package: gnupg Architecture: any +Multi-Arch: foreign Depends: ${shlibs:Depends}, ${misc:Depends}, gpgv -Recommends: ${shlibs:Recommends}, gnupg-curl -Suggests: gnupg-doc, xloadimage | imagemagick | eog, libpcsclite1 +Suggests: ${shlibs:Suggests}, gnupg-curl, gnupg-doc, xloadimage | imagemagick | eog, libpcsclite1 Description: GNU privacy guard - a free PGP replacement GnuPG is GNU's tool for secure communication and data storage. It can be used to encrypt data and to create digital signatures. @@ -42,7 +42,8 @@ Package: gnupg-curl Priority: optional Architecture: any -Depends: ${shlibs:Depends}, ${shlibs:Recommends}, ${misc:Depends}, gnupg +Multi-Arch: foreign +Depends: ${shlibs:Depends}, ${shlibs:Suggests}, ${misc:Depends}, gnupg Description: GNU privacy guard - a free PGP replacement (cURL) GnuPG is GNU's tool for secure communication and data storage. It can be used to encrypt data and to create digital signatures. @@ -59,6 +60,7 @@ Package: gpgv Architecture: any +Multi-Arch: foreign Depends: ${shlibs:Depends}, ${misc:Depends} Suggests: gnupg Description: GNU privacy guard - signature verification tool @@ -100,16 +101,0 @@ - -Package: gpgv-win32 -Architecture: all -Priority: extra -Depends: ${misc:Depends} -Suggests: wine -Description: GNU privacy guard - signature verification tool (win32 build) - GnuPG is GNU's tool for secure communication and data storage. - . - gpgv is a stripped-down version of gnupg which is only able to check - signatures. It is smaller than the full-blown gnupg and uses a - different (and simpler) way to check that the public keys used to - make the signature are trustworthy. - . - This is a win32 version of gpgv. It's meant to be used by the win32-loader - component of Debian-Installer. diff -u gnupg-1.4.11/debian/patches/00list gnupg-1.4.11/debian/patches/00list --- gnupg-1.4.11/debian/patches/00list +++ gnupg-1.4.11/debian/patches/00list @@ -1,0 +2,20 @@ +disable_mlock_test +use_agent_default +long-keyids +CVE-2012-6085 +CVE-2013-4242 +CVE-2013-4351 +CVE-2013-4402 +CVE-2013-4576 +CVE-2014-4617 +CVE-2014-5270 +0001-Screen-keyserver-responses +0002-Make-screening-of-keyserver-result-work-with-multi-k +0003-Add-kbnode_t-for-easier-backporting +0004-gpg-Fix-regression-due-to-the-keyserver-import-filte +Add-build-and-runtime-support-for-larger-RSA-key +CVE-2014-3591 +CVE-2015-0837 +CVE-2015-1606 +CVE-2015-1607 +CVE-2016-6313 only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2015-1607.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2015-1607.dpatch @@ -0,0 +1,694 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# From 57af33d9e7c9b20b413b96882e670e75a67a5e65 Mon Sep 17 00:00:00 2001 +# From: Werner Koch +# Date: Sat, 21 Feb 2015 23:10:32 -0500 +# Subject: [PATCH] Use inline functions to convert buffer data to scalars. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/apdu.c gnupg-1.4.11/g10/apdu.c +--- gnupg-1.4.11~/g10/apdu.c 2009-07-21 09:21:44.000000000 -0400 ++++ gnupg-1.4.11/g10/apdu.c 2015-03-25 13:59:41.963070843 -0400 +@@ -60,6 +60,7 @@ + #include "scdaemon.h" + #include "exechelp.h" + #endif /* GNUPG_MAJOR_VERSION != 1 */ ++#include "../include/host2net.h" + + #include "apdu.h" + #include "ccid-driver.h" +@@ -903,15 +904,14 @@ + i? strerror (errno) : "premature EOF"); + goto command_failed; + } +- len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4]; ++ len = buf32_to_size_t (msgbuf+1); + if (msgbuf[0] != 0x81 || len < 4) + { + log_error ("invalid response header from PC/SC received\n"); + goto command_failed; + } + len -= 4; /* Already read the error code. */ +- err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16) +- | (msgbuf[7] << 8 ) | msgbuf[8]); ++ err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5)); + if (err) + { + log_error ("pcsc_status failed: %s (0x%lx)\n", +@@ -1071,15 +1071,14 @@ + i? strerror (errno) : "premature EOF"); + goto command_failed; + } +- len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4]; ++ len = buf32_to_size_t (msgbuf+1); + if (msgbuf[0] != 0x81 || len < 4) + { + log_error ("invalid response header from PC/SC received\n"); + goto command_failed; + } + len -= 4; /* Already read the error code. */ +- err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16) +- | (msgbuf[7] << 8 ) | msgbuf[8]); ++ err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5)); + if (err) + { + log_error ("pcsc_transmit failed: %s (0x%lx)\n", +@@ -1204,15 +1203,14 @@ + i? strerror (errno) : "premature EOF"); + goto command_failed; + } +- len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4]; ++ len = buf32_to_size_t (msgbuf+1); + if (msgbuf[0] != 0x81 || len < 4) + { + log_error ("invalid response header from PC/SC received\n"); + goto command_failed; + } + len -= 4; /* Already read the error code. */ +- err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16) +- | (msgbuf[7] << 8 ) | msgbuf[8]); ++ err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5)); + if (err) + log_error ("pcsc_close failed: %s (0x%lx)\n", + pcsc_error_string (err), err); +@@ -1391,7 +1389,7 @@ + i? strerror (errno) : "premature EOF"); + goto command_failed; + } +- len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4]; ++ len = buf32_to_size_t (msgbuf+1); + if (msgbuf[0] != 0x81 || len < 4) + { + log_error ("invalid response header from PC/SC received\n"); +@@ -1405,8 +1403,7 @@ + sw = SW_HOST_GENERAL_ERROR; + goto command_failed; + } +- err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16) +- | (msgbuf[7] << 8 ) | msgbuf[8]); ++ err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5)); + if (err) + { + log_error ("PC/SC RESET failed: %s (0x%lx)\n", +@@ -1706,7 +1703,7 @@ + i? strerror (errno) : "premature EOF"); + goto command_failed; + } +- len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4]; ++ len = buf32_to_size_t (msgbuf+1); + if (msgbuf[0] != 0x81 || len < 4) + { + log_error ("invalid response header from PC/SC received\n"); +@@ -1719,8 +1716,8 @@ + (unsigned long)len); + goto command_failed; + } +- err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16) +- | (msgbuf[7] << 8 ) | msgbuf[8]); ++ err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5)); ++ + if (err) + { + log_error ("PC/SC OPEN failed: %s\n", pcsc_error_string (err)); +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/app-openpgp.c gnupg-1.4.11/g10/app-openpgp.c +--- gnupg-1.4.11~/g10/app-openpgp.c 2010-10-18 05:15:23.000000000 -0400 ++++ gnupg-1.4.11/g10/app-openpgp.c 2015-03-25 13:59:41.963070843 -0400 +@@ -68,6 +68,7 @@ + #include "iso7816.h" + #include "app-common.h" + #include "tlv.h" ++#include "../include/host2net.h" + + + /* A table describing the DOs of the card. */ +@@ -744,7 +745,7 @@ + char numbuf1[50], numbuf2[50]; + unsigned long value; + +- value = (stamp[0] << 24) | (stamp[1]<<16) | (stamp[2]<<8) | stamp[3]; ++ value = buf32_to_ulong (stamp); + if (!value) + return; + sprintf (numbuf1, "%d", number); +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/build-packet.c gnupg-1.4.11/g10/build-packet.c +--- gnupg-1.4.11~/g10/build-packet.c 2010-09-28 04:51:26.000000000 -0400 ++++ gnupg-1.4.11/g10/build-packet.c 2015-03-25 13:59:41.963070843 -0400 +@@ -34,6 +34,7 @@ + #include "memory.h" + #include "i18n.h" + #include "options.h" ++#include "../include/host2net.h" + + static int do_user_id( IOBUF out, int ctb, PKT_user_id *uid ); + static int do_public_key( IOBUF out, int ctb, PKT_public_key *pk ); +@@ -585,8 +586,7 @@ + if( n == 255 ) { + if( buflen < 4 ) + break; +- n = (buffer[0] << 24) | (buffer[1] << 16) +- | (buffer[2] << 8) | buffer[3]; ++ n = buf32_to_size_t (buffer); + buffer += 4; + buflen -= 4; + } +@@ -709,7 +709,7 @@ + /* This should never happen since we don't currently allow + creating such a subpacket, but just in case... */ + case SIGSUBPKT_SIG_EXPIRE: +- if(buffer_to_u32(buffer)+sig->timestamp<=make_timestamp()) ++ if (buf32_to_u32 (buffer) + sig->timestamp <= make_timestamp()) + sig->flags.expired=1; + else + sig->flags.expired=0; +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/ccid-driver.c gnupg-1.4.11/g10/ccid-driver.c +--- gnupg-1.4.11~/g10/ccid-driver.c 2009-12-21 09:35:05.000000000 -0500 ++++ gnupg-1.4.11/g10/ccid-driver.c 2015-03-25 13:59:41.967070877 -0400 +@@ -92,6 +92,7 @@ + #include + + #include "ccid-driver.h" ++#include "../include/host2net.h" + + #define DRVNAME "ccid-driver: " + +@@ -292,7 +293,7 @@ + static unsigned int + convert_le_u32 (const unsigned char *buf) + { +- return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); ++ return buf[0] | (buf[1] << 8) | (buf[2] << 16) | ((unsigned int)buf[3] << 24); + } + + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/getkey.c gnupg-1.4.11/g10/getkey.c +--- gnupg-1.4.11~/g10/getkey.c 2015-03-25 13:59:38.000000000 -0400 ++++ gnupg-1.4.11/g10/getkey.c 2015-03-25 13:59:41.967070877 -0400 +@@ -34,6 +34,7 @@ + #include "trustdb.h" + #include "i18n.h" + #include "keyserver-internal.h" ++#include "../include/host2net.h" + + #define MAX_PK_CACHE_ENTRIES PK_UID_CACHE_SIZE + #define MAX_UID_CACHE_ENTRIES PK_UID_CACHE_SIZE +@@ -1385,14 +1386,14 @@ + + p = parse_sig_subpkt( sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL ); + if( pk ) { +- ed = p? pk->timestamp + buffer_to_u32(p):0; ++ ed = p? pk->timestamp + buf32_to_u32(p):0; + if( sig->timestamp > sigdate ) { + pk->expiredate = ed; + sigdate = sig->timestamp; + } + } + else { +- ed = p? sk->timestamp + buffer_to_u32(p):0; ++ ed = p? sk->timestamp + buf32_to_u32(p):0; + if( sig->timestamp > sigdate ) { + sk->expiredate = ed; + sigdate = sig->timestamp; +@@ -1517,8 +1518,8 @@ + + /* ditto for the key expiration */ + p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL); +- if( p && buffer_to_u32(p) ) +- uid->help_key_expire = keycreated + buffer_to_u32(p); ++ if( p && buf32_to_u32 (p) ) ++ uid->help_key_expire = keycreated + buf32_to_u32(p); + else + uid->help_key_expire = 0; + +@@ -1732,9 +1733,9 @@ + key_usage=parse_key_usage(sig); + + p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL); +- if( p && buffer_to_u32(p) ) ++ if( p && buf32_to_u32 (p) ) + { +- key_expire = keytimestamp + buffer_to_u32(p); ++ key_expire = keytimestamp + buf32_to_u32 (p); + key_expire_seen = 1; + } + +@@ -2156,8 +2157,8 @@ + subpk->pubkey_usage = key_usage; + + p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL); +- if ( p && buffer_to_u32(p) ) +- key_expire = keytimestamp + buffer_to_u32(p); ++ if ( p && buf32_to_u32 (p) ) ++ key_expire = keytimestamp + buf32_to_u32 (p); + else + key_expire = 0; + subpk->has_expired = key_expire >= curtime? 0 : key_expire; +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/keygen.c gnupg-1.4.11/g10/keygen.c +--- gnupg-1.4.11~/g10/keygen.c 2015-03-25 13:59:38.000000000 -0400 ++++ gnupg-1.4.11/g10/keygen.c 2015-03-25 14:00:44.251594381 -0400 +@@ -40,6 +40,7 @@ + #include "i18n.h" + #include "cardglue.h" + #include "keyserver-internal.h" ++#include "host2net.h" + + #define MAX_PREFS 30 + +@@ -837,10 +838,7 @@ + } + else if(buf[1]==255) + { +- pktlen =buf[2] << 24; +- pktlen|=buf[3] << 16; +- pktlen|=buf[4] << 8; +- pktlen|=buf[5]; ++ pktlen = buf32_to_size_t (buf+2); + buf+=6; + } + else +@@ -857,14 +855,14 @@ + break; + + case 2: +- pktlen =buf[mark++] << 24; +- pktlen|=buf[mark++] << 16; ++ pktlen = (size_t)buf[mark++] << 24; ++ pktlen |= buf[mark++] << 16; + + case 1: +- pktlen|=buf[mark++] << 8; ++ pktlen |= buf[mark++] << 8; + + case 0: +- pktlen|=buf[mark++]; ++ pktlen |= buf[mark++]; + } + + buf+=mark; +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/keyid.c gnupg-1.4.11/g10/keyid.c +--- gnupg-1.4.11~/g10/keyid.c 2008-12-11 11:40:05.000000000 -0500 ++++ gnupg-1.4.11/g10/keyid.c 2015-03-25 13:59:41.971070912 -0400 +@@ -32,6 +32,7 @@ + #include "mpi.h" + #include "keydb.h" + #include "i18n.h" ++#include "host2net.h" + + int + pubkey_letter( int algo ) +@@ -230,15 +231,8 @@ + { + u32 keyid[2]; + +- keyid[0] = (unsigned char)desc->u.fpr[12] << 24 +- | (unsigned char)desc->u.fpr[13] << 16 +- | (unsigned char)desc->u.fpr[14] << 8 +- | (unsigned char)desc->u.fpr[15] ; +- keyid[1] = (unsigned char)desc->u.fpr[16] << 24 +- | (unsigned char)desc->u.fpr[17] << 16 +- | (unsigned char)desc->u.fpr[18] << 8 +- | (unsigned char)desc->u.fpr[19] ; +- ++ keyid[0] = buf32_to_u32 (desc->u.fpr+12); ++ keyid[1] = buf32_to_u32 (desc->u.fpr+16); + return keystr(keyid); + } + +@@ -289,8 +283,8 @@ + if(md) + { + dp = md_read( md, 0 ); +- keyid[0] = dp[12] << 24 | dp[13] << 16 | dp[14] << 8 | dp[15] ; +- keyid[1] = dp[16] << 24 | dp[17] << 16 | dp[18] << 8 | dp[19] ; ++ keyid[0] = buf32_to_u32 (dp+12); ++ keyid[1] = buf32_to_u32 (dp+16); + lowbits = keyid[1]; + md_close(md); + sk->keyid[0] = keyid[0]; +@@ -343,8 +337,8 @@ + if(md) + { + dp = md_read( md, 0 ); +- keyid[0] = dp[12] << 24 | dp[13] << 16 | dp[14] << 8 | dp[15] ; +- keyid[1] = dp[16] << 24 | dp[17] << 16 | dp[18] << 8 | dp[19] ; ++ keyid[0] = buf32_to_u32 (dp+12); ++ keyid[1] = buf32_to_u32 (dp+16); + lowbits = keyid[1]; + md_close(md); + pk->keyid[0] = keyid[0]; +@@ -387,8 +381,8 @@ + } + else { + const byte *dp = fprint; +- keyid[0] = dp[12] << 24 | dp[13] << 16 | dp[14] << 8 | dp[15] ; +- keyid[1] = dp[16] << 24 | dp[17] << 16 | dp[18] << 8 | dp[19] ; ++ keyid[0] = buf32_to_u32 (dp+12); ++ keyid[1] = buf32_to_u32 (dp+16); + } + + return keyid[1]; +@@ -676,8 +670,8 @@ + if( !array ) + array = xmalloc( len ); + memcpy(array, dp, len ); +- pk->keyid[0] = dp[12] << 24 | dp[13] << 16 | dp[14] << 8 | dp[15] ; +- pk->keyid[1] = dp[16] << 24 | dp[17] << 16 | dp[18] << 8 | dp[19] ; ++ pk->keyid[0] = buf32_to_u32 (dp+12); ++ pk->keyid[1] = buf32_to_u32 (dp+16); + md_close(md); + } + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/misc.c gnupg-1.4.11/g10/misc.c +--- gnupg-1.4.11~/g10/misc.c 2010-09-28 05:00:25.000000000 -0400 ++++ gnupg-1.4.11/g10/misc.c 2015-03-25 13:59:41.971070912 -0400 +@@ -295,17 +295,6 @@ + return csum; + } + +-u32 +-buffer_to_u32( const byte *buffer ) +-{ +- unsigned long a; +- a = *buffer << 24; +- a |= buffer[1] << 16; +- a |= buffer[2] << 8; +- a |= buffer[3]; +- return a; +-} +- + void + print_pubkey_algo_note( int algo ) + { +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/parse-packet.c gnupg-1.4.11/g10/parse-packet.c +--- gnupg-1.4.11~/g10/parse-packet.c 2010-06-18 04:06:08.000000000 -0400 ++++ gnupg-1.4.11/g10/parse-packet.c 2015-03-25 13:59:41.975070944 -0400 +@@ -35,6 +35,7 @@ + #include "options.h" + #include "main.h" + #include "i18n.h" ++#include "host2net.h" + + #ifndef MAX_EXTERN_MPI_BITS + #define MAX_EXTERN_MPI_BITS 16384 +@@ -88,7 +89,7 @@ + read_16(IOBUF inp) + { + unsigned short a; +- a = iobuf_get_noeof(inp) << 8; ++ a = (unsigned short)iobuf_get_noeof(inp) << 8; + a |= iobuf_get_noeof(inp); + return a; + } +@@ -97,7 +98,7 @@ + read_32(IOBUF inp) + { + unsigned long a; +- a = iobuf_get_noeof(inp) << 24; ++ a = (unsigned long)iobuf_get_noeof(inp) << 24; + a |= iobuf_get_noeof(inp) << 16; + a |= iobuf_get_noeof(inp) << 8; + a |= iobuf_get_noeof(inp); +@@ -377,7 +378,8 @@ + } + else if( c == 255 ) + { +- pktlen = (hdr[hdrlen++] = iobuf_get_noeof(inp)) << 24; ++ pktlen = ++ (unsigned long)(hdr[hdrlen++] = iobuf_get_noeof(inp)) << 24; + pktlen |= (hdr[hdrlen++] = iobuf_get_noeof(inp)) << 16; + pktlen |= (hdr[hdrlen++] = iobuf_get_noeof(inp)) << 8; + if( (c = iobuf_get(inp)) == -1 ) +@@ -872,14 +874,15 @@ + switch( type ) { + case SIGSUBPKT_SIG_CREATED: + if( length >= 4 ) +- fprintf (listfp, "sig created %s", strtimestamp( buffer_to_u32(buffer) ) ); ++ fprintf (listfp, "sig created %s", ++ strtimestamp (buf32_to_u32(buffer)) ); + break; + case SIGSUBPKT_SIG_EXPIRE: + if( length >= 4 ) + { +- if(buffer_to_u32(buffer)) ++ if(buf32_to_u32(buffer)) + fprintf (listfp, "sig expires after %s", +- strtimevalue( buffer_to_u32(buffer) ) ); ++ strtimevalue( buf32_to_u32(buffer) ) ); + else + fprintf (listfp, "sig does not expire"); + } +@@ -907,9 +910,9 @@ + case SIGSUBPKT_KEY_EXPIRE: + if( length >= 4 ) + { +- if(buffer_to_u32(buffer)) ++ if(buf32_to_u32(buffer)) + fprintf (listfp, "key expires after %s", +- strtimevalue( buffer_to_u32(buffer) ) ); ++ strtimevalue( buf32_to_u32(buffer) ) ); + else + fprintf (listfp, "key does not expire"); + } +@@ -932,8 +935,8 @@ + case SIGSUBPKT_ISSUER: + if( length >= 8 ) + fprintf (listfp, "issuer key ID %08lX%08lX", +- (ulong)buffer_to_u32(buffer), +- (ulong)buffer_to_u32(buffer+4) ); ++ buf32_to_ulong (buffer), ++ buf32_to_ulong (buffer+4)); + break; + case SIGSUBPKT_NOTATION: + { +@@ -1178,8 +1181,7 @@ + if( n == 255 ) { /* 4 byte length header */ + if( buflen < 4 ) + goto too_short; +- n = (buffer[0] << 24) | (buffer[1] << 16) +- | (buffer[2] << 8) | buffer[3]; ++ n = buf32_to_size_t (buffer); + buffer += 4; + buflen -= 4; + } +@@ -1401,7 +1403,7 @@ + + p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_SIG_CREATED, NULL ); + if(p) +- sig->timestamp = buffer_to_u32(p); ++ sig->timestamp = buf32_to_u32 (p); + else if(!(sig->pubkey_algo>=100 && sig->pubkey_algo<=110) + && opt.verbose) + log_info ("signature packet without timestamp\n"); +@@ -1409,16 +1411,16 @@ + p = parse_sig_subpkt2( sig, SIGSUBPKT_ISSUER, NULL ); + if(p) + { +- sig->keyid[0] = buffer_to_u32(p); +- sig->keyid[1] = buffer_to_u32(p+4); ++ sig->keyid[0] = buf32_to_u32 (p); ++ sig->keyid[1] = buf32_to_u32 (p+4); + } + else if(!(sig->pubkey_algo>=100 && sig->pubkey_algo<=110) + && opt.verbose) + log_info ("signature packet without keyid\n"); + + p=parse_sig_subpkt(sig->hashed,SIGSUBPKT_SIG_EXPIRE,NULL); +- if(p && buffer_to_u32(p)) +- sig->expiredate=sig->timestamp+buffer_to_u32(p); ++ if(p && buf32_to_u32 (p)) ++ sig->expiredate = sig->timestamp + buf32_to_u32 (p); + if(sig->expiredate && sig->expiredate<=make_timestamp()) + sig->flags.expired=1; + +@@ -1999,9 +2001,8 @@ + if( n == 255 ) { /* 4 byte length header */ + if( buflen < 4 ) + goto too_short; +- n = (buffer[0] << 24) | (buffer[1] << 16) +- | (buffer[2] << 8) | buffer[3]; +- buffer += 4; ++ n = buf32_to_size_t (buffer); ++ buffer += 4; + buflen -= 4; + } + else if( n >= 192 ) { /* 2 byte special encoded length header */ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/tdbio.c gnupg-1.4.11/g10/tdbio.c +--- gnupg-1.4.11~/g10/tdbio.c 2009-12-15 03:56:26.000000000 -0500 ++++ gnupg-1.4.11/g10/tdbio.c 2015-03-25 14:01:46.032113708 -0400 +@@ -1210,13 +1210,13 @@ + rec->r.ver.cert_depth = *p++; + rec->r.ver.trust_model = *p++; + p += 3; +- rec->r.ver.created = buftoulong(p); p += 4; +- rec->r.ver.nextcheck = buftoulong(p); p += 4; ++ rec->r.ver.created = buf32_to_ulong (p); p += 4; ++ rec->r.ver.nextcheck = buf32_to_ulong (p); p += 4; + p += 4; + p += 4; +- rec->r.ver.firstfree =buftoulong(p); p += 4; ++ rec->r.ver.firstfree =buf32_to_ulong (p); p += 4; + p += 4; +- rec->r.ver.trusthashtbl =buftoulong(p); p += 4; ++ rec->r.ver.trusthashtbl =buf32_to_ulong (p); p += 4; + if( recnum ) { + log_error( _("%s: version record with recnum %lu\n"), db_name, + (ulong)recnum ); +@@ -1229,17 +1229,17 @@ + } + break; + case RECTYPE_FREE: +- rec->r.free.next = buftoulong(p); p += 4; ++ rec->r.free.next = buf32_to_ulong (p); p += 4; + break; + case RECTYPE_HTBL: + for(i=0; i < ITEMS_PER_HTBL_RECORD; i++ ) { +- rec->r.htbl.item[i] = buftoulong(p); p += 4; ++ rec->r.htbl.item[i] = buf32_to_ulong (p); p += 4; + } + break; + case RECTYPE_HLST: +- rec->r.hlst.next = buftoulong(p); p += 4; ++ rec->r.hlst.next = buf32_to_ulong (p); p += 4; + for(i=0; i < ITEMS_PER_HLST_RECORD; i++ ) { +- rec->r.hlst.rnum[i] = buftoulong(p); p += 4; ++ rec->r.hlst.rnum[i] = buf32_to_ulong (p); p += 4; + } + break; + case RECTYPE_TRUST: +@@ -1248,12 +1248,12 @@ + rec->r.trust.depth = *p++; + rec->r.trust.min_ownertrust = *p++; + p++; +- rec->r.trust.validlist = buftoulong(p); p += 4; ++ rec->r.trust.validlist = buf32_to_ulong (p); p += 4; + break; + case RECTYPE_VALID: + memcpy( rec->r.valid.namehash, p, 20); p+=20; + rec->r.valid.validity = *p++; +- rec->r.valid.next = buftoulong(p); p += 4; ++ rec->r.valid.next = buf32_to_ulong (p); p += 4; + rec->r.valid.full_count = *p++; + rec->r.valid.marginal_count = *p++; + break; +@@ -1560,7 +1560,7 @@ + ottable_size += 1000; + ottable = xrealloc (ottable, ottable_size * sizeof *ottable); + } +- ottable[ottable_used].keyrecno = buftoulong (oldbuf+6); ++ ottable[ottable_used].keyrecno = buf32_to_ulong (oldbuf+6); + ottable[ottable_used].ot = oldbuf[18]; + ottable[ottable_used].okay = 0; + memset (ottable[ottable_used].fpr,0, 20); +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/trustdb.c gnupg-1.4.11/g10/trustdb.c +--- gnupg-1.4.11~/g10/trustdb.c 2009-12-21 09:34:19.000000000 -0500 ++++ gnupg-1.4.11/g10/trustdb.c 2015-03-25 13:59:41.975070944 -0400 +@@ -1585,7 +1585,7 @@ + u32 expire; + + p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_SIG_EXPIRE, NULL ); +- expire = p? sig->timestamp + buffer_to_u32(p) : 0; ++ expire = p? sig->timestamp + buf32_to_u32 (p) : 0; + + if (expire==0 || expire > curtime ) + { +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/include/host2net.h gnupg-1.4.11/include/host2net.h +--- gnupg-1.4.11~/include/host2net.h 2008-12-11 11:39:58.000000000 -0500 ++++ gnupg-1.4.11/include/host2net.h 2015-03-25 13:59:41.975070944 -0400 +@@ -1,5 +1,5 @@ +-/* host2net.h - Some macros +- * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. ++/* host2net.h - Endian conversion macros ++ * Copyright (C) 1998, 2014, 2015 Werner Koch + * + * This file is part of GNUPG. + * +@@ -17,14 +17,11 @@ + * along with this program; if not, see . + */ + +-#ifndef G10_HOST2NET_H +-#define G10_HOST2NET_H ++#ifndef GNUPG_COMMON_HOST2NET_H ++#define GNUPG_COMMON_HOST2NET_H + + #include "types.h" + +-#define buftoulong( p ) ((*(byte*)(p) << 24) | (*((byte*)(p)+1)<< 16) | \ +- (*((byte*)(p)+2) << 8) | (*((byte*)(p)+3))) +-#define buftoushort( p ) ((*((byte*)(p)) << 8) | (*((byte*)(p)+1))) + #define ulongtobuf( p, a ) do { \ + ((byte*)p)[0] = a >> 24; \ + ((byte*)p)[1] = a >> 16; \ +@@ -35,8 +32,71 @@ + ((byte*)p)[0] = a >> 8; \ + ((byte*)p)[1] = a ; \ + } while(0) +-#define buftou32( p) buftoulong( (p) ) +-#define u32tobuf( p, a) ulongtobuf( (p), (a) ) + + +-#endif /*G10_HOST2NET_H*/ ++static inline unsigned long ++buf16_to_ulong (const void *buffer) ++{ ++ const unsigned char *p = buffer; ++ ++ return (((unsigned long)p[0] << 8) | p[1]); ++} ++ ++static inline unsigned int ++buf16_to_uint (const void *buffer) ++{ ++ const unsigned char *p = buffer; ++ ++ return (((unsigned int)p[0] << 8) | p[1]); ++} ++ ++static inline unsigned short ++buf16_to_ushort (const void *buffer) ++{ ++ const unsigned char *p = buffer; ++ ++ return (((unsigned short)p[0] << 8) | p[1]); ++} ++ ++static inline u16 ++buf16_to_u16 (const void *buffer) ++{ ++ const unsigned char *p = buffer; ++ ++ return (((u16)p[0] << 8) | p[1]); ++} ++ ++static inline size_t ++buf32_to_size_t (const void *buffer) ++{ ++ const unsigned char *p = buffer; ++ ++ return (((size_t)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); ++} ++ ++static inline unsigned long ++buf32_to_ulong (const void *buffer) ++{ ++ const unsigned char *p = buffer; ++ ++ return (((unsigned long)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); ++} ++ ++static inline unsigned int ++buf32_to_uint (const void *buffer) ++{ ++ const unsigned char *p = buffer; ++ ++ return (((unsigned int)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); ++} ++ ++static inline u32 ++buf32_to_u32 (const void *buffer) ++{ ++ const unsigned char *p = buffer; ++ ++ return (((u32)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); ++} ++ ++ ++#endif /*GNUPG_COMMON_HOST2NET_H*/ only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2015-0837.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2015-0837.dpatch @@ -0,0 +1,217 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# From 6cbc75e71295f23431c4ab95edc7573f2fc28476 Mon Sep 17 00:00:00 2001 +# From: NIIBE Yutaka +# Date: Thu, 26 Feb 2015 21:00:05 +0900 +# Subject: [PATCH] mpi: Avoid data-dependent timing variations in mpi_powm. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/include/mpi.h gnupg-1.4.11/include/mpi.h +--- gnupg-1.4.11~/include/mpi.h 2008-12-11 11:39:58.000000000 -0500 ++++ gnupg-1.4.11/include/mpi.h 2015-03-25 13:59:21.846901778 -0400 +@@ -81,6 +81,7 @@ + void mpi_set_secure( MPI a ); + void mpi_clear( MPI a ); + void mpi_set( MPI w, MPI u); ++void mpi_set_cond( MPI w, MPI u, unsigned long set); + void mpi_set_ui( MPI w, ulong u); + MPI mpi_alloc_set_ui( unsigned long u); + void mpi_m_check( MPI a ); +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/mpi/mpi-pow.c gnupg-1.4.11/mpi/mpi-pow.c +--- gnupg-1.4.11~/mpi/mpi-pow.c 2015-03-25 13:59:17.000000000 -0400 ++++ gnupg-1.4.11/mpi/mpi-pow.c 2015-03-25 13:59:21.846901778 -0400 +@@ -345,7 +345,7 @@ + *xsize_p = rsize + ssize; + } + +-#define SIZE_B_2I3 ((1 << (5 - 1)) - 1) ++#define SIZE_PRECOMP ((1 << (5 - 1))) + + /**************** + * RES = BASE ^ EXPO mod MOD +@@ -376,11 +376,12 @@ + mpi_ptr_t bp_marker = NULL; + mpi_ptr_t ep_marker = NULL; + mpi_ptr_t xp_marker = NULL; +- mpi_ptr_t b_2i3[SIZE_B_2I3]; /* Pre-computed array: BASE^3, ^5, ^7, ... */ +- mpi_size_t b_2i3size[SIZE_B_2I3]; ++ mpi_ptr_t precomp[SIZE_PRECOMP]; /* Pre-computed array: BASE^1, ^3, ^5, ... */ ++ mpi_size_t precomp_size[SIZE_PRECOMP]; + mpi_size_t W; + mpi_ptr_t base_u; + mpi_size_t base_u_size; ++ mpi_size_t max_u_size; + + esize = expo->nlimbs; + msize = mod->nlimbs; +@@ -494,7 +495,7 @@ + + /* Main processing. */ + { +- mpi_size_t i, j; ++ mpi_size_t i, j, k; + mpi_ptr_t xp; + mpi_size_t xsize; + int c; +@@ -508,33 +509,29 @@ + memset( &karactx, 0, sizeof karactx ); + negative_result = (ep[0] & 1) && bsign; + +- /* Precompute B_2I3[], BASE^(2 * i + 3), BASE^3, ^5, ^7, ... */ ++ /* Precompute PRECOMP[], BASE^(2 * i + 1), BASE^1, ^3, ^5, ... */ + if (W > 1) /* X := BASE^2 */ + mul_mod (xp, &xsize, bp, bsize, bp, bsize, mp, msize, &karactx); +- for (i = 0; i < (1 << (W - 1)) - 1; i++) +- { /* B_2I3[i] = BASE^(2 * i + 3) */ +- if (i == 0) +- { +- base_u = bp; +- base_u_size = bsize; +- } +- else +- { +- base_u = b_2i3[i-1]; +- base_u_size = b_2i3size[i-1]; +- } +- ++ base_u = precomp[0] = mpi_alloc_limb_space (bsize, esec); ++ base_u_size = max_u_size = precomp_size[0] = bsize; ++ MPN_COPY (precomp[0], bp, bsize); ++ for (i = 1; i < (1 << (W - 1)); i++) ++ { /* PRECOMP[i] = BASE^(2 * i + 1) */ + if (xsize >= base_u_size) + mul_mod (rp, &rsize, xp, xsize, base_u, base_u_size, + mp, msize, &karactx); + else + mul_mod (rp, &rsize, base_u, base_u_size, xp, xsize, + mp, msize, &karactx); +- b_2i3[i] = mpi_alloc_limb_space (rsize, esec); +- b_2i3size[i] = rsize; +- MPN_COPY (b_2i3[i], rp, rsize); ++ base_u = precomp[i] = mpi_alloc_limb_space (rsize, esec); ++ base_u_size = precomp_size[i] = rsize; ++ if (max_u_size < base_u_size) ++ max_u_size = base_u_size; ++ MPN_COPY (precomp[i], rp, rsize); + } + ++ base_u = mpi_alloc_limb_space (max_u_size, esec); ++ + i = esize - 1; + + /* Main loop. +@@ -620,17 +617,26 @@ + rsize = xsize; + } + +- if (e0 == 0) +- { +- base_u = bp; +- base_u_size = bsize; +- } +- else ++ /* ++ * base_u <= precomp[e0] ++ * base_u_size <= precomp_size[e0]; ++ */ ++ base_u_size = 0; ++ for (k = 0; k < (1<< (W - 1)); k++) + { +- base_u = b_2i3[e0 - 1]; +- base_u_size = b_2i3size[e0 -1]; +- } ++ struct gcry_mpi w, u; ++ w.alloced = w.nlimbs = precomp_size[k]; ++ u.alloced = u.nlimbs = precomp_size[k]; ++ w.nbits = w.nlimbs * BITS_PER_MPI_LIMB; ++ u.nbits = u.nlimbs * BITS_PER_MPI_LIMB; ++ w.sign = u.sign = 0; ++ w.flags = u.flags = 0; ++ w.d = base_u; ++ u.d = precomp[k]; + ++ mpi_set_cond (&w, &u, k == e0); ++ base_u_size |= (precomp_size[k] & ((mpi_size_t)0 - (k == e0)) ); ++ } + mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size, + mp, msize, &karactx); + tp = rp; rp = xp; xp = tp; +@@ -656,15 +662,21 @@ + + if (e != 0) + { +- if ((e>>1) == 0) +- { +- base_u = bp; +- base_u_size = bsize; +- } +- else ++ base_u_size = 0; ++ for (k = 0; k < (1<< (W - 1)); k++) + { +- base_u = b_2i3[(e>>1) - 1]; +- base_u_size = b_2i3size[(e>>1) -1]; ++ struct gcry_mpi w, u; ++ w.alloced = w.nlimbs = precomp_size[k]; ++ u.alloced = u.nlimbs = precomp_size[k]; ++ w.nbits = w.nlimbs * BITS_PER_MPI_LIMB; ++ u.nbits = u.nlimbs * BITS_PER_MPI_LIMB; ++ w.sign = u.sign = 0; ++ w.flags = u.flags = 0; ++ w.d = base_u; ++ u.d = precomp[k]; ++ ++ mpi_set_cond (&w, &u, k == (e>>1)); ++ base_u_size |= (precomp_size[k] & ((mpi_size_t)0 - (k == (e>>1))) ); + } + + mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size, +@@ -714,8 +726,9 @@ + MPN_NORMALIZE (rp, rsize); + + mpihelp_release_karatsuba_ctx (&karactx ); +- for (i = 0; i < (1 << (W - 1)) - 1; i++) +- mpi_free_limb_space (b_2i3[i]); ++ for (i = 0; i < (1 << (W - 1)); i++) ++ mpi_free_limb_space (precomp[i]); ++ mpi_free_limb_space (base_u); + } + + /* Fixup for negative results. */ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/mpi/mpiutil.c gnupg-1.4.11/mpi/mpiutil.c +--- gnupg-1.4.11~/mpi/mpiutil.c 2008-12-11 11:39:43.000000000 -0500 ++++ gnupg-1.4.11/mpi/mpiutil.c 2015-03-25 13:59:21.846901778 -0400 +@@ -433,6 +433,34 @@ + + + void ++mpi_set_cond( MPI w, MPI u, unsigned long set) ++{ ++ mpi_size_t i; ++ mpi_size_t nlimbs = u->alloced; ++ mpi_limb_t mask = ((mpi_limb_t)0) - !!set; ++ mpi_limb_t x; ++ ++ if (w->alloced != u->alloced) ++ log_bug ("mpi_set_cond: different sizes\n"); ++ ++ for (i = 0; i < nlimbs; i++) ++ { ++ x = mask & (w->d[i] ^ u->d[i]); ++ w->d[i] = w->d[i] ^ x; ++ } ++ ++ x = mask & (w->nlimbs ^ u->nlimbs); ++ w->nlimbs = w->nlimbs ^ x; ++ ++ x = mask & (w->nbits ^ u->nbits); ++ w->nbits = w->nbits ^ x; ++ ++ x = mask & (w->sign ^ u->sign); ++ w->sign = w->sign ^ x; ++} ++ ++ ++void + mpi_set_ui( MPI w, unsigned long u) + { + RESIZE_IF_NEEDED(w, 1); only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/use_agent_default.dpatch +++ gnupg-1.4.11/debian/patches/use_agent_default.dpatch @@ -0,0 +1,25 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 61_use_agent_default.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Use agent by default. (LP: #15485) + +@DPATCH@ +diff -urNad gnupg-1.4.9~/g10/options.skel gnupg-1.4.9/g10/options.skel +--- gnupg-1.4.9~/g10/options.skel 2008-07-21 01:03:49.000000000 +0200 ++++ gnupg-1.4.9/g10/options.skel 2008-07-21 01:19:59.000000000 +0200 +@@ -198,8 +198,12 @@ + # at ftp.gnupg.org/gcrypt/alpha/aegypten/). To make use of the agent, + # you have to run an agent as daemon and use the option + # +-# use-agent +-# ++# For Ubuntu we now use-agent by default to support more automatic ++# use of GPG and S/MIME encryption by GUI programs. Depending on the ++# program, users may still have to manually decide to install gnupg-agent. ++ ++use-agent ++ + # which tries to use the agent but will fallback to the regular mode + # if there is a problem connecting to the agent. The normal way to + # locate the agent is by looking at the environment variable only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/disable_mlock_test.dpatch +++ gnupg-1.4.11/debian/patches/disable_mlock_test.dpatch @@ -0,0 +1,23 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 50_disable_mlock_test.dpatch by Michael Bienia +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Disable mlock() test since it fails with ulimit 0 (on Ubuntu buildds). + + +@DPATCH@ +diff -urNad gnupg-1.4.9~/config.h.in gnupg-1.4.9/config.h.in +--- gnupg-1.4.9~/config.h.in 2008-03-26 18:33:29.000000000 +0100 ++++ gnupg-1.4.9/config.h.in 2008-07-21 00:57:44.000000000 +0200 +@@ -82,8 +82,11 @@ + /* Define if `gethrtime(2)' does not work correctly i.e. issues a SIGILL. */ + #undef HAVE_BROKEN_GETHRTIME + ++/* Test doesn't work, since ulimit is sometimes 0... */ ++#if 0 + /* Defined if the mlock() call does not work */ + #undef HAVE_BROKEN_MLOCK ++#endif + + /* Define to 1 if the compiler understands __builtin_expect. */ + #undef HAVE_BUILTIN_EXPECT only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2013-4402.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2013-4402.dpatch @@ -0,0 +1,154 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# Description: fix denial of service via infinite recursion +# Origin: backported from GnuPG 1.4.15 +# Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=725439 + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/mainproc.c gnupg-1.4.11/g10/mainproc.c +--- gnupg-1.4.11~/g10/mainproc.c 2010-08-31 04:04:59.000000000 -0400 ++++ gnupg-1.4.11/g10/mainproc.c 2013-10-08 07:49:53.896606333 -0400 +@@ -41,6 +41,11 @@ + #include "photoid.h" + + ++/* Put an upper limit on nested packets. The 32 is an arbitrary ++ value, a much lower should actually be sufficient. */ ++#define MAX_NESTING_DEPTH 32 ++ ++ + struct kidlist_item { + struct kidlist_item *next; + u32 kid[2]; +@@ -782,7 +787,7 @@ + return proc_encryption_packets( info, a ); + } + +-static void ++static int + proc_compressed( CTX c, PACKET *pkt ) + { + PKT_compressed *zd = pkt->pkt.compressed; +@@ -801,6 +806,7 @@ + log_error("uncompressing failed: %s\n", g10_errstr(rc)); + free_packet(pkt); + c->last_was_session_key = 0; ++ return rc; + } + + /**************** +@@ -1231,14 +1237,37 @@ + } + + +-int ++static int ++check_nesting (CTX c) ++{ ++ int level; ++ ++ for (level = 0; c; c = c->anchor) ++ level++; ++ ++ if (level > MAX_NESTING_DEPTH) ++ { ++ log_error ("input data with too deeply nested packets\n"); ++ write_status_text (STATUS_UNEXPECTED, "1"); ++ return G10ERR_UNEXPECTED; ++ } ++ return 0; ++} ++ ++ ++static int + do_proc_packets( CTX c, IOBUF a ) + { +- PACKET *pkt = xmalloc( sizeof *pkt ); +- int rc=0; +- int any_data=0; ++ PACKET *pkt; ++ int rc = 0; ++ int any_data = 0; + int newpkt; + ++ rc = check_nesting (c); ++ if (rc) ++ return rc; ++ ++ pkt = xmalloc( sizeof *pkt ); + c->iobuf = a; + init_packet(pkt); + while( (rc=parse_packet(a, pkt)) != -1 ) { +@@ -1258,7 +1287,7 @@ + case PKT_SYMKEY_ENC: proc_symkey_enc( c, pkt ); break; + case PKT_ENCRYPTED: + case PKT_ENCRYPTED_MDC: proc_encrypted( c, pkt ); break; +- case PKT_COMPRESSED: proc_compressed( c, pkt ); break; ++ case PKT_COMPRESSED: rc = proc_compressed( c, pkt ); break; + default: newpkt = 0; break; + } + } +@@ -1276,7 +1305,7 @@ + goto leave; + case PKT_SIGNATURE: newpkt = add_signature( c, pkt ); break; + case PKT_PLAINTEXT: proc_plaintext( c, pkt ); break; +- case PKT_COMPRESSED: proc_compressed( c, pkt ); break; ++ case PKT_COMPRESSED: rc = proc_compressed( c, pkt ); break; + case PKT_ONEPASS_SIG: newpkt = add_onepass_sig( c, pkt ); break; + case PKT_GPG_CONTROL: newpkt = add_gpg_control(c, pkt); break; + default: newpkt = 0; break; +@@ -1296,7 +1325,7 @@ + case PKT_ENCRYPTED: + case PKT_ENCRYPTED_MDC: proc_encrypted( c, pkt ); break; + case PKT_PLAINTEXT: proc_plaintext( c, pkt ); break; +- case PKT_COMPRESSED: proc_compressed( c, pkt ); break; ++ case PKT_COMPRESSED: rc = proc_compressed( c, pkt ); break; + case PKT_ONEPASS_SIG: newpkt = add_onepass_sig( c, pkt ); break; + case PKT_GPG_CONTROL: newpkt = add_gpg_control(c, pkt); break; + default: newpkt = 0; break; +@@ -1321,13 +1350,17 @@ + case PKT_ENCRYPTED: + case PKT_ENCRYPTED_MDC: proc_encrypted( c, pkt ); break; + case PKT_PLAINTEXT: proc_plaintext( c, pkt ); break; +- case PKT_COMPRESSED: proc_compressed( c, pkt ); break; ++ case PKT_COMPRESSED: rc = proc_compressed( c, pkt ); break; + case PKT_ONEPASS_SIG: newpkt = add_onepass_sig( c, pkt ); break; + case PKT_GPG_CONTROL: newpkt = add_gpg_control(c, pkt); break; + case PKT_RING_TRUST: newpkt = add_ring_trust( c, pkt ); break; + default: newpkt = 0; break; + } + } ++ ++ if (rc) ++ goto leave; ++ + /* This is a very ugly construct and frankly, I don't remember why + * I used it. Adding the MDC check here is a hack. + * The right solution is to initiate another context for encrypted +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/util/iobuf.c gnupg-1.4.11/util/iobuf.c +--- gnupg-1.4.11~/util/iobuf.c 2010-09-28 05:23:08.000000000 -0400 ++++ gnupg-1.4.11/util/iobuf.c 2013-10-08 07:49:53.896606333 -0400 +@@ -55,6 +55,11 @@ + + #undef FILE_FILTER_USES_STDIO + ++/* To avoid a potential DoS with compression packets we better limit ++ the number of filters in a chain. */ ++#define MAX_NESTING_FILTER 64 ++ ++ + #ifdef HAVE_DOSISH_SYSTEM + #define USE_SETMODE 1 + #endif +@@ -1403,6 +1408,12 @@ + + if( a->use == 2 && (rc=iobuf_flush(a)) ) + return rc; ++ ++ if (a->subno >= MAX_NESTING_FILTER) { ++ log_error ("i/o filter too deeply nested - corrupted data?\n"); ++ return G10ERR_UNEXPECTED; ++ } ++ + /* make a copy of the current stream, so that + * A is the new stream and B the original one. + * The contents of the buffers are transferred to the only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2016-6313.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2016-6313.dpatch @@ -0,0 +1,50 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# Description: fix random number generator prediction +# Origin: upstream, http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commit;h=e23eec8c9a602eee0a09851a54db0f5d611f125c +# Origin: upstream, http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commit;h=c6dbfe89903d0c8191cf50ecf1abb3c8458b427a + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/cipher/random.c gnupg-1.4.11/cipher/random.c +--- gnupg-1.4.11~/cipher/random.c 2016-08-17 13:36:37.000000000 -0400 ++++ gnupg-1.4.11/cipher/random.c 2016-08-17 13:36:53.252890259 -0400 +@@ -360,23 +360,21 @@ + #if DIGESTLEN != 20 + #error must have a digest length of 20 for ripe-md-160 + #endif +- /* loop over the pool */ ++ /* pool -> pool' */ + pend = pool + POOLSIZE; + memcpy(hashbuf, pend - DIGESTLEN, DIGESTLEN ); + memcpy(hashbuf+DIGESTLEN, pool, BLOCKLEN-DIGESTLEN); + rmd160_mixblock( &md, hashbuf); +- memcpy(pool, hashbuf, 20 ); ++ memcpy(pool, hashbuf, DIGESTLEN); + ++ /* Loop for the remaining iterations. */ + p = pool; + for( n=1; n < POOLBLOCKS; n++ ) { +- memcpy(hashbuf, p, DIGESTLEN ); +- +- p += DIGESTLEN; +- if( p+DIGESTLEN+BLOCKLEN < pend ) +- memcpy(hashbuf+DIGESTLEN, p+DIGESTLEN, BLOCKLEN-DIGESTLEN); ++ if( p + BLOCKLEN < pend ) ++ memcpy(hashbuf, p, BLOCKLEN); + else { +- char *pp = p+DIGESTLEN; +- for(i=DIGESTLEN; i < BLOCKLEN; i++ ) { ++ char *pp = p; ++ for(i=0; i < BLOCKLEN; i++ ) { + if( pp >= pend ) + pp = pool; + hashbuf[i] = *pp++; +@@ -384,7 +382,8 @@ + } + + rmd160_mixblock( &md, hashbuf); +- memcpy(p, hashbuf, 20 ); ++ p += DIGESTLEN; ++ memcpy(p, hashbuf, DIGESTLEN); + } + burn_stack (384); /* for the rmd160_mixblock() */ + } only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/0002-Make-screening-of-keyserver-result-work-with-multi-k.dpatch +++ gnupg-1.4.11/debian/patches/0002-Make-screening-of-keyserver-result-work-with-multi-k.dpatch @@ -0,0 +1,120 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# From 955524f4359ba9e9de213f4067c38df9ae4808a8 Mon Sep 17 00:00:00 2001 +# From: Werner Koch +# Date: Wed, 25 Jun 2014 14:33:34 +0200 +# Subject: [PATCH] Make screening of keyserver result work with multi-key +# commands. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/keyserver.c gnupg-1.4.11/g10/keyserver.c +--- gnupg-1.4.11~/g10/keyserver.c 2015-03-25 13:55:23.000000000 -0400 ++++ gnupg-1.4.11/g10/keyserver.c 2015-03-25 13:56:00.733211909 -0400 +@@ -954,13 +954,25 @@ + #define KEYSERVER_ARGS_NOKEEP " -o \"%o\" \"%i\"" + + ++/* Structure to convey the arg to keyserver_retrieval_filter. */ ++struct ks_retrieval_filter_arg_s ++{ ++ KEYDB_SEARCH_DESC *desc; ++ int ndesc; ++}; ++ ++ + /* Check whether a key matches the search description. The filter + returns 0 if the key shall be imported. Note that this kind of + filter is not related to the iobuf filters. */ + static int +-keyserver_retrieval_filter (PKT_public_key *pk, PKT_secret_key *sk, void *arg) ++keyserver_retrieval_filter (PKT_public_key *pk, PKT_secret_key *sk, ++ void *opaque) + { +- KEYDB_SEARCH_DESC *desc = arg; ++ struct ks_retrieval_filter_arg_s *arg = opaque; ++ KEYDB_SEARCH_DESC *desc = arg->desc; ++ int ndesc = arg->ndesc; ++ int n; + u32 keyid[2]; + byte fpr[MAX_FINGERPRINT_LEN]; + size_t fpr_len = 0; +@@ -969,32 +981,40 @@ + if (sk) + return G10ERR_GENERAL; + ++ if (!ndesc) ++ return 0; /* Okay if no description given. */ ++ + fingerprint_from_pk (pk, fpr, &fpr_len); + keyid_from_pk (pk, keyid); + + /* Compare requested and returned fingerprints if available. */ +- if (desc->mode == KEYDB_SEARCH_MODE_FPR20) +- { +- if (fpr_len != 20 || memcmp (fpr, desc->u.fpr, 20)) +- return G10ERR_GENERAL; +- } +- else if (desc->mode == KEYDB_SEARCH_MODE_FPR16) +- { +- if (fpr_len != 16 || memcmp (fpr, desc->u.fpr, 16)) +- return G10ERR_GENERAL; +- } +- else if (desc->mode == KEYDB_SEARCH_MODE_LONG_KID) +- { +- if (keyid[0] != desc->u.kid[0] || keyid[1] != desc->u.kid[1]) +- return G10ERR_GENERAL; +- } +- else if (desc->mode == KEYDB_SEARCH_MODE_SHORT_KID) ++ for (n = 0; n < ndesc; n++) + { +- if (keyid[1] != desc->u.kid[1]) +- return G10ERR_GENERAL; ++ if (desc[n].mode == KEYDB_SEARCH_MODE_FPR20) ++ { ++ if (fpr_len == 20 && !memcmp (fpr, desc[n].u.fpr, 20)) ++ return 0; ++ } ++ else if (desc[n].mode == KEYDB_SEARCH_MODE_FPR16) ++ { ++ if (fpr_len == 16 && !memcmp (fpr, desc[n].u.fpr, 16)) ++ return 0; ++ } ++ else if (desc[n].mode == KEYDB_SEARCH_MODE_LONG_KID) ++ { ++ if (keyid[0] == desc[n].u.kid[0] && keyid[1] == desc[n].u.kid[1]) ++ return 0; ++ } ++ else if (desc[n].mode == KEYDB_SEARCH_MODE_SHORT_KID) ++ { ++ if (keyid[1] == desc[n].u.kid[1]) ++ return 0; ++ } ++ else ++ return 0; + } + +- return 0; ++ return G10ERR_GENERAL; + } + + +@@ -1534,6 +1554,7 @@ + case KS_GETNAME: + { + void *stats_handle; ++ struct ks_retrieval_filter_arg_s filterarg; + + stats_handle=import_new_stats_handle(); + +@@ -1544,9 +1565,11 @@ + way to do this could be to continue parsing this + line-by-line and make a temp iobuf for each key. */ + ++ filterarg.desc = desc; ++ filterarg.ndesc = count; + import_keys_stream(spawn->fromchild,stats_handle,fpr,fpr_len, + opt.keyserver_options.import_options, +- keyserver_retrieval_filter, desc); ++ keyserver_retrieval_filter, &filterarg); + + import_print_stats(stats_handle); + import_release_stats_handle(stats_handle); only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2014-4617.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2014-4617.dpatch @@ -0,0 +1,59 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# Description: fix denial of service via uncompressing garbled packets +# Origin: upstream, http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commitdiff;h=11fdfcf82bd8 +# Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752497 + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/compress.c gnupg-1.4.11/g10/compress.c +--- gnupg-1.4.11~/g10/compress.c 2009-09-02 09:04:53.000000000 -0400 ++++ gnupg-1.4.11/g10/compress.c 2014-06-26 08:29:51.366146335 -0400 +@@ -131,7 +131,7 @@ + * PGP uses a windowsize of 13 bits. Using a negative value for + * it forces zlib not to expect a zlib header. This is a + * undocumented feature Peter Gutmann told me about. +- * ++ * + * We must use 15 bits for the inflator because CryptoEx uses 15 + * bits thus the output would get scrambled w/o error indication + * if we would use 13 bits. For the uncompressing this does not +@@ -155,7 +155,8 @@ + IOBUF a, size_t *ret_len ) + { + int zrc; +- int rc=0; ++ int rc = 0; ++ int leave = 0; + size_t n; + int nread, count; + int refill = !zs->avail_in; +@@ -178,13 +179,14 @@ + if( nread == -1 ) + nread = 0; + n += nread; +- /* If we use the undocumented feature to suppress +- * the zlib header, we have to give inflate an +- * extra dummy byte to read */ +- if( nread < count && zfx->algo == 1 ) { +- *(zfx->inbuf + n) = 0xFF; /* is it really needed ? */ +- zfx->algo1hack = 1; ++ /* Algo 1 has no zlib header which requires us to to give ++ * inflate an extra dummy byte to read. To be on the safe ++ * side we allow for up to 4 ff bytes. */ ++ if( nread < count && zfx->algo == 1 && zfx->algo1hack < 4) { ++ *(zfx->inbuf + n) = 0xFF; ++ zfx->algo1hack++; + n++; ++ leave = 1; + } + zs->avail_in = n; + } +@@ -208,7 +210,8 @@ + else + log_fatal("zlib inflate problem: rc=%d\n", zrc ); + } +- } while( zs->avail_out && zrc != Z_STREAM_END && zrc != Z_BUF_ERROR ); ++ } while (zs->avail_out && zrc != Z_STREAM_END && zrc != Z_BUF_ERROR ++ && !leave); + *ret_len = zfx->outbufsize - zs->avail_out; + if( DBG_FILTER ) + log_debug("do_uncompress: returning %u bytes\n", (unsigned)*ret_len ); only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/0004-gpg-Fix-regression-due-to-the-keyserver-import-filte.dpatch +++ gnupg-1.4.11/debian/patches/0004-gpg-Fix-regression-due-to-the-keyserver-import-filte.dpatch @@ -0,0 +1,215 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# From d58552760b26d840824658814d59c8b1a25a4219 Mon Sep 17 00:00:00 2001 +# From: Werner Koch +# Date: Wed, 6 Aug 2014 17:11:21 +0200 +# Subject: [PATCH 2/2] gpg: Fix regression due to the keyserver import filter. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/import.c gnupg-1.4.11/g10/import.c +--- gnupg-1.4.11~/g10/import.c 2015-03-25 13:56:41.000000000 -0400 ++++ gnupg-1.4.11/g10/import.c 2015-03-25 13:56:46.693598034 -0400 +@@ -60,16 +60,16 @@ + + static int import( IOBUF inp, const char* fname,struct stats_s *stats, + unsigned char **fpr,size_t *fpr_len,unsigned int options, +- import_filter filter, void *filter_arg ); ++ import_filter_t filter, void *filter_arg ); + static int read_block( IOBUF a, PACKET **pending_pkt, KBNODE *ret_root ); + static void revocation_present(KBNODE keyblock); + static int import_one(const char *fname, KBNODE keyblock,struct stats_s *stats, + unsigned char **fpr,size_t *fpr_len, + unsigned int options,int from_sk, +- import_filter filter, void *filter_arg); ++ import_filter_t filter, void *filter_arg); + static int import_secret_one( const char *fname, KBNODE keyblock, + struct stats_s *stats, unsigned int options, +- import_filter filter, void *filter_arg); ++ import_filter_t filter, void *filter_arg); + static int import_revoke_cert( const char *fname, KBNODE node, + struct stats_s *stats); + static int chk_self_sigs( const char *fname, KBNODE keyblock, +@@ -167,7 +167,7 @@ + import_keys_internal( IOBUF inp, char **fnames, int nnames, + void *stats_handle, unsigned char **fpr, size_t *fpr_len, + unsigned int options, +- import_filter filter, void *filter_arg) ++ import_filter_t filter, void *filter_arg) + { + int i, rc = 0; + struct stats_s *stats = stats_handle; +@@ -239,7 +239,7 @@ + int + import_keys_stream( IOBUF inp, void *stats_handle, + unsigned char **fpr, size_t *fpr_len,unsigned int options, +- import_filter filter, void *filter_arg ) ++ import_filter_t filter, void *filter_arg ) + { + return import_keys_internal (inp, NULL, 0, stats_handle, fpr, fpr_len, + options, filter, filter_arg); +@@ -248,7 +248,7 @@ + static int + import( IOBUF inp, const char* fname,struct stats_s *stats, + unsigned char **fpr,size_t *fpr_len,unsigned int options, +- import_filter filter, void *filter_arg) ++ import_filter_t filter, void *filter_arg) + { + PACKET *pending_pkt = NULL; + KBNODE keyblock = NULL; +@@ -753,7 +753,7 @@ + static int + import_one( const char *fname, KBNODE keyblock, struct stats_s *stats, + unsigned char **fpr,size_t *fpr_len,unsigned int options, +- int from_sk, import_filter filter, void *filter_arg) ++ int from_sk, import_filter_t filter, void *filter_arg) + { + PKT_public_key *pk; + PKT_public_key *pk_orig; +@@ -793,7 +793,7 @@ + return 0; + } + +- if (filter && filter (pk, NULL, filter_arg)) ++ if (filter && filter (keyblock, filter_arg)) + { + log_error (_("key %s: %s\n"), keystr_from_pk(pk), + _("rejected by import filter")); +@@ -1169,7 +1169,7 @@ + static int + import_secret_one( const char *fname, KBNODE keyblock, + struct stats_s *stats, unsigned int options, +- import_filter filter, void *filter_arg) ++ import_filter_t filter, void *filter_arg) + { + PKT_secret_key *sk; + KBNODE node, uidnode; +@@ -1185,7 +1185,7 @@ + keyid_from_sk( sk, keyid ); + uidnode = find_next_kbnode( keyblock, PKT_USER_ID ); + +- if (filter && filter (NULL, sk, filter_arg)) { ++ if (filter && filter (keyblock, filter_arg)) { + log_error (_("secret key %s: %s\n"), keystr_from_sk(sk), + _("rejected by import filter")); + return 0; +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/keyserver.c gnupg-1.4.11/g10/keyserver.c +--- gnupg-1.4.11~/g10/keyserver.c 2015-03-25 13:56:41.000000000 -0400 ++++ gnupg-1.4.11/g10/keyserver.c 2015-03-25 13:56:46.697598067 -0400 +@@ -966,52 +966,68 @@ + returns 0 if the key shall be imported. Note that this kind of + filter is not related to the iobuf filters. */ + static int +-keyserver_retrieval_filter (PKT_public_key *pk, PKT_secret_key *sk, +- void *opaque) ++keyserver_retrieval_filter (kbnode_t keyblock, void *opaque) + { + struct ks_retrieval_filter_arg_s *arg = opaque; + KEYDB_SEARCH_DESC *desc = arg->desc; + int ndesc = arg->ndesc; ++ kbnode_t node; ++ PKT_public_key *pk; + int n; + u32 keyid[2]; + byte fpr[MAX_FINGERPRINT_LEN]; + size_t fpr_len = 0; + +- /* Secret keys are not expected from a keyserver. Do not import. */ +- if (sk) +- return G10ERR_GENERAL; ++ /* Secret keys are not expected from a keyserver. We do not ++ care about secret subkeys because the import code takes care ++ of skipping them. Not allowing an import of a public key ++ with a secret subkey would make it too easy to inhibit the ++ downloading of a public key. Recall that keyservers do only ++ limited checks. */ ++ node = find_kbnode (keyblock, PKT_SECRET_KEY); ++ if (node) ++ return G10ERR_GENERAL; /* Do not import. */ + + if (!ndesc) + return 0; /* Okay if no description given. */ + +- fingerprint_from_pk (pk, fpr, &fpr_len); +- keyid_from_pk (pk, keyid); +- +- /* Compare requested and returned fingerprints if available. */ +- for (n = 0; n < ndesc; n++) ++ /* Loop over all key packets. */ ++ for (node = keyblock; node; node = node->next) + { +- if (desc[n].mode == KEYDB_SEARCH_MODE_FPR20) +- { +- if (fpr_len == 20 && !memcmp (fpr, desc[n].u.fpr, 20)) +- return 0; +- } +- else if (desc[n].mode == KEYDB_SEARCH_MODE_FPR16) +- { +- if (fpr_len == 16 && !memcmp (fpr, desc[n].u.fpr, 16)) +- return 0; +- } +- else if (desc[n].mode == KEYDB_SEARCH_MODE_LONG_KID) +- { +- if (keyid[0] == desc[n].u.kid[0] && keyid[1] == desc[n].u.kid[1]) +- return 0; +- } +- else if (desc[n].mode == KEYDB_SEARCH_MODE_SHORT_KID) ++ if (node->pkt->pkttype != PKT_PUBLIC_KEY ++ && node->pkt->pkttype != PKT_PUBLIC_SUBKEY) ++ continue; ++ ++ pk = node->pkt->pkt.public_key; ++ fingerprint_from_pk (pk, fpr, &fpr_len); ++ keyid_from_pk (pk, keyid); ++ ++ /* Compare requested and returned fingerprints if available. */ ++ for (n = 0; n < ndesc; n++) + { +- if (keyid[1] == desc[n].u.kid[1]) +- return 0; ++ if (desc[n].mode == KEYDB_SEARCH_MODE_FPR20) ++ { ++ if (fpr_len == 20 && !memcmp (fpr, desc[n].u.fpr, 20)) ++ return 0; ++ } ++ else if (desc[n].mode == KEYDB_SEARCH_MODE_FPR16) ++ { ++ if (fpr_len == 16 && !memcmp (fpr, desc[n].u.fpr, 16)) ++ return 0; ++ } ++ else if (desc[n].mode == KEYDB_SEARCH_MODE_LONG_KID) ++ { ++ if (keyid[0] == desc[n].u.kid[0] && keyid[1] == desc[n].u.kid[1]) ++ return 0; ++ } ++ else if (desc[n].mode == KEYDB_SEARCH_MODE_SHORT_KID) ++ { ++ if (keyid[1] == desc[n].u.kid[1]) ++ return 0; ++ } ++ else /* No keyid or fingerprint - can't check. */ ++ return 0; /* allow import. */ + } +- else +- return 0; + } + + return G10ERR_GENERAL; +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/main.h gnupg-1.4.11/g10/main.h +--- gnupg-1.4.11~/g10/main.h 2015-03-25 13:56:41.000000000 -0400 ++++ gnupg-1.4.11/g10/main.h 2015-03-25 13:56:46.697598067 -0400 +@@ -214,14 +214,14 @@ + + /*-- import.c --*/ + +-typedef int (*import_filter)(PKT_public_key *pk, PKT_secret_key *sk, void *arg); ++typedef int (*import_filter_t)(kbnode_t keyblock, void *arg); + + int parse_import_options(char *str,unsigned int *options,int noisy); + void import_keys( char **fnames, int nnames, + void *stats_hd, unsigned int options ); + int import_keys_stream (IOBUF inp,void *stats_hd,unsigned char **fpr, + size_t *fpr_len,unsigned int options, +- import_filter filter, void *filter_arg); ++ import_filter_t filter, void *filter_arg); + void *import_new_stats_handle (void); + void import_release_stats_handle (void *p); + void import_print_stats (void *hd); only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/0003-Add-kbnode_t-for-easier-backporting.dpatch +++ gnupg-1.4.11/debian/patches/0003-Add-kbnode_t-for-easier-backporting.dpatch @@ -0,0 +1,18 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# From dcf58b3471b1c9ba87a826aa132033e506664808 Mon Sep 17 00:00:00 2001 +# From: Werner Koch +# Date: Wed, 6 Aug 2014 17:09:15 +0200 +# Subject: [PATCH 1/2] Add kbnode_t for easier backporting. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/global.h gnupg-1.4.11/g10/global.h +--- gnupg-1.4.11~/g10/global.h 2008-12-11 11:40:05.000000000 -0500 ++++ gnupg-1.4.11/g10/global.h 2015-03-25 13:56:28.385444218 -0400 +@@ -23,6 +23,7 @@ + #define MAX_FINGERPRINT_LEN 20 + + typedef struct kbnode_struct *KBNODE; ++typedef struct kbnode_struct *kbnode_t; + typedef struct keydb_search_desc KEYDB_SEARCH_DESC; + + #endif /*GPG_GLOBAL_H*/ only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/long-keyids.dpatch +++ gnupg-1.4.11/debian/patches/long-keyids.dpatch @@ -0,0 +1,48 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# Description: Use the longest key ID available when requesting a key from +# a key server +# Origin: upstream, http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commit;h=6fe25e5602fabe92c68e5ba30e4777221e8612df +# Bug: https://bugs.g10code.com/gnupg/issue1340 + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/keyserver/gpgkeys_hkp.c gnupg-1.4.11/keyserver/gpgkeys_hkp.c +--- gnupg-1.4.11~/keyserver/gpgkeys_hkp.c 2009-08-25 14:41:27.000000000 -0400 ++++ gnupg-1.4.11/keyserver/gpgkeys_hkp.c 2012-08-14 08:34:08.701024646 -0400 +@@ -234,9 +234,10 @@ + get_key(char *getkey) + { + CURLcode res; +- char request[MAX_URL+60]; ++ char request[MAX_URL+92]; + char *offset; + struct curl_writer_ctx ctx; ++ size_t keylen; + + memset(&ctx,0,sizeof(ctx)); + +@@ -262,14 +263,19 @@ + strcat(request,port); + strcat(request,opt->path); + /* request is MAX_URL+55 bytes long - MAX_URL covers the whole URL, +- including any supplied path. The 60 overcovers this /pks/... etc +- string plus the 8 bytes of key id */ ++ including any supplied path. The 92 overcovers this /pks/... etc ++ string plus the 8, 16, or 40 bytes of key id/fingerprint */ + append_path(request,"/pks/lookup?op=get&options=mr&search=0x"); + +- /* fingerprint or long key id. Take the last 8 characters and treat +- it like a short key id */ +- if(strlen(getkey)>8) +- offset=&getkey[strlen(getkey)-8]; ++ /* send only fingerprint, long key id, or short keyid. see: ++ https://tools.ietf.org/html/draft-shaw-openpgp-hkp-00#section-3.1.1.1 */ ++ keylen = strlen(getkey); ++ if(keylen >= 40) ++ offset=&getkey[keylen-40]; ++ else if(keylen >= 16) ++ offset=&getkey[keylen-16]; ++ else if(keylen >= 8) ++ offset=&getkey[keylen-8]; + else + offset=getkey; + only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2014-5270.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2014-5270.dpatch @@ -0,0 +1,464 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# Description: fix side-channel attack on Elgamal encryption subkeys +# Origin: backport, http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commit;h=cad8216f9a0b33c9dc84ecc4f385b00045e7b496 + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/mpi/mpi-pow.c gnupg-1.4.11/mpi/mpi-pow.c +--- gnupg-1.4.11~/mpi/mpi-pow.c 2014-08-19 09:41:29.000000000 -0400 ++++ gnupg-1.4.11/mpi/mpi-pow.c 2014-08-19 09:41:38.663415854 -0400 +@@ -34,7 +34,14 @@ + #include "longlong.h" + #include + ++/* ++ * When you need old implementation, please add compilation option ++ * -DUSE_ALGORITHM_SIMPLE_EXPONENTIATION ++ * or expose this line: ++#define USE_ALGORITHM_SIMPLE_EXPONENTIATION 1 ++ */ + ++#if defined(USE_ALGORITHM_SIMPLE_EXPONENTIATION) + /**************** + * RES = BASE ^ EXP mod MOD + */ +@@ -300,4 +307,440 @@ + if( xp_marker ) mpi_free_limb_space( xp_marker ); + if( tspace ) mpi_free_limb_space( tspace ); + } ++#else /*!USE_ALGORITHM_SIMPLE_EXPONENTIATION */ ++ ++/** ++ * Internal function to compute ++ * ++ * X = R * S mod M ++ * ++ * and set the size of X at the pointer XSIZE_P. ++ * Use karatsuba structure at KARACTX_P. ++ * ++ * Condition: ++ * RSIZE >= SSIZE ++ * Enough space for X is allocated beforehand. ++ * ++ * For generic cases, we can/should use mpi_mulm. ++ * This function is use for specific internal case. ++ */ ++static void ++mul_mod (mpi_ptr_t xp, mpi_size_t *xsize_p, ++ mpi_ptr_t rp, mpi_size_t rsize, ++ mpi_ptr_t sp, mpi_size_t ssize, ++ mpi_ptr_t mp, mpi_size_t msize, ++ struct karatsuba_ctx *karactx_p) ++{ ++ if( ssize < KARATSUBA_THRESHOLD ) ++ mpihelp_mul ( xp, rp, rsize, sp, ssize ); ++ else ++ mpihelp_mul_karatsuba_case (xp, rp, rsize, sp, ssize, karactx_p); ++ ++ if (rsize + ssize > msize) ++ { ++ mpihelp_divrem (xp + msize, 0, xp, rsize + ssize, mp, msize); ++ *xsize_p = msize; ++ } ++ else ++ *xsize_p = rsize + ssize; ++} ++ ++#define SIZE_B_2I3 ((1 << (5 - 1)) - 1) ++ ++/**************** ++ * RES = BASE ^ EXPO mod MOD ++ * ++ * To mitigate the Yarom/Falkner flush+reload cache side-channel ++ * attack on the RSA secret exponent, we don't use the square ++ * routine but multiplication. ++ * ++ * Reference: ++ * Handbook of Applied Cryptography ++ * Algorithm 14.83: Modified left-to-right k-ary exponentiation ++ */ ++void ++mpi_powm (MPI res, MPI base, MPI expo, MPI mod) ++{ ++ /* Pointer to the limbs of the arguments, their size and signs. */ ++ mpi_ptr_t rp, ep, mp, bp; ++ mpi_size_t esize, msize, bsize, rsize; ++ int msign, bsign, rsign; ++ /* Flags telling the secure allocation status of the arguments. */ ++ int esec, msec, bsec; ++ /* Size of the result including space for temporary values. */ ++ mpi_size_t size; ++ /* Helper. */ ++ int mod_shift_cnt; ++ int negative_result; ++ mpi_ptr_t mp_marker = NULL; ++ mpi_ptr_t bp_marker = NULL; ++ mpi_ptr_t ep_marker = NULL; ++ mpi_ptr_t xp_marker = NULL; ++ mpi_ptr_t b_2i3[SIZE_B_2I3]; /* Pre-computed array: BASE^3, ^5, ^7, ... */ ++ mpi_size_t b_2i3size[SIZE_B_2I3]; ++ mpi_size_t W; ++ mpi_ptr_t base_u; ++ mpi_size_t base_u_size; ++ ++ esize = expo->nlimbs; ++ msize = mod->nlimbs; ++ size = 2 * msize; ++ msign = mod->sign; ++ ++ if (esize * BITS_PER_MPI_LIMB > 512) ++ W = 5; ++ else if (esize * BITS_PER_MPI_LIMB > 256) ++ W = 4; ++ else if (esize * BITS_PER_MPI_LIMB > 128) ++ W = 3; ++ else if (esize * BITS_PER_MPI_LIMB > 64) ++ W = 2; ++ else ++ W = 1; ++ ++ esec = mpi_is_secure(expo); ++ msec = mpi_is_secure(mod); ++ bsec = mpi_is_secure(base); ++ ++ rp = res->d; ++ ep = expo->d; ++ ++ if (!msize) ++ msize = 1 / msize; /* provoke a signal */ ++ ++ if (!esize) ++ { ++ /* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0 depending ++ on if MOD equals 1. */ ++ res->nlimbs = (msize == 1 && mod->d[0] == 1) ? 0 : 1; ++ if (res->nlimbs) ++ { ++ RESIZE_IF_NEEDED (res, 1); ++ rp = res->d; ++ rp[0] = 1; ++ } ++ res->sign = 0; ++ goto leave; ++ } ++ ++ /* Normalize MOD (i.e. make its most significant bit set) as ++ required by mpn_divrem. This will make the intermediate values ++ in the calculation slightly larger, but the correct result is ++ obtained after a final reduction using the original MOD value. */ ++ mp = mp_marker = mpi_alloc_limb_space(msize, msec); ++ count_leading_zeros (mod_shift_cnt, mod->d[msize-1]); ++ if (mod_shift_cnt) ++ mpihelp_lshift (mp, mod->d, msize, mod_shift_cnt); ++ else ++ MPN_COPY( mp, mod->d, msize ); ++ ++ bsize = base->nlimbs; ++ bsign = base->sign; ++ if (bsize > msize) ++ { ++ /* The base is larger than the module. Reduce it. ++ ++ Allocate (BSIZE + 1) with space for remainder and quotient. ++ (The quotient is (bsize - msize + 1) limbs.) */ ++ bp = bp_marker = mpi_alloc_limb_space( bsize + 1, bsec ); ++ MPN_COPY ( bp, base->d, bsize ); ++ /* We don't care about the quotient, store it above the ++ * remainder, at BP + MSIZE. */ ++ mpihelp_divrem( bp + msize, 0, bp, bsize, mp, msize ); ++ bsize = msize; ++ /* Canonicalize the base, since we are going to multiply with it ++ quite a few times. */ ++ MPN_NORMALIZE( bp, bsize ); ++ } ++ else ++ bp = base->d; ++ ++ if (!bsize) ++ { ++ res->nlimbs = 0; ++ res->sign = 0; ++ goto leave; ++ } ++ ++ ++ /* Make BASE, EXPO and MOD not overlap with RES. */ ++ if ( rp == bp ) ++ { ++ /* RES and BASE are identical. Allocate temp. space for BASE. */ ++ assert (!bp_marker); ++ bp = bp_marker = mpi_alloc_limb_space( bsize, bsec ); ++ MPN_COPY(bp, rp, bsize); ++ } ++ if ( rp == ep ) ++ { ++ /* RES and EXPO are identical. Allocate temp. space for EXPO. */ ++ ep = ep_marker = mpi_alloc_limb_space( esize, esec ); ++ MPN_COPY(ep, rp, esize); ++ } ++ if ( rp == mp ) ++ { ++ /* RES and MOD are identical. Allocate temporary space for MOD.*/ ++ assert (!mp_marker); ++ mp = mp_marker = mpi_alloc_limb_space( msize, msec ); ++ MPN_COPY(mp, rp, msize); ++ } ++ ++ /* Copy base to the result. */ ++ if (res->alloced < size) ++ { ++ mpi_resize (res, size); ++ rp = res->d; ++ } ++ ++ /* Main processing. */ ++ { ++ mpi_size_t i, j; ++ mpi_ptr_t xp; ++ mpi_size_t xsize; ++ int c; ++ mpi_limb_t e; ++ mpi_limb_t carry_limb; ++ struct karatsuba_ctx karactx; ++ mpi_ptr_t tp; ++ ++ xp = xp_marker = mpi_alloc_limb_space( 2 * (msize + 1), msec ); ++ ++ memset( &karactx, 0, sizeof karactx ); ++ negative_result = (ep[0] & 1) && bsign; ++ ++ /* Precompute B_2I3[], BASE^(2 * i + 3), BASE^3, ^5, ^7, ... */ ++ if (W > 1) /* X := BASE^2 */ ++ mul_mod (xp, &xsize, bp, bsize, bp, bsize, mp, msize, &karactx); ++ for (i = 0; i < (1 << (W - 1)) - 1; i++) ++ { /* B_2I3[i] = BASE^(2 * i + 3) */ ++ if (i == 0) ++ { ++ base_u = bp; ++ base_u_size = bsize; ++ } ++ else ++ { ++ base_u = b_2i3[i-1]; ++ base_u_size = b_2i3size[i-1]; ++ } ++ ++ if (xsize >= base_u_size) ++ mul_mod (rp, &rsize, xp, xsize, base_u, base_u_size, ++ mp, msize, &karactx); ++ else ++ mul_mod (rp, &rsize, base_u, base_u_size, xp, xsize, ++ mp, msize, &karactx); ++ b_2i3[i] = mpi_alloc_limb_space (rsize, esec); ++ b_2i3size[i] = rsize; ++ MPN_COPY (b_2i3[i], rp, rsize); ++ } ++ ++ i = esize - 1; ++ ++ /* Main loop. ++ ++ Make the result be pointed to alternately by XP and RP. This ++ helps us avoid block copying, which would otherwise be ++ necessary with the overlap restrictions of mpihelp_divmod. With ++ 50% probability the result after this loop will be in the area ++ originally pointed by RP (==RES->d), and with 50% probability ++ in the area originally pointed to by XP. */ ++ rsign = 0; ++ if (W == 1) ++ { ++ rsize = bsize; ++ } ++ else ++ { ++ rsize = msize; ++ MPN_ZERO (rp, rsize); ++ } ++ MPN_COPY ( rp, bp, bsize ); ++ ++ e = ep[i]; ++ count_leading_zeros (c, e); ++ e = (e << c) << 1; ++ c = BITS_PER_MPI_LIMB - 1 - c; ++ ++ j = 0; ++ ++ for (;;) ++ if (e == 0) ++ { ++ j += c; ++ i--; ++ if ( i < 0 ) ++ { ++ c = 0; ++ break; ++ } ++ ++ e = ep[i]; ++ c = BITS_PER_MPI_LIMB; ++ } ++ else ++ { ++ int c0; ++ mpi_limb_t e0; ++ ++ count_leading_zeros (c0, e); ++ e = (e << c0); ++ c -= c0; ++ j += c0; ++ ++ if (c >= W) ++ { ++ e0 = (e >> (BITS_PER_MPI_LIMB - W)); ++ e = (e << W); ++ c -= W; ++ } ++ else ++ { ++ i--; ++ if ( i < 0 ) ++ { ++ e = (e >> (BITS_PER_MPI_LIMB - c)); ++ break; ++ } ++ ++ c0 = c; ++ e0 = (e >> (BITS_PER_MPI_LIMB - W)) ++ | (ep[i] >> (BITS_PER_MPI_LIMB - W + c0)); ++ e = (ep[i] << (W - c0)); ++ c = BITS_PER_MPI_LIMB - W + c0; ++ } ++ ++ count_trailing_zeros (c0, e0); ++ e0 = (e0 >> c0) >> 1; ++ ++ for (j += W - c0; j; j--) ++ { ++ mul_mod (xp, &xsize, rp, rsize, rp, rsize, mp, msize, &karactx); ++ tp = rp; rp = xp; xp = tp; ++ rsize = xsize; ++ } ++ ++ if (e0 == 0) ++ { ++ base_u = bp; ++ base_u_size = bsize; ++ } ++ else ++ { ++ base_u = b_2i3[e0 - 1]; ++ base_u_size = b_2i3size[e0 -1]; ++ } ++ ++ mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size, ++ mp, msize, &karactx); ++ tp = rp; rp = xp; xp = tp; ++ rsize = xsize; ++ ++ j = c0; ++ } ++ ++ if (c != 0) ++ { ++ j += c; ++ count_trailing_zeros (c, e); ++ e = (e >> c); ++ j -= c; ++ } ++ ++ while (j--) ++ { ++ mul_mod (xp, &xsize, rp, rsize, rp, rsize, mp, msize, &karactx); ++ tp = rp; rp = xp; xp = tp; ++ rsize = xsize; ++ } ++ ++ if (e != 0) ++ { ++ if ((e>>1) == 0) ++ { ++ base_u = bp; ++ base_u_size = bsize; ++ } ++ else ++ { ++ base_u = b_2i3[(e>>1) - 1]; ++ base_u_size = b_2i3size[(e>>1) -1]; ++ } ++ ++ mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size, ++ mp, msize, &karactx); ++ tp = rp; rp = xp; xp = tp; ++ rsize = xsize; ++ ++ for (; c; c--) ++ { ++ mul_mod (xp, &xsize, rp, rsize, rp, rsize, mp, msize, &karactx); ++ tp = rp; rp = xp; xp = tp; ++ rsize = xsize; ++ } ++ } ++ ++ /* We shifted MOD, the modulo reduction argument, left ++ MOD_SHIFT_CNT steps. Adjust the result by reducing it with the ++ original MOD. ++ ++ Also make sure the result is put in RES->d (where it already ++ might be, see above). */ ++ if ( mod_shift_cnt ) ++ { ++ carry_limb = mpihelp_lshift( res->d, rp, rsize, mod_shift_cnt); ++ rp = res->d; ++ if ( carry_limb ) ++ { ++ rp[rsize] = carry_limb; ++ rsize++; ++ } ++ } ++ else if (res->d != rp) ++ { ++ MPN_COPY (res->d, rp, rsize); ++ rp = res->d; ++ } ++ ++ if ( rsize >= msize ) ++ { ++ mpihelp_divrem(rp + msize, 0, rp, rsize, mp, msize); ++ rsize = msize; ++ } ++ ++ /* Remove any leading zero words from the result. */ ++ if ( mod_shift_cnt ) ++ mpihelp_rshift (rp, rp, rsize, mod_shift_cnt); ++ MPN_NORMALIZE (rp, rsize); ++ ++ mpihelp_release_karatsuba_ctx (&karactx ); ++ for (i = 0; i < (1 << (W - 1)) - 1; i++) ++ mpi_free_limb_space (b_2i3[i]); ++ } ++ ++ /* Fixup for negative results. */ ++ if ( negative_result && rsize ) ++ { ++ if ( mod_shift_cnt ) ++ mpihelp_rshift (mp, mp, msize, mod_shift_cnt); ++ mpihelp_sub (rp, mp, msize, rp, rsize); ++ rsize = msize; ++ rsign = msign; ++ MPN_NORMALIZE(rp, rsize); ++ } ++ assert (res->d == rp); ++ res->nlimbs = rsize; ++ res->sign = rsign; ++ ++ leave: ++ if (mp_marker) ++ mpi_free_limb_space (mp_marker); ++ if (bp_marker) ++ mpi_free_limb_space (bp_marker); ++ if (ep_marker) ++ mpi_free_limb_space (ep_marker); ++ if (xp_marker) ++ mpi_free_limb_space (xp_marker); ++} ++#endif /*!USE_ALGORITHM_SIMPLE_EXPONENTIATION */ + only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2014-3591.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2014-3591.dpatch @@ -0,0 +1,92 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# From ff53cf06e966dce0daba5f2c84e03ab9db2c3c8b Mon Sep 17 00:00:00 2001 +# From: Werner Koch +# Date: Mon, 11 Aug 2014 16:15:40 +0200 +# Subject: [PATCH] Use ciphertext blinding for Elgamal decryption. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/cipher/elgamal.c gnupg-1.4.11/cipher/elgamal.c +--- gnupg-1.4.11~/cipher/elgamal.c 2015-03-25 13:59:01.000000000 -0400 ++++ gnupg-1.4.11/cipher/elgamal.c 2015-03-25 13:59:09.318796491 -0400 +@@ -31,6 +31,11 @@ + #include "cipher.h" + #include "elgamal.h" + ++/* Blinding is used to mitigate side-channel attacks. You may undef ++ this to speed up the operation in case the system is secured ++ against physical and network mounted side-channel attacks. */ ++#define USE_BLINDING 1 ++ + typedef struct { + MPI p; /* prime */ + MPI g; /* group generator */ +@@ -372,25 +377,55 @@ + static void + decrypt(MPI output, MPI a, MPI b, ELG_secret_key *skey ) + { +- MPI t1 = mpi_alloc_secure( mpi_get_nlimbs( skey->p ) ); ++ MPI t1, t2, r; ++ unsigned int nbits = mpi_get_nbits (skey->p); + +- mpi_normalize (a); +- mpi_normalize (b); ++ mpi_normalize (a); ++ mpi_normalize (b); ++ ++ t1 = mpi_alloc_secure (mpi_nlimb_hint_from_nbits (nbits)); ++#ifdef USE_BLINDING ++ ++ t2 = mpi_alloc_secure (mpi_nlimb_hint_from_nbits (nbits)); ++ r = mpi_alloc (mpi_nlimb_hint_from_nbits (nbits)); ++ ++ /* We need a random number of about the prime size. The random ++ number merely needs to be unpredictable; thus we use level 0. */ ++ randomize_mpi (r, nbits, 0); ++ ++ /* t1 = r^x mod p */ ++ mpi_powm (t1, r, skey->x, skey->p); ++ /* t2 = (a * r)^-x mod p */ ++ mpi_mulm (t2, a, r, skey->p); ++ mpi_powm (t2, t2, skey->x, skey->p); ++ mpi_invm (t2, t2, skey->p); ++ /* t1 = (t1 * t2) mod p*/ ++ mpi_mulm (t1, t1, t2, skey->p); ++ ++ mpi_free (r); ++ mpi_free (t2); ++ ++#else /*!USE_BLINDING*/ ++ ++ /* output = b/(a^x) mod p */ ++ mpi_powm (t1, a, skey->x, skey->p); ++ mpi_invm (t1, t1, skey->p); ++ ++#endif /*!USE_BLINDING*/ ++ ++ mpi_mulm (output, b, t1, skey->p); + +- /* output = b/(a^x) mod p */ +- mpi_powm( t1, a, skey->x, skey->p ); +- mpi_invm( t1, t1, skey->p ); +- mpi_mulm( output, b, t1, skey->p ); + #if 0 +- if( DBG_CIPHER ) { +- log_mpidump("elg decrypted x= ", skey->x); +- log_mpidump("elg decrypted p= ", skey->p); +- log_mpidump("elg decrypted a= ", a); +- log_mpidump("elg decrypted b= ", b); +- log_mpidump("elg decrypted M= ", output); ++ if (DBG_CIPHER) ++ { ++ log_mpidump("elg decrypted x= ", skey->x); ++ log_mpidump("elg decrypted p= ", skey->p); ++ log_mpidump("elg decrypted a= ", a); ++ log_mpidump("elg decrypted b= ", b); ++ log_mpidump("elg decrypted M= ", output); + } + #endif +- mpi_free(t1); ++ mpi_free (t1); + } + + only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/0001-Screen-keyserver-responses.dpatch +++ gnupg-1.4.11/debian/patches/0001-Screen-keyserver-responses.dpatch @@ -0,0 +1,398 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# From 5230304349490f31aa64ee2b69a8a2bc06bf7816 Mon Sep 17 00:00:00 2001 +# From: Stefan Tomanek +# Date: Thu, 30 Jan 2014 00:57:43 +0100 +# Subject: [PATCH] Screen keyserver responses. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/import.c gnupg-1.4.11/g10/import.c +--- gnupg-1.4.11~/g10/import.c 2015-03-25 13:51:43.000000000 -0400 ++++ gnupg-1.4.11/g10/import.c 2015-03-25 13:53:51.628127467 -0400 +@@ -59,14 +59,17 @@ + + + static int import( IOBUF inp, const char* fname,struct stats_s *stats, +- unsigned char **fpr,size_t *fpr_len,unsigned int options ); ++ unsigned char **fpr,size_t *fpr_len,unsigned int options, ++ import_filter filter, void *filter_arg ); + static int read_block( IOBUF a, PACKET **pending_pkt, KBNODE *ret_root ); + static void revocation_present(KBNODE keyblock); + static int import_one(const char *fname, KBNODE keyblock,struct stats_s *stats, + unsigned char **fpr,size_t *fpr_len, +- unsigned int options,int from_sk); ++ unsigned int options,int from_sk, ++ import_filter filter, void *filter_arg); + static int import_secret_one( const char *fname, KBNODE keyblock, +- struct stats_s *stats, unsigned int options); ++ struct stats_s *stats, unsigned int options, ++ import_filter filter, void *filter_arg); + static int import_revoke_cert( const char *fname, KBNODE node, + struct stats_s *stats); + static int chk_self_sigs( const char *fname, KBNODE keyblock, +@@ -163,7 +166,8 @@ + static int + import_keys_internal( IOBUF inp, char **fnames, int nnames, + void *stats_handle, unsigned char **fpr, size_t *fpr_len, +- unsigned int options ) ++ unsigned int options, ++ import_filter filter, void *filter_arg) + { + int i, rc = 0; + struct stats_s *stats = stats_handle; +@@ -172,7 +176,8 @@ + stats = import_new_stats_handle (); + + if (inp) { +- rc = import( inp, "[stream]", stats, fpr, fpr_len, options); ++ rc = import (inp, "[stream]", stats, fpr, fpr_len, options, ++ filter, filter_arg); + } + else { + if( !fnames && !nnames ) +@@ -193,7 +198,8 @@ + log_error(_("can't open `%s': %s\n"), fname, strerror(errno) ); + else + { +- rc = import( inp2, fname, stats, fpr, fpr_len, options ); ++ rc = import (inp2, fname, stats, fpr, fpr_len, options, ++ NULL, NULL); + iobuf_close(inp2); + /* Must invalidate that ugly cache to actually close it. */ + iobuf_ioctl (NULL, 2, 0, (char*)fname); +@@ -226,19 +232,23 @@ + import_keys( char **fnames, int nnames, + void *stats_handle, unsigned int options ) + { +- import_keys_internal(NULL,fnames,nnames,stats_handle,NULL,NULL,options); ++ import_keys_internal (NULL, fnames, nnames, stats_handle, NULL, NULL, ++ options, NULL, NULL); + } + + int + import_keys_stream( IOBUF inp, void *stats_handle, +- unsigned char **fpr, size_t *fpr_len,unsigned int options ) ++ unsigned char **fpr, size_t *fpr_len,unsigned int options, ++ import_filter filter, void *filter_arg ) + { +- return import_keys_internal(inp,NULL,0,stats_handle,fpr,fpr_len,options); ++ return import_keys_internal (inp, NULL, 0, stats_handle, fpr, fpr_len, ++ options, filter, filter_arg); + } + + static int + import( IOBUF inp, const char* fname,struct stats_s *stats, +- unsigned char **fpr,size_t *fpr_len,unsigned int options ) ++ unsigned char **fpr,size_t *fpr_len,unsigned int options, ++ import_filter filter, void *filter_arg) + { + PACKET *pending_pkt = NULL; + KBNODE keyblock = NULL; +@@ -255,9 +265,11 @@ + + while( !(rc = read_block( inp, &pending_pkt, &keyblock) )) { + if( keyblock->pkt->pkttype == PKT_PUBLIC_KEY ) +- rc = import_one( fname, keyblock, stats, fpr, fpr_len, options, 0); +- else if( keyblock->pkt->pkttype == PKT_SECRET_KEY ) +- rc = import_secret_one( fname, keyblock, stats, options ); ++ rc = import_one (fname, keyblock, stats, fpr, fpr_len, options, 0, ++ filter, filter_arg); ++ else if( keyblock->pkt->pkttype == PKT_SECRET_KEY ) ++ rc = import_secret_one (fname, keyblock, stats, options, ++ filter, filter_arg); + else if( keyblock->pkt->pkttype == PKT_SIGNATURE + && keyblock->pkt->pkt.signature->sig_class == 0x20 ) + rc = import_revoke_cert( fname, keyblock, stats ); +@@ -741,7 +753,7 @@ + static int + import_one( const char *fname, KBNODE keyblock, struct stats_s *stats, + unsigned char **fpr,size_t *fpr_len,unsigned int options, +- int from_sk ) ++ int from_sk, import_filter filter, void *filter_arg) + { + PKT_public_key *pk; + PKT_public_key *pk_orig; +@@ -780,6 +792,13 @@ + log_error( _("key %s: no user ID\n"), keystr_from_pk(pk)); + return 0; + } ++ ++ if (filter && filter (pk, NULL, filter_arg)) ++ { ++ log_error (_("key %s: %s\n"), keystr_from_pk(pk), ++ _("rejected by import filter")); ++ return 0; ++ } + + if (opt.interactive) { + if(is_status_enabled()) +@@ -1149,7 +1168,8 @@ + */ + static int + import_secret_one( const char *fname, KBNODE keyblock, +- struct stats_s *stats, unsigned int options) ++ struct stats_s *stats, unsigned int options, ++ import_filter filter, void *filter_arg) + { + PKT_secret_key *sk; + KBNODE node, uidnode; +@@ -1165,6 +1185,12 @@ + keyid_from_sk( sk, keyid ); + uidnode = find_next_kbnode( keyblock, PKT_USER_ID ); + ++ if (filter && filter (NULL, sk, filter_arg)) { ++ log_error (_("secret key %s: %s\n"), keystr_from_sk(sk), ++ _("rejected by import filter")); ++ return 0; ++ } ++ + if( opt.verbose ) + { + log_info( "sec %4u%c/%s %s ", +@@ -1237,8 +1263,9 @@ + KBNODE pub_keyblock=sec_to_pub_keyblock(keyblock); + if(pub_keyblock) + { +- import_one(fname,pub_keyblock,stats, +- NULL,NULL,opt.import_options,1); ++ import_one (fname, pub_keyblock, stats, ++ NULL, NULL, opt.import_options, 1, ++ NULL, NULL); + release_kbnode(pub_keyblock); + } + } +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/keyserver.c gnupg-1.4.11/g10/keyserver.c +--- gnupg-1.4.11~/g10/keyserver.c 2010-09-28 04:55:23.000000000 -0400 ++++ gnupg-1.4.11/g10/keyserver.c 2015-03-25 13:54:37.392511839 -0400 +@@ -650,7 +650,7 @@ + case 'R': + work->flags|=1; + break; +- ++ + case 'd': + case 'D': + work->flags|=2; +@@ -904,7 +904,7 @@ + /* Leave this commented out or now, and perhaps for a very long + time. All HKPish servers return HTML error messages for + no-key-found. */ +- /* ++ /* + if(!started) + log_info(_("keyserver does not support searching\n")); + else +@@ -953,7 +953,52 @@ + #define KEYSERVER_ARGS_KEEP " -o \"%O\" \"%I\"" + #define KEYSERVER_ARGS_NOKEEP " -o \"%o\" \"%i\"" + +-static int ++ ++/* Check whether a key matches the search description. The filter ++ returns 0 if the key shall be imported. Note that this kind of ++ filter is not related to the iobuf filters. */ ++static int ++keyserver_retrieval_filter (PKT_public_key *pk, PKT_secret_key *sk, void *arg) ++{ ++ KEYDB_SEARCH_DESC *desc = arg; ++ u32 keyid[2]; ++ byte fpr[MAX_FINGERPRINT_LEN]; ++ size_t fpr_len = 0; ++ ++ /* Secret keys are not expected from a keyserver. Do not import. */ ++ if (sk) ++ return G10ERR_GENERAL; ++ ++ fingerprint_from_pk (pk, fpr, &fpr_len); ++ keyid_from_pk (pk, keyid); ++ ++ /* Compare requested and returned fingerprints if available. */ ++ if (desc->mode == KEYDB_SEARCH_MODE_FPR20) ++ { ++ if (fpr_len != 20 || memcmp (fpr, desc->u.fpr, 20)) ++ return G10ERR_GENERAL; ++ } ++ else if (desc->mode == KEYDB_SEARCH_MODE_FPR16) ++ { ++ if (fpr_len != 16 || memcmp (fpr, desc->u.fpr, 16)) ++ return G10ERR_GENERAL; ++ } ++ else if (desc->mode == KEYDB_SEARCH_MODE_LONG_KID) ++ { ++ if (keyid[0] != desc->u.kid[0] || keyid[1] != desc->u.kid[1]) ++ return G10ERR_GENERAL; ++ } ++ else if (desc->mode == KEYDB_SEARCH_MODE_SHORT_KID) ++ { ++ if (keyid[1] != desc->u.kid[1]) ++ return G10ERR_GENERAL; ++ } ++ ++ return 0; ++} ++ ++ ++static int + keyserver_spawn(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc, + int count,int *prog,unsigned char **fpr,size_t *fpr_len, + struct keyserver_spec *keyserver) +@@ -993,7 +1038,7 @@ + the program of this process lives. Fortunately Windows provides + a way to retrieve this and our get_libexecdir function has been + modified to return just this. Setting the exec-path is not +- anymore required. ++ anymore required. + set_exec_path(libexecdir); + */ + #else +@@ -1025,7 +1070,7 @@ + fetcher that can speak that protocol (this is a problem for + LDAP). */ + +- strcat(command,GPGKEYS_PREFIX); ++ strcat(command,GPGKEYS_PREFIX); + strcat(command,scheme); + + /* This "_uri" thing is in case we need to call a direct handler +@@ -1055,7 +1100,7 @@ + { + command=xrealloc(command,strlen(command)+ + strlen(KEYSERVER_ARGS_NOKEEP)+1); +- strcat(command,KEYSERVER_ARGS_NOKEEP); ++ strcat(command,KEYSERVER_ARGS_NOKEEP); + } + + ret=exec_write(&spawn,NULL,command,NULL,0,0); +@@ -1500,7 +1545,8 @@ + line-by-line and make a temp iobuf for each key. */ + + import_keys_stream(spawn->fromchild,stats_handle,fpr,fpr_len, +- opt.keyserver_options.import_options); ++ opt.keyserver_options.import_options, ++ keyserver_retrieval_filter, desc); + + import_print_stats(stats_handle); + import_release_stats_handle(stats_handle); +@@ -1531,7 +1577,7 @@ + return ret; + } + +-static int ++static int + keyserver_work(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc, + int count,unsigned char **fpr,size_t *fpr_len, + struct keyserver_spec *keyserver) +@@ -1601,7 +1647,7 @@ + #endif /* ! DISABLE_KEYSERVER_HELPERS*/ + } + +-int ++int + keyserver_export(STRLIST users) + { + STRLIST sl=NULL; +@@ -1633,7 +1679,7 @@ + return rc; + } + +-int ++int + keyserver_import(STRLIST users) + { + KEYDB_SEARCH_DESC *desc; +@@ -1693,7 +1739,7 @@ + return keyserver_work(KS_GET,NULL,&desc,1,NULL,NULL,keyserver); + } + +-int ++int + keyserver_import_keyid(u32 *keyid,struct keyserver_spec *keyserver) + { + KEYDB_SEARCH_DESC desc; +@@ -1708,7 +1754,7 @@ + } + + /* code mostly stolen from do_export_stream */ +-static int ++static int + keyidlist(STRLIST users,KEYDB_SEARCH_DESC **klist,int *count,int fakev3) + { + int rc=0,ndesc,num=100; +@@ -1731,10 +1777,10 @@ + } + else + { +- for (ndesc=0, sl=users; sl; sl = sl->next, ndesc++) ++ for (ndesc=0, sl=users; sl; sl = sl->next, ndesc++) + ; + desc = xmalloc ( ndesc * sizeof *desc); +- ++ + for (ndesc=0, sl=users; sl; sl = sl->next) + { + if(classify_user_id (sl->d, desc+ndesc)) +@@ -1747,7 +1793,7 @@ + + while (!(rc = keydb_search (kdbhd, desc, ndesc))) + { +- if (!users) ++ if (!users) + desc[0].mode = KEYDB_SEARCH_MODE_NEXT; + + /* read the keyblock */ +@@ -1850,7 +1896,7 @@ + + if(rc==-1) + rc=0; +- ++ + leave: + if(rc) + xfree(*klist); +@@ -2032,7 +2078,7 @@ + opt.no_armor=1; + + rc=import_keys_stream(key,NULL,fpr,fpr_len, +- opt.keyserver_options.import_options); ++ opt.keyserver_options.import_options, NULL, NULL); + + opt.no_armor=armor_status; + +@@ -2171,7 +2217,7 @@ + snprintf(port,7,":%u",srvlist[i].port); + strcat(keyserver->host,port); + } +- ++ + strcat(keyserver->host," "); + } + +@@ -2187,7 +2233,7 @@ + strcat(keyserver->host,domain); + + append_to_strlist(&list,name); +- ++ + rc=keyserver_work(KS_GETNAME,list,NULL,0,fpr,fpr_len,keyserver); + + free_strlist(list); +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/main.h gnupg-1.4.11/g10/main.h +--- gnupg-1.4.11~/g10/main.h 2009-08-03 12:19:20.000000000 -0400 ++++ gnupg-1.4.11/g10/main.h 2015-03-25 13:51:57.223166764 -0400 +@@ -213,11 +213,15 @@ + MD_HANDLE md, int hash_algo ); + + /*-- import.c --*/ ++ ++typedef int (*import_filter)(PKT_public_key *pk, PKT_secret_key *sk, void *arg); ++ + int parse_import_options(char *str,unsigned int *options,int noisy); + void import_keys( char **fnames, int nnames, + void *stats_hd, unsigned int options ); +-int import_keys_stream( IOBUF inp,void *stats_hd,unsigned char **fpr, +- size_t *fpr_len,unsigned int options ); ++int import_keys_stream (IOBUF inp,void *stats_hd,unsigned char **fpr, ++ size_t *fpr_len,unsigned int options, ++ import_filter filter, void *filter_arg); + void *import_new_stats_handle (void); + void import_release_stats_handle (void *p); + void import_print_stats (void *hd); only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2015-1606.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2015-1606.dpatch @@ -0,0 +1,48 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# From 81d3e541326e94d26a953aa70afc3cb149d11ebe Mon Sep 17 00:00:00 2001 +# From: Werner Koch +# Date: Sat, 21 Feb 2015 23:10:30 -0500 +# Subject: [PATCH] gpg: Prevent an invalid memory read using a garbled keyring. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/keyring.c gnupg-1.4.11/g10/keyring.c +--- gnupg-1.4.11~/g10/keyring.c 2010-10-10 05:16:23.000000000 -0400 ++++ gnupg-1.4.11/g10/keyring.c 2015-03-25 13:59:33.478999538 -0400 +@@ -400,8 +400,26 @@ + rc = G10ERR_INV_KEYRING; + break; + } +- if (pkt->pkttype == PKT_COMPRESSED) { +- log_error ("skipped compressed packet in keyring\n"); ++ ++ /* Filter allowed packets. */ ++ switch (pkt->pkttype){ ++ case PKT_PUBLIC_KEY: ++ case PKT_PUBLIC_SUBKEY: ++ case PKT_SECRET_KEY: ++ case PKT_SECRET_SUBKEY: ++ case PKT_USER_ID: ++ case PKT_ATTRIBUTE: ++ case PKT_SIGNATURE: ++ break; /* Allowed per RFC. */ ++ case PKT_RING_TRUST: ++ case PKT_OLD_COMMENT: ++ case PKT_COMMENT: ++ case PKT_GPG_CONTROL: ++ break; /* Allowed by us. */ ++ ++ default: ++ log_error ("skipped packet of type %d in keyring\n", ++ (int)pkt->pkttype); + free_packet(pkt); + init_packet(pkt); + continue; +@@ -467,7 +485,7 @@ + if (rc || !ret_kb) + release_kbnode (keyblock); + else { +- /*(duplicated form the loop body)*/ ++ /*(duplicated from the loop body)*/ + if ( pkt && pkt->pkttype == PKT_RING_TRUST + && lastnode + && lastnode->pkt->pkttype == PKT_SIGNATURE only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2012-6085.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2012-6085.dpatch @@ -0,0 +1,47 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# Description: fix keyring corruption via malformed key import +# Origin: upstream, http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=patch;h=f795a0d59e197455f8723c300eebf59e09853efa +# Bug: https://bugs.g10code.com/gnupg/issue1455 +# Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=697108 + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/import.c gnupg-1.4.11/g10/import.c +--- gnupg-1.4.11~/g10/import.c 2010-05-07 06:34:39.000000000 -0400 ++++ gnupg-1.4.11/g10/import.c 2013-01-08 10:52:51.153224564 -0500 +@@ -346,6 +346,27 @@ + } + + ++/* Return true if PKTTYPE is valid in a keyblock. */ ++static int ++valid_keyblock_packet (int pkttype) ++{ ++ switch (pkttype) ++ { ++ case PKT_PUBLIC_KEY: ++ case PKT_PUBLIC_SUBKEY: ++ case PKT_SECRET_KEY: ++ case PKT_SECRET_SUBKEY: ++ case PKT_SIGNATURE: ++ case PKT_USER_ID: ++ case PKT_ATTRIBUTE: ++ case PKT_RING_TRUST: ++ return 1; ++ default: ++ return 0; ++ } ++} ++ ++ + /**************** + * Read the next keyblock from stream A. + * PENDING_PKT should be initialzed to NULL +@@ -423,7 +444,7 @@ + } + in_cert = 1; + default: +- if( in_cert ) { ++ if (in_cert && valid_keyblock_packet (pkt->pkttype)) { + if( !root ) + root = new_kbnode( pkt ); + else only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/Add-build-and-runtime-support-for-larger-RSA-key.dpatch +++ gnupg-1.4.11/debian/patches/Add-build-and-runtime-support-for-larger-RSA-key.dpatch @@ -0,0 +1,193 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# From 534e2876acc05f9f8d9b54c18511fe768d77dfb5 Mon Sep 17 00:00:00 2001 +# From: Daniel Kahn Gillmor +# Date: Fri, 3 Oct 2014 12:01:11 -0400 +# Subject: [PATCH] gpg: Add build and runtime support for larger RSA keys + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/config.h.in gnupg-1.4.11/config.h.in +--- gnupg-1.4.11~/config.h.in 2015-03-25 13:57:03.000000000 -0400 ++++ gnupg-1.4.11/config.h.in 2015-03-25 13:57:09.117786438 -0400 +@@ -664,6 +664,9 @@ + /* Define as the return type of signal handlers (`int' or `void'). */ + #undef RETSIGTYPE + ++/* Size of secure memory buffer */ ++#undef SECMEM_BUFFER_SIZE ++ + /* The size of `time_t', as computed by sizeof. */ + #undef SIZEOF_TIME_T + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/configure gnupg-1.4.11/configure +--- gnupg-1.4.11~/configure 2010-10-18 04:50:11.000000000 -0400 ++++ gnupg-1.4.11/configure 2015-03-25 13:57:09.121786471 -0400 +@@ -814,6 +814,7 @@ + enable_selinux_support + enable_gnupg_iconv + enable_minimal ++enable_large_secmem + enable_card_support + enable_agent_support + enable_rsa +@@ -1507,6 +1508,7 @@ + enable SELinux support + --disable-gnupg-iconv disable the new iconv code + --enable-minimal build the smallest gpg binary possible ++ --enable-large-secmem allocate extra secure memory + --disable-card-support disable OpenPGP card support + --disable-agent-support disable gpg-agent support + --disable-rsa disable the RSA public key algorithm +@@ -4740,6 +4742,7 @@ + card_support=yes + agent_support=yes + disable_keyserver_path=no ++large_secmem=no + + # Check whether --enable-minimal was given. + if test "${enable_minimal+set}" = set; then : +@@ -4761,6 +4764,29 @@ + + + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to allocate extra secure memory" >&5 ++$as_echo_n "checking whether to allocate extra secure memory... " >&6; } ++# Check whether --enable-large-secmem was given. ++if test "${enable_large_secmem+set}" = set; then : ++ enableval=$enable_large_secmem; large_secmem=$enableval ++else ++ large_secmem=no ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $large_secmem" >&5 ++$as_echo "$large_secmem" >&6; } ++if test "$large_secmem" = yes ; then ++ SECMEM_BUFFER_SIZE=65536 ++else ++ SECMEM_BUFFER_SIZE=32768 ++fi ++ ++cat >>confdefs.h <<_ACEOF ++#define SECMEM_BUFFER_SIZE $SECMEM_BUFFER_SIZE ++_ACEOF ++ ++ ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenPGP card support is requested" >&5 + $as_echo_n "checking whether OpenPGP card support is requested... " >&6; } + # Check whether --enable-card-support was given. +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/configure.ac gnupg-1.4.11/configure.ac +--- gnupg-1.4.11~/configure.ac 2010-10-18 04:45:45.000000000 -0400 ++++ gnupg-1.4.11/configure.ac 2015-03-25 13:57:09.105786337 -0400 +@@ -147,6 +147,7 @@ + card_support=yes + agent_support=yes + disable_keyserver_path=no ++large_secmem=no + + AC_ARG_ENABLE(minimal, + AC_HELP_STRING([--enable-minimal],[build the smallest gpg binary possible]), +@@ -166,6 +167,21 @@ + agent_support=no) + + ++AC_MSG_CHECKING([whether to allocate extra secure memory]) ++AC_ARG_ENABLE(large-secmem, ++ AC_HELP_STRING([--enable-large-secmem], ++ [allocate extra secure memory]), ++ large_secmem=$enableval, large_secmem=no) ++AC_MSG_RESULT($large_secmem) ++if test "$large_secmem" = yes ; then ++ SECMEM_BUFFER_SIZE=65536 ++else ++ SECMEM_BUFFER_SIZE=32768 ++fi ++AC_DEFINE_UNQUOTED(SECMEM_BUFFER_SIZE,$SECMEM_BUFFER_SIZE, ++ [Size of secure memory buffer]) ++ ++ + AC_MSG_CHECKING([whether OpenPGP card support is requested]) + AC_ARG_ENABLE(card-support, + AC_HELP_STRING([--disable-card-support], +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/doc/gpg.texi gnupg-1.4.11/doc/gpg.texi +--- gnupg-1.4.11~/doc/gpg.texi 2010-10-18 05:10:48.000000000 -0400 ++++ gnupg-1.4.11/doc/gpg.texi 2015-03-25 13:57:09.109786371 -0400 +@@ -1127,6 +1127,15 @@ + validation. This option is only meaningful if pka-lookups is set. + @end table + ++@item --enable-large-rsa ++@itemx --disable-large-rsa ++@opindex enable-large-rsa ++@opindex disable-large-rsa ++With --gen-key and --batch, enable the creation of larger RSA secret ++keys than is generally recommended (up to 8192 bits). These large ++keys are more expensive to use, and their signatures and ++certifications are also larger. ++ + @item --enable-dsa2 + @itemx --disable-dsa2 + Enable hash truncation for all DSA keys even for old DSA Keys up to +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/gpg.c gnupg-1.4.11/g10/gpg.c +--- gnupg-1.4.11~/g10/gpg.c 2010-07-05 05:17:37.000000000 -0400 ++++ gnupg-1.4.11/g10/gpg.c 2015-03-25 13:57:09.109786371 -0400 +@@ -368,6 +368,8 @@ + oAutoKeyLocate, + oNoAutoKeyLocate, + oAllowMultisigVerification, ++ oEnableLargeRSA, ++ oDisableLargeRSA, + oEnableDSA2, + oDisableDSA2, + oAllowMultipleMessages, +@@ -715,6 +717,8 @@ + { oDebugCCIDDriver, "debug-ccid-driver", 0, "@"}, + #endif + { oAllowMultisigVerification, "allow-multisig-verification", 0, "@"}, ++ { oEnableLargeRSA, "enable-large-rsa", 0, "@"}, ++ { oDisableLargeRSA, "disable-large-rsa", 0, "@"}, + { oEnableDSA2, "enable-dsa2", 0, "@"}, + { oDisableDSA2, "disable-dsa2", 0, "@"}, + { oAllowMultipleMessages, "allow-multiple-messages", 0, "@"}, +@@ -2008,7 +2012,7 @@ + } + #endif + /* initialize the secure memory. */ +- got_secmem=secmem_init( 32768 ); ++ got_secmem=secmem_init( SECMEM_BUFFER_SIZE ); + maybe_setuid = 0; + /* Okay, we are now working under our real uid */ + +@@ -2876,6 +2880,22 @@ + release_akl(); + break; + ++ case oEnableLargeRSA: ++#if SECMEM_BUFFER_SIZE >= 65536 ++ opt.flags.large_rsa=1; ++#else ++ if (configname) ++ log_info("%s:%d: WARNING: gpg not built with large secure " ++ "memory buffer. Ignoring enable-large-rsa\n", ++ configname,configlineno); ++ else ++ log_info("WARNING: gpg not built with large secure " ++ "memory buffer. Ignoring --enable-large-rsa\n"); ++#endif /* SECMEM_BUFFER_SIZE >= 65536 */ ++ break; ++ case oDisableLargeRSA: opt.flags.large_rsa=0; ++ break; ++ + case oEnableDSA2: opt.flags.dsa2=1; break; + case oDisableDSA2: opt.flags.dsa2=0; break; + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/options.h gnupg-1.4.11/g10/options.h +--- gnupg-1.4.11~/g10/options.h 2009-07-20 04:01:58.000000000 -0400 ++++ gnupg-1.4.11/g10/options.h 2015-03-25 13:57:09.113786404 -0400 +@@ -227,6 +227,7 @@ + unsigned int utf8_filename:1; + unsigned int dsa2:1; + unsigned int allow_multiple_messages:1; ++ unsigned int large_rsa:1; + } flags; + + /* Linked list of ways to find a key if the key isn't on the local only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2013-4576.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2013-4576.dpatch @@ -0,0 +1,253 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# Description: fix RSA Key Extraction via Low-Bandwidth Acoustic +# Cryptanalysis attack +# Origin: upstream, http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commit;h=93a96e3c0c33370248f6570d8285c4e811d305d4 +# Origin: upstream, http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commit;h=d0d72d98f34579213230b3febfebd2fd8dff272b + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/cipher/dsa.c gnupg-1.4.11/cipher/dsa.c +--- gnupg-1.4.11~/cipher/dsa.c 2008-12-11 11:40:06.000000000 -0500 ++++ gnupg-1.4.11/cipher/dsa.c 2013-12-18 11:16:56.571767078 -0500 +@@ -274,7 +274,7 @@ + /**************** + * Make a DSA signature from HASH and put it into r and s. + * +- * Without generating the k this function runs in ++ * Without generating the k this function runs in + * about 26ms on a 300 Mhz Mobile Pentium + */ + +@@ -285,6 +285,8 @@ + MPI kinv; + MPI tmp; + ++ mpi_normalize (hash); ++ + /* select a random k with 0 < k < q */ + k = gen_k( skey->q ); + +@@ -311,7 +313,7 @@ + /**************** + * Returns true if the signature composed from R and S is valid. + * +- * Without the checks this function runs in ++ * Without the checks this function runs in + * about 31ms on a 300 Mhz Mobile Pentium + */ + static int +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/cipher/elgamal.c gnupg-1.4.11/cipher/elgamal.c +--- gnupg-1.4.11~/cipher/elgamal.c 2008-12-11 11:40:06.000000000 -0500 ++++ gnupg-1.4.11/cipher/elgamal.c 2013-12-18 11:16:56.571767078 -0500 +@@ -374,6 +374,9 @@ + { + MPI t1 = mpi_alloc_secure( mpi_get_nlimbs( skey->p ) ); + ++ mpi_normalize (a); ++ mpi_normalize (b); ++ + /* output = b/(a^x) mod p */ + mpi_powm( t1, a, skey->x, skey->p ); + mpi_invm( t1, t1, skey->p ); +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/cipher/random.c gnupg-1.4.11/cipher/random.c +--- gnupg-1.4.11~/cipher/random.c 2010-09-28 05:54:04.000000000 -0400 ++++ gnupg-1.4.11/cipher/random.c 2013-12-18 11:16:56.571767078 -0500 +@@ -284,6 +284,18 @@ + } + + ++/* Randomize the MPI by setting it to NBITS of random of quality LEVEL. */ ++void ++randomize_mpi (MPI mpi, size_t nbits, int level) ++{ ++ unsigned char *buffer; ++ ++ buffer = get_random_bits (nbits, level, mpi_is_secure (mpi)); ++ mpi_set_buffer (mpi, buffer, (nbits+7)/8, 0); ++ xfree (buffer); ++} ++ ++ + int + random_is_faked() + { +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/cipher/random.h gnupg-1.4.11/cipher/random.h +--- gnupg-1.4.11~/cipher/random.h 2008-12-11 11:40:06.000000000 -0500 ++++ gnupg-1.4.11/cipher/random.h 2013-12-18 11:16:56.571767078 -0500 +@@ -30,6 +30,7 @@ + int random_is_faked(void); + void random_disable_locking (void); + void randomize_buffer( byte *buffer, size_t length, int level ); ++void randomize_mpi (MPI mpi, size_t nbits, int level); + byte *get_random_bits( size_t nbits, int level, int secure ); + void fast_random_poll( void ); + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/cipher/rsa.c gnupg-1.4.11/cipher/rsa.c +--- gnupg-1.4.11~/cipher/rsa.c 2008-12-11 11:40:06.000000000 -0500 ++++ gnupg-1.4.11/cipher/rsa.c 2013-12-18 11:16:56.571767078 -0500 +@@ -1,5 +1,5 @@ + /* rsa.c - RSA function +- * Copyright (C) 1997, 1998, 1999 by Werner Koch (dd9jn) ++ * Copyright (C) 1997, 1998, 1999, 2013 by Werner Koch (dd9jn) + * Copyright (C) 2000, 2001 Free Software Foundation, Inc. + * + * This file is part of GnuPG. +@@ -22,7 +22,7 @@ + which expires on September 20, 2000. The patent holder placed that + patent into the public domain on Sep 6th, 2000. + */ +- ++ + #include + #include + #include +@@ -32,6 +32,10 @@ + #include "cipher.h" + #include "rsa.h" + ++/* Blinding is used to mitigate side-channel attacks. You may undef ++ this to speed up the operation in case the system is secured ++ against physical and network mounted side-channel attacks. */ ++#define USE_BLINDING 1 + + typedef struct { + MPI n; /* modulus */ +@@ -103,7 +107,7 @@ + + /* make sure that nbits is even so that we generate p, q of equal size */ + if ( (nbits&1) ) +- nbits++; ++ nbits++; + + n = mpi_alloc ( mpi_nlimb_hint_from_nbits (nbits) ); + +@@ -146,7 +150,7 @@ + 65537 as the new best practice. See FIPS-186-3. + */ + e = mpi_alloc ( mpi_nlimb_hint_from_nbits (32) ); +- mpi_set_ui( e, 65537); ++ mpi_set_ui( e, 65537); + while( !mpi_gcd(t1, e, phi) ) /* (while gcd is not 1) */ + mpi_add_ui( e, e, 2); + +@@ -268,7 +272,7 @@ + mpi_invm(t, skey->p, skey->q ); + if ( mpi_cmp(t, skey->u ) ) + log_info ( "RSA Oops: u is wrong\n"); +- ++ + log_info ( "RSA secret key check finished\n"); + + mpi_free (t); +@@ -286,9 +290,9 @@ + * + * Or faster: + * +- * m1 = c ^ (d mod (p-1)) mod p +- * m2 = c ^ (d mod (q-1)) mod q +- * h = u * (m2 - m1) mod q ++ * m1 = c ^ (d mod (p-1)) mod p ++ * m2 = c ^ (d mod (q-1)) mod q ++ * h = u * (m2 - m1) mod q + * m = m1 + h * p + * + * Where m is OUTPUT, c is INPUT and d,n,p,q,u are elements of SKEY. +@@ -299,13 +303,31 @@ + #if 0 + mpi_powm( output, input, skey->d, skey->n ); + #else +- MPI m1 = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 ); +- MPI m2 = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 ); +- MPI h = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 ); ++ int nlimbs = mpi_get_nlimbs (skey->n)+1; ++ MPI m1 = mpi_alloc_secure (nlimbs); ++ MPI m2 = mpi_alloc_secure (nlimbs); ++ MPI h = mpi_alloc_secure (nlimbs); ++# ifdef USE_BLINDING ++ MPI bdata= mpi_alloc_secure (nlimbs); ++ MPI r = mpi_alloc_secure (nlimbs); ++# endif /* USE_BLINDING */ ++ ++ /* Remove superfluous leading zeroes from INPUT. */ ++ mpi_normalize (input); ++ ++# ifdef USE_BLINDING ++ /* Blind: bdata = (data * r^e) mod n */ ++ randomize_mpi (r, mpi_get_nbits (skey->n), 0); ++ mpi_fdiv_r (r, r, skey->n); ++ mpi_powm (bdata, r, skey->e, skey->n); ++ mpi_mulm (bdata, bdata, input, skey->n); ++ input = bdata; ++# endif /* USE_BLINDING */ + ++ /* RSA secret operation: */ + /* m1 = c ^ (d mod (p-1)) mod p */ + mpi_sub_ui( h, skey->p, 1 ); +- mpi_fdiv_r( h, skey->d, h ); ++ mpi_fdiv_r( h, skey->d, h ); + mpi_powm( m1, input, h, skey->p ); + /* m2 = c ^ (d mod (q-1)) mod q */ + mpi_sub_ui( h, skey->q, 1 ); +@@ -313,14 +335,21 @@ + mpi_powm( m2, input, h, skey->q ); + /* h = u * ( m2 - m1 ) mod q */ + mpi_sub( h, m2, m1 ); +- if ( mpi_is_neg( h ) ) ++ if ( mpi_is_neg( h ) ) + mpi_add ( h, h, skey->q ); +- mpi_mulm( h, skey->u, h, skey->q ); ++ mpi_mulm( h, skey->u, h, skey->q ); + /* m = m2 + h * p */ + mpi_mul ( h, h, skey->p ); + mpi_add ( output, m1, h ); +- /* ready */ +- ++ ++# ifdef USE_BLINDING ++ mpi_free (bdata); ++ /* Unblind: output = (output * r^(-1)) mod n */ ++ mpi_invm (r, r, skey->n); ++ mpi_mulm (output, output, r, skey->n); ++ mpi_free (r); ++# endif /* USE_BLINDING */ ++ + mpi_free ( h ); + mpi_free ( m1 ); + mpi_free ( m2 ); +@@ -395,6 +424,7 @@ + rsa_decrypt( int algo, MPI *result, MPI *data, MPI *skey ) + { + RSA_secret_key sk; ++ MPI input; + + if( algo != 1 && algo != 2 ) + return G10ERR_PUBKEY_ALGO; +@@ -405,8 +435,16 @@ + sk.p = skey[3]; + sk.q = skey[4]; + sk.u = skey[5]; +- *result = mpi_alloc_secure( mpi_get_nlimbs( sk.n ) ); +- secret( *result, data[0], &sk ); ++ ++ /* Better make sure that there are no superfluous leading zeroes ++ in the input and it has not been padded using multiples of N. ++ This mitigates side-channel attacks (CVE-2013-4576). */ ++ input = mpi_alloc (0); ++ mpi_normalize (data[0]); ++ mpi_fdiv_r (input, data[0], sk.n); ++ *result = mpi_alloc_secure (mpi_get_nlimbs (sk.n)); ++ secret (*result, input, &sk); ++ mpi_free (input); + return 0; + } + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/gpgv.c gnupg-1.4.11/g10/gpgv.c +--- gnupg-1.4.11~/g10/gpgv.c 2010-09-28 05:14:58.000000000 -0400 ++++ gnupg-1.4.11/g10/gpgv.c 2013-12-18 11:16:56.571767078 -0500 +@@ -388,6 +388,7 @@ + void random_dump_stats(void) {} + int quick_random_gen( int onoff ) { return -1;} + void randomize_buffer( byte *buffer, size_t length, int level ) {} ++void randomize_mpi (MPI mpi, size_t nbits, int level) {} + int random_is_faked() { return -1;} + byte *get_random_bits( size_t nbits, int level, int secure ) { return NULL;} + void set_random_seed_file( const char *name ) {} only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2013-4242.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2013-4242.dpatch @@ -0,0 +1,95 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## CVE-2013-4242.dpatch by Seth Arnold +## +## All lines beginning with `## DP:' are a description of the patch. +# From: Werner Koch +# Date: Fri, 19 Jul 2013 11:49:23 +0000 (+0200) +# Subject: Mitigate a flush+reload cache attack on RSA secret exponents. +# X-Git-Tag: gnupg-1.4.14~5 +# X-Git-Url: http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commitdiff_plain;h=35646689f4b80955ff7dbe1687bf2c479c53421e;hp=fd86f3031161f11c3cbef643a213a04c821364dd +# +# 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 eprint.iacr.org: +# +# 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 + + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/NEWS gnupg-1.4.11/NEWS +--- gnupg-1.4.11~/NEWS 2010-10-18 01:49:28.000000000 -0700 ++++ gnupg-1.4.11/NEWS 2013-07-30 15:52:47.000000000 -0700 +@@ -5,6 +5,15 @@ + + * Minor changes for better interoperability with GnuPG-2. + ++ * Mitigate the Yarom/Falkner flush+reload side-channel attack on ++ RSA secret keys. ++ ++ * Fixed IDEA for big-endian CPUs ++ ++ * Improved the diagnostics for failed keyserver lockups. ++ ++ * Minor bug and portability fixes. ++ + + Noteworthy changes in version 1.4.10 (2009-09-02) + ------------------------------------------------- +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/NEWS.orig gnupg-1.4.11/NEWS.orig +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/mpi/mpi-pow.c gnupg-1.4.11/mpi/mpi-pow.c +--- gnupg-1.4.11~/mpi/mpi-pow.c 2008-12-11 08:39:43.000000000 -0800 ++++ gnupg-1.4.11/mpi/mpi-pow.c 2013-07-30 15:52:47.000000000 -0700 +@@ -1,5 +1,6 @@ + /* mpi-pow.c - MPI functions +- * Copyright (C) 1994, 1996, 1998, 2000 Free Software Foundation, Inc. ++ * Copyright (C) 1994, 1996, 1998, 2000 Free Software Foundation, Inc. ++ * Copyright (C) 2013 Werner Koch + * + * This file is part of GnuPG. + * +@@ -210,7 +211,14 @@ + tp = rp; rp = xp; xp = tp; + rsize = xsize; + +- if( (mpi_limb_signed_t)e < 0 ) { ++ /* To mitigate the Yarom/Falkner flush+reload cache ++ * side-channel attack on the RSA secret exponent, we ++ * do the multiplication regardless of the value of ++ * the high-bit of E. But to avoid this performance ++ * penalty we do it only if the exponent has been ++ * stored in secure memory and we can thus assume it ++ * is a secret exponent. */ ++ if (esec || (mpi_limb_signed_t)e < 0) { + /*mpihelp_mul( xp, rp, rsize, bp, bsize );*/ + if( bsize < KARATSUBA_THRESHOLD ) { + mpihelp_mul( xp, rp, rsize, bp, bsize ); +@@ -225,7 +233,8 @@ + mpihelp_divrem(xp + msize, 0, xp, xsize, mp, msize); + xsize = msize; + } +- ++ } ++ if ((mpi_limb_signed_t)e < 0) { + tp = rp; rp = xp; xp = tp; + rsize = xsize; + } +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/mpi/mpi-pow.c.orig gnupg-1.4.11/mpi/mpi-pow.c.orig only in patch2: unchanged: --- gnupg-1.4.11.orig/debian/patches/CVE-2013-4351.dpatch +++ gnupg-1.4.11/debian/patches/CVE-2013-4351.dpatch @@ -0,0 +1,54 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +# Description: fix incorrect no-usage-permitted flag handling +# Origin: backported from GnuPG 1.4.15 +# Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=722722 + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/getkey.c gnupg-1.4.11/g10/getkey.c +--- gnupg-1.4.11~/g10/getkey.c 2009-05-06 04:01:47.000000000 -0400 ++++ gnupg-1.4.11/g10/getkey.c 2013-10-08 07:49:41.520606451 -0400 +@@ -1452,13 +1452,19 @@ + + if(flags) + key_usage |= PUBKEY_USAGE_UNKNOWN; ++ ++ if (!key_usage) ++ key_usage |= PUBKEY_USAGE_NONE; + } ++ else if (p) /* Key flags of length zero. */ ++ key_usage |= PUBKEY_USAGE_NONE; + + /* We set PUBKEY_USAGE_UNKNOWN to indicate that this key has a + capability that we do not handle. This serves to distinguish + between a zero key usage which we handle as the default + capabilities for that algorithm, and a usage that we do not +- handle. */ ++ handle. Likewise we use PUBKEY_USAGE_NONE to indicate that ++ key_flags have been given but they do not specify any usage. */ + + return key_usage; + } +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/g10/keygen.c gnupg-1.4.11/g10/keygen.c +--- gnupg-1.4.11~/g10/keygen.c 2010-02-17 03:58:43.000000000 -0500 ++++ gnupg-1.4.11/g10/keygen.c 2013-10-08 07:49:41.520606451 -0400 +@@ -210,9 +210,6 @@ + if (use & PUBKEY_USAGE_AUTH) + buf[0] |= 0x20; + +- if (!buf[0]) +- return; +- + build_sig_subpkt (sig, SIGSUBPKT_KEY_FLAGS, buf, 1); + } + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/include/cipher.h gnupg-1.4.11/include/cipher.h +--- gnupg-1.4.11~/include/cipher.h 2008-12-11 11:39:58.000000000 -0500 ++++ gnupg-1.4.11/include/cipher.h 2013-10-08 07:49:41.520606451 -0400 +@@ -54,6 +54,7 @@ + #define PUBKEY_USAGE_CERT 4 /* key is also good to certify other keys*/ + #define PUBKEY_USAGE_AUTH 8 /* key is good for authentication */ + #define PUBKEY_USAGE_UNKNOWN 128 /* key has an unknown usage bit */ ++#define PUBKEY_USAGE_NONE 256 /* No usage given. */ + + #define DIGEST_ALGO_MD5 1 + #define DIGEST_ALGO_SHA1 2