swm_version: 1 base: distro_version: dev pins: {} mutations: - type: source_patch tarball: https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.4.9.tar.bz2 sha256: dd17ab2e9a04fd79d39d853f599cbc852062ddb9ab52a4ddeb4176fd8b302964 patches: - "diff --git a/scd/app.c b/scd/app.c\nindex 21230bd..5999c37 100644\n--- a/scd/app.c\n+++ b/scd/app.c\n@@ -23,6 +23,7 @@\n #include \n #include \n #include \n+#include \n \n #ifndef HAVE_W32_SYSTEM\n #include \t\t/* F_SETFD F_GETFL F_SETFL O_NONBLOCK fcntl(2) */\n" - "From: Debian GnuPG Maintainers \nDate: Tue, 14 Apr 2015 10:02:31 -0400\nSubject: avoid-beta-warning\n\navoid self-describing as a beta\n\nUsing autoreconf against the source as distributed in tarball form\ninvariably results in a package that thinks it's a \"beta\" package,\nwhich produces the \"THIS IS A DEVELOPMENT VERSION\" warning string.\n\nsince we use dh_autoreconf, i need this patch to avoid producing\nbuilds that announce themselves as DEVELOPMENT VERSIONs.\n\nSee discussion at:\n\n http://lists.gnupg.org/pipermail/gnupg-devel/2014-November/029065.html\n---\n autogen.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\nPatch-Source: https://sources.debian.org/data/main/g/gnupg2/2.2.27-2/debian/patches/debian-packaging/avoid-beta-warning.patch\n\ndiff --git a/autogen.sh b/autogen.sh\nindex b238550..9b86d3f 100755\n--- a/autogen.sh\n+++ b/autogen.sh\n@@ -229,7 +229,7 @@ if [ \"$myhost\" = \"find-version\" ]; then\n esac\n \n beta=no\n- if [ -e .git ]; then\n+ if false; then\n ingit=yes\n tmp=$(git describe --match \"${matchstr1}\" --long 2>/dev/null)\n tmp=$(echo \"$tmp\" | sed s/^\"$package\"//)\n@@ -245,8 +245,8 @@ if [ \"$myhost\" = \"find-version\" ]; then\n rvd=$((0x$(echo ${rev} | dd bs=1 count=4 2>/dev/null)))\n else\n ingit=no\n- beta=yes\n- tmp=\"-unknown\"\n+ beta=no\n+ tmp=\"\"\n rev=\"0000000\"\n rvd=\"0\"\n fi\n" - "From: Daniel Kahn Gillmor \nDate: Mon, 29 Aug 2016 12:34:42 -0400\nSubject: avoid regenerating defsincdate (use shipped file)\n\nupstream ships doc/defsincdate in its tarballs. but doc/Makefile.am\ntries to rewrite doc/defsincdate if it notices that any of the files\nhave been modified more recently, and it does so assuming that we're\nrunning from a git repo.\n\nHowever, we'd rather ship the documents cleanly without regenerating\ndefsincdate -- we don't have a git repo available (debian builds from\nupstream tarballs) and any changes to the texinfo files (e.g. from\ndebian/patches/) might result in different dates on the files than we\nexpect after they're applied by dpkg or quilt or whatever, which makes\nthe datestamp unreproducible.\n---\n doc/Makefile.am | 9 ---------\n 1 file changed, 9 deletions(-)\n\nPatch-Source: https://sources.debian.org/data/main/g/gnupg2/2.2.27-2/debian/patches/debian-packaging/avoid-regenerating-defsincdate-use-shipped-file.patch\n\ndiff --git a/doc/Makefile.am b/doc/Makefile.am\nindex 2b882c3..6be571b 100644\n--- a/doc/Makefile.am\n+++ b/doc/Makefile.am\n@@ -178,15 +178,6 @@ $(myman_pages) gnupg.7 : yat2m-stamp defs.inc\n \n dist-hook: defsincdate\n \n-defsincdate: $(gnupg_TEXINFOS)\n-\t: >defsincdate ; \\\n-\tif test -e $(top_srcdir)/.git; then \\\n-\t (cd $(srcdir) && git log -1 --format='%ct' \\\n- -- $(gnupg_TEXINFOS) 2>/dev/null) >>defsincdate; \\\n- elif test x\"$$SOURCE_DATE_EPOCH\" != x; then \\\n-\t echo \"$$SOURCE_DATE_EPOCH\" >>defsincdate ; \\\n-\tfi\n-\n defs.inc : defsincdate Makefile mkdefsinc\n \tincd=\"`test -f defsincdate || echo '$(srcdir)/'`defsincdate\"; \\\n \t./mkdefsinc -C $(srcdir) --date \"`cat $$incd 2>/dev/null`\" \\\n" - "From: Daniel Kahn Gillmor \nDate: Tue, 11 Aug 2015 20:28:26 -0400\nSubject: Avoid simple memory dumps via ptrace\n\nThis avoids needing to setgid gpg-agent. It probably doesn't defend\nagainst all possible attacks, but it defends against one specific (and\neasy) one. If there are other protections we should do them too.\n\nThis will make it slightly harder to debug the agent because the\nnormal user won't be able to attach gdb to it directly while it runs.\n\nThe remaining options for debugging are:\n\n * launch the agent from gdb directly\n * connect gdb to a running agent as the superuser\n\nUpstream bug: https://dev.gnupg.org/T1211\n---\n agent/gpg-agent.c | 8 ++++++++\n configure.ac | 2 +-\n scd/scdaemon.c | 9 +++++++++\n 3 files changed, 18 insertions(+), 1 deletion(-)\n\nPatch-Source: https://sources.debian.org/data/main/g/gnupg2/2.2.27-2/debian/patches/block-ptrace-on-secret-daemons/Avoid-simple-memory-dumps-via-ptrace.patch\n\ndiff --git a/agent/gpg-agent.c b/agent/gpg-agent.c\nindex 412eb43..1de989b 100644\n--- a/agent/gpg-agent.c\n+++ b/agent/gpg-agent.c\n@@ -48,6 +48,9 @@\n # include \n #endif\n #include \n+#ifdef HAVE_PRCTL\n+# include \n+#endif\n \n #define INCLUDED_BY_MAIN_MODULE 1\n #define GNUPG_COMMON_NEED_AFLOCAL\n@@ -1095,6 +1098,11 @@ main (int argc, char **argv)\n \n early_system_init ();\n \n+#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)\n+ /* Disable ptrace on Linux without sgid bit */\n+ prctl(PR_SET_DUMPABLE, 0);\n+#endif\n+\n /* Before we do anything else we save the list of currently open\n file descriptors and the signal mask. This info is required to\n do the exec call properly. We don't need it on Windows. */\ndiff --git a/configure.ac b/configure.ac\nindex 099c6a8..4c9fcee 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -1419,7 +1419,7 @@ AC_CHECK_FUNCS([atexit canonicalize_file_name clock_gettime ctermid \\\n ftruncate funlockfile getaddrinfo getenv getpagesize \\\n getpwnam getpwuid getrlimit getrusage gettimeofday \\\n gmtime_r inet_ntop inet_pton isascii lstat memicmp \\\n- memmove memrchr mmap nl_langinfo pipe raise rand \\\n+ memmove memrchr mmap nl_langinfo pipe prctl raise rand \\\n setenv setlocale setrlimit sigaction sigprocmask \\\n stat stpcpy strcasecmp strerror strftime stricmp \\\n strlwr strncasecmp strpbrk strsep strtol strtoul \\\ndiff --git a/scd/scdaemon.c b/scd/scdaemon.c\nindex e43769f..2066543 100644\n--- a/scd/scdaemon.c\n+++ b/scd/scdaemon.c\n@@ -37,6 +37,9 @@\n #include \n #include \n #include \n+#ifdef HAVE_PRCTL\n+# include \n+#endif\n \n #define INCLUDED_BY_MAIN_MODULE 1\n #define GNUPG_COMMON_NEED_AFLOCAL\n@@ -462,6 +465,12 @@ main (int argc, char **argv )\n const char *application_priority = NULL;\n \n early_system_init ();\n+\n+#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)\n+ /* Disable ptrace on Linux without sgid bit */\n+ prctl(PR_SET_DUMPABLE, 0);\n+#endif\n+\n gpgrt_set_strusage (my_strusage);\n gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);\n /* Please note that we may running SUID(ROOT), so be very CAREFUL\n" - "note: combination of previous 0210+0220\n--\nFrom: Daniel Kahn Gillmor \nDate: Sat, 29 Oct 2016 01:25:05 -0400\nSubject: dirmngr: hkp: Avoid potential race condition when some hosts die.\n\n* dirmngr/ks-engine-hkp.c (select_random_host): Use atomic pass\nthrough the host table instead of risking out-of-bounds write.\n\n--\n\nMultiple threads may write to hosttable[x]->dead while\nselect_random_host() is running. For example, a housekeeping thread\nmight clear the ->dead bit on some entries, or another connection to\ndirmngr might manually mark a host as alive.\n\nIf one or more hosts are resurrected between the two loops over a\ngiven table in select_random_host(), then the allocation of tbl might\nnot be large enough, resulting in a write past the end of tbl on the\nsecond loop.\n\nThis change collapses the two loops into a single loop to avoid this\ndiscrepancy: each host's \"dead\" bit is now only checked once.\n\nAs Werner points out, this isn't currently strictly necessary, since\nnpth will not switch threads unless a blocking system call is made,\nand no blocking system call is made in these two loops.\n\nHowever, in a subsequent change in this series, we will call a\nfunction in this loop, and that function may sometimes write(2), or\ncall other functions, which may themselves block. Keeping this as a\nsingle-pass loop avoids the need to keep track of what might block and\nwhat might not.\n\nSigned-off-by: Daniel Kahn Gillmor \n---\n dirmngr/ks-engine-hkp.c | 23 ++++++++++-------------\n 1 file changed, 10 insertions(+), 13 deletions(-)\n\nPatch-Source: https://sources.debian.org/data/main/g/gnupg2/2.2.27-2/debian/patches/dirmngr-idling/dirmngr-hkp-Avoid-potential-race-condition-when-some.patch\n\nFrom: Daniel Kahn Gillmor \nDate: Sat, 29 Oct 2016 02:00:50 -0400\nSubject: dirmngr: Avoid need for hkp housekeeping.\n\n* dirmngr/ks-engine-hkp.c (host_is_alive): New function. Test whether\nhost is alive and resurrects it if it has been dead long enough.\n(select_random_host, map_host, ks_hkp_mark_host): Use host_is_alive\ninstead of testing hostinfo_t->dead directly.\n(ks_hkp_housekeeping): Remove function, no longer needed.\n* dirmngr/dirmngr.c (housekeeping_thread): Remove call to\nks_hkp_housekeeping.\n\n--\n\nRather than resurrecting hosts upon scheduled resurrection times, test\nwhether hosts should be resurrected as they're inspected for being\ndead. This removes the need for explicit housekeeping, and makes host\nresurrections happen \"just in time\", rather than being clustered on\nHOUSEKEEPING_INTERVAL seconds.\n\nAccording to 392e068e9f143d41f6350345619543cbcd47380f,\ndns_stuff_housekeeping only works on Windows, so it also isn't\nnecessary in debian, but it remains in place for now.\n\nSigned-off-by: Daniel Kahn Gillmor \n---\n dirmngr/dirmngr.c | 3 ---\n dirmngr/dirmngr.h | 1 -\n dirmngr/ks-engine-hkp.c | 72 ++++++++++++++++++++++++-------------------------\n 3 files changed, 35 insertions(+), 41 deletions(-)\n\nPatch-Source: https://sources.debian.org/data/main/g/gnupg2/2.2.27-2/debian/patches/dirmngr-idling/dirmngr-Avoid-need-for-hkp-housekeeping.patch\n\ndiff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c\nindex 977e7dd..5017c3f 100644\n--- a/dirmngr/dirmngr.c\n+++ b/dirmngr/dirmngr.c\n@@ -2085,7 +2085,6 @@ housekeeping_thread (void *arg)\n dirmngr_init_default_ctrl (&ctrlbuf);\n \n dns_stuff_housekeeping ();\n- ks_hkp_housekeeping (curtime);\n if (network_activity_seen)\n {\n network_activity_seen = 0;\ndiff --git a/dirmngr/ks-engine-hkp.c b/dirmngr/ks-engine-hkp.c\nindex 5292da8..690b37d 100644\n--- a/dirmngr/ks-engine-hkp.c\n+++ b/dirmngr/ks-engine-hkp.c\n@@ -221,6 +221,24 @@ host_in_pool_p (hostinfo_t hi, int tblidx)\n return 0;\n }\n \n+static int\n+host_is_alive (hostinfo_t hi, time_t curtime)\n+{\n+ if (!hi)\n+ return 0;\n+ if (!hi->dead)\n+ return 1;\n+ if (!hi->died_at)\n+ return 0; /* manually marked dead */\n+ if (hi->died_at + RESURRECT_INTERVAL <= curtime\n+ || hi->died_at > curtime)\n+ {\n+ hi->dead = 0;\n+ log_info (\"resurrected host '%s'\", hi->name);\n+ return 1;\n+ }\n+ return 0;\n+}\n \n /* Select a random host. Consult HI->pool which indices into the global\n hosttable. Returns index into HI->pool or -1 if no host could be\n@@ -228,32 +246,32 @@ host_in_pool_p (hostinfo_t hi, int tblidx)\n static int\n select_random_host (hostinfo_t hi)\n {\n- int *tbl;\n- size_t tblsize;\n+ int *tbl = NULL;\n+ size_t tblsize = 0;\n int pidx, idx;\n+ time_t curtime;\n+\n+ curtime = gnupg_get_time ();\n \n /* CHECKTHIS(); See */\n /* https://sources.debian.org/patches/gnupg2/2.2.20-1/dirmngr-idling/dirmngr-hkp-Avoid-potential-race-condition-when-some.patch/ */\n \n /* We create a new table so that we randomly select only from\n currently alive hosts. */\n- for (idx = 0, tblsize = 0;\n+ for (idx = 0;\n idx < hi->pool_len && (pidx = hi->pool[idx]) != -1;\n idx++)\n- if (hosttable[pidx] && !hosttable[pidx]->dead)\n- tblsize++;\n+ if (hosttable[pidx] && host_is_alive (hosttable[pidx], curtime))\n+ {\n+ tblsize++;\n+ tbl = xtryrealloc(tbl, tblsize * sizeof *tbl);\n+ if (!tbl)\n+ return -1; /* memory allocation failed! */\n+ tbl[tblsize-1] = pidx;\n+ }\n if (!tblsize)\n return -1; /* No hosts. */\n \n- tbl = xtrymalloc (tblsize * sizeof *tbl);\n- if (!tbl)\n- return -1;\n- for (idx = 0, tblsize = 0;\n- idx < hi->pool_len && (pidx = hi->pool[idx]) != -1;\n- idx++)\n- if (hosttable[pidx] && !hosttable[pidx]->dead)\n- tbl[tblsize++] = pidx;\n-\n if (tblsize == 1) /* Save a get_uint_nonce. */\n pidx = tbl[0];\n else\n@@ -471,6 +489,7 @@ map_host (ctrl_t ctrl, const char *name, const char *srvtag, int force_reselect,\n int is_pool;\n int new_hosts = 0;\n char *cname;\n+ time_t curtime;\n \n *r_host = NULL;\n if (r_httpflags)\n@@ -510,6 +529,7 @@ map_host (ctrl_t ctrl, const char *name, const char *srvtag, int force_reselect,\n }\n else\n hi = hosttable[idx];\n+ curtime = gnupg_get_time ();\n \n is_pool = hi->pool != NULL;\n \n@@ -616,7 +636,7 @@ map_host (ctrl_t ctrl, const char *name, const char *srvtag, int force_reselect,\n if (force_reselect)\n hi->poolidx = -1;\n else if (hi->poolidx >= 0 && hi->poolidx < hosttable_size\n- && hosttable[hi->poolidx] && hosttable[hi->poolidx]->dead)\n+ && hosttable[hi->poolidx] && !host_is_alive (hosttable[hi->poolidx], curtime))\n hi->poolidx = -1;\n \n /* Select a host if needed. */\n@@ -675,7 +695,7 @@ map_host (ctrl_t ctrl, const char *name, const char *srvtag, int force_reselect,\n return gpg_error_from_syserror ();\n }\n \n- if (hi->dead)\n+ if (!host_is_alive (hi, curtime))\n {\n log_error (\"host '%s' marked as dead\\n\", hi->name);\n if (r_httphost)\n@@ -781,7 +801,8 @@ ks_hkp_mark_host (ctrl_t ctrl, const char *name, int alive)\n {\n gpg_error_t err = 0;\n hostinfo_t hi, hi2;\n- int idx, idx2, idx3, n;\n+ int idx, idx2, idx3, n, is_alive;\n+ time_t curtime;\n \n if (!name || !*name || !strcmp (name, \"localhost\"))\n return 0;\n@@ -796,13 +817,15 @@ ks_hkp_mark_host (ctrl_t ctrl, const char *name, int alive)\n goto leave;\n }\n \n+ curtime = gnupg_get_time ();\n hi = hosttable[idx];\n- if (alive && hi->dead)\n+ is_alive = host_is_alive (hi, curtime);\n+ if (alive && !is_alive)\n {\n hi->dead = 0;\n err = ks_printf_help (ctrl, \"marking '%s' as alive\", name);\n }\n- else if (!alive && !hi->dead)\n+ else if (!alive && is_alive)\n {\n hi->dead = 1;\n hi->died_at = 0; /* Manually set dead. */\n@@ -836,14 +859,15 @@ ks_hkp_mark_host (ctrl_t ctrl, const char *name, int alive)\n \n hi2 = hosttable[n];\n if (!hi2)\n- ;\n- else if (alive && hi2->dead)\n+ continue;\n+ is_alive = host_is_alive (hi2, curtime);\n+ if (alive && !is_alive)\n {\n hi2->dead = 0;\n err = ks_printf_help (ctrl, \"marking '%s' as alive\",\n hi2->name);\n }\n- else if (!alive && !hi2->dead)\n+ else if (!alive && is_alive)\n {\n hi2->dead = 1;\n hi2->died_at = 0; /* Manually set dead. */\n@@ -1149,40 +1173,6 @@ ks_hkp_resolve (ctrl_t ctrl, parsed_uri_t uri)\n }\n \n \n-/* Housekeeping function called from the housekeeping thread. It is\n- used to mark dead hosts alive so that they may be tried again after\n- some time. */\n-void\n-ks_hkp_housekeeping (time_t curtime)\n-{\n- int idx;\n- hostinfo_t hi;\n-\n- if (npth_mutex_lock (&hosttable_lock))\n- log_fatal (\"failed to acquire mutex\\n\");\n-\n- for (idx=0; idx < hosttable_size; idx++)\n- {\n- hi = hosttable[idx];\n- if (!hi)\n- continue;\n- if (!hi->dead)\n- continue;\n- if (!hi->died_at)\n- continue; /* Do not resurrect manually shot hosts. */\n- if (hi->died_at + RESURRECT_INTERVAL <= curtime\n- || hi->died_at > curtime)\n- {\n- hi->dead = 0;\n- log_info (\"resurrected host '%s'\", hi->name);\n- }\n- }\n-\n- if (npth_mutex_unlock (&hosttable_lock))\n- log_fatal (\"failed to release mutex\\n\");\n-}\n-\n-\n /* Reload (SIGHUP) action for this module. We mark all host alive\n * even those which have been manually shot. */\n void\n" - | From: Daniel Kahn Gillmor From: Jakub Jirutka Date: Sun, 20 Nov 2016 23:09:24 -0500 Date: Wed, 18 Aug 2021 21:08:20 +0200 Subject: dirmngr: Avoid automatically checking upstream swdb. * dirmngr/dirmngr.c (housekeeping_thread): Avoid automatically checking upstream's software database. In Debian, software updates should be handled by the distro mechanism, and additional upstream checks only confuse the user. * doc/dirmngr.texi: document that --allow-version-check does nothing. Signed-off-by: Daniel Kahn Gillmor --- dirmngr/dirmngr.c | 2 -- doc/dirmngr.texi | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) Patch-Source: https://sources.debian.org/data/main/g/gnupg2/2.2.27-2/debian/patches/dirmngr-idling/dirmngr-Avoid-automatically-checking-upstream-swdb.patch diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 89eea4e..f26ed63 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -1955,8 +1955,6 @@ housekeeping_thread (void *arg) if (network_activity_seen) { network_activity_seen = 0; - if (opt.allow_version_check) - dirmngr_load_swdb (&ctrlbuf, 0); workqueue_run_global_tasks (&ctrlbuf, 1); } else diff --git a/doc/dirmngr.texi b/doc/dirmngr.texi index 843fdbf..84a8d28 100644 --- a/doc/dirmngr.texi +++ b/doc/dirmngr.texi @@ -291,9 +291,10 @@ Set the size of the queue for pending connections. The default is 64. @item --allow-version-check @opindex allow-version-check Allow Dirmngr to connect to @code{https://versions.gnupg.org} to get -the list of current software versions. If this option is enabled -the list is retrieved in case the local -copy does not exist or is older than 5 to 7 days. See the option +the list of current software versions. +On Alpine-packaged versions, this option does nothing since software +updates should be handled by the distribution. +See the option @option{--query-swdb} of the command @command{gpgconf} for more details. Note, that regardless of this option a version check can always be triggered using this command: - "From: Daniel Kahn Gillmor \nDate: Thu, 7 Sep 2017 18:49:35 -0400\nSubject: gpg: Default to SHA-512 for all signature types on RSA keys.\n\n* g10/main.h (DEFAULT_DIGEST_ALGO): Use SHA512 instead of SHA256 in\n--gnupg mode (leave strict RFC and PGP modes alone).\n* configure.ac: Do not allow disabling sha512.\n* g10/misc.c (map_md_openpgp_to_gcry): Always support SHA512.\n\n--\n\nSHA512 is more performant on most 64-bit platforms than SHA256, and\noffers a better security margin. It is also widely implemented.\n\nSigned-off-by: Daniel Kahn Gillmor \n---\n configure.ac | 2 +-\n g10/main.h | 2 +-\n g10/misc.c | 5 +----\n 3 files changed, 3 insertions(+), 6 deletions(-)\n\nPatch-Source: https://sources.debian.org/data/main/g/gnupg2/2.2.27-2/debian/patches/update-defaults/gpg-Default-to-SHA-512-for-all-signature-types-on-RS.patch\n\ndiff --git a/configure.ac b/configure.ac\nindex c31ae02..f7788b3 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -339,7 +339,7 @@ GNUPG_GPG_DISABLE_ALGO([rmd160],[RIPE-MD160 hash])\n GNUPG_GPG_DISABLE_ALGO([sha224],[SHA-224 hash])\n # SHA256 is a MUST algorithm for GnuPG.\n GNUPG_GPG_DISABLE_ALGO([sha384],[SHA-384 hash])\n-GNUPG_GPG_DISABLE_ALGO([sha512],[SHA-512 hash])\n+# SHA512 is a MUST algorithm for GnuPG.\n \n \n # Allow disabling of zip support.\ndiff --git a/g10/main.h b/g10/main.h\nindex b29e23e..0a64a21 100644\n--- a/g10/main.h\n+++ b/g10/main.h\n@@ -41,7 +41,7 @@\n # define DEFAULT_CIPHER_ALGO CIPHER_ALGO_3DES\n #endif\n \n-#define DEFAULT_DIGEST_ALGO ((GNUPG)? DIGEST_ALGO_SHA256:DIGEST_ALGO_SHA1)\n+#define DEFAULT_DIGEST_ALGO ((GNUPG)? DIGEST_ALGO_SHA512:DIGEST_ALGO_SHA1)\n #define DEFAULT_S2K_DIGEST_ALGO DEFAULT_DIGEST_ALGO\n #ifdef HAVE_ZIP\n # define DEFAULT_COMPRESS_ALGO COMPRESS_ALGO_ZIP\ndiff --git a/g10/misc.c b/g10/misc.c\nindex 2f4b452..0e6d9d5 100644\n--- a/g10/misc.c\n+++ b/g10/misc.c\n@@ -862,11 +862,8 @@ map_md_openpgp_to_gcry (digest_algo_t algo)\n case DIGEST_ALGO_SHA384: return 0;\n #endif\n \n-#ifdef GPG_USE_SHA512\n case DIGEST_ALGO_SHA512: return GCRY_MD_SHA512;\n-#else\n- case DIGEST_ALGO_SHA512: return 0;\n-#endif\n+\n default: return 0;\n }\n }\n" - "From: Daniel Kahn Gillmor \nDate: Wed, 3 Jan 2018 12:34:26 -0500\nSubject: gpg: Prefer SHA-512 and SHA-384 in personal-digest-preferences.\n\n* g10/keygen.c (keygen_set_std_prefs): prefer SHA-512\nand SHA-384 by default.\n\n--\n\nIn 8ede3ae29a39641a2f98ad9a4cf61ea99085a892, upstream changed the\ndefaults for --default-preference-list to advertise a preference for\nSHA-512, without touching --personal-digest-preferences. This makes\nthe same change for --personal-digest-preferences, since every modern\nOpenPGP library supports them all.\n\nSigned-off-by: Daniel Kahn Gillmor \n---\n g10/keygen.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\nPatch-Source: https://sources.debian.org/data/main/g/gnupg2/2.2.27-2/debian/patches/update-defaults/gpg-Prefer-SHA-512-and-SHA-384-in-personal-digest.patch\n\ndiff --git a/g10/keygen.c b/g10/keygen.c\nindex 79d4579..cb92468 100644\n--- a/g10/keygen.c\n+++ b/g10/keygen.c\n@@ -391,16 +391,16 @@ keygen_set_std_prefs (const char *string,int personal)\n if (personal)\n {\n /* The default internal hash algo order is:\n- * SHA-256, SHA-384, SHA-512, SHA-224, SHA-1.\n+ * SHA-512, SHA-384, SHA-256, SHA-224, SHA-1.\n */\n- if (!openpgp_md_test_algo (DIGEST_ALGO_SHA256))\n- strcat (dummy_string, \"H8 \");\n+ if (!openpgp_md_test_algo (DIGEST_ALGO_SHA512))\n+ strcat (dummy_string, \"H10 \");\n \n if (!openpgp_md_test_algo (DIGEST_ALGO_SHA384))\n strcat (dummy_string, \"H9 \");\n \n- if (!openpgp_md_test_algo (DIGEST_ALGO_SHA512))\n- strcat (dummy_string, \"H10 \");\n+ if (!openpgp_md_test_algo (DIGEST_ALGO_SHA256))\n+ strcat (dummy_string, \"H8 \");\n }\n else\n {\n" - "From: Daniel Kahn Gillmor \nDate: Mon, 15 Jul 2019 16:24:35 -0400\nSubject: gpg: drop import-clean from default keyserver import options\n\n* g10/gpg.c (main): drop IMPORT_CLEAN from the\ndefault opt.keyserver_options.import_options\n* doc/gpg.texi: reflect this change in the documentation\n\nGiven that SELF_SIGS_ONLY is already set, it's not clear what\nadditional benefit IMPORT_CLEAN provides. Furthermore, IMPORT_CLEAN\nmeans that receiving an OpenPGP certificate from a keyserver will\npotentially delete data that is otherwise held in the local keyring,\nwhich is surprising to users who expect retrieval from the keyservers\nto be purely additive.\n\nGnuPG-Bug-Id: 4628\nSigned-off-by: Daniel Kahn Gillmor \n---\n doc/gpg.texi | 2 +-\n g10/gpg.c | 3 +--\n 2 files changed, 2 insertions(+), 3 deletions(-)\n\nPatch-Source: https://sources.debian.org/data/main/g/gnupg2/2.2.27-2/debian/patches/gpg-drop-import-clean-from-default-keyserver-import-optio.patch\n\ndiff --git a/doc/gpg.texi b/doc/gpg.texi\nindex 804ecf9..b238278 100644\n--- a/doc/gpg.texi\n+++ b/doc/gpg.texi\n@@ -2047,7 +2047,7 @@ are available for all keyserver types, some common options are:\n \n @end table\n \n-The default list of options is: \"self-sigs-only, import-clean,\n+The default list of options is: \"self-sigs-only,\n repair-keys, repair-pks-subkey-bug, export-attributes\". However, if\n the actual used source is an LDAP server \"no-self-sigs-only\" is\n assumed unless \"self-sigs-only\" has been explicitly configured.\ndiff --git a/g10/gpg.c b/g10/gpg.c\nindex 68c0454..205de60 100644\n--- a/g10/gpg.c\n+++ b/g10/gpg.c\n@@ -2441,8 +2441,7 @@ main (int argc, char **argv)\n \t\t\t\t\t | IMPORT_REPAIR_PKS_SUBKEY_BUG\n | IMPORT_SELF_SIGS_ONLY\n | IMPORT_COLLAPSE_UIDS\n- | IMPORT_COLLAPSE_SUBKEYS\n- | IMPORT_CLEAN);\n+ | IMPORT_COLLAPSE_SUBKEYS);\n opt.keyserver_options.export_options = EXPORT_ATTRIBUTES;\n opt.keyserver_options.options = 0;\n opt.verify_options = (LIST_SHOW_UID_VALIDITY\n" - "--- gnupg-2.1.7/common/i18n.c.orig\t2015-08-31 20:40:18.752742866 +0300\n+++ gnupg-2.1.7/common/i18n.c\t2015-08-31 20:40:41.806336224 +0300\n@@ -85,8 +85,8 @@\n bindtextdomain (PACKAGE_GT, gnupg_localedir ());\n textdomain (PACKAGE_GT);\n #else\n-# ifdef ENABLE_NLS\n setlocale (LC_ALL, \"\" );\n+# ifdef ENABLE_NLS\n bindtextdomain (PACKAGE_GT, gnupg_localedir ());\n textdomain (PACKAGE_GT);\n # endif\n" - "see:\nhttps://lore.kernel.org/distributions/F30D6590-3E0C-4865-A944-7DE118A619CF@gentoo.org/\n\nthis reverts to the pre-2.4 default of key generation. the new one is\n(apparently) not compatible with a potential future specification, and\ngenerates incompatible keys by default.\n\nonce this is figured out, find a better solution than this\n--\nFrom 8b3e9127ea02eae8ec3470149e22804a572df5b8 Mon Sep 17 00:00:00 2001\nFrom: psykose \nDate: Tue, 7 Feb 2023 10:14:34 +0100\nSubject: [PATCH] Revert \"gpg: Merge --rfc4880bis features into --gnupg\"\n\nThis reverts commit 4583f4fe2e11b3dd070066628c3f16776cc74f72.\n---\n g10/gpg.c | 35 ++++++++++++++++++++++++++++++++---\n g10/keygen.c | 30 ++++++++++++++++++------------\n 2 files changed, 50 insertions(+), 15 deletions(-)\n\ndiff --git a/g10/gpg.c b/g10/gpg.c\nindex b759cc1..5a04163 100644\n--- a/g10/gpg.c\n+++ b/g10/gpg.c\n@@ -247,6 +247,7 @@ enum cmd_and_opt_values\n oGnuPG,\n oRFC2440,\n oRFC4880,\n+ oRFC4880bis,\n oOpenPGP,\n oPGP7,\n oPGP8,\n@@ -635,6 +636,7 @@ static gpgrt_opt_t opts[] = {\n ARGPARSE_s_n (oGnuPG, \"no-pgp8\", \"@\"),\n ARGPARSE_s_n (oRFC2440, \"rfc2440\", \"@\"),\n ARGPARSE_s_n (oRFC4880, \"rfc4880\", \"@\"),\n+ ARGPARSE_s_n (oRFC4880bis, \"rfc4880bis\", \"@\"),\n ARGPARSE_s_n (oOpenPGP, \"openpgp\", N_(\"use strict OpenPGP behavior\")),\n ARGPARSE_s_n (oPGP7, \"pgp6\", \"@\"),\n ARGPARSE_s_n (oPGP7, \"pgp7\", \"@\"),\n@@ -976,7 +978,6 @@ static gpgrt_opt_t opts[] = {\n ARGPARSE_s_n (oNoop, \"no-allow-multiple-messages\", \"@\"),\n ARGPARSE_s_s (oNoop, \"aead-algo\", \"@\"),\n ARGPARSE_s_s (oNoop, \"personal-aead-preferences\",\"@\"),\n- ARGPARSE_s_n (oNoop, \"rfc4880bis\", \"@\"),\n ARGPARSE_s_n (oNoop, \"override-compliance-check\", \"@\"),\n \n \n@@ -2225,7 +2226,7 @@ static struct gnupg_compliance_option compliance_options[] =\n {\n { \"gnupg\", oGnuPG },\n { \"openpgp\", oOpenPGP },\n- { \"rfc4880bis\", oGnuPG },\n+ { \"rfc4880bis\", oRFC4880bis },\n { \"rfc4880\", oRFC4880 },\n { \"rfc2440\", oRFC2440 },\n { \"pgp6\", oPGP7 },\n@@ -2241,8 +2242,28 @@ static struct gnupg_compliance_option compliance_options[] =\n static void\n set_compliance_option (enum cmd_and_opt_values option)\n {\n+ opt.flags.rfc4880bis = 0; /* Clear because it is initially set. */\n+\n switch (option)\n {\n+ case oRFC4880bis:\n+ opt.flags.rfc4880bis = 1;\n+ opt.compliance = CO_RFC4880;\n+ opt.flags.dsa2 = 1;\n+ opt.flags.require_cross_cert = 1;\n+ opt.rfc2440_text = 0;\n+ opt.allow_non_selfsigned_uid = 1;\n+ opt.allow_freeform_uid = 1;\n+ opt.escape_from = 1;\n+ opt.not_dash_escaped = 0;\n+ opt.def_cipher_algo = 0;\n+ opt.def_digest_algo = 0;\n+ opt.cert_digest_algo = 0;\n+ opt.compress_algo = -1;\n+ opt.s2k_mode = 3; /* iterated+salted */\n+ opt.s2k_digest_algo = DIGEST_ALGO_SHA256;\n+ opt.s2k_cipher_algo = CIPHER_ALGO_AES256;\n+ break;\n case oOpenPGP:\n case oRFC4880:\n /* This is effectively the same as RFC2440, but with\n@@ -2286,6 +2307,7 @@ set_compliance_option (enum cmd_and_opt_values option)\n case oPGP8: opt.compliance = CO_PGP8; break;\n case oGnuPG:\n opt.compliance = CO_GNUPG;\n+ opt.flags.rfc4880bis = 1;\n break;\n \n case oDE_VS:\n@@ -2488,6 +2510,7 @@ main (int argc, char **argv)\n opt.emit_version = 0;\n opt.weak_digests = NULL;\n opt.compliance = CO_GNUPG;\n+ opt.flags.rfc4880bis = 1;\n \n /* Check special options given on the command line. */\n orig_argc = argc;\n@@ -3030,6 +3053,7 @@ main (int argc, char **argv)\n case oOpenPGP:\n case oRFC2440:\n case oRFC4880:\n+ case oRFC4880bis:\n case oPGP7:\n case oPGP8:\n case oGnuPG:\n@@ -3858,6 +3882,11 @@ main (int argc, char **argv)\n if( may_coredump && !opt.quiet )\n \tlog_info(_(\"WARNING: program may create a core file!\\n\"));\n \n+ if (!opt.flags.rfc4880bis)\n+ {\n+ opt.mimemode = 0; /* This will use text mode instead. */\n+ }\n+\n if (eyes_only) {\n if (opt.set_filename)\n \t log_info(_(\"WARNING: %s overrides %s\\n\"),\n@@ -4074,7 +4103,7 @@ main (int argc, char **argv)\n /* Check our chosen algorithms against the list of legal\n algorithms. */\n \n- if(!GNUPG)\n+ if(!GNUPG && !opt.flags.rfc4880bis)\n {\n \tconst char *badalg=NULL;\n \tpreftype_t badtype=PREFTYPE_NONE;\ndiff --git a/g10/keygen.c b/g10/keygen.c\nindex 7f54f7d..83fc3f3 100644\n--- a/g10/keygen.c\n+++ b/g10/keygen.c\n@@ -404,7 +404,7 @@ keygen_set_std_prefs (const char *string,int personal)\n \t strcat(dummy_string,\"S7 \");\n \t strcat(dummy_string,\"S2 \"); /* 3DES */\n \n- if (!openpgp_aead_test_algo (AEAD_ALGO_OCB))\n+ if (opt.flags.rfc4880bis && !openpgp_aead_test_algo (AEAD_ALGO_OCB))\n \t strcat(dummy_string,\"A2 \");\n \n if (personal)\n@@ -889,7 +889,7 @@ keygen_upd_std_prefs (PKT_signature *sig, void *opaque)\n /* Make sure that the MDC feature flag is set if needed. */\n add_feature_mdc (sig,mdc_available);\n add_feature_aead (sig, aead_available);\n- add_feature_v5 (sig, 1);\n+ add_feature_v5 (sig, opt.flags.rfc4880bis);\n add_keyserver_modify (sig,ks_modify);\n keygen_add_keyserver_url(sig,NULL);\n \n@@ -3382,7 +3382,10 @@ parse_key_parameter_part (ctrl_t ctrl,\n }\n }\n else if (!ascii_strcasecmp (s, \"v5\"))\n- keyversion = 5;\n+ {\n+ if (opt.flags.rfc4880bis)\n+ keyversion = 5;\n+ }\n else if (!ascii_strcasecmp (s, \"v4\"))\n keyversion = 4;\n else\n@@ -3641,7 +3644,7 @@ parse_key_parameter_part (ctrl_t ctrl,\n * ecdsa := Use algorithm ECDSA.\n * eddsa := Use algorithm EdDSA.\n * ecdh := Use algorithm ECDH.\n- * v5 := Create version 5 key\n+ * v5 := Create version 5 key (requires option --rfc4880bis)\n *\n * There are several defaults and fallbacks depending on the\n * algorithm. PART can be used to select which part of STRING is\n@@ -4513,9 +4516,9 @@ read_parameter_file (ctrl_t ctrl, const char *fname )\n \t }\n \t}\n \n- if ((keywords[i].key == pVERSION\n- || keywords[i].key == pSUBVERSION))\n- ; /* Ignore version. */\n+ if (!opt.flags.rfc4880bis && (keywords[i].key == pVERSION\n+ || keywords[i].key == pSUBVERSION))\n+ ; /* Ignore version unless --rfc4880bis is active. */\n else\n {\n r = xmalloc_clear( sizeof *r + strlen( value ) );\n@@ -4610,11 +4613,14 @@ quickgen_set_para (struct para_data_s *para, int for_subkey,\n para = r;\n }\n \n- r = xmalloc_clear (sizeof *r + 20);\n- r->key = for_subkey? pSUBVERSION : pVERSION;\n- snprintf (r->u.value, 20, \"%d\", version);\n- r->next = para;\n- para = r;\n+ if (opt.flags.rfc4880bis)\n+ {\n+ r = xmalloc_clear (sizeof *r + 20);\n+ r->key = for_subkey? pSUBVERSION : pVERSION;\n+ snprintf (r->u.value, 20, \"%d\", version);\n+ r->next = para;\n+ para = r;\n+ }\n \n if (keytime)\n {\n" build: compiler: zig-cc target: x86_64-linux-musl link: static flags: [] phases: configure: "./configure \\\n\t--build=$CBUILD \\\n\t--host=$CHOST \\\n\t--prefix=/usr \\\n\t--sysconfdir=/etc \\\n\t--localstatedir=/var \\\n\t--enable-static \\\n\t--disable-shared \\\n\t--disable-nls \\\n\t--disable-tofu \\\n\t--disable-scdaemon \\\n\t--disable-dirmngr \\\n\t--disable-doc \\\n\t--disable-gpgtar \\\n\t--disable-wks-tools \\\n\t--disable-photo-viewers \\\n\t--without-readline \\\n\t--disable-bzip2 \\\n\t--with-libgpg-error-prefix=/usr \\\n\t--with-libgcrypt-prefix=/usr \\\n\t--with-libassuan-prefix=/usr \\\n\t--with-ksba-prefix=/usr \\\n\t--with-npth-prefix=/usr\n" compile: make install: | make DESTDIR="/out" install cd "/out" # compat symlinks ln -s gpg usr/bin/gpg2 ln -s gpgv usr/bin/gpgv2 # tool interno de tests rm -f usr/bin/gpgscm strip_debug: true target_bin: /usr/bin/gnupg expected_hash: b3:f610ba6a97022f72b5499a2535b36cdc069cd87ecc9303837d14b7416d302c44 deps: build: - binutils - libgpg-error - libgcrypt - libassuan - libksba - npth - zlib - linux-headers - pkgconf - make runtime: []