tawasuyu

sergio/takana

> Una distribución Linux construida con un laboratorio funcional y hermético en el > sótano, y una terminal mutable, clásica y anárquica en el piso de arriba — diseñada > desde el suelo para que una IA programadora entienda, modifique y co…

TOML 604Rust 56Shell 36Markdown 281227 Definiciones

⎇ 0e35652fb1a5ffed39cf6b2ba4f4fb693b7f1b21 recipes/HACK-revert-rfc4880bis-default.patch 207 líneas · 6.9 KB Historia crudo

base-system-3: promover cadena crypto + libusb/usbutils + gnupg (índice 743) ecf05e1b9 · sergio ·

1see:
2https://lore.kernel.org/distributions/F30D6590-3E0C-4865-A944-7DE118A619CF@gentoo.org/
3
4this reverts to the pre-2.4 default of key generation. the new one is
5(apparently) not compatible with a potential future specification, and
6generates incompatible keys by default.
7
8once this is figured out, find a better solution than this
9--
10From 8b3e9127ea02eae8ec3470149e22804a572df5b8 Mon Sep 17 00:00:00 2001
11From: psykose <alice@ayaya.dev>
12Date: Tue, 7 Feb 2023 10:14:34 +0100
13Subject: [PATCH] Revert "gpg: Merge --rfc4880bis features into --gnupg"
14
15This reverts commit 4583f4fe2e11b3dd070066628c3f16776cc74f72.
16---
17 g10/gpg.c    | 35 ++++++++++++++++++++++++++++++++---
18 g10/keygen.c | 30 ++++++++++++++++++------------
19 2 files changed, 50 insertions(+), 15 deletions(-)
20
21diff --git a/g10/gpg.c b/g10/gpg.c
22index b759cc1..5a04163 100644
23--- a/g10/gpg.c
24+++ b/g10/gpg.c
25@@ -247,6 +247,7 @@ enum cmd_and_opt_values
26     oGnuPG,
27     oRFC2440,
28     oRFC4880,
29+    oRFC4880bis,
30     oOpenPGP,
31     oPGP7,
32     oPGP8,
33@@ -635,6 +636,7 @@ static gpgrt_opt_t opts[] = {
34   ARGPARSE_s_n (oGnuPG, "no-pgp8", "@"),
35   ARGPARSE_s_n (oRFC2440, "rfc2440", "@"),
36   ARGPARSE_s_n (oRFC4880, "rfc4880", "@"),
37+  ARGPARSE_s_n (oRFC4880bis, "rfc4880bis", "@"),
38   ARGPARSE_s_n (oOpenPGP, "openpgp", N_("use strict OpenPGP behavior")),
39   ARGPARSE_s_n (oPGP7, "pgp6", "@"),
40   ARGPARSE_s_n (oPGP7, "pgp7", "@"),
41@@ -976,7 +978,6 @@ static gpgrt_opt_t opts[] = {
42   ARGPARSE_s_n (oNoop, "no-allow-multiple-messages", "@"),
43   ARGPARSE_s_s (oNoop, "aead-algo", "@"),
44   ARGPARSE_s_s (oNoop, "personal-aead-preferences","@"),
45-  ARGPARSE_s_n (oNoop, "rfc4880bis", "@"),
46   ARGPARSE_s_n (oNoop, "override-compliance-check", "@"),
47 
48 
49@@ -2225,7 +2226,7 @@ static struct gnupg_compliance_option compliance_options[] =
50   {
51     { "gnupg",      oGnuPG },
52     { "openpgp",    oOpenPGP },
53-    { "rfc4880bis", oGnuPG },
54+    { "rfc4880bis", oRFC4880bis },
55     { "rfc4880",    oRFC4880 },
56     { "rfc2440",    oRFC2440 },
57     { "pgp6",       oPGP7 },
58@@ -2241,8 +2242,28 @@ static struct gnupg_compliance_option compliance_options[] =
59 static void
60 set_compliance_option (enum cmd_and_opt_values option)
61 {
62+  opt.flags.rfc4880bis = 0;  /* Clear because it is initially set.  */
63+
64   switch (option)
65     {
66+    case oRFC4880bis:
67+      opt.flags.rfc4880bis = 1;
68+      opt.compliance = CO_RFC4880;
69+      opt.flags.dsa2 = 1;
70+      opt.flags.require_cross_cert = 1;
71+      opt.rfc2440_text = 0;
72+      opt.allow_non_selfsigned_uid = 1;
73+      opt.allow_freeform_uid = 1;
74+      opt.escape_from = 1;
75+      opt.not_dash_escaped = 0;
76+      opt.def_cipher_algo = 0;
77+      opt.def_digest_algo = 0;
78+      opt.cert_digest_algo = 0;
79+      opt.compress_algo = -1;
80+      opt.s2k_mode = 3; /* iterated+salted */
81+      opt.s2k_digest_algo = DIGEST_ALGO_SHA256;
82+      opt.s2k_cipher_algo = CIPHER_ALGO_AES256;
83+      break;
84     case oOpenPGP:
85     case oRFC4880:
86       /* This is effectively the same as RFC2440, but with
87@@ -2286,6 +2307,7 @@ set_compliance_option (enum cmd_and_opt_values option)
88     case oPGP8:  opt.compliance = CO_PGP8;  break;
89     case oGnuPG:
90       opt.compliance = CO_GNUPG;
91+      opt.flags.rfc4880bis = 1;
92       break;
93 
94     case oDE_VS:
95@@ -2488,6 +2510,7 @@ main (int argc, char **argv)
96     opt.emit_version = 0;
97     opt.weak_digests = NULL;
98     opt.compliance = CO_GNUPG;
99+    opt.flags.rfc4880bis = 1;
100 
101     /* Check special options given on the command line.  */
102     orig_argc = argc;
103@@ -3030,6 +3053,7 @@ main (int argc, char **argv)
104           case oOpenPGP:
105           case oRFC2440:
106           case oRFC4880:
107+          case oRFC4880bis:
108           case oPGP7:
109           case oPGP8:
110           case oGnuPG:
111@@ -3858,6 +3882,11 @@ main (int argc, char **argv)
112     if( may_coredump && !opt.quiet )
113 	log_info(_("WARNING: program may create a core file!\n"));
114 
115+    if (!opt.flags.rfc4880bis)
116+      {
117+        opt.mimemode = 0; /* This will use text mode instead.  */
118+      }
119+
120     if (eyes_only) {
121       if (opt.set_filename)
122 	  log_info(_("WARNING: %s overrides %s\n"),
123@@ -4074,7 +4103,7 @@ main (int argc, char **argv)
124     /* Check our chosen algorithms against the list of legal
125        algorithms. */
126 
127-    if(!GNUPG)
128+    if(!GNUPG && !opt.flags.rfc4880bis)
129       {
130 	const char *badalg=NULL;
131 	preftype_t badtype=PREFTYPE_NONE;
132diff --git a/g10/keygen.c b/g10/keygen.c
133index 7f54f7d..83fc3f3 100644
134--- a/g10/keygen.c
135+++ b/g10/keygen.c
136@@ -404,7 +404,7 @@ keygen_set_std_prefs (const char *string,int personal)
137 	      strcat(dummy_string,"S7 ");
138 	    strcat(dummy_string,"S2 "); /* 3DES */
139 
140-            if (!openpgp_aead_test_algo (AEAD_ALGO_OCB))
141+            if (opt.flags.rfc4880bis && !openpgp_aead_test_algo (AEAD_ALGO_OCB))
142 	      strcat(dummy_string,"A2 ");
143 
144             if (personal)
145@@ -889,7 +889,7 @@ keygen_upd_std_prefs (PKT_signature *sig, void *opaque)
146   /* Make sure that the MDC feature flag is set if needed.  */
147   add_feature_mdc (sig,mdc_available);
148   add_feature_aead (sig, aead_available);
149-  add_feature_v5 (sig, 1);
150+  add_feature_v5 (sig, opt.flags.rfc4880bis);
151   add_keyserver_modify (sig,ks_modify);
152   keygen_add_keyserver_url(sig,NULL);
153 
154@@ -3382,7 +3382,10 @@ parse_key_parameter_part (ctrl_t ctrl,
155                 }
156             }
157           else if (!ascii_strcasecmp (s, "v5"))
158-            keyversion = 5;
159+            {
160+              if (opt.flags.rfc4880bis)
161+                keyversion = 5;
162+            }
163           else if (!ascii_strcasecmp (s, "v4"))
164             keyversion = 4;
165           else
166@@ -3641,7 +3644,7 @@ parse_key_parameter_part (ctrl_t ctrl,
167  *   ecdsa := Use algorithm ECDSA.
168  *   eddsa := Use algorithm EdDSA.
169  *   ecdh  := Use algorithm ECDH.
170- *   v5    := Create version 5 key
171+ *   v5    := Create version 5 key (requires option --rfc4880bis)
172  *
173  * There are several defaults and fallbacks depending on the
174  * algorithm.  PART can be used to select which part of STRING is
175@@ -4513,9 +4516,9 @@ read_parameter_file (ctrl_t ctrl, const char *fname )
176 	    }
177 	}
178 
179-        if ((keywords[i].key == pVERSION
180-             || keywords[i].key == pSUBVERSION))
181-          ; /* Ignore version.  */
182+        if (!opt.flags.rfc4880bis && (keywords[i].key == pVERSION
183+                                      || keywords[i].key == pSUBVERSION))
184+          ; /* Ignore version unless --rfc4880bis is active.  */
185         else
186           {
187             r = xmalloc_clear( sizeof *r + strlen( value ) );
188@@ -4610,11 +4613,14 @@ quickgen_set_para (struct para_data_s *para, int for_subkey,
189       para = r;
190     }
191 
192-  r = xmalloc_clear (sizeof *r + 20);
193-  r->key = for_subkey? pSUBVERSION : pVERSION;
194-  snprintf (r->u.value, 20, "%d", version);
195-  r->next = para;
196-  para = r;
197+  if (opt.flags.rfc4880bis)
198+    {
199+      r = xmalloc_clear (sizeof *r + 20);
200+      r->key = for_subkey? pSUBVERSION : pVERSION;
201+      snprintf (r->u.value, 20, "%d", version);
202+      r->next = para;
203+      para = r;
204+    }
205 
206   if (keytime)
207     {