aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-12-07 14:45:44 +0100
committerChristian Grothoff <christian@grothoff.org>2019-12-07 14:45:44 +0100
commitb365e4d52a723b48bb018a8c2dbfc8fe1050988a (patch)
treee1580b45148cafa7f85dff8272f50dc18661b420 /src
parent3a13f497bc0edad6e1155685f167fafa5e58e75f (diff)
downloadgnunet-b365e4d52a723b48bb018a8c2dbfc8fe1050988a.tar.gz
gnunet-b365e4d52a723b48bb018a8c2dbfc8fe1050988a.zip
flip LSD0001 defines
Diffstat (limited to 'src')
-rw-r--r--src/gns/gnunet-gns.c9
-rw-r--r--src/gns/gnunet-service-gns_resolver.c41
-rw-r--r--src/gns/nss/nss_gns_query.c2
-rw-r--r--src/gns/plugin_gnsrecord_gns.c35
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c20
5 files changed, 31 insertions, 76 deletions
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c
index 600a9c9a5..37633daf1 100644
--- a/src/gns/gnunet-gns.c
+++ b/src/gns/gnunet-gns.c
@@ -238,15 +238,15 @@ run (void *cls,
238 if (NULL != (colon = strchr (lookup_name, ':'))) 238 if (NULL != (colon = strchr (lookup_name, ':')))
239 *colon = '\0'; 239 *colon = '\0';
240 } 240 }
241#ifdef LSD001 241
242 Idna_rc rc;
243 /** 242 /**
244 * If DNS compatibility is requested, we first verify that the 243 * If DNS compatibility is requested, we first verify that the
245 * lookup_name is in a DNS format. If yes, we convert it to UTF-8. 244 * lookup_name is in a DNS format. If yes, we convert it to UTF-8.
246 */ 245 */
247 if (GNUNET_YES == dns_compat) 246 if (GNUNET_YES == dns_compat)
248 { 247 {
249#endif 248 Idna_rc rc;
249
250 if (GNUNET_OK != GNUNET_DNSPARSER_check_name (lookup_name)) 250 if (GNUNET_OK != GNUNET_DNSPARSER_check_name (lookup_name))
251 { 251 {
252 fprintf (stderr, 252 fprintf (stderr,
@@ -255,7 +255,6 @@ run (void *cls,
255 global_ret = 3; 255 global_ret = 3;
256 return; 256 return;
257 } 257 }
258#ifdef LSD001
259 if (IDNA_SUCCESS != 258 if (IDNA_SUCCESS !=
260 (rc = idna_to_unicode_8z8z (lookup_name, &idna_name, 259 (rc = idna_to_unicode_8z8z (lookup_name, &idna_name,
261 IDNA_ALLOW_UNASSIGNED))) 260 IDNA_ALLOW_UNASSIGNED)))
@@ -269,7 +268,7 @@ run (void *cls,
269 } 268 }
270 lookup_name = idna_name; 269 lookup_name = idna_name;
271 } 270 }
272#endif 271
273 if (GNUNET_YES != 272 if (GNUNET_YES !=
274 GNUNET_CLIENT_test (cfg, 273 GNUNET_CLIENT_test (cfg,
275 "arm")) 274 "arm"))
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 4b2641818..dac0ab16a 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -1279,9 +1279,9 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1279 if (0 == rh->name_resolution_pos) 1279 if (0 == rh->name_resolution_pos)
1280 { 1280 {
1281 GNUNET_asprintf (&res, 1281 GNUNET_asprintf (&res,
1282 "%.*s", 1282 "%.*s",
1283 strlen (cname) - (strlen (tld) + 1), 1283 strlen (cname) - (strlen (tld) + 1),
1284 cname); 1284 cname);
1285 } 1285 }
1286 else 1286 else
1287 { 1287 {
@@ -1289,7 +1289,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1289 "%.*s.%.*s", 1289 "%.*s.%.*s",
1290 (int) rh->name_resolution_pos, 1290 (int) rh->name_resolution_pos,
1291 rh->name, 1291 rh->name,
1292 (int) strlen (cname) - (strlen(tld)+1), 1292 (int) strlen (cname) - (strlen (tld) + 1),
1293 cname); 1293 cname);
1294 } 1294 }
1295 rh->name_resolution_pos = strlen (res); 1295 rh->name_resolution_pos = strlen (res);
@@ -1747,14 +1747,8 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
1747 n = GNUNET_DNSPARSER_parse_name (rd[i].data, 1747 n = GNUNET_DNSPARSER_parse_name (rd[i].data,
1748 rd[i].data_size, 1748 rd[i].data_size,
1749 &off); 1749 &off);
1750#ifdef LSD001
1751 ip = GNUNET_strdup (&rd[i].data[off]); 1750 ip = GNUNET_strdup (&rd[i].data[off]);
1752 off += strlen (ip) + 1; 1751 off += strlen (ip) + 1;
1753#else
1754 ip = GNUNET_DNSPARSER_parse_name (rd[i].data,
1755 rd[i].data_size,
1756 &off);
1757#endif
1758 1752
1759 if ((NULL == n) || 1753 if ((NULL == n) ||
1760 (NULL == ip) || 1754 (NULL == ip) ||
@@ -1877,19 +1871,24 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
1877 (0 != rh->name_resolution_pos) ? "." : "", 1871 (0 != rh->name_resolution_pos) ? "." : "",
1878 ns); 1872 ns);
1879 GNUNET_free (ns); 1873 GNUNET_free (ns);
1880#ifdef LSD001 1874
1881 /* the GNS name is UTF-8 and may include multibyte chars.
1882 * We have to convert the combined name to a DNS-compatible IDNA.
1883 */
1884 char *tmp = ac->label;
1885 if (IDNA_SUCCESS != idna_to_ascii_8z (tmp, &ac->label, IDNA_ALLOW_UNASSIGNED))
1886 { 1875 {
1887 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1876 /* the GNS name is UTF-8 and may include multibyte chars.
1888 _ ("Name `%s' cannot be converted to IDNA."), tmp); 1877 * We have to convert the combined name to a DNS-compatible IDNA.
1889 return GNUNET_SYSERR; 1878 */
1879 char *tmp = ac->label;
1880
1881 if (IDNA_SUCCESS != idna_to_ascii_8z (tmp,
1882 &ac->label,
1883 IDNA_ALLOW_UNASSIGNED))
1884 {
1885 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1886 _ ("Name `%s' cannot be converted to IDNA."),
1887 tmp);
1888 return GNUNET_SYSERR;
1889 }
1890 GNUNET_free (tmp);
1890 } 1891 }
1891 GNUNET_free (tmp);
1892#endif
1893 1892
1894 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 1893 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
1895 rh->ac_tail, 1894 rh->ac_tail,
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c
index 7b69282cb..77ad3a358 100644
--- a/src/gns/nss/nss_gns_query.c
+++ b/src/gns/nss/nss_gns_query.c
@@ -74,9 +74,7 @@ gns_resolve_name (int af, const char *name, struct userdata *u)
74 { 74 {
75 char *argv[] = { "gnunet-gns", 75 char *argv[] = { "gnunet-gns",
76 "-r", /* Raw output for easier parsing */ 76 "-r", /* Raw output for easier parsing */
77#ifdef LSD001
78 "-d", /* DNS compatibility (allow IDNA names, no UTF-8) */ 77 "-d", /* DNS compatibility (allow IDNA names, no UTF-8) */
79#endif
80 "-t", 78 "-t",
81 (AF_INET6 == af) ? "AAAA" : "A", 79 (AF_INET6 == af) ? "AAAA" : "A",
82 "-u", 80 "-u",
diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c
index 38c3582c1..871fc9324 100644
--- a/src/gns/plugin_gnsrecord_gns.c
+++ b/src/gns/plugin_gnsrecord_gns.c
@@ -78,19 +78,8 @@ gns_value_to_string (void *cls,
78 GNUNET_free_non_null (ns); 78 GNUNET_free_non_null (ns);
79 return NULL; 79 return NULL;
80 } 80 }
81#ifdef LSD001 //DNS server IP/name must be UTF-8 81 /* DNS server IP/name must be UTF-8 */
82 ip = GNUNET_strdup((char*) &data[off]); 82 ip = GNUNET_strdup ((char*) &data[off]);
83#else
84 // Must be IP or DNS name
85 ip = GNUNET_DNSPARSER_parse_name (data, data_size, &off);
86 if ((NULL == ip) || (off != data_size))
87 {
88 GNUNET_break_op (0);
89 GNUNET_free_non_null (ns);
90 GNUNET_free_non_null (ip);
91 return NULL;
92 }
93#endif
94 GNUNET_asprintf (&nstr, "%s@%s", ns, ip); 83 GNUNET_asprintf (&nstr, "%s@%s", ns, ip);
95 GNUNET_free_non_null (ns); 84 GNUNET_free_non_null (ns);
96 GNUNET_free_non_null (ip); 85 GNUNET_free_non_null (ip);
@@ -215,9 +204,9 @@ gns_string_to_value (void *cls,
215 204
216 off = 0; 205 off = 0;
217 if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (nsbuf, 206 if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (nsbuf,
218 sizeof(nsbuf), 207 sizeof(nsbuf),
219 &off, 208 &off,
220 cpy)) 209 cpy))
221 { 210 {
222 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 211 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
223 _ ( 212 _ (
@@ -226,21 +215,9 @@ gns_string_to_value (void *cls,
226 GNUNET_free (cpy); 215 GNUNET_free (cpy);
227 return GNUNET_SYSERR; 216 return GNUNET_SYSERR;
228 } 217 }
229#ifdef LSD001 //The DNS server location/name is in UTF-8 218 /* The DNS server location/name is in UTF-8 */
230 GNUNET_memcpy (&nsbuf[off], at, strlen (at) + 1); 219 GNUNET_memcpy (&nsbuf[off], at, strlen (at) + 1);
231 off += strlen (at) + 1; 220 off += strlen (at) + 1;
232#else
233 if (GNUNET_OK !=
234 GNUNET_DNSPARSER_builder_add_name (nsbuf, sizeof(nsbuf), &off, at))
235 {
236 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
237 _ (
238 "Failed to serialize GNS2DNS record with value `%s': Not a DNS name\n"),
239 s);
240 GNUNET_free (cpy);
241 return GNUNET_SYSERR;
242 }
243#endif
244 GNUNET_free (cpy); 221 GNUNET_free (cpy);
245 *data_size = off; 222 *data_size = off;
246 *data = GNUNET_malloc (off); 223 *data = GNUNET_malloc (off);
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
index 2b05dea56..b27688019 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/gnsrecord/gnsrecord_crypto.c
@@ -54,12 +54,7 @@ derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
54{ 54{
55 static const char ctx_key[] = "gns-aes-ctx-key"; 55 static const char ctx_key[] = "gns-aes-ctx-key";
56 static const char ctx_iv[] = "gns-aes-ctx-iv"; 56 static const char ctx_iv[] = "gns-aes-ctx-iv";
57/** 57
58 * Next time we break protocol (v12) we harmonize the KDF usage in GNS:
59 * We use the strings above as salt and the public key as IKM similar to
60 * how derive_h is done in crypto_ecc.c.
61 */
62#ifdef LSD001
63 GNUNET_CRYPTO_kdf (skey, sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey), 58 GNUNET_CRYPTO_kdf (skey, sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey),
64 ctx_key, strlen (ctx_key), 59 ctx_key, strlen (ctx_key),
65 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 60 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
@@ -71,19 +66,6 @@ derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
71 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 66 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
72 label, strlen (label), 67 label, strlen (label),
73 NULL, 0); 68 NULL, 0);
74#else
75 GNUNET_CRYPTO_kdf (skey, sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey),
76 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
77 label, strlen (label),
78 ctx_key, strlen (ctx_key),
79 NULL, 0);
80 GNUNET_CRYPTO_kdf (iv, sizeof(struct
81 GNUNET_CRYPTO_SymmetricInitializationVector),
82 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
83 label, strlen (label),
84 ctx_iv, strlen (ctx_iv),
85 NULL, 0);
86#endif
87} 69}
88 70
89 71