diff options
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.c')
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 37f12ff6e..f20cd24c9 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -224,7 +224,7 @@ free_get_pseu_authority_handle (struct GetPseuAuthorityHandle *gph) | |||
224 | { | 224 | { |
225 | gph->namestore_task = NULL; | 225 | gph->namestore_task = NULL; |
226 | GNUNET_free (gph->auth); | 226 | GNUNET_free (gph->auth); |
227 | GNUNET_CRYPTO_rsa_key_free (gph->key); | 227 | GNUNET_CRYPTO_ecc_key_free (gph->key); |
228 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); | 228 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); |
229 | GNUNET_free (gph); | 229 | GNUNET_free (gph); |
230 | } | 230 | } |
@@ -270,11 +270,11 @@ 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_RsaPublicKeyBinaryEncoded *key, | 273 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *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, |
277 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 277 | const struct GNUNET_CRYPTO_EccSignature *signature) |
278 | { | 278 | { |
279 | struct GetPseuAuthorityHandle* gph = cls; | 279 | struct GetPseuAuthorityHandle* gph = cls; |
280 | struct GNUNET_NAMESTORE_RecordData new_pkey; | 280 | struct GNUNET_NAMESTORE_RecordData new_pkey; |
@@ -463,12 +463,12 @@ process_auth_discovery_dht_result (void* cls, | |||
463 | */ | 463 | */ |
464 | static void | 464 | static void |
465 | process_auth_discovery_ns_result (void* cls, | 465 | process_auth_discovery_ns_result (void* cls, |
466 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, | 466 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *key, |
467 | struct GNUNET_TIME_Absolute expiration, | 467 | struct GNUNET_TIME_Absolute expiration, |
468 | const char *name, | 468 | const char *name, |
469 | unsigned int rd_count, | 469 | unsigned int rd_count, |
470 | const struct GNUNET_NAMESTORE_RecordData *rd, | 470 | const struct GNUNET_NAMESTORE_RecordData *rd, |
471 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 471 | const struct GNUNET_CRYPTO_EccSignature *signature) |
472 | { | 472 | { |
473 | struct GetPseuAuthorityHandle* gph = cls; | 473 | struct GetPseuAuthorityHandle* gph = cls; |
474 | struct GNUNET_HashCode lookup_key; | 474 | struct GNUNET_HashCode lookup_key; |
@@ -536,12 +536,12 @@ process_auth_discovery_ns_result (void* cls, | |||
536 | */ | 536 | */ |
537 | static void | 537 | static void |
538 | process_zone_to_name_discover (void *cls, | 538 | process_zone_to_name_discover (void *cls, |
539 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 539 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
540 | struct GNUNET_TIME_Absolute expire, | 540 | struct GNUNET_TIME_Absolute expire, |
541 | const char *name, | 541 | const char *name, |
542 | unsigned int rd_len, | 542 | unsigned int rd_len, |
543 | const struct GNUNET_NAMESTORE_RecordData *rd, | 543 | const struct GNUNET_NAMESTORE_RecordData *rd, |
544 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 544 | const struct GNUNET_CRYPTO_EccSignature *signature) |
545 | { | 545 | { |
546 | struct GetPseuAuthorityHandle* gph = cls; | 546 | struct GetPseuAuthorityHandle* gph = cls; |
547 | 547 | ||
@@ -592,31 +592,33 @@ shorten_authority_chain (struct GetPseuAuthorityHandle *gph) | |||
592 | */ | 592 | */ |
593 | static void | 593 | static void |
594 | start_shorten (struct AuthorityChain *auth, | 594 | start_shorten (struct AuthorityChain *auth, |
595 | const struct GNUNET_CRYPTO_RsaPrivateKey *key) | 595 | const struct GNUNET_CRYPTO_EccPrivateKey *key) |
596 | { | 596 | { |
597 | struct GetPseuAuthorityHandle *gph; | 597 | struct GetPseuAuthorityHandle *gph; |
598 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; | 598 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pkey; |
599 | struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *pb_key; | 599 | struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *pb_key; |
600 | 600 | ||
601 | GNUNET_CRYPTO_rsa_key_get_public (key, &pkey); | 601 | GNUNET_CRYPTO_ecc_key_get_public (key, &pkey); |
602 | if (NULL == (pb_key = GNUNET_CRYPTO_rsa_encode_key (key))) | 602 | if (NULL == (pb_key = GNUNET_CRYPTO_ecc_encode_key (key))) |
603 | { | 603 | { |
604 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 604 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
605 | "Failed to encode RSA key on shorten\n"); | 605 | "Failed to encode ECC key on shorten\n"); |
606 | return; | 606 | return; |
607 | } | 607 | } |
608 | gph = GNUNET_malloc (sizeof (struct GetPseuAuthorityHandle)); | 608 | gph = GNUNET_new (struct GetPseuAuthorityHandle); |
609 | gph->key = GNUNET_CRYPTO_rsa_decode_key ((const char*) pb_key, ntohs (pb_key->len)); | 609 | gph->key = GNUNET_CRYPTO_ecc_decode_key ((const char*) pb_key, |
610 | ntohs (pb_key->size), | ||
611 | GNUNET_YES); | ||
610 | GNUNET_free (pb_key); | 612 | GNUNET_free (pb_key); |
611 | if (NULL == gph->key) | 613 | if (NULL == gph->key) |
612 | { | 614 | { |
613 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 615 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
614 | "Failed to decode RSA key on shorten\n"); | 616 | "Failed to decode ECC key on shorten\n"); |
615 | GNUNET_free (gph); | 617 | GNUNET_free (gph); |
616 | return; | 618 | return; |
617 | } | 619 | } |
618 | GNUNET_CRYPTO_short_hash (&pkey, | 620 | GNUNET_CRYPTO_short_hash (&pkey, |
619 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 621 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), |
620 | &gph->our_zone); | 622 | &gph->our_zone); |
621 | gph->auth = GNUNET_malloc (sizeof (struct AuthorityChain)); | 623 | gph->auth = GNUNET_malloc (sizeof (struct AuthorityChain)); |
622 | memcpy (gph->auth, auth, sizeof (struct AuthorityChain)); | 624 | memcpy (gph->auth, auth, sizeof (struct AuthorityChain)); |
@@ -1154,11 +1156,11 @@ resolve_record_dht (struct ResolverHandle *rh) | |||
1154 | */ | 1156 | */ |
1155 | static void | 1157 | static void |
1156 | process_record_result_ns (void* cls, | 1158 | process_record_result_ns (void* cls, |
1157 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, | 1159 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *key, |
1158 | struct GNUNET_TIME_Absolute expiration, | 1160 | struct GNUNET_TIME_Absolute expiration, |
1159 | const char *name, unsigned int rd_count, | 1161 | const char *name, unsigned int rd_count, |
1160 | const struct GNUNET_NAMESTORE_RecordData *rd, | 1162 | const struct GNUNET_NAMESTORE_RecordData *rd, |
1161 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 1163 | const struct GNUNET_CRYPTO_EccSignature *signature) |
1162 | { | 1164 | { |
1163 | struct ResolverHandle *rh = cls; | 1165 | struct ResolverHandle *rh = cls; |
1164 | struct RecordLookupHandle *rlh = rh->proc_cls; | 1166 | struct RecordLookupHandle *rlh = rh->proc_cls; |
@@ -1169,7 +1171,7 @@ process_record_result_ns (void* cls, | |||
1169 | 1171 | ||
1170 | rh->namestore_task = NULL; | 1172 | rh->namestore_task = NULL; |
1171 | GNUNET_CRYPTO_short_hash (key, | 1173 | GNUNET_CRYPTO_short_hash (key, |
1172 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 1174 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), |
1173 | &zone); | 1175 | &zone); |
1174 | remaining_time = GNUNET_TIME_absolute_get_remaining (expiration); | 1176 | remaining_time = GNUNET_TIME_absolute_get_remaining (expiration); |
1175 | rh->status = 0; | 1177 | rh->status = 0; |
@@ -2034,12 +2036,12 @@ handle_delegation_ns (void* cls, struct ResolverHandle *rh, | |||
2034 | */ | 2036 | */ |
2035 | static void | 2037 | static void |
2036 | process_pkey_revocation_result_ns (void *cls, | 2038 | process_pkey_revocation_result_ns (void *cls, |
2037 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, | 2039 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *key, |
2038 | struct GNUNET_TIME_Absolute expiration, | 2040 | struct GNUNET_TIME_Absolute expiration, |
2039 | const char *name, | 2041 | const char *name, |
2040 | unsigned int rd_count, | 2042 | unsigned int rd_count, |
2041 | const struct GNUNET_NAMESTORE_RecordData *rd, | 2043 | const struct GNUNET_NAMESTORE_RecordData *rd, |
2042 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 2044 | const struct GNUNET_CRYPTO_EccSignature *signature) |
2043 | { | 2045 | { |
2044 | struct ResolverHandle *rh = cls; | 2046 | struct ResolverHandle *rh = cls; |
2045 | struct GNUNET_TIME_Relative remaining_time; | 2047 | struct GNUNET_TIME_Relative remaining_time; |
@@ -3063,12 +3065,12 @@ handle_delegation_ns (void* cls, struct ResolverHandle *rh, | |||
3063 | */ | 3065 | */ |
3064 | static void | 3066 | static void |
3065 | process_delegation_result_ns (void* cls, | 3067 | process_delegation_result_ns (void* cls, |
3066 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, | 3068 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *key, |
3067 | struct GNUNET_TIME_Absolute expiration, | 3069 | struct GNUNET_TIME_Absolute expiration, |
3068 | const char *name, | 3070 | const char *name, |
3069 | unsigned int rd_count, | 3071 | unsigned int rd_count, |
3070 | const struct GNUNET_NAMESTORE_RecordData *rd, | 3072 | const struct GNUNET_NAMESTORE_RecordData *rd, |
3071 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 3073 | const struct GNUNET_CRYPTO_EccSignature *signature) |
3072 | { | 3074 | { |
3073 | struct ResolverHandle *rh = cls; | 3075 | struct ResolverHandle *rh = cls; |
3074 | struct GNUNET_TIME_Relative remaining_time; | 3076 | struct GNUNET_TIME_Relative remaining_time; |
@@ -3080,7 +3082,7 @@ process_delegation_result_ns (void* cls, | |||
3080 | 3082 | ||
3081 | rh->namestore_task = NULL; | 3083 | rh->namestore_task = NULL; |
3082 | GNUNET_CRYPTO_short_hash (key, | 3084 | GNUNET_CRYPTO_short_hash (key, |
3083 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 3085 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), |
3084 | &zone); | 3086 | &zone); |
3085 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3087 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3086 | "GNS_PHASE_DELEGATE_NS-%llu: Got %d records from authority lookup for `%s' in zone %s\n", | 3088 | "GNS_PHASE_DELEGATE_NS-%llu: Got %d records from authority lookup for `%s' in zone %s\n", |
@@ -3326,7 +3328,7 @@ gns_resolver_lookup_record (struct GNUNET_CRYPTO_ShortHashCode zone, | |||
3326 | struct GNUNET_CRYPTO_ShortHashCode pzone, | 3328 | struct GNUNET_CRYPTO_ShortHashCode pzone, |
3327 | uint32_t record_type, | 3329 | uint32_t record_type, |
3328 | const char* name, | 3330 | const char* name, |
3329 | struct GNUNET_CRYPTO_RsaPrivateKey *key, | 3331 | struct GNUNET_CRYPTO_EccPrivateKey *key, |
3330 | struct GNUNET_TIME_Relative timeout, | 3332 | struct GNUNET_TIME_Relative timeout, |
3331 | int only_cached, | 3333 | int only_cached, |
3332 | RecordLookupProcessor proc, | 3334 | RecordLookupProcessor proc, |
@@ -3509,12 +3511,12 @@ finish_shorten (struct ResolverHandle *rh, | |||
3509 | */ | 3511 | */ |
3510 | static void | 3512 | static void |
3511 | process_zone_to_name_shorten_root (void *cls, | 3513 | process_zone_to_name_shorten_root (void *cls, |
3512 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 3514 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
3513 | struct GNUNET_TIME_Absolute expire, | 3515 | struct GNUNET_TIME_Absolute expire, |
3514 | const char *name, | 3516 | const char *name, |
3515 | unsigned int rd_len, | 3517 | unsigned int rd_len, |
3516 | const struct GNUNET_NAMESTORE_RecordData *rd, | 3518 | const struct GNUNET_NAMESTORE_RecordData *rd, |
3517 | const struct GNUNET_CRYPTO_RsaSignature *signature); | 3519 | const struct GNUNET_CRYPTO_EccSignature *signature); |
3518 | 3520 | ||
3519 | 3521 | ||
3520 | /** | 3522 | /** |
@@ -3531,12 +3533,12 @@ process_zone_to_name_shorten_root (void *cls, | |||
3531 | */ | 3533 | */ |
3532 | static void | 3534 | static void |
3533 | process_zone_to_name_shorten_shorten (void *cls, | 3535 | process_zone_to_name_shorten_shorten (void *cls, |
3534 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 3536 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
3535 | struct GNUNET_TIME_Absolute expire, | 3537 | struct GNUNET_TIME_Absolute expire, |
3536 | const char *name, | 3538 | const char *name, |
3537 | unsigned int rd_len, | 3539 | unsigned int rd_len, |
3538 | const struct GNUNET_NAMESTORE_RecordData *rd, | 3540 | const struct GNUNET_NAMESTORE_RecordData *rd, |
3539 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 3541 | const struct GNUNET_CRYPTO_EccSignature *signature) |
3540 | { | 3542 | { |
3541 | struct ResolverHandle *rh = cls; | 3543 | struct ResolverHandle *rh = cls; |
3542 | struct NameShortenHandle* nsh = rh->proc_cls; | 3544 | struct NameShortenHandle* nsh = rh->proc_cls; |
@@ -3647,12 +3649,12 @@ process_zone_to_name_shorten_shorten (void *cls, | |||
3647 | */ | 3649 | */ |
3648 | static void | 3650 | static void |
3649 | process_zone_to_name_shorten_private (void *cls, | 3651 | process_zone_to_name_shorten_private (void *cls, |
3650 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 3652 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
3651 | struct GNUNET_TIME_Absolute expire, | 3653 | struct GNUNET_TIME_Absolute expire, |
3652 | const char *name, | 3654 | const char *name, |
3653 | unsigned int rd_len, | 3655 | unsigned int rd_len, |
3654 | const struct GNUNET_NAMESTORE_RecordData *rd, | 3656 | const struct GNUNET_NAMESTORE_RecordData *rd, |
3655 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 3657 | const struct GNUNET_CRYPTO_EccSignature *signature) |
3656 | { | 3658 | { |
3657 | struct ResolverHandle *rh = cls; | 3659 | struct ResolverHandle *rh = cls; |
3658 | struct NameShortenHandle* nsh = rh->proc_cls; | 3660 | struct NameShortenHandle* nsh = rh->proc_cls; |
@@ -3762,12 +3764,12 @@ process_zone_to_name_shorten_private (void *cls, | |||
3762 | */ | 3764 | */ |
3763 | static void | 3765 | static void |
3764 | process_zone_to_name_shorten_root (void *cls, | 3766 | process_zone_to_name_shorten_root (void *cls, |
3765 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 3767 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
3766 | struct GNUNET_TIME_Absolute expire, | 3768 | struct GNUNET_TIME_Absolute expire, |
3767 | const char *name, | 3769 | const char *name, |
3768 | unsigned int rd_len, | 3770 | unsigned int rd_len, |
3769 | const struct GNUNET_NAMESTORE_RecordData *rd, | 3771 | const struct GNUNET_NAMESTORE_RecordData *rd, |
3770 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 3772 | const struct GNUNET_CRYPTO_EccSignature *signature) |
3771 | { | 3773 | { |
3772 | struct ResolverHandle *rh = cls; | 3774 | struct ResolverHandle *rh = cls; |
3773 | struct NameShortenHandle* nsh = rh->proc_cls; | 3775 | struct NameShortenHandle* nsh = rh->proc_cls; |
@@ -3985,12 +3987,12 @@ handle_delegation_ns_shorten (void* cls, | |||
3985 | */ | 3987 | */ |
3986 | static void | 3988 | static void |
3987 | process_zone_to_name_zkey(void *cls, | 3989 | process_zone_to_name_zkey(void *cls, |
3988 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 3990 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
3989 | struct GNUNET_TIME_Absolute expire, | 3991 | struct GNUNET_TIME_Absolute expire, |
3990 | const char *name, | 3992 | const char *name, |
3991 | unsigned int rd_len, | 3993 | unsigned int rd_len, |
3992 | const struct GNUNET_NAMESTORE_RecordData *rd, | 3994 | const struct GNUNET_NAMESTORE_RecordData *rd, |
3993 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 3995 | const struct GNUNET_CRYPTO_EccSignature *signature) |
3994 | { | 3996 | { |
3995 | struct ResolverHandle *rh = cls; | 3997 | struct ResolverHandle *rh = cls; |
3996 | struct NameShortenHandle *nsh = rh->proc_cls; | 3998 | struct NameShortenHandle *nsh = rh->proc_cls; |