[Pkg-gnupg-commit] [gnupg2] 129/132: drop patches already upstream

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 17 03:07:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit e3047ce8c57b9d464c39637464273f1afbb72559
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Tue May 16 22:33:40 2017 -0400

    drop patches already upstream
---
 .../0013-agent-Minor-fix-for-get_client_pid.patch  |   56 --
 .../0014-gpgscm-Simplify-substring-operation.patch |   39 -
 ...gscm-Simplify-get-output-string-operation.patch |   43 -
 .../patches/0016-gpgscm-Fix-copying-values.patch   |  103 --
 ...s-Fix-setup-of-ephemeral-home-directories.patch |  133 ---
 ...s-Fix-setup-of-ephemeral-home-directories.patch |   31 -
 .../patches/0019-tests-Make-test-more-robust.patch |   43 -
 ...gpgscm-Initialize-unused-slots-in-vectors.patch |   42 -
 .../0021-gpgscm-Avoid-mutating-integer.patch       |   27 -
 ...gent-Serialize-access-to-passphrase-cache.patch |  220 -----
 ...eep-CCID-reader-open-when-card-is-not-ava.patch |   41 -
 .../0024-scd-Internal-CCID-reader-cleanup.patch    |  449 ---------
 ...-gpg-Fix-printing-of-offline-taken-subkey.patch |   27 -
 .../0026-doc-Explain-the-in-a-key-listing.patch    |   34 -
 .../0027-gpgscm-Fix-compact-vector-encoding.patch  |   43 -
 ...ve-arbitrary-limit-on-number-of-cell-segm.patch |  285 ------
 ...m-Make-global-data-constant-when-possible.patch |  156 ---
 ...cate-small-integers-in-the-rodata-section.patch | 1011 --------------------
 ...ll-length-specifier-when-time_t-is-larger.patch |   43 -
 .../0032-g10-Minor-clean-up-for-export.c.patch     |   90 --
 ...33-dirmngr-Fix-dns-stuff.c-in-another-way.patch |   32 -
 ...-unexpected-suspend-resume-by-CCID-driver.patch |   55 --
 .../patches/0035-common-Simplify-format_text.patch |  139 ---
 .../0036-dirmngr-Fix-possible-null-reference.patch |   28 -
 ...tools-Fix-condition-for-gpg-connect-agent.patch |   30 -
 debian/patches/0038-dirmngr-Fix-type-of-sock.patch |   25 -
 .../0039-common-g10-Fix-enumeration-types.patch    |  179 ----
 .../patches/0040-dirmngr-Fix-thread-key-type.patch |   25 -
 .../0041-dirmngr-Fix-alignment-of-ADDR.patch       |  155 ---
 ...2-dirmngr-Fix-http.c-for-sockaddr_storage.patch |   70 --
 .../0043-dirmngr-More-fix-for-Windows.patch        |   73 --
 ...44-agent-Clean-up-error-initialize-return.patch |   85 --
 ...0-Fix-import-export-filter-property-match.patch |   25 -
 debian/patches/0046-g10-Minor-fixes.patch          |   66 --
 debian/patches/0047-g10-Fix-parse_ring_trust.patch |   25 -
 debian/patches/0048-tests-Minor-memory-fix.patch   |   25 -
 debian/patches/0049-agent-Minor-cleanup.patch      |   46 -
 debian/patches/0050-agent-More-minor-change.patch  |   24 -
 ...51-dirmngr-Fix-API-difference-for-Windows.patch |  100 --
 ...0052-dirmngr-Fix-final-close-of-LISTEN_FD.patch |   50 -
 ...3-g10-invalidate-the-fd-cache-for-keyring.patch |   41 -
 ...054-dirmngr-Fix-aliasing-problem-in-dns.c.patch |   89 --
 debian/patches/0055-doc-Fix-documentation.patch    |   26 -
 debian/patches/0056-gpg-Fix-typo.patch             |   25 -
 ...g-Properly-account-for-ring-trust-packets.patch |   83 --
 .../0058-g10-Remove-skeleton-options-files.patch   |  445 ---------
 ...ning-prefer-available-card-key-when-no-u-.patch |   69 --
 debian/patches/series                              |   47 -
 48 files changed, 4998 deletions(-)

diff --git a/debian/patches/0013-agent-Minor-fix-for-get_client_pid.patch b/debian/patches/0013-agent-Minor-fix-for-get_client_pid.patch
deleted file mode 100644
index d419f9e..0000000
--- a/debian/patches/0013-agent-Minor-fix-for-get_client_pid.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Tue, 4 Apr 2017 10:39:00 +0900
-Subject: agent: Minor fix for get_client_pid.
-
-* agent/command-ssh.c (get_client_pid): Use 0 to initialize.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 5744d2038bd17b8b1be4e73d0ad3bc41772efe96)
----
- agent/command-ssh.c | 10 ++++++----
- 1 file changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/agent/command-ssh.c b/agent/command-ssh.c
-index 5a02542..b15d8b2 100644
---- a/agent/command-ssh.c
-+++ b/agent/command-ssh.c
-@@ -3567,7 +3567,7 @@ ssh_request_process (ctrl_t ctrl, estream_t stream_sock)
- static unsigned long
- get_client_pid (int fd)
- {
--  pid_t client_pid = (pid_t)(-1);
-+  pid_t client_pid = (pid_t)0;
- 
- #ifdef SO_PEERCRED
-   {
-@@ -3578,7 +3578,7 @@ get_client_pid (int fd)
- #endif
-     socklen_t cl = sizeof cr;
- 
--    if ( !getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl))
-+    if (!getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl))
-       {
- #if defined (HAVE_STRUCT_SOCKPEERCRED_PID) || defined (HAVE_STRUCT_UCRED_PID)
-         client_pid = cr.pid;
-@@ -3593,7 +3593,7 @@ get_client_pid (int fd)
-   {
-     socklen_t len = sizeof (pid_t);
- 
--    getsockopt(fd, SOL_LOCAL, LOCAL_PEERPID, &client_pid, &len);
-+    getsockopt (fd, SOL_LOCAL, LOCAL_PEERPID, &client_pid, &len);
-   }
- #elif defined (LOCAL_PEEREID)
-   {
-@@ -3613,9 +3613,11 @@ get_client_pid (int fd)
-         ucred_free (ucred);
-       }
-   }
-+#else
-+  (void)fd;
- #endif
- 
--  return client_pid == (pid_t)(-1)? 0 : (unsigned long)client_pid;
-+  return (unsigned long)client_pid;
- }
- 
- 
diff --git a/debian/patches/0014-gpgscm-Simplify-substring-operation.patch b/debian/patches/0014-gpgscm-Simplify-substring-operation.patch
deleted file mode 100644
index a982dd1..0000000
--- a/debian/patches/0014-gpgscm-Simplify-substring-operation.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Tue, 4 Apr 2017 14:28:45 +0200
-Subject: gpgscm: Simplify substring operation.
-
-* tests/gpgscm/scheme.c (opexe_2): Simplify 'substring'.
-
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit d858096c99705ccf2e115475f81c4cf88edbeebf)
----
- tests/gpgscm/scheme.c | 8 +-------
- 1 file changed, 1 insertion(+), 7 deletions(-)
-
-diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
-index fbc562d..3c7afa3 100644
---- a/tests/gpgscm/scheme.c
-+++ b/tests/gpgscm/scheme.c
-@@ -4355,7 +4355,6 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) {
-           char *str;
-           int index0;
-           int index1;
--          int len;
- 
-           str=strvalue(car(sc->args));
- 
-@@ -4374,13 +4373,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) {
-                index1=strlength(car(sc->args));
-           }
- 
--          len=index1-index0;
- 	  gc_disable(sc, 1);
--          x=mk_empty_string(sc,len,' ');
--          memcpy(strvalue(x),str+index0,len);
--          strvalue(x)[len]=0;
--
--          s_return_enable_gc(sc, x);
-+          s_return_enable_gc(sc, mk_counted_string(sc, str + index0, index1 - index0));
-      }
- 
-      CASE(OP_VECTOR): {   /* vector */
diff --git a/debian/patches/0015-gpgscm-Simplify-get-output-string-operation.patch b/debian/patches/0015-gpgscm-Simplify-get-output-string-operation.patch
deleted file mode 100644
index 650319c..0000000
--- a/debian/patches/0015-gpgscm-Simplify-get-output-string-operation.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Tue, 4 Apr 2017 17:38:50 +0200
-Subject: gpgscm: Simplify get-output-string operation.
-
-* tests/gpgscm/scheme.c (opexe_4): Simplify 'get-output-string'.
-
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit a80d4a9b50ad47eae1f8c740dd73804311e38783)
----
- tests/gpgscm/scheme.c | 20 ++++++--------------
- 1 file changed, 6 insertions(+), 14 deletions(-)
-
-diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
-index 3c7afa3..736486f 100644
---- a/tests/gpgscm/scheme.c
-+++ b/tests/gpgscm/scheme.c
-@@ -4811,20 +4811,12 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) {
-           port *p;
- 
-           if ((p=car(sc->args)->_object._port)->kind&port_string) {
--               off_t size;
--               char *str;
--
--               size=p->rep.string.curr-p->rep.string.start+1;
--               str=sc->malloc(size);
--               if(str != NULL) {
--                    pointer s;
--
--                    memcpy(str,p->rep.string.start,size-1);
--                    str[size-1]='\0';
--                    s=mk_string(sc,str);
--                    sc->free(str);
--                    s_return(sc,s);
--               }
-+	       gc_disable(sc, 1);
-+	       s_return_enable_gc(
-+		    sc,
-+		    mk_counted_string(sc,
-+				      p->rep.string.start,
-+				      p->rep.string.curr - p->rep.string.start));
-           }
-           s_return(sc,sc->F);
-      }
diff --git a/debian/patches/0016-gpgscm-Fix-copying-values.patch b/debian/patches/0016-gpgscm-Fix-copying-values.patch
deleted file mode 100644
index 1b5d7cc..0000000
--- a/debian/patches/0016-gpgscm-Fix-copying-values.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Tue, 4 Apr 2017 17:36:45 +0200
-Subject: gpgscm: Fix copying values.
-
-* tests/gpgscm/scheme.c (copy_value): New function.
-(mk_tagged_value): Use new function.
-(opexe_4): Likewise for OP_SAVE_FORCED.
---
-
-Occasionally, we need to copy a value from one location in the storage
-to another.  Scheme objects are fine.  Some primitive objects,
-however, require finalization, usually to free resources.
-
-For these values, we either make a copy or acquire a reference.
-
-Fixes e.g. a double free if a delayed expression evaluating to a
-string is forced.
-
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit 6261611d3786f19fd84ccc79f45a89cadac518e8)
----
- tests/gpgscm/scheme.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 52 insertions(+), 2 deletions(-)
-
-diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
-index 736486f..51fdef0 100644
---- a/tests/gpgscm/scheme.c
-+++ b/tests/gpgscm/scheme.c
-@@ -624,6 +624,56 @@ static long binary_decode(const char *s) {
- 
- 

- 
-+/*
-+ * Copying values.
-+ *
-+ * Occasionally, we need to copy a value from one location in the
-+ * storage to another.  Scheme objects are fine.  Some primitive
-+ * objects, however, require finalization, usually to free resources.
-+ *
-+ * For these values, we either make a copy or acquire a reference.
-+ */
-+
-+/*
-+ * Copy SRC to DST.
-+ *
-+ * Copies the representation of SRC to DST.  This makes SRC
-+ * indistinguishable from DST from the perspective of a Scheme
-+ * expression modulo the fact that they reside at a different location
-+ * in the store.
-+ *
-+ * Conditions:
-+ *
-+ *     - SRC must not be a vector.
-+ *     - Caller must ensure that any resources associated with the
-+ *       value currently stored in DST is accounted for.
-+ */
-+static void
-+copy_value(scheme *sc, pointer dst, pointer src)
-+{
-+  memcpy(dst, src, sizeof *src);
-+
-+  /* We may need to make a copy or acquire a reference.  */
-+  if (typeflag(dst) & T_FINALIZE)
-+    switch (type(dst)) {
-+    case T_STRING:
-+      strvalue(dst) = store_string(sc, strlength(dst), strvalue(dst), 0);
-+      break;
-+    case T_PORT:
-+      /* XXX acquire reference */
-+      assert (!"implemented");
-+      break;
-+    case T_FOREIGN_OBJECT:
-+      /* XXX acquire reference */
-+      assert (!"implemented");
-+      break;
-+     case T_VECTOR:
-+      assert (!"vectors cannot be copied");
-+    }
-+}
-+
-+

-+
- /* Tags are like property lists, but can be attached to arbitrary
-  * values.  */
- 
-@@ -640,7 +690,7 @@ mk_tagged_value(scheme *sc, pointer v, pointer tag_car, pointer tag_cdr)
-   if (r == sc->sink)
-     return sc->sink;
- 
--  memcpy(r, v, sizeof *v);
-+  copy_value(sc, r, v);
-   typeflag(r) |= T_TAGGED;
- 
-   t = r + 1;
-@@ -4603,7 +4653,7 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) {
-           }
- 
-      CASE(OP_SAVE_FORCED):     /* Save forced value replacing promise */
--          memcpy(sc->code,sc->value,sizeof(struct cell));
-+	  copy_value(sc, sc->code, sc->value);
-           s_return(sc,sc->value);
- 
-      CASE(OP_WRITE):      /* write */
diff --git a/debian/patches/0017-tests-Fix-setup-of-ephemeral-home-directories.patch b/debian/patches/0017-tests-Fix-setup-of-ephemeral-home-directories.patch
deleted file mode 100644
index 61394e7..0000000
--- a/debian/patches/0017-tests-Fix-setup-of-ephemeral-home-directories.patch
+++ /dev/null
@@ -1,133 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Tue, 4 Apr 2017 14:32:04 +0200
-Subject: tests: Fix setup of ephemeral home directories.
-
-* tests/openpgp/defs.scm (with-ephemeral-home-directory): Create
-configuration files when we enter the context.
-* tests/openpgp/setup.scm: Do not use an ephemeral home directory.
-Tests should always use the cwd.
-* tests/gpgsm/setup.scm: Likewise.
-* tests/gpgsm/export.scm: Add explicit constructor function.
-* tests/openpgp/decrypt-session-key.scm: Likewise.
-* tests/openpgp/decrypt-unwrap-verify.scm: Likewise.
---
-
-Previously, ephemeral homedirectories lacked a configuration, hence
-GnuPG tried to start backend daemons using their installed locations.
-Fix this by explicitly creating a suitable configuration.
-
-GnuPG-bug-id: 3047
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit 32b75fb7743f35936d7014fce33c90ba97dfa374)
----
- tests/gpgsm/export.scm                  |  2 +-
- tests/gpgsm/setup.scm                   |  8 +++-----
- tests/openpgp/decrypt-session-key.scm   |  2 +-
- tests/openpgp/decrypt-unwrap-verify.scm |  2 +-
- tests/openpgp/defs.scm                  | 12 ++++++++----
- tests/openpgp/setup.scm                 | 13 ++++++-------
- 6 files changed, 20 insertions(+), 19 deletions(-)
-
-diff --git a/tests/gpgsm/export.scm b/tests/gpgsm/export.scm
-index 1ee91e4..47fb06e 100644
---- a/tests/gpgsm/export.scm
-+++ b/tests/gpgsm/export.scm
-@@ -25,7 +25,7 @@
-  (lambda (cert)
-    (lettmp (exported)
-      (call-check `(, at gpgsm --output ,exported --export ,cert::uid::CN))
--     (with-ephemeral-home-directory
-+     (with-ephemeral-home-directory setup-gpgsm-environment
-       (call-check `(, at gpgsm --import ,exported))
-       (assert (sm-have-public-key? cert)))))
-  (lambda (cert) cert::uid::CN)
-diff --git a/tests/gpgsm/setup.scm b/tests/gpgsm/setup.scm
-index 91821a0..aa1ab41 100644
---- a/tests/gpgsm/setup.scm
-+++ b/tests/gpgsm/setup.scm
-@@ -23,8 +23,6 @@
- (unless (and tarball (not (null? tarball)))
- 	(error "Usage: setup.scm --create-tarball <file> ..."))
- 
--(with-ephemeral-home-directory
-- (chdir (getenv "GNUPGHOME"))
-- (create-gpgsmhome)
-- (stop-agent)
-- (call-check `(,(tool 'gpgtar) --create --output ,(car tarball) ".")))
-+(setenv "GNUPGHOME" (getcwd) #t)
-+(create-gpgsmhome)
-+(call-check `(,(tool 'gpgtar) --create --output ,(car tarball) "."))
-diff --git a/tests/openpgp/decrypt-session-key.scm b/tests/openpgp/decrypt-session-key.scm
-index 771b53d..989ce30 100755
---- a/tests/openpgp/decrypt-session-key.scm
-+++ b/tests/openpgp/decrypt-session-key.scm
-@@ -37,7 +37,7 @@
-  (lambda (name)
-    (let* ((source (in-srcdir (string-append name ".asc")))
- 	  (key (get-session-key source)))
--     (with-ephemeral-home-directory
-+     (with-ephemeral-home-directory setup-environment
-       (tr:do
-        (tr:open source)
-        (tr:gpg "" `(--yes --decrypt --override-session-key ,key))
-diff --git a/tests/openpgp/decrypt-unwrap-verify.scm b/tests/openpgp/decrypt-unwrap-verify.scm
-index 97a72e4..ef9a99a 100755
---- a/tests/openpgp/decrypt-unwrap-verify.scm
-+++ b/tests/openpgp/decrypt-unwrap-verify.scm
-@@ -35,7 +35,7 @@
- 
-        ;; Then, verify the signature with a clean working directory
-        ;; containing only Steve's public key.
--       (with-ephemeral-home-directory
-+       (with-ephemeral-home-directory setup-environment
- 	(call-check `(, at gpg --import ,steve's-key))
- 	(call-check `(, at gpg --verify ,unwrapped)))))
-   '("encsig-2-keys-3" "encsig-2-keys-4")))
-diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
-index e8d06c0..4271ba0 100644
---- a/tests/openpgp/defs.scm
-+++ b/tests/openpgp/defs.scm
-@@ -289,14 +289,18 @@
- 
- ;; Evaluate a sequence of expressions with an ephemeral home
- ;; directory.
--(define-macro (with-ephemeral-home-directory . expressions)
-+(define-macro (with-ephemeral-home-directory setup-fn . expressions)
-   (let ((original-home-directory (gensym))
--	(ephemeral-home-directory (gensym)))
-+	(ephemeral-home-directory (gensym))
-+	(setup (gensym)))
-     `(let ((,original-home-directory (getenv "GNUPGHOME"))
--	   (,ephemeral-home-directory (mkdtemp)))
-+	   (,ephemeral-home-directory (mkdtemp))
-+	   (,setup (delay (,setup-fn))))
-        (finally (unlink-recursively ,ephemeral-home-directory)
- 	 (dynamic-wind
--	     (lambda () (setenv "GNUPGHOME" ,ephemeral-home-directory #t))
-+	     (lambda ()
-+	       (force ,setup)
-+	       (setenv "GNUPGHOME" ,ephemeral-home-directory #t))
- 	     (lambda () , at expressions)
- 	     (lambda () (setenv "GNUPGHOME" ,original-home-directory #t)))))))
- 
-diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm
-index 4b3bfcb..a7d14e7 100755
---- a/tests/openpgp/setup.scm
-+++ b/tests/openpgp/setup.scm
-@@ -40,10 +40,9 @@
-        '(gpgconf gpg gpg-agent scdaemon gpgsm dirmngr gpg-connect-agent
- 		 gpg-preset-passphrase gpgtar pinentry)))
- 
--(with-ephemeral-home-directory
-- (chdir (getenv "GNUPGHOME"))
-- (create-gpghome)
-- (start-agent)
-- (create-legacy-gpghome)
-- (stop-agent)
-- (call-check `(,(tool 'gpgtar) --create --output ,(cadr *args*) ".")))
-+(setenv "GNUPGHOME" (getcwd) #t)
-+(create-gpghome)
-+(start-agent)
-+(create-legacy-gpghome)
-+(stop-agent)
-+(call-check `(,(tool 'gpgtar) --create --output ,(cadr *args*) "."))
diff --git a/debian/patches/0018-tests-Fix-setup-of-ephemeral-home-directories.patch b/debian/patches/0018-tests-Fix-setup-of-ephemeral-home-directories.patch
deleted file mode 100644
index a0bd43e..0000000
--- a/debian/patches/0018-tests-Fix-setup-of-ephemeral-home-directories.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Wed, 5 Apr 2017 15:18:30 +0200
-Subject: tests: Fix setup of ephemeral home directories.
-
-* tests/openpgp/defs.scm (with-ephemeral-home-directory): Set
-GNUPGHOME and cwd to the ephemeral directory before calling the setup
-function.
-
-GnuPG-bug-id: 3047
-Fixes-commit: 32b75fb7743f35936d7014fce33c90ba97dfa374
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit 01e84d429aeeb1450012ff0576a6a24de50693c6)
----
- tests/openpgp/defs.scm | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
-index 4271ba0..815a560 100644
---- a/tests/openpgp/defs.scm
-+++ b/tests/openpgp/defs.scm
-@@ -299,8 +299,8 @@
-        (finally (unlink-recursively ,ephemeral-home-directory)
- 	 (dynamic-wind
- 	     (lambda ()
--	       (force ,setup)
--	       (setenv "GNUPGHOME" ,ephemeral-home-directory #t))
-+	       (setenv "GNUPGHOME" ,ephemeral-home-directory #t)
-+	       (with-working-directory ,ephemeral-home-directory (force ,setup)))
- 	     (lambda () , at expressions)
- 	     (lambda () (setenv "GNUPGHOME" ,original-home-directory #t)))))))
- 
diff --git a/debian/patches/0019-tests-Make-test-more-robust.patch b/debian/patches/0019-tests-Make-test-more-robust.patch
deleted file mode 100644
index d6d5e2d..0000000
--- a/debian/patches/0019-tests-Make-test-more-robust.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Thu, 6 Apr 2017 12:33:37 +0200
-Subject: tests: Make test more robust.
-
-* tests/openpgp/4gb-packet.scm: Skip if we do not have BZIP2.
-* tests/openpgp/defs.scm (have-compression-algo?): New function.
-
-GnuPG-bug-id: 3028
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit 94645311f8a3e9ae33643512f87fbef41bf0556f)
----
- tests/openpgp/4gb-packet.scm | 7 ++++---
- tests/openpgp/defs.scm       | 2 ++
- 2 files changed, 6 insertions(+), 3 deletions(-)
-
-diff --git a/tests/openpgp/4gb-packet.scm b/tests/openpgp/4gb-packet.scm
-index b827181..109e61d 100755
---- a/tests/openpgp/4gb-packet.scm
-+++ b/tests/openpgp/4gb-packet.scm
-@@ -23,6 +23,7 @@
- (load (with-path "defs.scm"))
- (setup-environment)
- 
--(if (= 0 (call `(, at GPG --list-packets ,(in-srcdir "4gb-packet.asc"))))
--  (info "Can parse 4GB packets.")
--  (fail "Failed to parse 4GB packet."))
-+(unless (have-compression-algo? "BZIP2")
-+	(skip "BZIP2 support not compiled in."))
-+
-+(call-check `(, at GPG --list-packets ,(in-srcdir "4gb-packet.asc")))
-diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
-index 815a560..29eb775 100644
---- a/tests/openpgp/defs.scm
-+++ b/tests/openpgp/defs.scm
-@@ -258,6 +258,8 @@
-   (not (not (member x (force all-hash-algos)))))
- (define (have-cipher-algo? x)
-   (not (not (member x (force all-cipher-algos)))))
-+(define (have-compression-algo? x)
-+  (not (not (member x (force all-compression-algos)))))
- 
- (define (gpg-pipe args0 args1 errfd)
-   (lambda (source sink)
diff --git a/debian/patches/0020-gpgscm-Initialize-unused-slots-in-vectors.patch b/debian/patches/0020-gpgscm-Initialize-unused-slots-in-vectors.patch
deleted file mode 100644
index 94e6c19..0000000
--- a/debian/patches/0020-gpgscm-Initialize-unused-slots-in-vectors.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Thu, 6 Apr 2017 16:21:48 +0200
-Subject: gpgscm: Initialize unused slots in vectors.
-
-* tests/gpgscm/scheme.c (get_vector_object): Initialize unused slots
-at the end of vectors.
---
-
-They should not be used for anything, but let's just initialize them
-to something benign to be sure.
-
-GnuPG-bug-id: 3014
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit b83903f59ec5d49ac579f263da70ebc8dc3645b5)
----
- tests/gpgscm/scheme.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
-index 51fdef0..3719e53 100644
---- a/tests/gpgscm/scheme.c
-+++ b/tests/gpgscm/scheme.c
-@@ -1083,11 +1083,19 @@ static pointer get_cell(scheme *sc, pointer a, pointer b)
- static pointer get_vector_object(scheme *sc, int len, pointer init)
- {
-   pointer cells = get_consecutive_cells(sc, vector_size(len));
-+  int i;
-+  int alloc_len = 1 + 3 * (vector_size(len) - 1);
-   if(sc->no_memory) { return sc->sink; }
-   /* Record it as a vector so that gc understands it. */
-   typeflag(cells) = (T_VECTOR | T_ATOM | T_FINALIZE);
-   vector_length(cells) = len;
-   fill_vector(cells,init);
-+
-+  /* Initialize the unused slots at the end.  */
-+  assert (alloc_len - len < 3);
-+  for (i = len; i < alloc_len; i++)
-+    cells->_object._vector._elements[i] = sc->NIL;
-+
-   if (gc_enabled (sc))
-     push_recent_alloc(sc, cells, sc->NIL);
-   return cells;
diff --git a/debian/patches/0021-gpgscm-Avoid-mutating-integer.patch b/debian/patches/0021-gpgscm-Avoid-mutating-integer.patch
deleted file mode 100644
index 9a75baf..0000000
--- a/debian/patches/0021-gpgscm-Avoid-mutating-integer.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Thu, 6 Apr 2017 16:24:49 +0200
-Subject: gpgscm: Avoid mutating integer.
-
-* tests/gpgscm/scheme.c (opexe_5): Do not modify the integer in-place
-while printing an vector.  Integer objects may be shared, so they must
-not be mutated.
-
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit f1dc34f502a68673e7a29f3fcf57b8dc6a4fac89)
----
- tests/gpgscm/scheme.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
-index 3719e53..aa0cf69 100644
---- a/tests/gpgscm/scheme.c
-+++ b/tests/gpgscm/scheme.c
-@@ -5181,7 +5181,7 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) {
-                s_return(sc,sc->T);
-           } else {
-                pointer elem=vector_elem(vec,i);
--               ivalue_unchecked(cdr(sc->args))=i+1;
-+               cdr(sc->args) = mk_integer(sc, i + 1);
-                s_save(sc,OP_PVECFROM, sc->args, sc->NIL);
-                sc->args=elem;
-                if (i > 0)
diff --git a/debian/patches/0022-agent-Serialize-access-to-passphrase-cache.patch b/debian/patches/0022-agent-Serialize-access-to-passphrase-cache.patch
deleted file mode 100644
index 7f30b27..0000000
--- a/debian/patches/0022-agent-Serialize-access-to-passphrase-cache.patch
+++ /dev/null
@@ -1,220 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Fri, 7 Apr 2017 08:39:26 +0900
-Subject: agent: Serialize access to passphrase cache.
-
-* agent/cache.c (encryption_lock): Remove.
-(cache_lock): New.  Now, we have coarse grain lock to serialize
-entire cache access.
-(initialize_module_cache): Use CACHE_LOCK.
-(init_encryption, new_data): Remove ENCRYPTION_LOCK.
-(agent_flush_cache, agent_put_cache, agent_get_cache): Lock the cache.
-
---
-
-GnuPG-bug-id: 3027
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit ebe12be034f052cdec871f0d8ad1bfab85d7b943)
----
- agent/cache.c | 73 ++++++++++++++++++++++++++++++-----------------------------
- 1 file changed, 37 insertions(+), 36 deletions(-)
-
-diff --git a/agent/cache.c b/agent/cache.c
-index 41e0905..80d5f8d 100644
---- a/agent/cache.c
-+++ b/agent/cache.c
-@@ -31,9 +31,8 @@
- /* The size of the encryption key in bytes.  */
- #define ENCRYPTION_KEYSIZE (128/8)
- 
--/* A mutex used to protect the encryption.  This is required because
--   we use one context to do all encryption and decryption.  */
--static npth_mutex_t encryption_lock;
-+/* A mutex used to serialize access to the cache.  */
-+static npth_mutex_t cache_lock;
- /* The encryption context.  This is the only place where the
-    encryption key for all cached entries is available.  It would be nice
-    to keep this (or just the key) in some hardware device, for example
-@@ -76,7 +75,7 @@ initialize_module_cache (void)
- {
-   int err;
- 
--  err = npth_mutex_init (&encryption_lock, NULL);
-+  err = npth_mutex_init (&cache_lock, NULL);
- 
-   if (err)
-     log_fatal ("error initializing cache module: %s\n", strerror (err));
-@@ -102,15 +101,10 @@ init_encryption (void)
- {
-   gpg_error_t err;
-   void *key;
--  int res;
- 
-   if (encryption_handle)
-     return 0; /* Shortcut - Already initialized.  */
- 
--  res = npth_mutex_lock (&encryption_lock);
--  if (res)
--    log_fatal ("failed to acquire cache encryption mutex: %s\n", strerror (res));
--
-   err = gcry_cipher_open (&encryption_handle, GCRY_CIPHER_AES128,
-                           GCRY_CIPHER_MODE_AESWRAP, GCRY_CIPHER_SECURE);
-   if (!err)
-@@ -133,10 +127,6 @@ init_encryption (void)
-     log_error ("error initializing cache encryption context: %s\n",
-                gpg_strerror (err));
- 
--  res = npth_mutex_unlock (&encryption_lock);
--  if (res)
--    log_fatal ("failed to release cache encryption mutex: %s\n", strerror (res));
--
-   return err? gpg_error (GPG_ERR_NOT_INITIALIZED) : 0;
- }
- 
-@@ -155,7 +145,6 @@ new_data (const char *string, struct secret_data_s **r_data)
-   struct secret_data_s *d, *d_enc;
-   size_t length;
-   int total;
--  int res;
- 
-   *r_data = NULL;
- 
-@@ -186,17 +175,9 @@ new_data (const char *string, struct secret_data_s **r_data)
-     }
- 
-   d_enc->totallen = total;
--  res = npth_mutex_lock (&encryption_lock);
--  if (res)
--    log_fatal ("failed to acquire cache encryption mutex: %s\n",
--               strerror (res));
--
-   err = gcry_cipher_encrypt (encryption_handle, d_enc->data, total,
-                              d->data, total - 8);
-   xfree (d);
--  res = npth_mutex_unlock (&encryption_lock);
--  if (res)
--    log_fatal ("failed to release cache encryption mutex: %s\n", strerror (res));
-   if (err)
-     {
-       xfree (d_enc);
-@@ -281,10 +262,15 @@ void
- agent_flush_cache (void)
- {
-   ITEM r;
-+  int res;
- 
-   if (DBG_CACHE)
-     log_debug ("agent_flush_cache\n");
- 
-+  res = npth_mutex_lock (&cache_lock);
-+  if (res)
-+    log_fatal ("failed to acquire cache mutex: %s\n", strerror (res));
-+
-   for (r=thecache; r; r = r->next)
-     {
-       if (r->pw)
-@@ -296,6 +282,10 @@ agent_flush_cache (void)
-           r->accessed = 0;
-         }
-     }
-+
-+  res = npth_mutex_unlock (&cache_lock);
-+  if (res)
-+    log_fatal ("failed to release cache mutex: %s\n", strerror (res));
- }
- 
- 
-@@ -321,6 +311,11 @@ agent_put_cache (const char *key, cache_mode_t cache_mode,
- {
-   gpg_error_t err = 0;
-   ITEM r;
-+  int res;
-+
-+  res = npth_mutex_lock (&cache_lock);
-+  if (res)
-+    log_fatal ("failed to acquire cache mutex: %s\n", strerror (res));
- 
-   if (DBG_CACHE)
-     log_debug ("agent_put_cache '%s' (mode %d) requested ttl=%d\n",
-@@ -336,7 +331,7 @@ agent_put_cache (const char *key, cache_mode_t cache_mode,
-         }
-     }
-   if ((!ttl && data) || cache_mode == CACHE_MODE_IGNORE)
--    return 0;
-+    goto out;
- 
-   for (r=thecache; r; r = r->next)
-     {
-@@ -386,6 +381,12 @@ agent_put_cache (const char *key, cache_mode_t cache_mode,
-       if (err)
-         log_error ("error inserting cache item: %s\n", gpg_strerror (err));
-     }
-+
-+ out:
-+  res = npth_mutex_unlock (&cache_lock);
-+  if (res)
-+    log_fatal ("failed to release cache mutex: %s\n", strerror (res));
-+
-   return err;
- }
- 
-@@ -405,15 +406,18 @@ agent_get_cache (const char *key, cache_mode_t cache_mode)
-   if (cache_mode == CACHE_MODE_IGNORE)
-     return NULL;
- 
-+  res = npth_mutex_lock (&cache_lock);
-+  if (res)
-+    log_fatal ("failed to acquire cache mutex: %s\n", strerror (res));
-+
-   if (!key)
-     {
-       key = last_stored_cache_key;
-       if (!key)
--        return NULL;
-+        goto out;
-       last_stored = 1;
-     }
- 
--
-   if (DBG_CACHE)
-     log_debug ("agent_get_cache '%s' (mode %d)%s ...\n",
-                key, cache_mode,
-@@ -440,17 +444,9 @@ agent_get_cache (const char *key, cache_mode_t cache_mode)
-             err = gpg_error_from_syserror ();
-           else
-             {
--              res = npth_mutex_lock (&encryption_lock);
--              if (res)
--                log_fatal ("failed to acquire cache encryption mutex: %s\n",
--			   strerror (res));
-               err = gcry_cipher_decrypt (encryption_handle,
-                                          value, r->pw->totallen - 8,
-                                          r->pw->data, r->pw->totallen);
--              res = npth_mutex_unlock (&encryption_lock);
--              if (res)
--                log_fatal ("failed to release cache encryption mutex: %s\n",
--			   strerror (res));
-             }
-           if (err)
-             {
-@@ -459,13 +455,18 @@ agent_get_cache (const char *key, cache_mode_t cache_mode)
-               log_error ("retrieving cache entry '%s' failed: %s\n",
-                          key, gpg_strerror (err));
-             }
--          return value;
-+          break;
-         }
-     }
--  if (DBG_CACHE)
-+  if (DBG_CACHE && value == NULL)
-     log_debug ("... miss\n");
- 
--  return NULL;
-+ out:
-+  res = npth_mutex_unlock (&cache_lock);
-+  if (res)
-+    log_fatal ("failed to release cache mutex: %s\n", strerror (res));
-+
-+  return value;
- }
- 
- 
diff --git a/debian/patches/0023-scd-Don-t-keep-CCID-reader-open-when-card-is-not-ava.patch b/debian/patches/0023-scd-Don-t-keep-CCID-reader-open-when-card-is-not-ava.patch
deleted file mode 100644
index a662eb1..0000000
--- a/debian/patches/0023-scd-Don-t-keep-CCID-reader-open-when-card-is-not-ava.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Fri, 7 Apr 2017 12:18:16 +0900
-Subject: scd: Don't keep CCID reader open when card is not available.
-
-* scd/apdu.c (open_ccid_reader): Fail if no ATR.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 3c93595d701c59cbc9b67a7fd0bcde7ee0fada1a)
----
- scd/apdu.c | 11 +++--------
- 1 file changed, 3 insertions(+), 8 deletions(-)
-
-diff --git a/scd/apdu.c b/scd/apdu.c
-index 147bf73..65f770d 100644
---- a/scd/apdu.c
-+++ b/scd/apdu.c
-@@ -1496,6 +1496,9 @@ open_ccid_reader (struct dev_list *dl)
- 
-   err = ccid_open_reader (dl->portstr, dl->idx, dl->ccid_table,
-                           &slotp->ccid.handle, &slotp->rdrname);
-+  if (!err)
-+    err = ccid_get_atr (slotp->ccid.handle,
-+                        slotp->atr, sizeof slotp->atr, &slotp->atrlen);
-   if (err)
-     {
-       slotp->used = 0;
-@@ -1503,14 +1506,6 @@ open_ccid_reader (struct dev_list *dl)
-       return -1;
-     }
- 
--  err = ccid_get_atr (slotp->ccid.handle,
--                      slotp->atr, sizeof slotp->atr, &slotp->atrlen);
--  if (err)
--    {
--      slotp->atrlen = 0;
--      err = 0;
--    }
--
-   require_get_status = ccid_require_get_status (slotp->ccid.handle);
- 
-   reader_table[slot].close_reader = close_ccid_reader;
diff --git a/debian/patches/0024-scd-Internal-CCID-reader-cleanup.patch b/debian/patches/0024-scd-Internal-CCID-reader-cleanup.patch
deleted file mode 100644
index 36cf5d3..0000000
--- a/debian/patches/0024-scd-Internal-CCID-reader-cleanup.patch
+++ /dev/null
@@ -1,449 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Fri, 7 Apr 2017 13:30:35 +0900
-Subject: scd: Internal CCID reader cleanup.
-
-* scd/ccid-reader.c (scan_usb_device): Only for scan mode, so, rename
-from scan_or_find_usb_device.
-(scan_devices): Likewise.  Remove support of special transport types.
-(ccid_get_reader_list): Simplify.
-(abort_cmd): Fix error return.
-(send_escape_cmd): Fix for RESULTLEN == NULL.
-(ccid_transceive_secure): Remove unnecessary var updates.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit cc420d34880e2a050b39f969873974cfc35fa5c3)
----
- scd/ccid-driver.c | 310 ++++++++----------------------------------------------
- 1 file changed, 41 insertions(+), 269 deletions(-)
-
-diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
-index a471adf..d135ca6 100644
---- a/scd/ccid-driver.c
-+++ b/scd/ccid-driver.c
-@@ -1129,21 +1129,11 @@ find_endpoint (const struct libusb_interface_descriptor *ifcdesc, int mode)
- }
- 
- 
--/* Helper for scan_or_find_devices. This function returns true if a
-+/* Helper for scan_devices. This function returns true if a
-    requested device has been found or the caller should stop scanning
-    for other reasons. */
--static int
--scan_or_find_usb_device (int scan_mode,
--                         int readerno, int *count, char **rid_list,
--                         const char *readerid,
--                         struct libusb_device *dev,
--                         char **r_rid,
--                         struct libusb_device_descriptor *desc,
--                         libusb_device_handle **r_idev,
--                         unsigned char **ifcdesc_extra,
--                         size_t *ifcdesc_extra_len,
--                         int *interface_number, int *setting_number,
--                         int *ep_bulk_out, int *ep_bulk_in, int *ep_intr)
-+static void
-+scan_usb_device (int *count, char **rid_list, struct libusb_device *dev)
- {
-   int ifc_no;
-   int set_no;
-@@ -1152,16 +1142,16 @@ scan_or_find_usb_device (int scan_mode,
-   libusb_device_handle *idev = NULL;
-   int err;
-   struct libusb_config_descriptor *config;
-+  struct libusb_device_descriptor desc;
-+  char *p;
- 
--  err = libusb_get_device_descriptor (dev, desc);
-+  err = libusb_get_device_descriptor (dev, &desc);
-   if (err)
--    return 0;
--
--  *r_idev = NULL;
-+    return;
- 
-   err = libusb_get_active_config_descriptor (dev, &config);
-   if (err)
--    return 0;
-+    return;
- 
-   for (ifc_no=0; ifc_no < config->bNumInterfaces; ifc_no++)
-     for (set_no=0; set_no < config->interface[ifc_no].num_altsetting; set_no++)
-@@ -1177,15 +1167,13 @@ scan_or_find_usb_device (int scan_mode,
-                  && ifcdesc->bInterfaceSubClass == 0
-                  && ifcdesc->bInterfaceProtocol == 0)
-                 || (ifcdesc->bInterfaceClass == 255
--                    && desc->idVendor == VENDOR_SCM
--                    && desc->idProduct == SCM_SPR532)
-+                    && desc.idVendor == VENDOR_SCM
-+                    && desc.idProduct == SCM_SPR532)
-                 || (ifcdesc->bInterfaceClass == 255
--                    && desc->idVendor == VENDOR_CHERRY
--                    && desc->idProduct == CHERRY_ST2000)))
-+                    && desc.idVendor == VENDOR_CHERRY
-+                    && desc.idProduct == CHERRY_ST2000)))
-           {
-             ++*count;
--            if (!scan_mode && ((readerno > 0 && readerno != *count - 1)))
--              continue;
- 
-             err = libusb_open (dev, &idev);
-             if (err)
-@@ -1194,89 +1182,36 @@ scan_or_find_usb_device (int scan_mode,
-                 continue; /* with next setting. */
-               }
- 
--            rid = make_reader_id (idev, desc->idVendor, desc->idProduct,
--                                  desc->iSerialNumber);
-+            rid = make_reader_id (idev, desc.idVendor, desc.idProduct,
-+                                  desc.iSerialNumber);
-             if (!rid)
-               {
-                 libusb_free_config_descriptor (config);
--                return 0;
-+                return;
-               }
- 
--            if (!scan_mode && readerno == -1 && readerid
--                && strncmp (rid, readerid, strlen (readerid)))
--              continue;
--
--            if (scan_mode)
-+            /* We are collecting infos about all available CCID
-+               readers.  Store them and continue.  */
-+            DEBUGOUT_2 ("found CCID reader %d (ID=%s)\n", *count, rid);
-+            p = malloc ((*rid_list? strlen (*rid_list):0) + 1
-+                        + strlen (rid) + 1);
-+            if (p)
-               {
--                char *p;
--
--                /* We are collecting infos about all
--                   available CCID readers.  Store them and
--                   continue. */
--                DEBUGOUT_2 ("found CCID reader %d (ID=%s)\n", *count, rid);
--                p = malloc ((*rid_list? strlen (*rid_list):0) + 1
--                            + strlen (rid) + 1);
--                if (p)
--                  {
--                    *p = 0;
--                    if (*rid_list)
--                      {
--                        strcat (p, *rid_list);
--                        free (*rid_list);
--                      }
--                    strcat (p, rid);
--                    strcat (p, "\n");
--                    *rid_list = p;
--                  }
--                else /* Out of memory. */
-+                *p = 0;
-+                if (*rid_list)
-                   {
--                    libusb_free_config_descriptor (config);
--                    free (rid);
--                    return 0;
-+                    strcat (p, *rid_list);
-+                    free (*rid_list);
-                   }
-+                strcat (p, rid);
-+                strcat (p, "\n");
-+                *rid_list = p;
-               }
--            else
-+            else /* Out of memory. */
-               {
--                /* We found the requested reader. */
--                if (ifcdesc_extra && ifcdesc_extra_len)
--                  {
--                    *ifcdesc_extra = malloc (ifcdesc->extra_length);
--                    if (!*ifcdesc_extra)
--                      {
--                        libusb_close (idev);
--                        free (rid);
--                        libusb_free_config_descriptor (config);
--                        return 1; /* Out of core. */
--                      }
--                    memcpy (*ifcdesc_extra, ifcdesc->extra,
--                            ifcdesc->extra_length);
--                    *ifcdesc_extra_len = ifcdesc->extra_length;
--                  }
--
--                if (interface_number)
--                  *interface_number = ifc_no;
--
--                if (setting_number)
--                  *setting_number = set_no;
--
--                if (ep_bulk_out)
--                  *ep_bulk_out = find_endpoint (ifcdesc, 0);
--                if (ep_bulk_in)
--                  *ep_bulk_in = find_endpoint (ifcdesc, 1);
--                if (ep_intr)
--                  *ep_intr = find_endpoint (ifcdesc, 2);
--
--                if (r_rid)
--                  {
--                    *r_rid = rid;
--                    rid = NULL;
--                  }
--                else
--                  free (rid);
--
--                *r_idev = idev;
-                 libusb_free_config_descriptor (config);
--                return 1; /* Found requested device. */
-+                free (rid);
-+                return;
-               }
- 
-             free (rid);
-@@ -1286,205 +1221,44 @@ scan_or_find_usb_device (int scan_mode,
-       }
- 
-   libusb_free_config_descriptor (config);
--
--  return 0;
- }
- 
--/* Combination function to either scan all CCID devices or to find and
--   open one specific device.
-+/* Scan all CCID devices.
- 
-    The function returns 0 if a reader has been found or when a scan
-    returned without error.
- 
--   With READERNO = -1 and READERID is NULL, scan mode is used and
-    R_RID should be the address where to store the list of reader_ids
-    we found.  If on return this list is empty, no CCID device has been
-    found; otherwise it points to an allocated linked list of reader
--   IDs.  Note that in this mode the function always returns NULL.
--
--   With READERNO >= 0 or READERID is not NULL find mode is used.  This
--   uses the same algorithm as the scan mode but stops and returns at
--   the entry number READERNO and return the handle for the opened
--   USB device. If R_RID is not NULL it will receive the reader ID of
--   that device.  If R_DEV is not NULL it will the device pointer of
--   that device.  If IFCDESC_EXTRA is NOT NULL it will receive a
--   malloced copy of the interfaces "extra: data filed;
--   IFCDESC_EXTRA_LEN receive the length of this field.  If there is
--   no reader with number READERNO or that reader is not usable by our
--   implementation NULL will be returned.  The caller must close a
--   returned USB device handle and free (if not passed as NULL) the
--   returned reader ID info as well as the IFCDESC_EXTRA.  On error
--   NULL will get stored at R_RID, R_DEV, IFCDESC_EXTRA and
--   IFCDESC_EXTRA_LEN.  With READERID being -1 the function stops if
--   the READERID was found.
--
--   If R_FD is not -1 on return the device is not using USB for
--   transport but the device associated with that file descriptor.  In
--   this case INTERFACE will receive the transport type and the other
--   USB specific return values are not used; the return value is
--   (void*)(1).
--
--   Note that the first entry of the returned reader ID list in scan mode
--   corresponds with a READERNO of 0 in find mode.
-+   IDs.
- */
- static int
--scan_or_find_devices (int readerno, const char *readerid,
--                      char **r_rid,
--                      struct libusb_device_descriptor *r_desc,
--                      unsigned char **ifcdesc_extra,
--                      size_t *ifcdesc_extra_len,
--                      int *interface_number, int *setting_number,
--                      int *ep_bulk_out, int *ep_bulk_in, int *ep_intr,
--                      libusb_device_handle **r_idev,
--                      int *r_fd)
-+scan_devices (char **r_rid)
- {
-   char *rid_list = NULL;
-   int count = 0;
-   libusb_device **dev_list = NULL;
-   libusb_device *dev;
--  libusb_device_handle *idev = NULL;
--  int scan_mode = (readerno == -1 && !readerid);
-   int i;
-   ssize_t n;
--  struct libusb_device_descriptor desc;
- 
-   /* Set return values to a default. */
-   if (r_rid)
-     *r_rid = NULL;
--  if (ifcdesc_extra)
--    *ifcdesc_extra = NULL;
--  if (ifcdesc_extra_len)
--    *ifcdesc_extra_len = 0;
--  if (interface_number)
--    *interface_number = 0;
--  if (setting_number)
--    *setting_number = 0;
--  if (r_idev)
--    *r_idev = NULL;
--  if (r_fd)
--    *r_fd = -1;
--
--  /* See whether we want scan or find mode. */
--  if (scan_mode)
--    {
--      assert (r_rid);
--    }
- 
-   n = libusb_get_device_list (NULL, &dev_list);
- 
-   for (i = 0; i < n; i++)
-     {
-       dev = dev_list[i];
--      if (scan_or_find_usb_device (scan_mode, readerno, &count, &rid_list,
--                                   readerid,
--                                   dev,
--                                   r_rid,
--                                   &desc,
--                                   &idev,
--                                   ifcdesc_extra,
--                                   ifcdesc_extra_len,
--                                   interface_number, setting_number,
--                                   ep_bulk_out, ep_bulk_in, ep_intr))
--        {
--          libusb_free_device_list (dev_list, 1);
--          /* Found requested device or out of core. */
--          if (!idev)
--            {
--              free (rid_list);
--              return -1; /* error */
--            }
--          *r_idev = idev;
--          if (r_desc)
--            memcpy (r_desc, &desc, sizeof (struct libusb_device_descriptor));
--          return 0;
--        }
-+      scan_usb_device (&count, &rid_list, dev);
-     }
- 
-   libusb_free_device_list (dev_list, 1);
- 
--  /* Now check whether there are any devices with special transport types. */
--  for (i=0; transports[i].name; i++)
--    {
--      int fd;
--      char *rid, *p;
--
--      fd = open (transports[i].name, O_RDWR);
--      if (fd == -1 && scan_mode && errno == EBUSY)
--        {
--          /* Ignore this error in scan mode because it indicates that
--             the device exists but is already open (most likely by us)
--             and thus in general suitable as a reader.  */
--        }
--      else if (fd == -1)
--        {
--          DEBUGOUT_2 ("failed to open '%s': %s\n",
--                     transports[i].name, strerror (errno));
--          continue;
--        }
--
--      rid = malloc (strlen (transports[i].name) + 30 + 10);
--      if (!rid)
--        {
--          if (fd != -1)
--            close (fd);
--          free (rid_list);
--          return -1; /* Error. */
--        }
--      sprintf (rid, "0000:%04X:%s:0", transports[i].type, transports[i].name);
--      if (scan_mode)
--        {
--          DEBUGOUT_2 ("found CCID reader %d (ID=%s)\n", count, rid);
--          p = malloc ((rid_list? strlen (rid_list):0) + 1 + strlen (rid) + 1);
--          if (!p)
--            {
--              if (fd != -1)
--                close (fd);
--              free (rid_list);
--              free (rid);
--              return -1; /* Error. */
--            }
--          *p = 0;
--          if (rid_list)
--            {
--              strcat (p, rid_list);
--              free (rid_list);
--            }
--          strcat (p, rid);
--          strcat (p, "\n");
--          rid_list = p;
--          ++count;
--        }
--      else if (!readerno ||
--               (readerno < 0 && readerid && !strcmp (readerid, rid)))
--        {
--          /* Found requested device. */
--          if (interface_number)
--            *interface_number = transports[i].type;
--          if (r_rid)
--            *r_rid = rid;
--          else
--            free (rid);
--          if (r_fd)
--            *r_fd = fd;
--          return 0; /* Okay, found device */
--        }
--      else /* This is not yet the reader we want. */
--        {
--          if (readerno >= 0)
--            --readerno;
--        }
--      free (rid);
--      if (fd != -1)
--        close (fd);
--    }
--
--  if (scan_mode)
--    {
--      *r_rid = rid_list;
--      return 0;
--    }
--  else
--    return -1;
-+  *r_rid = rid_list;
-+  return 0;
- }
- 
- 
-@@ -1517,8 +1291,7 @@ ccid_get_reader_list (void)
-       initialized_usb = 1;
-     }
- 
--  if (scan_or_find_devices (-1, NULL, &reader_list, NULL, NULL, NULL, NULL,
--                            NULL, NULL, NULL, NULL, NULL, NULL))
-+  if (scan_devices (&reader_list))
-     return NULL; /* Error. */
-   return reader_list;
- }
-@@ -2484,7 +2257,7 @@ abort_cmd (ccid_driver_t handle, int seqno)
-   if (!handle->idev)
-     {
-       /* I don't know how to send an abort to non-USB devices.  */
--      rc = CCID_DRIVER_ERR_NOT_SUPPORTED;
-+      return CCID_DRIVER_ERR_NOT_SUPPORTED;
-     }
- 
-   seqno &= 0xff;
-@@ -2639,7 +2412,8 @@ send_escape_cmd (ccid_driver_t handle,
-           else
-             {
-               memcpy (result, msg, msglen);
--              *resultlen = msglen;
-+              if (resultlen)
-+                *resultlen = msglen;
-               rc = 0;
-             }
-         }
-@@ -4006,9 +3780,7 @@ ccid_transceive_secure (ccid_driver_t handle,
-             }
- 
-           memcpy (resp, p, n);
--          resp += n;
-           *nresp += n;
--          maxresplen -= n;
-         }
- 
-       if (!(tpdu[1] & 0x20))
diff --git a/debian/patches/0025-gpg-Fix-printing-of-offline-taken-subkey.patch b/debian/patches/0025-gpg-Fix-printing-of-offline-taken-subkey.patch
deleted file mode 100644
index fe88391..0000000
--- a/debian/patches/0025-gpg-Fix-printing-of-offline-taken-subkey.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From: Werner Koch <wk at gnupg.org>
-Date: Fri, 7 Apr 2017 10:11:07 +0200
-Subject: gpg: Fix printing of offline taken subkey.
-
-* g10/keylist.c (list_keyblock_print): Set SECRET to 2 and not 0x32.
---
-
-Reported-by: Danielle McLean <dani at 00dani.me>
-Signed-off-by: Werner Koch <wk at gnupg.org>
-(cherry picked from commit 547bc01d57528ecc27b3b5e16797967a7f88fecf)
----
- g10/keylist.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/g10/keylist.c b/g10/keylist.c
-index 2b6ee9f..c75856f 100644
---- a/g10/keylist.c
-+++ b/g10/keylist.c
-@@ -1016,7 +1016,7 @@ list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr,
-               if (!agent_get_keyinfo (NULL, hexgrip, &serialno, NULL))
-                 secret = serialno? 3 : 1;
-               else
--                secret = '2';  /* Key not found.  */
-+                secret = 2;  /* Key not found.  */
-             }
- 
-           /* Print the "sub" line.  */
diff --git a/debian/patches/0026-doc-Explain-the-in-a-key-listing.patch b/debian/patches/0026-doc-Explain-the-in-a-key-listing.patch
deleted file mode 100644
index fd7d5bd..0000000
--- a/debian/patches/0026-doc-Explain-the-in-a-key-listing.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From: Werner Koch <wk at gnupg.org>
-Date: Fri, 7 Apr 2017 10:26:55 +0200
-Subject: doc: Explain the '>' in a key listing.
-
---
-
-Signed-off-by: Werner Koch <wk at gnupg.org>
-(cherry picked from commit 9c9fde1495be4accf4526a2626110876fd9d788d)
----
- doc/gpg.texi | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/doc/gpg.texi b/doc/gpg.texi
-index 37e1ff1..c0d7cc4 100644
---- a/doc/gpg.texi
-+++ b/doc/gpg.texi
-@@ -301,10 +301,13 @@ and other programs.
- @itemx -K
- @opindex list-secret-keys
- List the specified secret keys.  If no keys are specified, then all
--known secret keys are listed.  A @code{#} after the letters @code{sec}
--means that the secret key is not usable (for example, if it was
--exported using @option{--export-secret-subkeys}).  See also
-- at option{--list-keys}.
-+known secret keys are listed.  A @code{#} after the intial tags
-+ at code{sec} or @code{ssb} means that the secret key or subkey is
-+currently not usable.  We also say that this key has been taken
-+offline (for example, a primary key can be taken offline by exported
-+the key using the command @option{--export-secret-subkeys}).  A
-+ at code{>} after these tags indicate that the key is stored on a
-+smartcard.  See also @option{--list-keys}.
- 
- @item --list-signatures
- @opindex list-signatures
diff --git a/debian/patches/0027-gpgscm-Fix-compact-vector-encoding.patch b/debian/patches/0027-gpgscm-Fix-compact-vector-encoding.patch
deleted file mode 100644
index 16ad861..0000000
--- a/debian/patches/0027-gpgscm-Fix-compact-vector-encoding.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Fri, 7 Apr 2017 12:27:47 +0200
-Subject: gpgscm: Fix compact vector encoding.
-
-* tests/gpgscm/scheme-private.h (struct cell): Use uintptr_t for
-'_flags'.  This way, '_flags' has the size of a machine word.
---
-
-The compact vector representation introduced in 49e2ae65 requires that
-we can tell apart pointers and type flags.  This did not work on
-64-bit big-endian architectures.
-
-Fixes a crash on 64-bit big-endian architectures.
-
-Hat-tip-to: gniibe
-Fixes-commit: 49e2ae65e892f93be7f87cfaae3392b50a99e4b1
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit bf8b5e9042b3d86d419b2ac1987a9298c9d21500)
----
- tests/gpgscm/scheme-private.h | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h
-index abd89e8..fe50135 100644
---- a/tests/gpgscm/scheme-private.h
-+++ b/tests/gpgscm/scheme-private.h
-@@ -3,6 +3,7 @@
- #ifndef _SCHEME_PRIVATE_H
- #define _SCHEME_PRIVATE_H
- 
-+#include <stdint.h>
- #include "scheme.h"
- /*------------------ Ugly internals -----------------------------------*/
- /*------------------ Of interest only to FFI users --------------------*/
-@@ -42,7 +43,7 @@ typedef struct port {
- 
- /* cell structure */
- struct cell {
--  unsigned int _flag;
-+  uintptr_t _flag;
-   union {
-     struct {
-       char   *_svalue;
diff --git a/debian/patches/0028-gpgscm-Remove-arbitrary-limit-on-number-of-cell-segm.patch b/debian/patches/0028-gpgscm-Remove-arbitrary-limit-on-number-of-cell-segm.patch
deleted file mode 100644
index 39a5c2b..0000000
--- a/debian/patches/0028-gpgscm-Remove-arbitrary-limit-on-number-of-cell-segm.patch
+++ /dev/null
@@ -1,285 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Wed, 22 Mar 2017 16:22:57 +0100
-Subject: gpgscm: Remove arbitrary limit on number of cell segments.
-
-* tests/gpgscm/scheme-private.h (struct scheme): Remove fixed-size
-arrays for cell segments, replace them with a pointer to the new
-'struct cell_segment' instead.
-* tests/gpgscm/scheme.c (struct cell_segment): New definition.
-(_alloc_cellseg): Allocate the header within the segment, return a
-pointer to the header.
-(_dealloc_cellseg): New function.
-(alloc_cellseg): Insert the segments into a list.
-(_get_cell): Allocate a new segment if less than a quarter of
-CELL_SIGSIZE is recovered during garbage collection.
-(initialize_small_integers): Adapt callsite.
-(gc): Walk the list of segments.
-(scheme_init_custom_alloc): Remove initialization of removed field.
-(scheme_deinit): Adapt deallocation.
---
-
-Previously the number of cells that could be allocated was a
-compile-time limit.  Remove this limit.
-
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit 56638c28adc1bbe9fc052b92549a50935c0fe99c)
----
- tests/gpgscm/scheme-private.h |  10 +---
- tests/gpgscm/scheme.c         | 108 ++++++++++++++++++++++++++++--------------
- 2 files changed, 74 insertions(+), 44 deletions(-)
-
-diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h
-index fe50135..093442f 100644
---- a/tests/gpgscm/scheme-private.h
-+++ b/tests/gpgscm/scheme-private.h
-@@ -108,12 +108,7 @@ int tracing;
- #ifndef CELL_SEGSIZE
- #define CELL_SEGSIZE    5000  /* # of cells in one segment */
- #endif
--#ifndef CELL_NSEGMENT
--#define CELL_NSEGMENT   10    /* # of segments for cells */
--#endif
--void *alloc_seg[CELL_NSEGMENT];
--pointer cell_seg[CELL_NSEGMENT];
--int     last_cell_seg;
-+struct cell_segment *cell_segments;
- 
- /* We use 4 registers. */
- pointer args;            /* register for arguments of function */
-@@ -159,8 +154,7 @@ pointer COMPILE_HOOK;  /* *compile-hook* */
- 
- #if USE_SMALL_INTEGERS
- /* A fixed allocation of small integers.  */
--void *integer_alloc;
--pointer integer_cells;
-+struct cell_segment *integer_segment;
- #endif
- 
- pointer free_cell;       /* pointer to top of free cells */
-diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
-index aa0cf69..08b53a1 100644
---- a/tests/gpgscm/scheme.c
-+++ b/tests/gpgscm/scheme.c
-@@ -725,9 +725,26 @@ get_tag(scheme *sc, pointer v)
- 
- 

- 
-+/* Low-level allocator.
-+ *
-+ * Memory is allocated in segments.  Every segment holds a fixed
-+ * number of cells.  Segments are linked into a list, sorted in
-+ * reverse address order (i.e. those with a higher address first).
-+ * This is used in the garbage collector to build the freelist in
-+ * address order.
-+ */
-+
-+struct cell_segment
-+{
-+     struct cell_segment *next;
-+     void *alloc;
-+     pointer cells;
-+     size_t cells_len;
-+};
-+
- /* Allocate a new cell segment but do not make it available yet.  */
- static int
--_alloc_cellseg(scheme *sc, size_t len, void **alloc, pointer *cells)
-+_alloc_cellseg(scheme *sc, size_t len, struct cell_segment **segment)
- {
-   int adj = ADJ;
-   void *cp;
-@@ -735,46 +752,64 @@ _alloc_cellseg(scheme *sc, size_t len, void **alloc, pointer *cells)
-   if (adj < sizeof(struct cell))
-     adj = sizeof(struct cell);
- 
--  cp = sc->malloc(len * sizeof(struct cell) + adj);
-+  /* The segment header is conveniently allocated with the cells.  */
-+  cp = sc->malloc(sizeof **segment + len * sizeof(struct cell) + adj);
-   if (cp == NULL)
-     return 1;
- 
--  *alloc = cp;
-+  *segment = cp;
-+  (*segment)->next = NULL;
-+  (*segment)->alloc = cp;
-+  cp = (void *) ((uintptr_t) cp + sizeof **segment);
- 
-   /* adjust in TYPE_BITS-bit boundary */
-   if (((uintptr_t) cp) % adj != 0)
-     cp = (void *) (adj * ((uintptr_t) cp / adj + 1));
- 
--  *cells = cp;
-+  (*segment)->cells = cp;
-+  (*segment)->cells_len = len;
-   return 0;
- }
- 
-+/* Deallocate a cell segment.  Returns the next cell segment.
-+ * Convenient for deallocation in a loop.  */
-+static struct cell_segment *
-+_dealloc_cellseg(scheme *sc, struct cell_segment *segment)
-+{
-+
-+  struct cell_segment *next;
-+
-+  if (segment == NULL)
-+    return NULL;
-+
-+  next = segment->next;
-+  sc->free(segment->alloc);
-+  return next;
-+}
-+
- /* allocate new cell segment */
- static int alloc_cellseg(scheme *sc, int n) {
--     pointer newp;
-      pointer last;
-      pointer p;
--     long i;
-      int k;
- 
-      for (k = 0; k < n; k++) {
--         if (sc->last_cell_seg >= CELL_NSEGMENT - 1)
--              return k;
--	 i = ++sc->last_cell_seg;
--	 if (_alloc_cellseg(sc, CELL_SEGSIZE, &sc->alloc_seg[i], &newp)) {
--	      sc->last_cell_seg--;
-+	 struct cell_segment *new, **s;
-+	 if (_alloc_cellseg(sc, CELL_SEGSIZE, &new)) {
- 	      return k;
- 	 }
--         /* insert new segment in address order */
--         sc->cell_seg[i] = newp;
--         while (i > 0 && sc->cell_seg[i - 1] > sc->cell_seg[i]) {
--             p = sc->cell_seg[i];
--             sc->cell_seg[i] = sc->cell_seg[i - 1];
--             sc->cell_seg[--i] = p;
--         }
--         sc->fcells += CELL_SEGSIZE;
--         last = newp + CELL_SEGSIZE - 1;
--         for (p = newp; p <= last; p++) {
-+	 /* insert new segment in reverse address order */
-+	 for (s = &sc->cell_segments;
-+	      *s && (uintptr_t) (*s)->alloc > (uintptr_t) new->alloc;
-+	      s = &(*s)->next) {
-+	     /* walk */
-+	 }
-+	 new->next = *s;
-+	 *s = new;
-+
-+         sc->fcells += new->cells_len;
-+         last = new->cells + new->cells_len - 1;
-+          for (p = new->cells; p <= last; p++) {
-               typeflag(p) = 0;
-               cdr(p) = p + 1;
-               car(p) = sc->NIL;
-@@ -782,13 +817,13 @@ static int alloc_cellseg(scheme *sc, int n) {
-          /* insert new cells in address order on free list */
-          if (sc->free_cell == sc->NIL || p < sc->free_cell) {
-               cdr(last) = sc->free_cell;
--              sc->free_cell = newp;
-+              sc->free_cell = new->cells;
-          } else {
-                p = sc->free_cell;
--               while (cdr(p) != sc->NIL && newp > cdr(p))
-+               while (cdr(p) != sc->NIL && (uintptr_t) new->cells > (uintptr_t) cdr(p))
-                     p = cdr(p);
-                cdr(last) = cdr(p);
--               cdr(p) = newp;
-+               cdr(p) = new->cells;
-          }
-      }
-      return n;
-@@ -922,7 +957,7 @@ static pointer _get_cell(scheme *sc, pointer a, pointer b) {
- 
-   assert (gc_enabled (sc));
-   if (sc->free_cell == sc->NIL) {
--    const int min_to_be_recovered = sc->last_cell_seg*8;
-+    const int min_to_be_recovered = CELL_SEGSIZE / 4;
-     gc(sc,a, b);
-     if (sc->fcells < min_to_be_recovered
-         || sc->free_cell == sc->NIL) {
-@@ -1283,12 +1318,11 @@ static int
- initialize_small_integers(scheme *sc)
- {
-   int i;
--  if (_alloc_cellseg(sc, MAX_SMALL_INTEGER, &sc->integer_alloc,
--		     &sc->integer_cells))
-+  if (_alloc_cellseg(sc, MAX_SMALL_INTEGER, &sc->integer_segment))
-     return 1;
- 
-   for (i = 0; i < MAX_SMALL_INTEGER; i++) {
--    pointer x = &sc->integer_cells[i];
-+    pointer x = &sc->integer_segment->cells[i];
-     typeflag(x) = T_NUMBER | T_ATOM | MARK;
-     ivalue_unchecked(x) = i;
-     set_num_integer(x);
-@@ -1302,7 +1336,7 @@ mk_small_integer(scheme *sc, long n)
- {
- #define mk_small_integer_allocates	0
-   assert(0 <= n && n < MAX_SMALL_INTEGER);
--  return &sc->integer_cells[n];
-+  return &sc->integer_segment->cells[n];
- }
- #else
- 
-@@ -1666,6 +1700,7 @@ E6:   /* up.  Undo the link switching from steps E4 and E5. */
- /* garbage collection. parameter a, b is marked. */
- static void gc(scheme *sc, pointer a, pointer b) {
-   pointer p;
-+  struct cell_segment *s;
-   int i;
- 
-   assert (gc_enabled (sc));
-@@ -1712,9 +1747,9 @@ static void gc(scheme *sc, pointer a, pointer b) {
-      (which are also kept sorted by address) downwards to build the
-      free-list in sorted order.
-   */
--  for (i = sc->last_cell_seg; i >= 0; i--) {
--    p = sc->cell_seg[i] + CELL_SEGSIZE;
--    while (--p >= sc->cell_seg[i]) {
-+  for (s = sc->cell_segments; s; s = s->next) {
-+    p = s->cells + s->cells_len;
-+    while (--p >= s->cells) {
-       if ((typeflag(p) & 1) == 0)
- 	/* All types have the LSB set.  This is not a typeflag.  */
- 	continue;
-@@ -5592,7 +5627,6 @@ int scheme_init_custom_alloc(scheme *sc, func_alloc malloc, func_dealloc free) {
-   sc->gensym_cnt=0;
-   sc->malloc=malloc;
-   sc->free=free;
--  sc->last_cell_seg = -1;
-   sc->sink = &sc->_sink;
-   sc->NIL = &sc->_NIL;
-   sc->T = &sc->_HASHT;
-@@ -5626,6 +5660,7 @@ int scheme_init_custom_alloc(scheme *sc, func_alloc malloc, func_dealloc free) {
-   }
-   sc->strbuff_size = STRBUFFSIZE;
- 
-+  sc->cell_segments = NULL;
-   if (alloc_cellseg(sc,FIRST_CELLSEGS) != FIRST_CELLSEGS) {
-     sc->no_memory=1;
-     return 0;
-@@ -5726,6 +5761,7 @@ void scheme_set_external_data(scheme *sc, void *p) {
- }
- 
- void scheme_deinit(scheme *sc) {
-+  struct cell_segment *s;
-   int i;
- 
-   sc->oblist=sc->NIL;
-@@ -5758,11 +5794,11 @@ void scheme_deinit(scheme *sc) {
-   gc(sc,sc->NIL,sc->NIL);
- 
- #if USE_SMALL_INTEGERS
--  sc->free(sc->integer_alloc);
-+  _dealloc_cellseg(sc, sc->integer_segment);
- #endif
- 
--  for(i=0; i<=sc->last_cell_seg; i++) {
--    sc->free(sc->alloc_seg[i]);
-+  for (s = sc->cell_segments; s; s = _dealloc_cellseg(sc, s)) {
-+    /* nop */
-   }
-   sc->free(sc->strbuff);
- }
diff --git a/debian/patches/0029-gpgscm-Make-global-data-constant-when-possible.patch b/debian/patches/0029-gpgscm-Make-global-data-constant-when-possible.patch
deleted file mode 100644
index 673de95..0000000
--- a/debian/patches/0029-gpgscm-Make-global-data-constant-when-possible.patch
+++ /dev/null
@@ -1,156 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Thu, 23 Mar 2017 12:50:27 +0100
-Subject: gpgscm: Make global data constant when possible.
-
-* tests/gpgscm/scheme-private.h (struct scheme): Make 'vptr' const.
-* tests/gpgscm/scheme.c (num_zero): Statically initialize and turn
-into constant.
-(num_one): Likewise.
-(charnames): Change type so that it can be stored in rodata.
-(is_ascii_name): Adapt slightly.
-(assign_proc): Make argument const char *.
-(op_code_info): Make some fields const char *.
-(tests): Make const.
-(dispatch_table): Make const.  At least it can be made read-only after
-relocation.
-(Eval_Cycle): Adapt slightly.
-(vtbl): Make const.
-
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit c9c3fe883271868d3b2dd287d295cf6a8f8ffc05)
----
- tests/gpgscm/scheme-private.h |  2 +-
- tests/gpgscm/scheme.c         | 32 ++++++++++++++------------------
- 2 files changed, 15 insertions(+), 19 deletions(-)
-
-diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h
-index 093442f..69b78f2 100644
---- a/tests/gpgscm/scheme-private.h
-+++ b/tests/gpgscm/scheme-private.h
-@@ -200,7 +200,7 @@ unsigned int flags;
- void *ext_data;     /* For the benefit of foreign functions */
- long gensym_cnt;
- 
--struct scheme_interface *vptr;
-+const struct scheme_interface *vptr;
- };
- 
- /* operator code */
-diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
-index 08b53a1..c37b568 100644
---- a/tests/gpgscm/scheme.c
-+++ b/tests/gpgscm/scheme.c
-@@ -205,8 +205,8 @@ static INLINE int num_is_integer(pointer p) {
-   return ((p)->_object._number.is_fixnum);
- }
- 
--static num num_zero;
--static num num_one;
-+static const struct num num_zero = { 1, {0} };
-+static const struct num num_one  = { 1, {1} };
- 
- /* macros for cell operations */
- #define typeflag(p)      ((p)->_flag)
-@@ -339,7 +339,7 @@ static INLINE int Cislower(int c) { return isascii(c) && islower(c); }
- #endif
- 
- #if USE_ASCII_NAMES
--static const char *charnames[32]={
-+static const char charnames[32][3]={
-  "nul",
-  "soh",
-  "stx",
-@@ -377,12 +377,12 @@ static const char *charnames[32]={
- static int is_ascii_name(const char *name, int *pc) {
-   int i;
-   for(i=0; i<32; i++) {
--     if(stricmp(name,charnames[i])==0) {
-+     if (strncasecmp(name, charnames[i], 3) == 0) {
-           *pc=i;
-           return 1;
-      }
-   }
--  if(stricmp(name,"del")==0) {
-+  if (strcasecmp(name, "del") == 0) {
-      *pc=127;
-      return 1;
-   }
-@@ -447,7 +447,7 @@ static pointer opexe_6(scheme *sc, enum scheme_opcodes op);
- static void Eval_Cycle(scheme *sc, enum scheme_opcodes op);
- static void assign_syntax(scheme *sc, char *name);
- static int syntaxnum(pointer p);
--static void assign_proc(scheme *sc, enum scheme_opcodes, char *name);
-+static void assign_proc(scheme *sc, enum scheme_opcodes, const char *name);
- 
- #define num_ivalue(n)       (n.is_fixnum?(n).value.ivalue:(long)(n).value.rvalue)
- #define num_rvalue(n)       (!n.is_fixnum?(n).value.rvalue:(double)(n).value.ivalue)
-@@ -5308,7 +5308,7 @@ static int is_nonneg(pointer p) {
- }
- 
- /* Correspond carefully with following defines! */
--static struct {
-+static const struct {
-   test_predicate fct;
-   const char *kind;
- } tests[]={
-@@ -5347,17 +5347,18 @@ static struct {
- 
- typedef struct {
-   dispatch_func func;
--  char *name;
-+  const char *name;
-   int min_arity;
-   int max_arity;
--  char *arg_tests_encoding;
-+  const char *arg_tests_encoding;
- } op_code_info;
- 
- #define INF_ARG 0xffff
- 
--static op_code_info dispatch_table[]= {
-+static const op_code_info dispatch_table[]= {
- #define _OP_DEF(A,B,C,D,E,OP) {A,B,C,D,E},
- #include "opdefines.h"
-+#undef _OP_DEF
-   { 0 }
- };
- 
-@@ -5374,7 +5375,7 @@ static const char *procname(pointer x) {
- static void Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
-   sc->op = op;
-   for (;;) {
--    op_code_info *pcd=dispatch_table+sc->op;
-+    const op_code_info *pcd=dispatch_table+sc->op;
-     if (pcd->name!=0) { /* if built-in function, check arguments */
-       char msg[STRBUFFSIZE];
-       int ok=1;
-@@ -5457,7 +5458,7 @@ static void assign_syntax(scheme *sc, char *name) {
-      typeflag(x) |= T_SYNTAX;
- }
- 
--static void assign_proc(scheme *sc, enum scheme_opcodes op, char *name) {
-+static void assign_proc(scheme *sc, enum scheme_opcodes op, const char *name) {
-      pointer x, y;
- 
-      x = mk_symbol(sc, name);
-@@ -5519,7 +5520,7 @@ INTERFACE static pointer s_immutable_cons(scheme *sc, pointer a, pointer b) {
-  return immutable_cons(sc,a,b);
- }
- 
--static struct scheme_interface vtbl ={
-+static const struct scheme_interface vtbl = {
-   scheme_define,
-   s_cons,
-   s_immutable_cons,
-@@ -5616,11 +5617,6 @@ int scheme_init_custom_alloc(scheme *sc, func_alloc malloc, func_dealloc free) {
-   int i, n=sizeof(dispatch_table)/sizeof(dispatch_table[0]);
-   pointer x;
- 
--  num_zero.is_fixnum=1;
--  num_zero.value.ivalue=0;
--  num_one.is_fixnum=1;
--  num_one.value.ivalue=1;
--
- #if USE_INTERFACE
-   sc->vptr=&vtbl;
- #endif
diff --git a/debian/patches/0030-gpgscm-Allocate-small-integers-in-the-rodata-section.patch b/debian/patches/0030-gpgscm-Allocate-small-integers-in-the-rodata-section.patch
deleted file mode 100644
index 1484856..0000000
--- a/debian/patches/0030-gpgscm-Allocate-small-integers-in-the-rodata-section.patch
+++ /dev/null
@@ -1,1011 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Thu, 23 Mar 2017 15:21:36 +0100
-Subject: gpgscm: Allocate small integers in the rodata section.
-
-* tests/gpgscm/Makefile.am (gpgscm_SOURCES): Add new file.
-* tests/gpgscm/scheme-private.h (struct cell): Move number to the top
-of the union so that we can initialize it.
-(struct scheme): Remove 'integer_segment'.
-* tests/gpgscm/scheme.c (initialize_small_integers): Remove function.
-(small_integers): New variable.
-(MAX_SMALL_INTEGER): Compute.
-(mk_small_integer): Adapt.
-(mark): Avoid marking objects already marked.  This allows us to run
-the algorithm over objects in the rodata section if they are already
-marked.
-(scheme_init_custom_alloc): Remove initialization.
-(scheme_deinit): Remove deallocation.
-* tests/gpgscm/small-integers.h: New file.
---
-
-Allocate small integers from a fixed pool in the rodata section.  This
-spares us the initialization, and deduplicates integers across
-different processes.  It also makes the integers immutable, increasing
-memory safety.
-
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit 8640fa880d7050917f4729f2c0cb506e165ee446)
----
- tests/gpgscm/Makefile.am      |   3 +-
- tests/gpgscm/scheme-private.h |   7 +-
- tests/gpgscm/scheme.c         |  41 +-
- tests/gpgscm/small-integers.h | 847 ++++++++++++++++++++++++++++++++++++++++++
- 4 files changed, 861 insertions(+), 37 deletions(-)
- create mode 100644 tests/gpgscm/small-integers.h
-
-diff --git a/tests/gpgscm/Makefile.am b/tests/gpgscm/Makefile.am
-index 8942c7c..15fc883 100644
---- a/tests/gpgscm/Makefile.am
-+++ b/tests/gpgscm/Makefile.am
-@@ -44,7 +44,8 @@ commonpth_libs = ../$(libcommonpth)
- gpgscm_CFLAGS = -imacros scheme-config.h \
- 	$(LIBGCRYPT_CFLAGS) $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS)
- gpgscm_SOURCES = main.c private.h ffi.c ffi.h ffi-private.h \
--	scheme-config.h opdefines.h scheme.c scheme.h scheme-private.h
-+	scheme-config.h scheme.c scheme.h scheme-private.h \
-+	opdefines.h small-integers.h
- gpgscm_LDADD = $(LDADD) $(common_libs) \
- 	$(NETLIBS) $(LIBICONV) $(LIBREADLINE) $(LIBINTL) \
- 	$(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS)
-diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h
-index 69b78f2..abe65e7 100644
---- a/tests/gpgscm/scheme-private.h
-+++ b/tests/gpgscm/scheme-private.h
-@@ -45,11 +45,11 @@ typedef struct port {
- struct cell {
-   uintptr_t _flag;
-   union {
-+    num _number;
-     struct {
-       char   *_svalue;
-       int   _length;
-     } _string;
--    num _number;
-     port *_port;
-     foreign_func _ff;
-     struct {
-@@ -152,11 +152,6 @@ pointer SHARP_HOOK;  /* *sharp-hook* */
- pointer COMPILE_HOOK;  /* *compile-hook* */
- #endif
- 
--#if USE_SMALL_INTEGERS
--/* A fixed allocation of small integers.  */
--struct cell_segment *integer_segment;
--#endif
--
- pointer free_cell;       /* pointer to top of free cells */
- long    fcells;          /* # of free cells */
- size_t  inhibit_gc;      /* nesting of gc_disable */
-diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
-index c37b568..e04394d 100644
---- a/tests/gpgscm/scheme.c
-+++ b/tests/gpgscm/scheme.c
-@@ -1312,31 +1312,22 @@ INTERFACE pointer mk_character(scheme *sc, int c) {
- 
- /* s_save assumes that all opcodes can be expressed as a small
-  * integer.  */
--#define MAX_SMALL_INTEGER	OP_MAXDEFINED
--
--static int
--initialize_small_integers(scheme *sc)
--{
--  int i;
--  if (_alloc_cellseg(sc, MAX_SMALL_INTEGER, &sc->integer_segment))
--    return 1;
--
--  for (i = 0; i < MAX_SMALL_INTEGER; i++) {
--    pointer x = &sc->integer_segment->cells[i];
--    typeflag(x) = T_NUMBER | T_ATOM | MARK;
--    ivalue_unchecked(x) = i;
--    set_num_integer(x);
--  }
-+static const struct cell small_integers[] = {
-+#define DEFINE_INTEGER(n) { T_NUMBER | T_ATOM | MARK, {{ 1, {n}}}},
-+#include "small-integers.h"
-+#undef DEFINE_INTEGER
-+     {0}
-+};
- 
--  return 0;
--}
-+#define MAX_SMALL_INTEGER	(sizeof small_integers / sizeof *small_integers - 1)
- 
- static INLINE pointer
- mk_small_integer(scheme *sc, long n)
- {
- #define mk_small_integer_allocates	0
-+  (void) sc;
-   assert(0 <= n && n < MAX_SMALL_INTEGER);
--  return &sc->integer_segment->cells[n];
-+  return (pointer) &small_integers[n];
- }
- #else
- 
-@@ -1644,7 +1635,8 @@ static void mark(pointer a) {
- 
-      t = (pointer) 0;
-      p = a;
--E2:  setmark(p);
-+E2:  if (! is_mark(p))
-+	  setmark(p);
-      if(is_vector(p)) {
-           int i;
-           for (i = 0; i < vector_length(p); i++) {
-@@ -5629,13 +5621,6 @@ int scheme_init_custom_alloc(scheme *sc, func_alloc malloc, func_dealloc free) {
-   sc->F = &sc->_HASHF;
-   sc->EOF_OBJ=&sc->_EOF_OBJ;
- 
--#if USE_SMALL_INTEGERS
--  if (initialize_small_integers(sc)) {
--    sc->no_memory=1;
--    return 0;
--  }
--#endif
--
-   sc->free_cell = &sc->_NIL;
-   sc->fcells = 0;
-   sc->inhibit_gc = GC_ENABLED;
-@@ -5789,10 +5774,6 @@ void scheme_deinit(scheme *sc) {
-   sc->gc_verbose=0;
-   gc(sc,sc->NIL,sc->NIL);
- 
--#if USE_SMALL_INTEGERS
--  _dealloc_cellseg(sc, sc->integer_segment);
--#endif
--
-   for (s = sc->cell_segments; s; s = _dealloc_cellseg(sc, s)) {
-     /* nop */
-   }
-diff --git a/tests/gpgscm/small-integers.h b/tests/gpgscm/small-integers.h
-new file mode 100644
-index 0000000..46eda34
---- /dev/null
-+++ b/tests/gpgscm/small-integers.h
-@@ -0,0 +1,847 @@
-+/* Constant integer objects for TinySCHEME.
-+ *
-+ * Copyright (C) 2017 g10 code GmbH
-+ *
-+ * This file is part of GnuPG.
-+ *
-+ * GnuPG is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 3 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * GnuPG is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
-+ */
-+
-+/*
-+ * Ohne Worte.  Generated using:
-+ *
-+ *    $ n=0; while read line ; do           \
-+ *              echo "DEFINE_INTEGER($n)" ; \
-+ *              n="$(expr $n + 1)" ;        \
-+ *      done <./init.scm >> small-integers.h
-+ */
-+
-+DEFINE_INTEGER(0)
-+DEFINE_INTEGER(1)
-+DEFINE_INTEGER(2)
-+DEFINE_INTEGER(3)
-+DEFINE_INTEGER(4)
-+DEFINE_INTEGER(5)
-+DEFINE_INTEGER(6)
-+DEFINE_INTEGER(7)
-+DEFINE_INTEGER(8)
-+DEFINE_INTEGER(9)
-+DEFINE_INTEGER(10)
-+DEFINE_INTEGER(11)
-+DEFINE_INTEGER(12)
-+DEFINE_INTEGER(13)
-+DEFINE_INTEGER(14)
-+DEFINE_INTEGER(15)
-+DEFINE_INTEGER(16)
-+DEFINE_INTEGER(17)
-+DEFINE_INTEGER(18)
-+DEFINE_INTEGER(19)
-+DEFINE_INTEGER(20)
-+DEFINE_INTEGER(21)
-+DEFINE_INTEGER(22)
-+DEFINE_INTEGER(23)
-+DEFINE_INTEGER(24)
-+DEFINE_INTEGER(25)
-+DEFINE_INTEGER(26)
-+DEFINE_INTEGER(27)
-+DEFINE_INTEGER(28)
-+DEFINE_INTEGER(29)
-+DEFINE_INTEGER(30)
-+DEFINE_INTEGER(31)
-+DEFINE_INTEGER(32)
-+DEFINE_INTEGER(33)
-+DEFINE_INTEGER(34)
-+DEFINE_INTEGER(35)
-+DEFINE_INTEGER(36)
-+DEFINE_INTEGER(37)
-+DEFINE_INTEGER(38)
-+DEFINE_INTEGER(39)
-+DEFINE_INTEGER(40)
-+DEFINE_INTEGER(41)
-+DEFINE_INTEGER(42)
-+DEFINE_INTEGER(43)
-+DEFINE_INTEGER(44)
-+DEFINE_INTEGER(45)
-+DEFINE_INTEGER(46)
-+DEFINE_INTEGER(47)
-+DEFINE_INTEGER(48)
-+DEFINE_INTEGER(49)
-+DEFINE_INTEGER(50)
-+DEFINE_INTEGER(51)
-+DEFINE_INTEGER(52)
-+DEFINE_INTEGER(53)
-+DEFINE_INTEGER(54)
-+DEFINE_INTEGER(55)
-+DEFINE_INTEGER(56)
-+DEFINE_INTEGER(57)
-+DEFINE_INTEGER(58)
-+DEFINE_INTEGER(59)
-+DEFINE_INTEGER(60)
-+DEFINE_INTEGER(61)
-+DEFINE_INTEGER(62)
-+DEFINE_INTEGER(63)
-+DEFINE_INTEGER(64)
-+DEFINE_INTEGER(65)
-+DEFINE_INTEGER(66)
-+DEFINE_INTEGER(67)
-+DEFINE_INTEGER(68)
-+DEFINE_INTEGER(69)
-+DEFINE_INTEGER(70)
-+DEFINE_INTEGER(71)
-+DEFINE_INTEGER(72)
-+DEFINE_INTEGER(73)
-+DEFINE_INTEGER(74)
-+DEFINE_INTEGER(75)
-+DEFINE_INTEGER(76)
-+DEFINE_INTEGER(77)
-+DEFINE_INTEGER(78)
-+DEFINE_INTEGER(79)
-+DEFINE_INTEGER(80)
-+DEFINE_INTEGER(81)
-+DEFINE_INTEGER(82)
-+DEFINE_INTEGER(83)
-+DEFINE_INTEGER(84)
-+DEFINE_INTEGER(85)
-+DEFINE_INTEGER(86)
-+DEFINE_INTEGER(87)
-+DEFINE_INTEGER(88)
-+DEFINE_INTEGER(89)
-+DEFINE_INTEGER(90)
-+DEFINE_INTEGER(91)
-+DEFINE_INTEGER(92)
-+DEFINE_INTEGER(93)
-+DEFINE_INTEGER(94)
-+DEFINE_INTEGER(95)
-+DEFINE_INTEGER(96)
-+DEFINE_INTEGER(97)
-+DEFINE_INTEGER(98)
-+DEFINE_INTEGER(99)
-+DEFINE_INTEGER(100)
-+DEFINE_INTEGER(101)
-+DEFINE_INTEGER(102)
-+DEFINE_INTEGER(103)
-+DEFINE_INTEGER(104)
-+DEFINE_INTEGER(105)
-+DEFINE_INTEGER(106)
-+DEFINE_INTEGER(107)
-+DEFINE_INTEGER(108)
-+DEFINE_INTEGER(109)
-+DEFINE_INTEGER(110)
-+DEFINE_INTEGER(111)
-+DEFINE_INTEGER(112)
-+DEFINE_INTEGER(113)
-+DEFINE_INTEGER(114)
-+DEFINE_INTEGER(115)
-+DEFINE_INTEGER(116)
-+DEFINE_INTEGER(117)
-+DEFINE_INTEGER(118)
-+DEFINE_INTEGER(119)
-+DEFINE_INTEGER(120)
-+DEFINE_INTEGER(121)
-+DEFINE_INTEGER(122)
-+DEFINE_INTEGER(123)
-+DEFINE_INTEGER(124)
-+DEFINE_INTEGER(125)
-+DEFINE_INTEGER(126)
-+DEFINE_INTEGER(127)
-+DEFINE_INTEGER(128)
-+DEFINE_INTEGER(129)
-+DEFINE_INTEGER(130)
-+DEFINE_INTEGER(131)
-+DEFINE_INTEGER(132)
-+DEFINE_INTEGER(133)
-+DEFINE_INTEGER(134)
-+DEFINE_INTEGER(135)
-+DEFINE_INTEGER(136)
-+DEFINE_INTEGER(137)
-+DEFINE_INTEGER(138)
-+DEFINE_INTEGER(139)
-+DEFINE_INTEGER(140)
-+DEFINE_INTEGER(141)
-+DEFINE_INTEGER(142)
-+DEFINE_INTEGER(143)
-+DEFINE_INTEGER(144)
-+DEFINE_INTEGER(145)
-+DEFINE_INTEGER(146)
-+DEFINE_INTEGER(147)
-+DEFINE_INTEGER(148)
-+DEFINE_INTEGER(149)
-+DEFINE_INTEGER(150)
-+DEFINE_INTEGER(151)
-+DEFINE_INTEGER(152)
-+DEFINE_INTEGER(153)
-+DEFINE_INTEGER(154)
-+DEFINE_INTEGER(155)
-+DEFINE_INTEGER(156)
-+DEFINE_INTEGER(157)
-+DEFINE_INTEGER(158)
-+DEFINE_INTEGER(159)
-+DEFINE_INTEGER(160)
-+DEFINE_INTEGER(161)
-+DEFINE_INTEGER(162)
-+DEFINE_INTEGER(163)
-+DEFINE_INTEGER(164)
-+DEFINE_INTEGER(165)
-+DEFINE_INTEGER(166)
-+DEFINE_INTEGER(167)
-+DEFINE_INTEGER(168)
-+DEFINE_INTEGER(169)
-+DEFINE_INTEGER(170)
-+DEFINE_INTEGER(171)
-+DEFINE_INTEGER(172)
-+DEFINE_INTEGER(173)
-+DEFINE_INTEGER(174)
-+DEFINE_INTEGER(175)
-+DEFINE_INTEGER(176)
-+DEFINE_INTEGER(177)
-+DEFINE_INTEGER(178)
-+DEFINE_INTEGER(179)
-+DEFINE_INTEGER(180)
-+DEFINE_INTEGER(181)
-+DEFINE_INTEGER(182)
-+DEFINE_INTEGER(183)
-+DEFINE_INTEGER(184)
-+DEFINE_INTEGER(185)
-+DEFINE_INTEGER(186)
-+DEFINE_INTEGER(187)
-+DEFINE_INTEGER(188)
-+DEFINE_INTEGER(189)
-+DEFINE_INTEGER(190)
-+DEFINE_INTEGER(191)
-+DEFINE_INTEGER(192)
-+DEFINE_INTEGER(193)
-+DEFINE_INTEGER(194)
-+DEFINE_INTEGER(195)
-+DEFINE_INTEGER(196)
-+DEFINE_INTEGER(197)
-+DEFINE_INTEGER(198)
-+DEFINE_INTEGER(199)
-+DEFINE_INTEGER(200)
-+DEFINE_INTEGER(201)
-+DEFINE_INTEGER(202)
-+DEFINE_INTEGER(203)
-+DEFINE_INTEGER(204)
-+DEFINE_INTEGER(205)
-+DEFINE_INTEGER(206)
-+DEFINE_INTEGER(207)
-+DEFINE_INTEGER(208)
-+DEFINE_INTEGER(209)
-+DEFINE_INTEGER(210)
-+DEFINE_INTEGER(211)
-+DEFINE_INTEGER(212)
-+DEFINE_INTEGER(213)
-+DEFINE_INTEGER(214)
-+DEFINE_INTEGER(215)
-+DEFINE_INTEGER(216)
-+DEFINE_INTEGER(217)
-+DEFINE_INTEGER(218)
-+DEFINE_INTEGER(219)
-+DEFINE_INTEGER(220)
-+DEFINE_INTEGER(221)
-+DEFINE_INTEGER(222)
-+DEFINE_INTEGER(223)
-+DEFINE_INTEGER(224)
-+DEFINE_INTEGER(225)
-+DEFINE_INTEGER(226)
-+DEFINE_INTEGER(227)
-+DEFINE_INTEGER(228)
-+DEFINE_INTEGER(229)
-+DEFINE_INTEGER(230)
-+DEFINE_INTEGER(231)
-+DEFINE_INTEGER(232)
-+DEFINE_INTEGER(233)
-+DEFINE_INTEGER(234)
-+DEFINE_INTEGER(235)
-+DEFINE_INTEGER(236)
-+DEFINE_INTEGER(237)
-+DEFINE_INTEGER(238)
-+DEFINE_INTEGER(239)
-+DEFINE_INTEGER(240)
-+DEFINE_INTEGER(241)
-+DEFINE_INTEGER(242)
-+DEFINE_INTEGER(243)
-+DEFINE_INTEGER(244)
-+DEFINE_INTEGER(245)
-+DEFINE_INTEGER(246)
-+DEFINE_INTEGER(247)
-+DEFINE_INTEGER(248)
-+DEFINE_INTEGER(249)
-+DEFINE_INTEGER(250)
-+DEFINE_INTEGER(251)
-+DEFINE_INTEGER(252)
-+DEFINE_INTEGER(253)
-+DEFINE_INTEGER(254)
-+DEFINE_INTEGER(255)
-+DEFINE_INTEGER(256)
-+DEFINE_INTEGER(257)
-+DEFINE_INTEGER(258)
-+DEFINE_INTEGER(259)
-+DEFINE_INTEGER(260)
-+DEFINE_INTEGER(261)
-+DEFINE_INTEGER(262)
-+DEFINE_INTEGER(263)
-+DEFINE_INTEGER(264)
-+DEFINE_INTEGER(265)
-+DEFINE_INTEGER(266)
-+DEFINE_INTEGER(267)
-+DEFINE_INTEGER(268)
-+DEFINE_INTEGER(269)
-+DEFINE_INTEGER(270)
-+DEFINE_INTEGER(271)
-+DEFINE_INTEGER(272)
-+DEFINE_INTEGER(273)
-+DEFINE_INTEGER(274)
-+DEFINE_INTEGER(275)
-+DEFINE_INTEGER(276)
-+DEFINE_INTEGER(277)
-+DEFINE_INTEGER(278)
-+DEFINE_INTEGER(279)
-+DEFINE_INTEGER(280)
-+DEFINE_INTEGER(281)
-+DEFINE_INTEGER(282)
-+DEFINE_INTEGER(283)
-+DEFINE_INTEGER(284)
-+DEFINE_INTEGER(285)
-+DEFINE_INTEGER(286)
-+DEFINE_INTEGER(287)
-+DEFINE_INTEGER(288)
-+DEFINE_INTEGER(289)
-+DEFINE_INTEGER(290)
-+DEFINE_INTEGER(291)
-+DEFINE_INTEGER(292)
-+DEFINE_INTEGER(293)
-+DEFINE_INTEGER(294)
-+DEFINE_INTEGER(295)
-+DEFINE_INTEGER(296)
-+DEFINE_INTEGER(297)
-+DEFINE_INTEGER(298)
-+DEFINE_INTEGER(299)
-+DEFINE_INTEGER(300)
-+DEFINE_INTEGER(301)
-+DEFINE_INTEGER(302)
-+DEFINE_INTEGER(303)
-+DEFINE_INTEGER(304)
-+DEFINE_INTEGER(305)
-+DEFINE_INTEGER(306)
-+DEFINE_INTEGER(307)
-+DEFINE_INTEGER(308)
-+DEFINE_INTEGER(309)
-+DEFINE_INTEGER(310)
-+DEFINE_INTEGER(311)
-+DEFINE_INTEGER(312)
-+DEFINE_INTEGER(313)
-+DEFINE_INTEGER(314)
-+DEFINE_INTEGER(315)
-+DEFINE_INTEGER(316)
-+DEFINE_INTEGER(317)
-+DEFINE_INTEGER(318)
-+DEFINE_INTEGER(319)
-+DEFINE_INTEGER(320)
-+DEFINE_INTEGER(321)
-+DEFINE_INTEGER(322)
-+DEFINE_INTEGER(323)
-+DEFINE_INTEGER(324)
-+DEFINE_INTEGER(325)
-+DEFINE_INTEGER(326)
-+DEFINE_INTEGER(327)
-+DEFINE_INTEGER(328)
-+DEFINE_INTEGER(329)
-+DEFINE_INTEGER(330)
-+DEFINE_INTEGER(331)
-+DEFINE_INTEGER(332)
-+DEFINE_INTEGER(333)
-+DEFINE_INTEGER(334)
-+DEFINE_INTEGER(335)
-+DEFINE_INTEGER(336)
-+DEFINE_INTEGER(337)
-+DEFINE_INTEGER(338)
-+DEFINE_INTEGER(339)
-+DEFINE_INTEGER(340)
-+DEFINE_INTEGER(341)
-+DEFINE_INTEGER(342)
-+DEFINE_INTEGER(343)
-+DEFINE_INTEGER(344)
-+DEFINE_INTEGER(345)
-+DEFINE_INTEGER(346)
-+DEFINE_INTEGER(347)
-+DEFINE_INTEGER(348)
-+DEFINE_INTEGER(349)
-+DEFINE_INTEGER(350)
-+DEFINE_INTEGER(351)
-+DEFINE_INTEGER(352)
-+DEFINE_INTEGER(353)
-+DEFINE_INTEGER(354)
-+DEFINE_INTEGER(355)
-+DEFINE_INTEGER(356)
-+DEFINE_INTEGER(357)
-+DEFINE_INTEGER(358)
-+DEFINE_INTEGER(359)
-+DEFINE_INTEGER(360)
-+DEFINE_INTEGER(361)
-+DEFINE_INTEGER(362)
-+DEFINE_INTEGER(363)
-+DEFINE_INTEGER(364)
-+DEFINE_INTEGER(365)
-+DEFINE_INTEGER(366)
-+DEFINE_INTEGER(367)
-+DEFINE_INTEGER(368)
-+DEFINE_INTEGER(369)
-+DEFINE_INTEGER(370)
-+DEFINE_INTEGER(371)
-+DEFINE_INTEGER(372)
-+DEFINE_INTEGER(373)
-+DEFINE_INTEGER(374)
-+DEFINE_INTEGER(375)
-+DEFINE_INTEGER(376)
-+DEFINE_INTEGER(377)
-+DEFINE_INTEGER(378)
-+DEFINE_INTEGER(379)
-+DEFINE_INTEGER(380)
-+DEFINE_INTEGER(381)
-+DEFINE_INTEGER(382)
-+DEFINE_INTEGER(383)
-+DEFINE_INTEGER(384)
-+DEFINE_INTEGER(385)
-+DEFINE_INTEGER(386)
-+DEFINE_INTEGER(387)
-+DEFINE_INTEGER(388)
-+DEFINE_INTEGER(389)
-+DEFINE_INTEGER(390)
-+DEFINE_INTEGER(391)
-+DEFINE_INTEGER(392)
-+DEFINE_INTEGER(393)
-+DEFINE_INTEGER(394)
-+DEFINE_INTEGER(395)
-+DEFINE_INTEGER(396)
-+DEFINE_INTEGER(397)
-+DEFINE_INTEGER(398)
-+DEFINE_INTEGER(399)
-+DEFINE_INTEGER(400)
-+DEFINE_INTEGER(401)
-+DEFINE_INTEGER(402)
-+DEFINE_INTEGER(403)
-+DEFINE_INTEGER(404)
-+DEFINE_INTEGER(405)
-+DEFINE_INTEGER(406)
-+DEFINE_INTEGER(407)
-+DEFINE_INTEGER(408)
-+DEFINE_INTEGER(409)
-+DEFINE_INTEGER(410)
-+DEFINE_INTEGER(411)
-+DEFINE_INTEGER(412)
-+DEFINE_INTEGER(413)
-+DEFINE_INTEGER(414)
-+DEFINE_INTEGER(415)
-+DEFINE_INTEGER(416)
-+DEFINE_INTEGER(417)
-+DEFINE_INTEGER(418)
-+DEFINE_INTEGER(419)
-+DEFINE_INTEGER(420)
-+DEFINE_INTEGER(421)
-+DEFINE_INTEGER(422)
-+DEFINE_INTEGER(423)
-+DEFINE_INTEGER(424)
-+DEFINE_INTEGER(425)
-+DEFINE_INTEGER(426)
-+DEFINE_INTEGER(427)
-+DEFINE_INTEGER(428)
-+DEFINE_INTEGER(429)
-+DEFINE_INTEGER(430)
-+DEFINE_INTEGER(431)
-+DEFINE_INTEGER(432)
-+DEFINE_INTEGER(433)
-+DEFINE_INTEGER(434)
-+DEFINE_INTEGER(435)
-+DEFINE_INTEGER(436)
-+DEFINE_INTEGER(437)
-+DEFINE_INTEGER(438)
-+DEFINE_INTEGER(439)
-+DEFINE_INTEGER(440)
-+DEFINE_INTEGER(441)
-+DEFINE_INTEGER(442)
-+DEFINE_INTEGER(443)
-+DEFINE_INTEGER(444)
-+DEFINE_INTEGER(445)
-+DEFINE_INTEGER(446)
-+DEFINE_INTEGER(447)
-+DEFINE_INTEGER(448)
-+DEFINE_INTEGER(449)
-+DEFINE_INTEGER(450)
-+DEFINE_INTEGER(451)
-+DEFINE_INTEGER(452)
-+DEFINE_INTEGER(453)
-+DEFINE_INTEGER(454)
-+DEFINE_INTEGER(455)
-+DEFINE_INTEGER(456)
-+DEFINE_INTEGER(457)
-+DEFINE_INTEGER(458)
-+DEFINE_INTEGER(459)
-+DEFINE_INTEGER(460)
-+DEFINE_INTEGER(461)
-+DEFINE_INTEGER(462)
-+DEFINE_INTEGER(463)
-+DEFINE_INTEGER(464)
-+DEFINE_INTEGER(465)
-+DEFINE_INTEGER(466)
-+DEFINE_INTEGER(467)
-+DEFINE_INTEGER(468)
-+DEFINE_INTEGER(469)
-+DEFINE_INTEGER(470)
-+DEFINE_INTEGER(471)
-+DEFINE_INTEGER(472)
-+DEFINE_INTEGER(473)
-+DEFINE_INTEGER(474)
-+DEFINE_INTEGER(475)
-+DEFINE_INTEGER(476)
-+DEFINE_INTEGER(477)
-+DEFINE_INTEGER(478)
-+DEFINE_INTEGER(479)
-+DEFINE_INTEGER(480)
-+DEFINE_INTEGER(481)
-+DEFINE_INTEGER(482)
-+DEFINE_INTEGER(483)
-+DEFINE_INTEGER(484)
-+DEFINE_INTEGER(485)
-+DEFINE_INTEGER(486)
-+DEFINE_INTEGER(487)
-+DEFINE_INTEGER(488)
-+DEFINE_INTEGER(489)
-+DEFINE_INTEGER(490)
-+DEFINE_INTEGER(491)
-+DEFINE_INTEGER(492)
-+DEFINE_INTEGER(493)
-+DEFINE_INTEGER(494)
-+DEFINE_INTEGER(495)
-+DEFINE_INTEGER(496)
-+DEFINE_INTEGER(497)
-+DEFINE_INTEGER(498)
-+DEFINE_INTEGER(499)
-+DEFINE_INTEGER(500)
-+DEFINE_INTEGER(501)
-+DEFINE_INTEGER(502)
-+DEFINE_INTEGER(503)
-+DEFINE_INTEGER(504)
-+DEFINE_INTEGER(505)
-+DEFINE_INTEGER(506)
-+DEFINE_INTEGER(507)
-+DEFINE_INTEGER(508)
-+DEFINE_INTEGER(509)
-+DEFINE_INTEGER(510)
-+DEFINE_INTEGER(511)
-+DEFINE_INTEGER(512)
-+DEFINE_INTEGER(513)
-+DEFINE_INTEGER(514)
-+DEFINE_INTEGER(515)
-+DEFINE_INTEGER(516)
-+DEFINE_INTEGER(517)
-+DEFINE_INTEGER(518)
-+DEFINE_INTEGER(519)
-+DEFINE_INTEGER(520)
-+DEFINE_INTEGER(521)
-+DEFINE_INTEGER(522)
-+DEFINE_INTEGER(523)
-+DEFINE_INTEGER(524)
-+DEFINE_INTEGER(525)
-+DEFINE_INTEGER(526)
-+DEFINE_INTEGER(527)
-+DEFINE_INTEGER(528)
-+DEFINE_INTEGER(529)
-+DEFINE_INTEGER(530)
-+DEFINE_INTEGER(531)
-+DEFINE_INTEGER(532)
-+DEFINE_INTEGER(533)
-+DEFINE_INTEGER(534)
-+DEFINE_INTEGER(535)
-+DEFINE_INTEGER(536)
-+DEFINE_INTEGER(537)
-+DEFINE_INTEGER(538)
-+DEFINE_INTEGER(539)
-+DEFINE_INTEGER(540)
-+DEFINE_INTEGER(541)
-+DEFINE_INTEGER(542)
-+DEFINE_INTEGER(543)
-+DEFINE_INTEGER(544)
-+DEFINE_INTEGER(545)
-+DEFINE_INTEGER(546)
-+DEFINE_INTEGER(547)
-+DEFINE_INTEGER(548)
-+DEFINE_INTEGER(549)
-+DEFINE_INTEGER(550)
-+DEFINE_INTEGER(551)
-+DEFINE_INTEGER(552)
-+DEFINE_INTEGER(553)
-+DEFINE_INTEGER(554)
-+DEFINE_INTEGER(555)
-+DEFINE_INTEGER(556)
-+DEFINE_INTEGER(557)
-+DEFINE_INTEGER(558)
-+DEFINE_INTEGER(559)
-+DEFINE_INTEGER(560)
-+DEFINE_INTEGER(561)
-+DEFINE_INTEGER(562)
-+DEFINE_INTEGER(563)
-+DEFINE_INTEGER(564)
-+DEFINE_INTEGER(565)
-+DEFINE_INTEGER(566)
-+DEFINE_INTEGER(567)
-+DEFINE_INTEGER(568)
-+DEFINE_INTEGER(569)
-+DEFINE_INTEGER(570)
-+DEFINE_INTEGER(571)
-+DEFINE_INTEGER(572)
-+DEFINE_INTEGER(573)
-+DEFINE_INTEGER(574)
-+DEFINE_INTEGER(575)
-+DEFINE_INTEGER(576)
-+DEFINE_INTEGER(577)
-+DEFINE_INTEGER(578)
-+DEFINE_INTEGER(579)
-+DEFINE_INTEGER(580)
-+DEFINE_INTEGER(581)
-+DEFINE_INTEGER(582)
-+DEFINE_INTEGER(583)
-+DEFINE_INTEGER(584)
-+DEFINE_INTEGER(585)
-+DEFINE_INTEGER(586)
-+DEFINE_INTEGER(587)
-+DEFINE_INTEGER(588)
-+DEFINE_INTEGER(589)
-+DEFINE_INTEGER(590)
-+DEFINE_INTEGER(591)
-+DEFINE_INTEGER(592)
-+DEFINE_INTEGER(593)
-+DEFINE_INTEGER(594)
-+DEFINE_INTEGER(595)
-+DEFINE_INTEGER(596)
-+DEFINE_INTEGER(597)
-+DEFINE_INTEGER(598)
-+DEFINE_INTEGER(599)
-+DEFINE_INTEGER(600)
-+DEFINE_INTEGER(601)
-+DEFINE_INTEGER(602)
-+DEFINE_INTEGER(603)
-+DEFINE_INTEGER(604)
-+DEFINE_INTEGER(605)
-+DEFINE_INTEGER(606)
-+DEFINE_INTEGER(607)
-+DEFINE_INTEGER(608)
-+DEFINE_INTEGER(609)
-+DEFINE_INTEGER(610)
-+DEFINE_INTEGER(611)
-+DEFINE_INTEGER(612)
-+DEFINE_INTEGER(613)
-+DEFINE_INTEGER(614)
-+DEFINE_INTEGER(615)
-+DEFINE_INTEGER(616)
-+DEFINE_INTEGER(617)
-+DEFINE_INTEGER(618)
-+DEFINE_INTEGER(619)
-+DEFINE_INTEGER(620)
-+DEFINE_INTEGER(621)
-+DEFINE_INTEGER(622)
-+DEFINE_INTEGER(623)
-+DEFINE_INTEGER(624)
-+DEFINE_INTEGER(625)
-+DEFINE_INTEGER(626)
-+DEFINE_INTEGER(627)
-+DEFINE_INTEGER(628)
-+DEFINE_INTEGER(629)
-+DEFINE_INTEGER(630)
-+DEFINE_INTEGER(631)
-+DEFINE_INTEGER(632)
-+DEFINE_INTEGER(633)
-+DEFINE_INTEGER(634)
-+DEFINE_INTEGER(635)
-+DEFINE_INTEGER(636)
-+DEFINE_INTEGER(637)
-+DEFINE_INTEGER(638)
-+DEFINE_INTEGER(639)
-+DEFINE_INTEGER(640)
-+DEFINE_INTEGER(641)
-+DEFINE_INTEGER(642)
-+DEFINE_INTEGER(643)
-+DEFINE_INTEGER(644)
-+DEFINE_INTEGER(645)
-+DEFINE_INTEGER(646)
-+DEFINE_INTEGER(647)
-+DEFINE_INTEGER(648)
-+DEFINE_INTEGER(649)
-+DEFINE_INTEGER(650)
-+DEFINE_INTEGER(651)
-+DEFINE_INTEGER(652)
-+DEFINE_INTEGER(653)
-+DEFINE_INTEGER(654)
-+DEFINE_INTEGER(655)
-+DEFINE_INTEGER(656)
-+DEFINE_INTEGER(657)
-+DEFINE_INTEGER(658)
-+DEFINE_INTEGER(659)
-+DEFINE_INTEGER(660)
-+DEFINE_INTEGER(661)
-+DEFINE_INTEGER(662)
-+DEFINE_INTEGER(663)
-+DEFINE_INTEGER(664)
-+DEFINE_INTEGER(665)
-+DEFINE_INTEGER(666)
-+DEFINE_INTEGER(667)
-+DEFINE_INTEGER(668)
-+DEFINE_INTEGER(669)
-+DEFINE_INTEGER(670)
-+DEFINE_INTEGER(671)
-+DEFINE_INTEGER(672)
-+DEFINE_INTEGER(673)
-+DEFINE_INTEGER(674)
-+DEFINE_INTEGER(675)
-+DEFINE_INTEGER(676)
-+DEFINE_INTEGER(677)
-+DEFINE_INTEGER(678)
-+DEFINE_INTEGER(679)
-+DEFINE_INTEGER(680)
-+DEFINE_INTEGER(681)
-+DEFINE_INTEGER(682)
-+DEFINE_INTEGER(683)
-+DEFINE_INTEGER(684)
-+DEFINE_INTEGER(685)
-+DEFINE_INTEGER(686)
-+DEFINE_INTEGER(687)
-+DEFINE_INTEGER(688)
-+DEFINE_INTEGER(689)
-+DEFINE_INTEGER(690)
-+DEFINE_INTEGER(691)
-+DEFINE_INTEGER(692)
-+DEFINE_INTEGER(693)
-+DEFINE_INTEGER(694)
-+DEFINE_INTEGER(695)
-+DEFINE_INTEGER(696)
-+DEFINE_INTEGER(697)
-+DEFINE_INTEGER(698)
-+DEFINE_INTEGER(699)
-+DEFINE_INTEGER(700)
-+DEFINE_INTEGER(701)
-+DEFINE_INTEGER(702)
-+DEFINE_INTEGER(703)
-+DEFINE_INTEGER(704)
-+DEFINE_INTEGER(705)
-+DEFINE_INTEGER(706)
-+DEFINE_INTEGER(707)
-+DEFINE_INTEGER(708)
-+DEFINE_INTEGER(709)
-+DEFINE_INTEGER(710)
-+DEFINE_INTEGER(711)
-+DEFINE_INTEGER(712)
-+DEFINE_INTEGER(713)
-+DEFINE_INTEGER(714)
-+DEFINE_INTEGER(715)
-+DEFINE_INTEGER(716)
-+DEFINE_INTEGER(717)
-+DEFINE_INTEGER(718)
-+DEFINE_INTEGER(719)
-+DEFINE_INTEGER(720)
-+DEFINE_INTEGER(721)
-+DEFINE_INTEGER(722)
-+DEFINE_INTEGER(723)
-+DEFINE_INTEGER(724)
-+DEFINE_INTEGER(725)
-+DEFINE_INTEGER(726)
-+DEFINE_INTEGER(727)
-+DEFINE_INTEGER(728)
-+DEFINE_INTEGER(729)
-+DEFINE_INTEGER(730)
-+DEFINE_INTEGER(731)
-+DEFINE_INTEGER(732)
-+DEFINE_INTEGER(733)
-+DEFINE_INTEGER(734)
-+DEFINE_INTEGER(735)
-+DEFINE_INTEGER(736)
-+DEFINE_INTEGER(737)
-+DEFINE_INTEGER(738)
-+DEFINE_INTEGER(739)
-+DEFINE_INTEGER(740)
-+DEFINE_INTEGER(741)
-+DEFINE_INTEGER(742)
-+DEFINE_INTEGER(743)
-+DEFINE_INTEGER(744)
-+DEFINE_INTEGER(745)
-+DEFINE_INTEGER(746)
-+DEFINE_INTEGER(747)
-+DEFINE_INTEGER(748)
-+DEFINE_INTEGER(749)
-+DEFINE_INTEGER(750)
-+DEFINE_INTEGER(751)
-+DEFINE_INTEGER(752)
-+DEFINE_INTEGER(753)
-+DEFINE_INTEGER(754)
-+DEFINE_INTEGER(755)
-+DEFINE_INTEGER(756)
-+DEFINE_INTEGER(757)
-+DEFINE_INTEGER(758)
-+DEFINE_INTEGER(759)
-+DEFINE_INTEGER(760)
-+DEFINE_INTEGER(761)
-+DEFINE_INTEGER(762)
-+DEFINE_INTEGER(763)
-+DEFINE_INTEGER(764)
-+DEFINE_INTEGER(765)
-+DEFINE_INTEGER(766)
-+DEFINE_INTEGER(767)
-+DEFINE_INTEGER(768)
-+DEFINE_INTEGER(769)
-+DEFINE_INTEGER(770)
-+DEFINE_INTEGER(771)
-+DEFINE_INTEGER(772)
-+DEFINE_INTEGER(773)
-+DEFINE_INTEGER(774)
-+DEFINE_INTEGER(775)
-+DEFINE_INTEGER(776)
-+DEFINE_INTEGER(777)
-+DEFINE_INTEGER(778)
-+DEFINE_INTEGER(779)
-+DEFINE_INTEGER(780)
-+DEFINE_INTEGER(781)
-+DEFINE_INTEGER(782)
-+DEFINE_INTEGER(783)
-+DEFINE_INTEGER(784)
-+DEFINE_INTEGER(785)
-+DEFINE_INTEGER(786)
-+DEFINE_INTEGER(787)
-+DEFINE_INTEGER(788)
-+DEFINE_INTEGER(789)
-+DEFINE_INTEGER(790)
-+DEFINE_INTEGER(791)
-+DEFINE_INTEGER(792)
-+DEFINE_INTEGER(793)
-+DEFINE_INTEGER(794)
-+DEFINE_INTEGER(795)
-+DEFINE_INTEGER(796)
-+DEFINE_INTEGER(797)
-+DEFINE_INTEGER(798)
-+DEFINE_INTEGER(799)
-+DEFINE_INTEGER(800)
-+DEFINE_INTEGER(801)
-+DEFINE_INTEGER(802)
-+DEFINE_INTEGER(803)
-+DEFINE_INTEGER(804)
-+DEFINE_INTEGER(805)
-+DEFINE_INTEGER(806)
-+DEFINE_INTEGER(807)
-+DEFINE_INTEGER(808)
-+DEFINE_INTEGER(809)
-+DEFINE_INTEGER(810)
-+DEFINE_INTEGER(811)
-+DEFINE_INTEGER(812)
-+DEFINE_INTEGER(813)
-+DEFINE_INTEGER(814)
-+DEFINE_INTEGER(815)
-+DEFINE_INTEGER(816)
-+DEFINE_INTEGER(817)
diff --git a/debian/patches/0031-agent-Use-ll-length-specifier-when-time_t-is-larger.patch b/debian/patches/0031-agent-Use-ll-length-specifier-when-time_t-is-larger.patch
deleted file mode 100644
index 3496a8e..0000000
--- a/debian/patches/0031-agent-Use-ll-length-specifier-when-time_t-is-larger.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Mon, 10 Apr 2017 15:04:57 +0900
-Subject: agent: Use "ll" length specifier when time_t is larger.
-
-* agent/command.c (cmd_keytocard): Use KEYTOCARD_TIMESTAMP_FORMAT.
-
---
-
-On a big-endian 32-bit platform which uses 64-bit time_t, it might go
-wrong.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 170660ed11b56145dea4865e751ae5aff1681fe2)
----
- agent/command.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/agent/command.c b/agent/command.c
-index 1f8f7c2..ab6d7eb 100644
---- a/agent/command.c
-+++ b/agent/command.c
-@@ -2477,6 +2477,12 @@ cmd_delete_key (assuan_context_t ctx, char *line)
- 
- 
- 

-+#if SIZEOF_TIME_T > SIZEOF_UNSIGNED_LONG
-+#define KEYTOCARD_TIMESTAMP_FORMAT "(10:created-at10:%010llu))"
-+#else
-+#define KEYTOCARD_TIMESTAMP_FORMAT "(10:created-at10:%010lu))"
-+#endif
-+
- static const char hlp_keytocard[] =
-   "KEYTOCARD [--force] <hexstring_with_keygrip> <serialno> <id> <timestamp>\n"
-   "\n";
-@@ -2580,7 +2586,7 @@ cmd_keytocard (assuan_context_t ctx, char *line)
-   gcry_sexp_release (s_skey);
-   keydatalen--;			/* Decrement for last '\0'.  */
-   /* Add timestamp "created-at" in the private key */
--  snprintf (keydata+keydatalen-1, 30, "(10:created-at10:%010lu))", timestamp);
-+  snprintf (keydata+keydatalen-1, 30, KEYTOCARD_TIMESTAMP_FORMAT, timestamp);
-   keydatalen += 10 + 19 - 1;
-   err = divert_writekey (ctrl, force, serialno, id, keydata, keydatalen);
-   xfree (keydata);
diff --git a/debian/patches/0032-g10-Minor-clean-up-for-export.c.patch b/debian/patches/0032-g10-Minor-clean-up-for-export.c.patch
deleted file mode 100644
index ca6f13a..0000000
--- a/debian/patches/0032-g10-Minor-clean-up-for-export.c.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Wed, 12 Apr 2017 08:47:23 +0900
-Subject: g10: Minor clean up for export.c.
-
-* g10/export.c (export_ssh_key): Check IDENTIFIER for error.
-Release base64 thing on error of get_membuf.
-
---
-
-Compiler (older) may misunderstand the variable IDENTIFIER is not
-initialized, while good one can do better analysys on the value for
-ERR (and thus, IDENTIFIER).
-
-On the error of get_membuf, still, b64enc_finish should be called,
-even if it lost the ERR value.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 05218829589f6d4b09933fa19f568c2019367d5c)
----
- g10/export.c | 35 ++++++++++++++++-------------------
- 1 file changed, 16 insertions(+), 19 deletions(-)
-
-diff --git a/g10/export.c b/g10/export.c
-index 31caa55..9b203e3 100644
---- a/g10/export.c
-+++ b/g10/export.c
-@@ -2125,7 +2125,7 @@ export_ssh_key (ctrl_t ctrl, const char *userid)
-   u32 curtime = make_timestamp ();
-   kbnode_t latest_key, node;
-   PKT_public_key *pk;
--  const char *identifier;
-+  const char *identifier = NULL;
-   membuf_t mb;
-   estream_t fp = NULL;
-   struct b64state b64_state;
-@@ -2321,8 +2321,6 @@ export_ssh_key (ctrl_t ctrl, const char *userid)
-               identifier = "ecdsa-sha2-nistp384";
-             else if (!strcmp (curve, "nistp521"))
-               identifier = "ecdsa-sha2-nistp521";
--            else
--              identifier = NULL;
- 
-             if (!identifier)
-               err = gpg_error (GPG_ERR_UNKNOWN_CURVE);
-@@ -2353,7 +2351,7 @@ export_ssh_key (ctrl_t ctrl, const char *userid)
-       break;
-     }
- 
--  if (err)
-+  if (!identifier)
-     goto leave;
- 
-   if (opt.outfile && *opt.outfile && strcmp (opt.outfile, "-"))
-@@ -2369,22 +2367,21 @@ export_ssh_key (ctrl_t ctrl, const char *userid)
- 
-   es_fprintf (fp, "%s ", identifier);
-   err = b64enc_start_es (&b64_state, fp, "");
--  if (err)
--    goto leave;
--  {
--    void *blob;
--    size_t bloblen;
-+  if (!err)
-+    {
-+      void *blob;
-+      size_t bloblen;
- 
--    blob = get_membuf (&mb, &bloblen);
--    if (!blob)
--      err = gpg_error_from_syserror ();
--    else
--      err = b64enc_write (&b64_state, blob, bloblen);
--    xfree (blob);
--    if (err)
--      goto leave;
--  }
--  err = b64enc_finish (&b64_state);
-+      blob = get_membuf (&mb, &bloblen);
-+      if (blob)
-+        {
-+          err = b64enc_write (&b64_state, blob, bloblen);
-+          xfree (blob);
-+          if (err)
-+            goto leave;
-+        }
-+      err = b64enc_finish (&b64_state);
-+    }
-   if (err)
-     goto leave;
-   es_fprintf (fp, " openpgp:0x%08lX\n", (ulong)keyid_from_pk (pk, NULL));
diff --git a/debian/patches/0033-dirmngr-Fix-dns-stuff.c-in-another-way.patch b/debian/patches/0033-dirmngr-Fix-dns-stuff.c-in-another-way.patch
deleted file mode 100644
index 3a03230..0000000
--- a/debian/patches/0033-dirmngr-Fix-dns-stuff.c-in-another-way.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Wed, 12 Apr 2017 10:19:27 +0900
-Subject: dirmngr: Fix dns-stuff.c in another way.
-
-* dirmngr/dns-stuff.c (T_CERT): Define our own.
-
---
-
-T_CERT may be defined by another enum type even if the value is same.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit bd0c94939faf8ccfc117fb595e9bc0105edcafa4)
----
- dirmngr/dns-stuff.c | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c
-index 728f662..cb0456a 100644
---- a/dirmngr/dns-stuff.c
-+++ b/dirmngr/dns-stuff.c
-@@ -95,9 +95,8 @@
- #ifndef T_SRV
- #define T_SRV 33
- #endif
--#ifndef T_CERT
--# define T_CERT 37
--#endif
-+#undef T_CERT
-+#define T_CERT 37
- 
- /* The standard SOCKS and TOR ports.  */
- #define SOCKS_PORT 1080
diff --git a/debian/patches/0034-scd-Handle-unexpected-suspend-resume-by-CCID-driver.patch b/debian/patches/0034-scd-Handle-unexpected-suspend-resume-by-CCID-driver.patch
deleted file mode 100644
index 53fa774..0000000
--- a/debian/patches/0034-scd-Handle-unexpected-suspend-resume-by-CCID-driver.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Wed, 12 Apr 2017 11:21:08 +0900
-Subject: scd: Handle unexpected suspend/resume by CCID driver.
-
-* scd/ccid-driver.c (bulk_in): Handle unexpected failure.
-
---
-
-GnuPG-bug-id: 3083
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit f053f99ed0b0c6de7b7c4a07cbd7f7d213ddf0db)
----
- scd/ccid-driver.c | 20 ++++++++++++++++----
- 1 file changed, 16 insertions(+), 4 deletions(-)
-
-diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
-index d135ca6..efdd6e1 100644
---- a/scd/ccid-driver.c
-+++ b/scd/ccid-driver.c
-@@ -2196,7 +2196,7 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length,
-       goto retry;
-     }
- 
--  if (buffer[0] != expected_type)
-+  if (buffer[0] != expected_type && buffer[0] != RDR_to_PC_SlotStatus)
-     {
-       DEBUGOUT_1 ("unexpected bulk-in msg type (%02x)\n", buffer[0]);
-       abort_cmd (handle, seqno);
-@@ -2236,11 +2236,23 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length,
-   switch ((buffer[7] & 0x03))
-     {
-     case 0: /* no error */ break;
--    case 1: return CCID_DRIVER_ERR_CARD_INACTIVE;
--    case 2: return CCID_DRIVER_ERR_NO_CARD;
-+    case 1: rc = CCID_DRIVER_ERR_CARD_INACTIVE; break;
-+    case 2: rc = CCID_DRIVER_ERR_NO_CARD; break;
-     case 3: /* RFU */ break;
-     }
--  return 0;
-+
-+  if (rc)
-+    {
-+      /*
-+       * Communication failure by device side.
-+       * Possibly, it was forcibly suspended and resumed.
-+       */
-+      DEBUGOUT ("CCID: card inactive/removed\n");
-+      handle->powered_off = 1;
-+      scd_kick_the_loop ();
-+    }
-+
-+  return rc;
- }
- 
- 
diff --git a/debian/patches/0035-common-Simplify-format_text.patch b/debian/patches/0035-common-Simplify-format_text.patch
deleted file mode 100644
index bb3dc98..0000000
--- a/debian/patches/0035-common-Simplify-format_text.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Wed, 12 Apr 2017 14:47:30 +0900
-Subject: common: Simplify format_text.
-
-* common/stringhelp.c (format_text): Don't allow IN_PLACE formatting.
-* common/stringhelp.h: Change the API with no IN_PLACE.
-* common/t-stringhelp.c (test_format_text): Follow the change.
-* g10/gpgcompose.c (show_help): Likewise.
-* g10/tofu.c (format_conflict_msg_part1, ask_about_binding)
-(show_statistics, show_warning): Likewise.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 7b4edf14bb16fbe786e55b829a208960396ce8df)
----
- common/stringhelp.c   |  9 ++++-----
- common/stringhelp.h   |  2 +-
- common/t-stringhelp.c |  2 +-
- g10/gpgcompose.c      |  2 +-
- g10/tofu.c            | 10 +++++-----
- 5 files changed, 12 insertions(+), 13 deletions(-)
-
-diff --git a/common/stringhelp.c b/common/stringhelp.c
-index bea1466..509d327 100644
---- a/common/stringhelp.c
-+++ b/common/stringhelp.c
-@@ -1443,11 +1443,10 @@ compare_version_strings (const char *my_version, const char *req_version)
- 
- 

- /* Format a string so that it fits within about TARGET_COLS columns.
--   If IN_PLACE is 0, then TEXT is copied to a new buffer, which is
--   returned.  Otherwise, TEXT is modified in place and returned.
-+   TEXT_IN is copied to a new buffer, which is returned.
-    Normally, target_cols will be 72 and max_cols is 80.  */
- char *
--format_text (char *text, int in_place, int target_cols, int max_cols)
-+format_text (const char *text_in, int target_cols, int max_cols)
- {
-   const int do_debug = 0;
- 
-@@ -1459,9 +1458,9 @@ format_text (char *text, int in_place, int target_cols, int max_cols)
-   char *last_space = NULL;
-   int last_space_cols = 0;
-   int copied_last_space = 0;
-+  char *text;
- 
--  if (! in_place)
--    text = xstrdup (text);
-+  text = xstrdup (text_in);
- 
-   p = line = text;
-   while (1)
-diff --git a/common/stringhelp.h b/common/stringhelp.h
-index 3852d0f..a643f35 100644
---- a/common/stringhelp.h
-+++ b/common/stringhelp.h
-@@ -155,7 +155,7 @@ int split_fields (char *string, char **array, int arraysize);
- int compare_version_strings (const char *my_version, const char *req_version);
- 
- /* Format a string so that it fits within about TARGET_COLS columns.  */
--char *format_text (char *text, int in_place, int target_cols, int max_cols);
-+char *format_text (const char *text, int target_cols, int max_cols);
- 
- 
- /*-- mapstrings.c --*/
-diff --git a/common/t-stringhelp.c b/common/t-stringhelp.c
-index a105ad1..869ca56 100644
---- a/common/t-stringhelp.c
-+++ b/common/t-stringhelp.c
-@@ -885,7 +885,7 @@ test_format_text (void)
-     {
-       struct test *test = &tests[i];
-       char *result =
--        format_text (test->input, 0, test->target_cols, test->max_cols);
-+        format_text (test->input, test->target_cols, test->max_cols);
-       if (strcmp (result, test->expected) != 0)
-         {
-           printf ("%s: Test #%d failed.\nExpected: '%s'\nResult: '%s'\n",
-diff --git a/g10/gpgcompose.c b/g10/gpgcompose.c
-index d585502..071d6bf 100644
---- a/g10/gpgcompose.c
-+++ b/g10/gpgcompose.c
-@@ -305,7 +305,7 @@ show_help (struct option options[])
- 
-       if (! option)
-         space = 72;
--      formatted = format_text (tmp, 0, space, space + 4);
-+      formatted = format_text (tmp, space, space + 4);
- 
-       if (tmp != help)
-         xfree (tmp);
-diff --git a/g10/tofu.c b/g10/tofu.c
-index 169e29e..a6d5461 100644
---- a/g10/tofu.c
-+++ b/g10/tofu.c
-@@ -1355,7 +1355,7 @@ format_conflict_msg_part1 (int policy, strlist_t conflict_set,
-   es_fputc (0, fp);
-   if (es_fclose_snatch (fp, (void **)&tmpstr, NULL))
-     log_fatal ("error snatching memory stream\n");
--  text = format_text (tmpstr, 0, 72, 80);
-+  text = format_text (tmpstr, 72, 80);
-   es_free (tmpstr);
- 
-   return text;
-@@ -1913,7 +1913,7 @@ ask_about_binding (ctrl_t ctrl,
-       /* TRANSLATORS: Please translate the text found in the source
-        * file below.  We don't directly internationalize that text so
-        * that we can tweak it without breaking translations.  */
--      char *text = _("TOFU detected a binding conflict");
-+      const char *text = _("TOFU detected a binding conflict");
-       char *textbuf;
-       if (!strcmp (text, "TOFU detected a binding conflict"))
-         {
-@@ -1926,7 +1926,7 @@ ask_about_binding (ctrl_t ctrl,
-             "attack!  Before accepting this association, you should talk to or "
-             "call the person to make sure this new key is legitimate.";
-         }
--      textbuf = format_text (text, 0, 72, 80);
-+      textbuf = format_text (text, 72, 80);
-       es_fprintf (fp, "\n%s\n", textbuf);
-       xfree (textbuf);
-     }
-@@ -3190,7 +3190,7 @@ show_statistics (tofu_dbs_t dbs,
-         es_fputc (0, fp);
-         if (es_fclose_snatch (fp, (void **) &tmpmsg, NULL))
-           log_fatal ("error snatching memory stream\n");
--        msg = format_text (tmpmsg, 0, 72, 80);
-+        msg = format_text (tmpmsg, 72, 80);
-         es_free (tmpmsg);
- 
-         /* Print a status line but suppress the trailing LF.
-@@ -3265,7 +3265,7 @@ show_warning (const char *fingerprint, strlist_t user_id_list)
-       strlist_length (user_id_list)),
-      set_policy_command);
- 
--  text = format_text (tmpmsg, 0, 72, 80);
-+  text = format_text (tmpmsg, 72, 80);
-   xfree (tmpmsg);
-   log_string (GPGRT_LOG_INFO, text);
-   xfree (text);
diff --git a/debian/patches/0036-dirmngr-Fix-possible-null-reference.patch b/debian/patches/0036-dirmngr-Fix-possible-null-reference.patch
deleted file mode 100644
index d71c926..0000000
--- a/debian/patches/0036-dirmngr-Fix-possible-null-reference.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Wed, 12 Apr 2017 15:58:11 +0900
-Subject: dirmngr: Fix possible null reference.
-
-* dirmngr/dns.c (dns_error_t dns_trace_fput): Check NULL.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 7ae1857c90ab43ad9e31f0fb6dbd37f25cc37278)
----
- dirmngr/dns.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/dirmngr/dns.c b/dirmngr/dns.c
-index 869e7ed..ebfd4c3 100644
---- a/dirmngr/dns.c
-+++ b/dirmngr/dns.c
-@@ -4594,8 +4594,9 @@ dns_error_t dns_trace_fput(const struct dns_trace_event *te, const void *data, s
- 
- 	if (fwrite(&tmp, 1, headsize, fp) < headsize)
- 		return errno;
--	if (fwrite(data, 1, datasize, fp) < datasize)
--		return errno;
-+	if (data)
-+		if (fwrite(data, 1, datasize, fp) < datasize)
-+			return errno;
- 	if (fflush(fp))
- 		return errno;
- 
diff --git a/debian/patches/0037-tools-Fix-condition-for-gpg-connect-agent.patch b/debian/patches/0037-tools-Fix-condition-for-gpg-connect-agent.patch
deleted file mode 100644
index d18f873..0000000
--- a/debian/patches/0037-tools-Fix-condition-for-gpg-connect-agent.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Wed, 12 Apr 2017 16:01:16 +0900
-Subject: tools: Fix condition for gpg-connect-agent.
-
-* tools/gpg-connect-agent.c (start_agent): Add paren.
-
---
-
-The intention is comparing the error code depending opt.use_dirmngr.
-Considering C Operator Precedence, we should have paren here.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit f52f6af834cc488d11612e349e4af023d69a45f4)
----
- tools/gpg-connect-agent.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c
-index ef71d27..f20d331 100644
---- a/tools/gpg-connect-agent.c
-+++ b/tools/gpg-connect-agent.c
-@@ -2237,7 +2237,7 @@ start_agent (void)
-     {
-       if (!opt.autostart
-           && (gpg_err_code (err)
--              == opt.use_dirmngr? GPG_ERR_NO_DIRMNGR : GPG_ERR_NO_AGENT))
-+              == (opt.use_dirmngr? GPG_ERR_NO_DIRMNGR : GPG_ERR_NO_AGENT)))
-         {
-           /* In the no-autostart case we don't make gpg-connect-agent
-              fail on a missing server.  */
diff --git a/debian/patches/0038-dirmngr-Fix-type-of-sock.patch b/debian/patches/0038-dirmngr-Fix-type-of-sock.patch
deleted file mode 100644
index ca08ee7..0000000
--- a/debian/patches/0038-dirmngr-Fix-type-of-sock.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Wed, 12 Apr 2017 20:50:50 +0900
-Subject: dirmngr: Fix type of sock.
-
-* dirmngr/http.c (send_request): Use assuan_fd_t for SOCK.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 6755b3b505f79a5a233b18e85f57a0d3a455e664)
----
- dirmngr/http.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/dirmngr/http.c b/dirmngr/http.c
-index 04a30d6..356e2bc 100644
---- a/dirmngr/http.c
-+++ b/dirmngr/http.c
-@@ -1643,7 +1643,7 @@ send_request (http_t hd, const char *httphost, const char *auth,
-   const char *http_proxy = NULL;
-   char *proxy_authstr = NULL;
-   char *authstr = NULL;
--  int sock;
-+  assuan_fd_t sock;
- 
-   if (hd->uri->use_tls && !hd->session)
-     {
diff --git a/debian/patches/0039-common-g10-Fix-enumeration-types.patch b/debian/patches/0039-common-g10-Fix-enumeration-types.patch
deleted file mode 100644
index c9fbd0a..0000000
--- a/debian/patches/0039-common-g10-Fix-enumeration-types.patch
+++ /dev/null
@@ -1,179 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Thu, 13 Apr 2017 12:54:52 +0900
-Subject: common, g10: Fix enumeration types.
-
-* common/openpgpdefs.h (CIPHER_ALGO_PRIVATE10, PUBKEY_ALGO_PRIVATE10)
-(DIGEST_ALGO_PRIVATE10, COMPRESS_ALGO_PRIVATE10): New.
-* g10/misc.c (map_pk_gcry_to_openpgp): Add type conversion.
-(map_cipher_openpgp_to_gcry, openpgp_cipher_algo_name)
-(openpgp_pk_test_algo2, map_md_openpgp_to_gcry)
-(pubkey_get_npkey): Add default handling.
-
---
-
-Compilers may emit code assuming the maximum value of enum type.
-According to OpenPGP specification, there are cases for private uses.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 74258278efacd7069e8c1df8ff6fc3f4675d713e)
----
- common/openpgpdefs.h | 12 ++++++++----
- g10/misc.c           | 23 +++++++++++++----------
- 2 files changed, 21 insertions(+), 14 deletions(-)
-
-diff --git a/common/openpgpdefs.h b/common/openpgpdefs.h
-index 3d5d306..85a4251 100644
---- a/common/openpgpdefs.h
-+++ b/common/openpgpdefs.h
-@@ -136,7 +136,8 @@ typedef enum
-     CIPHER_ALGO_TWOFISH	    = 10, /* 256 bit */
-     CIPHER_ALGO_CAMELLIA128 = 11,
-     CIPHER_ALGO_CAMELLIA192 = 12,
--    CIPHER_ALGO_CAMELLIA256 = 13
-+    CIPHER_ALGO_CAMELLIA256 = 13,
-+    CIPHER_ALGO_PRIVATE10   = 110
-   }
- cipher_algo_t;
- 
-@@ -152,7 +153,8 @@ typedef enum
-     PUBKEY_ALGO_ECDSA       = 19, /* RFC-6637  */
-     PUBKEY_ALGO_ELGAMAL     = 20, /* Elgamal encrypt+sign (legacy).  */
-     /*                        21     reserved by OpenPGP.            */
--    PUBKEY_ALGO_EDDSA       = 22  /* EdDSA (not yet assigned).       */
-+    PUBKEY_ALGO_EDDSA       = 22, /* EdDSA (not yet assigned).       */
-+    PUBKEY_ALGO_PRIVATE10   = 110
-   }
- pubkey_algo_t;
- 
-@@ -166,7 +168,8 @@ typedef enum
-     DIGEST_ALGO_SHA256      =  8,
-     DIGEST_ALGO_SHA384      =  9,
-     DIGEST_ALGO_SHA512      = 10,
--    DIGEST_ALGO_SHA224      = 11
-+    DIGEST_ALGO_SHA224      = 11,
-+    DIGEST_ALGO_PRIVATE10   = 110
-   }
- digest_algo_t;
- 
-@@ -176,7 +179,8 @@ typedef enum
-     COMPRESS_ALGO_NONE      =  0,
-     COMPRESS_ALGO_ZIP       =  1,
-     COMPRESS_ALGO_ZLIB      =  2,
--    COMPRESS_ALGO_BZIP2     =  3
-+    COMPRESS_ALGO_BZIP2     =  3,
-+    COMPRESS_ALGO_PRIVATE10 = 110
-   }
- compress_algo_t;
- 
-diff --git a/g10/misc.c b/g10/misc.c
-index 0ecdb04..abae6c9 100644
---- a/g10/misc.c
-+++ b/g10/misc.c
-@@ -473,8 +473,8 @@ map_cipher_openpgp_to_gcry (cipher_algo_t algo)
- #else
-     case CIPHER_ALGO_CAMELLIA256: return 0;
- #endif
-+    default: return 0;
-     }
--  return 0;
- }
- 
- /* The inverse function of above.  */
-@@ -509,7 +509,7 @@ map_pk_gcry_to_openpgp (enum gcry_pk_algos algo)
-     {
-     case GCRY_PK_ECDSA:  return PUBKEY_ALGO_ECDSA;
-     case GCRY_PK_ECDH:   return PUBKEY_ALGO_ECDH;
--    default: return algo < 110 ? algo : 0;
-+    default: return algo < 110 ? (pubkey_algo_t)algo : 0;
-     }
- }
- 
-@@ -565,7 +565,6 @@ openpgp_cipher_algo_name (cipher_algo_t algo)
- {
-   switch (algo)
-     {
--    case CIPHER_ALGO_NONE:        break;
-     case CIPHER_ALGO_IDEA:        return "IDEA";
-     case CIPHER_ALGO_3DES:	  return "3DES";
-     case CIPHER_ALGO_CAST5:	  return "CAST5";
-@@ -577,8 +576,9 @@ openpgp_cipher_algo_name (cipher_algo_t algo)
-     case CIPHER_ALGO_CAMELLIA128: return "CAMELLIA128";
-     case CIPHER_ALGO_CAMELLIA192: return "CAMELLIA192";
-     case CIPHER_ALGO_CAMELLIA256: return "CAMELLIA256";
-+    case CIPHER_ALGO_NONE:
-+    default: return "?";
-     }
--  return "?";
- }
- 
- 
-@@ -636,6 +636,9 @@ openpgp_pk_test_algo2 (pubkey_algo_t algo, unsigned int use)
-       if (RFC2440)
-         ga = GCRY_PK_ELG;
-       break;
-+
-+    default:
-+      break;
-     }
-   if (!ga)
-     return gpg_error (GPG_ERR_PUBKEY_ALGO);
-@@ -699,8 +702,8 @@ openpgp_pk_algo_name (pubkey_algo_t algo)
-     case PUBKEY_ALGO_ECDH:      return "ECDH";
-     case PUBKEY_ALGO_ECDSA:     return "ECDSA";
-     case PUBKEY_ALGO_EDDSA:     return "EDDSA";
-+    default: return "?";
-     }
--  return "?";
- }
- 
- 
-@@ -832,8 +835,8 @@ map_md_openpgp_to_gcry (digest_algo_t algo)
- #else
-     case DIGEST_ALGO_SHA512: return 0;
- #endif
-+    default: return 0;
-     }
--  return 0;
- }
- 
- 
-@@ -1652,8 +1655,8 @@ pubkey_get_npkey (pubkey_algo_t algo)
-     case PUBKEY_ALGO_ECDSA:     return 2;
-     case PUBKEY_ALGO_ELGAMAL:   return 3;
-     case PUBKEY_ALGO_EDDSA:     return 2;
-+    default: return 0;
-     }
--  return 0;
- }
- 
- 
-@@ -1672,8 +1675,8 @@ pubkey_get_nskey (pubkey_algo_t algo)
-     case PUBKEY_ALGO_ECDSA:     return 3;
-     case PUBKEY_ALGO_ELGAMAL:   return 4;
-     case PUBKEY_ALGO_EDDSA:     return 3;
-+    default: return 0;
-     }
--  return 0;
- }
- 
- /* Temporary helper. */
-@@ -1691,8 +1694,8 @@ pubkey_get_nsig (pubkey_algo_t algo)
-     case PUBKEY_ALGO_ECDSA:     return 2;
-     case PUBKEY_ALGO_ELGAMAL:   return 2;
-     case PUBKEY_ALGO_EDDSA:     return 2;
-+    default: return 0;
-     }
--  return 0;
- }
- 
- 
-@@ -1711,8 +1714,8 @@ pubkey_get_nenc (pubkey_algo_t algo)
-     case PUBKEY_ALGO_ECDSA:     return 0;
-     case PUBKEY_ALGO_ELGAMAL:   return 2;
-     case PUBKEY_ALGO_EDDSA:     return 0;
-+    default: return 0;
-     }
--  return 0;
- }
- 
- 
diff --git a/debian/patches/0040-dirmngr-Fix-thread-key-type.patch b/debian/patches/0040-dirmngr-Fix-thread-key-type.patch
deleted file mode 100644
index 3a36382..0000000
--- a/debian/patches/0040-dirmngr-Fix-thread-key-type.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Thu, 13 Apr 2017 13:06:38 +0900
-Subject: dirmngr: Fix thread key type.
-
-* dirmngr/dirmngr.c (my_tlskey_current_fd): Use npth_key_t.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 37018adce6ea4920b34d59afcfe4f55f716b3086)
----
- dirmngr/dirmngr.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
-index 3972977..4b01cb4 100644
---- a/dirmngr/dirmngr.c
-+++ b/dirmngr/dirmngr.c
-@@ -343,7 +343,7 @@ union int_and_ptr_u
-    local storage.  We use this in conjunction with the
-    log_set_pid_suffix_cb feature.  */
- #ifndef HAVE_W32_SYSTEM
--static int my_tlskey_current_fd;
-+static npth_key_t my_tlskey_current_fd;
- #endif
- 
- /* Prototypes. */
diff --git a/debian/patches/0041-dirmngr-Fix-alignment-of-ADDR.patch b/debian/patches/0041-dirmngr-Fix-alignment-of-ADDR.patch
deleted file mode 100644
index d6c640d..0000000
--- a/debian/patches/0041-dirmngr-Fix-alignment-of-ADDR.patch
+++ /dev/null
@@ -1,155 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Thu, 13 Apr 2017 14:33:33 +0900
-Subject: dirmngr: Fix alignment of ADDR.
-
-* dirmngr/dns-stuff.h (dns_addrinfo_s): Use struct sockaddr_storage
-for size and alignment.
-* dirmngr/dns-stuff.c (resolve_name_libdns): Follow the change.
-(resolve_dns_name): Use struct sockaddr_storage.
-(resolve_addr_standard, resolve_dns_addr): Likewise.
-(resolve_dns_addr): Likewise.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 892b33bb2c57785927ea6652091191da2deed464)
----
- dirmngr/dns-stuff.c | 31 +++++++++++++++++--------------
- dirmngr/dns-stuff.h |  4 ++--
- 2 files changed, 19 insertions(+), 16 deletions(-)
-
-diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c
-index cb0456a..0635115 100644
---- a/dirmngr/dns-stuff.c
-+++ b/dirmngr/dns-stuff.c
-@@ -844,7 +844,7 @@ resolve_name_libdns (const char *name, unsigned short port,
-             (*r_canonname)[strlen (*r_canonname)-1] = 0;
-         }
- 
--      dai = xtrymalloc (sizeof *dai + ent->ai_addrlen -1);
-+      dai = xtrymalloc (sizeof *dai);
-       if (dai == NULL)
-         {
-           err = gpg_error_from_syserror ();
-@@ -968,7 +968,7 @@ resolve_name_standard (const char *name, unsigned short port,
-       if (opt_disable_ipv6 && ai->ai_family == AF_INET6)
-         continue;
- 
--      dai = xtrymalloc (sizeof *dai + ai->ai_addrlen - 1);
-+      dai = xtrymalloc (sizeof *dai);
-       dai->family = ai->ai_family;
-       dai->socktype = ai->ai_socktype;
-       dai->protocol = ai->ai_protocol;
-@@ -1036,7 +1036,7 @@ resolve_dns_name (const char *name, unsigned short port,
- #ifdef USE_LIBDNS
- /* Resolve an address using libdns.  */
- static gpg_error_t
--resolve_addr_libdns (const struct sockaddr *addr, int addrlen,
-+resolve_addr_libdns (const struct sockaddr_storage *addr, int addrlen,
-                      unsigned int flags, char **r_name)
- {
-   gpg_error_t err;
-@@ -1050,13 +1050,13 @@ resolve_addr_libdns (const struct sockaddr *addr, int addrlen,
- 
-   /* First we turn ADDR into a DNS name (with ".arpa" suffix).  */
-   err = 0;
--  if (addr->sa_family == AF_INET6)
-+  if (addr->ss_family == AF_INET6)
-     {
-       const struct sockaddr_in6 *a6 = (const struct sockaddr_in6 *)addr;
-       if (!dns_aaaa_arpa (host, sizeof host, (void*)&a6->sin6_addr))
-         err = gpg_error (GPG_ERR_INV_OBJ);
-     }
--  else if (addr->sa_family == AF_INET)
-+  else if (addr->ss_family == AF_INET)
-     {
-       const struct sockaddr_in *a4 = (const struct sockaddr_in *)addr;
-       if (!dns_a_arpa (host, sizeof host, (void*)&a4->sin_addr))
-@@ -1144,18 +1144,19 @@ resolve_addr_libdns (const struct sockaddr *addr, int addrlen,
-       buflen = sizeof ptr.host;
- 
-       p = buffer;
--      if (addr->sa_family == AF_INET6 && (flags & DNS_WITHBRACKET))
-+      if (addr->ss_family == AF_INET6 && (flags & DNS_WITHBRACKET))
-         {
-           *p++ = '[';
-           buflen -= 2;
-         }
--      ec = getnameinfo (addr, addrlen, p, buflen, NULL, 0, NI_NUMERICHOST);
-+      ec = getnameinfo ((const struct sockaddr *)addr,
-+                        addrlen, p, buflen, NULL, 0, NI_NUMERICHOST);
-       if (ec)
-         {
-           err = map_eai_to_gpg_error (ec);
-           goto leave;
-         }
--      if (addr->sa_family == AF_INET6 && (flags & DNS_WITHBRACKET))
-+      if (addr->ss_family == AF_INET6 && (flags & DNS_WITHBRACKET))
-         strcat (buffer, "]");
-     }
- 
-@@ -1169,7 +1170,7 @@ resolve_addr_libdns (const struct sockaddr *addr, int addrlen,
- 
- /* Resolve an address using the standard system function.  */
- static gpg_error_t
--resolve_addr_standard (const struct sockaddr *addr, int addrlen,
-+resolve_addr_standard (const struct sockaddr_storage *addr, int addrlen,
-                        unsigned int flags, char **r_name)
- {
-   gpg_error_t err;
-@@ -1187,20 +1188,22 @@ resolve_addr_standard (const struct sockaddr *addr, int addrlen,
-   if ((flags & DNS_NUMERICHOST) || tor_mode)
-     ec = EAI_NONAME;
-   else
--    ec = getnameinfo (addr, addrlen, buffer, buflen, NULL, 0, NI_NAMEREQD);
-+    ec = getnameinfo ((const struct sockaddr *)addr,
-+                      addrlen, buffer, buflen, NULL, 0, NI_NAMEREQD);
- 
-   if (!ec && *buffer == '[')
-     ec = EAI_FAIL;  /* A name may never start with a bracket.  */
-   else if (ec == EAI_NONAME)
-     {
-       p = buffer;
--      if (addr->sa_family == AF_INET6 && (flags & DNS_WITHBRACKET))
-+      if (addr->ss_family == AF_INET6 && (flags & DNS_WITHBRACKET))
-         {
-           *p++ = '[';
-           buflen -= 2;
-         }
--      ec = getnameinfo (addr, addrlen, p, buflen, NULL, 0, NI_NUMERICHOST);
--      if (!ec && addr->sa_family == AF_INET6 && (flags & DNS_WITHBRACKET))
-+      ec = getnameinfo ((const struct sockaddr *)addr,
-+                        addrlen, p, buflen, NULL, 0, NI_NUMERICHOST);
-+      if (!ec && addr->ss_family == AF_INET6 && (flags & DNS_WITHBRACKET))
-         strcat (buffer, "]");
-     }
- 
-@@ -1229,7 +1232,7 @@ resolve_addr_standard (const struct sockaddr *addr, int addrlen,
- 
- /* A wrapper around getnameinfo.  */
- gpg_error_t
--resolve_dns_addr (const struct sockaddr *addr, int addrlen,
-+resolve_dns_addr (const struct sockaddr_storage *addr, int addrlen,
-                   unsigned int flags, char **r_name)
- {
-   gpg_error_t err;
-diff --git a/dirmngr/dns-stuff.h b/dirmngr/dns-stuff.h
-index 71605b7..adb0b80 100644
---- a/dirmngr/dns-stuff.h
-+++ b/dirmngr/dns-stuff.h
-@@ -78,7 +78,7 @@ struct dns_addrinfo_s
-   int socktype;
-   int protocol;
-   int addrlen;
--  struct sockaddr addr[1];
-+  struct sockaddr_storage addr[1];
- };
- 
- 
-@@ -142,7 +142,7 @@ gpg_error_t resolve_dns_name (const char *name, unsigned short port,
-                               dns_addrinfo_t *r_dai, char **r_canonname);
- 
- /* Function similar to getnameinfo.  */
--gpg_error_t resolve_dns_addr (const struct sockaddr *addr, int addrlen,
-+gpg_error_t resolve_dns_addr (const struct sockaddr_storage *addr, int addrlen,
-                               unsigned int flags, char **r_name);
- 
- /* Return true if NAME is a numerical IP address.  */
diff --git a/debian/patches/0042-dirmngr-Fix-http.c-for-sockaddr_storage.patch b/debian/patches/0042-dirmngr-Fix-http.c-for-sockaddr_storage.patch
deleted file mode 100644
index 7e17e53..0000000
--- a/debian/patches/0042-dirmngr-Fix-http.c-for-sockaddr_storage.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Thu, 13 Apr 2017 14:46:57 +0900
-Subject: dirmngr: Fix http.c for sockaddr_storage.
-
-dirmngr/http.c (use_socks): Use sockaddr_storage.
-(my_sock_new_for_addr, connect_server): Likewise.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 86dcb03134fd4957d51ebaa06b7991239f9ee56a)
----
- dirmngr/http.c | 13 +++++++------
- 1 file changed, 7 insertions(+), 6 deletions(-)
-
-diff --git a/dirmngr/http.c b/dirmngr/http.c
-index 356e2bc..e645a54 100644
---- a/dirmngr/http.c
-+++ b/dirmngr/http.c
-@@ -2470,13 +2470,13 @@ start_server ()
-  * This function is basically a copy of the same internal fucntion in
-  * Libassuan.  */
- static int
--use_socks (struct sockaddr *addr)
-+use_socks (struct sockaddr_storage *addr)
- {
-   int mode;
- 
-   if (assuan_sock_get_flag (ASSUAN_INVALID_FD, "tor-mode", &mode) || !mode)
-     return 0;  /* Not in Tor mode.  */
--  else if (addr->sa_family == AF_INET6)
-+  else if (addr->ss_family == AF_INET6)
-     {
-       struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *)addr;
-       const unsigned char *s;
-@@ -2491,7 +2491,7 @@ use_socks (struct sockaddr *addr)
- 
-       return 0; /* This is the loopback address.  */
-     }
--  else if (addr->sa_family == AF_INET)
-+  else if (addr->ss_family == AF_INET)
-     {
-       struct sockaddr_in *addr_in = (struct sockaddr_in *)addr;
- 
-@@ -2508,7 +2508,7 @@ use_socks (struct sockaddr *addr)
- /* Wrapper around assuan_sock_new which takes the domain from an
-  * address parameter.  */
- static assuan_fd_t
--my_sock_new_for_addr (struct sockaddr *addr, int type, int proto)
-+my_sock_new_for_addr (struct sockaddr_storage *addr, int type, int proto)
- {
-   int domain;
- 
-@@ -2519,7 +2519,7 @@ my_sock_new_for_addr (struct sockaddr *addr, int type, int proto)
-       domain = AF_INET;
-     }
-   else
--    domain = addr->sa_family;
-+    domain = addr->ss_family;
- 
-   return assuan_sock_new (domain, type, proto);
- }
-@@ -2644,7 +2644,8 @@ connect_server (const char *server, unsigned short port,
-             }
- 
-           anyhostaddr = 1;
--          if (assuan_sock_connect (sock, ai->addr, ai->addrlen))
-+          if (assuan_sock_connect (sock, (struct sockaddr *)ai->addr,
-+                                   ai->addrlen))
-             {
-               last_err = gpg_err_make (default_errsource,
-                                        gpg_err_code_from_syserror ());
diff --git a/debian/patches/0043-dirmngr-More-fix-for-Windows.patch b/debian/patches/0043-dirmngr-More-fix-for-Windows.patch
deleted file mode 100644
index c7b90e7..0000000
--- a/debian/patches/0043-dirmngr-More-fix-for-Windows.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Fri, 14 Apr 2017 08:32:49 +0900
-Subject: dirmngr: More fix for Windows.
-
-* dirmngr/http.c (simple_cookie_read, simple_cookie_write): Only
-valid with HTTP_USE_NTBTLS.
-(_my_socket_new): Simply cast to int since it's for debug.
-(_my_socket_ref, _my_socket_unref): Likewise.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 4771bad610eb59e701fe8e53468e2af22d45eeb0)
----
- dirmngr/http.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/dirmngr/http.c b/dirmngr/http.c
-index e645a54..9b70599 100644
---- a/dirmngr/http.c
-+++ b/dirmngr/http.c
-@@ -166,7 +166,7 @@ static gpgrt_ssize_t cookie_read (void *cookie, void *buffer, size_t size);
- static gpgrt_ssize_t cookie_write (void *cookie,
-                                    const void *buffer, size_t size);
- static int cookie_close (void *cookie);
--#ifdef HAVE_W32_SYSTEM
-+#if defined(HAVE_W32_SYSTEM) && defined(HTTP_USE_NTBTLS)
- static gpgrt_ssize_t simple_cookie_read (void *cookie,
-                                          void *buffer, size_t size);
- static gpgrt_ssize_t simple_cookie_write (void *cookie,
-@@ -213,7 +213,7 @@ typedef struct cookie_s *cookie_t;
- 
- /* Simple cookie functions.  Here the cookie is an int with the
-  * socket. */
--#ifdef HAVE_W32_SYSTEM
-+#if defined(HAVE_W32_SYSTEM) && defined(HTTP_USE_NTBTLS)
- static es_cookie_io_functions_t simple_cookie_functions =
-   {
-     simple_cookie_read,
-@@ -383,7 +383,7 @@ _my_socket_new (int lnr, assuan_fd_t fd)
-   so->refcount = 1;
-   if (opt_debug)
-     log_debug ("http.c:%d:socket_new: object %p for fd %d created\n",
--               lnr, so, so->fd);
-+               lnr, so, (int)so->fd);
-   return so;
- }
- #define my_socket_new(a) _my_socket_new (__LINE__, (a))
-@@ -395,7 +395,7 @@ _my_socket_ref (int lnr, my_socket_t so)
-   so->refcount++;
-   if (opt_debug > 1)
-     log_debug ("http.c:%d:socket_ref: object %p for fd %d refcount now %d\n",
--               lnr, so, so->fd, so->refcount);
-+               lnr, so, (int)so->fd, so->refcount);
-   return so;
- }
- #define my_socket_ref(a) _my_socket_ref (__LINE__,(a))
-@@ -413,7 +413,7 @@ _my_socket_unref (int lnr, my_socket_t so,
-       so->refcount--;
-       if (opt_debug > 1)
-         log_debug ("http.c:%d:socket_unref: object %p for fd %d ref now %d\n",
--                   lnr, so, so->fd, so->refcount);
-+                   lnr, so, (int)so->fd, so->refcount);
- 
-       if (!so->refcount)
-         {
-@@ -2923,7 +2923,7 @@ cookie_write (void *cookie, const void *buffer_arg, size_t size)
- }
- 
- 
--#ifdef HAVE_W32_SYSTEM
-+#if defined(HAVE_W32_SYSTEM) && defined(HTTP_USE_NTBTLS)
- static gpgrt_ssize_t
- simple_cookie_read (void *cookie, void *buffer, size_t size)
- {
diff --git a/debian/patches/0044-agent-Clean-up-error-initialize-return.patch b/debian/patches/0044-agent-Clean-up-error-initialize-return.patch
deleted file mode 100644
index f47ad7e..0000000
--- a/debian/patches/0044-agent-Clean-up-error-initialize-return.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Fri, 14 Apr 2017 12:54:06 +0900
-Subject: agent: Clean up error initialize/return.
-
-* agent/call-pinentry.c (start_pinentry): Return RC.
-* agent/command-ssh.c (ssh_handler_request_identities): Don't set ERR.
-* agent/findkey.c (try_unprotect_cb): Return ERR.
-(unprotect): Don't set RC.
-* agent/gpg-agent.c (handle_connections): Don't set fd.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 36c4e540f1a4992675ee6e0acca1231325457079)
----
- agent/call-pinentry.c | 2 +-
- agent/command-ssh.c   | 1 -
- agent/findkey.c       | 4 +---
- agent/gpg-agent.c     | 1 -
- 4 files changed, 2 insertions(+), 6 deletions(-)
-
-diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
-index a35a3fb..6524cb1 100644
---- a/agent/call-pinentry.c
-+++ b/agent/call-pinentry.c
-@@ -654,7 +654,7 @@ start_pinentry (ctrl_t ctrl)
- 
-   xfree (flavor_version);
- 
--  return 0;
-+  return rc;
- }
- 
- 
-diff --git a/agent/command-ssh.c b/agent/command-ssh.c
-index b15d8b2..965c865 100644
---- a/agent/command-ssh.c
-+++ b/agent/command-ssh.c
-@@ -2582,7 +2582,6 @@ ssh_handler_request_identities (ctrl_t ctrl,
- 
-   key_public = NULL;
-   key_counter = 0;
--  err = 0;
- 
-   key_blobs = es_fopenmem (0, "r+b");
-   if (! key_blobs)
-diff --git a/agent/findkey.c b/agent/findkey.c
-index 0b2ddf1..f3c8ca9 100644
---- a/agent/findkey.c
-+++ b/agent/findkey.c
-@@ -328,7 +328,7 @@ try_unprotect_cb (struct pin_entry_info_s *pi)
-       xfree (desc);
-     }
- 
--  return 0;
-+  return err;
- }
- 
- 
-@@ -552,7 +552,6 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
-               return 0;
-             }
-           xfree (pw);
--          rc  = 0;
-         }
-       else if (cache_mode == CACHE_MODE_NORMAL)
-         {
-@@ -590,7 +589,6 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
-                   return 0;
-                 }
-               xfree (pw);
--              rc  = 0;
-             }
-         }
- 
-diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
-index c16d9a3..098a335 100644
---- a/agent/gpg-agent.c
-+++ b/agent/gpg-agent.c
-@@ -3043,7 +3043,6 @@ handle_connections (gnupg_fd_t listen_fd,
-                       xfree (ctrl);
-                     }
-                 }
--              fd = GNUPG_INVALID_FD;
-             }
-         }
-     }
diff --git a/debian/patches/0045-g10-Fix-import-export-filter-property-match.patch b/debian/patches/0045-g10-Fix-import-export-filter-property-match.patch
deleted file mode 100644
index fbeac30..0000000
--- a/debian/patches/0045-g10-Fix-import-export-filter-property-match.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Mon, 17 Apr 2017 09:08:31 +0900
-Subject: g10: Fix import/export filter property match.
-
-* g10/import.c (impex_filter_getval): Fix to "else if".
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit af5f8ecf51f5e1f33e832d4946d02313b78a0536)
----
- g10/import.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/g10/import.c b/g10/import.c
-index 54d649b..ba1c44a 100644
---- a/g10/import.c
-+++ b/g10/import.c
-@@ -1261,7 +1261,7 @@ impex_filter_getval (void *cookie, const char *propname)
-           snprintf (numbuf, sizeof numbuf, "%d", pk->pubkey_algo);
-           result = numbuf;
-         }
--      if (!strcmp (propname, "key_created"))
-+      else if (!strcmp (propname, "key_created"))
-         {
-           snprintf (numbuf, sizeof numbuf, "%lu", (ulong)pk->timestamp);
-           result = numbuf;
diff --git a/debian/patches/0046-g10-Minor-fixes.patch b/debian/patches/0046-g10-Minor-fixes.patch
deleted file mode 100644
index f739460..0000000
--- a/debian/patches/0046-g10-Minor-fixes.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Mon, 17 Apr 2017 09:15:13 +0900
-Subject: g10: Minor fixes.
-
-* g10/export.c (cleartext_secret_key_to_openpgp): No initialization.
-(do_export_one_keyblock): Initialize with GPG_ERR_NOT_FOUND.
-* g10/getkey.c (get_best_pubkey_byname): Add non-null check.
-* g10/tofu.c (tofu_set_policy): ERR initialize to 0.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 0dec0cc281dfa26db89f8cc5ee002dea5c2b2e81)
----
- g10/export.c | 4 ++--
- g10/getkey.c | 3 ++-
- g10/tofu.c   | 2 +-
- 3 files changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/g10/export.c b/g10/export.c
-index 9b203e3..ce79a2f 100644
---- a/g10/export.c
-+++ b/g10/export.c
-@@ -580,7 +580,7 @@ canon_pk_algo (enum gcry_pk_algos algo)
- static gpg_error_t
- cleartext_secret_key_to_openpgp (gcry_sexp_t s_key, PKT_public_key *pk)
- {
--  gpg_error_t err = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
-+  gpg_error_t err;
-   gcry_sexp_t top_list;
-   gcry_sexp_t key = NULL;
-   char *key_type = NULL;
-@@ -1539,7 +1539,7 @@ do_export_one_keyblock (ctrl_t ctrl, kbnode_t keyblock, u32 *keyid,
-                         KEYDB_SEARCH_DESC *desc, size_t ndesc,
-                         size_t descindex, gcry_cipher_hd_t cipherhd)
- {
--  gpg_error_t err;
-+  gpg_error_t err = gpg_error (GPG_ERR_NOT_FOUND);
-   char *cache_nonce = NULL;
-   subkey_list_t subkey_list = NULL;  /* Track already processed subkeys. */
-   int skip_until_subkey = 0;
-diff --git a/g10/getkey.c b/g10/getkey.c
-index 99bb98e..6ee9fe5 100644
---- a/g10/getkey.c
-+++ b/g10/getkey.c
-@@ -1654,7 +1654,8 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk,
-                   if (! ctx->kr_handle)
-                     {
-                       xfree (ctx);
--                      *retctx = NULL;
-+                      if (retctx)
-+                        *retctx = NULL;
-                       rc = gpg_error_from_syserror ();
-                     }
-                   else
-diff --git a/g10/tofu.c b/g10/tofu.c
-index a6d5461..d97bbc3 100644
---- a/g10/tofu.c
-+++ b/g10/tofu.c
-@@ -3857,7 +3857,7 @@ tofu_get_validity (ctrl_t ctrl, PKT_public_key *pk, strlist_t user_id_list,
- gpg_error_t
- tofu_set_policy (ctrl_t ctrl, kbnode_t kb, enum tofu_policy policy)
- {
--  gpg_error_t err;
-+  gpg_error_t err = 0;
-   time_t now = gnupg_get_time ();
-   tofu_dbs_t dbs;
-   PKT_public_key *pk;
diff --git a/debian/patches/0047-g10-Fix-parse_ring_trust.patch b/debian/patches/0047-g10-Fix-parse_ring_trust.patch
deleted file mode 100644
index 05270b2..0000000
--- a/debian/patches/0047-g10-Fix-parse_ring_trust.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Mon, 17 Apr 2017 09:33:19 +0900
-Subject: g10: Fix parse_ring_trust.
-
-* g10/parse-packet.c (parse_ring_trust): Fix condition.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 256e861bce3dc9aba8fab4df47a40cae3bede175)
----
- g10/parse-packet.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/g10/parse-packet.c b/g10/parse-packet.c
-index 2be9849..fa44f83 100644
---- a/g10/parse-packet.c
-+++ b/g10/parse-packet.c
-@@ -2948,7 +2948,7 @@ parse_ring_trust (parse_packet_ctx_t ctx, unsigned long pktlen)
-       if (namelen && pktlen)
-         {
-           rt.url = xtrymalloc (namelen + 1);
--          if (rt.url)
-+          if (!rt.url)
-             {
-               err = gpg_error_from_syserror ();
-               goto leave;
diff --git a/debian/patches/0048-tests-Minor-memory-fix.patch b/debian/patches/0048-tests-Minor-memory-fix.patch
deleted file mode 100644
index eebcc6f..0000000
--- a/debian/patches/0048-tests-Minor-memory-fix.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Mon, 17 Apr 2017 09:44:37 +0900
-Subject: tests: Minor memory fix.
-
-* tests/openpgp/fake-pinentry.c (get_passphrase): Free the memory.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit b9440aa3693a4bb91e1ba8ff09e2d93ff22dd70a)
----
- tests/openpgp/fake-pinentry.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/tests/openpgp/fake-pinentry.c b/tests/openpgp/fake-pinentry.c
-index 6585b01..fb0c6ae 100644
---- a/tests/openpgp/fake-pinentry.c
-+++ b/tests/openpgp/fake-pinentry.c
-@@ -126,6 +126,8 @@ get_passphrase (const char *fname)
-                fname, fname_new, strerror (errno));
-       exit (1);
-     }
-+
-+  free (fname_new);
-   return passphrase;
- }
- 
diff --git a/debian/patches/0049-agent-Minor-cleanup.patch b/debian/patches/0049-agent-Minor-cleanup.patch
deleted file mode 100644
index b18e675..0000000
--- a/debian/patches/0049-agent-Minor-cleanup.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Mon, 17 Apr 2017 16:43:36 +0900
-Subject: agent: Minor cleanup.
-
-* agent/command-ssh.c (ssh_key_to_protected_buffer): Not touch ERR.
-* agent/command.c (cmd_genkey, cmd_import_key): Clean up.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 45c52cca1401b930878a8f901b63cfbb22e9e327)
----
- agent/command-ssh.c | 1 -
- agent/command.c     | 2 --
- 2 files changed, 3 deletions(-)
-
-diff --git a/agent/command-ssh.c b/agent/command-ssh.c
-index 965c865..648fc9e 100644
---- a/agent/command-ssh.c
-+++ b/agent/command-ssh.c
-@@ -2981,7 +2981,6 @@ ssh_key_to_protected_buffer (gcry_sexp_t key, const char *passphrase,
-   unsigned int buffer_new_n;
-   gpg_error_t err;
- 
--  err = 0;
-   buffer_new_n = gcry_sexp_sprint (key, GCRYSEXP_FMT_CANON, NULL, 0);
-   buffer_new = xtrymalloc_secure (buffer_new_n);
-   if (! buffer_new)
-diff --git a/agent/command.c b/agent/command.c
-index ab6d7eb..bd184ac 100644
---- a/agent/command.c
-+++ b/agent/command.c
-@@ -927,7 +927,6 @@ cmd_genkey (assuan_context_t ctx, char *line)
-     }
-   line = skip_options (line);
- 
--  p = line;
-   for (p=line; *p && *p != ' ' && *p != '\t'; p++)
-     ;
-   *p = '\0';
-@@ -2105,7 +2104,6 @@ cmd_import_key (assuan_context_t ctx, char *line)
-   force = has_option (line, "--force");
-   line = skip_options (line);
- 
--  p = line;
-   for (p=line; *p && *p != ' ' && *p != '\t'; p++)
-     ;
-   *p = '\0';
diff --git a/debian/patches/0050-agent-More-minor-change.patch b/debian/patches/0050-agent-More-minor-change.patch
deleted file mode 100644
index 20ff158..0000000
--- a/debian/patches/0050-agent-More-minor-change.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Mon, 17 Apr 2017 20:03:36 +0900
-Subject: agent: More minor change.
-
-* agent/command.c (cmd_pksign): Remove redundant assignment.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 9296aed4bd2ad09d23339e658264e557c5312585)
----
- agent/command.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/agent/command.c b/agent/command.c
-index bd184ac..df788ef 100644
---- a/agent/command.c
-+++ b/agent/command.c
-@@ -791,7 +791,6 @@ cmd_pksign (assuan_context_t ctx, char *line)
- 
-   line = skip_options (line);
- 
--  p = line;
-   for (p=line; *p && *p != ' ' && *p != '\t'; p++)
-     ;
-   *p = '\0';
diff --git a/debian/patches/0051-dirmngr-Fix-API-difference-for-Windows.patch b/debian/patches/0051-dirmngr-Fix-API-difference-for-Windows.patch
deleted file mode 100644
index c31ec9d..0000000
--- a/debian/patches/0051-dirmngr-Fix-API-difference-for-Windows.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Tue, 18 Apr 2017 09:03:14 +0900
-Subject: dirmngr: Fix API difference for Windows.
-
-* dirmngr/http.c (read_server, write_server): Use assuan_fd_t.
-(http_wait_response): Use FD2INT to get unsigned integer fd.
-(read_server, write_server): Likewise.
-(simple_cookie_read, simple_cookie_write): Use assuan_fd_t.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 0d0a7efa8fa0accc1da851917376e2328ef33c96)
----
- dirmngr/http.c | 19 ++++++++++---------
- 1 file changed, 10 insertions(+), 9 deletions(-)
-
-diff --git a/dirmngr/http.c b/dirmngr/http.c
-index 9b70599..e74d051 100644
---- a/dirmngr/http.c
-+++ b/dirmngr/http.c
-@@ -98,6 +98,7 @@
- 
- #include "../common/util.h"
- #include "../common/i18n.h"
-+#include "../common/sysutils.h" /* (gnupg_fd_t) */
- #include "dns-stuff.h"
- #include "http.h"
- #include "http-common.h"
-@@ -159,8 +160,8 @@ static gpg_error_t parse_response (http_t hd);
- static gpg_error_t connect_server (const char *server, unsigned short port,
-                                    unsigned int flags, const char *srvtag,
-                                    assuan_fd_t *r_sock);
--static gpgrt_ssize_t read_server (int sock, void *buffer, size_t size);
--static gpg_error_t write_server (int sock, const char *data, size_t length);
-+static gpgrt_ssize_t read_server (assuan_fd_t sock, void *buffer, size_t size);
-+static gpg_error_t write_server (assuan_fd_t sock, const char *data, size_t length);
- 
- static gpgrt_ssize_t cookie_read (void *cookie, void *buffer, size_t size);
- static gpgrt_ssize_t cookie_write (void *cookie,
-@@ -1065,7 +1066,7 @@ http_wait_response (http_t hd)
-      is not required but some very old servers (e.g. the original pksd
-      keyserver didn't worked without it.  */
-   if ((hd->flags & HTTP_FLAG_SHUTDOWN))
--    shutdown (hd->sock->fd, 1);
-+    shutdown (FD2INT (hd->sock->fd), 1);
-   hd->in_data = 0;
- 
-   /* Create a new cookie and a stream for reading.  */
-@@ -2694,7 +2695,7 @@ connect_server (const char *server, unsigned short port,
- /* Helper to read from a socket.  This handles npth things and
-  * EINTR.  */
- static gpgrt_ssize_t
--read_server (int sock, void *buffer, size_t size)
-+read_server (assuan_fd_t sock, void *buffer, size_t size)
- {
-   int nread;
- 
-@@ -2705,7 +2706,7 @@ read_server (int sock, void *buffer, size_t size)
- # if defined(USE_NPTH)
-       npth_unprotect ();
- # endif
--      nread = recv (sock, buffer, size, 0);
-+      nread = recv (FD2INT (sock), buffer, size, 0);
- # if defined(USE_NPTH)
-       npth_protect ();
- # endif
-@@ -2727,7 +2728,7 @@ read_server (int sock, void *buffer, size_t size)
- 
- 
- static gpg_error_t
--write_server (int sock, const char *data, size_t length)
-+write_server (assuan_fd_t sock, const char *data, size_t length)
- {
-   int nleft;
-   int nwritten;
-@@ -2739,7 +2740,7 @@ write_server (int sock, const char *data, size_t length)
- # if defined(USE_NPTH)
-       npth_unprotect ();
- # endif
--      nwritten = send (sock, data, nleft, 0);
-+      nwritten = send (FD2INT (sock), data, nleft, 0);
- # if defined(USE_NPTH)
-       npth_protect ();
- # endif
-@@ -2927,14 +2928,14 @@ cookie_write (void *cookie, const void *buffer_arg, size_t size)
- static gpgrt_ssize_t
- simple_cookie_read (void *cookie, void *buffer, size_t size)
- {
--  int sock = (int)(uintptr_t)cookie;
-+  assuan_fd_t sock = (assuan_fd_t)cookie;
-   return read_server (sock, buffer, size);
- }
- 
- static gpgrt_ssize_t
- simple_cookie_write (void *cookie, const void *buffer_arg, size_t size)
- {
--  int sock = (int)(uintptr_t)cookie;
-+  assuan_fd_t sock = (assuan_fd_t)cookie;
-   const char *buffer = buffer_arg;
-   int nwritten;
- 
diff --git a/debian/patches/0052-dirmngr-Fix-final-close-of-LISTEN_FD.patch b/debian/patches/0052-dirmngr-Fix-final-close-of-LISTEN_FD.patch
deleted file mode 100644
index 746370a..0000000
--- a/debian/patches/0052-dirmngr-Fix-final-close-of-LISTEN_FD.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Tue, 18 Apr 2017 09:04:11 +0900
-Subject: dirmngr: Fix final close of LISTEN_FD.
-
-* dirmngr/dirmngr.c (handle_connections): Close LISTEN_FD.
-
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 4b2581dc0ea1d03e70023bb0748aa0c21c0a2173)
----
- dirmngr/dirmngr.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
-index 4b01cb4..e30c16c 100644
---- a/dirmngr/dirmngr.c
-+++ b/dirmngr/dirmngr.c
-@@ -1946,7 +1946,6 @@ handle_connections (assuan_fd_t listen_fd)
- #endif
-   struct sockaddr_un paddr;
-   socklen_t plen = sizeof( paddr );
--  gnupg_fd_t fd;
-   int nfd, ret;
-   fd_set fdset, read_fdset;
-   int saved_errno;
-@@ -2071,6 +2070,8 @@ handle_connections (assuan_fd_t listen_fd)
- 
-       if (FD_ISSET (FD2INT (listen_fd), &read_fdset))
- 	{
-+          gnupg_fd_t fd;
-+
-           plen = sizeof paddr;
- 	  fd = INT2FD (npth_accept (FD2INT(listen_fd),
- 				    (struct sockaddr *)&paddr, &plen));
-@@ -2099,7 +2100,6 @@ handle_connections (assuan_fd_t listen_fd)
-                 }
- 	      npth_setname_np (thread, threadname);
-             }
--          fd = GNUPG_INVALID_FD;
- 	}
-     }
- 
-@@ -2109,7 +2109,7 @@ handle_connections (assuan_fd_t listen_fd)
- #endif /*HAVE_INOTIFY_INIT*/
-   npth_attr_destroy (&tattr);
-   if (listen_fd != GNUPG_INVALID_FD)
--    assuan_sock_close (fd);
-+    assuan_sock_close (listen_fd);
-   cleanup ();
-   log_info ("%s %s stopped\n", strusage(11), strusage(13));
- }
diff --git a/debian/patches/0053-g10-invalidate-the-fd-cache-for-keyring.patch b/debian/patches/0053-g10-invalidate-the-fd-cache-for-keyring.patch
deleted file mode 100644
index 8effa5a..0000000
--- a/debian/patches/0053-g10-invalidate-the-fd-cache-for-keyring.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Tue, 25 Apr 2017 07:48:51 +0900
-Subject: g10: invalidate the fd cache for keyring.
-
-* g10/keyring.c (keyring_search_reset): Don't keep the FD cache.
-
---
-
-GnuPG-bug-id: 3096
-Fixes-commit: 5556eca5acd46983bff0b38a1ffbc2f07fbaba9f
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 116cfd60779fbb3540da629db54dc2e148f4a3a2)
----
- g10/keyring.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/g10/keyring.c b/g10/keyring.c
-index 51b7687..e223f0f 100644
---- a/g10/keyring.c
-+++ b/g10/keyring.c
-@@ -663,7 +663,6 @@ keyring_search_reset (KEYRING_HANDLE hd)
- {
-     log_assert (hd);
- 
--    hd->current.kr = NULL;
-     iobuf_close (hd->current.iobuf);
-     hd->current.iobuf = NULL;
-     hd->current.eof = 0;
-@@ -671,6 +670,12 @@ keyring_search_reset (KEYRING_HANDLE hd)
- 
-     hd->found.kr = NULL;
-     hd->found.offset = 0;
-+
-+    if (hd->current.kr)
-+      iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0,
-+                   (char*)hd->current.kr->fname);
-+    hd->current.kr = NULL;
-+
-     return 0;
- }
- 
diff --git a/debian/patches/0054-dirmngr-Fix-aliasing-problem-in-dns.c.patch b/debian/patches/0054-dirmngr-Fix-aliasing-problem-in-dns.c.patch
deleted file mode 100644
index 07c2b54..0000000
--- a/debian/patches/0054-dirmngr-Fix-aliasing-problem-in-dns.c.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Tue, 25 Apr 2017 21:00:41 +0900
-Subject: dirmngr: Fix aliasing problem in dns.c.
-
-* dirmngr/dns.c (dns_ai_setent): Care about aliasing.
-
---
-
-Co-authored-by: Tomas Mraz
-GnuPG-bug-id: 3105
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 247932f367f856e7ce91528e14f0aaf838150857)
----
- dirmngr/dns.c | 34 ++++++++++++++++++----------------
- 1 file changed, 18 insertions(+), 16 deletions(-)
-
-diff --git a/dirmngr/dns.c b/dirmngr/dns.c
-index ebfd4c3..866f69d 100644
---- a/dirmngr/dns.c
-+++ b/dirmngr/dns.c
-@@ -9440,29 +9440,31 @@ void dns_ai_close(struct dns_addrinfo *ai) {
- 
- 
- static int dns_ai_setent(struct addrinfo **ent, union dns_any *any, enum dns_type type, struct dns_addrinfo *ai) {
--	struct sockaddr *saddr;
--	struct sockaddr_in sin;
--	struct sockaddr_in6 sin6;
-+	union u {
-+		struct sockaddr_in sin;
-+		struct sockaddr_in6 sin6;
-+		struct sockaddr_storage ss;
-+	} addr;
- 	const char *cname;
- 	size_t clen;
- 
- 	switch (type) {
- 	case DNS_T_A:
--		saddr	= memset(&sin, '\0', sizeof sin);
-+		memset(&addr.sin, '\0', sizeof addr.sin);
- 
--		sin.sin_family	= AF_INET;
--		sin.sin_port	= htons(ai->port);
-+		addr.sin.sin_family	= AF_INET;
-+		addr.sin.sin_port	= htons(ai->port);
- 
--		memcpy(&sin.sin_addr, any, sizeof sin.sin_addr);
-+		memcpy(&addr.sin.sin_addr, any, sizeof addr.sin.sin_addr);
- 
- 		break;
- 	case DNS_T_AAAA:
--		saddr	= memset(&sin6, '\0', sizeof sin6);
-+		memset(&addr.sin6, '\0', sizeof addr.sin6);
- 
--		sin6.sin6_family	= AF_INET6;
--		sin6.sin6_port		= htons(ai->port);
-+		addr.sin6.sin6_family	= AF_INET6;
-+		addr.sin6.sin6_port	= htons(ai->port);
- 
--		memcpy(&sin6.sin6_addr, any, sizeof sin6.sin6_addr);
-+		memcpy(&addr.sin6.sin6_addr, any, sizeof addr.sin6.sin6_addr);
- 
- 		break;
- 	default:
-@@ -9477,20 +9479,20 @@ static int dns_ai_setent(struct addrinfo **ent, union dns_any *any, enum dns_typ
- 		clen	= 0;
- 	}
- 
--	if (!(*ent = malloc(sizeof **ent + dns_sa_len(saddr) + ((ai->hints.ai_flags & AI_CANONNAME)? clen + 1 : 0))))
-+	if (!(*ent = malloc(sizeof **ent + dns_sa_len(&addr) + ((ai->hints.ai_flags & AI_CANONNAME)? clen + 1 : 0))))
- 		return dns_syerr();
- 
- 	memset(*ent, '\0', sizeof **ent);
- 
--	(*ent)->ai_family	= saddr->sa_family;
-+	(*ent)->ai_family	= addr.ss.ss_family;
- 	(*ent)->ai_socktype	= ai->hints.ai_socktype;
- 	(*ent)->ai_protocol	= ai->hints.ai_protocol;
- 
--	(*ent)->ai_addr		= memcpy((unsigned char *)*ent + sizeof **ent, saddr, dns_sa_len(saddr));
--	(*ent)->ai_addrlen	= dns_sa_len(saddr);
-+	(*ent)->ai_addr		= memcpy((unsigned char *)*ent + sizeof **ent, &addr, dns_sa_len(&addr));
-+	(*ent)->ai_addrlen	= dns_sa_len(&addr);
- 
- 	if (ai->hints.ai_flags & AI_CANONNAME)
--		(*ent)->ai_canonname	= memcpy((unsigned char *)*ent + sizeof **ent + dns_sa_len(saddr), cname, clen + 1);
-+		(*ent)->ai_canonname	= memcpy((unsigned char *)*ent + sizeof **ent + dns_sa_len(&addr), cname, clen + 1);
- 
- 	ai->found++;
- 
diff --git a/debian/patches/0055-doc-Fix-documentation.patch b/debian/patches/0055-doc-Fix-documentation.patch
deleted file mode 100644
index b1334b0..0000000
--- a/debian/patches/0055-doc-Fix-documentation.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Mon, 8 May 2017 12:18:19 +0200
-Subject: doc: Fix documentation.
-
---
-Fixes-commit: da4db172f6f8fb254b770e59770c531a488e2400
-Signed-off-by: Justus Winter <justus at g10code.com>
-
-(cherry picked from commit 6fdeef5b61c814ba0e475bfc36655e4fe69d7c41)
----
- doc/gpg.texi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/doc/gpg.texi b/doc/gpg.texi
-index c0d7cc4..3250d4b 100644
---- a/doc/gpg.texi
-+++ b/doc/gpg.texi
-@@ -393,7 +393,7 @@ functionality is also available as the subcommand "passwd" with the
- @option{--edit-card} command.
- 
- @item --delete-keys @code{name}
-- at itemx --delete-keys @code{name}
-+ at opindex delete-keys
- Remove key from the public keyring. In batch mode either @option{--yes} is
- required or the key must be specified by fingerprint. This is a
- safeguard against accidental deletion of multiple keys.
diff --git a/debian/patches/0056-gpg-Fix-typo.patch b/debian/patches/0056-gpg-Fix-typo.patch
deleted file mode 100644
index c2bdce9..0000000
--- a/debian/patches/0056-gpg-Fix-typo.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Mon, 8 May 2017 13:52:39 +0200
-Subject: gpg: Fix typo.
-
---
-Signed-off-by: Justus Winter <justus at g10code.com>
-
-(cherry picked from commit 692208fd6c1547cc7dd2062a1d1c9499bc0a8be4)
----
- g10/packet.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/g10/packet.h b/g10/packet.h
-index 3cb1e3b..78486d7 100644
---- a/g10/packet.h
-+++ b/g10/packet.h
-@@ -623,7 +623,7 @@ struct parse_packet_ctx_s
-   iobuf_t inp;       /* The input stream with the packets.  */
-   struct packet_struct last_pkt; /* The last parsed packet.  */
-   int free_last_pkt; /* Indicates that LAST_PKT must be freed.  */
--  int skip_meta;     /* Skip right trust packets.  */
-+  int skip_meta;     /* Skip ring trust packets.  */
- };
- typedef struct parse_packet_ctx_s *parse_packet_ctx_t;
- 
diff --git a/debian/patches/0057-gpg-Properly-account-for-ring-trust-packets.patch b/debian/patches/0057-gpg-Properly-account-for-ring-trust-packets.patch
deleted file mode 100644
index 3d6db10..0000000
--- a/debian/patches/0057-gpg-Properly-account-for-ring-trust-packets.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From: Justus Winter <justus at g10code.com>
-Date: Mon, 8 May 2017 14:24:00 +0200
-Subject: gpg: Properly account for ring trust packets.
-
-* g10/keyring.c (keyring_get_keyblock): Use the parser's packet count
-instead of counting ourself.
-* g10/packet.h (struct parse_packet_ctx_s): New field
-'n_parsed_packets'.
-(init_parse_packet): Initialize new field.
-* g10/parse-packet.c (parse): Count packets.
---
-
-The 'keyring' keystore depends on the number of packets for delete and
-update operations.  With the rework of the ring trust packets, the
-trust packets were no longer properly accounted for leading to keyring
-corruptions.
-
-The 'keybox' store was not affected.
-
-GnuPG-bug-id: 3123
-GnuPG-bug-id: 3135
-GnuPG-bug-id: 3144
-Fixes-commit: a8895c99a7d0750132477d80cd66caaf3a709113
-Signed-off-by: Justus Winter <justus at g10code.com>
-(cherry picked from commit 22739433e98be80e46fe7d01d52a9627c1aebaae)
----
- g10/keyring.c      | 4 ++--
- g10/packet.h       | 2 ++
- g10/parse-packet.c | 3 +++
- 3 files changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/g10/keyring.c b/g10/keyring.c
-index e223f0f..50f1b82 100644
---- a/g10/keyring.c
-+++ b/g10/keyring.c
-@@ -409,11 +409,11 @@ keyring_get_keyblock (KEYRING_HANDLE hd, KBNODE *ret_kb)
-     pkt = xmalloc (sizeof *pkt);
-     init_packet (pkt);
-     init_parse_packet (&parsectx, a);
--    hd->found.n_packets = 0;;
-+    hd->found.n_packets = 0;
-     lastnode = NULL;
-     save_mode = set_packet_list_mode(0);
-     while ((rc=parse_packet (&parsectx, pkt)) != -1) {
--        hd->found.n_packets++;
-+        hd->found.n_packets = parsectx.n_parsed_packets;
-         if (gpg_err_code (rc) == GPG_ERR_UNKNOWN_PACKET) {
- 	    free_packet (pkt, &parsectx);
- 	    init_packet (pkt);
-diff --git a/g10/packet.h b/g10/packet.h
-index 78486d7..6a98db9 100644
---- a/g10/packet.h
-+++ b/g10/packet.h
-@@ -624,6 +624,7 @@ struct parse_packet_ctx_s
-   struct packet_struct last_pkt; /* The last parsed packet.  */
-   int free_last_pkt; /* Indicates that LAST_PKT must be freed.  */
-   int skip_meta;     /* Skip ring trust packets.  */
-+  unsigned int n_parsed_packets;	/* Number of parsed packets.  */
- };
- typedef struct parse_packet_ctx_s *parse_packet_ctx_t;
- 
-@@ -633,6 +634,7 @@ typedef struct parse_packet_ctx_s *parse_packet_ctx_t;
-     (a)->last_pkt.pkt.generic= NULL;\
-     (a)->free_last_pkt = 0;         \
-     (a)->skip_meta = 0;             \
-+    (a)->n_parsed_packets = 0;      \
-   } while (0)
- 
- #define deinit_parse_packet(a) do { \
-diff --git a/g10/parse-packet.c b/g10/parse-packet.c
-index fa44f83..dbb7af8 100644
---- a/g10/parse-packet.c
-+++ b/g10/parse-packet.c
-@@ -764,6 +764,9 @@ parse (parse_packet_ctx_t ctx, PACKET *pkt, int onlykeypkts, off_t * retpos,
-                 partial? (new_ctb ? " partial" : " indeterminate") :"",
-                 new_ctb? " new-ctb":"");
- 
-+  /* Count it.  */
-+  ctx->n_parsed_packets++;
-+
-   pkt->pkttype = pkttype;
-   rc = GPG_ERR_UNKNOWN_PACKET;	/* default error */
-   switch (pkttype)
diff --git a/debian/patches/0058-g10-Remove-skeleton-options-files.patch b/debian/patches/0058-g10-Remove-skeleton-options-files.patch
deleted file mode 100644
index 1b87554..0000000
--- a/debian/patches/0058-g10-Remove-skeleton-options-files.patch
+++ /dev/null
@@ -1,445 +0,0 @@
-From: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
-Date: Mon, 17 Apr 2017 10:51:55 -0400
-Subject: g10: Remove skeleton options files.
-
-* build-aux/speed/w32/inst.nsi: stop installing skeleton files.
-* doc/gpg.texi: stop documenting skeleton files.
-* g10/Makefile.am: stop installing skeleton files.
-* g10/openfile.c (copy_options_file): Remove.
-(try_make_homedir): do not call copy_options_file.
-
---
-
-The defaults for gpg and dirmngr are good.  Both programs should work
-fine for the simple case without any config file.  The skeleton config
-files were being copied at first use (when the defaults are fine).
-But when the user needs to fiddle with them (after they've become
-sophisticated users), they're likely out of date because gpg has been
-upgraded since then.  So they're used for documentation, but they're
-stale documentation, which is probably worse than a clean empty file.
-
-GnuPG-bug-id: 3086
-Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
-(cherry picked from commit 201f86803017c1db373023f7b506d4a0dc644bbc)
----
- build-aux/speedo/w32/inst.nsi |   2 -
- doc/gpg.texi                  |   4 --
- g10/Makefile.am               |   8 +--
- g10/dirmngr-conf.skel         |  73 ----------------------
- g10/openfile.c                | 102 -------------------------------
- g10/options.skel              | 139 ------------------------------------------
- 6 files changed, 1 insertion(+), 327 deletions(-)
- delete mode 100644 g10/dirmngr-conf.skel
- delete mode 100644 g10/options.skel
-
-diff --git a/build-aux/speedo/w32/inst.nsi b/build-aux/speedo/w32/inst.nsi
-index b4d6994..7716f7f 100644
---- a/build-aux/speedo/w32/inst.nsi
-+++ b/build-aux/speedo/w32/inst.nsi
-@@ -608,8 +608,6 @@ Section "GnuPG" SEC_gnupg
-       Rename /REBOOTOK scdaemon.exe.tmp scdaemon.exe
- 
-   SetOutPath "$INSTDIR\share\gnupg"
--  File "share/gnupg/gpg-conf.skel"
--  File "share/gnupg/dirmngr-conf.skel"
-   File "share/gnupg/distsigkey.gpg"
-   File "share/gnupg/sks-keyservers.netCA.pem"
- 
-diff --git a/doc/gpg.texi b/doc/gpg.texi
-index 3250d4b..1a0ea55 100644
---- a/doc/gpg.texi
-+++ b/doc/gpg.texi
-@@ -3480,10 +3480,6 @@ files; They all live in the current home directory (@pxref{option
-   You should backup all files in this directory and take care to keep
-   this backup closed away.
- 
--  @item @value{DATADIR}/options.skel
--  @efindex options.skel
--  The skeleton options file.
--
- @end table
- 
- Operation is further controlled by a few environment variables:
-diff --git a/g10/Makefile.am b/g10/Makefile.am
-index f1d2d17..142b2f3 100644
---- a/g10/Makefile.am
-+++ b/g10/Makefile.am
-@@ -18,7 +18,7 @@
- 
- ## Process this file with automake to produce Makefile.in
- 
--EXTRA_DIST = options.skel dirmngr-conf.skel distsigkey.gpg \
-+EXTRA_DIST = distsigkey.gpg \
- 	     ChangeLog-2011 gpg-w32info.rc \
- 	     gpg.w32-manifest.in test.c t-keydb-keyring.kbx \
- 	     t-keydb-get-keyblock.gpg t-stutter-data.asc
-@@ -238,18 +238,12 @@ install-exec-hook:
- 
- install-data-local:
- 	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
--	$(INSTALL_DATA) $(srcdir)/options.skel \
--				$(DESTDIR)$(pkgdatadir)/gpg-conf.skel
--	$(INSTALL_DATA) $(srcdir)/dirmngr-conf.skel \
--				$(DESTDIR)$(pkgdatadir)/dirmngr-conf.skel
- 	$(INSTALL_DATA) $(srcdir)/distsigkey.gpg \
- 				$(DESTDIR)$(pkgdatadir)/distsigkey.gpg
- 
- # NB: For uninstalling gpg and gpgv we use -local because there is
- # no need for a specific order the targets need to be run.
- uninstall-local:
--	- at rm $(DESTDIR)$(pkgdatadir)/gpg-conf.skel
--	- at rm $(DESTDIR)$(pkgdatadir)/dirmngr-conf.skel
- 	- at rm $(DESTDIR)$(pkgdatadir)/distsigkey.gpg
- 	- at files=`for p in $(gpg2_hack_uninst); do echo "$$p"; done | \
- 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-diff --git a/g10/dirmngr-conf.skel b/g10/dirmngr-conf.skel
-deleted file mode 100644
-index e2885e6..0000000
---- a/g10/dirmngr-conf.skel
-+++ /dev/null
-@@ -1,73 +0,0 @@
--# dirmngr-conf.skel - Skeleton to create dirmngr.conf.
--# (Note that the first three lines are not copied.)
--#
--# dirmngr.conf - Options for Dirmngr
--# Written in 2015 by The GnuPG Project <https://gnupg.org>
--#
--# To the extent possible under law, the authors have dedicated all
--# copyright and related and neighboring rights to this file to the
--# public domain worldwide.  This file is distributed without any
--# warranty.  You should have received a copy of the CC0 Public Domain
--# Dedication along with this file. If not, see
--# <http://creativecommons.org/publicdomain/zero/1.0/>.
--#
--#
--# Unless you specify which option file to use (with the command line
--# option "--options filename"), the file ~/.gnupg/dirmngr.conf is used
--# by dirmngr.  The file can contain any long options which are valid
--# for Dirmngr.  If the first non white space character of a line is a
--# '#', the line is ignored.  Empty lines are also ignored.  See the
--# dirmngr man page or the manual for a list of options.
--#
--
--# --keyserver URI
--#
--# GPG can send and receive keys to and from a keyserver.  These
--# servers can be HKP, Email, or LDAP (if GnuPG is built with LDAP
--# support).
--#
--# Example HKP keyservers:
--#      hkp://keys.gnupg.net
--#
--# Example HKP keyserver using a Tor OnionBalance service
--#      hkp://jirk5u4osbsr34t5.onion
--#
--# Example HKPS keyservers (see --hkp-cacert below):
--#       hkps://hkps.pool.sks-keyservers.net
--#
--# Example LDAP keyservers:
--#      ldap://pgp.surfnet.nl:11370
--#
--# Regular URL syntax applies, and you can set an alternate port
--# through the usual method:
--#      hkp://keyserver.example.net:22742
--#
--# Note that most servers (with the notable exception of
--# ldap://keyserver.pgp.com) synchronize changes with each other.  Note
--# also that a single server name may actually point to multiple
--# servers via DNS round-robin or service records.
--#
--# If exactly two keyservers are configured and only one is a Tor hidden
--# service, Dirmngr selects the keyserver to use depending on whether
--# Tor is locally running or not (on a per session base).  Example:
--#
--#  keyserver hkp://jirk5u4osbsr34t5.onion
--#  keyserver hkps://hkps.pool.sks-keyservers.net
--#
--# If no keyserver is specified GnuPG uses
--#  hkps://hkps.pool.sks-keyservers.net
--
--
--# --hkp-cacert FILENAME
--#
--# For the "hkps" scheme (keyserver access over TLS), Dirmngr needs to
--# know the root certificates for verification of the TLS certificates
--# used for the connection.  Enter the full name of a file with the
--# root certificates here.  If that file is in PEM format a ".pem"
--# suffix is expected.  This option may be given multiple times to add
--# more root certificates.  Tilde expansion is supported.
--# This is not required when the default server
--#   hkps://hkps.pool.sks-keyservers.net
--# is used.
--
--#hkp-cacert /path/to/CA/sks-keyservers.netCA.pem
-diff --git a/g10/openfile.c b/g10/openfile.c
-index 2257107..a557a98 100644
---- a/g10/openfile.c
-+++ b/g10/openfile.c
-@@ -36,12 +36,6 @@
- #include "../common/status.h"
- #include "../common/i18n.h"
- 
--#ifdef USE_ONLY_8DOT3
--#define SKELEXT ".skl"
--#else
--#define SKELEXT EXTSEP_S "skel"
--#endif
--
- #ifdef HAVE_W32_SYSTEM
- #define NAME_OF_DEV_NULL "nul"
- #else
-@@ -373,93 +367,6 @@ open_sigfile (const char *sigfilename, progress_filter_context_t *pfx)
- }
- 
- 
--/****************
-- * Copy the option file skeleton for NAME to the given directory.
-- * Returns true if the new option file has any option.
-- */
--static int
--copy_options_file (const char *destdir, const char *name)
--{
--  const char *datadir = gnupg_datadir ();
--  char *fname;
--  FILE *src, *dst;
--  int linefeeds=0;
--  int c;
--  mode_t oldmask;
--  int esc = 0;
--  int any_option = 0;
--
--  if (opt.dry_run)
--    return 0;
--
--  fname = xstrconcat (datadir, DIRSEP_S, name, "-conf", SKELEXT, NULL);
--  src = fopen (fname, "r");
--  if (src && is_secured_file (fileno (src)))
--    {
--      fclose (src);
--      src = NULL;
--      gpg_err_set_errno (EPERM);
--    }
--  if (!src)
--    {
--      log_info (_("can't open '%s': %s\n"), fname, strerror(errno));
--      xfree(fname);
--      return 0;
--    }
--  xfree (fname);
--  fname = xstrconcat (destdir, DIRSEP_S, name, EXTSEP_S, "conf", NULL);
--
--  oldmask = umask (077);
--  if (is_secured_filename (fname))
--    {
--      dst = NULL;
--      gpg_err_set_errno (EPERM);
--    }
--  else
--    dst = fopen( fname, "w" );
--  umask (oldmask);
--
--  if (!dst)
--    {
--      log_info (_("can't create '%s': %s\n"), fname, strerror(errno) );
--      fclose (src);
--      xfree (fname);
--      return 0;
--    }
--
--  while ((c = getc (src)) != EOF)
--    {
--      if (linefeeds < 3)
--        {
--          if (c == '\n')
--            linefeeds++;
--	}
--      else
--        {
--          putc (c, dst);
--          if (c== '\n')
--            esc = 1;
--          else if (esc == 1)
--            {
--              if (c == ' ' || c == '\t')
--                ;
--              else if (c == '#')
--                esc = 2;
--              else
--                any_option = 1;
--            }
--        }
--    }
--
--  fclose (dst);
--  fclose (src);
--
--  log_info (_("new configuration file '%s' created\n"), fname);
--  xfree (fname);
--  return any_option;
--}
--
--
- void
- try_make_homedir (const char *fname)
- {
-@@ -489,15 +396,6 @@ try_make_homedir (const char *fname)
-                     fname, strerror(errno) );
-       else if (!opt.quiet )
-         log_info ( _("directory '%s' created\n"), fname );
--
--      /* Note that we also copy a dirmngr.conf file here.  This is
--         because gpg is likely the first invoked tool and thus creates
--         the directory.  */
--      copy_options_file (fname, DIRMNGR_NAME);
--      if (copy_options_file (fname, GPG_NAME))
--        log_info (_("WARNING: options in '%s'"
--                    " are not yet active during this run\n"),
--                  fname);
-     }
- }
- 
-diff --git a/g10/options.skel b/g10/options.skel
-deleted file mode 100644
-index 87fc627..0000000
---- a/g10/options.skel
-+++ /dev/null
-@@ -1,139 +0,0 @@
--# These first three lines are not copied to the gpg.conf file in
--# the users home directory.
--# $Id$
--# Options for GnuPG
--# Copyright 1998-2003, 2010 Free Software Foundation, Inc.
--# Copyright 1998-2003, 2010 Werner Koch
--#
--# This file is free software; as a special exception the author gives
--# unlimited permission to copy and/or distribute it, with or without
--# modifications, as long as this notice is preserved.
--#
--# This file is distributed in the hope that it will be useful, but
--# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
--# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--#
--# Unless you specify which option file to use (with the command line
--# option "--options filename"), GnuPG uses the file ~/.gnupg/gpg.conf
--# by default.
--#
--# An options file can contain any long options which are available in
--# GnuPG. If the first non white space character of a line is a '#',
--# this line is ignored.  Empty lines are also ignored.
--#
--# See the gpg man page for a list of options.
--
--
--# If you have more than 1 secret key in your keyring, you may want to
--# uncomment the following option and set your preferred keyid.
--
--#default-key 621CC013
--
--
--# If you do not pass a recipient to gpg, it will ask for one.  Using
--# this option you can encrypt to a default key.  Key validation will
--# not be done in this case.  The second form uses the default key as
--# default recipient.
--
--#default-recipient some-user-id
--#default-recipient-self
--
--
--# Group names may be defined like this:
--#   group mynames = paige 0x12345678 joe patti
--#
--# Any time "mynames" is a recipient (-r or --recipient), it will be
--# expanded to the names "paige", "joe", and "patti", and the key ID
--# "0x12345678".  Note there is only one level of expansion - you
--# cannot make an group that points to another group.  Note also that
--# if there are spaces in the recipient name, this will appear as two
--# recipients.  In these cases it is better to use the key ID.
--
--#group mynames = paige 0x12345678 joe patti
--
--
--# GnuPG can automatically locate and retrieve keys as needed using
--# this option.  This happens when encrypting to an email address (in
--# the "user@@example.com" form) and there are no keys matching
--# "user at example.com" in the local keyring.  This option takes any
--# number mechanisms which are tried in the given order.  The default
--# is "--auto-key-locate local" to search for keys only in the local
--# key database.  Uncomment the next line to locate a missing key using
--# two DNS based mechanisms.
--
--#auto-key-locate local,pka,dane
--
--
--# Common options for keyserver functions:
--# (Note that the --keyserver option has been moved to dirmngr.conf)
--#
--# include-disabled = when searching, include keys marked as "disabled"
--#                    on the keyserver (not all keyservers support this).
--#
--# no-include-revoked = when searching, do not include keys marked as
--#                      "revoked" on the keyserver.
--#
--# verbose = show more information as the keys are fetched.
--#           Can be used more than once to increase the amount
--#           of information shown.
--#
--# auto-key-retrieve = automatically fetch keys as needed from the keyserver
--#                     when verifying signatures or when importing keys that
--#                     have been revoked by a revocation key that is not
--#                     present on the keyring.
--#
--# no-include-attributes = do not include attribute IDs (aka "photo IDs")
--#                         when sending keys to the keyserver.
--
--#keyserver-options auto-key-retrieve
--
--
--# Uncomment this line to display photo user IDs in key listings and
--# when a signature from a key with a photo is verified.
--
--#show-photos
--
--
--# Use this program to display photo user IDs
--#
--# %i is expanded to a temporary file that contains the photo.
--# %I is the same as %i, but the file isn't deleted afterwards by GnuPG.
--# %k is expanded to the key ID of the key.
--# %K is expanded to the long OpenPGP key ID of the key.
--# %t is expanded to the extension of the image (e.g. "jpg").
--# %T is expanded to the MIME type of the image (e.g. "image/jpeg").
--# %f is expanded to the fingerprint of the key.
--# %% is %, of course.
--#
--# If %i or %I are not present, then the photo is supplied to the
--# viewer on standard input.  If your platform supports it, standard
--# input is the best way to do this as it avoids the time and effort in
--# generating and then cleaning up a secure temp file.
--#
--# The default program is "xloadimage -fork -quiet -title 'KeyID 0x%k' stdin"
--# On Mac OS X and Windows, the default is to use your regular JPEG image
--# viewer.
--#
--# Some other viewers:
--# photo-viewer "qiv %i"
--# photo-viewer "ee %i"
--# photo-viewer "display -title 'KeyID 0x%k'"
--#
--# This one saves a copy of the photo ID in your home directory:
--# photo-viewer "cat > ~/photoid-for-key-%k.%t"
--#
--# Use your MIME handler to view photos:
--# photo-viewer "metamail -q -d -b -c %T -s 'KeyID 0x%k' -f GnuPG"
--
--
--# Because some mailers change lines starting with "From " to ">From "
--# it is good to handle such lines in a special way when creating
--# cleartext signatures; all other PGP versions do it this way too.
--# To enable full OpenPGP compliance you may want to use this option.
--
--#no-escape-from-lines
--
--
--# Uncomment the following option to get rid of the copyright notice
--
--#no-greeting
diff --git a/debian/patches/0059-g10-For-signing-prefer-available-card-key-when-no-u-.patch b/debian/patches/0059-g10-For-signing-prefer-available-card-key-when-no-u-.patch
deleted file mode 100644
index d2fbbae..0000000
--- a/debian/patches/0059-g10-For-signing-prefer-available-card-key-when-no-u-.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From: NIIBE Yutaka <gniibe at fsij.org>
-Date: Thu, 27 Apr 2017 10:33:58 +0900
-Subject: g10: For signing, prefer available card key when no -u option.
-
-* g10/skclist.c (build_sk_list): Ask gpg-agent if card is available.
-Then, use the card key if any.
-
---
-
-GnuPG-bug-id: 1983
-Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
-(cherry picked from commit 97a2394ecafaa6f58e4a1f70ecfd04408dc15606)
----
- g10/skclist.c | 30 ++++++++++++++++++++++++++++--
- 1 file changed, 28 insertions(+), 2 deletions(-)
-
-diff --git a/g10/skclist.c b/g10/skclist.c
-index a016b62..489277c 100644
---- a/g10/skclist.c
-+++ b/g10/skclist.c
-@@ -31,6 +31,7 @@
- #include "keydb.h"
- #include "../common/util.h"
- #include "../common/i18n.h"
-+#include "call-agent.h"
- 
- 
- /* Return true if Libgcrypt's RNG is in faked mode.  */
-@@ -126,13 +127,38 @@ build_sk_list (ctrl_t ctrl,
-      select the best key.  If a key specification is ambiguous and we
-      are in batch mode, die.  */
- 
--  if (!locusr) /* No user ids given - use the default key.  */
-+  if (!locusr) /* No user ids given - use the card key or the default key.  */
-     {
-+      struct agent_card_info_s info;
-       PKT_public_key *pk;
-+      char *serialno;
- 
-+      memset (&info, 0, sizeof(info));
-       pk = xmalloc_clear (sizeof *pk);
-       pk->req_usage = use;
--      if ((err = getkey_byname (ctrl, NULL, pk, NULL, 1, NULL)))
-+
-+      /* Check if a card is available.  If any, use it.  */
-+      err = agent_scd_serialno (&serialno, NULL);
-+      if (!err)
-+        {
-+          xfree (serialno);
-+          err = agent_scd_getattr ("KEY-FPR", &info);
-+          if (err)
-+            log_error ("error retrieving key fingerprint from card: %s\n",
-+                       gpg_strerror (err));
-+          else if (info.fpr1valid)
-+            {
-+              if ((err = get_pubkey_byfprint (ctrl, pk, NULL, info.fpr1, 20)))
-+                {
-+                  info.fpr1valid = 0;
-+                  log_error ("error on card key to sign: %s, try default\n",
-+                             gpg_strerror (err));
-+                }
-+            }
-+        }
-+
-+      if (!info.fpr1valid
-+          && (err = getkey_byname (ctrl, NULL, pk, NULL, 1, NULL)))
- 	{
- 	  free_public_key (pk);
- 	  pk = NULL;
diff --git a/debian/patches/series b/debian/patches/series
index 74a06de..ea6811b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,50 +10,3 @@ gpg-agent-idling/0009-agent-Allow-threads-to-interrupt-main-select-loop-wi.patch
 gpg-agent-idling/0010-agent-Avoid-tight-timer-tick-when-possible.patch
 gpg-agent-idling/0011-agent-Avoid-scheduled-checks-on-socket-when-inotify-.patch
 skip-missing-signing-keys/0013-g10-Skip-signing-keys-where-no-secret-key-is-availab.patch
-0013-agent-Minor-fix-for-get_client_pid.patch
-0014-gpgscm-Simplify-substring-operation.patch
-0015-gpgscm-Simplify-get-output-string-operation.patch
-0016-gpgscm-Fix-copying-values.patch
-0017-tests-Fix-setup-of-ephemeral-home-directories.patch
-0018-tests-Fix-setup-of-ephemeral-home-directories.patch
-0019-tests-Make-test-more-robust.patch
-0020-gpgscm-Initialize-unused-slots-in-vectors.patch
-0021-gpgscm-Avoid-mutating-integer.patch
-0022-agent-Serialize-access-to-passphrase-cache.patch
-0023-scd-Don-t-keep-CCID-reader-open-when-card-is-not-ava.patch
-0024-scd-Internal-CCID-reader-cleanup.patch
-0025-gpg-Fix-printing-of-offline-taken-subkey.patch
-0026-doc-Explain-the-in-a-key-listing.patch
-0027-gpgscm-Fix-compact-vector-encoding.patch
-0028-gpgscm-Remove-arbitrary-limit-on-number-of-cell-segm.patch
-0029-gpgscm-Make-global-data-constant-when-possible.patch
-0030-gpgscm-Allocate-small-integers-in-the-rodata-section.patch
-0031-agent-Use-ll-length-specifier-when-time_t-is-larger.patch
-0032-g10-Minor-clean-up-for-export.c.patch
-0033-dirmngr-Fix-dns-stuff.c-in-another-way.patch
-0034-scd-Handle-unexpected-suspend-resume-by-CCID-driver.patch
-0035-common-Simplify-format_text.patch
-0036-dirmngr-Fix-possible-null-reference.patch
-0037-tools-Fix-condition-for-gpg-connect-agent.patch
-0038-dirmngr-Fix-type-of-sock.patch
-0039-common-g10-Fix-enumeration-types.patch
-0040-dirmngr-Fix-thread-key-type.patch
-0041-dirmngr-Fix-alignment-of-ADDR.patch
-0042-dirmngr-Fix-http.c-for-sockaddr_storage.patch
-0043-dirmngr-More-fix-for-Windows.patch
-0044-agent-Clean-up-error-initialize-return.patch
-0045-g10-Fix-import-export-filter-property-match.patch
-0046-g10-Minor-fixes.patch
-0047-g10-Fix-parse_ring_trust.patch
-0048-tests-Minor-memory-fix.patch
-0049-agent-Minor-cleanup.patch
-0050-agent-More-minor-change.patch
-0051-dirmngr-Fix-API-difference-for-Windows.patch
-0052-dirmngr-Fix-final-close-of-LISTEN_FD.patch
-0053-g10-invalidate-the-fd-cache-for-keyring.patch
-0054-dirmngr-Fix-aliasing-problem-in-dns.c.patch
-0055-doc-Fix-documentation.patch
-0056-gpg-Fix-typo.patch
-0057-gpg-Properly-account-for-ring-trust-packets.patch
-0058-g10-Remove-skeleton-options-files.patch
-0059-g10-For-signing-prefer-available-card-key-when-no-u-.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list