diff options
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.c')
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 104 |
1 files changed, 47 insertions, 57 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 2cde3e37e..2e96b60ea 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -270,7 +270,7 @@ create_pkey_cont (void* cls, int32_t success, const char* emsg) | |||
270 | */ | 270 | */ |
271 | static void | 271 | static void |
272 | process_pseu_lookup_ns (void* cls, | 272 | process_pseu_lookup_ns (void* cls, |
273 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *key, | 273 | const struct GNUNET_CRYPTO_EccPublicKey *key, |
274 | struct GNUNET_TIME_Absolute expiration, | 274 | struct GNUNET_TIME_Absolute expiration, |
275 | const char *name, unsigned int rd_count, | 275 | const char *name, unsigned int rd_count, |
276 | const struct GNUNET_NAMESTORE_RecordData *rd, | 276 | const struct GNUNET_NAMESTORE_RecordData *rd, |
@@ -464,12 +464,12 @@ process_auth_discovery_dht_result (void* cls, | |||
464 | */ | 464 | */ |
465 | static void | 465 | static void |
466 | process_auth_discovery_ns_result (void* cls, | 466 | process_auth_discovery_ns_result (void* cls, |
467 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *key, | 467 | const struct GNUNET_CRYPTO_EccPublicKey *key, |
468 | struct GNUNET_TIME_Absolute expiration, | 468 | struct GNUNET_TIME_Absolute expiration, |
469 | const char *name, | 469 | const char *name, |
470 | unsigned int rd_count, | 470 | unsigned int rd_count, |
471 | const struct GNUNET_NAMESTORE_RecordData *rd, | 471 | const struct GNUNET_NAMESTORE_RecordData *rd, |
472 | const struct GNUNET_CRYPTO_EccSignature *signature) | 472 | const struct GNUNET_CRYPTO_EccSignature *signature) |
473 | { | 473 | { |
474 | struct GetPseuAuthorityHandle* gph = cls; | 474 | struct GetPseuAuthorityHandle* gph = cls; |
475 | struct GNUNET_HashCode lookup_key; | 475 | struct GNUNET_HashCode lookup_key; |
@@ -537,7 +537,7 @@ process_auth_discovery_ns_result (void* cls, | |||
537 | */ | 537 | */ |
538 | static void | 538 | static void |
539 | process_zone_to_name_discover (void *cls, | 539 | process_zone_to_name_discover (void *cls, |
540 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 540 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
541 | struct GNUNET_TIME_Absolute expire, | 541 | struct GNUNET_TIME_Absolute expire, |
542 | const char *name, | 542 | const char *name, |
543 | unsigned int rd_len, | 543 | unsigned int rd_len, |
@@ -575,12 +575,11 @@ shorten_authority_chain (struct GetPseuAuthorityHandle *gph) | |||
575 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 575 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
576 | "GNS_AUTO_PSEU: New authority %s discovered\n", | 576 | "GNS_AUTO_PSEU: New authority %s discovered\n", |
577 | gph->auth->name); | 577 | gph->auth->name); |
578 | |||
579 | gph->namestore_task = GNUNET_NAMESTORE_zone_to_name (namestore_handle, | 578 | gph->namestore_task = GNUNET_NAMESTORE_zone_to_name (namestore_handle, |
580 | &gph->our_zone, | 579 | &gph->our_zone, |
581 | &gph->auth->zone, | 580 | &gph->auth->zone, |
582 | &process_zone_to_name_discover, | 581 | &process_zone_to_name_discover, |
583 | gph); | 582 | gph); |
584 | } | 583 | } |
585 | 584 | ||
586 | 585 | ||
@@ -596,21 +595,12 @@ start_shorten (struct AuthorityChain *auth, | |||
596 | const struct GNUNET_CRYPTO_EccPrivateKey *key) | 595 | const struct GNUNET_CRYPTO_EccPrivateKey *key) |
597 | { | 596 | { |
598 | struct GetPseuAuthorityHandle *gph; | 597 | struct GetPseuAuthorityHandle *gph; |
599 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pkey; | 598 | struct GNUNET_CRYPTO_EccPublicKey pkey; |
600 | struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *pb_key; | ||
601 | 599 | ||
602 | GNUNET_CRYPTO_ecc_key_get_public (key, &pkey); | 600 | GNUNET_CRYPTO_ecc_key_get_public (key, &pkey); |
603 | if (NULL == (pb_key = GNUNET_CRYPTO_ecc_encode_key (key))) | ||
604 | { | ||
605 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
606 | "Failed to encode ECC key on shorten\n"); | ||
607 | return; | ||
608 | } | ||
609 | gph = GNUNET_new (struct GetPseuAuthorityHandle); | 601 | gph = GNUNET_new (struct GetPseuAuthorityHandle); |
610 | gph->key = GNUNET_CRYPTO_ecc_decode_key ((const char*) pb_key, | 602 | gph->key = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); |
611 | ntohs (pb_key->size), | 603 | *gph->key = *key; |
612 | GNUNET_YES); | ||
613 | GNUNET_free (pb_key); | ||
614 | if (NULL == gph->key) | 604 | if (NULL == gph->key) |
615 | { | 605 | { |
616 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 606 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -619,7 +609,7 @@ start_shorten (struct AuthorityChain *auth, | |||
619 | return; | 609 | return; |
620 | } | 610 | } |
621 | GNUNET_CRYPTO_short_hash (&pkey, | 611 | GNUNET_CRYPTO_short_hash (&pkey, |
622 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), | 612 | sizeof (struct GNUNET_CRYPTO_EccPublicKey), |
623 | &gph->our_zone); | 613 | &gph->our_zone); |
624 | gph->auth = GNUNET_malloc (sizeof (struct AuthorityChain)); | 614 | gph->auth = GNUNET_malloc (sizeof (struct AuthorityChain)); |
625 | memcpy (gph->auth, auth, sizeof (struct AuthorityChain)); | 615 | memcpy (gph->auth, auth, sizeof (struct AuthorityChain)); |
@@ -1157,7 +1147,7 @@ resolve_record_dht (struct ResolverHandle *rh) | |||
1157 | */ | 1147 | */ |
1158 | static void | 1148 | static void |
1159 | process_record_result_ns (void* cls, | 1149 | process_record_result_ns (void* cls, |
1160 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *key, | 1150 | const struct GNUNET_CRYPTO_EccPublicKey *key, |
1161 | struct GNUNET_TIME_Absolute expiration, | 1151 | struct GNUNET_TIME_Absolute expiration, |
1162 | const char *name, unsigned int rd_count, | 1152 | const char *name, unsigned int rd_count, |
1163 | const struct GNUNET_NAMESTORE_RecordData *rd, | 1153 | const struct GNUNET_NAMESTORE_RecordData *rd, |
@@ -1172,7 +1162,7 @@ process_record_result_ns (void* cls, | |||
1172 | 1162 | ||
1173 | rh->namestore_task = NULL; | 1163 | rh->namestore_task = NULL; |
1174 | GNUNET_CRYPTO_short_hash (key, | 1164 | GNUNET_CRYPTO_short_hash (key, |
1175 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), | 1165 | sizeof (struct GNUNET_CRYPTO_EccPublicKey), |
1176 | &zone); | 1166 | &zone); |
1177 | remaining_time = GNUNET_TIME_absolute_get_remaining (expiration); | 1167 | remaining_time = GNUNET_TIME_absolute_get_remaining (expiration); |
1178 | rh->status = 0; | 1168 | rh->status = 0; |
@@ -2040,7 +2030,7 @@ handle_delegation_ns (void* cls, struct ResolverHandle *rh, | |||
2040 | */ | 2030 | */ |
2041 | static void | 2031 | static void |
2042 | process_pkey_revocation_result_ns (void *cls, | 2032 | process_pkey_revocation_result_ns (void *cls, |
2043 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *key, | 2033 | const struct GNUNET_CRYPTO_EccPublicKey *key, |
2044 | struct GNUNET_TIME_Absolute expiration, | 2034 | struct GNUNET_TIME_Absolute expiration, |
2045 | const char *name, | 2035 | const char *name, |
2046 | unsigned int rd_count, | 2036 | unsigned int rd_count, |
@@ -3069,7 +3059,7 @@ handle_delegation_ns (void* cls, struct ResolverHandle *rh, | |||
3069 | */ | 3059 | */ |
3070 | static void | 3060 | static void |
3071 | process_delegation_result_ns (void* cls, | 3061 | process_delegation_result_ns (void* cls, |
3072 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *key, | 3062 | const struct GNUNET_CRYPTO_EccPublicKey *key, |
3073 | struct GNUNET_TIME_Absolute expiration, | 3063 | struct GNUNET_TIME_Absolute expiration, |
3074 | const char *name, | 3064 | const char *name, |
3075 | unsigned int rd_count, | 3065 | unsigned int rd_count, |
@@ -3086,7 +3076,7 @@ process_delegation_result_ns (void* cls, | |||
3086 | 3076 | ||
3087 | rh->namestore_task = NULL; | 3077 | rh->namestore_task = NULL; |
3088 | GNUNET_CRYPTO_short_hash (key, | 3078 | GNUNET_CRYPTO_short_hash (key, |
3089 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), | 3079 | sizeof (struct GNUNET_CRYPTO_EccPublicKey), |
3090 | &zone); | 3080 | &zone); |
3091 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3081 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3092 | "GNS_PHASE_DELEGATE_NS-%llu: Got %d records from authority lookup for `%s' in zone %s\n", | 3082 | "GNS_PHASE_DELEGATE_NS-%llu: Got %d records from authority lookup for `%s' in zone %s\n", |
@@ -3515,7 +3505,7 @@ finish_shorten (struct ResolverHandle *rh, | |||
3515 | */ | 3505 | */ |
3516 | static void | 3506 | static void |
3517 | process_zone_to_name_shorten_root (void *cls, | 3507 | process_zone_to_name_shorten_root (void *cls, |
3518 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 3508 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
3519 | struct GNUNET_TIME_Absolute expire, | 3509 | struct GNUNET_TIME_Absolute expire, |
3520 | const char *name, | 3510 | const char *name, |
3521 | unsigned int rd_len, | 3511 | unsigned int rd_len, |
@@ -3537,12 +3527,12 @@ process_zone_to_name_shorten_root (void *cls, | |||
3537 | */ | 3527 | */ |
3538 | static void | 3528 | static void |
3539 | process_zone_to_name_shorten_shorten (void *cls, | 3529 | process_zone_to_name_shorten_shorten (void *cls, |
3540 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 3530 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
3541 | struct GNUNET_TIME_Absolute expire, | 3531 | struct GNUNET_TIME_Absolute expire, |
3542 | const char *name, | 3532 | const char *name, |
3543 | unsigned int rd_len, | 3533 | unsigned int rd_len, |
3544 | const struct GNUNET_NAMESTORE_RecordData *rd, | 3534 | const struct GNUNET_NAMESTORE_RecordData *rd, |
3545 | const struct GNUNET_CRYPTO_EccSignature *signature) | 3535 | const struct GNUNET_CRYPTO_EccSignature *signature) |
3546 | { | 3536 | { |
3547 | struct ResolverHandle *rh = cls; | 3537 | struct ResolverHandle *rh = cls; |
3548 | struct NameShortenHandle* nsh = rh->proc_cls; | 3538 | struct NameShortenHandle* nsh = rh->proc_cls; |
@@ -3653,12 +3643,12 @@ process_zone_to_name_shorten_shorten (void *cls, | |||
3653 | */ | 3643 | */ |
3654 | static void | 3644 | static void |
3655 | process_zone_to_name_shorten_private (void *cls, | 3645 | process_zone_to_name_shorten_private (void *cls, |
3656 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 3646 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
3657 | struct GNUNET_TIME_Absolute expire, | 3647 | struct GNUNET_TIME_Absolute expire, |
3658 | const char *name, | 3648 | const char *name, |
3659 | unsigned int rd_len, | 3649 | unsigned int rd_len, |
3660 | const struct GNUNET_NAMESTORE_RecordData *rd, | 3650 | const struct GNUNET_NAMESTORE_RecordData *rd, |
3661 | const struct GNUNET_CRYPTO_EccSignature *signature) | 3651 | const struct GNUNET_CRYPTO_EccSignature *signature) |
3662 | { | 3652 | { |
3663 | struct ResolverHandle *rh = cls; | 3653 | struct ResolverHandle *rh = cls; |
3664 | struct NameShortenHandle* nsh = rh->proc_cls; | 3654 | struct NameShortenHandle* nsh = rh->proc_cls; |
@@ -3768,12 +3758,12 @@ process_zone_to_name_shorten_private (void *cls, | |||
3768 | */ | 3758 | */ |
3769 | static void | 3759 | static void |
3770 | process_zone_to_name_shorten_root (void *cls, | 3760 | process_zone_to_name_shorten_root (void *cls, |
3771 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 3761 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
3772 | struct GNUNET_TIME_Absolute expire, | 3762 | struct GNUNET_TIME_Absolute expire, |
3773 | const char *name, | 3763 | const char *name, |
3774 | unsigned int rd_len, | 3764 | unsigned int rd_len, |
3775 | const struct GNUNET_NAMESTORE_RecordData *rd, | 3765 | const struct GNUNET_NAMESTORE_RecordData *rd, |
3776 | const struct GNUNET_CRYPTO_EccSignature *signature) | 3766 | const struct GNUNET_CRYPTO_EccSignature *signature) |
3777 | { | 3767 | { |
3778 | struct ResolverHandle *rh = cls; | 3768 | struct ResolverHandle *rh = cls; |
3779 | struct NameShortenHandle* nsh = rh->proc_cls; | 3769 | struct NameShortenHandle* nsh = rh->proc_cls; |
@@ -3990,13 +3980,13 @@ handle_delegation_ns_shorten (void* cls, | |||
3990 | * @param signature the signature for the record data | 3980 | * @param signature the signature for the record data |
3991 | */ | 3981 | */ |
3992 | static void | 3982 | static void |
3993 | process_zone_to_name_zkey(void *cls, | 3983 | process_zone_to_name_zkey (void *cls, |
3994 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 3984 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
3995 | struct GNUNET_TIME_Absolute expire, | 3985 | struct GNUNET_TIME_Absolute expire, |
3996 | const char *name, | 3986 | const char *name, |
3997 | unsigned int rd_len, | 3987 | unsigned int rd_len, |
3998 | const struct GNUNET_NAMESTORE_RecordData *rd, | 3988 | const struct GNUNET_NAMESTORE_RecordData *rd, |
3999 | const struct GNUNET_CRYPTO_EccSignature *signature) | 3989 | const struct GNUNET_CRYPTO_EccSignature *signature) |
4000 | { | 3990 | { |
4001 | struct ResolverHandle *rh = cls; | 3991 | struct ResolverHandle *rh = cls; |
4002 | struct NameShortenHandle *nsh = rh->proc_cls; | 3992 | struct NameShortenHandle *nsh = rh->proc_cls; |