aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns_resolver.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-10-14 23:57:25 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-10-15 12:11:20 +0200
commitdba32dc385bf922c7cd91eecc209e1a37b96c137 (patch)
treee894b28b71b7a7baec59e713fbda59f0c4edb624 /src/gns/gnunet-service-gns_resolver.c
parent25eb1fb2acbe92b418d8643c06107ce0ab2bfb9a (diff)
downloadgnunet-dba32dc385bf922c7cd91eecc209e1a37b96c137.tar.gz
gnunet-dba32dc385bf922c7cd91eecc209e1a37b96c137.zip
- more fixes towards crypto agility
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.c')
-rw-r--r--src/gns/gnunet-service-gns_resolver.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index b34402f81..09b7a0a85 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -1709,9 +1709,8 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh,
1709 ac = GNUNET_new (struct AuthorityChain); 1709 ac = GNUNET_new (struct AuthorityChain);
1710 ac->rh = rh; 1710 ac->rh = rh;
1711 ac->gns_authority = GNUNET_YES; 1711 ac->gns_authority = GNUNET_YES;
1712 GNUNET_memcpy (&ac->authority_info.gns_authority, 1712 GNUNET_GNSRECORD_record_to_identity_key (rd,
1713 rd->data, 1713 &ac->authority_info.gns_authority);
1714 sizeof(struct GNUNET_IDENTITY_PublicKey));
1715 ac->label = resolver_lookup_get_next_label (rh); 1714 ac->label = resolver_lookup_get_next_label (rh);
1716 /* add AC to tail */ 1715 /* add AC to tail */
1717 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 1716 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
@@ -2258,16 +2257,11 @@ handle_gns_resolution_result (void *cls,
2258 2257
2259 case GNUNET_GNSRECORD_TYPE_PKEY: 2258 case GNUNET_GNSRECORD_TYPE_PKEY:
2260 { 2259 {
2261 struct GNUNET_IDENTITY_PublicKey pub; 2260 if (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))
2262
2263 if (rd[i].data_size != sizeof(struct GNUNET_IDENTITY_PublicKey))
2264 { 2261 {
2265 GNUNET_break_op (0); 2262 GNUNET_break_op (0);
2266 break; 2263 break;
2267 } 2264 }
2268 GNUNET_memcpy (&pub,
2269 rd[i].data,
2270 rd[i].data_size);
2271 rd_off++; 2265 rd_off++;
2272 if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type) 2266 if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type)
2273 { 2267 {
@@ -2277,7 +2271,8 @@ handle_gns_resolution_result (void *cls,
2277 ac = GNUNET_new (struct AuthorityChain); 2271 ac = GNUNET_new (struct AuthorityChain);
2278 ac->rh = rh; 2272 ac->rh = rh;
2279 ac->gns_authority = GNUNET_YES; 2273 ac->gns_authority = GNUNET_YES;
2280 ac->authority_info.gns_authority = pub; 2274 GNUNET_GNSRECORD_record_to_identity_key (&rd[i],
2275 &ac->authority_info.gns_authority);
2281 ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT); 2276 ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT);
2282 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 2277 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
2283 rh->ac_tail, 2278 rh->ac_tail,
@@ -2469,10 +2464,7 @@ handle_dht_response (void *cls,
2469 return; 2464 return;
2470 } 2465 }
2471 block = data; 2466 block = data;
2472 if (size != 2467 if (size != GNUNET_GNSRECORD_block_get_size (block))
2473 ntohl (block->purpose.size)
2474 + sizeof(struct GNUNET_IDENTITY_PublicKey)
2475 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature))
2476 { 2468 {
2477 /* how did this pass DHT block validation!? */ 2469 /* how did this pass DHT block validation!? */
2478 GNUNET_break (0); 2470 GNUNET_break (0);
@@ -2480,8 +2472,8 @@ handle_dht_response (void *cls,
2480 return; 2472 return;
2481 } 2473 }
2482 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2474 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2483 "Decrypting DHT block of size %u for `%s', expires %s\n", 2475 "Decrypting DHT block of size %lu for `%s', expires %s\n",
2484 ntohl (block->purpose.size), 2476 GNUNET_GNSRECORD_block_get_size (block),
2485 rh->name, 2477 rh->name,
2486 GNUNET_STRINGS_absolute_time_to_string (exp)); 2478 GNUNET_STRINGS_absolute_time_to_string (exp));
2487 if (GNUNET_OK != 2479 if (GNUNET_OK !=
@@ -2495,8 +2487,8 @@ handle_dht_response (void *cls,
2495 fail_resolution (rh); 2487 fail_resolution (rh);
2496 return; 2488 return;
2497 } 2489 }
2498 if (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( 2490 if (0 == GNUNET_TIME_absolute_get_remaining (
2499 block->expiration_time)). 2491 GNUNET_GNSRECORD_block_get_expiration (block)).
2500 rel_value_us) 2492 rel_value_us)
2501 { 2493 {
2502 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2494 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2604,8 +2596,8 @@ handle_namecache_block_response (void *cls,
2604 ((GNUNET_GNS_LO_LOCAL_MASTER == rh->options) && 2596 ((GNUNET_GNS_LO_LOCAL_MASTER == rh->options) &&
2605 (ac != rh->ac_head))) && 2597 (ac != rh->ac_head))) &&
2606 ((NULL == block) || 2598 ((NULL == block) ||
2607 (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( 2599 (0 == GNUNET_TIME_absolute_get_remaining (
2608 block->expiration_time)). 2600 GNUNET_GNSRECORD_block_get_expiration (block)).
2609 rel_value_us))) 2601 rel_value_us)))
2610 { 2602 {
2611 /* namecache knows nothing; try DHT lookup */ 2603 /* namecache knows nothing; try DHT lookup */
@@ -2622,8 +2614,8 @@ handle_namecache_block_response (void *cls,
2622 } 2614 }
2623 2615
2624 if ((NULL == block) || 2616 if ((NULL == block) ||
2625 (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( 2617 (0 == GNUNET_TIME_absolute_get_remaining (
2626 block->expiration_time)). 2618 GNUNET_GNSRECORD_block_get_expiration (block)).
2627 rel_value_us)) 2619 rel_value_us))
2628 { 2620 {
2629 /* DHT not permitted and no local result, fail */ 2621 /* DHT not permitted and no local result, fail */