aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2020-10-16 17:31:21 +0200
committert3sserakt <t3ss@posteo.de>2020-10-16 17:40:12 +0200
commitcde9403a6cc6bc03e571c872cdee205bbd838c31 (patch)
tree431929de91b2da817816370f9caf98b646d2745e
parent4b69b0866d7f29efeb92176e518ddbb6a9052033 (diff)
parente8b0bc481b8a30c325faf55a964cac2cd151f999 (diff)
downloadgnunet-cde9403a6cc6bc03e571c872cdee205bbd838c31.tar.gz
gnunet-cde9403a6cc6bc03e571c872cdee205bbd838c31.zip
Merge branch 'master' of ssh://gnunet.org/gnunet
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/Makefile.am8
-rw-r--r--src/ats-tests/ats-testing-log.c4
-rw-r--r--src/cadet/gnunet-service-cadet_channel.c10
-rw-r--r--src/cadet/gnunet-service-cadet_core.c4
-rw-r--r--src/cadet/gnunet-service-cadet_dht.c4
-rw-r--r--src/cadet/gnunet-service-cadet_tunnels.c2
-rw-r--r--src/consensus/consensus_api.c2
-rw-r--r--src/conversation/conversation.h8
-rw-r--r--src/conversation/conversation_api.c4
-rw-r--r--src/conversation/gnunet-conversation.c6
-rw-r--r--src/conversation/test_conversation_api.c8
-rw-r--r--src/conversation/test_conversation_api_reject.c8
-rw-r--r--src/conversation/test_conversation_api_twocalls.c8
-rw-r--r--src/datastore/datastore_api.c8
-rw-r--r--src/dht/gnunet-service-dht_clients.c6
-rw-r--r--src/dht/gnunet-service-dht_datacache.c4
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c4
-rw-r--r--src/dht/plugin_block_dht.c2
-rw-r--r--src/dns/gnunet-dns-monitor.c2
-rw-r--r--src/fs/fs_download.c2
-rw-r--r--src/fs/gnunet-daemon-fsprofiler.c4
-rw-r--r--src/fs/gnunet-publish.c13
-rw-r--r--src/gns/Makefile.am5
-rw-r--r--src/gns/gns.h2
-rw-r--r--src/gns/gns_api.c4
-rw-r--r--src/gns/gns_tld_api.c21
-rw-r--r--src/gns/gnunet-service-gns.c6
-rw-r--r--src/gns/gnunet-service-gns.h3
-rw-r--r--src/gns/gnunet-service-gns_interceptor.c2
-rw-r--r--src/gns/gnunet-service-gns_resolver.c57
-rw-r--r--src/gns/gnunet-service-gns_resolver.h2
-rw-r--r--src/gns/plugin_block_gns.c15
-rw-r--r--src/gns/plugin_gnsrecord_gns.c10
-rw-r--r--src/gns/plugin_rest_gns.c3
-rwxr-xr-xsrc/gns/test_gns_dht_lookup.sh1
-rw-r--r--src/gnsrecord/Makefile.am19
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c315
-rw-r--r--src/gnsrecord/gnsrecord_misc.c95
-rw-r--r--src/gnsrecord/gnunet-gnsrecord-tvg.c35
-rw-r--r--src/gnsrecord/json_gnsrecord.c (renamed from src/json/json_gnsrecord.c)114
-rw-r--r--src/gnsrecord/perf_gnsrecord_crypto.c5
-rw-r--r--src/gnsrecord/plugin_gnsrecord_dns.c2
-rw-r--r--src/gnsrecord/test_gnsrecord_crypto.c11
-rw-r--r--src/identity/gnunet-identity.c45
-rw-r--r--src/identity/gnunet-service-identity.c77
-rw-r--r--src/identity/identity.h81
-rw-r--r--src/identity/identity_api.c170
-rw-r--r--src/identity/identity_api_lookup.c4
-rw-r--r--src/identity/plugin_rest_identity.c23
-rw-r--r--src/identity/test_identity.c8
-rw-r--r--src/identity/test_identity_defaults.c8
-rw-r--r--src/include/gnunet_conversation_service.h2
-rw-r--r--src/include/gnunet_gns_service.h5
-rw-r--r--src/include/gnunet_gnsrecord_json_lib.h73
-rw-r--r--src/include/gnunet_gnsrecord_lib.h93
-rw-r--r--src/include/gnunet_identity_service.h160
-rw-r--r--src/include/gnunet_json_lib.h25
-rw-r--r--src/include/gnunet_namestore_plugin.h12
-rw-r--r--src/include/gnunet_namestore_service.h15
-rw-r--r--src/include/gnunet_reclaim_service.h33
-rw-r--r--src/include/gnunet_revocation_service.h34
-rw-r--r--src/json/Makefile.am7
-rw-r--r--src/json/json_generator.c108
-rw-r--r--src/my/my_query_helper.c8
-rw-r--r--src/namecache/Makefile.am9
-rw-r--r--src/namecache/gnunet-namecache.c4
-rw-r--r--src/namecache/gnunet-service-namecache.c47
-rw-r--r--src/namecache/namecache.h4
-rw-r--r--src/namecache/namecache_api.c23
-rw-r--r--src/namecache/plugin_namecache_flat.c16
-rw-r--r--src/namecache/plugin_namecache_postgres.c24
-rw-r--r--src/namecache/plugin_namecache_sqlite.c16
-rw-r--r--src/namecache/test_namecache_api_cache_block.c20
-rw-r--r--src/namestore/Makefile.am11
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c27
-rw-r--r--src/namestore/gnunet-namestore.c35
-rw-r--r--src/namestore/gnunet-service-namestore.c34
-rw-r--r--src/namestore/gnunet-zoneimport.c4
-rw-r--r--src/namestore/namestore.h18
-rw-r--r--src/namestore/namestore_api.c14
-rw-r--r--src/namestore/namestore_api_monitor.c4
-rw-r--r--src/namestore/perf_namestore_api_zone_iteration.c7
-rw-r--r--src/namestore/plugin_namestore_flat.c32
-rw-r--r--src/namestore/plugin_namestore_postgres.c18
-rw-r--r--src/namestore/plugin_namestore_sqlite.c18
-rw-r--r--src/namestore/plugin_rest_namestore.c30
-rw-r--r--src/namestore/test_namestore_api_lookup_nick.c11
-rw-r--r--src/namestore/test_namestore_api_lookup_private.c11
-rw-r--r--src/namestore/test_namestore_api_lookup_public.c17
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow.c17
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow_filter.c17
-rw-r--r--src/namestore/test_namestore_api_monitoring.c12
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c12
-rw-r--r--src/namestore/test_namestore_api_remove.c11
-rw-r--r--src/namestore/test_namestore_api_remove_not_existing_record.c9
-rw-r--r--src/namestore/test_namestore_api_store.c9
-rw-r--r--src/namestore/test_namestore_api_store_update.c13
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c39
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_nick.c14
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c14
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c39
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c15
-rw-r--r--src/namestore/test_plugin_namestore.c6
-rw-r--r--src/nse/gnunet-nse-profiler.c2
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c4
-rw-r--r--src/peerinfo-tool/plugin_rest_peerinfo.c4
-rw-r--r--src/reclaim/Makefile.am1
-rw-r--r--src/reclaim/gnunet-reclaim.c14
-rw-r--r--src/reclaim/gnunet-service-reclaim.c26
-rw-r--r--src/reclaim/gnunet-service-reclaim_tickets.c36
-rw-r--r--src/reclaim/gnunet-service-reclaim_tickets.h12
-rw-r--r--src/reclaim/oidc_helper.c22
-rw-r--r--src/reclaim/oidc_helper.h10
-rw-r--r--src/reclaim/plugin_rest_openid_connect.c57
-rw-r--r--src/reclaim/plugin_rest_reclaim.c44
-rw-r--r--src/reclaim/reclaim.h26
-rw-r--r--src/reclaim/reclaim_api.c30
-rw-r--r--src/reclaim/test_reclaim_attribute.c2
-rw-r--r--src/regex/regex_block_lib.c8
-rw-r--r--src/regex/regex_internal_dht.c9
-rw-r--r--src/regex/regex_test_graph.c9
-rw-r--r--src/revocation/Makefile.am3
-rw-r--r--src/revocation/gnunet-revocation-tvg.c25
-rw-r--r--src/revocation/gnunet-revocation.c71
-rw-r--r--src/revocation/gnunet-service-revocation.c75
-rw-r--r--src/revocation/plugin_block_revocation.c23
-rw-r--r--src/revocation/revocation.h11
-rw-r--r--src/revocation/revocation_api.c188
-rw-r--r--src/revocation/test_revocation.c20
-rw-r--r--src/set/gnunet-service-set_union.c18
-rw-r--r--src/set/set_api.c3
-rw-r--r--src/setu/gnunet-service-setu.c18
-rw-r--r--src/testbed-logger/gnunet-service-testbed-logger.c2
-rw-r--r--src/testbed/gnunet-service-testbed_cpustatus.c2
-rw-r--r--src/testbed/testbed_api.c2
-rw-r--r--src/testbed/testbed_api_topology.c6
-rw-r--r--src/transport/plugin_transport_http_client.c15
-rw-r--r--src/transport/plugin_transport_http_common.c2
-rw-r--r--src/transport/plugin_transport_http_server.c24
-rw-r--r--src/transport/plugin_transport_tcp.c12
-rw-r--r--src/transport/plugin_transport_udp.c15
-rw-r--r--src/transport/plugin_transport_unix.c4
-rw-r--r--src/transport/tcp_connection_legacy.c16
-rw-r--r--src/transport/tcp_service_legacy.c2
-rw-r--r--src/util/bio.c4
-rw-r--r--src/zonemaster/Makefile.am3
-rw-r--r--src/zonemaster/gnunet-service-zonemaster-monitor.c8
-rw-r--r--src/zonemaster/gnunet-service-zonemaster.c8
149 files changed, 2117 insertions, 1301 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5c379eed8..6aab56d14 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -185,6 +185,7 @@ src/gnsrecord/gnsrecord_crypto.c
185src/gnsrecord/gnsrecord_misc.c 185src/gnsrecord/gnsrecord_misc.c
186src/gnsrecord/gnsrecord_serialization.c 186src/gnsrecord/gnsrecord_serialization.c
187src/gnsrecord/gnunet-gnsrecord-tvg.c 187src/gnsrecord/gnunet-gnsrecord-tvg.c
188src/gnsrecord/json_gnsrecord.c
188src/gnsrecord/plugin_gnsrecord_dns.c 189src/gnsrecord/plugin_gnsrecord_dns.c
189src/hello/address.c 190src/hello/address.c
190src/hello/gnunet-hello.c 191src/hello/gnunet-hello.c
@@ -201,7 +202,6 @@ src/identity/identity_api_suffix_lookup.c
201src/identity/plugin_rest_identity.c 202src/identity/plugin_rest_identity.c
202src/json/json.c 203src/json/json.c
203src/json/json_generator.c 204src/json/json_generator.c
204src/json/json_gnsrecord.c
205src/json/json_helper.c 205src/json/json_helper.c
206src/json/json_mhd.c 206src/json/json_mhd.c
207src/my/my.c 207src/my/my.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 234a63389..f98cb96df 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,8 +11,8 @@ endif
11 11
12if HAVE_EXPERIMENTAL 12if HAVE_EXPERIMENTAL
13 EXP_DIR = \ 13 EXP_DIR = \
14 rps \ 14 rps
15 abd 15 #abd FTBFS
16if HAVE_ABE 16if HAVE_ABE
17 EXP_DIR += \ 17 EXP_DIR += \
18 abe 18 abe
@@ -51,7 +51,6 @@ SUBDIRS = \
51 include $(INTLEMU_SUBDIRS) \ 51 include $(INTLEMU_SUBDIRS) \
52 util \ 52 util \
53 nt \ 53 nt \
54 gnsrecord \
55 hello \ 54 hello \
56 block \ 55 block \
57 statistics \ 56 statistics \
@@ -74,7 +73,6 @@ SUBDIRS = \
74 fragmentation \ 73 fragmentation \
75 transport \ 74 transport \
76 ats-tool \ 75 ats-tool \
77 peerinfo-tool \
78 core \ 76 core \
79 $(TESTBED) \ 77 $(TESTBED) \
80 $(ATS_TESTS) \ 78 $(ATS_TESTS) \
@@ -85,8 +83,10 @@ SUBDIRS = \
85 regex \ 83 regex \
86 dns \ 84 dns \
87 identity \ 85 identity \
86 gnsrecord \
88 namecache \ 87 namecache \
89 namestore \ 88 namestore \
89 peerinfo-tool \
90 cadet \ 90 cadet \
91 set \ 91 set \
92 seti \ 92 seti \
diff --git a/src/ats-tests/ats-testing-log.c b/src/ats-tests/ats-testing-log.c
index 38094a438..955401dd8 100644
--- a/src/ats-tests/ats-testing-log.c
+++ b/src/ats-tests/ats-testing-log.c
@@ -575,7 +575,7 @@ GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l,
575 575
576 /* Assembling slave string */ 576 /* Assembling slave string */
577 GNUNET_asprintf (&data, 577 GNUNET_asprintf (&data,
578 "%llu;%llu;%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%u;%u;%u;%u;%u;%.3f;%.3f\n", 578 "%llu;%llu;%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%llu;%u;%u;%u;%u;%.3f;%.3f\n",
579 (long long unsigned 579 (long long unsigned
580 int) cur_lt->timestamp.abs_value_us, 580 int) cur_lt->timestamp.abs_value_us,
581 (long long unsigned 581 (long long unsigned
@@ -593,7 +593,7 @@ GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l,
593 (double) plt->app_rtt / 1000, 593 (double) plt->app_rtt / 1000,
594 plt->bandwidth_in, 594 plt->bandwidth_in,
595 plt->bandwidth_out, 595 plt->bandwidth_out,
596 plt->ats_delay, 596 plt->ats_delay.rel_value_us,
597 plt->ats_distance, 597 plt->ats_distance,
598 plt->ats_network_type, 598 plt->ats_network_type,
599 plt->ats_utilization_out, 599 plt->ats_utilization_out,
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c
index dab53b8c4..ae6d21452 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -442,7 +442,7 @@ GCCH_2s (const struct CadetChannel *ch)
442 ? "loopback" 442 ? "loopback"
443 : GNUNET_i2s (GCP_get_id (GCT_get_destination (ch->t))), 443 : GNUNET_i2s (GCP_get_id (GCT_get_destination (ch->t))),
444 GNUNET_h2s (&ch->port), 444 GNUNET_h2s (&ch->port),
445 ch->ctn, 445 ch->ctn.cn,
446 (NULL == ch->owner) 446 (NULL == ch->owner)
447 ? 0 447 ? 0
448 : ntohl (ch->owner->ccn.channel_of_client), 448 : ntohl (ch->owner->ccn.channel_of_client),
@@ -1899,10 +1899,10 @@ GCCH_handle_local_data (struct CadetChannel *ch,
1899 GNUNET_memcpy (&crm->data_message[1], buf, buf_len); 1899 GNUNET_memcpy (&crm->data_message[1], buf, buf_len);
1900 GNUNET_CONTAINER_DLL_insert_tail (ch->head_sent, ch->tail_sent, crm); 1900 GNUNET_CONTAINER_DLL_insert_tail (ch->head_sent, ch->tail_sent, crm);
1901 LOG (GNUNET_ERROR_TYPE_DEBUG, 1901 LOG (GNUNET_ERROR_TYPE_DEBUG,
1902 "Sending message %u from local client to %s with %u bytes\n", 1902 "Sending message %u from local client to %s with %lu bytes\n",
1903 ntohl (crm->data_message->mid.mid), 1903 ntohl (crm->data_message->mid.mid),
1904 GCCH_2s (ch), 1904 GCCH_2s (ch),
1905 buf_len); 1905 (unsigned long) buf_len);
1906 if (NULL != ch->retry_data_task) 1906 if (NULL != ch->retry_data_task)
1907 { 1907 {
1908 GNUNET_SCHEDULER_cancel (ch->retry_data_task); 1908 GNUNET_SCHEDULER_cancel (ch->retry_data_task);
@@ -2044,7 +2044,7 @@ GCCH_debug (struct CadetChannel *ch, enum GNUNET_ErrorType level)
2044 LOG2 (level, "CHN *** DEBUG NULL CHANNEL ***\n"); 2044 LOG2 (level, "CHN *** DEBUG NULL CHANNEL ***\n");
2045 return; 2045 return;
2046 } 2046 }
2047 LOG2 (level, "CHN %s:%X (%p)\n", GCT_2s (ch->t), ch->ctn, ch); 2047 LOG2 (level, "CHN %s:%X (%p)\n", GCT_2s (ch->t), ch->ctn.cn, ch);
2048 if (NULL != ch->owner) 2048 if (NULL != ch->owner)
2049 { 2049 {
2050 LOG2 (level, 2050 LOG2 (level,
@@ -2062,7 +2062,7 @@ GCCH_debug (struct CadetChannel *ch, enum GNUNET_ErrorType level)
2062 ntohl (ch->dest->ccn.channel_of_client)); 2062 ntohl (ch->dest->ccn.channel_of_client));
2063 } 2063 }
2064 LOG2 (level, 2064 LOG2 (level,
2065 "CHN Message IDs recv: %d (%LLX), send: %d\n", 2065 "CHN Message IDs recv: %d (%llX), send: %d\n",
2066 ntohl (ch->mid_recv.mid), 2066 ntohl (ch->mid_recv.mid),
2067 (unsigned long long) ch->mid_futures, 2067 (unsigned long long) ch->mid_futures,
2068 ntohl (ch->mid_send.mid)); 2068 ntohl (ch->mid_send.mid));
diff --git a/src/cadet/gnunet-service-cadet_core.c b/src/cadet/gnunet-service-cadet_core.c
index 9a83fa31d..95a5d3f63 100644
--- a/src/cadet/gnunet-service-cadet_core.c
+++ b/src/cadet/gnunet-service-cadet_core.c
@@ -296,7 +296,7 @@ discard_all_from_rung_tail ()
296 while (NULL != (dir = tail->rd_head)) 296 while (NULL != (dir = tail->rd_head))
297 { 297 {
298 LOG (GNUNET_ERROR_TYPE_DEBUG, 298 LOG (GNUNET_ERROR_TYPE_DEBUG,
299 "Queue full due new message %s on connection %s, dropping old message\n", 299 "Queue full due new message on connection %s, dropping old message\n",
300 GNUNET_sh2s (&dir->my_route->cid.connection_of_tunnel)); 300 GNUNET_sh2s (&dir->my_route->cid.connection_of_tunnel));
301 GNUNET_STATISTICS_update (stats, 301 GNUNET_STATISTICS_update (stats,
302 "# messages dropped due to full buffer", 302 "# messages dropped due to full buffer",
@@ -408,7 +408,7 @@ route_message (struct CadetPeer *prev,
408 { 408 {
409 /* We are in the highest rung, drop our own! */ 409 /* We are in the highest rung, drop our own! */
410 LOG (GNUNET_ERROR_TYPE_DEBUG, 410 LOG (GNUNET_ERROR_TYPE_DEBUG,
411 "Queue full due new message %s on connection %s, dropping old message\n", 411 "Queue full due new message on connection %s, dropping old message\n",
412 GNUNET_sh2s (&dir->my_route->cid.connection_of_tunnel)); 412 GNUNET_sh2s (&dir->my_route->cid.connection_of_tunnel));
413 GNUNET_STATISTICS_update (stats, 413 GNUNET_STATISTICS_update (stats,
414 "# messages dropped due to full buffer", 414 "# messages dropped due to full buffer",
diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c
index 4e8ccbb08..e1bbeb2c3 100644
--- a/src/cadet/gnunet-service-cadet_dht.c
+++ b/src/cadet/gnunet-service-cadet_dht.c
@@ -195,8 +195,8 @@ announce_id (void *cls)
195 &my_full_id, 195 &my_full_id,
196 sizeof(my_full_id)); 196 sizeof(my_full_id));
197 LOG (GNUNET_ERROR_TYPE_DEBUG, 197 LOG (GNUNET_ERROR_TYPE_DEBUG,
198 "Announcing my HELLO (%u bytes) in the DHT\n", 198 "Announcing my HELLO (%lu bytes) in the DHT\n",
199 size); 199 (unsigned long) size);
200 GNUNET_DHT_put (dht_handle, /* DHT handle */ 200 GNUNET_DHT_put (dht_handle, /* DHT handle */
201 &phash, /* Key to use */ 201 &phash, /* Key to use */
202 dht_replication_level, /* Replication level */ 202 dht_replication_level, /* Replication level */
diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c
index 2ca46b5aa..78bc54a5c 100644
--- a/src/cadet/gnunet-service-cadet_tunnels.c
+++ b/src/cadet/gnunet-service-cadet_tunnels.c
@@ -2431,7 +2431,7 @@ connection_ready_cb (void *cls,
2431 { 2431 {
2432 case CADET_TUNNEL_KEY_UNINITIALIZED: 2432 case CADET_TUNNEL_KEY_UNINITIALIZED:
2433 LOG (GNUNET_ERROR_TYPE_DEBUG, 2433 LOG (GNUNET_ERROR_TYPE_DEBUG,
2434 "Do not begin KX for %s if WE have no channels waiting. Retrying after %d\n", 2434 "Do not begin KX for %s if WE have no channels waiting. Retrying after %llu\n",
2435 GCT_2s (t), 2435 GCT_2s (t),
2436 GNUNET_TIME_absolute_get_remaining (t->next_kx_attempt).rel_value_us); 2436 GNUNET_TIME_absolute_get_remaining (t->next_kx_attempt).rel_value_us);
2437 /* Do not begin KX if WE have no channels waiting! */ 2437 /* Do not begin KX if WE have no channels waiting! */
diff --git a/src/consensus/consensus_api.c b/src/consensus/consensus_api.c
index 06b4c88ef..b4a9e5d39 100644
--- a/src/consensus/consensus_api.c
+++ b/src/consensus/consensus_api.c
@@ -280,7 +280,7 @@ GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus,
280 struct GNUNET_MQ_Envelope *ev; 280 struct GNUNET_MQ_Envelope *ev;
281 struct InsertDoneInfo *i; 281 struct InsertDoneInfo *i;
282 282
283 LOG (GNUNET_ERROR_TYPE_DEBUG, "inserting, size=%llu\n", element->size); 283 LOG (GNUNET_ERROR_TYPE_DEBUG, "inserting, size=%u\n", element->size);
284 284
285 ev = GNUNET_MQ_msg_extra (element_msg, element->size, 285 ev = GNUNET_MQ_msg_extra (element_msg, element->size,
286 GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT); 286 GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT);
diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h
index ed614ab1b..9eedbeb91 100644
--- a/src/conversation/conversation.h
+++ b/src/conversation/conversation.h
@@ -27,6 +27,8 @@
27#ifndef CONVERSATION_H 27#ifndef CONVERSATION_H
28#define CONVERSATION_H 28#define CONVERSATION_H
29 29
30#include "gnunet_identity_service.h"
31
30#ifdef __cplusplus 32#ifdef __cplusplus
31extern "C" 33extern "C"
32{ 34{
@@ -105,7 +107,7 @@ struct ClientPhoneRingMessage
105 /** 107 /**
106 * Who is calling us? 108 * Who is calling us?
107 */ 109 */
108 struct GNUNET_CRYPTO_EcdsaPublicKey caller_id; 110 struct GNUNET_IDENTITY_PublicKey caller_id;
109}; 111};
110 112
111 113
@@ -230,7 +232,7 @@ struct ClientCallMessage
230 /** 232 /**
231 * Identity of the caller. 233 * Identity of the caller.
232 */ 234 */
233 struct GNUNET_CRYPTO_EcdsaPrivateKey caller_id; 235 struct GNUNET_IDENTITY_PrivateKey caller_id;
234}; 236};
235 237
236 238
@@ -301,7 +303,7 @@ struct CadetPhoneRingMessage
301 /** 303 /**
302 * Who is calling us? (also who is signing). 304 * Who is calling us? (also who is signing).
303 */ 305 */
304 struct GNUNET_CRYPTO_EcdsaPublicKey caller_id; 306 struct GNUNET_IDENTITY_PublicKey caller_id;
305 307
306 /** 308 /**
307 * When does the signature expire? 309 * When does the signature expire?
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index daf51042a..88fe8f11c 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -105,7 +105,7 @@ struct GNUNET_CONVERSATION_Caller
105 /** 105 /**
106 * Identity of the person calling us. 106 * Identity of the person calling us.
107 */ 107 */
108 struct GNUNET_CRYPTO_EcdsaPublicKey caller_id; 108 struct GNUNET_IDENTITY_PublicKey caller_id;
109 109
110 /** 110 /**
111 * Internal handle to identify the caller with the service. 111 * Internal handle to identify the caller with the service.
@@ -192,7 +192,7 @@ struct GNUNET_CONVERSATION_Phone
192 /** 192 /**
193 * My GNS zone. 193 * My GNS zone.
194 */ 194 */
195 struct GNUNET_CRYPTO_EcdsaPrivateKey my_zone; 195 struct GNUNET_IDENTITY_PrivateKey my_zone;
196 196
197 /** 197 /**
198 * State machine for the phone. 198 * State machine for the phone.
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c
index 7a2a727a5..9ff0002e7 100644
--- a/src/conversation/gnunet-conversation.c
+++ b/src/conversation/gnunet-conversation.c
@@ -116,7 +116,7 @@ struct CallList
116 /** 116 /**
117 * Public key identifying the caller. 117 * Public key identifying the caller.
118 */ 118 */
119 struct GNUNET_CRYPTO_EcdsaPublicKey caller_id; 119 struct GNUNET_IDENTITY_PublicKey caller_id;
120 120
121 /** 121 /**
122 * Unique number of the call. 122 * Unique number of the call.
@@ -194,7 +194,7 @@ static char *ego_name;
194/** 194/**
195 * Public key of active conversation partner (if any). 195 * Public key of active conversation partner (if any).
196 */ 196 */
197static struct GNUNET_CRYPTO_EcdsaPublicKey peer_key; 197static struct GNUNET_IDENTITY_PublicKey peer_key;
198 198
199/** 199/**
200 * Name of active conversation partner (if any). 200 * Name of active conversation partner (if any).
@@ -244,7 +244,7 @@ static void
244phone_event_handler (void *cls, 244phone_event_handler (void *cls,
245 enum GNUNET_CONVERSATION_PhoneEventCode code, 245 enum GNUNET_CONVERSATION_PhoneEventCode code,
246 struct GNUNET_CONVERSATION_Caller *caller, 246 struct GNUNET_CONVERSATION_Caller *caller,
247 const struct GNUNET_CRYPTO_EcdsaPublicKey *caller_id) 247 const struct GNUNET_IDENTITY_PublicKey *caller_id)
248{ 248{
249 struct CallList *cl; 249 struct CallList *cl;
250 250
diff --git a/src/conversation/test_conversation_api.c b/src/conversation/test_conversation_api.c
index b51186dc8..c5efecd52 100644
--- a/src/conversation/test_conversation_api.c
+++ b/src/conversation/test_conversation_api.c
@@ -305,7 +305,7 @@ static void
305phone_event_handler (void *cls, 305phone_event_handler (void *cls,
306 enum GNUNET_CONVERSATION_PhoneEventCode code, 306 enum GNUNET_CONVERSATION_PhoneEventCode code,
307 struct GNUNET_CONVERSATION_Caller *caller, 307 struct GNUNET_CONVERSATION_Caller *caller,
308 const struct GNUNET_CRYPTO_EcdsaPublicKey *caller_id) 308 const struct GNUNET_IDENTITY_PublicKey *caller_id)
309{ 309{
310 static enum GNUNET_CONVERSATION_PhoneEventCode expect = 310 static enum GNUNET_CONVERSATION_PhoneEventCode expect =
311 GNUNET_CONVERSATION_EC_PHONE_RING; 311 GNUNET_CONVERSATION_EC_PHONE_RING;
@@ -385,7 +385,7 @@ call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
385 385
386static void 386static void
387caller_ego_create_cont (void *cls, 387caller_ego_create_cont (void *cls,
388 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 388 const struct GNUNET_IDENTITY_PrivateKey *pk,
389 const char *emsg) 389 const char *emsg)
390{ 390{
391 (void) cls; 391 (void) cls;
@@ -414,7 +414,7 @@ identity_cb (void *cls,
414 const char *name) 414 const char *name)
415{ 415{
416 struct GNUNET_GNSRECORD_Data rd; 416 struct GNUNET_GNSRECORD_Data rd;
417 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 417 struct GNUNET_IDENTITY_PublicKey pub;
418 418
419 (void) cls; 419 (void) cls;
420 (void) ctx; 420 (void) ctx;
@@ -465,7 +465,7 @@ identity_cb (void *cls,
465 465
466static void 466static void
467phone_ego_create_cont (void *cls, 467phone_ego_create_cont (void *cls,
468 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 468 const struct GNUNET_IDENTITY_PrivateKey *pk,
469 const char *emsg) 469 const char *emsg)
470{ 470{
471 (void) cls; 471 (void) cls;
diff --git a/src/conversation/test_conversation_api_reject.c b/src/conversation/test_conversation_api_reject.c
index 69fa9f1dc..08c64df37 100644
--- a/src/conversation/test_conversation_api_reject.c
+++ b/src/conversation/test_conversation_api_reject.c
@@ -179,7 +179,7 @@ static void
179phone_event_handler (void *cls, 179phone_event_handler (void *cls,
180 enum GNUNET_CONVERSATION_PhoneEventCode code, 180 enum GNUNET_CONVERSATION_PhoneEventCode code,
181 struct GNUNET_CONVERSATION_Caller *caller, 181 struct GNUNET_CONVERSATION_Caller *caller,
182 const struct GNUNET_CRYPTO_EcdsaPublicKey *caller_id) 182 const struct GNUNET_IDENTITY_PublicKey *caller_id)
183{ 183{
184 static enum GNUNET_CONVERSATION_PhoneEventCode expect = 184 static enum GNUNET_CONVERSATION_PhoneEventCode expect =
185 GNUNET_CONVERSATION_EC_PHONE_RING; 185 GNUNET_CONVERSATION_EC_PHONE_RING;
@@ -238,7 +238,7 @@ call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
238 238
239static void 239static void
240caller_ego_create_cont (void *cls, 240caller_ego_create_cont (void *cls,
241 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 241 const struct GNUNET_IDENTITY_PrivateKey *pk,
242 const char *emsg) 242 const char *emsg)
243{ 243{
244 (void) cls; 244 (void) cls;
@@ -267,7 +267,7 @@ identity_cb (void *cls,
267 const char *name) 267 const char *name)
268{ 268{
269 struct GNUNET_GNSRECORD_Data rd; 269 struct GNUNET_GNSRECORD_Data rd;
270 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 270 struct GNUNET_IDENTITY_PublicKey pub;
271 271
272 (void) cls; 272 (void) cls;
273 (void) ctx; 273 (void) ctx;
@@ -318,7 +318,7 @@ identity_cb (void *cls,
318 318
319static void 319static void
320phone_ego_create_cont (void *cls, 320phone_ego_create_cont (void *cls,
321 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 321 const struct GNUNET_IDENTITY_PrivateKey *pk,
322 const char *emsg) 322 const char *emsg)
323{ 323{
324 (void) cls; 324 (void) cls;
diff --git a/src/conversation/test_conversation_api_twocalls.c b/src/conversation/test_conversation_api_twocalls.c
index 83e8cb55a..ac7a3c9dd 100644
--- a/src/conversation/test_conversation_api_twocalls.c
+++ b/src/conversation/test_conversation_api_twocalls.c
@@ -403,7 +403,7 @@ static void
403phone_event_handler (void *cls, 403phone_event_handler (void *cls,
404 enum GNUNET_CONVERSATION_PhoneEventCode code, 404 enum GNUNET_CONVERSATION_PhoneEventCode code,
405 struct GNUNET_CONVERSATION_Caller *caller, 405 struct GNUNET_CONVERSATION_Caller *caller,
406 const struct GNUNET_CRYPTO_EcdsaPublicKey *caller_id) 406 const struct GNUNET_IDENTITY_PublicKey *caller_id)
407{ 407{
408 const char *cid; 408 const char *cid;
409 409
@@ -507,7 +507,7 @@ call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
507 507
508static void 508static void
509caller_ego_create_cont (void *cls, 509caller_ego_create_cont (void *cls,
510 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 510 const struct GNUNET_IDENTITY_PrivateKey *pk,
511 const char *emsg) 511 const char *emsg)
512{ 512{
513 (void) cls; 513 (void) cls;
@@ -536,7 +536,7 @@ identity_cb (void *cls,
536 const char *name) 536 const char *name)
537{ 537{
538 struct GNUNET_GNSRECORD_Data rd; 538 struct GNUNET_GNSRECORD_Data rd;
539 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 539 struct GNUNET_IDENTITY_PublicKey pub;
540 540
541 (void) cls; 541 (void) cls;
542 (void) ctx; 542 (void) ctx;
@@ -594,7 +594,7 @@ identity_cb (void *cls,
594 594
595static void 595static void
596phone_ego_create_cont (void *cls, 596phone_ego_create_cont (void *cls,
597 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 597 const struct GNUNET_IDENTITY_PrivateKey *pk,
598 const char *emsg) 598 const char *emsg)
599{ 599{
600 (void) cls; 600 (void) cls;
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index 4537f6efe..bd7a612ed 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -994,8 +994,8 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
994 } 994 }
995 995
996 LOG (GNUNET_ERROR_TYPE_DEBUG, 996 LOG (GNUNET_ERROR_TYPE_DEBUG,
997 "Asked to put %u bytes of data under key `%s' for %s\n", 997 "Asked to put %lu bytes of data under key `%s' for %s\n",
998 size, 998 (unsigned long) size,
999 GNUNET_h2s (key), 999 GNUNET_h2s (key),
1000 GNUNET_STRINGS_relative_time_to_string ( 1000 GNUNET_STRINGS_relative_time_to_string (
1001 GNUNET_TIME_absolute_get_remaining (expiration), 1001 GNUNET_TIME_absolute_get_remaining (expiration),
@@ -1205,8 +1205,8 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
1205 if (NULL == cont) 1205 if (NULL == cont)
1206 cont = &drop_status_cont; 1206 cont = &drop_status_cont;
1207 LOG (GNUNET_ERROR_TYPE_DEBUG, 1207 LOG (GNUNET_ERROR_TYPE_DEBUG,
1208 "Asked to remove %u bytes under key `%s'\n", 1208 "Asked to remove %lu bytes under key `%s'\n",
1209 size, 1209 (unsigned long) size,
1210 GNUNET_h2s (key)); 1210 GNUNET_h2s (key));
1211 env = GNUNET_MQ_msg_extra (dm, 1211 env = GNUNET_MQ_msg_extra (dm,
1212 size, 1212 size,
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index 1e44c1fad..5eb3115f4 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -488,8 +488,8 @@ handle_dht_local_put (void *cls,
488 GNUNET_h2s_full (&dht_msg->key)); 488 GNUNET_h2s_full (&dht_msg->key));
489 /* give to local clients */ 489 /* give to local clients */
490 LOG (GNUNET_ERROR_TYPE_DEBUG, 490 LOG (GNUNET_ERROR_TYPE_DEBUG,
491 "Handling local PUT of %u-bytes for query %s\n", 491 "Handling local PUT of %lu-bytes for query %s\n",
492 size - sizeof(struct GNUNET_DHT_ClientPutMessage), 492 (unsigned long) (size - sizeof(struct GNUNET_DHT_ClientPutMessage)),
493 GNUNET_h2s (&dht_msg->key)); 493 GNUNET_h2s (&dht_msg->key));
494 GDS_CLIENTS_handle_reply (GNUNET_TIME_absolute_ntoh (dht_msg->expiration), 494 GDS_CLIENTS_handle_reply (GNUNET_TIME_absolute_ntoh (dht_msg->expiration),
495 &dht_msg->key, 495 &dht_msg->key,
@@ -619,7 +619,7 @@ handle_dht_local_get (void *cls,
619 "Received GET request for %s from local client %p, xq: %.*s\n", 619 "Received GET request for %s from local client %p, xq: %.*s\n",
620 GNUNET_h2s (&get->key), 620 GNUNET_h2s (&get->key),
621 ch->client, 621 ch->client,
622 xquery_size, 622 (int) xquery_size,
623 xquery); 623 xquery);
624 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, 624 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
625 "CLIENT-GET %s\n", 625 "CLIENT-GET %s\n",
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c
index 41b7a3a2b..7eded2152 100644
--- a/src/dht/gnunet-service-dht_datacache.c
+++ b/src/dht/gnunet-service-dht_datacache.c
@@ -94,9 +94,9 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
94 put_path_length, 94 put_path_length,
95 put_path); 95 put_path);
96 LOG (GNUNET_ERROR_TYPE_DEBUG, 96 LOG (GNUNET_ERROR_TYPE_DEBUG,
97 "DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n", 97 "DATACACHE PUT for key %s [%lu] completed (%d) after %u hops\n",
98 GNUNET_h2s (key), 98 GNUNET_h2s (key),
99 data_size, 99 (unsigned long) data_size,
100 r, 100 r,
101 put_path_length); 101 put_path_length);
102} 102}
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index b211fca6b..88b0c5d92 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -2212,8 +2212,8 @@ handle_dht_p2p_get (void *cls,
2212 bg, 2212 bg,
2213 peer_bf); 2213 peer_bf);
2214 GDS_CLIENTS_process_get (options 2214 GDS_CLIENTS_process_get (options
2215 | (GNUNET_OK == forwarded) 2215 | ((GNUNET_OK == forwarded)
2216 ? GNUNET_DHT_RO_LAST_HOP : 0, 2216 ? GNUNET_DHT_RO_LAST_HOP : 0),
2217 type, 2217 type,
2218 ntohl (get->hop_count), 2218 ntohl (get->hop_count),
2219 ntohl (get->desired_replication_level), 2219 ntohl (get->desired_replication_level),
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c
index f213433ed..a9f336240 100644
--- a/src/dht/plugin_block_dht.c
+++ b/src/dht/plugin_block_dht.c
@@ -195,7 +195,7 @@ block_plugin_dht_get_key (void *cls,
195 { 195 {
196 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 196 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
197 "block-dht", 197 "block-dht",
198 _ ("Size mismatch for block\n"), 198 _ ("Size mismatch for block with type %u\n"),
199 GNUNET_BLOCK_TYPE_DHT_HELLO); 199 GNUNET_BLOCK_TYPE_DHT_HELLO);
200 return GNUNET_NO; 200 return GNUNET_NO;
201 } 201 }
diff --git a/src/dns/gnunet-dns-monitor.c b/src/dns/gnunet-dns-monitor.c
index d9830baa4..836d65c79 100644
--- a/src/dns/gnunet-dns-monitor.c
+++ b/src/dns/gnunet-dns-monitor.c
@@ -203,7 +203,7 @@ display_record (const struct GNUNET_DNSPARSER_Record *record)
203 else 203 else
204 { 204 {
205 GNUNET_asprintf (&tmp, 205 GNUNET_asprintf (&tmp,
206 "priority %u, weight = %s, port = %u, target = %s", 206 "priority %u, weight = %u, port = %u, target = %s",
207 (unsigned int) record->data.srv->priority, 207 (unsigned int) record->data.srv->priority,
208 (unsigned int) record->data.srv->weight, 208 (unsigned int) record->data.srv->weight,
209 (unsigned int) record->data.srv->port, 209 (unsigned int) record->data.srv->port,
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c
index 6154e8be0..d4677b794 100644
--- a/src/fs/fs_download.c
+++ b/src/fs/fs_download.c
@@ -1050,7 +1050,7 @@ process_result_with_request (void *cls,
1050 GNUNET_asprintf ( 1050 GNUNET_asprintf (
1051 &dc->emsg, 1051 &dc->emsg,
1052 _ ( 1052 _ (
1053 "Internal error or bogus download URI (expected %u bytes at depth %u and offset %llu/%llu, got %u bytes)"), 1053 "Internal error or bogus download URI (expected %lu bytes at depth %u and offset %llu/%llu, got %lu bytes)"),
1054 bs, 1054 bs,
1055 dr->depth, 1055 dr->depth,
1056 (unsigned long long) dr->offset, 1056 (unsigned long long) dr->offset,
diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c
index 829906461..fbb7c6028 100644
--- a/src/fs/gnunet-daemon-fsprofiler.c
+++ b/src/fs/gnunet-daemon-fsprofiler.c
@@ -592,14 +592,14 @@ run (void *cls, char *const *args GNUNET_UNUSED,
592 &replication_level)) 592 &replication_level))
593 replication_level = 1; 593 replication_level = 1;
594 GNUNET_snprintf (myoptname, sizeof(myoptname), 594 GNUNET_snprintf (myoptname, sizeof(myoptname),
595 "DOWNLOAD-PATTERN-%u", my_peerid); 595 "DOWNLOAD-PATTERN-%llu", my_peerid);
596 if (GNUNET_OK != 596 if (GNUNET_OK !=
597 GNUNET_CONFIGURATION_get_value_string (cfg, 597 GNUNET_CONFIGURATION_get_value_string (cfg,
598 "FSPROFILER", myoptname, 598 "FSPROFILER", myoptname,
599 &download_pattern)) 599 &download_pattern))
600 download_pattern = GNUNET_strdup (""); 600 download_pattern = GNUNET_strdup ("");
601 GNUNET_snprintf (myoptname, sizeof(myoptname), 601 GNUNET_snprintf (myoptname, sizeof(myoptname),
602 "PUBLISH-PATTERN-%u", my_peerid); 602 "PUBLISH-PATTERN-%llu", my_peerid);
603 if (GNUNET_OK != 603 if (GNUNET_OK !=
604 GNUNET_CONFIGURATION_get_value_string (cfg, 604 GNUNET_CONFIGURATION_get_value_string (cfg,
605 "FSPROFILER", myoptname, 605 "FSPROFILER", myoptname,
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index 91fcd8f8a..518192283 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -475,6 +475,7 @@ uri_ksk_continuation (void *cls,
475 const char *emsg) 475 const char *emsg)
476{ 476{
477 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; 477 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv;
478 const struct GNUNET_IDENTITY_PrivateKey *pk;
478 479
479 if (NULL != emsg) 480 if (NULL != emsg)
480 { 481 {
@@ -486,7 +487,10 @@ uri_ksk_continuation (void *cls,
486 GNUNET_SCHEDULER_shutdown (); 487 GNUNET_SCHEDULER_shutdown ();
487 return; 488 return;
488 } 489 }
489 priv = GNUNET_IDENTITY_ego_get_private_key (namespace); 490 pk = GNUNET_IDENTITY_ego_get_private_key (namespace);
491 if (GNUNET_IDENTITY_TYPE_ECDSA != ntohl (pk->type))
492 return;
493 priv = &pk->ecdsa_key;
490 GNUNET_FS_publish_sks (ctx, 494 GNUNET_FS_publish_sks (ctx,
491 priv, 495 priv,
492 this_id, 496 this_id,
@@ -569,6 +573,7 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result)
569{ 573{
570 struct GNUNET_FS_FileInformation *fi; 574 struct GNUNET_FS_FileInformation *fi;
571 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; 575 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv;
576 const struct GNUNET_IDENTITY_PrivateKey *pk;
572 577
573 fi = get_file_information (directory_scan_result); 578 fi = get_file_information (directory_scan_result);
574 GNUNET_FS_share_tree_free (directory_scan_result); 579 GNUNET_FS_share_tree_free (directory_scan_result);
@@ -589,7 +594,11 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result)
589 if (NULL == namespace) 594 if (NULL == namespace)
590 priv = NULL; 595 priv = NULL;
591 else 596 else
592 priv = GNUNET_IDENTITY_ego_get_private_key (namespace); 597 {
598 pk = GNUNET_IDENTITY_ego_get_private_key (namespace);
599 if (GNUNET_IDENTITY_TYPE_ECDSA == ntohl (pk->type))
600 priv = &pk->ecdsa_key;
601 }
593 pc = GNUNET_FS_publish_start (ctx, 602 pc = GNUNET_FS_publish_start (ctx,
594 fi, 603 fi,
595 priv, 604 priv,
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 5a9c70997..744ba66ec 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -109,6 +109,7 @@ libgnunet_plugin_rest_gns_la_SOURCES = \
109 plugin_rest_gns.c 109 plugin_rest_gns.c
110libgnunet_plugin_rest_gns_la_LIBADD = \ 110libgnunet_plugin_rest_gns_la_LIBADD = \
111 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 111 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
112 $(top_builddir)/src/gnsrecord/libgnunetgnsrecordjson.la \
112 libgnunetgns.la \ 113 libgnunetgns.la \
113 $(top_builddir)/src/rest/libgnunetrest.la \ 114 $(top_builddir)/src/rest/libgnunetrest.la \
114 $(top_builddir)/src/identity/libgnunetidentity.la \ 115 $(top_builddir)/src/identity/libgnunetidentity.la \
@@ -124,6 +125,7 @@ libgnunet_plugin_gnsrecord_gns_la_SOURCES = \
124 plugin_gnsrecord_gns.c 125 plugin_gnsrecord_gns.c
125libgnunet_plugin_gnsrecord_gns_la_LIBADD = \ 126libgnunet_plugin_gnsrecord_gns_la_LIBADD = \
126 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 127 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
128 $(top_builddir)/src/identity/libgnunetidentity.la \
127 $(top_builddir)/src/util/libgnunetutil.la \ 129 $(top_builddir)/src/util/libgnunetutil.la \
128 $(LTLIBINTL) 130 $(LTLIBINTL)
129libgnunet_plugin_gnsrecord_gns_la_LDFLAGS = \ 131libgnunet_plugin_gnsrecord_gns_la_LDFLAGS = \
@@ -135,6 +137,7 @@ gnunet_gns_SOURCES = \
135gnunet_gns_LDADD = \ 137gnunet_gns_LDADD = \
136 libgnunetgns.la \ 138 libgnunetgns.la \
137 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 139 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
140 $(top_builddir)/src/identity/libgnunetidentity.la \
138 $(top_builddir)/src/util/libgnunetutil.la \ 141 $(top_builddir)/src/util/libgnunetutil.la \
139 $(LIBIDN) $(LIBIDN2) \ 142 $(LIBIDN) $(LIBIDN2) \
140 $(GN_LIBINTL) 143 $(GN_LIBINTL)
@@ -144,6 +147,7 @@ gnunet_gns_benchmark_SOURCES = \
144gnunet_gns_benchmark_LDADD = \ 147gnunet_gns_benchmark_LDADD = \
145 libgnunetgns.la \ 148 libgnunetgns.la \
146 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 149 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
150 $(top_builddir)/src/identity/libgnunetidentity.la \
147 $(top_builddir)/src/util/libgnunetutil.la \ 151 $(top_builddir)/src/util/libgnunetutil.la \
148 $(GN_LIBINTL) 152 $(GN_LIBINTL)
149 153
@@ -247,6 +251,7 @@ libgnunet_plugin_block_gns_la_LIBADD = \
247 $(top_builddir)/src/util/libgnunetutil.la \ 251 $(top_builddir)/src/util/libgnunetutil.la \
248 $(top_builddir)/src/block/libgnunetblock.la \ 252 $(top_builddir)/src/block/libgnunetblock.la \
249 $(top_builddir)/src/block/libgnunetblockgroup.la \ 253 $(top_builddir)/src/block/libgnunetblockgroup.la \
254 $(top_builddir)/src/identity/libgnunetidentity.la \
250 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la 255 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la
251libgnunet_plugin_block_gns_la_LDFLAGS = \ 256libgnunet_plugin_block_gns_la_LDFLAGS = \
252 $(GN_LIBINTL) \ 257 $(GN_LIBINTL) \
diff --git a/src/gns/gns.h b/src/gns/gns.h
index a193632b7..d824742ad 100644
--- a/src/gns/gns.h
+++ b/src/gns/gns.h
@@ -48,7 +48,7 @@ struct LookupMessage
48 /** 48 /**
49 * Zone that is to be used for lookup 49 * Zone that is to be used for lookup
50 */ 50 */
51 struct GNUNET_CRYPTO_EcdsaPublicKey zone; 51 struct GNUNET_IDENTITY_PublicKey zone;
52 52
53 /** 53 /**
54 * Local options for where to look for results 54 * Local options for where to look for results
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index bf95bf340..841a0d240 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -343,7 +343,7 @@ GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr)
343struct GNUNET_GNS_LookupRequest * 343struct GNUNET_GNS_LookupRequest *
344GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, 344GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
345 const char *name, 345 const char *name,
346 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, 346 const struct GNUNET_IDENTITY_PublicKey *zone,
347 uint32_t type, 347 uint32_t type,
348 enum GNUNET_GNS_LocalOptions options, 348 enum GNUNET_GNS_LocalOptions options,
349 uint16_t recursion_depth_limit, 349 uint16_t recursion_depth_limit,
@@ -411,7 +411,7 @@ GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
411struct GNUNET_GNS_LookupRequest* 411struct GNUNET_GNS_LookupRequest*
412GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, 412GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
413 const char *name, 413 const char *name,
414 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, 414 const struct GNUNET_IDENTITY_PublicKey *zone,
415 uint32_t type, 415 uint32_t type,
416 enum GNUNET_GNS_LocalOptions options, 416 enum GNUNET_GNS_LocalOptions options,
417 GNUNET_GNS_LookupResultProcessor proc, 417 GNUNET_GNS_LookupResultProcessor proc,
diff --git a/src/gns/gns_tld_api.c b/src/gns/gns_tld_api.c
index 3ebf07db6..b883662ad 100644
--- a/src/gns/gns_tld_api.c
+++ b/src/gns/gns_tld_api.c
@@ -167,7 +167,7 @@ process_lookup_result (void *cls,
167 */ 167 */
168static void 168static void
169lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr, 169lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr,
170 const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) 170 const struct GNUNET_IDENTITY_PublicKey *pkey)
171{ 171{
172 ltr->lr = GNUNET_GNS_lookup (ltr->gns_handle, 172 ltr->lr = GNUNET_GNS_lookup (ltr->gns_handle,
173 ltr->name, 173 ltr->name,
@@ -190,11 +190,11 @@ lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr,
190 */ 190 */
191static void 191static void
192identity_zone_cb (void *cls, 192identity_zone_cb (void *cls,
193 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, 193 const struct GNUNET_IDENTITY_PrivateKey *priv,
194 const char *ego_name) 194 const char *ego_name)
195{ 195{
196 struct GNUNET_GNS_LookupWithTldRequest *ltr = cls; 196 struct GNUNET_GNS_LookupWithTldRequest *ltr = cls;
197 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 197 struct GNUNET_IDENTITY_PublicKey pkey;
198 198
199 ltr->id_co = NULL; 199 ltr->id_co = NULL;
200 if (NULL == priv) 200 if (NULL == priv)
@@ -219,7 +219,7 @@ identity_zone_cb (void *cls,
219 ltr->options = GNUNET_GNS_LO_NO_DHT; 219 ltr->options = GNUNET_GNS_LO_NO_DHT;
220 else 220 else
221 ltr->options = GNUNET_GNS_LO_LOCAL_MASTER; 221 ltr->options = GNUNET_GNS_LO_LOCAL_MASTER;
222 GNUNET_CRYPTO_ecdsa_key_get_public (priv, &pkey); 222 GNUNET_IDENTITY_key_get_public (priv, &pkey);
223 lookup_with_public_key (ltr, &pkey); 223 lookup_with_public_key (ltr, &pkey);
224} 224}
225 225
@@ -249,7 +249,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
249 const char *tld; 249 const char *tld;
250 char *dot_tld; 250 char *dot_tld;
251 char *zonestr; 251 char *zonestr;
252 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 252 struct GNUNET_IDENTITY_PublicKey pkey;
253 253
254 ltr = GNUNET_new (struct GNUNET_GNS_LookupWithTldRequest); 254 ltr = GNUNET_new (struct GNUNET_GNS_LookupWithTldRequest);
255 ltr->gns_handle = handle; 255 ltr->gns_handle = handle;
@@ -261,8 +261,10 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
261 /* start with trivial case: TLD is zkey */ 261 /* start with trivial case: TLD is zkey */
262 tld = get_tld (ltr->name); 262 tld = get_tld (ltr->name);
263 if (GNUNET_OK == 263 if (GNUNET_OK ==
264 GNUNET_CRYPTO_ecdsa_public_key_from_string (tld, strlen (tld), &pkey)) 264 GNUNET_IDENTITY_public_key_from_string (tld, &pkey))
265 { 265 {
266 LOG (GNUNET_ERROR_TYPE_DEBUG,
267 "`%s' seems to be a valid zone key\n", tld);
266 eat_tld (ltr->name, tld); 268 eat_tld (ltr->name, tld);
267 lookup_with_public_key (ltr, &pkey); 269 lookup_with_public_key (ltr, &pkey);
268 return ltr; 270 return ltr;
@@ -281,9 +283,8 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
281 &zonestr)) 283 &zonestr))
282 { 284 {
283 if (GNUNET_OK != 285 if (GNUNET_OK !=
284 GNUNET_CRYPTO_ecdsa_public_key_from_string (zonestr, 286 GNUNET_IDENTITY_public_key_from_string (zonestr,
285 strlen (zonestr), 287 &pkey))
286 &pkey))
287 { 288 {
288 GNUNET_log_config_invalid ( 289 GNUNET_log_config_invalid (
289 GNUNET_ERROR_TYPE_ERROR, 290 GNUNET_ERROR_TYPE_ERROR,
@@ -304,6 +305,8 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
304 } 305 }
305 GNUNET_free (dot_tld); 306 GNUNET_free (dot_tld);
306 } 307 }
308 LOG (GNUNET_ERROR_TYPE_DEBUG,
309 "`%s' should be a valid ego\n", ltr->name);
307 ltr->id_co = 310 ltr->id_co =
308 GNUNET_IDENTITY_ego_lookup_by_suffix (ltr->gns_handle->cfg, 311 GNUNET_IDENTITY_ego_lookup_by_suffix (ltr->gns_handle->cfg,
309 ltr->name, 312 ltr->name,
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 8c5b2d6c4..52300ae3b 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -123,7 +123,7 @@ struct GNS_TopLevelDomain
123 /** 123 /**
124 * Public key associated with the @a tld. 124 * Public key associated with the @a tld.
125 */ 125 */
126 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 126 struct GNUNET_IDENTITY_PublicKey pkey;
127 127
128 /** 128 /**
129 * Top-level domain as a string, including leading ".". 129 * Top-level domain as a string, including leading ".".
@@ -177,7 +177,7 @@ static struct GNS_TopLevelDomain *tld_tail;
177 */ 177 */
178int 178int
179GNS_find_tld (const char *tld_str, 179GNS_find_tld (const char *tld_str,
180 struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) 180 struct GNUNET_IDENTITY_PublicKey *pkey)
181{ 181{
182 if ('\0' == *tld_str) 182 if ('\0' == *tld_str)
183 return GNUNET_NO; 183 return GNUNET_NO;
@@ -485,7 +485,7 @@ read_service_conf (void *cls,
485 const char *option, 485 const char *option,
486 const char *value) 486 const char *value)
487{ 487{
488 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 488 struct GNUNET_IDENTITY_PublicKey pk;
489 struct GNS_TopLevelDomain *tld; 489 struct GNS_TopLevelDomain *tld;
490 490
491 (void) cls; 491 (void) cls;
diff --git a/src/gns/gnunet-service-gns.h b/src/gns/gnunet-service-gns.h
index 2a432f8aa..d4fb9ec9f 100644
--- a/src/gns/gnunet-service-gns.h
+++ b/src/gns/gnunet-service-gns.h
@@ -26,6 +26,7 @@
26#ifndef GNUNET_SERVICE_GNS_H 26#ifndef GNUNET_SERVICE_GNS_H
27#define GNUNET_SERVICE_GNS_H 27#define GNUNET_SERVICE_GNS_H
28 28
29#include "gnunet_identity_service.h"
29 30
30/** 31/**
31 * Find GNS zone belonging to TLD @a tld. 32 * Find GNS zone belonging to TLD @a tld.
@@ -36,7 +37,7 @@
36 */ 37 */
37int 38int
38GNS_find_tld (const char *tld_str, 39GNS_find_tld (const char *tld_str,
39 struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); 40 struct GNUNET_IDENTITY_PublicKey *pkey);
40 41
41 42
42/** 43/**
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c
index 19416a506..b53f4af6b 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -314,7 +314,7 @@ handle_dns_request (void *cls,
314{ 314{
315 struct GNUNET_DNSPARSER_Packet *p; 315 struct GNUNET_DNSPARSER_Packet *p;
316 struct InterceptLookupHandle *ilh; 316 struct InterceptLookupHandle *ilh;
317 struct GNUNET_CRYPTO_EcdsaPublicKey zone; 317 struct GNUNET_IDENTITY_PublicKey zone;
318 318
319 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 319 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
320 "Hijacked a DNS request. Processing.\n"); 320 "Hijacked a DNS request. Processing.\n");
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index cb75b23c7..1c13f4df1 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -173,7 +173,7 @@ struct AuthorityChain
173 /** 173 /**
174 * The zone of the GNS authority 174 * The zone of the GNS authority
175 */ 175 */
176 struct GNUNET_CRYPTO_EcdsaPublicKey gns_authority; 176 struct GNUNET_IDENTITY_PublicKey gns_authority;
177 177
178 struct 178 struct
179 { 179 {
@@ -305,7 +305,7 @@ struct GNS_ResolverHandle
305 /** 305 /**
306 * The top-level GNS authoritative zone to query 306 * The top-level GNS authoritative zone to query
307 */ 307 */
308 struct GNUNET_CRYPTO_EcdsaPublicKey authority_zone; 308 struct GNUNET_IDENTITY_PublicKey authority_zone;
309 309
310 /** 310 /**
311 * called when resolution phase finishes 311 * called when resolution phase finishes
@@ -1251,7 +1251,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1251 const char *tld; 1251 const char *tld;
1252 struct AuthorityChain *ac; 1252 struct AuthorityChain *ac;
1253 int af; 1253 int af;
1254 struct GNUNET_CRYPTO_EcdsaPublicKey zone; 1254 struct GNUNET_IDENTITY_PublicKey zone;
1255 1255
1256 nlen = strlen (cname); 1256 nlen = strlen (cname);
1257 tld = GNS_get_tld (cname); 1257 tld = GNS_get_tld (cname);
@@ -1296,7 +1296,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1296 { 1296 {
1297 GNUNET_asprintf (&res, 1297 GNUNET_asprintf (&res,
1298 "%.*s", 1298 "%.*s",
1299 strlen (cname) - (strlen (tld) + 1), 1299 (int) (strlen (cname) - (strlen (tld) + 1)),
1300 cname); 1300 cname);
1301 } 1301 }
1302 else 1302 else
@@ -1305,7 +1305,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1305 "%.*s.%.*s", 1305 "%.*s.%.*s",
1306 (int) rh->name_resolution_pos, 1306 (int) rh->name_resolution_pos,
1307 rh->name, 1307 rh->name,
1308 (int) strlen (cname) - (strlen (tld) + 1), 1308 (int) (strlen (cname) - (strlen (tld) + 1)),
1309 cname); 1309 cname);
1310 } 1310 }
1311 rh->name_resolution_pos = strlen (res); 1311 rh->name_resolution_pos = strlen (res);
@@ -1696,10 +1696,11 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh,
1696 const struct GNUNET_GNSRECORD_Data *rd) 1696 const struct GNUNET_GNSRECORD_Data *rd)
1697{ 1697{
1698 struct AuthorityChain *ac; 1698 struct AuthorityChain *ac;
1699 struct GNUNET_IDENTITY_PublicKey auth;
1699 1700
1700 /* delegation to another zone */ 1701 /* delegation to another zone */
1701 if (sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) != 1702 if (GNUNET_OK != GNUNET_GNSRECORD_record_to_identity_key (rd,
1702 rd->data_size) 1703 &auth))
1703 { 1704 {
1704 GNUNET_break_op (0); 1705 GNUNET_break_op (0);
1705 fail_resolution (rh); 1706 fail_resolution (rh);
@@ -1709,9 +1710,9 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh,
1709 ac = GNUNET_new (struct AuthorityChain); 1710 ac = GNUNET_new (struct AuthorityChain);
1710 ac->rh = rh; 1711 ac->rh = rh;
1711 ac->gns_authority = GNUNET_YES; 1712 ac->gns_authority = GNUNET_YES;
1712 GNUNET_memcpy (&ac->authority_info.gns_authority, 1713 ac->authority_info.gns_authority = auth;
1713 rd->data, 1714 GNUNET_GNSRECORD_record_to_identity_key (rd,
1714 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 1715 &ac->authority_info.gns_authority);
1715 ac->label = resolver_lookup_get_next_label (rh); 1716 ac->label = resolver_lookup_get_next_label (rh);
1716 /* add AC to tail */ 1717 /* add AC to tail */
1717 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 1718 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
@@ -1754,7 +1755,7 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
1754 char *n; 1755 char *n;
1755 size_t off; 1756 size_t off;
1756 struct Gns2DnsPending *gp; 1757 struct Gns2DnsPending *gp;
1757 struct GNUNET_CRYPTO_EcdsaPublicKey zone; 1758 struct GNUNET_IDENTITY_PublicKey zone;
1758 struct sockaddr_in v4; 1759 struct sockaddr_in v4;
1759 struct sockaddr_in6 v6; 1760 struct sockaddr_in6 v6;
1760 1761
@@ -2258,16 +2259,11 @@ handle_gns_resolution_result (void *cls,
2258 2259
2259 case GNUNET_GNSRECORD_TYPE_PKEY: 2260 case GNUNET_GNSRECORD_TYPE_PKEY:
2260 { 2261 {
2261 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
2262
2263 if (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) 2262 if (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))
2264 { 2263 {
2265 GNUNET_break_op (0); 2264 GNUNET_break_op (0);
2266 break; 2265 break;
2267 } 2266 }
2268 GNUNET_memcpy (&pub,
2269 rd[i].data,
2270 rd[i].data_size);
2271 rd_off++; 2267 rd_off++;
2272 if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type) 2268 if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type)
2273 { 2269 {
@@ -2277,7 +2273,9 @@ handle_gns_resolution_result (void *cls,
2277 ac = GNUNET_new (struct AuthorityChain); 2273 ac = GNUNET_new (struct AuthorityChain);
2278 ac->rh = rh; 2274 ac->rh = rh;
2279 ac->gns_authority = GNUNET_YES; 2275 ac->gns_authority = GNUNET_YES;
2280 ac->authority_info.gns_authority = pub; 2276 GNUNET_GNSRECORD_record_to_identity_key (&rd[i],
2277 &ac->authority_info.
2278 gns_authority);
2281 ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT); 2279 ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT);
2282 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 2280 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
2283 rh->ac_tail, 2281 rh->ac_tail,
@@ -2469,10 +2467,7 @@ handle_dht_response (void *cls,
2469 return; 2467 return;
2470 } 2468 }
2471 block = data; 2469 block = data;
2472 if (size != 2470 if (size != GNUNET_GNSRECORD_block_get_size (block))
2473 ntohl (block->purpose.size)
2474 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
2475 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature))
2476 { 2471 {
2477 /* how did this pass DHT block validation!? */ 2472 /* how did this pass DHT block validation!? */
2478 GNUNET_break (0); 2473 GNUNET_break (0);
@@ -2480,8 +2475,8 @@ handle_dht_response (void *cls,
2480 return; 2475 return;
2481 } 2476 }
2482 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2477 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2483 "Decrypting DHT block of size %u for `%s', expires %s\n", 2478 "Decrypting DHT block of size %lu for `%s', expires %s\n",
2484 ntohl (block->purpose.size), 2479 GNUNET_GNSRECORD_block_get_size (block),
2485 rh->name, 2480 rh->name,
2486 GNUNET_STRINGS_absolute_time_to_string (exp)); 2481 GNUNET_STRINGS_absolute_time_to_string (exp));
2487 if (GNUNET_OK != 2482 if (GNUNET_OK !=
@@ -2495,8 +2490,8 @@ handle_dht_response (void *cls,
2495 fail_resolution (rh); 2490 fail_resolution (rh);
2496 return; 2491 return;
2497 } 2492 }
2498 if (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( 2493 if (0 == GNUNET_TIME_absolute_get_remaining (
2499 block->expiration_time)). 2494 GNUNET_GNSRECORD_block_get_expiration (block)).
2500 rel_value_us) 2495 rel_value_us)
2501 { 2496 {
2502 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2497 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2594,7 +2589,7 @@ handle_namecache_block_response (void *cls,
2594 struct GNS_ResolverHandle *rh = cls; 2589 struct GNS_ResolverHandle *rh = cls;
2595 struct AuthorityChain *ac = rh->ac_tail; 2590 struct AuthorityChain *ac = rh->ac_tail;
2596 const char *label = ac->label; 2591 const char *label = ac->label;
2597 const struct GNUNET_CRYPTO_EcdsaPublicKey *auth = 2592 const struct GNUNET_IDENTITY_PublicKey *auth =
2598 &ac->authority_info.gns_authority; 2593 &ac->authority_info.gns_authority;
2599 struct GNUNET_HashCode query; 2594 struct GNUNET_HashCode query;
2600 2595
@@ -2604,8 +2599,8 @@ handle_namecache_block_response (void *cls,
2604 ((GNUNET_GNS_LO_LOCAL_MASTER == rh->options) && 2599 ((GNUNET_GNS_LO_LOCAL_MASTER == rh->options) &&
2605 (ac != rh->ac_head))) && 2600 (ac != rh->ac_head))) &&
2606 ((NULL == block) || 2601 ((NULL == block) ||
2607 (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( 2602 (0 == GNUNET_TIME_absolute_get_remaining (
2608 block->expiration_time)). 2603 GNUNET_GNSRECORD_block_get_expiration (block)).
2609 rel_value_us))) 2604 rel_value_us)))
2610 { 2605 {
2611 /* namecache knows nothing; try DHT lookup */ 2606 /* namecache knows nothing; try DHT lookup */
@@ -2622,8 +2617,8 @@ handle_namecache_block_response (void *cls,
2622 } 2617 }
2623 2618
2624 if ((NULL == block) || 2619 if ((NULL == block) ||
2625 (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( 2620 (0 == GNUNET_TIME_absolute_get_remaining (
2626 block->expiration_time)). 2621 GNUNET_GNSRECORD_block_get_expiration (block)).
2627 rel_value_us)) 2622 rel_value_us))
2628 { 2623 {
2629 /* DHT not permitted and no local result, fail */ 2624 /* DHT not permitted and no local result, fail */
@@ -2857,7 +2852,7 @@ start_resolver_lookup (void *cls)
2857 * @return handle to cancel operation 2852 * @return handle to cancel operation
2858 */ 2853 */
2859struct GNS_ResolverHandle * 2854struct GNS_ResolverHandle *
2860GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, 2855GNS_resolver_lookup (const struct GNUNET_IDENTITY_PublicKey *zone,
2861 uint32_t record_type, 2856 uint32_t record_type,
2862 const char *name, 2857 const char *name,
2863 enum GNUNET_GNS_LocalOptions options, 2858 enum GNUNET_GNS_LocalOptions options,
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h
index 3dab3c91a..b099c5d65 100644
--- a/src/gns/gnunet-service-gns_resolver.h
+++ b/src/gns/gnunet-service-gns_resolver.h
@@ -86,7 +86,7 @@ typedef void
86 * @return handle to cancel operation 86 * @return handle to cancel operation
87 */ 87 */
88struct GNS_ResolverHandle * 88struct GNS_ResolverHandle *
89GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, 89GNS_resolver_lookup (const struct GNUNET_IDENTITY_PublicKey *zone,
90 uint32_t record_type, 90 uint32_t record_type,
91 const char *name, 91 const char *name,
92 enum GNUNET_GNS_LocalOptions options, 92 enum GNUNET_GNS_LocalOptions options,
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c
index aabedcaac..9b58c9034 100644
--- a/src/gns/plugin_block_gns.c
+++ b/src/gns/plugin_block_gns.c
@@ -145,17 +145,13 @@ block_plugin_gns_evaluate (void *cls,
145 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 145 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
146 } 146 }
147 block = reply_block; 147 block = reply_block;
148 if (ntohl (block->purpose.size) + sizeof(struct 148 if (GNUNET_GNSRECORD_block_get_size (block) > reply_block_size)
149 GNUNET_CRYPTO_EcdsaSignature)
150 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) !=
151 reply_block_size)
152 { 149 {
153 GNUNET_break_op (0); 150 GNUNET_break_op (0);
154 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 151 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
155 } 152 }
156 GNUNET_CRYPTO_hash (&block->derived_key, 153 GNUNET_GNSRECORD_query_from_block (block,
157 sizeof(block->derived_key), 154 &h);
158 &h);
159 if (0 != GNUNET_memcmp (&h, query)) 155 if (0 != GNUNET_memcmp (&h, query))
160 { 156 {
161 GNUNET_break_op (0); 157 GNUNET_break_op (0);
@@ -206,9 +202,8 @@ block_plugin_gns_get_key (void *cls,
206 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 202 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
207 } 203 }
208 block = reply_block; 204 block = reply_block;
209 GNUNET_CRYPTO_hash (&block->derived_key, 205 GNUNET_GNSRECORD_query_from_block (block,
210 sizeof(block->derived_key), 206 key);
211 key);
212 return GNUNET_OK; 207 return GNUNET_OK;
213} 208}
214 209
diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c
index 81f2b9eff..0bd1d047f 100644
--- a/src/gns/plugin_gnsrecord_gns.c
+++ b/src/gns/plugin_gnsrecord_gns.c
@@ -50,13 +50,16 @@ gns_value_to_string (void *cls,
50 size_t data_size) 50 size_t data_size)
51{ 51{
52 const char *cdata; 52 const char *cdata;
53 struct GNUNET_IDENTITY_PublicKey pk;
53 54
54 switch (type) 55 switch (type)
55 { 56 {
56 case GNUNET_GNSRECORD_TYPE_PKEY: 57 case GNUNET_GNSRECORD_TYPE_PKEY:
57 if (data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) 58 if (data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))
58 return NULL; 59 return NULL;
59 return GNUNET_CRYPTO_ecdsa_public_key_to_string (data); 60 pk.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
61 memcpy (&pk.ecdsa_key, data, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
62 return GNUNET_IDENTITY_public_key_to_string (&pk);
60 63
61 case GNUNET_GNSRECORD_TYPE_NICK: 64 case GNUNET_GNSRECORD_TYPE_NICK:
62 return GNUNET_strndup (data, data_size); 65 return GNUNET_strndup (data, data_size);
@@ -154,6 +157,7 @@ gns_string_to_value (void *cls,
154 size_t *data_size) 157 size_t *data_size)
155{ 158{
156 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 159 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
160 struct GNUNET_IDENTITY_PublicKey pk;
157 161
158 if (NULL == s) 162 if (NULL == s)
159 return GNUNET_SYSERR; 163 return GNUNET_SYSERR;
@@ -161,7 +165,7 @@ gns_string_to_value (void *cls,
161 { 165 {
162 case GNUNET_GNSRECORD_TYPE_PKEY: 166 case GNUNET_GNSRECORD_TYPE_PKEY:
163 if (GNUNET_OK != 167 if (GNUNET_OK !=
164 GNUNET_CRYPTO_ecdsa_public_key_from_string (s, strlen (s), &pkey)) 168 GNUNET_IDENTITY_public_key_from_string (s, &pk))
165 { 169 {
166 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 170 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
167 _ ("Unable to parse PKEY record `%s'\n"), 171 _ ("Unable to parse PKEY record `%s'\n"),
@@ -169,7 +173,7 @@ gns_string_to_value (void *cls,
169 return GNUNET_SYSERR; 173 return GNUNET_SYSERR;
170 } 174 }
171 *data = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); 175 *data = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
172 GNUNET_memcpy (*data, &pkey, sizeof(pkey)); 176 GNUNET_memcpy (*data, &pk.ecdsa_key, sizeof(pkey));
173 *data_size = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey); 177 *data_size = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey);
174 return GNUNET_OK; 178 return GNUNET_OK;
175 179
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index 6ec921f70..2ccb5be2b 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -28,6 +28,7 @@
28#include "gnunet_rest_lib.h" 28#include "gnunet_rest_lib.h"
29#include "gnunet_json_lib.h" 29#include "gnunet_json_lib.h"
30#include "gnunet_gnsrecord_lib.h" 30#include "gnunet_gnsrecord_lib.h"
31#include "gnunet_gnsrecord_json_lib.h"
31#include "gnunet_gns_service.h" 32#include "gnunet_gns_service.h"
32#include "microhttpd.h" 33#include "microhttpd.h"
33#include <jansson.h> 34#include <jansson.h>
@@ -264,7 +265,7 @@ handle_gns_response (void *cls,
264 return; 265 return;
265 } 266 }
266 267
267 result_obj = GNUNET_JSON_from_gnsrecord (handle->name, rd, rd_count); 268 result_obj = GNUNET_GNSRECORD_JSON_from_gnsrecord (handle->name, rd, rd_count);
268 269
269 result = json_dumps (result_obj, 0); 270 result = json_dumps (result_obj, 0);
270 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); 271 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result);
diff --git a/src/gns/test_gns_dht_lookup.sh b/src/gns/test_gns_dht_lookup.sh
index d5516fd03..8d446c507 100755
--- a/src/gns/test_gns_dht_lookup.sh
+++ b/src/gns/test_gns_dht_lookup.sh
@@ -26,6 +26,7 @@ gnunet-arm -i datastore -c test_gns_lookup.conf
26gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf 26gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf
27DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}') 27DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}')
28gnunet-identity -C $MY_EGO -c test_gns_lookup.conf 28gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
29echo "MYEGO: $MY_EGO OTHER_EGO: $DELEGATED_PKEY"
29gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf 30gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
30#This works 31#This works
31gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf 32gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
diff --git a/src/gnsrecord/Makefile.am b/src/gnsrecord/Makefile.am
index 2e6eca7ba..84d218519 100644
--- a/src/gnsrecord/Makefile.am
+++ b/src/gnsrecord/Makefile.am
@@ -30,12 +30,14 @@ TESTS = \
30endif 30endif
31 31
32lib_LTLIBRARIES = \ 32lib_LTLIBRARIES = \
33 libgnunetgnsrecord.la 33 libgnunetgnsrecord.la \
34 libgnunetgnsrecordjson.la
34 35
35gnunet_gnsrecord_tvg_SOURCES = \ 36gnunet_gnsrecord_tvg_SOURCES = \
36 gnunet-gnsrecord-tvg.c 37 gnunet-gnsrecord-tvg.c
37gnunet_gnsrecord_tvg_LDADD = \ 38gnunet_gnsrecord_tvg_LDADD = \
38 $(top_builddir)/src/util/libgnunetutil.la \ 39 $(top_builddir)/src/util/libgnunetutil.la \
40 $(top_builddir)/src/identity/libgnunetidentity.la \
39 libgnunetgnsrecord.la \ 41 libgnunetgnsrecord.la \
40 $(GN_LIBINTL) 42 $(GN_LIBINTL)
41 43
@@ -47,11 +49,26 @@ libgnunetgnsrecord_la_SOURCES = \
47 gnsrecord_misc.c 49 gnsrecord_misc.c
48libgnunetgnsrecord_la_LIBADD = \ 50libgnunetgnsrecord_la_LIBADD = \
49 $(top_builddir)/src/util/libgnunetutil.la \ 51 $(top_builddir)/src/util/libgnunetutil.la \
52 $(top_builddir)/src/identity/libgnunetidentity.la \
53 $(LIBGCRYPT_LIBS) \
50 $(GN_LIBINTL) 54 $(GN_LIBINTL)
55libgnunetgnsrecord_la_DEPENDENCIES = \
56 $(top_builddir)/src/identity/libgnunetidentity.la
51libgnunetgnsrecord_la_LDFLAGS = \ 57libgnunetgnsrecord_la_LDFLAGS = \
52 $(GN_LIB_LDFLAGS) \ 58 $(GN_LIB_LDFLAGS) \
53 -version-info 0:0:0 59 -version-info 0:0:0
54 60
61libgnunetgnsrecordjson_la_SOURCES = \
62 json_gnsrecord.c
63libgnunetgnsrecordjson_la_LIBADD = \
64 $(top_builddir)/src/util/libgnunetutil.la \
65 $(top_builddir)/src/identity/libgnunetidentity.la \
66 libgnunetgnsrecord.la \
67 -ljansson \
68 $(GN_LIBINTL)
69libgnunetgnsrecordjson_la_LDFLAGS = \
70 $(GN_LIB_LDFLAGS) \
71 -version-info 0:0:0
55 72
56plugin_LTLIBRARIES = \ 73plugin_LTLIBRARIES = \
57 libgnunet_plugin_gnsrecord_dns.la 74 libgnunet_plugin_gnsrecord_dns.la
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
index c8919760a..9c551a936 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/gnsrecord/gnsrecord_crypto.c
@@ -37,6 +37,61 @@
37 37
38#define LOG(kind, ...) GNUNET_log_from (kind, "gnsrecord", __VA_ARGS__) 38#define LOG(kind, ...) GNUNET_log_from (kind, "gnsrecord", __VA_ARGS__)
39 39
40ssize_t
41ecdsa_symmetric_decrypt (
42 const void *block,
43 size_t size,
44 const unsigned char *key,
45 const unsigned char *ctr,
46 void *result)
47{
48 gcry_cipher_hd_t handle;
49 int rc;
50
51 GNUNET_assert (0 == gcry_cipher_open (&handle, GCRY_CIPHER_AES256,
52 GCRY_CIPHER_MODE_CTR, 0));
53 rc = gcry_cipher_setkey (handle,
54 key,
55 GNUNET_CRYPTO_AES_KEY_LENGTH);
56 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
57 rc = gcry_cipher_setctr (handle,
58 ctr,
59 GNUNET_CRYPTO_AES_KEY_LENGTH / 2);
60 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
61 GNUNET_assert (0 == gcry_cipher_decrypt (handle, result, size, block, size));
62 gcry_cipher_close (handle);
63 return size;
64}
65
66
67
68ssize_t
69ecdsa_symmetric_encrypt (
70 const void *block,
71 size_t size,
72 const unsigned char *key,
73 const unsigned char *ctr,
74 void *result)
75{
76 gcry_cipher_hd_t handle;
77 int rc;
78
79 GNUNET_assert (0 == gcry_cipher_open (&handle, GCRY_CIPHER_AES256,
80 GCRY_CIPHER_MODE_CTR, 0));
81 rc = gcry_cipher_setkey (handle,
82 key,
83 GNUNET_CRYPTO_AES_KEY_LENGTH);
84 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
85 rc = gcry_cipher_setctr (handle,
86 ctr,
87 GNUNET_CRYPTO_AES_KEY_LENGTH / 2);
88 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
89 GNUNET_assert (0 == gcry_cipher_encrypt (handle, result, size, block, size));
90 gcry_cipher_close (handle);
91 return size;
92}
93
94
40 95
41/** 96/**
42 * Derive session key and iv from label and public key. 97 * Derive session key and iv from label and public key.
@@ -47,25 +102,31 @@
47 * @param pub public key to use for KDF 102 * @param pub public key to use for KDF
48 */ 103 */
49static void 104static void
50derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, 105derive_block_aes_key (unsigned char *ctr,
51 struct GNUNET_CRYPTO_SymmetricSessionKey *skey, 106 unsigned char *key,
52 const char *label, 107 const char *label,
108 uint64_t exp,
53 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub) 109 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
54{ 110{
55 static const char ctx_key[] = "gns-aes-ctx-key"; 111 static const char ctx_key[] = "gns-aes-ctx-key";
56 static const char ctx_iv[] = "gns-aes-ctx-iv"; 112 static const char ctx_iv[] = "gns-aes-ctx-iv";
57 113
58 GNUNET_CRYPTO_kdf (skey, sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey), 114 GNUNET_CRYPTO_kdf (key, GNUNET_CRYPTO_AES_KEY_LENGTH,
59 ctx_key, strlen (ctx_key), 115 ctx_key, strlen (ctx_key),
60 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 116 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
61 label, strlen (label), 117 label, strlen (label),
62 NULL, 0); 118 NULL, 0);
63 GNUNET_CRYPTO_kdf (iv, sizeof(struct 119 memset (ctr, 0, GNUNET_CRYPTO_AES_KEY_LENGTH / 2);
64 GNUNET_CRYPTO_SymmetricInitializationVector), 120 /** 4 byte nonce **/
121 GNUNET_CRYPTO_kdf (ctr, 4,
65 ctx_iv, strlen (ctx_iv), 122 ctx_iv, strlen (ctx_iv),
66 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 123 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
67 label, strlen (label), 124 label, strlen (label),
68 NULL, 0); 125 NULL, 0);
126 /** Expiration time 64 bit. **/
127 memcpy (ctr + 4, &exp, sizeof (exp));
128 /** Set counter part to 1 **/
129 ctr[15] |= 0x01;
69} 130}
70 131
71 132
@@ -81,19 +142,20 @@ derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
81 * @return NULL on error (block too large) 142 * @return NULL on error (block too large)
82 */ 143 */
83static struct GNUNET_GNSRECORD_Block * 144static struct GNUNET_GNSRECORD_Block *
84block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 145block_create_ecdsa (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
85 const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey, 146 const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey,
86 struct GNUNET_TIME_Absolute expire, 147 struct GNUNET_TIME_Absolute expire,
87 const char *label, 148 const char *label,
88 const struct GNUNET_GNSRECORD_Data *rd, 149 const struct GNUNET_GNSRECORD_Data *rd,
89 unsigned int rd_count) 150 unsigned int rd_count)
90{ 151{
91 ssize_t payload_len = GNUNET_GNSRECORD_records_get_size (rd_count, 152 ssize_t payload_len = GNUNET_GNSRECORD_records_get_size (rd_count,
92 rd); 153 rd);
93 struct GNUNET_GNSRECORD_Block *block; 154 struct GNUNET_GNSRECORD_Block *block;
155 struct GNUNET_GNSRECORD_EcdsaBlock *ecblock;
94 struct GNUNET_CRYPTO_EcdsaPrivateKey *dkey; 156 struct GNUNET_CRYPTO_EcdsaPrivateKey *dkey;
95 struct GNUNET_CRYPTO_SymmetricInitializationVector iv; 157 unsigned char ctr[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
96 struct GNUNET_CRYPTO_SymmetricSessionKey skey; 158 unsigned char skey[GNUNET_CRYPTO_AES_KEY_LENGTH];
97 struct GNUNET_GNSRECORD_Data rdc[GNUNET_NZL (rd_count)]; 159 struct GNUNET_GNSRECORD_Data rdc[GNUNET_NZL (rd_count)];
98 uint32_t rd_count_nbo; 160 uint32_t rd_count_nbo;
99 struct GNUNET_TIME_Absolute now; 161 struct GNUNET_TIME_Absolute now;
@@ -140,35 +202,38 @@ block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
140 block = GNUNET_malloc (sizeof(struct GNUNET_GNSRECORD_Block) 202 block = GNUNET_malloc (sizeof(struct GNUNET_GNSRECORD_Block)
141 + sizeof(uint32_t) 203 + sizeof(uint32_t)
142 + payload_len); 204 + payload_len);
143 block->purpose.size = htonl (sizeof(uint32_t) 205 ecblock = &block->ecdsa_block;
144 + payload_len 206 block->type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
145 + sizeof(struct 207 ecblock->purpose.size = htonl (sizeof(uint32_t)
146 GNUNET_CRYPTO_EccSignaturePurpose) 208 + payload_len
147 + sizeof(struct GNUNET_TIME_AbsoluteNBO)); 209 + sizeof(struct
148 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); 210 GNUNET_CRYPTO_EccSignaturePurpose)
149 block->expiration_time = GNUNET_TIME_absolute_hton (expire); 211 + sizeof(struct GNUNET_TIME_AbsoluteNBO));
212 ecblock->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
213 ecblock->expiration_time = GNUNET_TIME_absolute_hton (expire);
150 /* encrypt and sign */ 214 /* encrypt and sign */
151 dkey = GNUNET_CRYPTO_ecdsa_private_key_derive (key, 215 dkey = GNUNET_CRYPTO_ecdsa_private_key_derive (key,
152 label, 216 label,
153 "gns"); 217 "gns");
154 GNUNET_CRYPTO_ecdsa_key_get_public (dkey, 218 GNUNET_CRYPTO_ecdsa_key_get_public (dkey,
155 &block->derived_key); 219 &ecblock->derived_key);
156 derive_block_aes_key (&iv, 220 derive_block_aes_key (ctr,
157 &skey, 221 skey,
158 label, 222 label,
223 ecblock->expiration_time.abs_value_us__,
159 pkey); 224 pkey);
160 GNUNET_break (payload_len + sizeof(uint32_t) == 225 GNUNET_break (payload_len + sizeof(uint32_t) ==
161 GNUNET_CRYPTO_symmetric_encrypt (payload, 226 ecdsa_symmetric_encrypt (payload,
162 payload_len 227 payload_len
163 + sizeof(uint32_t), 228 + sizeof(uint32_t),
164 &skey, 229 skey,
165 &iv, 230 ctr,
166 &block[1])); 231 &ecblock[1]));
167 } 232 }
168 if (GNUNET_OK != 233 if (GNUNET_OK !=
169 GNUNET_CRYPTO_ecdsa_sign_ (dkey, 234 GNUNET_CRYPTO_ecdsa_sign_ (dkey,
170 &block->purpose, 235 &ecblock->purpose,
171 &block->signature)) 236 &ecblock->signature))
172 { 237 {
173 GNUNET_break (0); 238 GNUNET_break (0);
174 GNUNET_free (dkey); 239 GNUNET_free (dkey);
@@ -191,7 +256,7 @@ block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
191 * @return NULL on error (block too large) 256 * @return NULL on error (block too large)
192 */ 257 */
193struct GNUNET_GNSRECORD_Block * 258struct GNUNET_GNSRECORD_Block *
194GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 259GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key,
195 struct GNUNET_TIME_Absolute expire, 260 struct GNUNET_TIME_Absolute expire,
196 const char *label, 261 const char *label,
197 const struct GNUNET_GNSRECORD_Data *rd, 262 const struct GNUNET_GNSRECORD_Data *rd,
@@ -199,14 +264,21 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
199{ 264{
200 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 265 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
201 266
202 GNUNET_CRYPTO_ecdsa_key_get_public (key, 267 switch (ntohl (key->type))
203 &pkey); 268 {
204 return block_create (key, 269 case GNUNET_GNSRECORD_TYPE_PKEY:
205 &pkey, 270 GNUNET_CRYPTO_ecdsa_key_get_public (&key->ecdsa_key,
206 expire, 271 &pkey);
207 label, 272 return block_create_ecdsa (&key->ecdsa_key,
208 rd, 273 &pkey,
209 rd_count); 274 expire,
275 label,
276 rd,
277 rd_count);
278 default:
279 GNUNET_assert (0);
280 }
281 return NULL;
210} 282}
211 283
212 284
@@ -240,12 +312,19 @@ struct KeyCacheLine
240 * @return NULL on error (block too large) 312 * @return NULL on error (block too large)
241 */ 313 */
242struct GNUNET_GNSRECORD_Block * 314struct GNUNET_GNSRECORD_Block *
243GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 315GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
244 struct GNUNET_TIME_Absolute expire, 316 struct GNUNET_TIME_Absolute expire,
245 const char *label, 317 const char *label,
246 const struct GNUNET_GNSRECORD_Data *rd, 318 const struct GNUNET_GNSRECORD_Data *rd,
247 unsigned int rd_count) 319 unsigned int rd_count)
248{ 320{
321 const struct GNUNET_CRYPTO_EcdsaPrivateKey *key;
322
323 if (GNUNET_IDENTITY_TYPE_ECDSA != ntohl (pkey->type))
324 {
325 return NULL; // FIXME
326 }
327 key = &pkey->ecdsa_key;
249#define CSIZE 64 328#define CSIZE 64
250 static struct KeyCacheLine cache[CSIZE]; 329 static struct KeyCacheLine cache[CSIZE];
251 struct KeyCacheLine *line; 330 struct KeyCacheLine *line;
@@ -261,12 +340,12 @@ GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
261 &line->pkey); 340 &line->pkey);
262 } 341 }
263#undef CSIZE 342#undef CSIZE
264 return block_create (key, 343 return block_create_ecdsa (key,
265 &line->pkey, 344 &line->pkey,
266 expire, 345 expire,
267 label, 346 label,
268 rd, 347 rd,
269 rd_count); 348 rd_count);
270} 349}
271 350
272 351
@@ -277,40 +356,40 @@ GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
277 * @param block block to verify 356 * @param block block to verify
278 * @return #GNUNET_OK if the signature is valid 357 * @return #GNUNET_OK if the signature is valid
279 */ 358 */
280int 359enum GNUNET_GenericReturnValue
281GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block) 360GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block)
282{ 361{
362 const struct GNUNET_CRYPTO_EcdsaPublicKey *key;
363 const struct GNUNET_GNSRECORD_EcdsaBlock *ecblock;
364
365 if (GNUNET_GNSRECORD_TYPE_PKEY != ntohl (block->type))
366 {
367 GNUNET_break (0);
368 return GNUNET_NO;
369 }
370 ecblock = &block->ecdsa_block;
371 key = &ecblock->derived_key;
372
283 return GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, 373 return GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN,
284 &block->purpose, 374 &ecblock->purpose,
285 &block->signature, 375 &ecblock->signature,
286 &block->derived_key); 376 key);
287} 377}
288 378
289 379
290/** 380enum GNUNET_GenericReturnValue
291 * Decrypt block. 381block_decrypt_ecdsa (const struct GNUNET_GNSRECORD_EcdsaBlock *block,
292 * 382 const struct
293 * @param block block to decrypt 383 GNUNET_CRYPTO_EcdsaPublicKey *zone_key,
294 * @param zone_key public key of the zone 384 const char *label,
295 * @param label the name for the records 385 GNUNET_GNSRECORD_RecordCallback proc,
296 * @param proc function to call with the result 386 void *proc_cls)
297 * @param proc_cls closure for proc
298 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was
299 * not well-formed
300 */
301int
302GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
303 const struct
304 GNUNET_CRYPTO_EcdsaPublicKey *zone_key,
305 const char *label,
306 GNUNET_GNSRECORD_RecordCallback proc,
307 void *proc_cls)
308{ 387{
309 size_t payload_len = ntohl (block->purpose.size) 388 size_t payload_len = ntohl (block->purpose.size)
310 - sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) 389 - sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
311 - sizeof(struct GNUNET_TIME_AbsoluteNBO); 390 - sizeof(struct GNUNET_TIME_AbsoluteNBO);
312 struct GNUNET_CRYPTO_SymmetricInitializationVector iv; 391 unsigned char ctr[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
313 struct GNUNET_CRYPTO_SymmetricSessionKey skey; 392 unsigned char key[GNUNET_CRYPTO_AES_KEY_LENGTH];
314 393
315 if (ntohl (block->purpose.size) < 394 if (ntohl (block->purpose.size) <
316 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) 395 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
@@ -319,18 +398,19 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
319 GNUNET_break_op (0); 398 GNUNET_break_op (0);
320 return GNUNET_SYSERR; 399 return GNUNET_SYSERR;
321 } 400 }
322 derive_block_aes_key (&iv, 401 derive_block_aes_key (ctr,
323 &skey, 402 key,
324 label, 403 label,
404 block->expiration_time.abs_value_us__,
325 zone_key); 405 zone_key);
326 { 406 {
327 char payload[payload_len]; 407 char payload[payload_len];
328 uint32_t rd_count; 408 uint32_t rd_count;
329 409
330 GNUNET_break (payload_len == 410 GNUNET_break (payload_len ==
331 GNUNET_CRYPTO_symmetric_decrypt (&block[1], payload_len, 411 ecdsa_symmetric_decrypt (&block[1], payload_len,
332 &skey, &iv, 412 key, ctr,
333 payload)); 413 payload));
334 GNUNET_memcpy (&rd_count, 414 GNUNET_memcpy (&rd_count,
335 payload, 415 payload,
336 sizeof(uint32_t)); 416 sizeof(uint32_t));
@@ -426,6 +506,39 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
426 506
427 507
428/** 508/**
509 * Decrypt block.
510 *
511 * @param block block to decrypt
512 * @param zone_key public key of the zone
513 * @param label the name for the records
514 * @param proc function to call with the result
515 * @param proc_cls closure for proc
516 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was
517 * not well-formed
518 */
519enum GNUNET_GenericReturnValue
520GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
521 const struct
522 GNUNET_IDENTITY_PublicKey *zone_key,
523 const char *label,
524 GNUNET_GNSRECORD_RecordCallback proc,
525 void *proc_cls)
526{
527 const struct GNUNET_CRYPTO_EcdsaPublicKey *key;
528
529 if (GNUNET_IDENTITY_TYPE_ECDSA != ntohl (zone_key->type))
530 {
531 return GNUNET_NO;
532 }
533 key = &zone_key->ecdsa_key;
534
535 return block_decrypt_ecdsa (&block->ecdsa_block,
536 key, label, proc, proc_cls);
537
538}
539
540
541/**
429 * Calculate the DHT query for a given @a label in a given @a zone. 542 * Calculate the DHT query for a given @a label in a given @a zone.
430 * 543 *
431 * @param zone private key of the zone 544 * @param zone private key of the zone
@@ -434,17 +547,24 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
434 */ 547 */
435void 548void
436GNUNET_GNSRECORD_query_from_private_key (const struct 549GNUNET_GNSRECORD_query_from_private_key (const struct
437 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 550 GNUNET_IDENTITY_PrivateKey *zone,
438 const char *label, 551 const char *label,
439 struct GNUNET_HashCode *query) 552 struct GNUNET_HashCode *query)
440{ 553{
441 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 554 struct GNUNET_IDENTITY_PublicKey pub;
442 555 switch (ntohl (zone->type))
443 GNUNET_CRYPTO_ecdsa_key_get_public (zone, 556 {
444 &pub); 557 case GNUNET_GNSRECORD_TYPE_PKEY:
445 GNUNET_GNSRECORD_query_from_public_key (&pub, 558
446 label, 559 GNUNET_IDENTITY_key_get_public (zone,
447 query); 560 &pub);
561 GNUNET_GNSRECORD_query_from_public_key (&pub,
562 label,
563 query);
564 break;
565 default:
566 GNUNET_assert (0);
567 }
448} 568}
449 569
450 570
@@ -457,18 +577,27 @@ GNUNET_GNSRECORD_query_from_private_key (const struct
457 */ 577 */
458void 578void
459GNUNET_GNSRECORD_query_from_public_key (const struct 579GNUNET_GNSRECORD_query_from_public_key (const struct
460 GNUNET_CRYPTO_EcdsaPublicKey *pub, 580 GNUNET_IDENTITY_PublicKey *pub,
461 const char *label, 581 const char *label,
462 struct GNUNET_HashCode *query) 582 struct GNUNET_HashCode *query)
463{ 583{
464 struct GNUNET_CRYPTO_EcdsaPublicKey pd; 584 struct GNUNET_IDENTITY_PublicKey pd;
465 GNUNET_CRYPTO_ecdsa_public_key_derive (pub, 585
466 label, 586 switch (ntohl (pub->type))
467 "gns", 587 {
468 &pd); 588 case GNUNET_GNSRECORD_TYPE_PKEY:
469 GNUNET_CRYPTO_hash (&pd, 589 pd.type = pub->type;
470 sizeof(pd), 590 GNUNET_CRYPTO_ecdsa_public_key_derive (&pub->ecdsa_key,
471 query); 591 label,
592 "gns",
593 &pd.ecdsa_key);
594 GNUNET_CRYPTO_hash (&pd.ecdsa_key,
595 sizeof (pd.ecdsa_key),
596 query);
597 break;
598 default:
599 GNUNET_assert (0);
600 }
472} 601}
473 602
474 603
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 5061f8493..4b1695d69 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -62,14 +62,14 @@ GNUNET_GNSRECORD_string_to_lowercase (const char *src)
62 * @return string form; will be overwritten by next call to #GNUNET_GNSRECORD_z2s 62 * @return string form; will be overwritten by next call to #GNUNET_GNSRECORD_z2s
63 */ 63 */
64const char * 64const char *
65GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z) 65GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z)
66{ 66{
67 static char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) * 8]; 67 static char buf[sizeof(struct GNUNET_IDENTITY_PublicKey) * 8];
68 char *end; 68 char *end;
69 69
70 end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, 70 end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z,
71 sizeof(struct 71 sizeof(struct
72 GNUNET_CRYPTO_EcdsaPublicKey), 72 GNUNET_IDENTITY_PublicKey),
73 buf, sizeof(buf)); 73 buf, sizeof(buf));
74 if (NULL == end) 74 if (NULL == end)
75 { 75 {
@@ -99,7 +99,7 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a,
99 if (a->record_type != b->record_type) 99 if (a->record_type != b->record_type)
100 { 100 {
101 LOG (GNUNET_ERROR_TYPE_DEBUG, 101 LOG (GNUNET_ERROR_TYPE_DEBUG,
102 "Record type %lu != %lu\n", a->record_type, b->record_type); 102 "Record type %u != %u\n", a->record_type, b->record_type);
103 return GNUNET_NO; 103 return GNUNET_NO;
104 } 104 }
105 if ((a->expiration_time != b->expiration_time) && 105 if ((a->expiration_time != b->expiration_time) &&
@@ -115,7 +115,7 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a,
115 != (b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS)) 115 != (b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS))
116 { 116 {
117 LOG (GNUNET_ERROR_TYPE_DEBUG, 117 LOG (GNUNET_ERROR_TYPE_DEBUG,
118 "Flags %lu (%lu) != %lu (%lu)\n", a->flags, 118 "Flags %u (%u) != %u (%u)\n", a->flags,
119 a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS, b->flags, 119 a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS, b->flags,
120 b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS); 120 b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS);
121 return GNUNET_NO; 121 return GNUNET_NO;
@@ -236,12 +236,12 @@ GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd)
236 * key in an encoding suitable for DNS labels. 236 * key in an encoding suitable for DNS labels.
237 */ 237 */
238const char * 238const char *
239GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) 239GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_PublicKey *pkey)
240{ 240{
241 static char ret[128]; 241 static char ret[128];
242 char *pkeys; 242 char *pkeys;
243 243
244 pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey); 244 pkeys = GNUNET_IDENTITY_public_key_to_string (pkey);
245 GNUNET_snprintf (ret, 245 GNUNET_snprintf (ret,
246 sizeof(ret), 246 sizeof(ret),
247 "%s", 247 "%s",
@@ -262,15 +262,88 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
262 */ 262 */
263int 263int
264GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, 264GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
265 struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) 265 struct GNUNET_IDENTITY_PublicKey *pkey)
266{ 266{
267 if (GNUNET_OK != 267 if (GNUNET_OK !=
268 GNUNET_CRYPTO_ecdsa_public_key_from_string (zkey, 268 GNUNET_IDENTITY_public_key_from_string (zkey,
269 strlen (zkey), 269 pkey))
270 pkey))
271 return GNUNET_SYSERR; 270 return GNUNET_SYSERR;
272 return GNUNET_OK; 271 return GNUNET_OK;
273} 272}
274 273
275 274
275size_t
276GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block)
277{
278 switch (ntohl (block->type))
279 {
280 case GNUNET_GNSRECORD_TYPE_PKEY:
281 return sizeof (uint32_t) /* zone type */
282 + sizeof (block->ecdsa_block) /* EcdsaBlock */
283 + ntohl (block->ecdsa_block.purpose.size) /* Length of signed data */
284 - sizeof (block->ecdsa_block.purpose); /* Purpose already in EcdsaBlock */
285 break;
286 default:
287 return 0;
288 }
289 return 0;
290}
291
292
293struct GNUNET_TIME_Absolute
294GNUNET_GNSRECORD_block_get_expiration (const struct
295 GNUNET_GNSRECORD_Block *block)
296{
297
298 switch (ntohl (block->type))
299 {
300 case GNUNET_GNSRECORD_TYPE_PKEY:
301 return GNUNET_TIME_absolute_ntoh (block->ecdsa_block.expiration_time);
302 default:
303 return GNUNET_TIME_absolute_get_zero_ ();
304 }
305 return GNUNET_TIME_absolute_get_zero_ ();
306
307}
308
309
310enum GNUNET_GenericReturnValue
311GNUNET_GNSRECORD_query_from_block (const struct GNUNET_GNSRECORD_Block *block,
312 struct GNUNET_HashCode *query)
313{
314 switch (ntohl (block->type))
315 {
316 case GNUNET_GNSRECORD_TYPE_PKEY:
317 GNUNET_CRYPTO_hash (&block->ecdsa_block.derived_key,
318 sizeof (block->ecdsa_block.derived_key),
319 query);
320 return GNUNET_OK;
321 default:
322 return GNUNET_SYSERR;
323 }
324 return GNUNET_SYSERR;
325
326}
327
328enum GNUNET_GenericReturnValue
329GNUNET_GNSRECORD_record_to_identity_key (const struct GNUNET_GNSRECORD_Data *rd,
330 struct GNUNET_IDENTITY_PublicKey *key)
331{
332 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
333 "Got record of type %u\n",
334 rd->record_type);
335 switch (rd->record_type)
336 {
337 case GNUNET_GNSRECORD_TYPE_PKEY:
338 key->type = htonl (rd->record_type);
339 memcpy (&key->ecdsa_key, rd->data, sizeof (key->ecdsa_key));
340 return GNUNET_OK;
341 default:
342 return GNUNET_SYSERR;
343 }
344 return GNUNET_SYSERR;
345
346
347}
348
276/* end of gnsrecord_misc.c */ 349/* end of gnsrecord_misc.c */
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c
index 789ff8aa3..6e6f6414c 100644
--- a/src/gnsrecord/gnunet-gnsrecord-tvg.c
+++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c
@@ -90,28 +90,30 @@ run (void *cls,
90 struct GNUNET_TIME_Absolute exp_abs = GNUNET_TIME_absolute_get (); 90 struct GNUNET_TIME_Absolute exp_abs = GNUNET_TIME_absolute_get ();
91 struct GNUNET_GNSRECORD_Block *rrblock; 91 struct GNUNET_GNSRECORD_Block *rrblock;
92 char *bdata; 92 char *bdata;
93 struct GNUNET_CRYPTO_EcdsaPrivateKey id_priv; 93 struct GNUNET_IDENTITY_PrivateKey id_priv;
94 struct GNUNET_CRYPTO_EcdsaPublicKey id_pub; 94 struct GNUNET_IDENTITY_PublicKey id_pub;
95 struct GNUNET_CRYPTO_EcdsaPrivateKey pkey_data_p; 95 struct GNUNET_IDENTITY_PrivateKey pkey_data_p;
96 struct GNUNET_CRYPTO_EcdsaPublicKey pkey_data; 96 struct GNUNET_IDENTITY_PublicKey pkey_data;
97 void *data; 97 void *data;
98 size_t data_size; 98 size_t data_size;
99 char *rdata; 99 char *rdata;
100 size_t rdata_size; 100 size_t rdata_size;
101 101
102 GNUNET_CRYPTO_ecdsa_key_create (&id_priv); 102 id_priv.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
103 GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv, 103 GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key);
104 &id_pub); 104 GNUNET_IDENTITY_key_get_public (&id_priv,
105 &id_pub);
105 fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); 106 fprintf (stdout, "Zone private key (d, little-endian scalar):\n");
106 print_bytes (&id_priv, sizeof(id_priv), 0); 107 print_bytes (&id_priv, GNUNET_IDENTITY_key_get_length (&id_pub), 0); //FIXME length for privkey?
107 fprintf (stdout, "\n"); 108 fprintf (stdout, "\n");
108 fprintf (stdout, "Zone public key (zk):\n"); 109 fprintf (stdout, "Zone public key (zk):\n");
109 print_bytes (&id_pub, sizeof(id_pub), 0); 110 print_bytes (&id_pub, GNUNET_IDENTITY_key_get_length (&id_pub), 0);
110 fprintf (stdout, "\n"); 111 fprintf (stdout, "\n");
111 112
112 GNUNET_CRYPTO_ecdsa_key_create (&pkey_data_p); 113 pkey_data_p.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
113 GNUNET_CRYPTO_ecdsa_key_get_public (&pkey_data_p, 114 GNUNET_CRYPTO_ecdsa_key_create (&pkey_data_p.ecdsa_key);
114 &pkey_data); 115 GNUNET_IDENTITY_key_get_public (&pkey_data_p,
116 &pkey_data);
115 fprintf (stdout, 117 fprintf (stdout,
116 "Label: %s\nRRCOUNT: %d\n\n", TEST_RECORD_LABEL, TEST_RRCOUNT); 118 "Label: %s\nRRCOUNT: %d\n\n", TEST_RECORD_LABEL, TEST_RRCOUNT);
117 memset (rd, 0, sizeof (struct GNUNET_GNSRECORD_Data) * 2); 119 memset (rd, 0, sizeof (struct GNUNET_GNSRECORD_Data) * 2);
@@ -147,19 +149,20 @@ run (void *cls,
147 TEST_RECORD_LABEL, 149 TEST_RECORD_LABEL,
148 rd, 150 rd,
149 TEST_RRCOUNT); 151 TEST_RRCOUNT);
150 size_t bdata_size = ntohl (rrblock->purpose.size) 152 size_t bdata_size = ntohl (rrblock->ecdsa_block.purpose.size)
151 - sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) 153 - sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
152 - sizeof(struct GNUNET_TIME_AbsoluteNBO); 154 - sizeof(struct GNUNET_TIME_AbsoluteNBO);
153 size_t rrblock_size = ntohl (rrblock->purpose.size) 155 size_t ecblock_size = ntohl (rrblock->ecdsa_block.purpose.size)
154 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) 156 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
155 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature); 157 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature);
158 size_t block_size = ecblock_size + sizeof (uint32_t);
156 159
157 bdata = (char*) &rrblock[1]; 160 bdata = (char*) &(&rrblock->ecdsa_block)[1];
158 fprintf (stdout, "BDATA:\n"); 161 fprintf (stdout, "BDATA:\n");
159 print_bytes (bdata, bdata_size, 8); 162 print_bytes (bdata, bdata_size, 8);
160 fprintf (stdout, "\n"); 163 fprintf (stdout, "\n");
161 fprintf (stdout, "RRBLOCK:\n"); 164 fprintf (stdout, "RRBLOCK:\n");
162 print_bytes (rrblock, rrblock_size, 8); 165 print_bytes (rrblock, block_size, 8);
163 fprintf (stdout, "\n"); 166 fprintf (stdout, "\n");
164 167
165} 168}
diff --git a/src/json/json_gnsrecord.c b/src/gnsrecord/json_gnsrecord.c
index 7e11aba94..068ff48c1 100644
--- a/src/json/json_gnsrecord.c
+++ b/src/gnsrecord/json_gnsrecord.c
@@ -26,6 +26,7 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_json_lib.h" 28#include "gnunet_json_lib.h"
29#include "gnunet_gnsrecord_lib.h"
29 30
30#define GNUNET_JSON_GNSRECORD_VALUE "value" 31#define GNUNET_JSON_GNSRECORD_VALUE "value"
31#define GNUNET_JSON_GNSRECORD_RECORD_DATA "data" 32#define GNUNET_JSON_GNSRECORD_RECORD_DATA "data"
@@ -258,7 +259,7 @@ clean_gnsrecordobject (void *cls, struct GNUNET_JSON_Specification *spec)
258 * @return JSON Specification 259 * @return JSON Specification
259 */ 260 */
260struct GNUNET_JSON_Specification 261struct GNUNET_JSON_Specification
261GNUNET_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd, 262GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd,
262 unsigned int *rd_count, 263 unsigned int *rd_count,
263 char **name) 264 char **name)
264{ 265{
@@ -277,3 +278,114 @@ GNUNET_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd,
277 .size_ptr = NULL }; 278 .size_ptr = NULL };
278 return ret; 279 return ret;
279} 280}
281
282
283/**
284 * Convert GNS record to JSON.
285 *
286 * @param rname name of record
287 * @param rd record data
288 * @return corresponding JSON encoding
289 */
290json_t *
291GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname,
292 const struct GNUNET_GNSRECORD_Data *rd,
293 unsigned int rd_count)
294{
295 struct GNUNET_TIME_Absolute abs_exp;
296 struct GNUNET_TIME_Relative rel_exp;
297 const char *expiration_time_str;
298 const char *record_type_str;
299 char *value_str;
300 json_t *data;
301 json_t *record;
302 json_t *records;
303
304 data = json_object ();
305 if (NULL == data)
306 {
307 GNUNET_break (0);
308 return NULL;
309 }
310 if (0 !=
311 json_object_set_new (data,
312 "record_name",
313 json_string (rname)))
314 {
315 GNUNET_break (0);
316 json_decref (data);
317 return NULL;
318 }
319 records = json_array ();
320 if (NULL == records)
321 {
322 GNUNET_break (0);
323 json_decref (data);
324 return NULL;
325 }
326 for (int i = 0; i < rd_count; i++)
327 {
328 value_str = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
329 rd[i].data,
330 rd[i].data_size);
331 if (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION & rd[i].flags)
332 {
333 rel_exp.rel_value_us = rd[i].expiration_time;
334 expiration_time_str = GNUNET_STRINGS_relative_time_to_string (rel_exp,
335 GNUNET_NO);
336 }
337 else
338 {
339 abs_exp.abs_value_us = rd[i].expiration_time;
340 expiration_time_str = GNUNET_STRINGS_absolute_time_to_string (abs_exp);
341 }
342 record_type_str = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
343 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
344 "Packing %s %s %s %d\n",
345 value_str, record_type_str, expiration_time_str, rd[i].flags);
346 record = json_pack ("{s:s,s:s,s:s,s:b,s:b,s:b,s:b}",
347 "value",
348 value_str,
349 "record_type",
350 record_type_str,
351 "expiration_time",
352 expiration_time_str,
353 "private",
354 rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE,
355 "relative_expiration",
356 rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION,
357 "supplemental",
358 rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL,
359 "shadow",
360 rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD);
361 GNUNET_free (value_str);
362 if (NULL == record)
363 {
364 GNUNET_break (0);
365 json_decref (records);
366 json_decref (data);
367 return NULL;
368 }
369 if (0 !=
370 json_array_append_new (records,
371 record))
372 {
373 GNUNET_break (0);
374 json_decref (records);
375 json_decref (data);
376 return NULL;
377 }
378 }
379 if (0 !=
380 json_object_set_new (data,
381 "data",
382 records))
383 {
384 GNUNET_break (0);
385 json_decref (data);
386 return NULL;
387 }
388 return data;
389}
390
391
diff --git a/src/gnsrecord/perf_gnsrecord_crypto.c b/src/gnsrecord/perf_gnsrecord_crypto.c
index eb4633f75..d9a3c20cf 100644
--- a/src/gnsrecord/perf_gnsrecord_crypto.c
+++ b/src/gnsrecord/perf_gnsrecord_crypto.c
@@ -73,7 +73,7 @@ run (void *cls,
73 struct GNUNET_GNSRECORD_Data *s_rd; 73 struct GNUNET_GNSRECORD_Data *s_rd;
74 const char *s_name; 74 const char *s_name;
75 struct GNUNET_TIME_Absolute start_time; 75 struct GNUNET_TIME_Absolute start_time;
76 struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 76 struct GNUNET_IDENTITY_PrivateKey privkey;
77 struct GNUNET_TIME_Absolute expire; 77 struct GNUNET_TIME_Absolute expire;
78 78
79 (void) cls; 79 (void) cls;
@@ -81,7 +81,8 @@ run (void *cls,
81 (void) cfgfile; 81 (void) cfgfile;
82 (void) cfg; 82 (void) cfg;
83 expire = GNUNET_TIME_absolute_get (); 83 expire = GNUNET_TIME_absolute_get ();
84 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 84 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
85 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
85 86
86 /* test block creation */ 87 /* test block creation */
87 s_name = "DUMMY.dummy.gnunet"; 88 s_name = "DUMMY.dummy.gnunet";
diff --git a/src/gnsrecord/plugin_gnsrecord_dns.c b/src/gnsrecord/plugin_gnsrecord_dns.c
index 9ac6fb9e6..bde9944e2 100644
--- a/src/gnsrecord/plugin_gnsrecord_dns.c
+++ b/src/gnsrecord/plugin_gnsrecord_dns.c
@@ -100,7 +100,7 @@ dns_value_to_string (void *cls,
100 return NULL; 100 return NULL;
101 } 101 }
102 GNUNET_asprintf (&result, 102 GNUNET_asprintf (&result,
103 "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu", 103 "rname=%s mname=%s %u,%u,%u,%u,%u",
104 soa->rname, 104 soa->rname,
105 soa->mname, 105 soa->mname,
106 soa->serial, 106 soa->serial,
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c b/src/gnsrecord/test_gnsrecord_crypto.c
index b67e9a123..d541f3076 100644
--- a/src/gnsrecord/test_gnsrecord_crypto.c
+++ b/src/gnsrecord/test_gnsrecord_crypto.c
@@ -100,17 +100,18 @@ run (void *cls,
100 const struct GNUNET_CONFIGURATION_Handle *cfg) 100 const struct GNUNET_CONFIGURATION_Handle *cfg)
101{ 101{
102 struct GNUNET_GNSRECORD_Block *block; 102 struct GNUNET_GNSRECORD_Block *block;
103 struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 103 struct GNUNET_IDENTITY_PublicKey pubkey;
104 struct GNUNET_HashCode query_pub; 104 struct GNUNET_HashCode query_pub;
105 struct GNUNET_HashCode query_priv; 105 struct GNUNET_HashCode query_priv;
106 struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get (); 106 struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get ();
107 struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 107 struct GNUNET_IDENTITY_PrivateKey privkey;
108 108
109 109
110 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 110 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
111 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
111 /* get public key */ 112 /* get public key */
112 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 113 GNUNET_IDENTITY_key_get_public (&privkey,
113 &pubkey); 114 &pubkey);
114 115
115 /* test query derivation */ 116 /* test query derivation */
116 GNUNET_GNSRECORD_query_from_private_key (&privkey, 117 GNUNET_GNSRECORD_query_from_private_key (&privkey,
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index d0f5546f3..a01cd1ed7 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -66,6 +66,11 @@ static unsigned int verbose;
66static int quiet; 66static int quiet;
67 67
68/** 68/**
69 * Was "eddsa" specified?
70 */
71static int type_eddsa;
72
73/**
69 * -C option 74 * -C option
70 */ 75 */
71static char *create_ego; 76static char *create_ego;
@@ -108,7 +113,7 @@ static struct GNUNET_IDENTITY_Operation *delete_op;
108/** 113/**
109 * Private key from command line option, or NULL. 114 * Private key from command line option, or NULL.
110 */ 115 */
111struct GNUNET_CRYPTO_EcdsaPrivateKey pk; 116struct GNUNET_IDENTITY_PrivateKey pk;
112 117
113/** 118/**
114 * Value to return from #main(). 119 * Value to return from #main().
@@ -197,7 +202,7 @@ delete_finished (void *cls,
197 */ 202 */
198static void 203static void
199create_finished (void *cls, 204create_finished (void *cls,
200 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 205 const struct GNUNET_IDENTITY_PrivateKey *pk,
201 const char *emsg) 206 const char *emsg)
202{ 207{
203 struct GNUNET_IDENTITY_Operation **op = cls; 208 struct GNUNET_IDENTITY_Operation **op = cls;
@@ -212,16 +217,16 @@ create_finished (void *cls,
212 } 217 }
213 else if (verbose) 218 else if (verbose)
214 { 219 {
215 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 220 struct GNUNET_IDENTITY_PublicKey pub;
216 char *pubs; 221 char *pubs;
217 222
218 GNUNET_CRYPTO_ecdsa_key_get_public (pk, &pub); 223 GNUNET_IDENTITY_key_get_public (pk, &pub);
219 pubs = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pub); 224 pubs = GNUNET_IDENTITY_public_key_to_string (&pub);
220 if (private_keys) 225 if (private_keys)
221 { 226 {
222 char *privs; 227 char *privs;
223 228
224 privs = GNUNET_CRYPTO_ecdsa_private_key_to_string (pk); 229 privs = GNUNET_IDENTITY_private_key_to_string (pk);
225 fprintf (stdout, "%s - %s\n", pubs, privs); 230 fprintf (stdout, "%s - %s\n", pubs, privs);
226 GNUNET_free (privs); 231 GNUNET_free (privs);
227 } 232 }
@@ -293,7 +298,7 @@ print_ego (void *cls,
293 void **ctx, 298 void **ctx,
294 const char *identifier) 299 const char *identifier)
295{ 300{
296 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 301 struct GNUNET_IDENTITY_PublicKey pk;
297 char *s; 302 char *s;
298 char *privs; 303 char *privs;
299 304
@@ -342,8 +347,8 @@ print_ego (void *cls,
342 set_ego)) ) 347 set_ego)) )
343 return; 348 return;
344 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 349 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
345 s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 350 s = GNUNET_IDENTITY_public_key_to_string (&pk);
346 privs = GNUNET_CRYPTO_ecdsa_private_key_to_string ( 351 privs = GNUNET_IDENTITY_private_key_to_string (
347 GNUNET_IDENTITY_ego_get_private_key (ego)); 352 GNUNET_IDENTITY_ego_get_private_key (ego));
348 if ((monitor) || (NULL != identifier)) 353 if ((monitor) || (NULL != identifier))
349 { 354 {
@@ -357,9 +362,16 @@ print_ego (void *cls,
357 else 362 else
358 { 363 {
359 if (private_keys) 364 if (private_keys)
360 fprintf (stdout, "%s - %s - %s\n", identifier, s, privs); 365 fprintf (stdout, "%s - %s - %s - %s\n",
366 identifier, s, privs,
367 (ntohl (pk.type) == GNUNET_IDENTITY_TYPE_ECDSA) ?
368 "ECDSA" : "EdDSA");
361 else 369 else
362 fprintf (stdout, "%s - %s\n", identifier, s); 370 fprintf (stdout, "%s - %s - %s\n",
371 identifier, s,
372 (ntohl (pk.type) == GNUNET_IDENTITY_TYPE_ECDSA) ?
373 "ECDSA" : "EdDSA");
374
363 } 375 }
364 } 376 }
365 GNUNET_free (privs); 377 GNUNET_free (privs);
@@ -407,11 +419,12 @@ run (void *cls,
407 strlen (privkey_ego), 419 strlen (privkey_ego),
408 &pk, 420 &pk,
409 sizeof(struct 421 sizeof(struct
410 GNUNET_CRYPTO_EcdsaPrivateKey)); 422 GNUNET_IDENTITY_PrivateKey));
411 create_op = 423 create_op =
412 GNUNET_IDENTITY_create (sh, 424 GNUNET_IDENTITY_create (sh,
413 create_ego, 425 create_ego,
414 &pk, 426 &pk,
427 0, // Ignored
415 &create_finished, 428 &create_finished,
416 &create_op); 429 &create_op);
417 } 430 }
@@ -420,6 +433,9 @@ run (void *cls,
420 GNUNET_IDENTITY_create (sh, 433 GNUNET_IDENTITY_create (sh,
421 create_ego, 434 create_ego,
422 NULL, 435 NULL,
436 (type_eddsa) ?
437 GNUNET_IDENTITY_TYPE_EDDSA :
438 GNUNET_IDENTITY_TYPE_ECDSA,
423 &create_finished, 439 &create_finished,
424 &create_op); 440 &create_op);
425 } 441 }
@@ -456,6 +472,11 @@ main (int argc, char *const *argv)
456 gettext_noop ( 472 gettext_noop (
457 "set the private key for the identity to PRIVATE_KEY (use together with -C)"), 473 "set the private key for the identity to PRIVATE_KEY (use together with -C)"),
458 &privkey_ego), 474 &privkey_ego),
475 GNUNET_GETOPT_option_flag ('X',
476 "eddsa",
477 gettext_noop (
478 "generate an EdDSA identity. (use together with -C) EXPERIMENTAL"),
479 &type_eddsa),
459 GNUNET_GETOPT_option_flag ('d', 480 GNUNET_GETOPT_option_flag ('d',
460 "display", 481 "display",
461 gettext_noop ("display all egos"), 482 gettext_noop ("display all egos"),
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c
index bdacf3ba0..6cdb1c2f7 100644
--- a/src/identity/gnunet-service-identity.c
+++ b/src/identity/gnunet-service-identity.c
@@ -57,7 +57,7 @@ struct Ego
57 /** 57 /**
58 * Private key of the ego. 58 * Private key of the ego.
59 */ 59 */
60 struct GNUNET_CRYPTO_EcdsaPrivateKey pk; 60 struct GNUNET_IDENTITY_PrivateKey pk;
61 61
62 /** 62 /**
63 * String identifier for the ego. 63 * String identifier for the ego.
@@ -538,8 +538,8 @@ handle_get_default_message (void *cls,
538 * @return 0 if the keys are equal 538 * @return 0 if the keys are equal
539 */ 539 */
540static int 540static int
541key_cmp (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1, 541key_cmp (const struct GNUNET_IDENTITY_PrivateKey *pk1,
542 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk2) 542 const struct GNUNET_IDENTITY_PrivateKey *pk2)
543{ 543{
544 return GNUNET_memcmp (pk1, pk2); 544 return GNUNET_memcmp (pk1, pk2);
545} 545}
@@ -738,10 +738,10 @@ handle_create_message (void *cls,
738 send_result_code (client, 0, NULL); 738 send_result_code (client, 0, NULL);
739 fn = get_ego_filename (ego); 739 fn = get_ego_filename (ego);
740 (void) GNUNET_DISK_directory_create_for_file (fn); 740 (void) GNUNET_DISK_directory_create_for_file (fn);
741 if (sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey) != 741 if (sizeof(struct GNUNET_IDENTITY_PrivateKey) !=
742 GNUNET_DISK_fn_write (fn, 742 GNUNET_DISK_fn_write (fn,
743 &crm->private_key, 743 &crm->private_key,
744 sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey), 744 sizeof(struct GNUNET_IDENTITY_PrivateKey),
745 GNUNET_DISK_PERM_USER_READ 745 GNUNET_DISK_PERM_USER_READ
746 | GNUNET_DISK_PERM_USER_WRITE)) 746 | GNUNET_DISK_PERM_USER_WRITE))
747 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", fn); 747 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", fn);
@@ -1038,6 +1038,67 @@ handle_delete_message (void *cls, const struct DeleteMessage *dm)
1038} 1038}
1039 1039
1040 1040
1041static int
1042read_from_file (const char *filename,
1043 void *buf,
1044 size_t buf_size)
1045{
1046 int fd;
1047 struct stat sb;
1048
1049 fd = open (filename,
1050 O_RDONLY);
1051 if (-1 == fd)
1052 {
1053 memset (buf,
1054 0,
1055 buf_size);
1056 return GNUNET_SYSERR;
1057 }
1058 if (0 != fstat (fd,
1059 &sb))
1060 {
1061 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
1062 "stat",
1063 filename);
1064 GNUNET_assert (0 == close (fd));
1065 memset (buf,
1066 0,
1067 buf_size);
1068 return GNUNET_SYSERR;
1069 }
1070 if (sb.st_size != buf_size)
1071 {
1072 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1073 "File `%s' has wrong size (%llu), expected %llu bytes\n",
1074 filename,
1075 (unsigned long long) sb.st_size,
1076 (unsigned long long) buf_size);
1077 GNUNET_assert (0 == close (fd));
1078 memset (buf,
1079 0,
1080 buf_size);
1081 return GNUNET_SYSERR;
1082 }
1083 if (buf_size !=
1084 read (fd,
1085 buf,
1086 buf_size))
1087 {
1088 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
1089 "read",
1090 filename);
1091 GNUNET_assert (0 == close (fd));
1092 memset (buf,
1093 0,
1094 buf_size);
1095 return GNUNET_SYSERR;
1096 }
1097 GNUNET_assert (0 == close (fd));
1098 return GNUNET_OK;
1099}
1100
1101
1041/** 1102/**
1042 * Process the given file from the "EGODIR". Parses the file 1103 * Process the given file from the "EGODIR". Parses the file
1043 * and creates the respective 'struct Ego' in memory. 1104 * and creates the respective 'struct Ego' in memory.
@@ -1063,9 +1124,9 @@ process_ego_file (void *cls,
1063 } 1124 }
1064 ego = GNUNET_new (struct Ego); 1125 ego = GNUNET_new (struct Ego);
1065 if (GNUNET_OK != 1126 if (GNUNET_OK !=
1066 GNUNET_CRYPTO_ecdsa_key_from_file (filename, 1127 read_from_file (filename,
1067 GNUNET_NO, 1128 &ego->pk,
1068 &ego->pk)) 1129 sizeof (ego->pk)))
1069 { 1130 {
1070 GNUNET_free (ego); 1131 GNUNET_free (ego);
1071 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1132 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
diff --git a/src/identity/identity.h b/src/identity/identity.h
index ef638fa36..11c5883bc 100644
--- a/src/identity/identity.h
+++ b/src/identity/identity.h
@@ -30,6 +30,44 @@
30 30
31#include "gnunet_common.h" 31#include "gnunet_common.h"
32 32
33/**
34 * Handle for an ego.
35 */
36struct GNUNET_IDENTITY_Ego
37{
38 /**
39 * Hash of the private key of this ego.
40 */
41 struct GNUNET_HashCode id;
42
43 /**
44 * The identity key pair
45 */
46 struct GNUNET_IDENTITY_PublicKey pub;
47
48 /**
49 * The identity key pair
50 */
51 struct GNUNET_IDENTITY_PrivateKey pk;
52
53 /**
54 * Current name associated with this ego.
55 */
56 char *name;
57
58 /**
59 * Client context associated with this ego.
60 */
61 void *ctx;
62
63 /**
64 * Set to true once @e pub was initialized
65 */
66 bool pub_initialized;
67};
68
69
70
33 71
34GNUNET_NETWORK_STRUCT_BEGIN 72GNUNET_NETWORK_STRUCT_BEGIN
35 73
@@ -95,7 +133,7 @@ struct UpdateMessage
95 /** 133 /**
96 * The private key 134 * The private key
97 */ 135 */
98 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; 136 struct GNUNET_IDENTITY_PrivateKey private_key;
99 137
100 /* followed by 0-terminated ego name */ 138 /* followed by 0-terminated ego name */
101}; 139};
@@ -151,7 +189,7 @@ struct SetDefaultMessage
151 /** 189 /**
152 * The private key 190 * The private key
153 */ 191 */
154 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; 192 struct GNUNET_IDENTITY_PrivateKey private_key;
155 193
156 /* followed by 0-terminated service name */ 194 /* followed by 0-terminated service name */
157}; 195};
@@ -181,7 +219,7 @@ struct CreateRequestMessage
181 /** 219 /**
182 * The private key 220 * The private key
183 */ 221 */
184 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; 222 struct GNUNET_IDENTITY_PrivateKey private_key;
185 223
186 /* followed by 0-terminated identity name */ 224 /* followed by 0-terminated identity name */
187}; 225};
@@ -239,42 +277,5 @@ struct DeleteMessage
239 277
240GNUNET_NETWORK_STRUCT_END 278GNUNET_NETWORK_STRUCT_END
241 279
242/**
243 * Handle for an ego.
244 */
245struct GNUNET_IDENTITY_Ego
246{
247 /**
248 * Hash of the private key of this ego.
249 */
250 struct GNUNET_HashCode id;
251
252 /**
253 * Private key associated with this ego.
254 */
255 struct GNUNET_CRYPTO_EcdsaPrivateKey pk;
256
257 /**
258 * Public key associated with this ego. Initialized on demand.
259 * Always use #GNUNET_IDENTITY_ego_get_public_key() to obtain.
260 */
261 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
262
263 /**
264 * Current name associated with this ego.
265 */
266 char *name;
267
268 /**
269 * Client context associated with this ego.
270 */
271 void *ctx;
272
273 /**
274 * Set to true once @e pub was initialized
275 */
276 bool pub_initialized;
277};
278
279 280
280#endif 281#endif
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index f7aca1655..213b6966e 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -74,7 +74,7 @@ struct GNUNET_IDENTITY_Operation
74 /** 74 /**
75 * Private key to return to @e create_cont, or NULL. 75 * Private key to return to @e create_cont, or NULL.
76 */ 76 */
77 struct GNUNET_CRYPTO_EcdsaPrivateKey pk; 77 struct GNUNET_IDENTITY_PrivateKey pk;
78 78
79 /** 79 /**
80 * Continuation to invoke with the result of the transmission for 80 * Continuation to invoke with the result of the transmission for
@@ -157,13 +157,12 @@ GNUNET_IDENTITY_ego_get_anonymous ()
157{ 157{
158 static struct GNUNET_IDENTITY_Ego anon; 158 static struct GNUNET_IDENTITY_Ego anon;
159 static int setup; 159 static int setup;
160 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
161 160
162 if (setup) 161 if (setup)
163 return &anon; 162 return &anon;
164 anon.pk = *GNUNET_CRYPTO_ecdsa_key_get_anonymous (); 163 anon.pk.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
165 GNUNET_CRYPTO_ecdsa_key_get_public (&anon.pk, 164 anon.pub.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
166 &pub); 165 anon.pk.ecdsa_key = *GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
167 GNUNET_CRYPTO_hash (&anon.pk, 166 GNUNET_CRYPTO_hash (&anon.pk,
168 sizeof(anon.pk), 167 sizeof(anon.pk),
169 &anon.id); 168 &anon.id);
@@ -172,6 +171,51 @@ GNUNET_IDENTITY_ego_get_anonymous ()
172} 171}
173 172
174 173
174enum GNUNET_GenericReturnValue
175GNUNET_IDENTITY_key_get_public (const struct
176 GNUNET_IDENTITY_PrivateKey *privkey,
177 struct GNUNET_IDENTITY_PublicKey *key)
178{
179 key->type = privkey->type;
180 switch (ntohl (privkey->type))
181 {
182 case GNUNET_IDENTITY_TYPE_ECDSA:
183 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey->ecdsa_key,
184 &key->ecdsa_key);
185 break;
186 case GNUNET_IDENTITY_TYPE_EDDSA:
187 GNUNET_CRYPTO_eddsa_key_get_public (&privkey->eddsa_key,
188 &key->eddsa_key);
189 break;
190 default:
191 GNUNET_break (0);
192 return GNUNET_SYSERR;
193 }
194 return GNUNET_OK;
195}
196
197
198static int
199private_key_create (enum GNUNET_IDENTITY_KeyType ktype,
200 struct GNUNET_IDENTITY_PrivateKey *key)
201{
202 key->type = htonl (ktype);
203 switch (ktype)
204 {
205 case GNUNET_IDENTITY_TYPE_ECDSA:
206 GNUNET_CRYPTO_ecdsa_key_create (&key->ecdsa_key);
207 break;
208 case GNUNET_IDENTITY_TYPE_EDDSA:
209 GNUNET_CRYPTO_eddsa_key_create (&key->eddsa_key);
210 break;
211 default:
212 GNUNET_break (0);
213 return GNUNET_SYSERR;
214 }
215 return GNUNET_OK;
216}
217
218
175/** 219/**
176 * Try again to connect to the identity service. 220 * Try again to connect to the identity service.
177 * 221 *
@@ -591,7 +635,7 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
591 * @param ego the ego 635 * @param ego the ego
592 * @return associated ECC key, valid as long as the ego is valid 636 * @return associated ECC key, valid as long as the ego is valid
593 */ 637 */
594const struct GNUNET_CRYPTO_EcdsaPrivateKey * 638const struct GNUNET_IDENTITY_PrivateKey *
595GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) 639GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
596{ 640{
597 return &ego->pk; 641 return &ego->pk;
@@ -606,12 +650,11 @@ GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
606 */ 650 */
607void 651void
608GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, 652GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
609 struct GNUNET_CRYPTO_EcdsaPublicKey *pk) 653 struct GNUNET_IDENTITY_PublicKey *pk)
610{ 654{
611 if (GNUNET_NO == ego->pub_initialized) 655 if (GNUNET_NO == ego->pub_initialized)
612 { 656 {
613 GNUNET_CRYPTO_ecdsa_key_get_public (&ego->pk, 657 GNUNET_IDENTITY_key_get_public (&ego->pk, &ego->pub);
614 &ego->pub);
615 ego->pub_initialized = GNUNET_YES; 658 ego->pub_initialized = GNUNET_YES;
616 } 659 }
617 *pk = ego->pub; 660 *pk = ego->pub;
@@ -710,20 +753,11 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
710} 753}
711 754
712 755
713/**
714 * Create a new identity with the given name.
715 *
716 * @param h identity service to use
717 * @param name desired name
718 * @param privkey desired private key or NULL to create one
719 * @param cont function to call with the result (will only be called once)
720 * @param cont_cls closure for @a cont
721 * @return handle to abort the operation
722 */
723struct GNUNET_IDENTITY_Operation * 756struct GNUNET_IDENTITY_Operation *
724GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, 757GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
725 const char *name, 758 const char *name,
726 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey, 759 const struct GNUNET_IDENTITY_PrivateKey *privkey,
760 enum GNUNET_IDENTITY_KeyType ktype,
727 GNUNET_IDENTITY_CreateContinuation cont, 761 GNUNET_IDENTITY_CreateContinuation cont,
728 void *cont_cls) 762 void *cont_cls)
729{ 763{
@@ -749,7 +783,10 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
749 crm->name_len = htons (slen); 783 crm->name_len = htons (slen);
750 crm->reserved = htons (0); 784 crm->reserved = htons (0);
751 if (NULL == privkey) 785 if (NULL == privkey)
752 GNUNET_CRYPTO_ecdsa_key_create (&crm->private_key); 786 {
787 GNUNET_assert (GNUNET_OK ==
788 private_key_create (ktype, &crm->private_key));
789 }
753 else 790 else
754 crm->private_key = *privkey; 791 crm->private_key = *privkey;
755 op->pk = crm->private_key; 792 op->pk = crm->private_key;
@@ -916,5 +953,96 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h)
916 GNUNET_free (h); 953 GNUNET_free (h);
917} 954}
918 955
956ssize_t
957private_key_get_length (const struct GNUNET_IDENTITY_PrivateKey *key)
958{
959 switch (ntohl (key->type))
960 {
961 case GNUNET_IDENTITY_TYPE_ECDSA:
962 return sizeof (key->type) + sizeof (key->ecdsa_key);
963 break;
964 case GNUNET_IDENTITY_TYPE_EDDSA:
965 return sizeof (key->type) + sizeof (key->eddsa_key);
966 break;
967 default:
968 GNUNET_break (0);
969 }
970 return -1;
971}
972
973
974
975ssize_t
976GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key)
977{
978 switch (ntohl (key->type))
979 {
980 case GNUNET_IDENTITY_TYPE_ECDSA:
981 return sizeof (key->type) + sizeof (key->ecdsa_key);
982 break;
983 case GNUNET_IDENTITY_TYPE_EDDSA:
984 return sizeof (key->type) + sizeof (key->eddsa_key);
985 break;
986 default:
987 GNUNET_break (0);
988 }
989 return -1;
990}
991
992
993char *
994GNUNET_IDENTITY_public_key_to_string (const struct
995 GNUNET_IDENTITY_PublicKey *key)
996{
997 size_t size = GNUNET_IDENTITY_key_get_length (key);
998 return GNUNET_STRINGS_data_to_string_alloc (key,
999 size);
1000}
1001
1002
1003char *
1004GNUNET_IDENTITY_private_key_to_string (const struct
1005 GNUNET_IDENTITY_PrivateKey *key)
1006{
1007 size_t size = private_key_get_length (key);
1008 return GNUNET_STRINGS_data_to_string_alloc (key,
1009 size);
1010}
1011
1012
1013enum GNUNET_GenericReturnValue
1014GNUNET_IDENTITY_public_key_from_string (const char *str,
1015 struct GNUNET_IDENTITY_PublicKey *key)
1016{
1017 enum GNUNET_GenericReturnValue ret;
1018 enum GNUNET_IDENTITY_KeyType ktype;
1019 ret = GNUNET_STRINGS_string_to_data (str,
1020 strlen (str),
1021 key,
1022 sizeof (*key));
1023 if (GNUNET_OK != ret)
1024 return GNUNET_SYSERR;
1025 ktype = ntohl (key->type);
1026 return (GNUNET_IDENTITY_TYPE_ECDSA == ktype) ? GNUNET_OK : GNUNET_SYSERR; //FIXME other keys, cleaner way?
1027
1028}
1029
1030
1031enum GNUNET_GenericReturnValue
1032GNUNET_IDENTITY_private_key_from_string (const char *str,
1033 struct GNUNET_IDENTITY_PrivateKey *key)
1034{
1035 enum GNUNET_GenericReturnValue ret;
1036 enum GNUNET_IDENTITY_KeyType ktype;
1037 ret = GNUNET_STRINGS_string_to_data (str,
1038 strlen (str),
1039 key,
1040 sizeof (*key));
1041 if (GNUNET_OK != ret)
1042 return GNUNET_SYSERR;
1043 ktype = ntohl (key->type);
1044 return (GNUNET_IDENTITY_TYPE_ECDSA == ktype) ? GNUNET_OK : GNUNET_SYSERR; //FIXME other keys, cleaner way?
1045}
1046
919 1047
920/* end of identity_api.c */ 1048/* end of identity_api.c */
diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c
index 26b1eacd7..51afb2515 100644
--- a/src/identity/identity_api_lookup.c
+++ b/src/identity/identity_api_lookup.c
@@ -127,14 +127,12 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
127 struct GNUNET_IDENTITY_EgoLookup *el = cls; 127 struct GNUNET_IDENTITY_EgoLookup *el = cls;
128 uint16_t name_len = ntohs (um->name_len); 128 uint16_t name_len = ntohs (um->name_len);
129 const char *str = (0 == name_len) ? NULL : (const char *) &um[1]; 129 const char *str = (0 == name_len) ? NULL : (const char *) &um[1];
130 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
131 struct GNUNET_HashCode id; 130 struct GNUNET_HashCode id;
132 struct GNUNET_IDENTITY_Ego ego; 131 struct GNUNET_IDENTITY_Ego ego;
133 memset (&ego, 0, sizeof (ego)); 132 memset (&ego, 0, sizeof (ego));
134 133
135 GNUNET_break (GNUNET_YES != ntohs (um->end_of_list)); 134 GNUNET_break (GNUNET_YES != ntohs (um->end_of_list));
136 GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub); 135 GNUNET_CRYPTO_hash (&um->private_key, sizeof(um->private_key), &id);
137 GNUNET_CRYPTO_hash (&pub, sizeof(pub), &id);
138 ego.pk = um->private_key; 136 ego.pk = um->private_key;
139 ego.name = (char *) str; 137 ego.name = (char *) str;
140 ego.id = id; 138 ego.id = id;
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index d86d29e36..dba1d478d 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -384,7 +384,7 @@ ego_get_for_subsystem (void *cls,
384{ 384{
385 struct RequestHandle *handle = cls; 385 struct RequestHandle *handle = cls;
386 struct MHD_Response *resp; 386 struct MHD_Response *resp;
387 struct GNUNET_CRYPTO_EcdsaPublicKey public_key; 387 struct GNUNET_IDENTITY_PublicKey public_key;
388 json_t *json_root; 388 json_t *json_root;
389 char *result_str; 389 char *result_str;
390 char *public_key_string; 390 char *public_key_string;
@@ -398,7 +398,7 @@ ego_get_for_subsystem (void *cls,
398 } 398 }
399 399
400 GNUNET_IDENTITY_ego_get_public_key (ego, &public_key); 400 GNUNET_IDENTITY_ego_get_public_key (ego, &public_key);
401 public_key_string = GNUNET_CRYPTO_ecdsa_public_key_to_string (&public_key); 401 public_key_string = GNUNET_IDENTITY_public_key_to_string (&public_key);
402 402
403 // create json with subsystem identity 403 // create json with subsystem identity
404 json_root = json_object (); 404 json_root = json_object ();
@@ -496,7 +496,7 @@ ego_get_all (struct GNUNET_REST_RequestHandle *con_handle,
496 GNUNET_CONTAINER_multihashmap_contains ( 496 GNUNET_CONTAINER_multihashmap_contains (
497 handle->rest_handle->url_param_map, &key)) 497 handle->rest_handle->url_param_map, &key))
498 { 498 {
499 privkey_str = GNUNET_CRYPTO_ecdsa_private_key_to_string ( 499 privkey_str = GNUNET_IDENTITY_private_key_to_string (
500 GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego)); 500 GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego));
501 json_object_set_new (json_ego, 501 json_object_set_new (json_ego,
502 GNUNET_REST_IDENTITY_PARAM_PRIVKEY, 502 GNUNET_REST_IDENTITY_PARAM_PRIVKEY,
@@ -549,7 +549,7 @@ ego_get_response (struct RequestHandle *handle, struct EgoEntry *ego_entry)
549 GNUNET_CONTAINER_multihashmap_contains ( 549 GNUNET_CONTAINER_multihashmap_contains (
550 handle->rest_handle->url_param_map, &key)) 550 handle->rest_handle->url_param_map, &key))
551 { 551 {
552 privkey_str = GNUNET_CRYPTO_ecdsa_private_key_to_string ( 552 privkey_str = GNUNET_IDENTITY_private_key_to_string (
553 GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego)); 553 GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego));
554 json_object_set_new (json_ego, 554 json_object_set_new (json_ego,
555 GNUNET_REST_IDENTITY_PARAM_PRIVKEY, 555 GNUNET_REST_IDENTITY_PARAM_PRIVKEY,
@@ -686,7 +686,7 @@ do_finished (void *cls, const char *emsg)
686 */ 686 */
687static void 687static void
688do_finished_create (void *cls, 688do_finished_create (void *cls,
689 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 689 const struct GNUNET_IDENTITY_PrivateKey *pk,
690 const char *emsg) 690 const char *emsg)
691{ 691{
692 struct RequestHandle *handle = cls; 692 struct RequestHandle *handle = cls;
@@ -999,8 +999,8 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
999 json_error_t err; 999 json_error_t err;
1000 char *egoname; 1000 char *egoname;
1001 char *privkey; 1001 char *privkey;
1002 struct GNUNET_CRYPTO_EcdsaPrivateKey pk; 1002 struct GNUNET_IDENTITY_PrivateKey pk;
1003 struct GNUNET_CRYPTO_EcdsaPrivateKey *pk_ptr; 1003 struct GNUNET_IDENTITY_PrivateKey *pk_ptr;
1004 int json_unpack_state; 1004 int json_unpack_state;
1005 char term_data[handle->data_size + 1]; 1005 char term_data[handle->data_size + 1];
1006 1006
@@ -1074,7 +1074,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
1074 strlen (privkey), 1074 strlen (privkey),
1075 &pk, 1075 &pk,
1076 sizeof(struct 1076 sizeof(struct
1077 GNUNET_CRYPTO_EcdsaPrivateKey)); 1077 GNUNET_IDENTITY_PrivateKey));
1078 pk_ptr = &pk; 1078 pk_ptr = &pk;
1079 } 1079 }
1080 else 1080 else
@@ -1084,6 +1084,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
1084 handle->op = GNUNET_IDENTITY_create (identity_handle, 1084 handle->op = GNUNET_IDENTITY_create (identity_handle,
1085 handle->name, 1085 handle->name,
1086 pk_ptr, 1086 pk_ptr,
1087 GNUNET_IDENTITY_TYPE_ECDSA,
1087 &do_finished_create, 1088 &do_finished_create,
1088 handle); 1089 handle);
1089} 1090}
@@ -1208,7 +1209,7 @@ list_ego (void *cls,
1208 const char *identifier) 1209 const char *identifier)
1209{ 1210{
1210 struct EgoEntry *ego_entry; 1211 struct EgoEntry *ego_entry;
1211 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 1212 struct GNUNET_IDENTITY_PublicKey pk;
1212 1213
1213 if ((NULL == ego) && (ID_REST_STATE_INIT == state)) 1214 if ((NULL == ego) && (ID_REST_STATE_INIT == state))
1214 { 1215 {
@@ -1219,7 +1220,7 @@ list_ego (void *cls,
1219 { 1220 {
1220 ego_entry = GNUNET_new (struct EgoEntry); 1221 ego_entry = GNUNET_new (struct EgoEntry);
1221 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 1222 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
1222 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 1223 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
1223 ego_entry->ego = ego; 1224 ego_entry->ego = ego;
1224 ego_entry->identifier = GNUNET_strdup (identifier); 1225 ego_entry->identifier = GNUNET_strdup (identifier);
1225 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 1226 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
@@ -1245,7 +1246,7 @@ list_ego (void *cls,
1245 /* Add */ 1246 /* Add */
1246 ego_entry = GNUNET_new (struct EgoEntry); 1247 ego_entry = GNUNET_new (struct EgoEntry);
1247 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 1248 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
1248 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 1249 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
1249 ego_entry->ego = ego; 1250 ego_entry->ego = ego;
1250 ego_entry->identifier = GNUNET_strdup (identifier); 1251 ego_entry->identifier = GNUNET_strdup (identifier);
1251 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 1252 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
diff --git a/src/identity/test_identity.c b/src/identity/test_identity.c
index 37eeab238..4954fe7be 100644
--- a/src/identity/test_identity.c
+++ b/src/identity/test_identity.c
@@ -253,7 +253,7 @@ success_rename_cont (void *cls, const char *emsg)
253 */ 253 */
254static void 254static void
255create_cb (void *cls, 255create_cb (void *cls,
256 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 256 const struct GNUNET_IDENTITY_PrivateKey *pk,
257 const char *emsg) 257 const char *emsg)
258{ 258{
259 CHECK (NULL != pk); 259 CHECK (NULL != pk);
@@ -279,7 +279,11 @@ run (void *cls,
279 GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL); 279 GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL);
280 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL); 280 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL);
281 CHECK (NULL != h); 281 CHECK (NULL != h);
282 op = GNUNET_IDENTITY_create (h, "test-id", NULL, &create_cb, NULL); 282 op = GNUNET_IDENTITY_create (h,
283 "test-id",
284 NULL,
285 GNUNET_IDENTITY_TYPE_ECDSA,
286 &create_cb, NULL);
283} 287}
284 288
285 289
diff --git a/src/identity/test_identity_defaults.c b/src/identity/test_identity_defaults.c
index 53eec1252..2d5244d1b 100644
--- a/src/identity/test_identity_defaults.c
+++ b/src/identity/test_identity_defaults.c
@@ -241,7 +241,7 @@ notification_cb (void *cls,
241 */ 241 */
242static void 242static void
243create_cb (void *cls, 243create_cb (void *cls,
244 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 244 const struct GNUNET_IDENTITY_PrivateKey *pk,
245 const char *emsg) 245 const char *emsg)
246{ 246{
247 CHECK (NULL == emsg); 247 CHECK (NULL == emsg);
@@ -266,7 +266,11 @@ run_set (void *cls,
266 GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL); 266 GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL);
267 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL); 267 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL);
268 CHECK (NULL != h); 268 CHECK (NULL != h);
269 op = GNUNET_IDENTITY_create (h, "test-id", NULL, &create_cb, NULL); 269 op = GNUNET_IDENTITY_create (h,
270 "test-id",
271 NULL,
272 GNUNET_IDENTITY_TYPE_ECDSA,
273 &create_cb, NULL);
270} 274}
271 275
272 276
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h
index 4566caad0..be5a81cfb 100644
--- a/src/include/gnunet_conversation_service.h
+++ b/src/include/gnunet_conversation_service.h
@@ -147,7 +147,7 @@ typedef void
147 struct GNUNET_CONVERSATION_Caller * 147 struct GNUNET_CONVERSATION_Caller *
148 caller, 148 caller,
149 const struct 149 const struct
150 GNUNET_CRYPTO_EcdsaPublicKey *caller_id); 150 GNUNET_IDENTITY_PublicKey *caller_id);
151 151
152 152
153/** 153/**
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h
index ef81e9a88..3f6c9b9aa 100644
--- a/src/include/gnunet_gns_service.h
+++ b/src/include/gnunet_gns_service.h
@@ -36,6 +36,7 @@
36 36
37#include "gnunet_util_lib.h" 37#include "gnunet_util_lib.h"
38#include "gnunet_dnsparser_lib.h" 38#include "gnunet_dnsparser_lib.h"
39#include "gnunet_identity_service.h"
39#include "gnunet_namestore_service.h" 40#include "gnunet_namestore_service.h"
40 41
41#ifdef __cplusplus 42#ifdef __cplusplus
@@ -139,7 +140,7 @@ enum GNUNET_GNS_LocalOptions
139struct GNUNET_GNS_LookupRequest * 140struct GNUNET_GNS_LookupRequest *
140GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, 141GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
141 const char *name, 142 const char *name,
142 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, 143 const struct GNUNET_IDENTITY_PublicKey *zone,
143 uint32_t type, 144 uint32_t type,
144 enum GNUNET_GNS_LocalOptions options, 145 enum GNUNET_GNS_LocalOptions options,
145 GNUNET_GNS_LookupResultProcessor proc, 146 GNUNET_GNS_LookupResultProcessor proc,
@@ -163,7 +164,7 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
163struct GNUNET_GNS_LookupRequest * 164struct GNUNET_GNS_LookupRequest *
164GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, 165GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
165 const char *name, 166 const char *name,
166 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, 167 const struct GNUNET_IDENTITY_PublicKey *zone,
167 uint32_t type, 168 uint32_t type,
168 enum GNUNET_GNS_LocalOptions options, 169 enum GNUNET_GNS_LocalOptions options,
169 uint16_t recursion_depth_limit, 170 uint16_t recursion_depth_limit,
diff --git a/src/include/gnunet_gnsrecord_json_lib.h b/src/include/gnunet_gnsrecord_json_lib.h
new file mode 100644
index 000000000..966461705
--- /dev/null
+++ b/src/include/gnunet_gnsrecord_json_lib.h
@@ -0,0 +1,73 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2012, 2013 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @author Martin Schanzenbach
23 *
24 * @file
25 * API that can be used to manipulate JSON GNS record data
26 *
27 * @defgroup gnsrecord GNS Record library
28 * Manipulate GNS record data
29 *
30 * @see [Documentation](https://gnunet.org/gns-plugins)
31 *
32 * @{
33 */
34#ifndef GNUNET_GNSRECORD_JSON_LIB_H
35#define GNUNET_GNSRECORD_JSON_LIB_H
36
37#include "gnunet_gnsrecord_lib.h"
38#include "gnunet_json_lib.h"
39
40#ifdef __cplusplus
41extern "C" {
42#if 0 /* keep Emacsens' auto-indent happy */
43}
44#endif
45#endif
46
47
48/**
49 * JSON Specification for GNS Records.
50 *
51 * @param gnsrecord_object struct of GNUNET_GNSRECORD_Data to fill
52 * @return JSON Specification
53 */
54struct GNUNET_JSON_Specification
55GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd,
56 unsigned int *rd_count,
57 char **name);
58
59
60/**
61 * Convert GNS record to JSON.
62 *
63 * @param rname name of record
64 * @param rd record data
65 * @return corresponding JSON encoding
66 */
67json_t *
68GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname,
69 const struct GNUNET_GNSRECORD_Data *rd,
70 unsigned int rd_count);
71
72
73#endif
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index 960203fb1..530879b21 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -34,6 +34,8 @@
34#ifndef GNUNET_GNSRECORD_LIB_H 34#ifndef GNUNET_GNSRECORD_LIB_H
35#define GNUNET_GNSRECORD_LIB_H 35#define GNUNET_GNSRECORD_LIB_H
36 36
37#include "gnunet_identity_service.h"
38
37#ifdef __cplusplus 39#ifdef __cplusplus
38extern "C" { 40extern "C" {
39#if 0 /* keep Emacsens' auto-indent happy */ 41#if 0 /* keep Emacsens' auto-indent happy */
@@ -55,7 +57,7 @@ extern "C" {
55/** 57/**
56 * Record type for GNS zone transfer ("PKEY"). 58 * Record type for GNS zone transfer ("PKEY").
57 */ 59 */
58#define GNUNET_GNSRECORD_TYPE_PKEY 65536 60#define GNUNET_GNSRECORD_TYPE_PKEY GNUNET_IDENTITY_TYPE_ECDSA
59 61
60/** 62/**
61 * Record type for GNS nick names ("NICK"). 63 * Record type for GNS nick names ("NICK").
@@ -151,6 +153,11 @@ extern "C" {
151 */ 153 */
152#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555 154#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555
153 155
156/**
157 * Record type for EDKEY delegations.
158 */
159#define GNUNET_GNSRECORD_TYPE_EDKEY GNUNET_IDENTITY_TYPE_EDDSA
160
154 161
155/** 162/**
156 * Flags that can be set for a record. 163 * Flags that can be set for a record.
@@ -261,21 +268,20 @@ struct GNUNET_GNSRECORD_PlaceData
261 /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */ 268 /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
262}; 269};
263 270
264
265/** 271/**
266 * Information we have in an encrypted block with record data (i.e. in the DHT). 272 * Information we have in an encrypted block with record data (i.e. in the DHT).
267 */ 273 */
268struct GNUNET_GNSRECORD_Block 274struct GNUNET_GNSRECORD_EcdsaBlock
269{ 275{
270 /** 276 /**
271 * Signature of the block. 277 * Derived key used for signing; hash of this is the query.
272 */ 278 */
273 struct GNUNET_CRYPTO_EcdsaSignature signature; 279 struct GNUNET_CRYPTO_EcdsaPublicKey derived_key;
274 280
275 /** 281 /**
276 * Derived key used for signing; hash of this is the query. 282 * Signature of the block.
277 */ 283 */
278 struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; 284 struct GNUNET_CRYPTO_EcdsaSignature signature;
279 285
280 /** 286 /**
281 * Number of bytes signed; also specifies the number of bytes 287 * Number of bytes signed; also specifies the number of bytes
@@ -291,6 +297,17 @@ struct GNUNET_GNSRECORD_Block
291 /* followed by encrypted data */ 297 /* followed by encrypted data */
292}; 298};
293 299
300struct GNUNET_GNSRECORD_Block
301{
302 uint32_t type;
303
304 union
305 {
306 struct GNUNET_GNSRECORD_EcdsaBlock ecdsa_block;
307 //struct GNUNET_GNSRECORD_EddsaBlock eddsa_block;
308 };
309};
310
294 311
295/** 312/**
296 * Record type used to box up SRV and TLSA records. For example, a 313 * Record type used to box up SRV and TLSA records. For example, a
@@ -335,7 +352,7 @@ struct GNUNET_GNSRECORD_ReverseRecord
335 /** 352 /**
336 * The public key of the namespace the is delegating to our namespace 353 * The public key of the namespace the is delegating to our namespace
337 */ 354 */
338 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 355 struct GNUNET_IDENTITY_PublicKey pkey;
339 356
340 /** 357 /**
341 * The expiration time of the delegation 358 * The expiration time of the delegation
@@ -488,7 +505,7 @@ GNUNET_GNSRECORD_string_to_lowercase (const char *src);
488 * #GNUNET_GNSRECORD_z2s. 505 * #GNUNET_GNSRECORD_z2s.
489 */ 506 */
490const char * 507const char *
491GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z); 508GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z);
492 509
493 510
494/** 511/**
@@ -502,7 +519,7 @@ GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z);
502 * key in an encoding suitable for DNS labels. 519 * key in an encoding suitable for DNS labels.
503 */ 520 */
504const char * 521const char *
505GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); 522GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_PublicKey *pkey);
506 523
507 524
508/** 525/**
@@ -516,7 +533,7 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
516 */ 533 */
517int 534int
518GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, 535GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
519 struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); 536 struct GNUNET_IDENTITY_PublicKey *pkey);
520 537
521 538
522/** 539/**
@@ -528,7 +545,7 @@ GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
528 */ 545 */
529void 546void
530GNUNET_GNSRECORD_query_from_private_key ( 547GNUNET_GNSRECORD_query_from_private_key (
531 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, 548 const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label,
532 struct GNUNET_HashCode *query); 549 struct GNUNET_HashCode *query);
533 550
534 551
@@ -541,7 +558,7 @@ GNUNET_GNSRECORD_query_from_private_key (
541 */ 558 */
542void 559void
543GNUNET_GNSRECORD_query_from_public_key ( 560GNUNET_GNSRECORD_query_from_public_key (
544 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, 561 const struct GNUNET_IDENTITY_PublicKey *pub, const char *label,
545 struct GNUNET_HashCode *query); 562 struct GNUNET_HashCode *query);
546 563
547 564
@@ -555,7 +572,7 @@ GNUNET_GNSRECORD_query_from_public_key (
555 * @param rd_count number of records in @a rd 572 * @param rd_count number of records in @a rd
556 */ 573 */
557struct GNUNET_GNSRECORD_Block * 574struct GNUNET_GNSRECORD_Block *
558GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 575GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key,
559 struct GNUNET_TIME_Absolute expire, 576 struct GNUNET_TIME_Absolute expire,
560 const char *label, 577 const char *label,
561 const struct GNUNET_GNSRECORD_Data *rd, 578 const struct GNUNET_GNSRECORD_Data *rd,
@@ -574,7 +591,7 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
574 * @param rd_count number of records in @a rd 591 * @param rd_count number of records in @a rd
575 */ 592 */
576struct GNUNET_GNSRECORD_Block * 593struct GNUNET_GNSRECORD_Block *
577GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 594GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *key,
578 struct GNUNET_TIME_Absolute expire, 595 struct GNUNET_TIME_Absolute expire,
579 const char *label, 596 const char *label,
580 const struct GNUNET_GNSRECORD_Data *rd, 597 const struct GNUNET_GNSRECORD_Data *rd,
@@ -606,7 +623,7 @@ GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block);
606int 623int
607GNUNET_GNSRECORD_block_decrypt ( 624GNUNET_GNSRECORD_block_decrypt (
608 const struct GNUNET_GNSRECORD_Block *block, 625 const struct GNUNET_GNSRECORD_Block *block,
609 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label, 626 const struct GNUNET_IDENTITY_PublicKey *zone_key, const char *label,
610 GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); 627 GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls);
611 628
612 629
@@ -636,6 +653,50 @@ GNUNET_GNSRECORD_record_get_expiration_time (
636 unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); 653 unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd);
637 654
638 655
656/**
657 * Returns the length of this block in bytes.
658 * Block length strongly depends on the zone type.
659 *
660 * @param block the block.
661 * @return the length of this block in bytes
662 */
663size_t
664GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block);
665
666/**
667 * Returns the expiration of a block.
668 *
669 * @param block the block.
670 * @return the block expiration.
671 */
672struct GNUNET_TIME_Absolute
673GNUNET_GNSRECORD_block_get_expiration (const struct GNUNET_GNSRECORD_Block *block);
674
675
676/**
677 * Builds the query hash from a block.
678 *
679 * @param block the block.
680 * @param query where to write the query hash.
681 * @return GNUNET_SYSERR on error.
682 */
683enum GNUNET_GenericReturnValue
684GNUNET_GNSRECORD_query_from_block (const struct GNUNET_GNSRECORD_Block *block,
685 struct GNUNET_HashCode *query);
686
687
688/**
689 * Build a #GNUNET_GNSRECORD_PublicKey from a
690 * zone delegation resource record set.
691 *
692 * @param the resource record set. MUST be a delegation record.
693 * @param key where to write the identtiy key.
694 * @return GNUNET_SYSERR on error or if the zone is not a delegation zone.
695 */
696enum GNUNET_GenericReturnValue
697GNUNET_GNSRECORD_record_to_identity_key (const struct GNUNET_GNSRECORD_Data *rd,
698 struct GNUNET_IDENTITY_PublicKey *key);
699
639#if 0 /* keep Emacsens' auto-indent happy */ 700#if 0 /* keep Emacsens' auto-indent happy */
640{ 701{
641#endif 702#endif
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h
index 94127248e..17714fec4 100644
--- a/src/include/gnunet_identity_service.h
+++ b/src/include/gnunet_identity_service.h
@@ -57,6 +57,21 @@ extern "C" {
57 */ 57 */
58#define GNUNET_IDENTITY_VERSION 0x00000100 58#define GNUNET_IDENTITY_VERSION 0x00000100
59 59
60enum GNUNET_IDENTITY_KeyType
61{
62 /**
63 * The identity type. The value is the same as the
64 * PKEY record type.
65 */
66 GNUNET_IDENTITY_TYPE_ECDSA = 65536,
67
68 /**
69 * EDDSA identity. The value is the same as the EDKEY
70 * record type.
71 */
72 GNUNET_IDENTITY_TYPE_EDDSA = 65556
73};
74
60/** 75/**
61 * Handle to access the identity service. 76 * Handle to access the identity service.
62 */ 77 */
@@ -67,6 +82,61 @@ struct GNUNET_IDENTITY_Handle;
67 */ 82 */
68struct GNUNET_IDENTITY_Ego; 83struct GNUNET_IDENTITY_Ego;
69 84
85
86/**
87 * A private key for an identity as per LSD0001.
88 */
89struct GNUNET_IDENTITY_PrivateKey
90{
91 /**
92 * Type of public key.
93 * Defined by the GNS zone type value.
94 * In NBO.
95 */
96 uint32_t type;
97
98 union
99 {
100 /**
101 * An ECDSA identity key.
102 */
103 struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key;
104
105 /**
106 * AN EdDSA identtiy key
107 */
108 struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_key;
109 };
110};
111
112
113/**
114 * An identity key as per LSD0001.
115 */
116struct GNUNET_IDENTITY_PublicKey
117{
118 /**
119 * Type of public key.
120 * Defined by the GNS zone type value.
121 * In NBO.
122 */
123 uint32_t type;
124
125 union
126 {
127 /**
128 * An ECDSA identity key.
129 */
130 struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_key;
131
132 /**
133 * AN EdDSA identtiy key
134 */
135 struct GNUNET_CRYPTO_EddsaPublicKey eddsa_key;
136 };
137};
138
139
70/** 140/**
71 * Handle for an operation with the identity service. 141 * Handle for an operation with the identity service.
72 */ 142 */
@@ -79,7 +149,7 @@ struct GNUNET_IDENTITY_Operation;
79 * @param ego the ego 149 * @param ego the ego
80 * @return associated ECC key, valid as long as the ego is valid 150 * @return associated ECC key, valid as long as the ego is valid
81 */ 151 */
82const struct GNUNET_CRYPTO_EcdsaPrivateKey * 152const struct GNUNET_IDENTITY_PrivateKey *
83GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego); 153GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego);
84 154
85 155
@@ -100,7 +170,7 @@ GNUNET_IDENTITY_ego_get_anonymous (void);
100 */ 170 */
101void 171void
102GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, 172GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
103 struct GNUNET_CRYPTO_EcdsaPublicKey *pk); 173 struct GNUNET_IDENTITY_PublicKey *pk);
104 174
105 175
106/** 176/**
@@ -224,7 +294,7 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h);
224typedef void 294typedef void
225(*GNUNET_IDENTITY_CreateContinuation) ( 295(*GNUNET_IDENTITY_CreateContinuation) (
226 void *cls, 296 void *cls,
227 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 297 const struct GNUNET_IDENTITY_PrivateKey *pk,
228 const char *emsg); 298 const char *emsg);
229 299
230 300
@@ -234,6 +304,7 @@ typedef void
234 * @param id identity service to use 304 * @param id identity service to use
235 * @param name desired name 305 * @param name desired name
236 * @param privkey desired private key or NULL to create one 306 * @param privkey desired private key or NULL to create one
307 * @param ktype the type of key to create. Ignored if privkey != NULL.
237 * @param cont function to call with the result (will only be called once) 308 * @param cont function to call with the result (will only be called once)
238 * @param cont_cls closure for @a cont 309 * @param cont_cls closure for @a cont
239 * @return handle to abort the operation 310 * @return handle to abort the operation
@@ -241,7 +312,8 @@ typedef void
241struct GNUNET_IDENTITY_Operation * 312struct GNUNET_IDENTITY_Operation *
242GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, 313GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
243 const char *name, 314 const char *name,
244 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey, 315 const struct GNUNET_IDENTITY_PrivateKey *privkey,
316 enum GNUNET_IDENTITY_KeyType ktype,
245 GNUNET_IDENTITY_CreateContinuation cont, 317 GNUNET_IDENTITY_CreateContinuation cont,
246 void *cont_cls); 318 void *cont_cls);
247 319
@@ -292,6 +364,84 @@ void
292GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); 364GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op);
293 365
294 366
367/**
368 * Get the compacted length of a #GNUNET_IDENTITY_PublicKey.
369 * Compacted means that it returns the minimum number of bytes this
370 * key is long, as opposed to the union structure inside
371 * #GNUNET_IDENTITY_PublicKey.
372 * Useful for compact serializations.
373 *
374 * @param key the key.
375 * @return -1 on error, else the compacted length of the key.
376 */
377ssize_t
378GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key);
379
380
381/**
382 * Creates a (Base32) string representation of the public key.
383 * The resulting string encodes a compacted representation of the key.
384 * See also #GNUNET_IDENTITY_key_get_length.
385 *
386 * @param key the key.
387 * @return the string representation of the key, or NULL on error.
388 */
389char *
390GNUNET_IDENTITY_public_key_to_string (const struct
391 GNUNET_IDENTITY_PublicKey *key);
392
393
394/**
395 * Creates a (Base32) string representation of the private key.
396 * The resulting string encodes a compacted representation of the key.
397 * See also #GNUNET_IDENTITY_key_get_length.
398 *
399 * @param key the key.
400 * @return the string representation of the key, or NULL on error.
401 */
402char *
403GNUNET_IDENTITY_private_key_to_string (const struct
404 GNUNET_IDENTITY_PrivateKey *key);
405
406
407/**
408 * Parses a (Base32) string representation of the public key.
409 * See also #GNUNET_IDENTITY_public_key_to_string.
410 *
411 * @param str the encoded key.
412 * @param key where to write the key.
413 * @return GNUNET_SYSERR on error.
414 */
415enum GNUNET_GenericReturnValue
416GNUNET_IDENTITY_public_key_from_string (const char*str,
417 struct GNUNET_IDENTITY_PublicKey *key);
418
419
420/**
421 * Parses a (Base32) string representation of the private key.
422 * See also #GNUNET_IDENTITY_private_key_to_string.
423 *
424 * @param str the encoded key.
425 * @param key where to write the key.
426 * @return GNUNET_SYSERR on error.
427 */
428enum GNUNET_GenericReturnValue
429GNUNET_IDENTITY_private_key_from_string (const char*str,
430 struct GNUNET_IDENTITY_PrivateKey *key);
431
432
433/**
434 * Retrieves the public key representation of a private key.
435 *
436 * @param privkey the private key.
437 * @param key the public key result.
438 * @return GNUNET_SYSERR on error.
439 */
440enum GNUNET_GenericReturnValue
441GNUNET_IDENTITY_key_get_public (const struct GNUNET_IDENTITY_PrivateKey *privkey,
442 struct GNUNET_IDENTITY_PublicKey *key);
443
444
295/* ************* convenience API to lookup an ego ***************** */ 445/* ************* convenience API to lookup an ego ***************** */
296 446
297/** 447/**
@@ -344,7 +494,7 @@ GNUNET_IDENTITY_ego_lookup_cancel (struct GNUNET_IDENTITY_EgoLookup *el);
344typedef void 494typedef void
345(*GNUNET_IDENTITY_EgoSuffixCallback) ( 495(*GNUNET_IDENTITY_EgoSuffixCallback) (
346 void *cls, 496 void *cls,
347 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, 497 const struct GNUNET_IDENTITY_PrivateKey *priv,
348 const char *ego_name); 498 const char *ego_name);
349 499
350 500
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h
index 07a14d329..92597d3dd 100644
--- a/src/include/gnunet_json_lib.h
+++ b/src/include/gnunet_json_lib.h
@@ -28,7 +28,6 @@
28#define GNUNET_JSON_LIB_H 28#define GNUNET_JSON_LIB_H
29 29
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31#include "gnunet_gnsrecord_lib.h"
32#include <jansson.h> 31#include <jansson.h>
33#include <microhttpd.h> 32#include <microhttpd.h>
34 33
@@ -359,18 +358,6 @@ GNUNET_JSON_spec_rsa_signature (const char *name,
359 struct GNUNET_CRYPTO_RsaSignature **sig); 358 struct GNUNET_CRYPTO_RsaSignature **sig);
360 359
361 360
362/**
363 * JSON Specification for GNS Records.
364 *
365 * @param gnsrecord_object struct of GNUNET_GNSRECORD_Data to fill
366 * @return JSON Specification
367 */
368struct GNUNET_JSON_Specification
369GNUNET_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd,
370 unsigned int *rd_count,
371 char **name);
372
373
374/* ****************** Generic generator interface ******************* */ 361/* ****************** Generic generator interface ******************* */
375 362
376 363
@@ -446,18 +433,6 @@ GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *pk);
446json_t * 433json_t *
447GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig); 434GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig);
448 435
449/**
450 * Convert Gns record to JSON.
451 *
452 * @param rname name of record
453 * @param rd record data
454 * @return corresponding JSON encoding
455 */
456json_t *
457GNUNET_JSON_from_gnsrecord (const char *rname,
458 const struct GNUNET_GNSRECORD_Data *rd,
459 unsigned int rd_count);
460
461/* ******************* Helpers for MHD upload handling ******************* */ 436/* ******************* Helpers for MHD upload handling ******************* */
462 437
463/** 438/**
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h
index 443c9e451..9cc8abc6e 100644
--- a/src/include/gnunet_namestore_plugin.h
+++ b/src/include/gnunet_namestore_plugin.h
@@ -58,7 +58,7 @@ typedef void
58(*GNUNET_NAMESTORE_RecordIterator) (void *cls, 58(*GNUNET_NAMESTORE_RecordIterator) (void *cls,
59 uint64_t serial, 59 uint64_t serial,
60 const struct 60 const struct
61 GNUNET_CRYPTO_EcdsaPrivateKey *private_key, 61 GNUNET_IDENTITY_PrivateKey *private_key,
62 const char *label, 62 const char *label,
63 unsigned int rd_count, 63 unsigned int rd_count,
64 const struct GNUNET_GNSRECORD_Data *rd); 64 const struct GNUNET_GNSRECORD_Data *rd);
@@ -87,7 +87,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
87 */ 87 */
88 int 88 int
89 (*store_records) (void *cls, 89 (*store_records) (void *cls,
90 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 90 const struct GNUNET_IDENTITY_PrivateKey *zone,
91 const char *label, 91 const char *label,
92 unsigned int rd_count, 92 unsigned int rd_count,
93 const struct GNUNET_GNSRECORD_Data *rd); 93 const struct GNUNET_GNSRECORD_Data *rd);
@@ -104,7 +104,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
104 */ 104 */
105 int 105 int
106 (*lookup_records) (void *cls, 106 (*lookup_records) (void *cls,
107 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 107 const struct GNUNET_IDENTITY_PrivateKey *zone,
108 const char *label, 108 const char *label,
109 GNUNET_NAMESTORE_RecordIterator iter, 109 GNUNET_NAMESTORE_RecordIterator iter,
110 void *iter_cls); 110 void *iter_cls);
@@ -126,7 +126,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
126 */ 126 */
127 int 127 int
128 (*iterate_records) (void *cls, 128 (*iterate_records) (void *cls,
129 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 129 const struct GNUNET_IDENTITY_PrivateKey *zone,
130 uint64_t serial, 130 uint64_t serial,
131 uint64_t limit, 131 uint64_t limit,
132 GNUNET_NAMESTORE_RecordIterator iter, 132 GNUNET_NAMESTORE_RecordIterator iter,
@@ -146,8 +146,8 @@ struct GNUNET_NAMESTORE_PluginFunctions
146 */ 146 */
147 int 147 int
148 (*zone_to_name) (void *cls, 148 (*zone_to_name) (void *cls,
149 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 149 const struct GNUNET_IDENTITY_PrivateKey *zone,
150 const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, 150 const struct GNUNET_IDENTITY_PublicKey *value_zone,
151 GNUNET_NAMESTORE_RecordIterator iter, 151 GNUNET_NAMESTORE_RecordIterator iter,
152 void *iter_cls); 152 void *iter_cls);
153}; 153};
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index bf42c8d34..ca4d2cb52 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -41,6 +41,7 @@
41#include "gnunet_util_lib.h" 41#include "gnunet_util_lib.h"
42#include "gnunet_block_lib.h" 42#include "gnunet_block_lib.h"
43#include "gnunet_gnsrecord_lib.h" 43#include "gnunet_gnsrecord_lib.h"
44#include "gnunet_identity_service.h"
44 45
45#ifdef __cplusplus 46#ifdef __cplusplus
46extern "C" 47extern "C"
@@ -127,7 +128,7 @@ typedef void
127struct GNUNET_NAMESTORE_QueueEntry * 128struct GNUNET_NAMESTORE_QueueEntry *
128GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, 129GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
129 const struct 130 const struct
130 GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 131 GNUNET_IDENTITY_PrivateKey *pkey,
131 const char *label, 132 const char *label,
132 unsigned int rd_count, 133 unsigned int rd_count,
133 const struct GNUNET_GNSRECORD_Data *rd, 134 const struct GNUNET_GNSRECORD_Data *rd,
@@ -147,7 +148,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
147typedef void 148typedef void
148(*GNUNET_NAMESTORE_RecordMonitor) (void *cls, 149(*GNUNET_NAMESTORE_RecordMonitor) (void *cls,
149 const struct 150 const struct
150 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 151 GNUNET_IDENTITY_PrivateKey *zone,
151 const char *label, 152 const char *label,
152 unsigned int rd_count, 153 unsigned int rd_count,
153 const struct GNUNET_GNSRECORD_Data *rd); 154 const struct GNUNET_GNSRECORD_Data *rd);
@@ -170,7 +171,7 @@ typedef void
170struct GNUNET_NAMESTORE_QueueEntry * 171struct GNUNET_NAMESTORE_QueueEntry *
171GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, 172GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
172 const struct 173 const struct
173 GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 174 GNUNET_IDENTITY_PrivateKey *pkey,
174 const char *label, 175 const char *label,
175 GNUNET_SCHEDULER_TaskCallback error_cb, 176 GNUNET_SCHEDULER_TaskCallback error_cb,
176 void *error_cb_cls, 177 void *error_cb_cls,
@@ -197,9 +198,9 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
197 */ 198 */
198struct GNUNET_NAMESTORE_QueueEntry * 199struct GNUNET_NAMESTORE_QueueEntry *
199GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, 200GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
200 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 201 const struct GNUNET_IDENTITY_PrivateKey *zone,
201 const struct 202 const struct
202 GNUNET_CRYPTO_EcdsaPublicKey *value_zone, 203 GNUNET_IDENTITY_PublicKey *value_zone,
203 GNUNET_SCHEDULER_TaskCallback error_cb, 204 GNUNET_SCHEDULER_TaskCallback error_cb,
204 void *error_cb_cls, 205 void *error_cb_cls,
205 GNUNET_NAMESTORE_RecordMonitor proc, 206 GNUNET_NAMESTORE_RecordMonitor proc,
@@ -246,7 +247,7 @@ GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe);
246struct GNUNET_NAMESTORE_ZoneIterator * 247struct GNUNET_NAMESTORE_ZoneIterator *
247GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, 248GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
248 const struct 249 const struct
249 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 250 GNUNET_IDENTITY_PrivateKey *zone,
250 GNUNET_SCHEDULER_TaskCallback error_cb, 251 GNUNET_SCHEDULER_TaskCallback error_cb,
251 void *error_cb_cls, 252 void *error_cb_cls,
252 GNUNET_NAMESTORE_RecordMonitor proc, 253 GNUNET_NAMESTORE_RecordMonitor proc,
@@ -316,7 +317,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor *
316GNUNET_NAMESTORE_zone_monitor_start (const struct 317GNUNET_NAMESTORE_zone_monitor_start (const struct
317 GNUNET_CONFIGURATION_Handle *cfg, 318 GNUNET_CONFIGURATION_Handle *cfg,
318 const struct 319 const struct
319 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 320 GNUNET_IDENTITY_PrivateKey *zone,
320 int iterate_first, 321 int iterate_first,
321 GNUNET_SCHEDULER_TaskCallback error_cb, 322 GNUNET_SCHEDULER_TaskCallback error_cb,
322 void *error_cb_cls, 323 void *error_cb_cls,
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h
index 368058f56..8549081a1 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -38,6 +38,7 @@ extern "C" {
38#endif 38#endif
39#endif 39#endif
40 40
41#include "gnunet_identity_service.h"
41#include "gnunet_reclaim_lib.h" 42#include "gnunet_reclaim_lib.h"
42#include "gnunet_util_lib.h" 43#include "gnunet_util_lib.h"
43 44
@@ -69,12 +70,12 @@ struct GNUNET_RECLAIM_Ticket
69 /** 70 /**
70 * The ticket issuer (= the user) 71 * The ticket issuer (= the user)
71 */ 72 */
72 struct GNUNET_CRYPTO_EcdsaPublicKey identity; 73 struct GNUNET_IDENTITY_PublicKey identity;
73 74
74 /** 75 /**
75 * The ticket audience (= relying party) 76 * The ticket audience (= relying party)
76 */ 77 */
77 struct GNUNET_CRYPTO_EcdsaPublicKey audience; 78 struct GNUNET_IDENTITY_PublicKey audience;
78 79
79 /** 80 /**
80 * The ticket random identifier 81 * The ticket random identifier
@@ -129,7 +130,7 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls,
129 * @param attr The attribute 130 * @param attr The attribute
130 */ 131 */
131typedef void (*GNUNET_RECLAIM_AttributeResult) ( 132typedef void (*GNUNET_RECLAIM_AttributeResult) (
132 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 133 void *cls, const struct GNUNET_IDENTITY_PublicKey *identity,
133 const struct GNUNET_RECLAIM_Attribute *attr); 134 const struct GNUNET_RECLAIM_Attribute *attr);
134 135
135/** 136/**
@@ -141,7 +142,7 @@ typedef void (*GNUNET_RECLAIM_AttributeResult) (
141 * @param presentation The presentation for the credential (may be NULL) 142 * @param presentation The presentation for the credential (may be NULL)
142 */ 143 */
143typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( 144typedef void (*GNUNET_RECLAIM_AttributeTicketResult) (
144 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 145 void *cls, const struct GNUNET_IDENTITY_PublicKey *identity,
145 const struct GNUNET_RECLAIM_Attribute *attr, 146 const struct GNUNET_RECLAIM_Attribute *attr,
146 const struct GNUNET_RECLAIM_Presentation *presentation); 147 const struct GNUNET_RECLAIM_Presentation *presentation);
147 148
@@ -155,7 +156,7 @@ typedef void (*GNUNET_RECLAIM_AttributeTicketResult) (
155 * @param attributes the parsed attributes 156 * @param attributes the parsed attributes
156 */ 157 */
157typedef void (*GNUNET_RECLAIM_CredentialResult) ( 158typedef void (*GNUNET_RECLAIM_CredentialResult) (
158 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 159 void *cls, const struct GNUNET_IDENTITY_PublicKey *identity,
159 const struct GNUNET_RECLAIM_Credential *credential); 160 const struct GNUNET_RECLAIM_Credential *credential);
160 161
161 162
@@ -184,7 +185,7 @@ GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
184struct GNUNET_RECLAIM_Operation * 185struct GNUNET_RECLAIM_Operation *
185GNUNET_RECLAIM_attribute_store ( 186GNUNET_RECLAIM_attribute_store (
186 struct GNUNET_RECLAIM_Handle *h, 187 struct GNUNET_RECLAIM_Handle *h,
187 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 188 const struct GNUNET_IDENTITY_PrivateKey *pkey,
188 const struct GNUNET_RECLAIM_Attribute *attr, 189 const struct GNUNET_RECLAIM_Attribute *attr,
189 const struct GNUNET_TIME_Relative *exp_interval, 190 const struct GNUNET_TIME_Relative *exp_interval,
190 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); 191 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
@@ -205,7 +206,7 @@ GNUNET_RECLAIM_attribute_store (
205struct GNUNET_RECLAIM_Operation * 206struct GNUNET_RECLAIM_Operation *
206GNUNET_RECLAIM_credential_store ( 207GNUNET_RECLAIM_credential_store (
207 struct GNUNET_RECLAIM_Handle *h, 208 struct GNUNET_RECLAIM_Handle *h,
208 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 209 const struct GNUNET_IDENTITY_PrivateKey *pkey,
209 const struct GNUNET_RECLAIM_Credential *credential, 210 const struct GNUNET_RECLAIM_Credential *credential,
210 const struct GNUNET_TIME_Relative *exp_interval, 211 const struct GNUNET_TIME_Relative *exp_interval,
211 GNUNET_RECLAIM_ContinuationWithStatus cont, 212 GNUNET_RECLAIM_ContinuationWithStatus cont,
@@ -226,7 +227,7 @@ GNUNET_RECLAIM_credential_store (
226struct GNUNET_RECLAIM_Operation * 227struct GNUNET_RECLAIM_Operation *
227GNUNET_RECLAIM_attribute_delete ( 228GNUNET_RECLAIM_attribute_delete (
228 struct GNUNET_RECLAIM_Handle *h, 229 struct GNUNET_RECLAIM_Handle *h,
229 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 230 const struct GNUNET_IDENTITY_PrivateKey *pkey,
230 const struct GNUNET_RECLAIM_Attribute *attr, 231 const struct GNUNET_RECLAIM_Attribute *attr,
231 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); 232 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
232 233
@@ -244,7 +245,7 @@ GNUNET_RECLAIM_attribute_delete (
244struct GNUNET_RECLAIM_Operation * 245struct GNUNET_RECLAIM_Operation *
245GNUNET_RECLAIM_credential_delete ( 246GNUNET_RECLAIM_credential_delete (
246 struct GNUNET_RECLAIM_Handle *h, 247 struct GNUNET_RECLAIM_Handle *h,
247 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 248 const struct GNUNET_IDENTITY_PrivateKey *pkey,
248 const struct GNUNET_RECLAIM_Credential *cred, 249 const struct GNUNET_RECLAIM_Credential *cred,
249 GNUNET_RECLAIM_ContinuationWithStatus cont, 250 GNUNET_RECLAIM_ContinuationWithStatus cont,
250 void *cont_cls); 251 void *cont_cls);
@@ -276,7 +277,7 @@ GNUNET_RECLAIM_credential_delete (
276struct GNUNET_RECLAIM_AttributeIterator * 277struct GNUNET_RECLAIM_AttributeIterator *
277GNUNET_RECLAIM_get_attributes_start ( 278GNUNET_RECLAIM_get_attributes_start (
278 struct GNUNET_RECLAIM_Handle *h, 279 struct GNUNET_RECLAIM_Handle *h,
279 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 280 const struct GNUNET_IDENTITY_PrivateKey *identity,
280 GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, 281 GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
281 GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, 282 GNUNET_RECLAIM_AttributeResult proc, void *proc_cls,
282 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); 283 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
@@ -332,7 +333,7 @@ GNUNET_RECLAIM_get_attributes_stop (
332struct GNUNET_RECLAIM_CredentialIterator * 333struct GNUNET_RECLAIM_CredentialIterator *
333GNUNET_RECLAIM_get_credentials_start ( 334GNUNET_RECLAIM_get_credentials_start (
334 struct GNUNET_RECLAIM_Handle *h, 335 struct GNUNET_RECLAIM_Handle *h,
335 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 336 const struct GNUNET_IDENTITY_PrivateKey *identity,
336 GNUNET_SCHEDULER_TaskCallback error_cb, 337 GNUNET_SCHEDULER_TaskCallback error_cb,
337 void *error_cb_cls, 338 void *error_cb_cls,
338 GNUNET_RECLAIM_CredentialResult proc, 339 GNUNET_RECLAIM_CredentialResult proc,
@@ -380,8 +381,8 @@ GNUNET_RECLAIM_get_credentials_stop (
380struct GNUNET_RECLAIM_Operation * 381struct GNUNET_RECLAIM_Operation *
381GNUNET_RECLAIM_ticket_issue ( 382GNUNET_RECLAIM_ticket_issue (
382 struct GNUNET_RECLAIM_Handle *h, 383 struct GNUNET_RECLAIM_Handle *h,
383 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, 384 const struct GNUNET_IDENTITY_PrivateKey *iss,
384 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, 385 const struct GNUNET_IDENTITY_PublicKey *rp,
385 const struct GNUNET_RECLAIM_AttributeList *attrs, 386 const struct GNUNET_RECLAIM_AttributeList *attrs,
386 GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls); 387 GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls);
387 388
@@ -402,7 +403,7 @@ GNUNET_RECLAIM_ticket_issue (
402struct GNUNET_RECLAIM_Operation * 403struct GNUNET_RECLAIM_Operation *
403GNUNET_RECLAIM_ticket_revoke ( 404GNUNET_RECLAIM_ticket_revoke (
404 struct GNUNET_RECLAIM_Handle *h, 405 struct GNUNET_RECLAIM_Handle *h,
405 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 406 const struct GNUNET_IDENTITY_PrivateKey *identity,
406 const struct GNUNET_RECLAIM_Ticket *ticket, 407 const struct GNUNET_RECLAIM_Ticket *ticket,
407 GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls); 408 GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls);
408 409
@@ -422,7 +423,7 @@ GNUNET_RECLAIM_ticket_revoke (
422struct GNUNET_RECLAIM_Operation * 423struct GNUNET_RECLAIM_Operation *
423GNUNET_RECLAIM_ticket_consume ( 424GNUNET_RECLAIM_ticket_consume (
424 struct GNUNET_RECLAIM_Handle *h, 425 struct GNUNET_RECLAIM_Handle *h,
425 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 426 const struct GNUNET_IDENTITY_PrivateKey *identity,
426 const struct GNUNET_RECLAIM_Ticket *ticket, 427 const struct GNUNET_RECLAIM_Ticket *ticket,
427 GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls); 428 GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls);
428 429
@@ -447,7 +448,7 @@ GNUNET_RECLAIM_ticket_consume (
447struct GNUNET_RECLAIM_TicketIterator * 448struct GNUNET_RECLAIM_TicketIterator *
448GNUNET_RECLAIM_ticket_iteration_start ( 449GNUNET_RECLAIM_ticket_iteration_start (
449 struct GNUNET_RECLAIM_Handle *h, 450 struct GNUNET_RECLAIM_Handle *h,
450 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 451 const struct GNUNET_IDENTITY_PrivateKey *identity,
451 GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, 452 GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
452 GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, 453 GNUNET_RECLAIM_TicketCallback proc, void *proc_cls,
453 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); 454 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h
index 105bb1149..18c1f2674 100644
--- a/src/include/gnunet_revocation_service.h
+++ b/src/include/gnunet_revocation_service.h
@@ -21,6 +21,8 @@
21#ifndef GNUNET_REVOCATION_SERVICE_H_ 21#ifndef GNUNET_REVOCATION_SERVICE_H_
22#define GNUNET_REVOCATION_SERVICE_H_ 22#define GNUNET_REVOCATION_SERVICE_H_
23 23
24#include "gnunet_identity_service.h"
25
24/** 26/**
25 * @author Christian Grothoff 27 * @author Christian Grothoff
26 * 28 *
@@ -51,6 +53,13 @@ extern "C"
51#define GNUNET_REVOCATION_VERSION 0x00000001 53#define GNUNET_REVOCATION_VERSION 0x00000001
52 54
53/** 55/**
56 * Maximum length of a revocation
57 */
58#define GNUNET_REVOCATION_MAX_PROOF_SIZE sizeof(struct GNUNET_REVOCATION_PowP) +\
59 sizeof(struct GNUNET_IDENTITY_PublicKey) +\
60 1024 //FIXME max sig_len
61
62/**
54 * The proof-of-work narrowing factor. 63 * The proof-of-work narrowing factor.
55 * The number of PoWs that are calculates as part of revocation. 64 * The number of PoWs that are calculates as part of revocation.
56 */ 65 */
@@ -79,22 +88,14 @@ struct GNUNET_REVOCATION_PowP
79 */ 88 */
80 uint64_t pow[POW_COUNT] GNUNET_PACKED; 89 uint64_t pow[POW_COUNT] GNUNET_PACKED;
81 90
82 /** 91 /** followed by the public key type, the key and a signature **/
83 * The signature
84 */
85 struct GNUNET_CRYPTO_EcdsaSignature signature;
86
87 /**
88 * The revoked public key
89 */
90 struct GNUNET_CRYPTO_EcdsaPublicKey key;
91}; 92};
92 93
93 94
94/** 95/**
95 * The signature object we use for the PoW 96 * The signature object we use for the PoW
96 */ 97 */
97struct GNUNET_REVOCATION_SignaturePurposePS 98struct GNUNET_REVOCATION_EcdsaSignaturePurposePS
98{ 99{
99 /** 100 /**
100 * The signature purpose 101 * The signature purpose
@@ -102,6 +103,11 @@ struct GNUNET_REVOCATION_SignaturePurposePS
102 struct GNUNET_CRYPTO_EccSignaturePurpose purpose; 103 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
103 104
104 /** 105 /**
106 * Type of the key
107 */
108 uint32_t ktype;
109
110 /**
105 * The revoked public key 111 * The revoked public key
106 */ 112 */
107 struct GNUNET_CRYPTO_EcdsaPublicKey key; 113 struct GNUNET_CRYPTO_EcdsaPublicKey key;
@@ -150,7 +156,7 @@ typedef void (*GNUNET_REVOCATION_Callback) (void *cls,
150 */ 156 */
151struct GNUNET_REVOCATION_Query * 157struct GNUNET_REVOCATION_Query *
152GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, 158GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg,
153 const struct GNUNET_CRYPTO_EcdsaPublicKey *key, 159 const struct GNUNET_IDENTITY_PublicKey *key,
154 GNUNET_REVOCATION_Callback func, void *func_cls); 160 GNUNET_REVOCATION_Callback func, void *func_cls);
155 161
156 162
@@ -217,7 +223,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
217 * @param pow the pow object to work with in the calculation. 223 * @param pow the pow object to work with in the calculation.
218 */ 224 */
219void 225void
220GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 226GNUNET_REVOCATION_pow_init (const struct GNUNET_IDENTITY_PrivateKey *key,
221 struct GNUNET_REVOCATION_PowP *pow); 227 struct GNUNET_REVOCATION_PowP *pow);
222 228
223 229
@@ -256,6 +262,10 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc);
256void 262void
257GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc); 263GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc);
258 264
265size_t
266GNUNET_REVOCATION_proof_get_size (const struct GNUNET_REVOCATION_PowP *pow);
267
268
259#if 0 /* keep Emacsens' auto-indent happy */ 269#if 0 /* keep Emacsens' auto-indent happy */
260{ 270{
261#endif 271#endif
diff --git a/src/json/Makefile.am b/src/json/Makefile.am
index 2ed05c35a..d4ea38adf 100644
--- a/src/json/Makefile.am
+++ b/src/json/Makefile.am
@@ -18,18 +18,15 @@ libgnunetjson_la_SOURCES = \
18 json.c \ 18 json.c \
19 json_mhd.c \ 19 json_mhd.c \
20 json_generator.c \ 20 json_generator.c \
21 json_helper.c \ 21 json_helper.c
22 json_gnsrecord.c
23libgnunetjson_la_LIBADD = \ 22libgnunetjson_la_LIBADD = \
24 $(top_builddir)/src/util/libgnunetutil.la \ 23 $(top_builddir)/src/util/libgnunetutil.la \
25 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
26 -ljansson \ 24 -ljansson \
27 $(MHD_LIBS) \ 25 $(MHD_LIBS) \
28 $(XLIB) \ 26 $(XLIB) \
29 $(Z_LIBS) 27 $(Z_LIBS)
30libgnunetjson_la_DEPENDENCIES = \ 28libgnunetjson_la_DEPENDENCIES = \
31 $(top_builddir)/src/util/libgnunetutil.la \ 29 $(top_builddir)/src/util/libgnunetutil.la
32 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la
33 30
34 31
35check_PROGRAMS = \ 32check_PROGRAMS = \
diff --git a/src/json/json_generator.c b/src/json/json_generator.c
index 3f82a5f17..5806eb174 100644
--- a/src/json/json_generator.c
+++ b/src/json/json_generator.c
@@ -201,113 +201,5 @@ GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig)
201} 201}
202 202
203 203
204/**
205 * Convert GNS record to JSON.
206 *
207 * @param rname name of record
208 * @param rd record data
209 * @return corresponding JSON encoding
210 */
211json_t *
212GNUNET_JSON_from_gnsrecord (const char*rname,
213 const struct GNUNET_GNSRECORD_Data *rd,
214 unsigned int rd_count)
215{
216 struct GNUNET_TIME_Absolute abs_exp;
217 struct GNUNET_TIME_Relative rel_exp;
218 const char *expiration_time_str;
219 const char *record_type_str;
220 char *value_str;
221 json_t *data;
222 json_t *record;
223 json_t *records;
224
225 data = json_object ();
226 if (NULL == data)
227 {
228 GNUNET_break (0);
229 return NULL;
230 }
231 if (0 !=
232 json_object_set_new (data,
233 "record_name",
234 json_string (rname)))
235 {
236 GNUNET_break (0);
237 json_decref (data);
238 return NULL;
239 }
240 records = json_array ();
241 if (NULL == records)
242 {
243 GNUNET_break (0);
244 json_decref (data);
245 return NULL;
246 }
247 for (int i = 0; i < rd_count; i++)
248 {
249 value_str = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
250 rd[i].data,
251 rd[i].data_size);
252 if (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION & rd[i].flags)
253 {
254 rel_exp.rel_value_us = rd[i].expiration_time;
255 expiration_time_str = GNUNET_STRINGS_relative_time_to_string (rel_exp,
256 GNUNET_NO);
257 }
258 else
259 {
260 abs_exp.abs_value_us = rd[i].expiration_time;
261 expiration_time_str = GNUNET_STRINGS_absolute_time_to_string (abs_exp);
262 }
263 record_type_str = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
264 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
265 "Packing %s %s %s %d\n",
266 value_str, record_type_str, expiration_time_str, rd[i].flags);
267 record = json_pack ("{s:s,s:s,s:s,s:b,s:b,s:b,s:b}",
268 "value",
269 value_str,
270 "record_type",
271 record_type_str,
272 "expiration_time",
273 expiration_time_str,
274 "private",
275 rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE,
276 "relative_expiration",
277 rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION,
278 "supplemental",
279 rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL,
280 "shadow",
281 rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD);
282 GNUNET_free (value_str);
283 if (NULL == record)
284 {
285 GNUNET_break (0);
286 json_decref (records);
287 json_decref (data);
288 return NULL;
289 }
290 if (0 !=
291 json_array_append_new (records,
292 record))
293 {
294 GNUNET_break (0);
295 json_decref (records);
296 json_decref (data);
297 return NULL;
298 }
299 }
300 if (0 !=
301 json_object_set_new (data,
302 "data",
303 records))
304 {
305 GNUNET_break (0);
306 json_decref (data);
307 return NULL;
308 }
309 return data;
310}
311
312 204
313/* End of json/json_generator.c */ 205/* End of json/json_generator.c */
diff --git a/src/my/my_query_helper.c b/src/my/my_query_helper.c
index 526e57b8b..97ea04fd1 100644
--- a/src/my/my_query_helper.c
+++ b/src/my/my_query_helper.c
@@ -280,14 +280,14 @@ my_conv_rsa_public_key (void *cls,
280 MYSQL_BIND *qbind) 280 MYSQL_BIND *qbind)
281{ 281{
282 const struct GNUNET_CRYPTO_RsaPublicKey *rsa = qp->data; 282 const struct GNUNET_CRYPTO_RsaPublicKey *rsa = qp->data;
283 char *buf; 283 void *buf;
284 size_t buf_size; 284 size_t buf_size;
285 285
286 (void) cls; 286 (void) cls;
287 GNUNET_assert (1 == qp->num_params); 287 GNUNET_assert (1 == qp->num_params);
288 buf_size = GNUNET_CRYPTO_rsa_public_key_encode (rsa, 288 buf_size = GNUNET_CRYPTO_rsa_public_key_encode (rsa,
289 &buf); 289 &buf);
290 qbind->buffer = (void *) buf; 290 qbind->buffer = buf;
291 qbind->buffer_length = buf_size; 291 qbind->buffer_length = buf_size;
292 qbind->buffer_type = MYSQL_TYPE_BLOB; 292 qbind->buffer_type = MYSQL_TYPE_BLOB;
293 return 1; 293 return 1;
@@ -332,14 +332,14 @@ my_conv_rsa_signature (void *cls,
332 MYSQL_BIND *qbind) 332 MYSQL_BIND *qbind)
333{ 333{
334 const struct GNUNET_CRYPTO_RsaSignature *sig = qp->data; 334 const struct GNUNET_CRYPTO_RsaSignature *sig = qp->data;
335 char *buf; 335 void *buf;
336 size_t buf_size; 336 size_t buf_size;
337 337
338 (void) cls; 338 (void) cls;
339 GNUNET_assert (1 == qp->num_params); 339 GNUNET_assert (1 == qp->num_params);
340 buf_size = GNUNET_CRYPTO_rsa_signature_encode (sig, 340 buf_size = GNUNET_CRYPTO_rsa_signature_encode (sig,
341 &buf); 341 &buf);
342 qbind->buffer = (void *) buf; 342 qbind->buffer = buf;
343 qbind->buffer_length = buf_size; 343 qbind->buffer_length = buf_size;
344 qbind->buffer_type = MYSQL_TYPE_BLOB; 344 qbind->buffer_type = MYSQL_TYPE_BLOB;
345 return 1; 345 return 1;
diff --git a/src/namecache/Makefile.am b/src/namecache/Makefile.am
index 5e80ea4c5..836a6b5d9 100644
--- a/src/namecache/Makefile.am
+++ b/src/namecache/Makefile.am
@@ -65,6 +65,7 @@ libgnunetnamecache_la_SOURCES = \
65 namecache.h 65 namecache.h
66libgnunetnamecache_la_LIBADD = \ 66libgnunetnamecache_la_LIBADD = \
67 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 67 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
68 $(top_builddir)/src/identity/libgnunetidentity.la \
68 $(top_builddir)/src/util/libgnunetutil.la \ 69 $(top_builddir)/src/util/libgnunetutil.la \
69 $(GN_LIBINTL) 70 $(GN_LIBINTL)
70libgnunetnamecache_la_LDFLAGS = \ 71libgnunetnamecache_la_LDFLAGS = \
@@ -82,6 +83,7 @@ gnunet_namecache_SOURCES = \
82 gnunet-namecache.c 83 gnunet-namecache.c
83gnunet_namecache_LDADD = \ 84gnunet_namecache_LDADD = \
84 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 85 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
86 $(top_builddir)/src/identity/libgnunetidentity.la \
85 $(top_builddir)/src/util/libgnunetutil.la \ 87 $(top_builddir)/src/util/libgnunetutil.la \
86 libgnunetnamecache.la \ 88 libgnunetnamecache.la \
87 $(GN_LIBINTL) 89 $(GN_LIBINTL)
@@ -91,6 +93,7 @@ gnunet_service_namecache_SOURCES = \
91 93
92gnunet_service_namecache_LDADD = \ 94gnunet_service_namecache_LDADD = \
93 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 95 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
96 $(top_builddir)/src/identity/libgnunetidentity.la \
94 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 97 $(top_builddir)/src/statistics/libgnunetstatistics.la \
95 $(top_builddir)/src/util/libgnunetutil.la \ 98 $(top_builddir)/src/util/libgnunetutil.la \
96 libgnunetnamecache.la \ 99 libgnunetnamecache.la \
@@ -107,6 +110,8 @@ libgnunet_plugin_namecache_flat_la_SOURCES = \
107libgnunet_plugin_namecache_flat_la_LIBADD = \ 110libgnunet_plugin_namecache_flat_la_LIBADD = \
108 libgnunetnamecache.la \ 111 libgnunetnamecache.la \
109 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 112 $(top_builddir)/src/statistics/libgnunetstatistics.la \
113 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
114 $(top_builddir)/src/identity/libgnunetidentity.la \
110 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ 115 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
111 $(LTLIBINTL) 116 $(LTLIBINTL)
112libgnunet_plugin_namecache_flat_la_LDFLAGS = \ 117libgnunet_plugin_namecache_flat_la_LDFLAGS = \
@@ -118,6 +123,8 @@ libgnunet_plugin_namecache_sqlite_la_LIBADD = \
118 libgnunetnamecache.la \ 123 libgnunetnamecache.la \
119 $(top_builddir)/src/sq/libgnunetsq.la \ 124 $(top_builddir)/src/sq/libgnunetsq.la \
120 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 125 $(top_builddir)/src/statistics/libgnunetstatistics.la \
126 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
127 $(top_builddir)/src/identity/libgnunetidentity.la \
121 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ 128 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
122 $(LTLIBINTL) 129 $(LTLIBINTL)
123libgnunet_plugin_namecache_sqlite_la_LDFLAGS = \ 130libgnunet_plugin_namecache_sqlite_la_LDFLAGS = \
@@ -130,6 +137,8 @@ libgnunet_plugin_namecache_postgres_la_LIBADD = \
130 libgnunetnamecache.la \ 137 libgnunetnamecache.la \
131 $(top_builddir)/src/pq/libgnunetpq.la \ 138 $(top_builddir)/src/pq/libgnunetpq.la \
132 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 139 $(top_builddir)/src/statistics/libgnunetstatistics.la \
140 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
141 $(top_builddir)/src/identity/libgnunetidentity.la \
133 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lpq \ 142 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lpq \
134 $(LTLIBINTL) 143 $(LTLIBINTL)
135libgnunet_plugin_namecache_postgres_la_LDFLAGS = \ 144libgnunet_plugin_namecache_postgres_la_LDFLAGS = \
diff --git a/src/namecache/gnunet-namecache.c b/src/namecache/gnunet-namecache.c
index 2e3c733e6..19f2a5766 100644
--- a/src/namecache/gnunet-namecache.c
+++ b/src/namecache/gnunet-namecache.c
@@ -51,7 +51,7 @@ static char *name;
51/** 51/**
52 * Public key of the zone to look in. 52 * Public key of the zone to look in.
53 */ 53 */
54static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 54static struct GNUNET_IDENTITY_PublicKey pubkey;
55 55
56/** 56/**
57 * Public key of the zone to look in, in ASCII. 57 * Public key of the zone to look in, in ASCII.
@@ -177,7 +177,7 @@ run (void *cls,
177 } 177 }
178 178
179 if (GNUNET_OK != 179 if (GNUNET_OK !=
180 GNUNET_CRYPTO_ecdsa_public_key_from_string (pkey, strlen (pkey), &pubkey)) 180 GNUNET_IDENTITY_public_key_from_string (pkey, &pubkey))
181 { 181 {
182 fprintf (stderr, _ ("Invalid public key for zone `%s'\n"), pkey); 182 fprintf (stderr, _ ("Invalid public key for zone `%s'\n"), pkey);
183 GNUNET_SCHEDULER_shutdown (); 183 GNUNET_SCHEDULER_shutdown ();
diff --git a/src/namecache/gnunet-service-namecache.c b/src/namecache/gnunet-service-namecache.c
index 7cf216ce3..07bf30de9 100644
--- a/src/namecache/gnunet-service-namecache.c
+++ b/src/namecache/gnunet-service-namecache.c
@@ -184,40 +184,24 @@ handle_lookup_block_it (void *cls,
184 struct LookupBlockContext *lnc = cls; 184 struct LookupBlockContext *lnc = cls;
185 struct GNUNET_MQ_Envelope *env; 185 struct GNUNET_MQ_Envelope *env;
186 struct LookupBlockResponseMessage *r; 186 struct LookupBlockResponseMessage *r;
187 size_t esize;
188 size_t bsize; 187 size_t bsize;
189 188
190 bsize = ntohl (block->purpose.size); 189 bsize = GNUNET_GNSRECORD_block_get_size (block);
191 if (bsize <
192 (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof(struct
193 GNUNET_TIME_AbsoluteNBO)))
194 {
195 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
196 "Malformed block.");
197 lnc->status = GNUNET_SYSERR;
198 return;
199 }
200 esize = ntohl (block->purpose.size)
201 - sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
202 - sizeof(struct GNUNET_TIME_AbsoluteNBO);
203 env = GNUNET_MQ_msg_extra (r, 190 env = GNUNET_MQ_msg_extra (r,
204 esize, 191 bsize,
205 GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK_RESPONSE); 192 GNUNET_MESSAGE_TYPE_NAMECACHE_LOOKUP_BLOCK_RESPONSE);
206 r->gns_header.r_id = htonl (lnc->request_id); 193 r->gns_header.r_id = htonl (lnc->request_id);
207 r->expire = block->expiration_time;
208 r->signature = block->signature;
209 r->derived_key = block->derived_key;
210 GNUNET_memcpy (&r[1], 194 GNUNET_memcpy (&r[1],
211 &block[1], 195 block,
212 esize); 196 bsize);
213 GNUNET_STATISTICS_update (statistics, 197 GNUNET_STATISTICS_update (statistics,
214 "blocks found in cache", 198 "blocks found in cache",
215 1, 199 1,
216 GNUNET_NO); 200 GNUNET_NO);
201 r->expire = GNUNET_TIME_absolute_hton (
202 GNUNET_GNSRECORD_block_get_expiration (block));
217 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
218 "Sending NAMECACHE_LOOKUP_BLOCK_RESPONSE message with expiration time %s\n", 204 "Sending NAMECACHE_LOOKUP_BLOCK_RESPONSE message\n");
219 GNUNET_STRINGS_absolute_time_to_string (
220 GNUNET_TIME_absolute_ntoh (r->expire)));
221 GNUNET_MQ_send (lnc->nc->mq, 205 GNUNET_MQ_send (lnc->nc->mq,
222 env); 206 env);
223} 207}
@@ -314,20 +298,11 @@ handle_block_cache (void *cls,
314 GNUNET_NO); 298 GNUNET_NO);
315 esize = ntohs (rp_msg->gns_header.header.size) - sizeof(struct 299 esize = ntohs (rp_msg->gns_header.header.size) - sizeof(struct
316 BlockCacheMessage); 300 BlockCacheMessage);
317 block = GNUNET_malloc (sizeof(struct GNUNET_GNSRECORD_Block) + esize); 301 block = GNUNET_malloc (esize);
318 block->signature = rp_msg->signature; 302 memcpy (block, &rp_msg[1], esize);
319 block->derived_key = rp_msg->derived_key;
320 block->purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
321 + sizeof(struct GNUNET_TIME_AbsoluteNBO)
322 + esize);
323 block->expiration_time = rp_msg->expire;
324 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
325 "Received NAMECACHE_BLOCK_CACHE message with expiration time %s\n", 304 "Received NAMECACHE_BLOCK_CACHE message with type %u\n",
326 GNUNET_STRINGS_absolute_time_to_string ( 305 htonl (block->type));
327 GNUNET_TIME_absolute_ntoh (block->expiration_time)));
328 GNUNET_memcpy (&block[1],
329 &rp_msg[1],
330 esize);
331 res = GSN_database->cache_block (GSN_database->cls, 306 res = GSN_database->cache_block (GSN_database->cls,
332 block); 307 block);
333 GNUNET_free (block); 308 GNUNET_free (block);
diff --git a/src/namecache/namecache.h b/src/namecache/namecache.h
index 1657662c2..43c8cf85f 100644
--- a/src/namecache/namecache.h
+++ b/src/namecache/namecache.h
@@ -92,7 +92,7 @@ struct LookupBlockResponseMessage
92 /** 92 /**
93 * Derived public key. 93 * Derived public key.
94 */ 94 */
95 struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; 95 struct GNUNET_IDENTITY_PublicKey derived_key;
96 96
97 /* follwed by encrypted block data */ 97 /* follwed by encrypted block data */
98}; 98};
@@ -121,7 +121,7 @@ struct BlockCacheMessage
121 /** 121 /**
122 * Derived public key. 122 * Derived public key.
123 */ 123 */
124 struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; 124 struct GNUNET_IDENTITY_PublicKey derived_key;
125 125
126 /* follwed by encrypted block data */ 126 /* follwed by encrypted block data */
127}; 127};
diff --git a/src/namecache/namecache_api.c b/src/namecache/namecache_api.c
index 0c904c9ed..fdbf142a7 100644
--- a/src/namecache/namecache_api.c
+++ b/src/namecache/namecache_api.c
@@ -225,19 +225,11 @@ handle_lookup_block_response (void *cls,
225 size = ntohs (msg->gns_header.header.size) 225 size = ntohs (msg->gns_header.header.size)
226 - sizeof(struct LookupBlockResponseMessage); 226 - sizeof(struct LookupBlockResponseMessage);
227 { 227 {
228 char buf[size + sizeof(struct GNUNET_GNSRECORD_Block)] GNUNET_ALIGN; 228 char buf[size] GNUNET_ALIGN;
229 struct GNUNET_GNSRECORD_Block *block; 229 struct GNUNET_GNSRECORD_Block *block;
230 230
231 block = (struct GNUNET_GNSRECORD_Block *) buf; 231 block = (struct GNUNET_GNSRECORD_Block *) buf;
232 block->signature = msg->signature; 232 GNUNET_memcpy (block,
233 block->derived_key = msg->derived_key;
234 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
235 block->purpose.size = htonl (size
236 + sizeof(struct GNUNET_TIME_AbsoluteNBO)
237 + sizeof(struct
238 GNUNET_CRYPTO_EccSignaturePurpose));
239 block->expiration_time = msg->expire;
240 GNUNET_memcpy (&block[1],
241 &msg[1], 233 &msg[1],
242 size); 234 size);
243 if (GNUNET_OK != 235 if (GNUNET_OK !=
@@ -483,11 +475,7 @@ GNUNET_NAMECACHE_block_cache (struct GNUNET_NAMECACHE_Handle *h,
483 475
484 if (NULL == h->mq) 476 if (NULL == h->mq)
485 return NULL; 477 return NULL;
486 blen = ntohl (block->purpose.size); 478 blen = GNUNET_GNSRECORD_block_get_size (block);
487 GNUNET_assert (blen > (sizeof(struct GNUNET_TIME_AbsoluteNBO)
488 + sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)));
489 blen -= (sizeof(struct GNUNET_TIME_AbsoluteNBO)
490 + sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose));
491 rid = get_op_id (h); 479 rid = get_op_id (h);
492 qe = GNUNET_new (struct GNUNET_NAMECACHE_QueueEntry); 480 qe = GNUNET_new (struct GNUNET_NAMECACHE_QueueEntry);
493 qe->nsh = h; 481 qe->nsh = h;
@@ -502,11 +490,8 @@ GNUNET_NAMECACHE_block_cache (struct GNUNET_NAMECACHE_Handle *h,
502 blen, 490 blen,
503 GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE); 491 GNUNET_MESSAGE_TYPE_NAMECACHE_BLOCK_CACHE);
504 msg->gns_header.r_id = htonl (rid); 492 msg->gns_header.r_id = htonl (rid);
505 msg->expire = block->expiration_time;
506 msg->signature = block->signature;
507 msg->derived_key = block->derived_key;
508 GNUNET_memcpy (&msg[1], 493 GNUNET_memcpy (&msg[1],
509 &block[1], 494 block,
510 blen); 495 blen);
511 GNUNET_MQ_send (h->mq, 496 GNUNET_MQ_send (h->mq,
512 env); 497 env);
diff --git a/src/namecache/plugin_namecache_flat.c b/src/namecache/plugin_namecache_flat.c
index 24f4f2570..eb7800051 100644
--- a/src/namecache/plugin_namecache_flat.c
+++ b/src/namecache/plugin_namecache_flat.c
@@ -207,10 +207,7 @@ store_and_free_entries (void *cls,
207 struct GNUNET_CRYPTO_HashAsciiEncoded query; 207 struct GNUNET_CRYPTO_HashAsciiEncoded query;
208 size_t block_size; 208 size_t block_size;
209 209
210 block_size = ntohl (entry->block->purpose.size) 210 block_size = GNUNET_GNSRECORD_block_get_size (entry->block);
211 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
212 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature);
213
214 GNUNET_STRINGS_base64_encode ((char *) entry->block, 211 GNUNET_STRINGS_base64_encode ((char *) entry->block,
215 block_size, 212 block_size,
216 &block_b64); 213 &block_b64);
@@ -277,7 +274,7 @@ expire_blocks (void *cls,
277 struct GNUNET_TIME_Absolute expiration; 274 struct GNUNET_TIME_Absolute expiration;
278 275
279 now = GNUNET_TIME_absolute_get (); 276 now = GNUNET_TIME_absolute_get ();
280 expiration = GNUNET_TIME_absolute_ntoh (entry->block->expiration_time); 277 expiration = GNUNET_GNSRECORD_block_get_expiration (entry->block);
281 278
282 if (0 == GNUNET_TIME_absolute_get_difference (now, 279 if (0 == GNUNET_TIME_absolute_get_difference (now,
283 expiration).rel_value_us) 280 expiration).rel_value_us)
@@ -319,12 +316,9 @@ namecache_cache_block (void *cls,
319 size_t block_size; 316 size_t block_size;
320 317
321 namecache_expire_blocks (plugin); 318 namecache_expire_blocks (plugin);
322 GNUNET_CRYPTO_hash (&block->derived_key, 319 GNUNET_GNSRECORD_query_from_block (block,
323 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 320 &query);
324 &query); 321 block_size = GNUNET_GNSRECORD_block_get_size (block);
325 block_size = ntohl (block->purpose.size)
326 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
327 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature);
328 if (block_size > 64 * 65536) 322 if (block_size > 64 * 65536)
329 { 323 {
330 GNUNET_break (0); 324 GNUNET_break (0);
diff --git a/src/namecache/plugin_namecache_postgres.c b/src/namecache/plugin_namecache_postgres.c
index 654a3ae81..ae0f71a1f 100644
--- a/src/namecache/plugin_namecache_postgres.c
+++ b/src/namecache/plugin_namecache_postgres.c
@@ -153,11 +153,11 @@ namecache_postgres_expire_blocks (struct Plugin *plugin)
153static void 153static void
154delete_old_block (struct Plugin *plugin, 154delete_old_block (struct Plugin *plugin,
155 const struct GNUNET_HashCode *query, 155 const struct GNUNET_HashCode *query,
156 struct GNUNET_TIME_AbsoluteNBO expiration_time) 156 struct GNUNET_TIME_Absolute expiration_time)
157{ 157{
158 struct GNUNET_PQ_QueryParam params[] = { 158 struct GNUNET_PQ_QueryParam params[] = {
159 GNUNET_PQ_query_param_auto_from_type (query), 159 GNUNET_PQ_query_param_auto_from_type (query),
160 GNUNET_PQ_query_param_absolute_time_nbo (&expiration_time), 160 GNUNET_PQ_query_param_absolute_time (&expiration_time),
161 GNUNET_PQ_query_param_end 161 GNUNET_PQ_query_param_end
162 }; 162 };
163 enum GNUNET_DB_QueryStatus res; 163 enum GNUNET_DB_QueryStatus res;
@@ -182,21 +182,20 @@ namecache_postgres_cache_block (void *cls,
182{ 182{
183 struct Plugin *plugin = cls; 183 struct Plugin *plugin = cls;
184 struct GNUNET_HashCode query; 184 struct GNUNET_HashCode query;
185 size_t block_size = ntohl (block->purpose.size) 185 size_t block_size = GNUNET_GNSRECORD_block_get_size (block);
186 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) 186 struct GNUNET_TIME_Absolute exp;
187 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature); 187 exp = GNUNET_GNSRECORD_block_get_expiration (block);
188 struct GNUNET_PQ_QueryParam params[] = { 188 struct GNUNET_PQ_QueryParam params[] = {
189 GNUNET_PQ_query_param_auto_from_type (&query), 189 GNUNET_PQ_query_param_auto_from_type (&query),
190 GNUNET_PQ_query_param_fixed_size (block, block_size), 190 GNUNET_PQ_query_param_fixed_size (block, block_size),
191 GNUNET_PQ_query_param_absolute_time_nbo (&block->expiration_time), 191 GNUNET_PQ_query_param_absolute_time (&exp),
192 GNUNET_PQ_query_param_end 192 GNUNET_PQ_query_param_end
193 }; 193 };
194 enum GNUNET_DB_QueryStatus res; 194 enum GNUNET_DB_QueryStatus res;
195 195
196 namecache_postgres_expire_blocks (plugin); 196 namecache_postgres_expire_blocks (plugin);
197 GNUNET_CRYPTO_hash (&block->derived_key, 197 GNUNET_GNSRECORD_query_from_block (block,
198 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 198 &query);
199 &query);
200 if (block_size > 64 * 65536) 199 if (block_size > 64 * 65536)
201 { 200 {
202 GNUNET_break (0); 201 GNUNET_break (0);
@@ -204,7 +203,7 @@ namecache_postgres_cache_block (void *cls,
204 } 203 }
205 delete_old_block (plugin, 204 delete_old_block (plugin,
206 &query, 205 &query,
207 block->expiration_time); 206 exp);
208 207
209 res = GNUNET_PQ_eval_prepared_non_select (plugin->dbh, 208 res = GNUNET_PQ_eval_prepared_non_select (plugin->dbh,
210 "cache_block", 209 "cache_block",
@@ -263,10 +262,7 @@ namecache_postgres_lookup_block (void *cls,
263 "Ending iteration (no more results)\n"); 262 "Ending iteration (no more results)\n");
264 return GNUNET_NO; 263 return GNUNET_NO;
265 } 264 }
266 if ((bsize < sizeof(*block)) || 265 if ((bsize < sizeof(*block)))
267 (bsize != ntohl (block->purpose.size)
268 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
269 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature)))
270 { 266 {
271 GNUNET_break (0); 267 GNUNET_break (0);
272 LOG (GNUNET_ERROR_TYPE_DEBUG, 268 LOG (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/namecache/plugin_namecache_sqlite.c b/src/namecache/plugin_namecache_sqlite.c
index c9d79ba2d..82008c837 100644
--- a/src/namecache/plugin_namecache_sqlite.c
+++ b/src/namecache/plugin_namecache_sqlite.c
@@ -332,9 +332,7 @@ namecache_sqlite_cache_block (void *cls,
332 struct Plugin *plugin = cls; 332 struct Plugin *plugin = cls;
333 struct GNUNET_HashCode query; 333 struct GNUNET_HashCode query;
334 struct GNUNET_TIME_Absolute expiration; 334 struct GNUNET_TIME_Absolute expiration;
335 size_t block_size = ntohl (block->purpose.size) 335 size_t block_size = GNUNET_GNSRECORD_block_get_size (block);
336 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
337 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature);
338 struct GNUNET_SQ_QueryParam del_params[] = { 336 struct GNUNET_SQ_QueryParam del_params[] = {
339 GNUNET_SQ_query_param_auto_from_type (&query), 337 GNUNET_SQ_query_param_auto_from_type (&query),
340 GNUNET_SQ_query_param_absolute_time (&expiration), 338 GNUNET_SQ_query_param_absolute_time (&expiration),
@@ -356,10 +354,9 @@ namecache_sqlite_cache_block (void *cls,
356 last_expire = GNUNET_TIME_absolute_get (); 354 last_expire = GNUNET_TIME_absolute_get ();
357 namecache_sqlite_expire_blocks (plugin); 355 namecache_sqlite_expire_blocks (plugin);
358 } 356 }
359 GNUNET_CRYPTO_hash (&block->derived_key, 357 GNUNET_assert (GNUNET_OK ==
360 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 358 GNUNET_GNSRECORD_query_from_block (block, &query));
361 &query); 359 expiration = GNUNET_GNSRECORD_block_get_expiration (block);
362 expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time);
363 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 360 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
364 "Caching new version of block %s (expires %s)\n", 361 "Caching new version of block %s (expires %s)\n",
365 GNUNET_h2s (&query), 362 GNUNET_h2s (&query),
@@ -498,10 +495,7 @@ namecache_sqlite_lookup_block (void *cls,
498 GNUNET_break (0); 495 GNUNET_break (0);
499 ret = GNUNET_SYSERR; 496 ret = GNUNET_SYSERR;
500 } 497 }
501 else if ((block_size < sizeof(struct GNUNET_GNSRECORD_Block)) || 498 else if ((block_size < sizeof(struct GNUNET_GNSRECORD_Block)))
502 (ntohl (block->purpose.size)
503 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
504 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature) != block_size))
505 { 499 {
506 GNUNET_break (0); 500 GNUNET_break (0);
507 GNUNET_SQ_cleanup_result (rs); 501 GNUNET_SQ_cleanup_result (rs);
diff --git a/src/namecache/test_namecache_api_cache_block.c b/src/namecache/test_namecache_api_cache_block.c
index 12b72d93b..310c4de42 100644
--- a/src/namecache/test_namecache_api_cache_block.c
+++ b/src/namecache/test_namecache_api_cache_block.c
@@ -39,9 +39,9 @@ static struct GNUNET_NAMECACHE_Handle *nsh;
39 39
40static struct GNUNET_SCHEDULER_Task *endbadly_task; 40static struct GNUNET_SCHEDULER_Task *endbadly_task;
41 41
42static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 42static struct GNUNET_IDENTITY_PrivateKey privkey;
43 43
44static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 44static struct GNUNET_IDENTITY_PublicKey pubkey;
45 45
46static int res; 46static int res;
47 47
@@ -172,23 +172,13 @@ run (void *cls,
172{ 172{
173 struct GNUNET_GNSRECORD_Data rd; 173 struct GNUNET_GNSRECORD_Data rd;
174 struct GNUNET_GNSRECORD_Block *block; 174 struct GNUNET_GNSRECORD_Block *block;
175 char *hostkey_file;
176 const char *name = "dummy.dummy.gnunet"; 175 const char *name = "dummy.dummy.gnunet";
177 176
178 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 177 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
179 &endbadly, NULL); 178 &endbadly, NULL);
180 GNUNET_asprintf (&hostkey_file, 179 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
181 "zonefiles%s%s", 180 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
182 DIR_SEPARATOR_STR, 181 GNUNET_IDENTITY_key_get_public (&privkey, &pubkey);
183 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
184 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n",
185 hostkey_file);
186 GNUNET_assert (GNUNET_SYSERR !=
187 GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file,
188 GNUNET_YES,
189 &privkey));
190 GNUNET_free (hostkey_file);
191 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey);
192 182
193 183
194 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 10000000000; 184 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 10000000000;
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index 40ac64197..3a92f98c9 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -131,6 +131,7 @@ libgnunet_plugin_rest_namestore_la_LIBADD = \
131 $(top_builddir)/src/identity/libgnunetidentity.la \ 131 $(top_builddir)/src/identity/libgnunetidentity.la \
132 $(top_builddir)/src/json/libgnunetjson.la \ 132 $(top_builddir)/src/json/libgnunetjson.la \
133 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 133 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
134 $(top_builddir)/src/gnsrecord/libgnunetgnsrecordjson.la \
134 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ 135 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
135 $(LTLIBINTL) -ljansson $(MHD_LIBS) 136 $(LTLIBINTL) -ljansson $(MHD_LIBS)
136libgnunet_plugin_rest_namestore_la_LDFLAGS = \ 137libgnunet_plugin_rest_namestore_la_LDFLAGS = \
@@ -144,6 +145,7 @@ libgnunetnamestore_la_SOURCES = \
144 namestore.h 145 namestore.h
145libgnunetnamestore_la_LIBADD = \ 146libgnunetnamestore_la_LIBADD = \
146 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 147 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
148 $(top_builddir)/src/identity/libgnunetidentity.la \
147 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 149 $(top_builddir)/src/statistics/libgnunetstatistics.la \
148 $(top_builddir)/src/util/libgnunetutil.la \ 150 $(top_builddir)/src/util/libgnunetutil.la \
149 $(GN_LIBINTL) 151 $(GN_LIBINTL)
@@ -190,6 +192,7 @@ gnunet_service_namestore_SOURCES = \
190gnunet_service_namestore_LDADD = \ 192gnunet_service_namestore_LDADD = \
191 $(top_builddir)/src/namecache/libgnunetnamecache.la \ 193 $(top_builddir)/src/namecache/libgnunetnamecache.la \
192 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 194 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
195 $(top_builddir)/src/identity/libgnunetidentity.la \
193 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 196 $(top_builddir)/src/statistics/libgnunetstatistics.la \
194 $(top_builddir)/src/util/libgnunetutil.la \ 197 $(top_builddir)/src/util/libgnunetutil.la \
195 libgnunetnamestore.la \ 198 libgnunetnamestore.la \
@@ -200,7 +203,8 @@ gnunet_service_namestore_LDADD = \
200libgnunet_plugin_namestore_flat_la_SOURCES = \ 203libgnunet_plugin_namestore_flat_la_SOURCES = \
201 plugin_namestore_flat.c 204 plugin_namestore_flat.c
202libgnunet_plugin_namestore_flat_la_LIBADD = \ 205libgnunet_plugin_namestore_flat_la_LIBADD = \
203 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 206 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
207 $(top_builddir)/src/identity/libgnunetidentity.la \
204 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 208 $(top_builddir)/src/statistics/libgnunetstatistics.la \
205 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ 209 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
206 $(LTLIBINTL) 210 $(LTLIBINTL)
@@ -212,6 +216,7 @@ libgnunet_plugin_namestore_sqlite_la_SOURCES = \
212 plugin_namestore_sqlite.c 216 plugin_namestore_sqlite.c
213libgnunet_plugin_namestore_sqlite_la_LIBADD = \ 217libgnunet_plugin_namestore_sqlite_la_LIBADD = \
214 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 218 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
219 $(top_builddir)/src/identity/libgnunetidentity.la \
215 $(top_builddir)/src/sq/libgnunetsq.la \ 220 $(top_builddir)/src/sq/libgnunetsq.la \
216 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 221 $(top_builddir)/src/statistics/libgnunetstatistics.la \
217 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ 222 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
@@ -223,6 +228,7 @@ libgnunet_plugin_namestore_postgres_la_SOURCES = \
223 plugin_namestore_postgres.c 228 plugin_namestore_postgres.c
224libgnunet_plugin_namestore_postgres_la_LIBADD = \ 229libgnunet_plugin_namestore_postgres_la_LIBADD = \
225 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 230 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
231 $(top_builddir)/src/identity/libgnunetidentity.la \
226 $(top_builddir)/src/pq/libgnunetpq.la \ 232 $(top_builddir)/src/pq/libgnunetpq.la \
227 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 233 $(top_builddir)/src/statistics/libgnunetstatistics.la \
228 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lpq \ 234 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lpq \
@@ -236,6 +242,7 @@ test_namestore_api_store_flat_LDADD = \
236 $(top_builddir)/src/testing/libgnunettesting.la \ 242 $(top_builddir)/src/testing/libgnunettesting.la \
237 $(top_builddir)/src/util/libgnunetutil.la \ 243 $(top_builddir)/src/util/libgnunetutil.la \
238 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 244 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
245 $(top_builddir)/src/identity/libgnunetidentity.la \
239 libgnunetnamestore.la 246 libgnunetnamestore.la
240 247
241test_namestore_api_store_sqlite_SOURCES = \ 248test_namestore_api_store_sqlite_SOURCES = \
@@ -244,6 +251,7 @@ test_namestore_api_store_sqlite_LDADD = \
244 $(top_builddir)/src/testing/libgnunettesting.la \ 251 $(top_builddir)/src/testing/libgnunettesting.la \
245 $(top_builddir)/src/util/libgnunetutil.la \ 252 $(top_builddir)/src/util/libgnunetutil.la \
246 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 253 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
254 $(top_builddir)/src/identity/libgnunetidentity.la \
247 libgnunetnamestore.la 255 libgnunetnamestore.la
248 256
249test_namestore_api_store_postgres_SOURCES = \ 257test_namestore_api_store_postgres_SOURCES = \
@@ -252,6 +260,7 @@ test_namestore_api_store_postgres_LDADD = \
252 $(top_builddir)/src/testing/libgnunettesting.la \ 260 $(top_builddir)/src/testing/libgnunettesting.la \
253 $(top_builddir)/src/util/libgnunetutil.la \ 261 $(top_builddir)/src/util/libgnunetutil.la \
254 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 262 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
263 $(top_builddir)/src/identity/libgnunetidentity.la \
255 libgnunetnamestore.la 264 libgnunetnamestore.la
256 265
257test_namestore_api_store_update_flat_SOURCES = \ 266test_namestore_api_store_update_flat_SOURCES = \
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index 34641d22e..844f4a990 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -164,7 +164,7 @@ struct Request
164 */ 164 */
165 char public_key[128]; 165 char public_key[128];
166 166
167 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 167 struct GNUNET_IDENTITY_PublicKey pub;
168}; 168};
169 169
170/** 170/**
@@ -211,7 +211,7 @@ static struct GNUNET_NAMESTORE_Handle *ns;
211/** 211/**
212 * Private key for the fcfsd zone. 212 * Private key for the fcfsd zone.
213 */ 213 */
214static struct GNUNET_CRYPTO_EcdsaPrivateKey fcfs_zone_pkey; 214static struct GNUNET_IDENTITY_PrivateKey fcfs_zone_pkey;
215 215
216/** 216/**
217 * Connection to identity service. 217 * Connection to identity service.
@@ -306,7 +306,6 @@ zone_iteration_end (void *cls)
306 /* return static form */ 306 /* return static form */
307 GNUNET_asprintf (&full_page, 307 GNUNET_asprintf (&full_page,
308 ZONEINFO_PAGE, 308 ZONEINFO_PAGE,
309 zr->zoneinfo,
310 zr->zoneinfo); 309 zr->zoneinfo);
311 response = MHD_create_response_from_buffer (strlen (full_page), 310 response = MHD_create_response_from_buffer (strlen (full_page),
312 (void *) full_page, 311 (void *) full_page,
@@ -332,7 +331,7 @@ zone_iteration_end (void *cls)
332 */ 331 */
333static void 332static void
334iterate_cb (void *cls, 333iterate_cb (void *cls,
335 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 334 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
336 const char *name, 335 const char *name,
337 unsigned int rd_len, 336 unsigned int rd_len,
338 const struct GNUNET_GNSRECORD_Data *rd) 337 const struct GNUNET_GNSRECORD_Data *rd)
@@ -615,7 +614,7 @@ zone_to_name_error (void *cls)
615 */ 614 */
616static void 615static void
617zone_to_name_cb (void *cls, 616zone_to_name_cb (void *cls,
618 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 617 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
619 const char *name, 618 const char *name,
620 unsigned int rd_count, 619 unsigned int rd_count,
621 const struct GNUNET_GNSRECORD_Data *rd) 620 const struct GNUNET_GNSRECORD_Data *rd)
@@ -677,7 +676,7 @@ lookup_it_error (void *cls)
677 */ 676 */
678static void 677static void
679lookup_it_processor (void *cls, 678lookup_it_processor (void *cls,
680 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zonekey, 679 const struct GNUNET_IDENTITY_PrivateKey *zonekey,
681 const char *label, 680 const char *label,
682 unsigned int rd_count, 681 unsigned int rd_count,
683 const struct GNUNET_GNSRECORD_Data *rd) 682 const struct GNUNET_GNSRECORD_Data *rd)
@@ -712,9 +711,8 @@ lookup_it_finished (void *cls)
712 return; 711 return;
713 } 712 }
714 if (GNUNET_OK != 713 if (GNUNET_OK !=
715 GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, 714 GNUNET_IDENTITY_public_key_from_string (request->public_key,
716 strlen (request->public_key), 715 &request->pub))
717 &request->pub))
718 { 716 {
719 GNUNET_break (0); 717 GNUNET_break (0);
720 request->phase = RP_FAIL; 718 request->phase = RP_FAIL;
@@ -767,7 +765,7 @@ create_response (void *cls,
767{ 765{
768 struct MHD_Response *response; 766 struct MHD_Response *response;
769 struct Request *request; 767 struct Request *request;
770 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 768 struct GNUNET_IDENTITY_PublicKey pub;
771 MHD_RESULT ret; 769 MHD_RESULT ret;
772 770
773 (void) cls; 771 (void) cls;
@@ -822,10 +820,8 @@ create_response (void *cls,
822 request->pp = NULL; 820 request->pp = NULL;
823 } 821 }
824 if (GNUNET_OK != 822 if (GNUNET_OK !=
825 GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, 823 GNUNET_IDENTITY_public_key_from_string (request->public_key,
826 strlen ( 824 &pub))
827 request->public_key),
828 &pub))
829 { 825 {
830 /* parse error */ 826 /* parse error */
831 return fill_s_reply ("Failed to parse given public key", 827 return fill_s_reply ("Failed to parse given public key",
@@ -1211,7 +1207,8 @@ main (int argc,
1211 options, 1207 options,
1212 &run, NULL)) ? 0 : 1; 1208 &run, NULL)) ? 0 : 1;
1213 GNUNET_free_nz ((void *) argv); 1209 GNUNET_free_nz ((void *) argv);
1214 GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey); 1210 // FIXME
1211 // GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey);
1215 return ret; 1212 return ret;
1216} 1213}
1217 1214
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 07d045b90..345d76910 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -59,7 +59,7 @@ static struct GNUNET_NAMESTORE_Handle *ns;
59/** 59/**
60 * Private key for the our zone. 60 * Private key for the our zone.
61 */ 61 */
62static struct GNUNET_CRYPTO_EcdsaPrivateKey zone_pkey; 62static struct GNUNET_IDENTITY_PrivateKey zone_pkey;
63 63
64/** 64/**
65 * Handle to identity lookup. 65 * Handle to identity lookup.
@@ -496,7 +496,7 @@ display_record (const char *rname,
496 */ 496 */
497static void 497static void
498display_record_iterator (void *cls, 498display_record_iterator (void *cls,
499 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 499 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
500 const char *rname, 500 const char *rname,
501 unsigned int rd_len, 501 unsigned int rd_len,
502 const struct GNUNET_GNSRECORD_Data *rd) 502 const struct GNUNET_GNSRECORD_Data *rd)
@@ -519,7 +519,7 @@ display_record_iterator (void *cls,
519 */ 519 */
520static void 520static void
521display_record_monitor (void *cls, 521display_record_monitor (void *cls,
522 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 522 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
523 const char *rname, 523 const char *rname,
524 unsigned int rd_len, 524 unsigned int rd_len,
525 const struct GNUNET_GNSRECORD_Data *rd) 525 const struct GNUNET_GNSRECORD_Data *rd)
@@ -542,7 +542,7 @@ display_record_monitor (void *cls,
542 */ 542 */
543static void 543static void
544display_record_lookup (void *cls, 544display_record_lookup (void *cls,
545 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 545 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
546 const char *rname, 546 const char *rname,
547 unsigned int rd_len, 547 unsigned int rd_len,
548 const struct GNUNET_GNSRECORD_Data *rd) 548 const struct GNUNET_GNSRECORD_Data *rd)
@@ -622,7 +622,7 @@ add_error_cb (void *cls)
622 */ 622 */
623static void 623static void
624get_existing_record (void *cls, 624get_existing_record (void *cls,
625 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 625 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
626 const char *rec_name, 626 const char *rec_name,
627 unsigned int rd_count, 627 unsigned int rd_count,
628 const struct GNUNET_GNSRECORD_Data *rd) 628 const struct GNUNET_GNSRECORD_Data *rd)
@@ -781,7 +781,7 @@ reverse_error_cb (void *cls)
781 */ 781 */
782static void 782static void
783handle_reverse_lookup (void *cls, 783handle_reverse_lookup (void *cls,
784 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 784 const struct GNUNET_IDENTITY_PrivateKey *zone,
785 const char *label, 785 const char *label,
786 unsigned int rd_count, 786 unsigned int rd_count,
787 const struct GNUNET_GNSRECORD_Data *rd) 787 const struct GNUNET_GNSRECORD_Data *rd)
@@ -826,7 +826,7 @@ del_lookup_error_cb (void *cls)
826 */ 826 */
827static void 827static void
828del_monitor (void *cls, 828del_monitor (void *cls,
829 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 829 const struct GNUNET_IDENTITY_PrivateKey *zone,
830 const char *label, 830 const char *label,
831 unsigned int rd_count, 831 unsigned int rd_count,
832 const struct GNUNET_GNSRECORD_Data *rd) 832 const struct GNUNET_GNSRECORD_Data *rd)
@@ -1187,12 +1187,11 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg)
1187 } 1187 }
1188 if (NULL != reverse_pkey) 1188 if (NULL != reverse_pkey)
1189 { 1189 {
1190 struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 1190 struct GNUNET_IDENTITY_PublicKey pubkey;
1191 1191
1192 if (GNUNET_OK != 1192 if (GNUNET_OK !=
1193 GNUNET_CRYPTO_ecdsa_public_key_from_string (reverse_pkey, 1193 GNUNET_IDENTITY_public_key_from_string (reverse_pkey,
1194 strlen (reverse_pkey), 1194 &pubkey))
1195 &pubkey))
1196 { 1195 {
1197 fprintf (stderr, 1196 fprintf (stderr,
1198 _ ("Invalid public key for reverse lookup `%s'\n"), 1197 _ ("Invalid public key for reverse lookup `%s'\n"),
@@ -1211,12 +1210,12 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg)
1211 { 1210 {
1212 char sh[105]; 1211 char sh[105];
1213 char sname[64]; 1212 char sname[64];
1214 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 1213 struct GNUNET_IDENTITY_PublicKey pkey;
1215 1214
1216 GNUNET_STRINGS_utf8_tolower (uri, uri); 1215 GNUNET_STRINGS_utf8_tolower (uri, uri);
1217 if ((2 != (sscanf (uri, "gnunet://gns/%52s/%63s", sh, sname))) || 1216 if ((2 != (sscanf (uri, "gnunet://gns/%52s/%63s", sh, sname))) ||
1218 (GNUNET_OK != 1217 (GNUNET_OK !=
1219 GNUNET_CRYPTO_ecdsa_public_key_from_string (sh, strlen (sh), &pkey))) 1218 GNUNET_IDENTITY_public_key_from_string (sh, &pkey)))
1220 { 1219 {
1221 fprintf (stderr, _ ("Invalid URI `%s'\n"), uri); 1220 fprintf (stderr, _ ("Invalid URI `%s'\n"), uri);
1222 GNUNET_SCHEDULER_shutdown (); 1221 GNUNET_SCHEDULER_shutdown ();
@@ -1242,8 +1241,8 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg)
1242 } 1241 }
1243 memset (&rd, 0, sizeof(rd)); 1242 memset (&rd, 0, sizeof(rd));
1244 rd.data = &pkey; 1243 rd.data = &pkey;
1245 rd.data_size = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey); 1244 rd.data_size = GNUNET_IDENTITY_key_get_length (&pkey);
1246 rd.record_type = GNUNET_GNSRECORD_TYPE_PKEY; 1245 rd.record_type = ntohl (pkey.type);
1247 rd.expiration_time = etime; 1246 rd.expiration_time = etime;
1248 if (GNUNET_YES == etime_is_rel) 1247 if (GNUNET_YES == etime_is_rel)
1249 rd.flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 1248 rd.flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
@@ -1704,11 +1703,13 @@ main (int argc, char *const *argv)
1704 NULL))) 1703 NULL)))
1705 { 1704 {
1706 GNUNET_free_nz ((void *) argv); 1705 GNUNET_free_nz ((void *) argv);
1707 GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); 1706 //FIXME
1707 //GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
1708 return lret; 1708 return lret;
1709 } 1709 }
1710 GNUNET_free_nz ((void *) argv); 1710 GNUNET_free_nz ((void *) argv);
1711 GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); 1711 //FIXME
1712 //GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
1712 return ret; 1713 return ret;
1713} 1714}
1714 1715
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index b24bb2952..d6774b37b 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -82,7 +82,7 @@ struct ZoneIteration
82 /** 82 /**
83 * Key of the zone we are iterating over. 83 * Key of the zone we are iterating over.
84 */ 84 */
85 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 85 struct GNUNET_IDENTITY_PrivateKey zone;
86 86
87 /** 87 /**
88 * Last sequence number in the zone iteration used to address next 88 * Last sequence number in the zone iteration used to address next
@@ -174,7 +174,7 @@ struct ZoneMonitor
174 /** 174 /**
175 * Private key of the zone. 175 * Private key of the zone.
176 */ 176 */
177 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 177 struct GNUNET_IDENTITY_PrivateKey zone;
178 178
179 /** 179 /**
180 * Task active during initial iteration. 180 * Task active during initial iteration.
@@ -314,7 +314,7 @@ struct NickCache
314 /** 314 /**
315 * Zone the cache entry is for. 315 * Zone the cache entry is for.
316 */ 316 */
317 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 317 struct GNUNET_IDENTITY_PrivateKey zone;
318 318
319 /** 319 /**
320 * Cached record data. 320 * Cached record data.
@@ -336,7 +336,7 @@ static struct NickCache nick_cache[NC_SIZE];
336/** 336/**
337 * Public key of all zeros. 337 * Public key of all zeros.
338 */ 338 */
339static const struct GNUNET_CRYPTO_EcdsaPrivateKey zero; 339static const struct GNUNET_IDENTITY_PrivateKey zero;
340 340
341/** 341/**
342 * Configuration handle. 342 * Configuration handle.
@@ -481,7 +481,7 @@ free_store_activity (struct StoreActivity *sa)
481static void 481static void
482lookup_nick_it (void *cls, 482lookup_nick_it (void *cls,
483 uint64_t seq, 483 uint64_t seq,
484 const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, 484 const struct GNUNET_IDENTITY_PrivateKey *private_key,
485 const char *label, 485 const char *label,
486 unsigned int rd_count, 486 unsigned int rd_count,
487 const struct GNUNET_GNSRECORD_Data *rd) 487 const struct GNUNET_GNSRECORD_Data *rd)
@@ -521,7 +521,7 @@ lookup_nick_it (void *cls,
521 * @param nick nick entry to cache 521 * @param nick nick entry to cache
522 */ 522 */
523static void 523static void
524cache_nick (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 524cache_nick (const struct GNUNET_IDENTITY_PrivateKey *zone,
525 const struct GNUNET_GNSRECORD_Data *nick) 525 const struct GNUNET_GNSRECORD_Data *nick)
526{ 526{
527 struct NickCache *oldest; 527 struct NickCache *oldest;
@@ -564,9 +564,9 @@ cache_nick (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
564 * @return NULL if no NICK record was found 564 * @return NULL if no NICK record was found
565 */ 565 */
566static struct GNUNET_GNSRECORD_Data * 566static struct GNUNET_GNSRECORD_Data *
567get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone) 567get_nick_record (const struct GNUNET_IDENTITY_PrivateKey *zone)
568{ 568{
569 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 569 struct GNUNET_IDENTITY_PublicKey pub;
570 struct GNUNET_GNSRECORD_Data *nick; 570 struct GNUNET_GNSRECORD_Data *nick;
571 int res; 571 int res;
572 572
@@ -606,7 +606,7 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone)
606 __LINE__); 606 __LINE__);
607 if (1 == do_log) 607 if (1 == do_log)
608 { 608 {
609 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub); 609 GNUNET_IDENTITY_key_get_public (zone, &pub);
610 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, 610 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
611 "No nick name set for zone `%s'\n", 611 "No nick name set for zone `%s'\n",
612 GNUNET_GNSRECORD_z2s (&pub)); 612 GNUNET_GNSRECORD_z2s (&pub));
@@ -720,7 +720,7 @@ merge_with_nick_records (const struct GNUNET_GNSRECORD_Data *nick_rd,
720static void 720static void
721send_lookup_response (struct NamestoreClient *nc, 721send_lookup_response (struct NamestoreClient *nc,
722 uint32_t request_id, 722 uint32_t request_id,
723 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 723 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
724 const char *name, 724 const char *name,
725 unsigned int rd_count, 725 unsigned int rd_count,
726 const struct GNUNET_GNSRECORD_Data *rd) 726 const struct GNUNET_GNSRECORD_Data *rd)
@@ -899,14 +899,14 @@ static void
899refresh_block (struct NamestoreClient *nc, 899refresh_block (struct NamestoreClient *nc,
900 struct ZoneIteration *zi, 900 struct ZoneIteration *zi,
901 uint32_t rid, 901 uint32_t rid,
902 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 902 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
903 const char *name, 903 const char *name,
904 unsigned int rd_count, 904 unsigned int rd_count,
905 const struct GNUNET_GNSRECORD_Data *rd) 905 const struct GNUNET_GNSRECORD_Data *rd)
906{ 906{
907 struct GNUNET_GNSRECORD_Block *block; 907 struct GNUNET_GNSRECORD_Block *block;
908 struct CacheOperation *cop; 908 struct CacheOperation *cop;
909 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 909 struct GNUNET_IDENTITY_PublicKey pkey;
910 struct GNUNET_GNSRECORD_Data *nick; 910 struct GNUNET_GNSRECORD_Data *nick;
911 struct GNUNET_GNSRECORD_Data *res; 911 struct GNUNET_GNSRECORD_Data *res;
912 unsigned int res_count; 912 unsigned int res_count;
@@ -946,7 +946,7 @@ refresh_block (struct NamestoreClient *nc,
946 block = 946 block =
947 GNUNET_GNSRECORD_block_create (zone_key, exp_time, name, res, res_count); 947 GNUNET_GNSRECORD_block_create (zone_key, exp_time, name, res, res_count);
948 GNUNET_assert (NULL != block); 948 GNUNET_assert (NULL != block);
949 GNUNET_CRYPTO_ecdsa_key_get_public (zone_key, &pkey); 949 GNUNET_IDENTITY_key_get_public (zone_key, &pkey);
950 GNUNET_log ( 950 GNUNET_log (
951 GNUNET_ERROR_TYPE_DEBUG, 951 GNUNET_ERROR_TYPE_DEBUG,
952 "Caching block for label `%s' with %u records and expiration %s in zone `%s' in namecache\n", 952 "Caching block for label `%s' with %u records and expiration %s in zone `%s' in namecache\n",
@@ -1214,7 +1214,7 @@ struct RecordLookupContext
1214static void 1214static void
1215lookup_it (void *cls, 1215lookup_it (void *cls,
1216 uint64_t seq, 1216 uint64_t seq,
1217 const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, 1217 const struct GNUNET_IDENTITY_PrivateKey *private_key,
1218 const char *label, 1218 const char *label,
1219 unsigned int rd_count, 1219 unsigned int rd_count,
1220 const struct GNUNET_GNSRECORD_Data *rd) 1220 const struct GNUNET_GNSRECORD_Data *rd)
@@ -1605,7 +1605,7 @@ struct ZoneToNameCtx
1605static void 1605static void
1606handle_zone_to_name_it (void *cls, 1606handle_zone_to_name_it (void *cls,
1607 uint64_t seq, 1607 uint64_t seq,
1608 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 1608 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
1609 const char *name, 1609 const char *name,
1610 unsigned int rd_count, 1610 unsigned int rd_count,
1611 const struct GNUNET_GNSRECORD_Data *rd) 1611 const struct GNUNET_GNSRECORD_Data *rd)
@@ -1738,7 +1738,7 @@ struct ZoneIterationProcResult
1738static void 1738static void
1739zone_iterate_proc (void *cls, 1739zone_iterate_proc (void *cls,
1740 uint64_t seq, 1740 uint64_t seq,
1741 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 1741 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
1742 const char *name, 1742 const char *name,
1743 unsigned int rd_count, 1743 unsigned int rd_count,
1744 const struct GNUNET_GNSRECORD_Data *rd) 1744 const struct GNUNET_GNSRECORD_Data *rd)
@@ -2009,7 +2009,7 @@ monitor_iteration_next (void *cls);
2009static void 2009static void
2010monitor_iterate_cb (void *cls, 2010monitor_iterate_cb (void *cls,
2011 uint64_t seq, 2011 uint64_t seq,
2012 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 2012 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
2013 const char *name, 2013 const char *name,
2014 unsigned int rd_count, 2014 unsigned int rd_count,
2015 const struct GNUNET_GNSRECORD_Data *rd) 2015 const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index 5b4e41475..ce62b52d5 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -96,7 +96,7 @@ struct Zone
96 /** 96 /**
97 * Private key of the zone. 97 * Private key of the zone.
98 */ 98 */
99 struct GNUNET_CRYPTO_EcdsaPrivateKey key; 99 struct GNUNET_IDENTITY_PrivateKey key;
100}; 100};
101 101
102 102
@@ -1405,7 +1405,7 @@ ns_lookup_error_cb (void *cls)
1405 */ 1405 */
1406static void 1406static void
1407ns_lookup_result_cb (void *cls, 1407ns_lookup_result_cb (void *cls,
1408 const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 1408 const struct GNUNET_IDENTITY_PrivateKey *key,
1409 const char *label, 1409 const char *label,
1410 unsigned int rd_count, 1410 unsigned int rd_count,
1411 const struct GNUNET_GNSRECORD_Data *rd) 1411 const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h
index 6f45ab1c1..fd9a8ed47 100644
--- a/src/namestore/namestore.h
+++ b/src/namestore/namestore.h
@@ -90,7 +90,7 @@ struct RecordStoreMessage
90 /** 90 /**
91 * The private key of the authority. 91 * The private key of the authority.
92 */ 92 */
93 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; 93 struct GNUNET_IDENTITY_PrivateKey private_key;
94 94
95 /* followed by: 95 /* followed by:
96 * name with length name_len 96 * name with length name_len
@@ -134,7 +134,7 @@ struct LabelLookupMessage
134 /** 134 /**
135 * The private key of the zone to look up in 135 * The private key of the zone to look up in
136 */ 136 */
137 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 137 struct GNUNET_IDENTITY_PrivateKey zone;
138 138
139 /* followed by: 139 /* followed by:
140 * name with length name_len 140 * name with length name_len
@@ -176,7 +176,7 @@ struct LabelLookupResponseMessage
176 /** 176 /**
177 * The private key of the authority. 177 * The private key of the authority.
178 */ 178 */
179 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; 179 struct GNUNET_IDENTITY_PrivateKey private_key;
180 180
181 /* followed by: 181 /* followed by:
182 * name with length name_len 182 * name with length name_len
@@ -198,12 +198,12 @@ struct ZoneToNameMessage
198 /** 198 /**
199 * The private key of the zone to look up in 199 * The private key of the zone to look up in
200 */ 200 */
201 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 201 struct GNUNET_IDENTITY_PrivateKey zone;
202 202
203 /** 203 /**
204 * The public key of the target zone 204 * The public key of the target zone
205 */ 205 */
206 struct GNUNET_CRYPTO_EcdsaPublicKey value_zone; 206 struct GNUNET_IDENTITY_PublicKey value_zone;
207}; 207};
208 208
209 209
@@ -241,7 +241,7 @@ struct ZoneToNameResponseMessage
241 /** 241 /**
242 * The private key of the zone that contained the name. 242 * The private key of the zone that contained the name.
243 */ 243 */
244 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 244 struct GNUNET_IDENTITY_PrivateKey zone;
245 245
246 /* followed by: 246 /* followed by:
247 * name with length name_len 247 * name with length name_len
@@ -283,7 +283,7 @@ struct RecordResultMessage
283 /** 283 /**
284 * The private key of the authority. 284 * The private key of the authority.
285 */ 285 */
286 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; 286 struct GNUNET_IDENTITY_PrivateKey private_key;
287 287
288 /* followed by: 288 /* followed by:
289 * name with length name_len 289 * name with length name_len
@@ -311,7 +311,7 @@ struct ZoneMonitorStartMessage
311 /** 311 /**
312 * Zone key. 312 * Zone key.
313 */ 313 */
314 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 314 struct GNUNET_IDENTITY_PrivateKey zone;
315}; 315};
316 316
317 317
@@ -352,7 +352,7 @@ struct ZoneIterationStartMessage
352 /** 352 /**
353 * Zone key. All zeros for "all zones". 353 * Zone key. All zeros for "all zones".
354 */ 354 */
355 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 355 struct GNUNET_IDENTITY_PrivateKey zone;
356}; 356};
357 357
358 358
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index f383f8b4a..c845b5019 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -174,7 +174,7 @@ struct GNUNET_NAMESTORE_ZoneIterator
174 /** 174 /**
175 * Private key of the zone. 175 * Private key of the zone.
176 */ 176 */
177 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 177 struct GNUNET_IDENTITY_PrivateKey zone;
178 178
179 /** 179 /**
180 * The operation id this zone iteration operation has 180 * The operation id this zone iteration operation has
@@ -493,7 +493,7 @@ handle_lookup_result (void *cls, const struct LabelLookupResponseMessage *msg)
493static int 493static int
494check_record_result (void *cls, const struct RecordResultMessage *msg) 494check_record_result (void *cls, const struct RecordResultMessage *msg)
495{ 495{
496 static struct GNUNET_CRYPTO_EcdsaPrivateKey priv_dummy; 496 static struct GNUNET_IDENTITY_PrivateKey priv_dummy;
497 const char *name; 497 const char *name;
498 size_t msg_len; 498 size_t msg_len;
499 size_t name_len; 499 size_t name_len;
@@ -981,7 +981,7 @@ warn_delay (void *cls)
981struct GNUNET_NAMESTORE_QueueEntry * 981struct GNUNET_NAMESTORE_QueueEntry *
982GNUNET_NAMESTORE_records_store ( 982GNUNET_NAMESTORE_records_store (
983 struct GNUNET_NAMESTORE_Handle *h, 983 struct GNUNET_NAMESTORE_Handle *h,
984 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 984 const struct GNUNET_IDENTITY_PrivateKey *pkey,
985 const char *label, 985 const char *label,
986 unsigned int rd_count, 986 unsigned int rd_count,
987 const struct GNUNET_GNSRECORD_Data *rd, 987 const struct GNUNET_GNSRECORD_Data *rd,
@@ -1080,7 +1080,7 @@ GNUNET_NAMESTORE_records_store (
1080struct GNUNET_NAMESTORE_QueueEntry * 1080struct GNUNET_NAMESTORE_QueueEntry *
1081GNUNET_NAMESTORE_records_lookup ( 1081GNUNET_NAMESTORE_records_lookup (
1082 struct GNUNET_NAMESTORE_Handle *h, 1082 struct GNUNET_NAMESTORE_Handle *h,
1083 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 1083 const struct GNUNET_IDENTITY_PrivateKey *pkey,
1084 const char *label, 1084 const char *label,
1085 GNUNET_SCHEDULER_TaskCallback error_cb, 1085 GNUNET_SCHEDULER_TaskCallback error_cb,
1086 void *error_cb_cls, 1086 void *error_cb_cls,
@@ -1140,8 +1140,8 @@ GNUNET_NAMESTORE_records_lookup (
1140struct GNUNET_NAMESTORE_QueueEntry * 1140struct GNUNET_NAMESTORE_QueueEntry *
1141GNUNET_NAMESTORE_zone_to_name ( 1141GNUNET_NAMESTORE_zone_to_name (
1142 struct GNUNET_NAMESTORE_Handle *h, 1142 struct GNUNET_NAMESTORE_Handle *h,
1143 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1143 const struct GNUNET_IDENTITY_PrivateKey *zone,
1144 const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, 1144 const struct GNUNET_IDENTITY_PublicKey *value_zone,
1145 GNUNET_SCHEDULER_TaskCallback error_cb, 1145 GNUNET_SCHEDULER_TaskCallback error_cb,
1146 void *error_cb_cls, 1146 void *error_cb_cls,
1147 GNUNET_NAMESTORE_RecordMonitor proc, 1147 GNUNET_NAMESTORE_RecordMonitor proc,
@@ -1196,7 +1196,7 @@ GNUNET_NAMESTORE_zone_to_name (
1196struct GNUNET_NAMESTORE_ZoneIterator * 1196struct GNUNET_NAMESTORE_ZoneIterator *
1197GNUNET_NAMESTORE_zone_iteration_start ( 1197GNUNET_NAMESTORE_zone_iteration_start (
1198 struct GNUNET_NAMESTORE_Handle *h, 1198 struct GNUNET_NAMESTORE_Handle *h,
1199 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1199 const struct GNUNET_IDENTITY_PrivateKey *zone,
1200 GNUNET_SCHEDULER_TaskCallback error_cb, 1200 GNUNET_SCHEDULER_TaskCallback error_cb,
1201 void *error_cb_cls, 1201 void *error_cb_cls,
1202 GNUNET_NAMESTORE_RecordMonitor proc, 1202 GNUNET_NAMESTORE_RecordMonitor proc,
diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c
index 9dc955544..6670e54ce 100644
--- a/src/namestore/namestore_api_monitor.c
+++ b/src/namestore/namestore_api_monitor.c
@@ -82,7 +82,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor
82 /** 82 /**
83 * Monitored zone. 83 * Monitored zone.
84 */ 84 */
85 struct GNUNET_CRYPTO_EcdsaPrivateKey zone; 85 struct GNUNET_IDENTITY_PrivateKey zone;
86 86
87 /** 87 /**
88 * Do we first iterate over all existing records? 88 * Do we first iterate over all existing records?
@@ -302,7 +302,7 @@ reconnect (struct GNUNET_NAMESTORE_ZoneMonitor *zm)
302struct GNUNET_NAMESTORE_ZoneMonitor * 302struct GNUNET_NAMESTORE_ZoneMonitor *
303GNUNET_NAMESTORE_zone_monitor_start ( 303GNUNET_NAMESTORE_zone_monitor_start (
304 const struct GNUNET_CONFIGURATION_Handle *cfg, 304 const struct GNUNET_CONFIGURATION_Handle *cfg,
305 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 305 const struct GNUNET_IDENTITY_PrivateKey *zone,
306 int iterate_first, 306 int iterate_first,
307 GNUNET_SCHEDULER_TaskCallback error_cb, 307 GNUNET_SCHEDULER_TaskCallback error_cb,
308 void *error_cb_cls, 308 void *error_cb_cls,
diff --git a/src/namestore/perf_namestore_api_zone_iteration.c b/src/namestore/perf_namestore_api_zone_iteration.c
index c1012de62..f46a1c523 100644
--- a/src/namestore/perf_namestore_api_zone_iteration.c
+++ b/src/namestore/perf_namestore_api_zone_iteration.c
@@ -64,7 +64,7 @@ static struct GNUNET_SCHEDULER_Task *timeout_task;
64 64
65static struct GNUNET_SCHEDULER_Task *t; 65static struct GNUNET_SCHEDULER_Task *t;
66 66
67static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 67static struct GNUNET_IDENTITY_PrivateKey privkey;
68 68
69static struct GNUNET_NAMESTORE_ZoneIterator *zi; 69static struct GNUNET_NAMESTORE_ZoneIterator *zi;
70 70
@@ -188,7 +188,7 @@ fail_cb (void *cls)
188 188
189static void 189static void
190zone_proc (void *cls, 190zone_proc (void *cls,
191 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 191 const struct GNUNET_IDENTITY_PrivateKey *zone,
192 const char *label, 192 const char *label,
193 unsigned int rd_count, 193 unsigned int rd_count,
194 const struct GNUNET_GNSRECORD_Data *rd) 194 const struct GNUNET_GNSRECORD_Data *rd)
@@ -341,7 +341,8 @@ run (void *cls,
341 NULL); 341 NULL);
342 nsh = GNUNET_NAMESTORE_connect (cfg); 342 nsh = GNUNET_NAMESTORE_connect (cfg);
343 GNUNET_assert (NULL != nsh); 343 GNUNET_assert (NULL != nsh);
344 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 344 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
345 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
345 start = GNUNET_TIME_absolute_get (); 346 start = GNUNET_TIME_absolute_get ();
346 t = GNUNET_SCHEDULER_add_now (&publish_record, 347 t = GNUNET_SCHEDULER_add_now (&publish_record,
347 NULL); 348 NULL);
diff --git a/src/namestore/plugin_namestore_flat.c b/src/namestore/plugin_namestore_flat.c
index 60b24df67..1a071fd80 100644
--- a/src/namestore/plugin_namestore_flat.c
+++ b/src/namestore/plugin_namestore_flat.c
@@ -54,7 +54,7 @@ struct FlatFileEntry
54 /** 54 /**
55 * Entry zone 55 * Entry zone
56 */ 56 */
57 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; 57 struct GNUNET_IDENTITY_PrivateKey private_key;
58 58
59 /** 59 /**
60 * Record cound 60 * Record cound
@@ -86,7 +86,7 @@ struct FlatFileEntry
86 * @param h[out] initialized hash 86 * @param h[out] initialized hash
87 */ 87 */
88static void 88static void
89hash_pkey_and_label (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 89hash_pkey_and_label (const struct GNUNET_IDENTITY_PrivateKey *pkey,
90 const char *label, 90 const char *label,
91 struct GNUNET_HashCode *h) 91 struct GNUNET_HashCode *h)
92{ 92{
@@ -95,14 +95,14 @@ hash_pkey_and_label (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
95 size_t key_len; 95 size_t key_len;
96 96
97 label_len = strlen (label); 97 label_len = strlen (label);
98 key_len = label_len + sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey); 98 key_len = label_len + sizeof(struct GNUNET_IDENTITY_PrivateKey);
99 key = GNUNET_malloc (key_len); 99 key = GNUNET_malloc (key_len);
100 GNUNET_memcpy (key, 100 GNUNET_memcpy (key,
101 label, 101 label,
102 label_len); 102 label_len);
103 GNUNET_memcpy (key + label_len, 103 GNUNET_memcpy (key + label_len,
104 pkey, 104 pkey,
105 sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey)); 105 sizeof(struct GNUNET_IDENTITY_PrivateKey));
106 GNUNET_CRYPTO_hash (key, 106 GNUNET_CRYPTO_hash (key,
107 key_len, 107 key_len,
108 h); 108 h);
@@ -296,7 +296,7 @@ database_setup (struct Plugin *plugin)
296 GNUNET_free (record_data); 296 GNUNET_free (record_data);
297 297
298 { 298 {
299 struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key; 299 struct GNUNET_IDENTITY_PrivateKey *private_key;
300 300
301 GNUNET_STRINGS_base64_decode (zone_private_key, 301 GNUNET_STRINGS_base64_decode (zone_private_key,
302 strlen (zone_private_key), 302 strlen (zone_private_key),
@@ -345,7 +345,7 @@ store_and_free_entries (void *cls,
345 345
346 (void) key; 346 (void) key;
347 GNUNET_STRINGS_base64_encode (&entry->private_key, 347 GNUNET_STRINGS_base64_encode (&entry->private_key,
348 sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey), 348 sizeof(struct GNUNET_IDENTITY_PrivateKey),
349 &zone_private_key); 349 &zone_private_key);
350 data_size = GNUNET_GNSRECORD_records_get_size (entry->record_count, 350 data_size = GNUNET_GNSRECORD_records_get_size (entry->record_count,
351 entry->record_data); 351 entry->record_data);
@@ -452,7 +452,7 @@ database_shutdown (struct Plugin *plugin)
452static int 452static int
453namestore_flat_store_records (void *cls, 453namestore_flat_store_records (void *cls,
454 const struct 454 const struct
455 GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 455 GNUNET_IDENTITY_PrivateKey *zone_key,
456 const char *label, 456 const char *label,
457 unsigned int rd_count, 457 unsigned int rd_count,
458 const struct GNUNET_GNSRECORD_Data *rd) 458 const struct GNUNET_GNSRECORD_Data *rd)
@@ -482,7 +482,7 @@ namestore_flat_store_records (void *cls,
482 strlen (label)); 482 strlen (label));
483 GNUNET_memcpy (&entry->private_key, 483 GNUNET_memcpy (&entry->private_key,
484 zone_key, 484 zone_key,
485 sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey)); 485 sizeof(struct GNUNET_IDENTITY_PrivateKey));
486 entry->rvalue = rvalue; 486 entry->rvalue = rvalue;
487 entry->record_count = rd_count; 487 entry->record_count = rd_count;
488 entry->record_data = GNUNET_new_array (rd_count, 488 entry->record_data = GNUNET_new_array (rd_count,
@@ -517,7 +517,7 @@ namestore_flat_store_records (void *cls,
517 */ 517 */
518static int 518static int
519namestore_flat_lookup_records (void *cls, 519namestore_flat_lookup_records (void *cls,
520 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 520 const struct GNUNET_IDENTITY_PrivateKey *zone,
521 const char *label, 521 const char *label,
522 GNUNET_NAMESTORE_RecordIterator iter, 522 GNUNET_NAMESTORE_RecordIterator iter,
523 void *iter_cls) 523 void *iter_cls)
@@ -574,7 +574,7 @@ struct IterateContext
574 /** 574 /**
575 * Target zone. 575 * Target zone.
576 */ 576 */
577 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone; 577 const struct GNUNET_IDENTITY_PrivateKey *zone;
578 578
579 /** 579 /**
580 * Function to call on each record. 580 * Function to call on each record.
@@ -647,7 +647,7 @@ iterate_zones (void *cls,
647static int 647static int
648namestore_flat_iterate_records (void *cls, 648namestore_flat_iterate_records (void *cls,
649 const struct 649 const struct
650 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 650 GNUNET_IDENTITY_PrivateKey *zone,
651 uint64_t serial, 651 uint64_t serial,
652 uint64_t limit, 652 uint64_t limit,
653 GNUNET_NAMESTORE_RecordIterator iter, 653 GNUNET_NAMESTORE_RecordIterator iter,
@@ -674,8 +674,8 @@ namestore_flat_iterate_records (void *cls,
674 */ 674 */
675struct ZoneToNameContext 675struct ZoneToNameContext
676{ 676{
677 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone; 677 const struct GNUNET_IDENTITY_PrivateKey *zone;
678 const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone; 678 const struct GNUNET_IDENTITY_PublicKey *value_zone;
679 GNUNET_NAMESTORE_RecordIterator iter; 679 GNUNET_NAMESTORE_RecordIterator iter;
680 void *iter_cls; 680 void *iter_cls;
681 681
@@ -702,7 +702,7 @@ zone_to_name (void *cls,
702 continue; 702 continue;
703 if (0 == memcmp (ztn->value_zone, 703 if (0 == memcmp (ztn->value_zone,
704 entry->record_data[i].data, 704 entry->record_data[i].data,
705 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))) 705 sizeof(struct GNUNET_IDENTITY_PublicKey)))
706 { 706 {
707 ztn->iter (ztn->iter_cls, 707 ztn->iter (ztn->iter_cls,
708 i + 1, /* zero is illegal! */ 708 i + 1, /* zero is illegal! */
@@ -730,9 +730,9 @@ zone_to_name (void *cls,
730 */ 730 */
731static int 731static int
732namestore_flat_zone_to_name (void *cls, 732namestore_flat_zone_to_name (void *cls,
733 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 733 const struct GNUNET_IDENTITY_PrivateKey *zone,
734 const struct 734 const struct
735 GNUNET_CRYPTO_EcdsaPublicKey *value_zone, 735 GNUNET_IDENTITY_PublicKey *value_zone,
736 GNUNET_NAMESTORE_RecordIterator iter, 736 GNUNET_NAMESTORE_RecordIterator iter,
737 void *iter_cls) 737 void *iter_cls)
738{ 738{
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index 04100567c..358fd35d6 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -180,13 +180,13 @@ database_setup (struct Plugin *plugin)
180static int 180static int
181namestore_postgres_store_records (void *cls, 181namestore_postgres_store_records (void *cls,
182 const struct 182 const struct
183 GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 183 GNUNET_IDENTITY_PrivateKey *zone_key,
184 const char *label, 184 const char *label,
185 unsigned int rd_count, 185 unsigned int rd_count,
186 const struct GNUNET_GNSRECORD_Data *rd) 186 const struct GNUNET_GNSRECORD_Data *rd)
187{ 187{
188 struct Plugin *plugin = cls; 188 struct Plugin *plugin = cls;
189 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 189 struct GNUNET_IDENTITY_PublicKey pkey;
190 uint64_t rvalue; 190 uint64_t rvalue;
191 uint32_t rd_count32 = (uint32_t) rd_count; 191 uint32_t rd_count32 = (uint32_t) rd_count;
192 ssize_t data_size; 192 ssize_t data_size;
@@ -197,7 +197,7 @@ namestore_postgres_store_records (void *cls,
197 for (unsigned int i = 0; i < rd_count; i++) 197 for (unsigned int i = 0; i < rd_count; i++)
198 if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) 198 if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type)
199 { 199 {
200 GNUNET_break (sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) == 200 GNUNET_break (sizeof(struct GNUNET_IDENTITY_PublicKey) ==
201 rd[i].data_size); 201 rd[i].data_size);
202 GNUNET_memcpy (&pkey, 202 GNUNET_memcpy (&pkey,
203 rd[i].data, 203 rd[i].data,
@@ -296,7 +296,7 @@ struct ParserContext
296 /** 296 /**
297 * Zone key, NULL if part of record. 297 * Zone key, NULL if part of record.
298 */ 298 */
299 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key; 299 const struct GNUNET_IDENTITY_PrivateKey *zone_key;
300 300
301 /** 301 /**
302 * Number of results still to return (counted down by 302 * Number of results still to return (counted down by
@@ -330,7 +330,7 @@ parse_result_call_iterator (void *cls,
330 size_t data_size; 330 size_t data_size;
331 uint32_t record_count; 331 uint32_t record_count;
332 char *label; 332 char *label;
333 struct GNUNET_CRYPTO_EcdsaPrivateKey zk; 333 struct GNUNET_IDENTITY_PrivateKey zk;
334 struct GNUNET_PQ_ResultSpec rs_with_zone[] = { 334 struct GNUNET_PQ_ResultSpec rs_with_zone[] = {
335 GNUNET_PQ_result_spec_uint64 ("seq", &serial), 335 GNUNET_PQ_result_spec_uint64 ("seq", &serial),
336 GNUNET_PQ_result_spec_uint32 ("record_count", &record_count), 336 GNUNET_PQ_result_spec_uint32 ("record_count", &record_count),
@@ -407,7 +407,7 @@ parse_result_call_iterator (void *cls,
407static int 407static int
408namestore_postgres_lookup_records (void *cls, 408namestore_postgres_lookup_records (void *cls,
409 const struct 409 const struct
410 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 410 GNUNET_IDENTITY_PrivateKey *zone,
411 const char *label, 411 const char *label,
412 GNUNET_NAMESTORE_RecordIterator iter, 412 GNUNET_NAMESTORE_RecordIterator iter,
413 void *iter_cls) 413 void *iter_cls)
@@ -457,7 +457,7 @@ namestore_postgres_lookup_records (void *cls,
457static int 457static int
458namestore_postgres_iterate_records (void *cls, 458namestore_postgres_iterate_records (void *cls,
459 const struct 459 const struct
460 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 460 GNUNET_IDENTITY_PrivateKey *zone,
461 uint64_t serial, 461 uint64_t serial,
462 uint64_t limit, 462 uint64_t limit,
463 GNUNET_NAMESTORE_RecordIterator iter, 463 GNUNET_NAMESTORE_RecordIterator iter,
@@ -524,9 +524,9 @@ namestore_postgres_iterate_records (void *cls,
524static int 524static int
525namestore_postgres_zone_to_name (void *cls, 525namestore_postgres_zone_to_name (void *cls,
526 const struct 526 const struct
527 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 527 GNUNET_IDENTITY_PrivateKey *zone,
528 const struct 528 const struct
529 GNUNET_CRYPTO_EcdsaPublicKey *value_zone, 529 GNUNET_IDENTITY_PublicKey *value_zone,
530 GNUNET_NAMESTORE_RecordIterator iter, 530 GNUNET_NAMESTORE_RecordIterator iter,
531 void *iter_cls) 531 void *iter_cls)
532{ 532{
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c
index 45fb782f7..4a4ce3d8d 100644
--- a/src/namestore/plugin_namestore_sqlite.c
+++ b/src/namestore/plugin_namestore_sqlite.c
@@ -314,14 +314,14 @@ database_shutdown (struct Plugin *plugin)
314static int 314static int
315namestore_sqlite_store_records (void *cls, 315namestore_sqlite_store_records (void *cls,
316 const struct 316 const struct
317 GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 317 GNUNET_IDENTITY_PrivateKey *zone_key,
318 const char *label, 318 const char *label,
319 unsigned int rd_count, 319 unsigned int rd_count,
320 const struct GNUNET_GNSRECORD_Data *rd) 320 const struct GNUNET_GNSRECORD_Data *rd)
321{ 321{
322 struct Plugin *plugin = cls; 322 struct Plugin *plugin = cls;
323 int n; 323 int n;
324 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 324 struct GNUNET_IDENTITY_PublicKey pkey;
325 uint64_t rvalue; 325 uint64_t rvalue;
326 ssize_t data_size; 326 ssize_t data_size;
327 327
@@ -331,7 +331,7 @@ namestore_sqlite_store_records (void *cls,
331 for (unsigned int i = 0; i < rd_count; i++) 331 for (unsigned int i = 0; i < rd_count; i++)
332 if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) 332 if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type)
333 { 333 {
334 GNUNET_break (sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) == 334 GNUNET_break (sizeof(struct GNUNET_IDENTITY_PublicKey) ==
335 rd[i].data_size); 335 rd[i].data_size);
336 GNUNET_memcpy (&pkey, 336 GNUNET_memcpy (&pkey,
337 rd[i].data, 337 rd[i].data,
@@ -461,7 +461,7 @@ static int
461get_records_and_call_iterator (struct Plugin *plugin, 461get_records_and_call_iterator (struct Plugin *plugin,
462 sqlite3_stmt *stmt, 462 sqlite3_stmt *stmt,
463 const struct 463 const struct
464 GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 464 GNUNET_IDENTITY_PrivateKey *zone_key,
465 uint64_t limit, 465 uint64_t limit,
466 GNUNET_NAMESTORE_RecordIterator iter, 466 GNUNET_NAMESTORE_RecordIterator iter,
467 void *iter_cls) 467 void *iter_cls)
@@ -496,7 +496,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
496 size_t data_size; 496 size_t data_size;
497 void *data; 497 void *data;
498 char *label; 498 char *label;
499 struct GNUNET_CRYPTO_EcdsaPrivateKey zk; 499 struct GNUNET_IDENTITY_PrivateKey zk;
500 struct GNUNET_SQ_ResultSpec rs[] = { 500 struct GNUNET_SQ_ResultSpec rs[] = {
501 GNUNET_SQ_result_spec_uint64 (&seq), 501 GNUNET_SQ_result_spec_uint64 (&seq),
502 GNUNET_SQ_result_spec_uint32 (&record_count), 502 GNUNET_SQ_result_spec_uint32 (&record_count),
@@ -578,7 +578,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
578static int 578static int
579namestore_sqlite_lookup_records (void *cls, 579namestore_sqlite_lookup_records (void *cls,
580 const struct 580 const struct
581 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 581 GNUNET_IDENTITY_PrivateKey *zone,
582 const char *label, 582 const char *label,
583 GNUNET_NAMESTORE_RecordIterator iter, 583 GNUNET_NAMESTORE_RecordIterator iter,
584 void *iter_cls) 584 void *iter_cls)
@@ -629,7 +629,7 @@ namestore_sqlite_lookup_records (void *cls,
629static int 629static int
630namestore_sqlite_iterate_records (void *cls, 630namestore_sqlite_iterate_records (void *cls,
631 const struct 631 const struct
632 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 632 GNUNET_IDENTITY_PrivateKey *zone,
633 uint64_t serial, 633 uint64_t serial,
634 uint64_t limit, 634 uint64_t limit,
635 GNUNET_NAMESTORE_RecordIterator iter, 635 GNUNET_NAMESTORE_RecordIterator iter,
@@ -695,9 +695,9 @@ namestore_sqlite_iterate_records (void *cls,
695 */ 695 */
696static int 696static int
697namestore_sqlite_zone_to_name (void *cls, 697namestore_sqlite_zone_to_name (void *cls,
698 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 698 const struct GNUNET_IDENTITY_PrivateKey *zone,
699 const struct 699 const struct
700 GNUNET_CRYPTO_EcdsaPublicKey *value_zone, 700 GNUNET_IDENTITY_PublicKey *value_zone,
701 GNUNET_NAMESTORE_RecordIterator iter, 701 GNUNET_NAMESTORE_RecordIterator iter,
702 void *iter_cls) 702 void *iter_cls)
703{ 703{
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index 9354b9896..edcbeb874 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -30,7 +30,7 @@
30#include "gnunet_namestore_service.h" 30#include "gnunet_namestore_service.h"
31#include "gnunet_identity_service.h" 31#include "gnunet_identity_service.h"
32#include "gnunet_rest_lib.h" 32#include "gnunet_rest_lib.h"
33#include "gnunet_json_lib.h" 33#include "gnunet_gnsrecord_json_lib.h"
34#include "microhttpd.h" 34#include "microhttpd.h"
35#include <jansson.h> 35#include <jansson.h>
36 36
@@ -214,7 +214,7 @@ struct RequestHandle
214 /** 214 /**
215 * Private key for the zone 215 * Private key for the zone
216 */ 216 */
217 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_pkey; 217 const struct GNUNET_IDENTITY_PrivateKey *zone_pkey;
218 218
219 /** 219 /**
220 * IDENTITY Operation 220 * IDENTITY Operation
@@ -510,7 +510,7 @@ namestore_list_finished (void *cls)
510 */ 510 */
511static void 511static void
512namestore_list_iteration (void *cls, 512namestore_list_iteration (void *cls,
513 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 513 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
514 const char *rname, 514 const char *rname,
515 unsigned int rd_len, 515 unsigned int rd_len,
516 const struct GNUNET_GNSRECORD_Data *rd) 516 const struct GNUNET_GNSRECORD_Data *rd)
@@ -535,9 +535,9 @@ namestore_list_iteration (void *cls,
535 /** Only add if not empty **/ 535 /** Only add if not empty **/
536 if (j > 0) 536 if (j > 0)
537 { 537 {
538 record_obj = GNUNET_JSON_from_gnsrecord (rname, 538 record_obj = GNUNET_GNSRECORD_JSON_from_gnsrecord (rname,
539 rd_filtered, 539 rd_filtered,
540 j); 540 j);
541 json_array_append_new (handle->resp_object, record_obj); 541 json_array_append_new (handle->resp_object, record_obj);
542 } 542 }
543 GNUNET_NAMESTORE_zone_iterator_next (handle->list_it, 1); 543 GNUNET_NAMESTORE_zone_iterator_next (handle->list_it, 1);
@@ -561,7 +561,7 @@ ns_lookup_error_cb (void *cls)
561 561
562static void 562static void
563ns_get_lookup_cb (void *cls, 563ns_get_lookup_cb (void *cls,
564 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 564 const struct GNUNET_IDENTITY_PrivateKey *zone,
565 const char *label, 565 const char *label,
566 unsigned int rd_len, 566 unsigned int rd_len,
567 const struct GNUNET_GNSRECORD_Data *rd) 567 const struct GNUNET_GNSRECORD_Data *rd)
@@ -587,9 +587,9 @@ ns_get_lookup_cb (void *cls,
587 /** Only add if not empty **/ 587 /** Only add if not empty **/
588 if (j > 0) 588 if (j > 0)
589 { 589 {
590 record_obj = GNUNET_JSON_from_gnsrecord (label, 590 record_obj = GNUNET_GNSRECORD_JSON_from_gnsrecord (label,
591 rd_filtered, 591 rd_filtered,
592 j); 592 j);
593 json_array_append_new (handle->resp_object, record_obj); 593 json_array_append_new (handle->resp_object, record_obj);
594 } 594 }
595 GNUNET_SCHEDULER_add_now (&namestore_list_finished, handle); 595 GNUNET_SCHEDULER_add_now (&namestore_list_finished, handle);
@@ -689,7 +689,7 @@ namestore_get (struct GNUNET_REST_RequestHandle *con_handle,
689 689
690static void 690static void
691ns_lookup_cb (void *cls, 691ns_lookup_cb (void *cls,
692 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 692 const struct GNUNET_IDENTITY_PrivateKey *zone,
693 const char *label, 693 const char *label,
694 unsigned int rd_count, 694 unsigned int rd_count,
695 const struct GNUNET_GNSRECORD_Data *rd) 695 const struct GNUNET_GNSRECORD_Data *rd)
@@ -755,7 +755,7 @@ namestore_add_or_update (struct GNUNET_REST_RequestHandle *con_handle,
755 handle->rest_handle->data_size); 755 handle->rest_handle->data_size);
756 data_js = json_loads (term_data, JSON_DECODE_ANY, &err); 756 data_js = json_loads (term_data, JSON_DECODE_ANY, &err);
757 struct GNUNET_JSON_Specification gnsspec[] = 757 struct GNUNET_JSON_Specification gnsspec[] =
758 { GNUNET_JSON_spec_gnsrecord (&handle->rd, &handle->rd_count, 758 { GNUNET_GNSRECORD_JSON_spec_gnsrecord (&handle->rd, &handle->rd_count,
759 &handle->record_name), 759 &handle->record_name),
760 GNUNET_JSON_spec_end () }; 760 GNUNET_JSON_spec_end () };
761 if (GNUNET_OK != GNUNET_JSON_parse (data_js, gnsspec, NULL, NULL)) 761 if (GNUNET_OK != GNUNET_JSON_parse (data_js, gnsspec, NULL, NULL))
@@ -946,7 +946,7 @@ list_ego (void *cls,
946 const char *identifier) 946 const char *identifier)
947{ 947{
948 struct EgoEntry *ego_entry; 948 struct EgoEntry *ego_entry;
949 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 949 struct GNUNET_IDENTITY_PublicKey pk;
950 950
951 if ((NULL == ego) && (ID_REST_STATE_INIT == state)) 951 if ((NULL == ego) && (ID_REST_STATE_INIT == state))
952 { 952 {
@@ -957,7 +957,7 @@ list_ego (void *cls,
957 { 957 {
958 ego_entry = GNUNET_new (struct EgoEntry); 958 ego_entry = GNUNET_new (struct EgoEntry);
959 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 959 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
960 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 960 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
961 ego_entry->ego = ego; 961 ego_entry->ego = ego;
962 ego_entry->identifier = GNUNET_strdup (identifier); 962 ego_entry->identifier = GNUNET_strdup (identifier);
963 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 963 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
@@ -983,7 +983,7 @@ list_ego (void *cls,
983 /* Add */ 983 /* Add */
984 ego_entry = GNUNET_new (struct EgoEntry); 984 ego_entry = GNUNET_new (struct EgoEntry);
985 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 985 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
986 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 986 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
987 ego_entry->ego = ego; 987 ego_entry->ego = ego;
988 ego_entry->identifier = GNUNET_strdup (identifier); 988 ego_entry->identifier = GNUNET_strdup (identifier);
989 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 989 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c
index 14fe7fc70..6ce969c9b 100644
--- a/src/namestore/test_namestore_api_lookup_nick.c
+++ b/src/namestore/test_namestore_api_lookup_nick.c
@@ -41,9 +41,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
41 41
42static struct GNUNET_SCHEDULER_Task *endbadly_task; 42static struct GNUNET_SCHEDULER_Task *endbadly_task;
43 43
44static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 44static struct GNUNET_IDENTITY_PrivateKey privkey;
45 45
46static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 46static struct GNUNET_IDENTITY_PublicKey pubkey;
47 47
48static int res; 48static int res;
49 49
@@ -98,7 +98,7 @@ end (void *cls)
98 98
99static void 99static void
100lookup_it (void *cls, 100lookup_it (void *cls,
101 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 101 const struct GNUNET_IDENTITY_PrivateKey *zone,
102 const char *label, 102 const char *label,
103 unsigned int rd_count, 103 unsigned int rd_count,
104 const struct GNUNET_GNSRECORD_Data *rd) 104 const struct GNUNET_GNSRECORD_Data *rd)
@@ -288,8 +288,9 @@ run (void *cls,
288 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 288 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
289 &endbadly, 289 &endbadly,
290 NULL); 290 NULL);
291 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 291 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
292 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 292 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
293 GNUNET_IDENTITY_key_get_public (&privkey,
293 &pubkey); 294 &pubkey);
294 295
295 nsh = GNUNET_NAMESTORE_connect (cfg); 296 nsh = GNUNET_NAMESTORE_connect (cfg);
diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c
index d0ad726cc..67cf54582 100644
--- a/src/namestore/test_namestore_api_lookup_private.c
+++ b/src/namestore/test_namestore_api_lookup_private.c
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
38 38
39static struct GNUNET_SCHEDULER_Task *endbadly_task; 39static struct GNUNET_SCHEDULER_Task *endbadly_task;
40 40
41static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 41static struct GNUNET_IDENTITY_PrivateKey privkey;
42 42
43static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 43static struct GNUNET_IDENTITY_PublicKey pubkey;
44 44
45static int res; 45static int res;
46 46
@@ -91,7 +91,7 @@ end (void *cls)
91 91
92static void 92static void
93lookup_it (void *cls, 93lookup_it (void *cls,
94 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 94 const struct GNUNET_IDENTITY_PrivateKey *zone,
95 const char *label, 95 const char *label,
96 unsigned int rd_count, 96 unsigned int rd_count,
97 const struct GNUNET_GNSRECORD_Data *rd) 97 const struct GNUNET_GNSRECORD_Data *rd)
@@ -187,8 +187,9 @@ run (void *cls,
187 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 187 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
188 &endbadly, 188 &endbadly,
189 NULL); 189 NULL);
190 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 190 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
191 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey); 191 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
192 GNUNET_IDENTITY_key_get_public (&privkey, &pubkey);
192 193
193 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; 194 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us;
194 rd.record_type = TEST_RECORD_TYPE; 195 rd.record_type = TEST_RECORD_TYPE;
diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c
index 039c7cbf6..5e3e7bbd8 100644
--- a/src/namestore/test_namestore_api_lookup_public.c
+++ b/src/namestore/test_namestore_api_lookup_public.c
@@ -42,9 +42,9 @@ static struct GNUNET_NAMECACHE_Handle *nch;
42 42
43static struct GNUNET_SCHEDULER_Task *endbadly_task; 43static struct GNUNET_SCHEDULER_Task *endbadly_task;
44 44
45static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 45static struct GNUNET_IDENTITY_PrivateKey privkey;
46 46
47static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 47static struct GNUNET_IDENTITY_PublicKey pubkey;
48 48
49static int res; 49static int res;
50 50
@@ -163,7 +163,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
163{ 163{
164 const char *name = cls; 164 const char *name = cls;
165 struct GNUNET_HashCode derived_hash; 165 struct GNUNET_HashCode derived_hash;
166 struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 166 struct GNUNET_IDENTITY_PublicKey pubkey;
167 167
168 nsqe = NULL; 168 nsqe = NULL;
169 GNUNET_assert (NULL != cls); 169 GNUNET_assert (NULL != cls);
@@ -173,8 +173,8 @@ put_cont (void *cls, int32_t success, const char *emsg)
173 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 173 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
174 174
175 /* Create derived hash */ 175 /* Create derived hash */
176 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 176 GNUNET_IDENTITY_key_get_public (&privkey,
177 &pubkey); 177 &pubkey);
178 GNUNET_GNSRECORD_query_from_public_key (&pubkey, name, &derived_hash); 178 GNUNET_GNSRECORD_query_from_public_key (&pubkey, name, &derived_hash);
179 179
180 ncqe = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash, 180 ncqe = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash,
@@ -193,9 +193,10 @@ run (void *cls,
193 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 193 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
194 &endbadly, 194 &endbadly,
195 NULL); 195 NULL);
196 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 196 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
197 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 197 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
198 &pubkey); 198 GNUNET_IDENTITY_key_get_public (&privkey,
199 &pubkey);
199 200
200 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; 201 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000;
201 rd.record_type = TEST_RECORD_TYPE; 202 rd.record_type = TEST_RECORD_TYPE;
diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c
index d399d903a..79fa4c9c6 100644
--- a/src/namestore/test_namestore_api_lookup_shadow.c
+++ b/src/namestore/test_namestore_api_lookup_shadow.c
@@ -44,9 +44,9 @@ static struct GNUNET_NAMECACHE_Handle *nch;
44 44
45static struct GNUNET_SCHEDULER_Task *endbadly_task; 45static struct GNUNET_SCHEDULER_Task *endbadly_task;
46 46
47static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 47static struct GNUNET_IDENTITY_PrivateKey privkey;
48 48
49static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 49static struct GNUNET_IDENTITY_PublicKey pubkey;
50 50
51static int res; 51static int res;
52 52
@@ -195,7 +195,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
195{ 195{
196 const char *name = cls; 196 const char *name = cls;
197 struct GNUNET_HashCode derived_hash; 197 struct GNUNET_HashCode derived_hash;
198 struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 198 struct GNUNET_IDENTITY_PublicKey pubkey;
199 199
200 nsqe = NULL; 200 nsqe = NULL;
201 GNUNET_assert (NULL != cls); 201 GNUNET_assert (NULL != cls);
@@ -205,8 +205,8 @@ put_cont (void *cls, int32_t success, const char *emsg)
205 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 205 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
206 206
207 /* Create derived hash */ 207 /* Create derived hash */
208 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 208 GNUNET_IDENTITY_key_get_public (&privkey,
209 &pubkey); 209 &pubkey);
210 GNUNET_GNSRECORD_query_from_public_key (&pubkey, 210 GNUNET_GNSRECORD_query_from_public_key (&pubkey,
211 name, 211 name,
212 &derived_hash); 212 &derived_hash);
@@ -228,9 +228,10 @@ run (void *cls,
228 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 228 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
229 &endbadly, 229 &endbadly,
230 NULL); 230 NULL);
231 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 231 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
232 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 232 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
233 &pubkey); 233 GNUNET_IDENTITY_key_get_public (&privkey,
234 &pubkey);
234 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; 235 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000;
235 rd.record_type = TEST_RECORD_TYPE; 236 rd.record_type = TEST_RECORD_TYPE;
236 rd.data_size = TEST_RECORD_DATALEN; 237 rd.data_size = TEST_RECORD_DATALEN;
diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c
index 40dbeb90f..4fc197750 100644
--- a/src/namestore/test_namestore_api_lookup_shadow_filter.c
+++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c
@@ -48,9 +48,9 @@ static struct GNUNET_SCHEDULER_Task *endbadly_task;
48 48
49static struct GNUNET_SCHEDULER_Task *delayed_lookup_task; 49static struct GNUNET_SCHEDULER_Task *delayed_lookup_task;
50 50
51static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 51static struct GNUNET_IDENTITY_PrivateKey privkey;
52 52
53static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 53static struct GNUNET_IDENTITY_PublicKey pubkey;
54 54
55static int res; 55static int res;
56 56
@@ -66,7 +66,7 @@ static struct GNUNET_TIME_Absolute record_expiration;
66 66
67static struct GNUNET_HashCode derived_hash; 67static struct GNUNET_HashCode derived_hash;
68 68
69static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 69static struct GNUNET_IDENTITY_PublicKey pubkey;
70 70
71 71
72static void 72static void
@@ -267,8 +267,8 @@ put_cont (void *cls, int32_t success, const char *emsg)
267 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 267 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
268 268
269 /* Create derived hash */ 269 /* Create derived hash */
270 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 270 GNUNET_IDENTITY_key_get_public (&privkey,
271 &pubkey); 271 &pubkey);
272 GNUNET_GNSRECORD_query_from_public_key (&pubkey, TEST_NAME, &derived_hash); 272 GNUNET_GNSRECORD_query_from_public_key (&pubkey, TEST_NAME, &derived_hash);
273 273
274 if (0 == GNUNET_TIME_absolute_get_remaining (record_expiration).rel_value_us) 274 if (0 == GNUNET_TIME_absolute_get_remaining (record_expiration).rel_value_us)
@@ -297,9 +297,10 @@ run (void *cls,
297 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 297 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
298 &endbadly, 298 &endbadly,
299 NULL); 299 NULL);
300 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 300 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
301 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 301 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
302 &pubkey); 302 GNUNET_IDENTITY_key_get_public (&privkey,
303 &pubkey);
303 304
304 record_expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), 305 record_expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
305 EXPIRATION); 306 EXPIRATION);
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c
index 3f1be1403..df0c38608 100644
--- a/src/namestore/test_namestore_api_monitoring.c
+++ b/src/namestore/test_namestore_api_monitoring.c
@@ -37,9 +37,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
37 37
38static struct GNUNET_SCHEDULER_Task *endbadly_task; 38static struct GNUNET_SCHEDULER_Task *endbadly_task;
39 39
40static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 40static struct GNUNET_IDENTITY_PrivateKey privkey;
41 41
42static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; 42static struct GNUNET_IDENTITY_PrivateKey privkey2;
43 43
44static struct GNUNET_NAMESTORE_ZoneMonitor *zm; 44static struct GNUNET_NAMESTORE_ZoneMonitor *zm;
45 45
@@ -133,7 +133,7 @@ end (void *cls)
133 133
134static void 134static void
135zone_proc (void *cls, 135zone_proc (void *cls,
136 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 136 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
137 const char *name, 137 const char *name,
138 unsigned int rd_count, 138 unsigned int rd_count,
139 const struct GNUNET_GNSRECORD_Data *rd) 139 const struct GNUNET_GNSRECORD_Data *rd)
@@ -273,7 +273,8 @@ run (void *cls,
273 struct GNUNET_TESTING_Peer *peer) 273 struct GNUNET_TESTING_Peer *peer)
274{ 274{
275 res = 1; 275 res = 1;
276 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 276 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
277 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
277 /* Start monitoring */ 278 /* Start monitoring */
278 zm = GNUNET_NAMESTORE_zone_monitor_start (cfg, 279 zm = GNUNET_NAMESTORE_zone_monitor_start (cfg,
279 &privkey, 280 &privkey,
@@ -304,7 +305,8 @@ run (void *cls,
304 return; 305 return;
305 } 306 }
306 307
307 GNUNET_CRYPTO_ecdsa_key_create (&privkey2); 308 privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
309 GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key);
308 310
309 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 311 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
310 "Created record 3\n"); 312 "Created record 3\n");
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c
index 728fcc25e..366f5739f 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
38 38
39static struct GNUNET_SCHEDULER_Task *endbadly_task; 39static struct GNUNET_SCHEDULER_Task *endbadly_task;
40 40
41static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 41static struct GNUNET_IDENTITY_PrivateKey privkey;
42 42
43static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; 43static struct GNUNET_IDENTITY_PrivateKey privkey2;
44 44
45static struct GNUNET_NAMESTORE_ZoneMonitor *zm; 45static struct GNUNET_NAMESTORE_ZoneMonitor *zm;
46 46
@@ -129,7 +129,7 @@ end (void *cls)
129 129
130static void 130static void
131zone_proc (void *cls, 131zone_proc (void *cls,
132 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 132 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
133 const char *name, 133 const char *name,
134 unsigned int rd_count, 134 unsigned int rd_count,
135 const struct GNUNET_GNSRECORD_Data *rd) 135 const struct GNUNET_GNSRECORD_Data *rd)
@@ -302,8 +302,10 @@ run (void *cls,
302 struct GNUNET_TESTING_Peer *peer) 302 struct GNUNET_TESTING_Peer *peer)
303{ 303{
304 res = 1; 304 res = 1;
305 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 305 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
306 GNUNET_CRYPTO_ecdsa_key_create (&privkey2); 306 privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
307 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
308 GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key);
307 309
308 cfg = mycfg; 310 cfg = mycfg;
309 GNUNET_SCHEDULER_add_shutdown (&end, 311 GNUNET_SCHEDULER_add_shutdown (&end,
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
index e575821e8..b6254e531 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -39,9 +39,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
39 39
40static struct GNUNET_SCHEDULER_Task *endbadly_task; 40static struct GNUNET_SCHEDULER_Task *endbadly_task;
41 41
42static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 42static struct GNUNET_IDENTITY_PrivateKey privkey;
43 43
44static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 44static struct GNUNET_IDENTITY_PublicKey pubkey;
45 45
46static int res; 46static int res;
47 47
@@ -158,9 +158,10 @@ run (void *cls,
158 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 158 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
159 &endbadly, 159 &endbadly,
160 NULL); 160 NULL);
161 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 161 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
162 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 162 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
163 &pubkey); 163 GNUNET_IDENTITY_key_get_public (&privkey,
164 &pubkey);
164 165
165 removed = GNUNET_NO; 166 removed = GNUNET_NO;
166 167
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c
index 75e1cc3ed..e66992909 100644
--- a/src/namestore/test_namestore_api_remove_not_existing_record.c
+++ b/src/namestore/test_namestore_api_remove_not_existing_record.c
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
38 38
39static struct GNUNET_SCHEDULER_Task *endbadly_task; 39static struct GNUNET_SCHEDULER_Task *endbadly_task;
40 40
41static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 41static struct GNUNET_IDENTITY_PrivateKey privkey;
42 42
43static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 43static struct GNUNET_IDENTITY_PublicKey pubkey;
44 44
45static int res; 45static int res;
46 46
@@ -132,8 +132,9 @@ run (void *cls,
132 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 132 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
133 &endbadly, 133 &endbadly,
134 NULL); 134 NULL);
135 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 135 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
136 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey); 136 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
137 GNUNET_IDENTITY_key_get_public (&privkey, &pubkey);
137 138
138 nsh = GNUNET_NAMESTORE_connect (cfg); 139 nsh = GNUNET_NAMESTORE_connect (cfg);
139 GNUNET_break (NULL != nsh); 140 GNUNET_break (NULL != nsh);
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c
index 9223b56a3..e0b7daa5d 100644
--- a/src/namestore/test_namestore_api_store.c
+++ b/src/namestore/test_namestore_api_store.c
@@ -39,9 +39,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
39 39
40static struct GNUNET_SCHEDULER_Task *endbadly_task; 40static struct GNUNET_SCHEDULER_Task *endbadly_task;
41 41
42static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 42static struct GNUNET_IDENTITY_PrivateKey privkey;
43 43
44static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 44static struct GNUNET_IDENTITY_PublicKey pubkey;
45 45
46static int res; 46static int res;
47 47
@@ -113,8 +113,9 @@ run (void *cls,
113 113
114 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 114 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
115 &endbadly, NULL); 115 &endbadly, NULL);
116 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 116 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
117 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey); 117 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
118 GNUNET_IDENTITY_key_get_public (&privkey, &pubkey);
118 119
119 120
120 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; 121 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us;
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c
index 7a5a69a6c..5c169734a 100644
--- a/src/namestore/test_namestore_api_store_update.c
+++ b/src/namestore/test_namestore_api_store_update.c
@@ -48,9 +48,9 @@ static struct GNUNET_NAMECACHE_Handle *nch;
48 48
49static struct GNUNET_SCHEDULER_Task *endbadly_task; 49static struct GNUNET_SCHEDULER_Task *endbadly_task;
50 50
51static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 51static struct GNUNET_IDENTITY_PrivateKey privkey;
52 52
53static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 53static struct GNUNET_IDENTITY_PublicKey pubkey;
54 54
55static int res; 55static int res;
56 56
@@ -246,9 +246,10 @@ run (void *cls,
246 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 246 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
247 &endbadly, 247 &endbadly,
248 NULL); 248 NULL);
249 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 249 memset (&privkey, 0, sizeof (privkey));
250 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 250 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
251 &pubkey); 251 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
252 GNUNET_IDENTITY_key_get_public (&privkey, &pubkey);
252 rd.flags = GNUNET_GNSRECORD_RF_NONE; 253 rd.flags = GNUNET_GNSRECORD_RF_NONE;
253 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; 254 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000;
254 rd.record_type = TEST_RECORD_TYPE; 255 rd.record_type = TEST_RECORD_TYPE;
@@ -291,7 +292,7 @@ main (int argc,
291 SETUP_CFG (plugin_name, cfg_name); 292 SETUP_CFG (plugin_name, cfg_name);
292 res = 1; 293 res = 1;
293 if (0 != 294 if (0 !=
294 GNUNET_TESTING_peer_run ("test-namestore-api-store-update", 295 GNUNET_TESTING_peer_run ("test--store-update",
295 cfg_name, 296 cfg_name,
296 &run, 297 &run,
297 NULL)) 298 NULL))
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index 5d02b9e49..55ca901e2 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -37,9 +37,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
37 37
38static struct GNUNET_SCHEDULER_Task *endbadly_task; 38static struct GNUNET_SCHEDULER_Task *endbadly_task;
39 39
40static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 40static struct GNUNET_IDENTITY_PrivateKey privkey;
41 41
42static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; 42static struct GNUNET_IDENTITY_PrivateKey privkey2;
43 43
44static struct GNUNET_NAMESTORE_ZoneIterator *zi; 44static struct GNUNET_NAMESTORE_ZoneIterator *zi;
45 45
@@ -142,7 +142,7 @@ fail_cb (void *cls)
142 142
143static void 143static void
144zone_proc (void *cls, 144zone_proc (void *cls,
145 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 145 const struct GNUNET_IDENTITY_PrivateKey *zone,
146 const char *label, 146 const char *label,
147 unsigned int rd_count, 147 unsigned int rd_count,
148 const struct GNUNET_GNSRECORD_Data *rd) 148 const struct GNUNET_GNSRECORD_Data *rd)
@@ -331,7 +331,7 @@ create_record (unsigned int count)
331 */ 331 */
332static void 332static void
333empty_zone_proc (void *cls, 333empty_zone_proc (void *cls,
334 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 334 const struct GNUNET_IDENTITY_PrivateKey *zone,
335 const char *label, 335 const char *label,
336 unsigned int rd_count, 336 unsigned int rd_count,
337 const struct GNUNET_GNSRECORD_Data *rd) 337 const struct GNUNET_GNSRECORD_Data *rd)
@@ -362,34 +362,11 @@ empty_zone_proc (void *cls,
362static void 362static void
363empty_zone_end (void *cls) 363empty_zone_end (void *cls)
364{ 364{
365 char *hostkey_file;
366
367 zi = NULL; 365 zi = NULL;
368 GNUNET_asprintf (&hostkey_file, 366 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
369 "zonefiles%s%s", 367 privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
370 DIR_SEPARATOR_STR, 368 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
371 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 369 GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key);
372 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
373 "Using zonekey file `%s' \n",
374 hostkey_file);
375 GNUNET_assert (GNUNET_SYSERR !=
376 GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file,
377 GNUNET_YES,
378 &privkey));
379 GNUNET_free (hostkey_file);
380
381 GNUNET_asprintf (&hostkey_file,
382 "zonefiles%s%s",
383 DIR_SEPARATOR_STR,
384 "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey");
385 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
386 "Using zonekey file `%s' \n",
387 hostkey_file);
388 GNUNET_assert (GNUNET_SYSERR !=
389 GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file,
390 GNUNET_YES,
391 &privkey2));
392 GNUNET_free (hostkey_file);
393 370
394 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); 371 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n");
395 372
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c
index 4e54a05d2..c203a63a6 100644
--- a/src/namestore/test_namestore_api_zone_iteration_nick.c
+++ b/src/namestore/test_namestore_api_zone_iteration_nick.c
@@ -38,9 +38,9 @@
38 38
39static struct GNUNET_NAMESTORE_Handle *nsh; 39static struct GNUNET_NAMESTORE_Handle *nsh;
40 40
41static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 41static struct GNUNET_IDENTITY_PrivateKey privkey;
42 42
43static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; 43static struct GNUNET_IDENTITY_PrivateKey privkey2;
44 44
45static struct GNUNET_NAMESTORE_ZoneIterator *zi; 45static struct GNUNET_NAMESTORE_ZoneIterator *zi;
46 46
@@ -153,7 +153,7 @@ zone_proc_end (void *cls)
153 153
154static void 154static void
155zone_proc (void *cls, 155zone_proc (void *cls,
156 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 156 const struct GNUNET_IDENTITY_PrivateKey *zone,
157 const char *label, 157 const char *label,
158 unsigned int rd_count, 158 unsigned int rd_count,
159 const struct GNUNET_GNSRECORD_Data *rd) 159 const struct GNUNET_GNSRECORD_Data *rd)
@@ -345,7 +345,7 @@ nick_1_cont (void *cls, int32_t success, const char *emsg)
345 */ 345 */
346static void 346static void
347empty_zone_proc (void *cls, 347empty_zone_proc (void *cls,
348 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 348 const struct GNUNET_IDENTITY_PrivateKey *zone,
349 const char *label, 349 const char *label,
350 unsigned int rd_count, 350 unsigned int rd_count,
351 const struct GNUNET_GNSRECORD_Data *rd) 351 const struct GNUNET_GNSRECORD_Data *rd)
@@ -379,8 +379,10 @@ empty_zone_end (void *cls)
379 struct GNUNET_GNSRECORD_Data rd; 379 struct GNUNET_GNSRECORD_Data rd;
380 380
381 zi = NULL; 381 zi = NULL;
382 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 382 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
383 GNUNET_CRYPTO_ecdsa_key_create (&privkey2); 383 privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
384 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
385 GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key);
384 386
385 memset (&rd, 0, sizeof(rd)); 387 memset (&rd, 0, sizeof(rd));
386 rd.data = ZONE_NICK_1; 388 rd.data = ZONE_NICK_1;
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index 30920713f..70097a69e 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
38 38
39static struct GNUNET_SCHEDULER_Task *endbadly_task; 39static struct GNUNET_SCHEDULER_Task *endbadly_task;
40 40
41static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 41static struct GNUNET_IDENTITY_PrivateKey privkey;
42 42
43static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; 43static struct GNUNET_IDENTITY_PrivateKey privkey2;
44 44
45static struct GNUNET_NAMESTORE_ZoneIterator *zi; 45static struct GNUNET_NAMESTORE_ZoneIterator *zi;
46 46
@@ -124,7 +124,7 @@ fail_cb (void *cls)
124 124
125static void 125static void
126zone_proc (void *cls, 126zone_proc (void *cls,
127 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 127 const struct GNUNET_IDENTITY_PrivateKey *zone,
128 const char *label, 128 const char *label,
129 unsigned int rd_count, 129 unsigned int rd_count,
130 const struct GNUNET_GNSRECORD_Data *rd) 130 const struct GNUNET_GNSRECORD_Data *rd)
@@ -309,7 +309,7 @@ create_record (unsigned int count)
309 */ 309 */
310static void 310static void
311empty_zone_proc (void *cls, 311empty_zone_proc (void *cls,
312 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 312 const struct GNUNET_IDENTITY_PrivateKey *zone,
313 const char *label, 313 const char *label,
314 unsigned int rd_count, 314 unsigned int rd_count,
315 const struct GNUNET_GNSRECORD_Data *rd) 315 const struct GNUNET_GNSRECORD_Data *rd)
@@ -341,8 +341,10 @@ static void
341empty_zone_proc_end (void *cls) 341empty_zone_proc_end (void *cls)
342{ 342{
343 zi = NULL; 343 zi = NULL;
344 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 344 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
345 GNUNET_CRYPTO_ecdsa_key_create (&privkey2); 345 privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
346 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
347 GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key);
346 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 348 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
347 "Created record 1\n"); 349 "Created record 1\n");
348 GNUNET_asprintf (&s_name_1, 350 GNUNET_asprintf (&s_name_1,
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index bdcdd1706..71b36ba09 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -34,9 +34,9 @@
34 34
35static struct GNUNET_NAMESTORE_Handle *nsh; 35static struct GNUNET_NAMESTORE_Handle *nsh;
36 36
37static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 37static struct GNUNET_IDENTITY_PrivateKey privkey;
38 38
39static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; 39static struct GNUNET_IDENTITY_PrivateKey privkey2;
40 40
41static struct GNUNET_NAMESTORE_ZoneIterator *zi; 41static struct GNUNET_NAMESTORE_ZoneIterator *zi;
42 42
@@ -112,7 +112,7 @@ fail_cb (void *cls)
112 112
113static void 113static void
114zone_proc (void *cls, 114zone_proc (void *cls,
115 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 115 const struct GNUNET_IDENTITY_PrivateKey *zone,
116 const char *label, 116 const char *label,
117 unsigned int rd_count, 117 unsigned int rd_count,
118 const struct GNUNET_GNSRECORD_Data *rd) 118 const struct GNUNET_GNSRECORD_Data *rd)
@@ -318,7 +318,7 @@ create_record (unsigned int count)
318 */ 318 */
319static void 319static void
320empty_zone_proc (void *cls, 320empty_zone_proc (void *cls,
321 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 321 const struct GNUNET_IDENTITY_PrivateKey *zone,
322 const char *label, 322 const char *label,
323 unsigned int rd_count, 323 unsigned int rd_count,
324 const struct GNUNET_GNSRECORD_Data *rd) 324 const struct GNUNET_GNSRECORD_Data *rd)
@@ -347,34 +347,13 @@ empty_zone_proc (void *cls,
347static void 347static void
348empty_zone_proc_end (void *cls) 348empty_zone_proc_end (void *cls)
349{ 349{
350 char *hostkey_file;
351
352 GNUNET_assert (nsh == cls); 350 GNUNET_assert (nsh == cls);
353 zi = NULL; 351 zi = NULL;
354 GNUNET_asprintf (&hostkey_file, 352 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
355 "zonefiles%s%s", 353 privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
356 DIR_SEPARATOR_STR, 354 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
357 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 355 GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key);
358 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 356
359 "Using zonekey file `%s' \n",
360 hostkey_file);
361 GNUNET_assert (GNUNET_SYSERR
362 != GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file,
363 GNUNET_YES,
364 &privkey));
365 GNUNET_free (hostkey_file);
366 GNUNET_asprintf (&hostkey_file,
367 "zonefiles%s%s",
368 DIR_SEPARATOR_STR,
369 "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey");
370 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
371 "Using zonekey file `%s'\n",
372 hostkey_file);
373 GNUNET_assert (GNUNET_SYSERR !=
374 GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file,
375 GNUNET_YES,
376 &privkey2));
377 GNUNET_free (hostkey_file);
378 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
379 "Created record 1\n"); 358 "Created record 1\n");
380 359
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c
index 94cc5c285..e5ede6bcd 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -42,11 +42,11 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
42 42
43static struct GNUNET_SCHEDULER_Task *endbadly_task; 43static struct GNUNET_SCHEDULER_Task *endbadly_task;
44 44
45static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; 45static struct GNUNET_IDENTITY_PrivateKey privkey;
46 46
47static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 47static struct GNUNET_IDENTITY_PublicKey pubkey;
48 48
49static struct GNUNET_CRYPTO_EcdsaPublicKey s_zone_value; 49static struct GNUNET_IDENTITY_PublicKey s_zone_value;
50 50
51static char *s_name; 51static char *s_name;
52 52
@@ -92,7 +92,7 @@ end (void *cls)
92 92
93static void 93static void
94zone_to_name_proc (void *cls, 94zone_to_name_proc (void *cls,
95 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 95 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
96 const char *n, 96 const char *n,
97 unsigned int rd_count, 97 unsigned int rd_count,
98 const struct GNUNET_GNSRECORD_Data *rd) 98 const struct GNUNET_GNSRECORD_Data *rd)
@@ -203,10 +203,11 @@ run (void *cls,
203 GNUNET_SCHEDULER_add_shutdown (&end, 203 GNUNET_SCHEDULER_add_shutdown (&end,
204 NULL); 204 NULL);
205 GNUNET_asprintf (&s_name, "dummy"); 205 GNUNET_asprintf (&s_name, "dummy");
206 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 206 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
207 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
207 /* get public key */ 208 /* get public key */
208 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 209 GNUNET_IDENTITY_key_get_public (&privkey,
209 &pubkey); 210 &pubkey);
210 211
211 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, 212 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
212 &s_zone_value, 213 &s_zone_value,
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c
index 0f9ce97e4..baea0e444 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -85,14 +85,14 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
85static void 85static void
86test_record (void *cls, 86test_record (void *cls,
87 uint64_t seq, 87 uint64_t seq,
88 const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, 88 const struct GNUNET_IDENTITY_PrivateKey *private_key,
89 const char *label, 89 const char *label,
90 unsigned int rd_count, 90 unsigned int rd_count,
91 const struct GNUNET_GNSRECORD_Data *rd) 91 const struct GNUNET_GNSRECORD_Data *rd)
92{ 92{
93 int *idp = cls; 93 int *idp = cls;
94 int id = *idp; 94 int id = *idp;
95 struct GNUNET_CRYPTO_EcdsaPrivateKey tzone_private_key; 95 struct GNUNET_IDENTITY_PrivateKey tzone_private_key;
96 char tname[64]; 96 char tname[64];
97 unsigned int trd_count = 1 + (id % 1024); 97 unsigned int trd_count = 1 + (id % 1024);
98 98
@@ -123,7 +123,7 @@ get_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id)
123static void 123static void
124put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id) 124put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id)
125{ 125{
126 struct GNUNET_CRYPTO_EcdsaPrivateKey zone_private_key; 126 struct GNUNET_IDENTITY_PrivateKey zone_private_key;
127 char label[64]; 127 char label[64];
128 unsigned int rd_count = 1 + (id % 1024); 128 unsigned int rd_count = 1 + (id % 1024);
129 struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL (rd_count)]; 129 struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL (rd_count)];
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c
index 81a16b245..f653a716e 100644
--- a/src/nse/gnunet-nse-profiler.c
+++ b/src/nse/gnunet-nse-profiler.c
@@ -317,7 +317,7 @@ handle_estimate (void *cls,
317 } 317 }
318 size = GNUNET_snprintf (output_buffer, 318 size = GNUNET_snprintf (output_buffer,
319 sizeof(output_buffer), 319 sizeof(output_buffer),
320 "%p %llu %llu %f %f %f\n", 320 "%p %u %llu %f %f %f\n",
321 peer, 321 peer,
322 peers_running, 322 peers_running,
323 (unsigned long long) timestamp.abs_value_us, 323 (unsigned long long) timestamp.abs_value_us,
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index 739249a93..987c7c3a0 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -338,9 +338,9 @@ print_address (void *cls,
338 ar->pc = pc; 338 ar->pc = pc;
339 ar->expiration = expiration; 339 ar->expiration = expiration;
340 GNUNET_asprintf (&ar->result, 340 GNUNET_asprintf (&ar->result,
341 "%s:%u:%u", 341 "%s:%lu:%u",
342 address->transport_name, 342 address->transport_name,
343 address->address_length, 343 (unsigned long) address->address_length,
344 address->local_info); 344 address->local_info);
345 ar->atsc = GNUNET_TRANSPORT_address_to_string (cfg, 345 ar->atsc = GNUNET_TRANSPORT_address_to_string (cfg,
346 address, 346 address,
diff --git a/src/peerinfo-tool/plugin_rest_peerinfo.c b/src/peerinfo-tool/plugin_rest_peerinfo.c
index 99cec7e58..4bbc7442e 100644
--- a/src/peerinfo-tool/plugin_rest_peerinfo.c
+++ b/src/peerinfo-tool/plugin_rest_peerinfo.c
@@ -554,9 +554,9 @@ print_address (void *cls,
554 ar->pc = pc; 554 ar->pc = pc;
555 ar->expiration = expiration; 555 ar->expiration = expiration;
556 GNUNET_asprintf (&ar->result, 556 GNUNET_asprintf (&ar->result,
557 "%s:%u:%u", 557 "%s:%lu:%u",
558 address->transport_name, 558 address->transport_name,
559 address->address_length, 559 (unsigned long) address->address_length,
560 address->local_info); 560 address->local_info);
561 ar->atsc = GNUNET_TRANSPORT_address_to_string (cfg, 561 ar->atsc = GNUNET_TRANSPORT_address_to_string (cfg,
562 address, 562 address,
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am
index a58127abf..9463f19d9 100644
--- a/src/reclaim/Makefile.am
+++ b/src/reclaim/Makefile.am
@@ -103,6 +103,7 @@ gnunet_service_reclaim_SOURCES = \
103 gnunet-service-reclaim_tickets.h 103 gnunet-service-reclaim_tickets.h
104gnunet_service_reclaim_LDADD = \ 104gnunet_service_reclaim_LDADD = \
105 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 105 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
106 $(top_builddir)/src/identity/libgnunetidentity.la \
106 $(top_builddir)/src/util/libgnunetutil.la \ 107 $(top_builddir)/src/util/libgnunetutil.la \
107 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 108 $(top_builddir)/src/namestore/libgnunetnamestore.la \
108 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 109 $(top_builddir)/src/statistics/libgnunetstatistics.la \
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
index b9306b802..cefb66b8f 100644
--- a/src/reclaim/gnunet-reclaim.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -152,12 +152,12 @@ static struct GNUNET_RECLAIM_TicketIterator *ticket_iterator;
152/** 152/**
153 * ego private key 153 * ego private key
154 */ 154 */
155static const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey; 155static const struct GNUNET_IDENTITY_PrivateKey *pkey;
156 156
157/** 157/**
158 * rp public key 158 * rp public key
159 */ 159 */
160static struct GNUNET_CRYPTO_EcdsaPublicKey rp_key; 160static struct GNUNET_IDENTITY_PublicKey rp_key;
161 161
162/** 162/**
163 * Ticket to consume 163 * Ticket to consume
@@ -261,7 +261,7 @@ store_cont (void *cls, int32_t success, const char *emsg)
261 261
262static void 262static void
263process_attrs (void *cls, 263process_attrs (void *cls,
264 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 264 const struct GNUNET_IDENTITY_PublicKey *identity,
265 const struct GNUNET_RECLAIM_Attribute *attr, 265 const struct GNUNET_RECLAIM_Attribute *attr,
266 const struct GNUNET_RECLAIM_Presentation *presentation) 266 const struct GNUNET_RECLAIM_Presentation *presentation)
267{ 267{
@@ -346,7 +346,7 @@ ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
346 aud = 346 aud =
347 GNUNET_STRINGS_data_to_string_alloc (&ticket->audience, 347 GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
348 sizeof(struct 348 sizeof(struct
349 GNUNET_CRYPTO_EcdsaPublicKey)); 349 GNUNET_IDENTITY_PublicKey));
350 ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd)); 350 ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
351 tkt = 351 tkt =
352 GNUNET_STRINGS_data_to_string_alloc (ticket, 352 GNUNET_STRINGS_data_to_string_alloc (ticket,
@@ -511,7 +511,7 @@ iter_finished (void *cls)
511 511
512static void 512static void
513iter_cb (void *cls, 513iter_cb (void *cls,
514 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 514 const struct GNUNET_IDENTITY_PublicKey *identity,
515 const struct GNUNET_RECLAIM_Attribute *attr) 515 const struct GNUNET_RECLAIM_Attribute *attr)
516{ 516{
517 struct GNUNET_RECLAIM_AttributeListEntry *le; 517 struct GNUNET_RECLAIM_AttributeListEntry *le;
@@ -653,7 +653,7 @@ cred_iter_finished (void *cls)
653 653
654static void 654static void
655cred_iter_cb (void *cls, 655cred_iter_cb (void *cls,
656 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 656 const struct GNUNET_IDENTITY_PublicKey *identity,
657 const struct GNUNET_RECLAIM_Credential *cred) 657 const struct GNUNET_RECLAIM_Credential *cred)
658{ 658{
659 char *cred_str; 659 char *cred_str;
@@ -734,7 +734,7 @@ start_process ()
734 734
735 if ((NULL != rp) && 735 if ((NULL != rp) &&
736 (GNUNET_OK != 736 (GNUNET_OK !=
737 GNUNET_CRYPTO_ecdsa_public_key_from_string (rp, strlen (rp), &rp_key)) ) 737 GNUNET_IDENTITY_public_key_from_string (rp, &rp_key)) )
738 { 738 {
739 fprintf (stderr, "%s is not a public key!\n", rp); 739 fprintf (stderr, "%s is not a public key!\n", rp);
740 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 740 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index d2cdc62a2..0774fecea 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -110,7 +110,7 @@ struct Iterator
110 /** 110 /**
111 * Key of the zone we are iterating over. 111 * Key of the zone we are iterating over.
112 */ 112 */
113 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 113 struct GNUNET_IDENTITY_PrivateKey identity;
114 114
115 /** 115 /**
116 * Namestore iterator 116 * Namestore iterator
@@ -266,7 +266,7 @@ struct AttributeDeleteHandle
266 /** 266 /**
267 * Identity 267 * Identity
268 */ 268 */
269 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 269 struct GNUNET_IDENTITY_PrivateKey identity;
270 270
271 271
272 /** 272 /**
@@ -334,12 +334,12 @@ struct AttributeStoreHandle
334 /** 334 /**
335 * Identity 335 * Identity
336 */ 336 */
337 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 337 struct GNUNET_IDENTITY_PrivateKey identity;
338 338
339 /** 339 /**
340 * Identity pubkey 340 * Identity pubkey
341 */ 341 */
342 struct GNUNET_CRYPTO_EcdsaPublicKey identity_pkey; 342 struct GNUNET_IDENTITY_PublicKey identity_pkey;
343 343
344 /** 344 /**
345 * QueueEntry 345 * QueueEntry
@@ -862,7 +862,7 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
862 */ 862 */
863static void 863static void
864consume_result_cb (void *cls, 864consume_result_cb (void *cls,
865 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 865 const struct GNUNET_IDENTITY_PublicKey *identity,
866 const struct GNUNET_RECLAIM_AttributeList *attrs, 866 const struct GNUNET_RECLAIM_AttributeList *attrs,
867 const struct GNUNET_RECLAIM_PresentationList *presentations, 867 const struct GNUNET_RECLAIM_PresentationList *presentations,
868 int32_t success, 868 int32_t success,
@@ -1082,7 +1082,7 @@ handle_attribute_store_message (void *cls,
1082 ash->r_id = ntohl (sam->id); 1082 ash->r_id = ntohl (sam->id);
1083 ash->identity = sam->identity; 1083 ash->identity = sam->identity;
1084 ash->exp.rel_value_us = GNUNET_ntohll (sam->exp); 1084 ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1085 GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity, &ash->identity_pkey); 1085 GNUNET_IDENTITY_key_get_public (&sam->identity, &ash->identity_pkey);
1086 1086
1087 GNUNET_SERVICE_client_continue (idp->client); 1087 GNUNET_SERVICE_client_continue (idp->client);
1088 ash->client = idp; 1088 ash->client = idp;
@@ -1157,7 +1157,7 @@ cred_error (void *cls)
1157*/ 1157*/
1158static void 1158static void
1159cred_add_cb (void *cls, 1159cred_add_cb (void *cls,
1160 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1160 const struct GNUNET_IDENTITY_PrivateKey *zone,
1161 const char *label, 1161 const char *label,
1162 unsigned int rd_count, 1162 unsigned int rd_count,
1163 const struct GNUNET_GNSRECORD_Data *rd) 1163 const struct GNUNET_GNSRECORD_Data *rd)
@@ -1266,7 +1266,7 @@ handle_credential_store_message (void *cls,
1266 ash->r_id = ntohl (sam->id); 1266 ash->r_id = ntohl (sam->id);
1267 ash->identity = sam->identity; 1267 ash->identity = sam->identity;
1268 ash->exp.rel_value_us = GNUNET_ntohll (sam->exp); 1268 ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1269 GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity, &ash->identity_pkey); 1269 GNUNET_IDENTITY_key_get_public (&sam->identity, &ash->identity_pkey);
1270 1270
1271 GNUNET_SERVICE_client_continue (idp->client); 1271 GNUNET_SERVICE_client_continue (idp->client);
1272 ash->client = idp; 1272 ash->client = idp;
@@ -1311,7 +1311,7 @@ send_delete_response (struct AttributeDeleteHandle *adh, int32_t success)
1311 */ 1311 */
1312static void 1312static void
1313ticket_iter (void *cls, 1313ticket_iter (void *cls,
1314 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1314 const struct GNUNET_IDENTITY_PrivateKey *zone,
1315 const char *label, 1315 const char *label,
1316 unsigned int rd_count, 1316 unsigned int rd_count,
1317 const struct GNUNET_GNSRECORD_Data *rd) 1317 const struct GNUNET_GNSRECORD_Data *rd)
@@ -1739,7 +1739,7 @@ attr_iter_error (void *cls)
1739 */ 1739 */
1740static void 1740static void
1741attr_iter_cb (void *cls, 1741attr_iter_cb (void *cls,
1742 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1742 const struct GNUNET_IDENTITY_PrivateKey *zone,
1743 const char *label, 1743 const char *label,
1744 unsigned int rd_count, 1744 unsigned int rd_count,
1745 const struct GNUNET_GNSRECORD_Data *rd) 1745 const struct GNUNET_GNSRECORD_Data *rd)
@@ -1764,7 +1764,7 @@ attr_iter_cb (void *cls,
1764 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); 1764 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
1765 arm->id = htonl (ai->request_id); 1765 arm->id = htonl (ai->request_id);
1766 arm->attr_len = htons (rd->data_size); 1766 arm->attr_len = htons (rd->data_size);
1767 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); 1767 GNUNET_IDENTITY_key_get_public (zone, &arm->identity);
1768 data_tmp = (char *) &arm[1]; 1768 data_tmp = (char *) &arm[1];
1769 GNUNET_memcpy (data_tmp, rd->data, rd->data_size); 1769 GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1770 GNUNET_MQ_send (ai->client->mq, env); 1770 GNUNET_MQ_send (ai->client->mq, env);
@@ -1923,7 +1923,7 @@ cred_iter_error (void *cls)
1923 */ 1923 */
1924static void 1924static void
1925cred_iter_cb (void *cls, 1925cred_iter_cb (void *cls,
1926 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1926 const struct GNUNET_IDENTITY_PrivateKey *zone,
1927 const char *label, 1927 const char *label,
1928 unsigned int rd_count, 1928 unsigned int rd_count,
1929 const struct GNUNET_GNSRECORD_Data *rd) 1929 const struct GNUNET_GNSRECORD_Data *rd)
@@ -1948,7 +1948,7 @@ cred_iter_cb (void *cls,
1948 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); 1948 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT);
1949 arm->id = htonl (ai->request_id); 1949 arm->id = htonl (ai->request_id);
1950 arm->credential_len = htons (rd->data_size); 1950 arm->credential_len = htons (rd->data_size);
1951 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); 1951 GNUNET_IDENTITY_key_get_public (zone, &arm->identity);
1952 data_tmp = (char *) &arm[1]; 1952 data_tmp = (char *) &arm[1];
1953 GNUNET_memcpy (data_tmp, rd->data, rd->data_size); 1953 GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1954 1954
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c
index 4dd8100f9..0b1730bec 100644
--- a/src/reclaim/gnunet-service-reclaim_tickets.c
+++ b/src/reclaim/gnunet-service-reclaim_tickets.c
@@ -86,12 +86,12 @@ struct RECLAIM_TICKETS_ConsumeHandle
86 /** 86 /**
87 * Audience Key 87 * Audience Key
88 */ 88 */
89 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 89 struct GNUNET_IDENTITY_PrivateKey identity;
90 90
91 /** 91 /**
92 * Audience Key 92 * Audience Key
93 */ 93 */
94 struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub; 94 struct GNUNET_IDENTITY_PublicKey identity_pub;
95 95
96 /** 96 /**
97 * Lookup DLL 97 * Lookup DLL
@@ -180,7 +180,7 @@ struct TicketIssueHandle
180 /** 180 /**
181 * Issuer Key 181 * Issuer Key
182 */ 182 */
183 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 183 struct GNUNET_IDENTITY_PrivateKey identity;
184 184
185 /** 185 /**
186 * Ticket to issue 186 * Ticket to issue
@@ -263,7 +263,7 @@ struct RECLAIM_TICKETS_RevokeHandle
263 /** 263 /**
264 * Issuer Key 264 * Issuer Key
265 */ 265 */
266 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 266 struct GNUNET_IDENTITY_PrivateKey identity;
267 267
268 /** 268 /**
269 * Callback 269 * Callback
@@ -490,7 +490,7 @@ rvk_ticket_update_finished (void *cls)
490 */ 490 */
491static void 491static void
492rvk_ticket_update (void *cls, 492rvk_ticket_update (void *cls,
493 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 493 const struct GNUNET_IDENTITY_PrivateKey *zone,
494 const char *label, 494 const char *label,
495 unsigned int rd_count, 495 unsigned int rd_count,
496 const struct GNUNET_GNSRECORD_Data *rd) 496 const struct GNUNET_GNSRECORD_Data *rd)
@@ -665,7 +665,7 @@ move_attr_finished (void *cls, int32_t success, const char *emsg)
665 */ 665 */
666static void 666static void
667rvk_move_attr_cb (void *cls, 667rvk_move_attr_cb (void *cls,
668 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 668 const struct GNUNET_IDENTITY_PrivateKey *zone,
669 const char *label, 669 const char *label,
670 unsigned int rd_count, 670 unsigned int rd_count,
671 const struct GNUNET_GNSRECORD_Data *rd) 671 const struct GNUNET_GNSRECORD_Data *rd)
@@ -850,7 +850,7 @@ remove_ticket_cont (void *cls, int32_t success, const char *emsg)
850 */ 850 */
851static void 851static void
852revoke_attrs_cb (void *cls, 852revoke_attrs_cb (void *cls,
853 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 853 const struct GNUNET_IDENTITY_PrivateKey *zone,
854 const char *label, 854 const char *label,
855 unsigned int rd_count, 855 unsigned int rd_count,
856 const struct GNUNET_GNSRECORD_Data *rd) 856 const struct GNUNET_GNSRECORD_Data *rd)
@@ -913,7 +913,7 @@ rvk_attrs_err_cb (void *cls)
913 */ 913 */
914struct RECLAIM_TICKETS_RevokeHandle * 914struct RECLAIM_TICKETS_RevokeHandle *
915RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket, 915RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket,
916 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 916 const struct GNUNET_IDENTITY_PrivateKey *identity,
917 RECLAIM_TICKETS_RevokeCallback cb, 917 RECLAIM_TICKETS_RevokeCallback cb,
918 void *cb_cls) 918 void *cb_cls)
919{ 919{
@@ -925,7 +925,7 @@ RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket,
925 rvk->cb_cls = cb_cls; 925 rvk->cb_cls = cb_cls;
926 rvk->identity = *identity; 926 rvk->identity = *identity;
927 rvk->ticket = *ticket; 927 rvk->ticket = *ticket;
928 GNUNET_CRYPTO_ecdsa_key_get_public (&rvk->identity, &rvk->ticket.identity); 928 GNUNET_IDENTITY_key_get_public (&rvk->identity, &rvk->ticket.identity);
929 /** Get shared attributes **/ 929 /** Get shared attributes **/
930 label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, 930 label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
931 sizeof(ticket->rnd)); 931 sizeof(ticket->rnd));
@@ -1184,7 +1184,7 @@ lookup_authz_cb (void *cls,
1184 * @return handle to the operation 1184 * @return handle to the operation
1185 */ 1185 */
1186struct RECLAIM_TICKETS_ConsumeHandle * 1186struct RECLAIM_TICKETS_ConsumeHandle *
1187RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id, 1187RECLAIM_TICKETS_consume (const struct GNUNET_IDENTITY_PrivateKey *id,
1188 const struct GNUNET_RECLAIM_Ticket *ticket, 1188 const struct GNUNET_RECLAIM_Ticket *ticket,
1189 RECLAIM_TICKETS_ConsumeCallback cb, 1189 RECLAIM_TICKETS_ConsumeCallback cb,
1190 void *cb_cls) 1190 void *cb_cls)
@@ -1195,7 +1195,7 @@ RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id,
1195 cth = GNUNET_new (struct RECLAIM_TICKETS_ConsumeHandle); 1195 cth = GNUNET_new (struct RECLAIM_TICKETS_ConsumeHandle);
1196 1196
1197 cth->identity = *id; 1197 cth->identity = *id;
1198 GNUNET_CRYPTO_ecdsa_key_get_public (&cth->identity, &cth->identity_pub); 1198 GNUNET_IDENTITY_key_get_public (&cth->identity, &cth->identity_pub);
1199 cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); 1199 cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
1200 cth->presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList); 1200 cth->presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList);
1201 cth->ticket = *ticket; 1201 cth->ticket = *ticket;
@@ -1453,7 +1453,7 @@ filter_tickets_error_cb (void *cls)
1453 */ 1453 */
1454static void 1454static void
1455filter_tickets_cb (void *cls, 1455filter_tickets_cb (void *cls,
1456 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1456 const struct GNUNET_IDENTITY_PrivateKey *zone,
1457 const char *label, 1457 const char *label,
1458 unsigned int rd_count, 1458 unsigned int rd_count,
1459 const struct GNUNET_GNSRECORD_Data *rd) 1459 const struct GNUNET_GNSRECORD_Data *rd)
@@ -1489,7 +1489,7 @@ filter_tickets_cb (void *cls,
1489 // cmp audience 1489 // cmp audience
1490 if (0 == memcmp (&tih->ticket.audience, 1490 if (0 == memcmp (&tih->ticket.audience,
1491 &ticket->audience, 1491 &ticket->audience,
1492 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))) 1492 sizeof(struct GNUNET_IDENTITY_PublicKey)))
1493 { 1493 {
1494 tih->ticket = *ticket; 1494 tih->ticket = *ticket;
1495 continue; 1495 continue;
@@ -1602,7 +1602,7 @@ filter_tickets_finished_cb (void *cls)
1602{ 1602{
1603 struct TicketIssueHandle *tih = cls; 1603 struct TicketIssueHandle *tih = cls;
1604 1604
1605 GNUNET_CRYPTO_ecdsa_key_get_public (&tih->identity, &tih->ticket.identity); 1605 GNUNET_IDENTITY_key_get_public (&tih->identity, &tih->ticket.identity);
1606 GNUNET_RECLAIM_id_generate (&tih->ticket.rnd); 1606 GNUNET_RECLAIM_id_generate (&tih->ticket.rnd);
1607 issue_ticket (tih); 1607 issue_ticket (tih);
1608} 1608}
@@ -1620,9 +1620,9 @@ filter_tickets_finished_cb (void *cls)
1620 * FIXME: Return handle?? 1620 * FIXME: Return handle??
1621 */ 1621 */
1622void 1622void
1623RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1623RECLAIM_TICKETS_issue (const struct GNUNET_IDENTITY_PrivateKey *identity,
1624 const struct GNUNET_RECLAIM_AttributeList *attrs, 1624 const struct GNUNET_RECLAIM_AttributeList *attrs,
1625 const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, 1625 const struct GNUNET_IDENTITY_PublicKey *audience,
1626 RECLAIM_TICKETS_TicketResult cb, 1626 RECLAIM_TICKETS_TicketResult cb,
1627 void *cb_cls) 1627 void *cb_cls)
1628{ 1628{
@@ -1680,7 +1680,7 @@ cleanup_iter (struct RECLAIM_TICKETS_Iterator *iter)
1680 */ 1680 */
1681static void 1681static void
1682collect_tickets_cb (void *cls, 1682collect_tickets_cb (void *cls,
1683 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1683 const struct GNUNET_IDENTITY_PrivateKey *zone,
1684 const char *label, 1684 const char *label,
1685 unsigned int rd_count, 1685 unsigned int rd_count,
1686 const struct GNUNET_GNSRECORD_Data *rd) 1686 const struct GNUNET_GNSRECORD_Data *rd)
@@ -1765,7 +1765,7 @@ RECLAIM_TICKETS_iteration_stop (struct RECLAIM_TICKETS_Iterator *iter)
1765 */ 1765 */
1766struct RECLAIM_TICKETS_Iterator * 1766struct RECLAIM_TICKETS_Iterator *
1767RECLAIM_TICKETS_iteration_start ( 1767RECLAIM_TICKETS_iteration_start (
1768 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1768 const struct GNUNET_IDENTITY_PrivateKey *identity,
1769 RECLAIM_TICKETS_TicketIter cb, 1769 RECLAIM_TICKETS_TicketIter cb,
1770 void *cb_cls) 1770 void *cb_cls)
1771{ 1771{
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.h b/src/reclaim/gnunet-service-reclaim_tickets.h
index 0dd790fc7..9c31a6143 100644
--- a/src/reclaim/gnunet-service-reclaim_tickets.h
+++ b/src/reclaim/gnunet-service-reclaim_tickets.h
@@ -138,7 +138,7 @@ typedef void (*RECLAIM_TICKETS_TicketResult) (
138 */ 138 */
139typedef void (*RECLAIM_TICKETS_ConsumeCallback) ( 139typedef void (*RECLAIM_TICKETS_ConsumeCallback) (
140 void *cls, 140 void *cls,
141 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 141 const struct GNUNET_IDENTITY_PublicKey *identity,
142 const struct GNUNET_RECLAIM_AttributeList *attributes, 142 const struct GNUNET_RECLAIM_AttributeList *attributes,
143 const struct GNUNET_RECLAIM_PresentationList *presentations, 143 const struct GNUNET_RECLAIM_PresentationList *presentations,
144 int32_t success, 144 int32_t success,
@@ -167,7 +167,7 @@ typedef void (*RECLAIM_TICKETS_RevokeCallback) (void *cls, int32_t success);
167 */ 167 */
168struct RECLAIM_TICKETS_RevokeHandle * 168struct RECLAIM_TICKETS_RevokeHandle *
169RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket, 169RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket,
170 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 170 const struct GNUNET_IDENTITY_PrivateKey *identity,
171 RECLAIM_TICKETS_RevokeCallback cb, 171 RECLAIM_TICKETS_RevokeCallback cb,
172 void *cb_cls); 172 void *cb_cls);
173 173
@@ -193,7 +193,7 @@ RECLAIM_TICKETS_revoke_cancel (struct RECLAIM_TICKETS_RevokeHandle *rh);
193 * @return handle to the operation 193 * @return handle to the operation
194 */ 194 */
195struct RECLAIM_TICKETS_ConsumeHandle * 195struct RECLAIM_TICKETS_ConsumeHandle *
196RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id, 196RECLAIM_TICKETS_consume (const struct GNUNET_IDENTITY_PrivateKey *id,
197 const struct GNUNET_RECLAIM_Ticket *ticket, 197 const struct GNUNET_RECLAIM_Ticket *ticket,
198 RECLAIM_TICKETS_ConsumeCallback cb, 198 RECLAIM_TICKETS_ConsumeCallback cb,
199 void *cb_cls); 199 void *cb_cls);
@@ -220,9 +220,9 @@ RECLAIM_TICKETS_consume_cancel (struct RECLAIM_TICKETS_ConsumeHandle *cth);
220 * FIXME: Return handle?? 220 * FIXME: Return handle??
221 */ 221 */
222void 222void
223RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 223RECLAIM_TICKETS_issue (const struct GNUNET_IDENTITY_PrivateKey *identity,
224 const struct GNUNET_RECLAIM_AttributeList *attrs, 224 const struct GNUNET_RECLAIM_AttributeList *attrs,
225 const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, 225 const struct GNUNET_IDENTITY_PublicKey *audience,
226 RECLAIM_TICKETS_TicketResult cb, 226 RECLAIM_TICKETS_TicketResult cb,
227 void *cb_cls); 227 void *cb_cls);
228 228
@@ -255,7 +255,7 @@ RECLAIM_TICKETS_iteration_stop (struct RECLAIM_TICKETS_Iterator *iter);
255 */ 255 */
256struct RECLAIM_TICKETS_Iterator * 256struct RECLAIM_TICKETS_Iterator *
257RECLAIM_TICKETS_iteration_start ( 257RECLAIM_TICKETS_iteration_start (
258 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 258 const struct GNUNET_IDENTITY_PrivateKey *identity,
259 RECLAIM_TICKETS_TicketIter cb, 259 RECLAIM_TICKETS_TicketIter cb,
260 void *cb_cls); 260 void *cb_cls);
261 261
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c
index b307a358c..c3ff07976 100644
--- a/src/reclaim/oidc_helper.c
+++ b/src/reclaim/oidc_helper.c
@@ -155,7 +155,7 @@ fix_base64 (char *str)
155} 155}
156 156
157static json_t* 157static json_t*
158generate_userinfo_json(const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, 158generate_userinfo_json(const struct GNUNET_IDENTITY_PublicKey *sub_key,
159 const struct GNUNET_RECLAIM_AttributeList *attrs, 159 const struct GNUNET_RECLAIM_AttributeList *attrs,
160 const struct GNUNET_RECLAIM_PresentationList *presentations) 160 const struct GNUNET_RECLAIM_PresentationList *presentations)
161{ 161{
@@ -180,7 +180,7 @@ generate_userinfo_json(const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key,
180 subject = 180 subject =
181 GNUNET_STRINGS_data_to_string_alloc (sub_key, 181 GNUNET_STRINGS_data_to_string_alloc (sub_key,
182 sizeof(struct 182 sizeof(struct
183 GNUNET_CRYPTO_EcdsaPublicKey)); 183 GNUNET_IDENTITY_PublicKey));
184 body = json_object (); 184 body = json_object ();
185 aggr_names = json_object (); 185 aggr_names = json_object ();
186 aggr_sources = json_object (); 186 aggr_sources = json_object ();
@@ -295,7 +295,7 @@ generate_userinfo_json(const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key,
295 * @return Userinfo JSON 295 * @return Userinfo JSON
296 */ 296 */
297char * 297char *
298OIDC_generate_userinfo (const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, 298OIDC_generate_userinfo (const struct GNUNET_IDENTITY_PublicKey *sub_key,
299 const struct GNUNET_RECLAIM_AttributeList *attrs, 299 const struct GNUNET_RECLAIM_AttributeList *attrs,
300 const struct GNUNET_RECLAIM_PresentationList *presentations) 300 const struct GNUNET_RECLAIM_PresentationList *presentations)
301{ 301{
@@ -321,8 +321,8 @@ OIDC_generate_userinfo (const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key,
321 * @return a new base64-encoded JWT string. 321 * @return a new base64-encoded JWT string.
322 */ 322 */
323char * 323char *
324OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, 324OIDC_generate_id_token (const struct GNUNET_IDENTITY_PublicKey *aud_key,
325 const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, 325 const struct GNUNET_IDENTITY_PublicKey *sub_key,
326 const struct GNUNET_RECLAIM_AttributeList *attrs, 326 const struct GNUNET_RECLAIM_AttributeList *attrs,
327 const struct GNUNET_RECLAIM_PresentationList *presentations, 327 const struct GNUNET_RECLAIM_PresentationList *presentations,
328 const struct GNUNET_TIME_Relative *expiration_time, 328 const struct GNUNET_TIME_Relative *expiration_time,
@@ -356,11 +356,11 @@ OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
356 subject = 356 subject =
357 GNUNET_STRINGS_data_to_string_alloc (sub_key, 357 GNUNET_STRINGS_data_to_string_alloc (sub_key,
358 sizeof(struct 358 sizeof(struct
359 GNUNET_CRYPTO_EcdsaPublicKey)); 359 GNUNET_IDENTITY_PublicKey));
360 audience = 360 audience =
361 GNUNET_STRINGS_data_to_string_alloc (aud_key, 361 GNUNET_STRINGS_data_to_string_alloc (aud_key,
362 sizeof(struct 362 sizeof(struct
363 GNUNET_CRYPTO_EcdsaPublicKey)); 363 GNUNET_IDENTITY_PublicKey));
364 header = create_jwt_header (); 364 header = create_jwt_header ();
365 365
366 // aud REQUIRED public key client_id must be there 366 // aud REQUIRED public key client_id must be there
@@ -438,7 +438,7 @@ OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
438 * @return a new authorization code (caller must free) 438 * @return a new authorization code (caller must free)
439 */ 439 */
440char * 440char *
441OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, 441OIDC_build_authz_code (const struct GNUNET_IDENTITY_PrivateKey *issuer,
442 const struct GNUNET_RECLAIM_Ticket *ticket, 442 const struct GNUNET_RECLAIM_Ticket *ticket,
443 const struct GNUNET_RECLAIM_AttributeList *attrs, 443 const struct GNUNET_RECLAIM_AttributeList *attrs,
444 const struct GNUNET_RECLAIM_PresentationList *presentations, 444 const struct GNUNET_RECLAIM_PresentationList *presentations,
@@ -544,7 +544,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
544 buf_ptr += payload_len; 544 buf_ptr += payload_len;
545 // Sign and store signature 545 // Sign and store signature
546 if (GNUNET_SYSERR == 546 if (GNUNET_SYSERR ==
547 GNUNET_CRYPTO_ecdsa_sign_ (issuer, 547 GNUNET_CRYPTO_ecdsa_sign_ (&issuer->ecdsa_key,
548 purpose, 548 purpose,
549 (struct GNUNET_CRYPTO_EcdsaSignature *) 549 (struct GNUNET_CRYPTO_EcdsaSignature *)
550 buf_ptr)) 550 buf_ptr))
@@ -576,7 +576,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
576 * @return GNUNET_OK if successful, else GNUNET_SYSERR 576 * @return GNUNET_OK if successful, else GNUNET_SYSERR
577 */ 577 */
578int 578int
579OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, 579OIDC_parse_authz_code (const struct GNUNET_IDENTITY_PublicKey *audience,
580 const char *code, 580 const char *code,
581 const char *code_verifier, 581 const char *code_verifier,
582 struct GNUNET_RECLAIM_Ticket *ticket, 582 struct GNUNET_RECLAIM_Ticket *ticket,
@@ -687,7 +687,7 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
687 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN, 687 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN,
688 purpose, 688 purpose,
689 signature, 689 signature,
690 &ticket->identity)) 690 &ticket->identity.ecdsa_key))
691 { 691 {
692 GNUNET_free (code_payload); 692 GNUNET_free (code_payload);
693 if (NULL != *nonce_str) 693 if (NULL != *nonce_str)
diff --git a/src/reclaim/oidc_helper.h b/src/reclaim/oidc_helper.h
index 10a6f3d1f..eb1022423 100644
--- a/src/reclaim/oidc_helper.h
+++ b/src/reclaim/oidc_helper.h
@@ -50,8 +50,8 @@
50 * @return a new base64-encoded JWT string. 50 * @return a new base64-encoded JWT string.
51 */ 51 */
52char* 52char*
53OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, 53OIDC_generate_id_token (const struct GNUNET_IDENTITY_PublicKey *aud_key,
54 const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, 54 const struct GNUNET_IDENTITY_PublicKey *sub_key,
55 const struct GNUNET_RECLAIM_AttributeList *attrs, 55 const struct GNUNET_RECLAIM_AttributeList *attrs,
56 const struct GNUNET_RECLAIM_PresentationList *presentations, 56 const struct GNUNET_RECLAIM_PresentationList *presentations,
57 const struct GNUNET_TIME_Relative *expiration_time, 57 const struct GNUNET_TIME_Relative *expiration_time,
@@ -71,7 +71,7 @@ OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
71 * @return a new authorization code (caller must free) 71 * @return a new authorization code (caller must free)
72 */ 72 */
73char* 73char*
74OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, 74OIDC_build_authz_code (const struct GNUNET_IDENTITY_PrivateKey *issuer,
75 const struct GNUNET_RECLAIM_Ticket *ticket, 75 const struct GNUNET_RECLAIM_Ticket *ticket,
76 const struct GNUNET_RECLAIM_AttributeList *attrs, 76 const struct GNUNET_RECLAIM_AttributeList *attrs,
77 const struct GNUNET_RECLAIM_PresentationList *presentations, 77 const struct GNUNET_RECLAIM_PresentationList *presentations,
@@ -93,7 +93,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
93 * @return GNUNET_OK if successful, else GNUNET_SYSERR 93 * @return GNUNET_OK if successful, else GNUNET_SYSERR
94 */ 94 */
95int 95int
96OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *ecdsa_pub, 96OIDC_parse_authz_code (const struct GNUNET_IDENTITY_PublicKey *ecdsa_pub,
97 const char *code, 97 const char *code,
98 const char *code_verifier, 98 const char *code_verifier,
99 struct GNUNET_RECLAIM_Ticket *ticket, 99 struct GNUNET_RECLAIM_Ticket *ticket,
@@ -152,7 +152,7 @@ OIDC_check_scopes_for_claim_request (const char *scopes,
152 * @return Userinfo JSON 152 * @return Userinfo JSON
153 */ 153 */
154char * 154char *
155OIDC_generate_userinfo (const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, 155OIDC_generate_userinfo (const struct GNUNET_IDENTITY_PublicKey *sub_key,
156 const struct GNUNET_RECLAIM_AttributeList *attrs, 156 const struct GNUNET_RECLAIM_AttributeList *attrs,
157 const struct GNUNET_RECLAIM_PresentationList *presentations); 157 const struct GNUNET_RECLAIM_PresentationList *presentations);
158 158
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c
index 5b0bb2b6f..7a8a886bd 100644
--- a/src/reclaim/plugin_rest_openid_connect.c
+++ b/src/reclaim/plugin_rest_openid_connect.c
@@ -300,7 +300,7 @@ struct OIDC_Variables
300 /** 300 /**
301 * The RP client public key 301 * The RP client public key
302 */ 302 */
303 struct GNUNET_CRYPTO_EcdsaPublicKey client_pkey; 303 struct GNUNET_IDENTITY_PublicKey client_pkey;
304 304
305 /** 305 /**
306 * The OIDC client id of the RP 306 * The OIDC client id of the RP
@@ -411,7 +411,7 @@ struct RequestHandle
411 /** 411 /**
412 * Pointer to ego private key 412 * Pointer to ego private key
413 */ 413 */
414 struct GNUNET_CRYPTO_EcdsaPrivateKey priv_key; 414 struct GNUNET_IDENTITY_PrivateKey priv_key;
415 415
416 /** 416 /**
417 * OIDC variables 417 * OIDC variables
@@ -972,7 +972,7 @@ oidc_ticket_issue_cb (void *cls,
972 (NULL != handle->tld)) 972 (NULL != handle->tld))
973 { 973 {
974 GNUNET_asprintf (&redirect_uri, 974 GNUNET_asprintf (&redirect_uri,
975 "%s.%s/%s?%s=%s&state=%s", 975 "%s.%s/%s%s%s=%s&state=%s",
976 handle->redirect_prefix, 976 handle->redirect_prefix,
977 handle->tld, 977 handle->tld,
978 handle->redirect_suffix, 978 handle->redirect_suffix,
@@ -1087,7 +1087,7 @@ oidc_cred_collect_finished_cb (void *cls)
1087 */ 1087 */
1088static void 1088static void
1089oidc_cred_collect (void *cls, 1089oidc_cred_collect (void *cls,
1090 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1090 const struct GNUNET_IDENTITY_PublicKey *identity,
1091 const struct GNUNET_RECLAIM_Credential *cred) 1091 const struct GNUNET_RECLAIM_Credential *cred)
1092{ 1092{
1093 struct RequestHandle *handle = cls; 1093 struct RequestHandle *handle = cls;
@@ -1211,7 +1211,7 @@ attr_in_userinfo_request (struct RequestHandle *handle,
1211 */ 1211 */
1212static void 1212static void
1213oidc_attr_collect (void *cls, 1213oidc_attr_collect (void *cls,
1214 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1214 const struct GNUNET_IDENTITY_PublicKey *identity,
1215 const struct GNUNET_RECLAIM_Attribute *attr) 1215 const struct GNUNET_RECLAIM_Attribute *attr)
1216{ 1216{
1217 struct RequestHandle *handle = cls; 1217 struct RequestHandle *handle = cls;
@@ -1260,8 +1260,8 @@ code_redirect (void *cls)
1260 struct RequestHandle *handle = cls; 1260 struct RequestHandle *handle = cls;
1261 struct GNUNET_TIME_Absolute current_time; 1261 struct GNUNET_TIME_Absolute current_time;
1262 struct GNUNET_TIME_Absolute *relog_time; 1262 struct GNUNET_TIME_Absolute *relog_time;
1263 struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 1263 struct GNUNET_IDENTITY_PublicKey pubkey;
1264 struct GNUNET_CRYPTO_EcdsaPublicKey ego_pkey; 1264 struct GNUNET_IDENTITY_PublicKey ego_pkey;
1265 struct GNUNET_HashCode cache_key; 1265 struct GNUNET_HashCode cache_key;
1266 char *identity_cookie; 1266 char *identity_cookie;
1267 1267
@@ -1281,11 +1281,8 @@ code_redirect (void *cls)
1281 if (current_time.abs_value_us <= relog_time->abs_value_us) 1281 if (current_time.abs_value_us <= relog_time->abs_value_us)
1282 { 1282 {
1283 if (GNUNET_OK != 1283 if (GNUNET_OK !=
1284 GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc 1284 GNUNET_IDENTITY_public_key_from_string (handle->oidc
1285 ->login_identity, 1285 ->login_identity,
1286 strlen (
1287 handle->oidc
1288 ->login_identity),
1289 &pubkey)) 1286 &pubkey))
1290 { 1287 {
1291 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE); 1288 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE);
@@ -1376,7 +1373,7 @@ lookup_redirect_uri_result (void *cls,
1376 char *tmp; 1373 char *tmp;
1377 char *tmp_key_str; 1374 char *tmp_key_str;
1378 char *pos; 1375 char *pos;
1379 struct GNUNET_CRYPTO_EcdsaPublicKey redirect_zone; 1376 struct GNUNET_IDENTITY_PublicKey redirect_zone;
1380 1377
1381 handle->gns_op = NULL; 1378 handle->gns_op = NULL;
1382 if (0 == rd_count) 1379 if (0 == rd_count)
@@ -1608,10 +1605,10 @@ static void
1608tld_iter (void *cls, const char *section, const char *option, const char *value) 1605tld_iter (void *cls, const char *section, const char *option, const char *value)
1609{ 1606{
1610 struct RequestHandle *handle = cls; 1607 struct RequestHandle *handle = cls;
1611 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 1608 struct GNUNET_IDENTITY_PublicKey pkey;
1612 1609
1613 if (GNUNET_OK != 1610 if (GNUNET_OK !=
1614 GNUNET_CRYPTO_ecdsa_public_key_from_string (value, strlen (value), &pkey)) 1611 GNUNET_IDENTITY_public_key_from_string (value, &pkey))
1615 { 1612 {
1616 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Skipping non key %s\n", value); 1613 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Skipping non key %s\n", value);
1617 return; 1614 return;
@@ -1635,8 +1632,8 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1635{ 1632{
1636 struct RequestHandle *handle = cls; 1633 struct RequestHandle *handle = cls;
1637 struct EgoEntry *tmp_ego; 1634 struct EgoEntry *tmp_ego;
1638 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 1635 const struct GNUNET_IDENTITY_PrivateKey *priv_key;
1639 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 1636 struct GNUNET_IDENTITY_PublicKey pkey;
1640 1637
1641 cookie_identity_interpretation (handle); 1638 cookie_identity_interpretation (handle);
1642 1639
@@ -1664,9 +1661,7 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1664 } 1661 }
1665 1662
1666 if (GNUNET_OK != 1663 if (GNUNET_OK !=
1667 GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc->client_id, 1664 GNUNET_IDENTITY_public_key_from_string (handle->oidc->client_id,
1668 strlen (
1669 handle->oidc->client_id),
1670 &handle->oidc->client_pkey)) 1665 &handle->oidc->client_pkey))
1671 { 1666 {
1672 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT); 1667 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT);
@@ -1682,7 +1677,7 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1682 for (tmp_ego = ego_head; NULL != tmp_ego; tmp_ego = tmp_ego->next) 1677 for (tmp_ego = ego_head; NULL != tmp_ego; tmp_ego = tmp_ego->next)
1683 { 1678 {
1684 priv_key = GNUNET_IDENTITY_ego_get_private_key (tmp_ego->ego); 1679 priv_key = GNUNET_IDENTITY_ego_get_private_key (tmp_ego->ego);
1685 GNUNET_CRYPTO_ecdsa_key_get_public (priv_key, &pkey); 1680 GNUNET_IDENTITY_key_get_public (priv_key, &pkey);
1686 if (0 == GNUNET_memcmp (&pkey, &handle->oidc->client_pkey)) 1681 if (0 == GNUNET_memcmp (&pkey, &handle->oidc->client_pkey))
1687 { 1682 {
1688 handle->tld = GNUNET_strdup (tmp_ego->identifier); 1683 handle->tld = GNUNET_strdup (tmp_ego->identifier);
@@ -1865,7 +1860,7 @@ parse_credentials_post_body (struct RequestHandle *handle,
1865 1860
1866static int 1861static int
1867check_authorization (struct RequestHandle *handle, 1862check_authorization (struct RequestHandle *handle,
1868 struct GNUNET_CRYPTO_EcdsaPublicKey *cid) 1863 struct GNUNET_IDENTITY_PublicKey *cid)
1869{ 1864{
1870 char *expected_pass; 1865 char *expected_pass;
1871 char *received_cid; 1866 char *received_cid;
@@ -1902,7 +1897,7 @@ check_authorization (struct RequestHandle *handle,
1902 GNUNET_STRINGS_string_to_data (received_cid, 1897 GNUNET_STRINGS_string_to_data (received_cid,
1903 strlen (received_cid), 1898 strlen (received_cid),
1904 cid, 1899 cid,
1905 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 1900 sizeof(struct GNUNET_IDENTITY_PublicKey));
1906 GNUNET_free (received_cid); 1901 GNUNET_free (received_cid);
1907 return GNUNET_OK; 1902 return GNUNET_OK;
1908 1903
@@ -1948,7 +1943,7 @@ check_authorization (struct RequestHandle *handle,
1948 GNUNET_STRINGS_string_to_data (received_cid, 1943 GNUNET_STRINGS_string_to_data (received_cid,
1949 strlen (received_cid), 1944 strlen (received_cid),
1950 cid, 1945 cid,
1951 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 1946 sizeof(struct GNUNET_IDENTITY_PublicKey));
1952 1947
1953 GNUNET_free (received_cpw); 1948 GNUNET_free (received_cpw);
1954 GNUNET_free (received_cid); 1949 GNUNET_free (received_cid);
@@ -1958,10 +1953,10 @@ check_authorization (struct RequestHandle *handle,
1958 1953
1959const struct EgoEntry * 1954const struct EgoEntry *
1960find_ego (struct RequestHandle *handle, 1955find_ego (struct RequestHandle *handle,
1961 struct GNUNET_CRYPTO_EcdsaPublicKey *test_key) 1956 struct GNUNET_IDENTITY_PublicKey *test_key)
1962{ 1957{
1963 struct EgoEntry *ego_entry; 1958 struct EgoEntry *ego_entry;
1964 struct GNUNET_CRYPTO_EcdsaPublicKey pub_key; 1959 struct GNUNET_IDENTITY_PublicKey pub_key;
1965 1960
1966 for (ego_entry = ego_head; NULL != ego_entry; 1961 for (ego_entry = ego_head; NULL != ego_entry;
1967 ego_entry = ego_entry->next) 1962 ego_entry = ego_entry->next)
@@ -1992,7 +1987,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1992 struct GNUNET_RECLAIM_AttributeList *cl = NULL; 1987 struct GNUNET_RECLAIM_AttributeList *cl = NULL;
1993 struct GNUNET_RECLAIM_PresentationList *pl = NULL; 1988 struct GNUNET_RECLAIM_PresentationList *pl = NULL;
1994 struct GNUNET_RECLAIM_Ticket ticket; 1989 struct GNUNET_RECLAIM_Ticket ticket;
1995 struct GNUNET_CRYPTO_EcdsaPublicKey cid; 1990 struct GNUNET_IDENTITY_PublicKey cid;
1996 struct GNUNET_HashCode cache_key; 1991 struct GNUNET_HashCode cache_key;
1997 struct MHD_Response *resp; 1992 struct MHD_Response *resp;
1998 char *grant_type; 1993 char *grant_type;
@@ -2145,7 +2140,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2145 */ 2140 */
2146static void 2141static void
2147consume_ticket (void *cls, 2142consume_ticket (void *cls,
2148 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 2143 const struct GNUNET_IDENTITY_PublicKey *identity,
2149 const struct GNUNET_RECLAIM_Attribute *attr, 2144 const struct GNUNET_RECLAIM_Attribute *attr,
2150 const struct GNUNET_RECLAIM_Presentation *pres) 2145 const struct GNUNET_RECLAIM_Presentation *pres)
2151{ 2146{
@@ -2225,7 +2220,7 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2225 char *authorization_type; 2220 char *authorization_type;
2226 char *authorization_access_token; 2221 char *authorization_access_token;
2227 const struct EgoEntry *aud_ego; 2222 const struct EgoEntry *aud_ego;
2228 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 2223 const struct GNUNET_IDENTITY_PrivateKey *privkey;
2229 2224
2230 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Getting userinfo\n"); 2225 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Getting userinfo\n");
2231 GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY, 2226 GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY,
@@ -2349,7 +2344,7 @@ list_ego (void *cls,
2349 const char *identifier) 2344 const char *identifier)
2350{ 2345{
2351 struct EgoEntry *ego_entry; 2346 struct EgoEntry *ego_entry;
2352 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 2347 struct GNUNET_IDENTITY_PublicKey pk;
2353 2348
2354 if ((NULL == ego) && (ID_REST_STATE_INIT == state)) 2349 if ((NULL == ego) && (ID_REST_STATE_INIT == state))
2355 { 2350 {
@@ -2362,7 +2357,7 @@ list_ego (void *cls,
2362 { 2357 {
2363 ego_entry = GNUNET_new (struct EgoEntry); 2358 ego_entry = GNUNET_new (struct EgoEntry);
2364 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 2359 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
2365 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 2360 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
2366 ego_entry->ego = ego; 2361 ego_entry->ego = ego;
2367 ego_entry->identifier = GNUNET_strdup (identifier); 2362 ego_entry->identifier = GNUNET_strdup (identifier);
2368 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 2363 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
@@ -2389,7 +2384,7 @@ list_ego (void *cls,
2389 /* Add */ 2384 /* Add */
2390 ego_entry = GNUNET_new (struct EgoEntry); 2385 ego_entry = GNUNET_new (struct EgoEntry);
2391 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 2386 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
2392 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 2387 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
2393 ego_entry->ego = ego; 2388 ego_entry->ego = ego;
2394 ego_entry->identifier = GNUNET_strdup (identifier); 2389 ego_entry->identifier = GNUNET_strdup (identifier);
2395 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 2390 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c
index ff11d2a56..022744c82 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -172,7 +172,7 @@ struct RequestHandle
172 /** 172 /**
173 * Pointer to ego private key 173 * Pointer to ego private key
174 */ 174 */
175 struct GNUNET_CRYPTO_EcdsaPrivateKey priv_key; 175 struct GNUNET_IDENTITY_PrivateKey priv_key;
176 176
177 /** 177 /**
178 * Rest connection 178 * Rest connection
@@ -440,14 +440,14 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
440 tmp = 440 tmp =
441 GNUNET_STRINGS_data_to_string_alloc (&ticket->identity, 441 GNUNET_STRINGS_data_to_string_alloc (&ticket->identity,
442 sizeof(struct 442 sizeof(struct
443 GNUNET_CRYPTO_EcdsaPublicKey)); 443 GNUNET_IDENTITY_PublicKey));
444 value = json_string (tmp); 444 value = json_string (tmp);
445 json_object_set_new (json_resource, "issuer", value); 445 json_object_set_new (json_resource, "issuer", value);
446 GNUNET_free (tmp); 446 GNUNET_free (tmp);
447 tmp = 447 tmp =
448 GNUNET_STRINGS_data_to_string_alloc (&ticket->audience, 448 GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
449 sizeof(struct 449 sizeof(struct
450 GNUNET_CRYPTO_EcdsaPublicKey)); 450 GNUNET_IDENTITY_PublicKey));
451 value = json_string (tmp); 451 value = json_string (tmp);
452 json_object_set_new (json_resource, "audience", value); 452 json_object_set_new (json_resource, "audience", value);
453 GNUNET_free (tmp); 453 GNUNET_free (tmp);
@@ -465,7 +465,7 @@ add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
465 void *cls) 465 void *cls)
466{ 466{
467 struct RequestHandle *handle = cls; 467 struct RequestHandle *handle = cls;
468 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv; 468 const struct GNUNET_IDENTITY_PrivateKey *identity_priv;
469 const char *identity; 469 const char *identity;
470 struct EgoEntry *ego_entry; 470 struct EgoEntry *ego_entry;
471 struct GNUNET_RECLAIM_Credential *attribute; 471 struct GNUNET_RECLAIM_Credential *attribute;
@@ -545,7 +545,7 @@ add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
545 */ 545 */
546static void 546static void
547cred_collect (void *cls, 547cred_collect (void *cls,
548 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 548 const struct GNUNET_IDENTITY_PublicKey *identity,
549 const struct GNUNET_RECLAIM_Credential *cred) 549 const struct GNUNET_RECLAIM_Credential *cred)
550{ 550{
551 struct RequestHandle *handle = cls; 551 struct RequestHandle *handle = cls;
@@ -631,7 +631,7 @@ list_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
631 void *cls) 631 void *cls)
632{ 632{
633 struct RequestHandle *handle = cls; 633 struct RequestHandle *handle = cls;
634 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 634 const struct GNUNET_IDENTITY_PrivateKey *priv_key;
635 struct EgoEntry *ego_entry; 635 struct EgoEntry *ego_entry;
636 char *identity; 636 char *identity;
637 637
@@ -688,7 +688,7 @@ delete_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
688 void *cls) 688 void *cls)
689{ 689{
690 struct RequestHandle *handle = cls; 690 struct RequestHandle *handle = cls;
691 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 691 const struct GNUNET_IDENTITY_PrivateKey *priv_key;
692 struct GNUNET_RECLAIM_Credential attr; 692 struct GNUNET_RECLAIM_Credential attr;
693 struct EgoEntry *ego_entry; 693 struct EgoEntry *ego_entry;
694 char *identity_id_str; 694 char *identity_id_str;
@@ -754,7 +754,7 @@ list_tickets_cont (struct GNUNET_REST_RequestHandle *con_handle,
754 const char *url, 754 const char *url,
755 void *cls) 755 void *cls)
756{ 756{
757 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 757 const struct GNUNET_IDENTITY_PrivateKey *priv_key;
758 struct RequestHandle *handle = cls; 758 struct RequestHandle *handle = cls;
759 struct EgoEntry *ego_entry; 759 struct EgoEntry *ego_entry;
760 char *identity; 760 char *identity;
@@ -801,7 +801,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
801 const char *url, 801 const char *url,
802 void *cls) 802 void *cls)
803{ 803{
804 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv; 804 const struct GNUNET_IDENTITY_PrivateKey *identity_priv;
805 const char *identity; 805 const char *identity;
806 struct RequestHandle *handle = cls; 806 struct RequestHandle *handle = cls;
807 struct EgoEntry *ego_entry; 807 struct EgoEntry *ego_entry;
@@ -949,7 +949,7 @@ parse_jwt (const struct GNUNET_RECLAIM_Credential *cred,
949 */ 949 */
950static void 950static void
951attr_collect (void *cls, 951attr_collect (void *cls,
952 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 952 const struct GNUNET_IDENTITY_PublicKey *identity,
953 const struct GNUNET_RECLAIM_Attribute *attr) 953 const struct GNUNET_RECLAIM_Attribute *attr)
954{ 954{
955 struct RequestHandle *handle = cls; 955 struct RequestHandle *handle = cls;
@@ -996,7 +996,7 @@ list_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
996 const char *url, 996 const char *url,
997 void *cls) 997 void *cls)
998{ 998{
999 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 999 const struct GNUNET_IDENTITY_PrivateKey *priv_key;
1000 struct RequestHandle *handle = cls; 1000 struct RequestHandle *handle = cls;
1001 struct EgoEntry *ego_entry; 1001 struct EgoEntry *ego_entry;
1002 char *identity; 1002 char *identity;
@@ -1050,7 +1050,7 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1050 const char *url, 1050 const char *url,
1051 void *cls) 1051 void *cls)
1052{ 1052{
1053 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 1053 const struct GNUNET_IDENTITY_PrivateKey *priv_key;
1054 struct RequestHandle *handle = cls; 1054 struct RequestHandle *handle = cls;
1055 struct GNUNET_RECLAIM_Attribute attr; 1055 struct GNUNET_RECLAIM_Attribute attr;
1056 struct EgoEntry *ego_entry; 1056 struct EgoEntry *ego_entry;
@@ -1108,11 +1108,11 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1108 const char *url, 1108 const char *url,
1109 void *cls) 1109 void *cls)
1110{ 1110{
1111 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv; 1111 const struct GNUNET_IDENTITY_PrivateKey *identity_priv;
1112 struct RequestHandle *handle = cls; 1112 struct RequestHandle *handle = cls;
1113 struct EgoEntry *ego_entry; 1113 struct EgoEntry *ego_entry;
1114 struct GNUNET_RECLAIM_Ticket *ticket = NULL; 1114 struct GNUNET_RECLAIM_Ticket *ticket = NULL;
1115 struct GNUNET_CRYPTO_EcdsaPublicKey tmp_pk; 1115 struct GNUNET_IDENTITY_PublicKey tmp_pk;
1116 char term_data[handle->rest_handle->data_size + 1]; 1116 char term_data[handle->rest_handle->data_size + 1];
1117 json_t *data_json; 1117 json_t *data_json;
1118 json_error_t err; 1118 json_error_t err;
@@ -1156,7 +1156,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1156 GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk); 1156 GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk);
1157 if (0 == memcmp (&ticket->identity, 1157 if (0 == memcmp (&ticket->identity,
1158 &tmp_pk, 1158 &tmp_pk,
1159 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))) 1159 sizeof(struct GNUNET_IDENTITY_PublicKey)))
1160 break; 1160 break;
1161 } 1161 }
1162 if (NULL == ego_entry) 1162 if (NULL == ego_entry)
@@ -1178,7 +1178,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1178 1178
1179static void 1179static void
1180consume_cont (void *cls, 1180consume_cont (void *cls,
1181 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1181 const struct GNUNET_IDENTITY_PublicKey *identity,
1182 const struct GNUNET_RECLAIM_Attribute *attr, 1182 const struct GNUNET_RECLAIM_Attribute *attr,
1183 const struct GNUNET_RECLAIM_Presentation *pres) 1183 const struct GNUNET_RECLAIM_Presentation *pres)
1184{ 1184{
@@ -1215,11 +1215,11 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1215 const char *url, 1215 const char *url,
1216 void *cls) 1216 void *cls)
1217{ 1217{
1218 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv; 1218 const struct GNUNET_IDENTITY_PrivateKey *identity_priv;
1219 struct RequestHandle *handle = cls; 1219 struct RequestHandle *handle = cls;
1220 struct EgoEntry *ego_entry; 1220 struct EgoEntry *ego_entry;
1221 struct GNUNET_RECLAIM_Ticket *ticket; 1221 struct GNUNET_RECLAIM_Ticket *ticket;
1222 struct GNUNET_CRYPTO_EcdsaPublicKey tmp_pk; 1222 struct GNUNET_IDENTITY_PublicKey tmp_pk;
1223 char term_data[handle->rest_handle->data_size + 1]; 1223 char term_data[handle->rest_handle->data_size + 1];
1224 json_t *data_json; 1224 json_t *data_json;
1225 json_error_t err; 1225 json_error_t err;
@@ -1259,7 +1259,7 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1259 GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk); 1259 GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk);
1260 if (0 == memcmp (&ticket->audience, 1260 if (0 == memcmp (&ticket->audience,
1261 &tmp_pk, 1261 &tmp_pk,
1262 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))) 1262 sizeof(struct GNUNET_IDENTITY_PublicKey)))
1263 break; 1263 break;
1264 } 1264 }
1265 if (NULL == ego_entry) 1265 if (NULL == ego_entry)
@@ -1343,7 +1343,7 @@ list_ego (void *cls,
1343 const char *identifier) 1343 const char *identifier)
1344{ 1344{
1345 struct EgoEntry *ego_entry; 1345 struct EgoEntry *ego_entry;
1346 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 1346 struct GNUNET_IDENTITY_PublicKey pk;
1347 1347
1348 if ((NULL == ego) && (ID_REST_STATE_INIT == state)) 1348 if ((NULL == ego) && (ID_REST_STATE_INIT == state))
1349 { 1349 {
@@ -1354,7 +1354,7 @@ list_ego (void *cls,
1354 { 1354 {
1355 ego_entry = GNUNET_new (struct EgoEntry); 1355 ego_entry = GNUNET_new (struct EgoEntry);
1356 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 1356 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
1357 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 1357 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
1358 ego_entry->ego = ego; 1358 ego_entry->ego = ego;
1359 ego_entry->identifier = GNUNET_strdup (identifier); 1359 ego_entry->identifier = GNUNET_strdup (identifier);
1360 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 1360 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
@@ -1380,7 +1380,7 @@ list_ego (void *cls,
1380 /* Add */ 1380 /* Add */
1381 ego_entry = GNUNET_new (struct EgoEntry); 1381 ego_entry = GNUNET_new (struct EgoEntry);
1382 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 1382 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
1383 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 1383 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
1384 ego_entry->ego = ego; 1384 ego_entry->ego = ego;
1385 ego_entry->identifier = GNUNET_strdup (identifier); 1385 ego_entry->identifier = GNUNET_strdup (identifier);
1386 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 1386 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
diff --git a/src/reclaim/reclaim.h b/src/reclaim/reclaim.h
index bc7f34365..aae8ee89a 100644
--- a/src/reclaim/reclaim.h
+++ b/src/reclaim/reclaim.h
@@ -29,7 +29,7 @@
29#define RECLAIM_H 29#define RECLAIM_H
30 30
31#include "gnunet_common.h" 31#include "gnunet_common.h"
32 32#include "gnunet_identity_service.h"
33 33
34GNUNET_NETWORK_STRUCT_BEGIN 34GNUNET_NETWORK_STRUCT_BEGIN
35 35
@@ -62,7 +62,7 @@ struct AttributeStoreMessage
62 /** 62 /**
63 * Identity 63 * Identity
64 */ 64 */
65 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 65 struct GNUNET_IDENTITY_PrivateKey identity;
66 66
67 /* followed by the serialized attribute */ 67 /* followed by the serialized attribute */
68}; 68};
@@ -91,7 +91,7 @@ struct AttributeDeleteMessage
91 /** 91 /**
92 * Identity 92 * Identity
93 */ 93 */
94 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 94 struct GNUNET_IDENTITY_PrivateKey identity;
95 95
96 /* followed by the serialized attribute */ 96 /* followed by the serialized attribute */
97}; 97};
@@ -151,7 +151,7 @@ struct AttributeResultMessage
151 /** 151 /**
152 * The public key of the identity. 152 * The public key of the identity.
153 */ 153 */
154 struct GNUNET_CRYPTO_EcdsaPublicKey identity; 154 struct GNUNET_IDENTITY_PublicKey identity;
155 155
156 /* followed by: 156 /* followed by:
157 * serialized attribute data 157 * serialized attribute data
@@ -186,7 +186,7 @@ struct CredentialResultMessage
186 /** 186 /**
187 * The public key of the identity. 187 * The public key of the identity.
188 */ 188 */
189 struct GNUNET_CRYPTO_EcdsaPublicKey identity; 189 struct GNUNET_IDENTITY_PublicKey identity;
190 190
191 /* followed by: 191 /* followed by:
192 * serialized credential data 192 * serialized credential data
@@ -212,7 +212,7 @@ struct AttributeIterationStartMessage
212 /** 212 /**
213 * Identity. 213 * Identity.
214 */ 214 */
215 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 215 struct GNUNET_IDENTITY_PrivateKey identity;
216}; 216};
217 217
218 218
@@ -251,7 +251,7 @@ struct CredentialIterationStartMessage
251 /** 251 /**
252 * Identity. 252 * Identity.
253 */ 253 */
254 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 254 struct GNUNET_IDENTITY_PrivateKey identity;
255}; 255};
256 256
257 257
@@ -323,7 +323,7 @@ struct TicketIterationStartMessage
323 /** 323 /**
324 * Identity. 324 * Identity.
325 */ 325 */
326 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 326 struct GNUNET_IDENTITY_PrivateKey identity;
327}; 327};
328 328
329 329
@@ -379,12 +379,12 @@ struct IssueTicketMessage
379 /** 379 /**
380 * Identity. 380 * Identity.
381 */ 381 */
382 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 382 struct GNUNET_IDENTITY_PrivateKey identity;
383 383
384 /** 384 /**
385 * Requesting party. 385 * Requesting party.
386 */ 386 */
387 struct GNUNET_CRYPTO_EcdsaPublicKey rp; 387 struct GNUNET_IDENTITY_PublicKey rp;
388 388
389 /** 389 /**
390 * length of serialized attribute list 390 * length of serialized attribute list
@@ -412,7 +412,7 @@ struct RevokeTicketMessage
412 /** 412 /**
413 * Identity. 413 * Identity.
414 */ 414 */
415 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 415 struct GNUNET_IDENTITY_PrivateKey identity;
416 416
417 /** 417 /**
418 * length of serialized attribute list 418 * length of serialized attribute list
@@ -493,7 +493,7 @@ struct ConsumeTicketMessage
493 /** 493 /**
494 * Identity. 494 * Identity.
495 */ 495 */
496 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 496 struct GNUNET_IDENTITY_PrivateKey identity;
497 497
498 /** 498 /**
499 * The ticket to consume 499 * The ticket to consume
@@ -539,7 +539,7 @@ struct ConsumeTicketResultMessage
539 /** 539 /**
540 * The public key of the identity. 540 * The public key of the identity.
541 */ 541 */
542 struct GNUNET_CRYPTO_EcdsaPublicKey identity; 542 struct GNUNET_IDENTITY_PublicKey identity;
543 543
544 /* followed by: 544 /* followed by:
545 * serialized attributes data 545 * serialized attributes data
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index 1e0251519..f4f2b946a 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -235,7 +235,7 @@ struct GNUNET_RECLAIM_AttributeIterator
235 /** 235 /**
236 * Private key of the zone. 236 * Private key of the zone.
237 */ 237 */
238 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 238 struct GNUNET_IDENTITY_PrivateKey identity;
239 239
240 /** 240 /**
241 * The operation id this zone iteration operation has 241 * The operation id this zone iteration operation has
@@ -302,7 +302,7 @@ struct GNUNET_RECLAIM_CredentialIterator
302 /** 302 /**
303 * Private key of the zone. 303 * Private key of the zone.
304 */ 304 */
305 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 305 struct GNUNET_IDENTITY_PrivateKey identity;
306 306
307 /** 307 /**
308 * The operation id this zone iteration operation has 308 * The operation id this zone iteration operation has
@@ -704,7 +704,7 @@ check_attribute_result (void *cls, const struct AttributeResultMessage *msg)
704static void 704static void
705handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) 705handle_attribute_result (void *cls, const struct AttributeResultMessage *msg)
706{ 706{
707 static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; 707 static struct GNUNET_IDENTITY_PrivateKey identity_dummy;
708 struct GNUNET_RECLAIM_Handle *h = cls; 708 struct GNUNET_RECLAIM_Handle *h = cls;
709 struct GNUNET_RECLAIM_AttributeIterator *it; 709 struct GNUNET_RECLAIM_AttributeIterator *it;
710 struct GNUNET_RECLAIM_Operation *op; 710 struct GNUNET_RECLAIM_Operation *op;
@@ -806,7 +806,7 @@ static void
806handle_credential_result (void *cls, const struct 806handle_credential_result (void *cls, const struct
807 CredentialResultMessage *msg) 807 CredentialResultMessage *msg)
808{ 808{
809 static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; 809 static struct GNUNET_IDENTITY_PrivateKey identity_dummy;
810 struct GNUNET_RECLAIM_Handle *h = cls; 810 struct GNUNET_RECLAIM_Handle *h = cls;
811 struct GNUNET_RECLAIM_CredentialIterator *it; 811 struct GNUNET_RECLAIM_CredentialIterator *it;
812 struct GNUNET_RECLAIM_Operation *op; 812 struct GNUNET_RECLAIM_Operation *op;
@@ -1134,7 +1134,7 @@ GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h)
1134struct GNUNET_RECLAIM_Operation * 1134struct GNUNET_RECLAIM_Operation *
1135GNUNET_RECLAIM_attribute_store ( 1135GNUNET_RECLAIM_attribute_store (
1136 struct GNUNET_RECLAIM_Handle *h, 1136 struct GNUNET_RECLAIM_Handle *h,
1137 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 1137 const struct GNUNET_IDENTITY_PrivateKey *pkey,
1138 const struct GNUNET_RECLAIM_Attribute *attr, 1138 const struct GNUNET_RECLAIM_Attribute *attr,
1139 const struct GNUNET_TIME_Relative *exp_interval, 1139 const struct GNUNET_TIME_Relative *exp_interval,
1140 GNUNET_RECLAIM_ContinuationWithStatus cont, 1140 GNUNET_RECLAIM_ContinuationWithStatus cont,
@@ -1181,7 +1181,7 @@ GNUNET_RECLAIM_attribute_store (
1181struct GNUNET_RECLAIM_Operation * 1181struct GNUNET_RECLAIM_Operation *
1182GNUNET_RECLAIM_attribute_delete ( 1182GNUNET_RECLAIM_attribute_delete (
1183 struct GNUNET_RECLAIM_Handle *h, 1183 struct GNUNET_RECLAIM_Handle *h,
1184 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 1184 const struct GNUNET_IDENTITY_PrivateKey *pkey,
1185 const struct GNUNET_RECLAIM_Attribute *attr, 1185 const struct GNUNET_RECLAIM_Attribute *attr,
1186 GNUNET_RECLAIM_ContinuationWithStatus cont, 1186 GNUNET_RECLAIM_ContinuationWithStatus cont,
1187 void *cont_cls) 1187 void *cont_cls)
@@ -1226,7 +1226,7 @@ GNUNET_RECLAIM_attribute_delete (
1226struct GNUNET_RECLAIM_Operation * 1226struct GNUNET_RECLAIM_Operation *
1227GNUNET_RECLAIM_credential_store ( 1227GNUNET_RECLAIM_credential_store (
1228 struct GNUNET_RECLAIM_Handle *h, 1228 struct GNUNET_RECLAIM_Handle *h,
1229 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 1229 const struct GNUNET_IDENTITY_PrivateKey *pkey,
1230 const struct GNUNET_RECLAIM_Credential *attr, 1230 const struct GNUNET_RECLAIM_Credential *attr,
1231 const struct GNUNET_TIME_Relative *exp_interval, 1231 const struct GNUNET_TIME_Relative *exp_interval,
1232 GNUNET_RECLAIM_ContinuationWithStatus cont, 1232 GNUNET_RECLAIM_ContinuationWithStatus cont,
@@ -1273,7 +1273,7 @@ GNUNET_RECLAIM_credential_store (
1273struct GNUNET_RECLAIM_Operation * 1273struct GNUNET_RECLAIM_Operation *
1274GNUNET_RECLAIM_credential_delete ( 1274GNUNET_RECLAIM_credential_delete (
1275 struct GNUNET_RECLAIM_Handle *h, 1275 struct GNUNET_RECLAIM_Handle *h,
1276 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 1276 const struct GNUNET_IDENTITY_PrivateKey *pkey,
1277 const struct GNUNET_RECLAIM_Credential *attr, 1277 const struct GNUNET_RECLAIM_Credential *attr,
1278 GNUNET_RECLAIM_ContinuationWithStatus cont, 1278 GNUNET_RECLAIM_ContinuationWithStatus cont,
1279 void *cont_cls) 1279 void *cont_cls)
@@ -1330,7 +1330,7 @@ GNUNET_RECLAIM_credential_delete (
1330struct GNUNET_RECLAIM_AttributeIterator * 1330struct GNUNET_RECLAIM_AttributeIterator *
1331GNUNET_RECLAIM_get_attributes_start ( 1331GNUNET_RECLAIM_get_attributes_start (
1332 struct GNUNET_RECLAIM_Handle *h, 1332 struct GNUNET_RECLAIM_Handle *h,
1333 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1333 const struct GNUNET_IDENTITY_PrivateKey *identity,
1334 GNUNET_SCHEDULER_TaskCallback error_cb, 1334 GNUNET_SCHEDULER_TaskCallback error_cb,
1335 void *error_cb_cls, 1335 void *error_cb_cls,
1336 GNUNET_RECLAIM_AttributeResult proc, 1336 GNUNET_RECLAIM_AttributeResult proc,
@@ -1439,7 +1439,7 @@ GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it)
1439struct GNUNET_RECLAIM_CredentialIterator * 1439struct GNUNET_RECLAIM_CredentialIterator *
1440GNUNET_RECLAIM_get_credentials_start ( 1440GNUNET_RECLAIM_get_credentials_start (
1441 struct GNUNET_RECLAIM_Handle *h, 1441 struct GNUNET_RECLAIM_Handle *h,
1442 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1442 const struct GNUNET_IDENTITY_PrivateKey *identity,
1443 GNUNET_SCHEDULER_TaskCallback error_cb, 1443 GNUNET_SCHEDULER_TaskCallback error_cb,
1444 void *error_cb_cls, 1444 void *error_cb_cls,
1445 GNUNET_RECLAIM_CredentialResult proc, 1445 GNUNET_RECLAIM_CredentialResult proc,
@@ -1541,8 +1541,8 @@ GNUNET_RECLAIM_get_credentials_stop (struct
1541struct GNUNET_RECLAIM_Operation * 1541struct GNUNET_RECLAIM_Operation *
1542GNUNET_RECLAIM_ticket_issue ( 1542GNUNET_RECLAIM_ticket_issue (
1543 struct GNUNET_RECLAIM_Handle *h, 1543 struct GNUNET_RECLAIM_Handle *h,
1544 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, 1544 const struct GNUNET_IDENTITY_PrivateKey *iss,
1545 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, 1545 const struct GNUNET_IDENTITY_PublicKey *rp,
1546 const struct GNUNET_RECLAIM_AttributeList *attrs, 1546 const struct GNUNET_RECLAIM_AttributeList *attrs,
1547 GNUNET_RECLAIM_IssueTicketCallback cb, 1547 GNUNET_RECLAIM_IssueTicketCallback cb,
1548 void *cb_cls) 1548 void *cb_cls)
@@ -1590,7 +1590,7 @@ GNUNET_RECLAIM_ticket_issue (
1590struct GNUNET_RECLAIM_Operation * 1590struct GNUNET_RECLAIM_Operation *
1591GNUNET_RECLAIM_ticket_consume ( 1591GNUNET_RECLAIM_ticket_consume (
1592 struct GNUNET_RECLAIM_Handle *h, 1592 struct GNUNET_RECLAIM_Handle *h,
1593 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1593 const struct GNUNET_IDENTITY_PrivateKey *identity,
1594 const struct GNUNET_RECLAIM_Ticket *ticket, 1594 const struct GNUNET_RECLAIM_Ticket *ticket,
1595 GNUNET_RECLAIM_AttributeTicketResult cb, 1595 GNUNET_RECLAIM_AttributeTicketResult cb,
1596 void *cb_cls) 1596 void *cb_cls)
@@ -1636,7 +1636,7 @@ GNUNET_RECLAIM_ticket_consume (
1636struct GNUNET_RECLAIM_TicketIterator * 1636struct GNUNET_RECLAIM_TicketIterator *
1637GNUNET_RECLAIM_ticket_iteration_start ( 1637GNUNET_RECLAIM_ticket_iteration_start (
1638 struct GNUNET_RECLAIM_Handle *h, 1638 struct GNUNET_RECLAIM_Handle *h,
1639 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1639 const struct GNUNET_IDENTITY_PrivateKey *identity,
1640 GNUNET_SCHEDULER_TaskCallback error_cb, 1640 GNUNET_SCHEDULER_TaskCallback error_cb,
1641 void *error_cb_cls, 1641 void *error_cb_cls,
1642 GNUNET_RECLAIM_TicketCallback proc, 1642 GNUNET_RECLAIM_TicketCallback proc,
@@ -1731,7 +1731,7 @@ GNUNET_RECLAIM_ticket_iteration_stop (struct GNUNET_RECLAIM_TicketIterator *it)
1731struct GNUNET_RECLAIM_Operation * 1731struct GNUNET_RECLAIM_Operation *
1732GNUNET_RECLAIM_ticket_revoke ( 1732GNUNET_RECLAIM_ticket_revoke (
1733 struct GNUNET_RECLAIM_Handle *h, 1733 struct GNUNET_RECLAIM_Handle *h,
1734 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1734 const struct GNUNET_IDENTITY_PrivateKey *identity,
1735 const struct GNUNET_RECLAIM_Ticket *ticket, 1735 const struct GNUNET_RECLAIM_Ticket *ticket,
1736 GNUNET_RECLAIM_ContinuationWithStatus cb, 1736 GNUNET_RECLAIM_ContinuationWithStatus cb,
1737 void *cb_cls) 1737 void *cb_cls)
diff --git a/src/reclaim/test_reclaim_attribute.c b/src/reclaim/test_reclaim_attribute.c
index f71d86b56..f8faf8021 100644
--- a/src/reclaim/test_reclaim_attribute.c
+++ b/src/reclaim/test_reclaim_attribute.c
@@ -9,12 +9,10 @@ main (int argc, char *argv[])
9 struct GNUNET_RECLAIM_AttributeList *al; 9 struct GNUNET_RECLAIM_AttributeList *al;
10 struct GNUNET_RECLAIM_AttributeList *al_two; 10 struct GNUNET_RECLAIM_AttributeList *al_two;
11 struct GNUNET_RECLAIM_AttributeListEntry *ale; 11 struct GNUNET_RECLAIM_AttributeListEntry *ale;
12 struct GNUNET_RECLAIM_Attribute *attr;
13 char attrname[100]; 12 char attrname[100];
14 char attrdata[100]; 13 char attrdata[100];
15 size_t ser_len_claimed; 14 size_t ser_len_claimed;
16 size_t ser_len_actual; 15 size_t ser_len_actual;
17 ssize_t deser_len;
18 char *ser_data; 16 char *ser_data;
19 int count = 0; 17 int count = 0;
20 18
diff --git a/src/regex/regex_block_lib.c b/src/regex/regex_block_lib.c
index a309c2305..159e8bf8a 100644
--- a/src/regex/regex_block_lib.c
+++ b/src/regex/regex_block_lib.c
@@ -352,14 +352,14 @@ REGEX_BLOCK_iterate (const struct RegexBlock *block,
352 } 352 }
353 off = len; 353 off = len;
354 LOG (GNUNET_ERROR_TYPE_DEBUG, 354 LOG (GNUNET_ERROR_TYPE_DEBUG,
355 "Start iterating block of size %u, proof %u, off %u edges %u\n", 355 "Start iterating block of size %lu, proof %u, off %lu edges %u\n",
356 size, len, off, n); 356 (unsigned long) size, len, (unsigned long) off, n);
357 /* &aux[off] always points to our token */ 357 /* &aux[off] always points to our token */
358 for (n = 0; n < num_edges; n++) 358 for (n = 0; n < num_edges; n++)
359 { 359 {
360 LOG (GNUNET_ERROR_TYPE_DEBUG, 360 LOG (GNUNET_ERROR_TYPE_DEBUG,
361 "Edge %u/%u, off %u tokenlen %u (%.*s)\n", 361 "Edge %u/%u, off %lu tokenlen %u (%.*s)\n",
362 n + 1, num_edges, off, 362 n + 1, num_edges, (unsigned long) off,
363 ntohs (edges[n].token_length), ntohs (edges[n].token_length), 363 ntohs (edges[n].token_length), ntohs (edges[n].token_length),
364 &aux[off]); 364 &aux[off]);
365 if (NULL != iterator) 365 if (NULL != iterator)
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c
index d2c69f131..39d7cd847 100644
--- a/src/regex/regex_internal_dht.c
+++ b/src/regex/regex_internal_dht.c
@@ -427,8 +427,7 @@ regex_find_path (const struct GNUNET_HashCode *key,
427 427
428 LOG (GNUNET_ERROR_TYPE_DEBUG, 428 LOG (GNUNET_ERROR_TYPE_DEBUG,
429 "Accept state found, now searching for paths to %s\n", 429 "Accept state found, now searching for paths to %s\n",
430 GNUNET_h2s (key), 430 GNUNET_h2s (key));
431 (unsigned int) ctx->position);
432 get_h = GNUNET_DHT_get_start (ctx->info->dht, /* handle */ 431 get_h = GNUNET_DHT_get_start (ctx->info->dht, /* handle */
433 GNUNET_BLOCK_TYPE_REGEX_ACCEPT, /* type */ 432 GNUNET_BLOCK_TYPE_REGEX_ACCEPT, /* type */
434 key, /* key to search */ 433 key, /* key to search */
@@ -534,8 +533,8 @@ regex_result_iterator (void *cls,
534 return GNUNET_YES; // We found an accept state! 533 return GNUNET_YES; // We found an accept state!
535 } 534 }
536 LOG (GNUNET_ERROR_TYPE_DEBUG, 535 LOG (GNUNET_ERROR_TYPE_DEBUG,
537 "* %u, %u, [%u]\n", 536 "* %lu, %lu, [%u]\n",
538 ctx->position, 537 (unsigned long) ctx->position,
539 strlen (ctx->info->description), 538 strlen (ctx->info->description),
540 GNUNET_BLOCK_is_accepting (block, result->size)); 539 GNUNET_BLOCK_is_accepting (block, result->size));
541 regex_next_edge (block, result->size, ctx); 540 regex_next_edge (block, result->size, ctx);
@@ -729,7 +728,7 @@ REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht,
729 "Initial key for `%s' is %s (based on `%.*s')\n", 728 "Initial key for `%s' is %s (based on `%.*s')\n",
730 string, 729 string,
731 GNUNET_h2s (&key), 730 GNUNET_h2s (&key),
732 size, 731 (int) size,
733 string); 732 string);
734 ctx = GNUNET_new (struct RegexSearchContext); 733 ctx = GNUNET_new (struct RegexSearchContext);
735 ctx->position = size; 734 ctx->position = size;
diff --git a/src/regex/regex_test_graph.c b/src/regex/regex_test_graph.c
index 8e1e00fd4..c8efae772 100644
--- a/src/regex/regex_test_graph.c
+++ b/src/regex/regex_test_graph.c
@@ -177,8 +177,7 @@ REGEX_TEST_automaton_save_graph_step (void *cls, unsigned int count,
177 } 177 }
178 else 178 else
179 { 179 {
180 GNUNET_asprintf (&s_acc, "\"%s\" [shape=doublecircle];\n", name, 180 GNUNET_asprintf (&s_acc, "\"%s\" [shape=doublecircle];\n", name);
181 s->scc_id);
182 } 181 }
183 } 182 }
184 else if (GNUNET_YES == ctx->coloring) 183 else if (GNUNET_YES == ctx->coloring)
@@ -189,7 +188,7 @@ REGEX_TEST_automaton_save_graph_step (void *cls, unsigned int count,
189 } 188 }
190 else 189 else
191 { 190 {
192 GNUNET_asprintf (&s_acc, "\"%s\" [shape=circle];\n", name, s->scc_id); 191 GNUNET_asprintf (&s_acc, "\"%s\" [shape=circle];\n", name);
193 } 192 }
194 193
195 GNUNET_assert (NULL != s_acc); 194 GNUNET_assert (NULL != s_acc);
@@ -228,7 +227,7 @@ REGEX_TEST_automaton_save_graph_step (void *cls, unsigned int count,
228 else 227 else
229 { 228 {
230 GNUNET_asprintf (&s_tran, "\"%s\" -> \"%s\" [label = \"ε\"];\n", name, 229 GNUNET_asprintf (&s_tran, "\"%s\" -> \"%s\" [label = \"ε\"];\n", name,
231 to_name, s->scc_id); 230 to_name);
232 } 231 }
233 } 232 }
234 else 233 else
@@ -242,7 +241,7 @@ REGEX_TEST_automaton_save_graph_step (void *cls, unsigned int count,
242 else 241 else
243 { 242 {
244 GNUNET_asprintf (&s_tran, "\"%s\" -> \"%s\" [label = \"%s\"];\n", name, 243 GNUNET_asprintf (&s_tran, "\"%s\" -> \"%s\" [label = \"%s\"];\n", name,
245 to_name, ctran->label, s->scc_id); 244 to_name, ctran->label);
246 } 245 }
247 } 246 }
248 247
diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am
index 9d98502a6..b1a079a0d 100644
--- a/src/revocation/Makefile.am
+++ b/src/revocation/Makefile.am
@@ -30,6 +30,7 @@ libgnunet_plugin_block_revocation_la_LIBADD = \
30 $(top_builddir)/src/block/libgnunetblockgroup.la \ 30 $(top_builddir)/src/block/libgnunetblockgroup.la \
31 $(top_builddir)/src/block/libgnunetblock.la \ 31 $(top_builddir)/src/block/libgnunetblock.la \
32 $(top_builddir)/src/util/libgnunetutil.la \ 32 $(top_builddir)/src/util/libgnunetutil.la \
33 $(top_builddir)/src/identity/libgnunetidentity.la \
33 $(LTLIBINTL) 34 $(LTLIBINTL)
34libgnunet_plugin_block_revocation_la_DEPENDENCIES = \ 35libgnunet_plugin_block_revocation_la_DEPENDENCIES = \
35 libgnunetrevocation.la \ 36 libgnunetrevocation.la \
@@ -63,6 +64,7 @@ libgnunetrevocation_la_SOURCES = \
63 revocation_api.c revocation.h 64 revocation_api.c revocation.h
64libgnunetrevocation_la_LIBADD = \ 65libgnunetrevocation_la_LIBADD = \
65 $(top_builddir)/src/util/libgnunetutil.la \ 66 $(top_builddir)/src/util/libgnunetutil.la \
67 $(top_builddir)/src/identity/libgnunetidentity.la \
66 $(LIBGCRYPT_LIBS) \ 68 $(LIBGCRYPT_LIBS) \
67 $(GN_LIBINTL) $(XLIB) -lgcrypt 69 $(GN_LIBINTL) $(XLIB) -lgcrypt
68libgnunetrevocation_la_LDFLAGS = \ 70libgnunetrevocation_la_LDFLAGS = \
@@ -80,6 +82,7 @@ gnunet_service_revocation_LDADD = \
80 $(top_builddir)/src/core/libgnunetcore.la \ 82 $(top_builddir)/src/core/libgnunetcore.la \
81 $(top_builddir)/src/setu/libgnunetsetu.la \ 83 $(top_builddir)/src/setu/libgnunetsetu.la \
82 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 84 $(top_builddir)/src/statistics/libgnunetstatistics.la \
85 $(top_builddir)/src/identity/libgnunetidentity.la \
83 $(top_builddir)/src/util/libgnunetutil.la \ 86 $(top_builddir)/src/util/libgnunetutil.la \
84 -lm \ 87 -lm \
85 $(GN_LIBINTL) 88 $(GN_LIBINTL)
diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c
index 29df1bb4d..1692472bb 100644
--- a/src/revocation/gnunet-revocation-tvg.c
+++ b/src/revocation/gnunet-revocation-tvg.c
@@ -65,25 +65,26 @@ run (void *cls,
65 const char *cfgfile, 65 const char *cfgfile,
66 const struct GNUNET_CONFIGURATION_Handle *cfg) 66 const struct GNUNET_CONFIGURATION_Handle *cfg)
67{ 67{
68 struct GNUNET_CRYPTO_EcdsaPrivateKey id_priv; 68 struct GNUNET_IDENTITY_PrivateKey id_priv;
69 struct GNUNET_CRYPTO_EcdsaPublicKey id_pub; 69 struct GNUNET_IDENTITY_PublicKey id_pub;
70 struct GNUNET_REVOCATION_PowP pow; 70 struct GNUNET_REVOCATION_PowP *pow;
71 struct GNUNET_REVOCATION_PowCalculationHandle *ph; 71 struct GNUNET_REVOCATION_PowCalculationHandle *ph;
72 struct GNUNET_TIME_Relative exp; 72 struct GNUNET_TIME_Relative exp;
73 73
74 GNUNET_CRYPTO_ecdsa_key_create (&id_priv); 74 id_priv.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
75 GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv, 75 GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key);
76 &id_pub); 76 GNUNET_IDENTITY_key_get_public (&id_priv,
77 &id_pub);
77 fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); 78 fprintf (stdout, "Zone private key (d, little-endian scalar):\n");
78 print_bytes (&id_priv, sizeof(id_priv), 0); 79 print_bytes (&id_priv, sizeof(id_priv), 0);
79 fprintf (stdout, "\n"); 80 fprintf (stdout, "\n");
80 fprintf (stdout, "Zone public key (zk):\n"); 81 fprintf (stdout, "Zone public key (zk):\n");
81 print_bytes (&id_pub, sizeof(id_pub), 0); 82 print_bytes (&id_pub, sizeof(id_pub), 0);
82 fprintf (stdout, "\n"); 83 fprintf (stdout, "\n");
83 memset (&pow, 0, sizeof (pow)); 84 pow = GNUNET_malloc (GNUNET_REVOCATION_MAX_PROOF_SIZE);
84 GNUNET_REVOCATION_pow_init (&id_priv, 85 GNUNET_REVOCATION_pow_init (&id_priv,
85 &pow); 86 pow);
86 ph = GNUNET_REVOCATION_pow_start (&pow, 87 ph = GNUNET_REVOCATION_pow_start (pow,
87 TEST_EPOCHS, 88 TEST_EPOCHS,
88 TEST_DIFFICULTY); 89 TEST_DIFFICULTY);
89 fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n", 90 fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n",
@@ -97,12 +98,12 @@ run (void *cls,
97 } 98 }
98 exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 99 exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
99 TEST_EPOCHS); 100 TEST_EPOCHS);
100 GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (&pow, 101 GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (pow,
101 TEST_DIFFICULTY, 102 TEST_DIFFICULTY,
102 exp)); 103 exp));
103 fprintf (stdout, "Proof:\n"); 104 fprintf (stdout, "Proof:\n");
104 print_bytes (&pow, 105 print_bytes (pow,
105 sizeof (pow), 106 GNUNET_REVOCATION_proof_get_size (pow),
106 8); 107 8);
107} 108}
108 109
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c
index 0e1e482ab..d59ea7c81 100644
--- a/src/revocation/gnunet-revocation.c
+++ b/src/revocation/gnunet-revocation.c
@@ -101,7 +101,7 @@ static struct GNUNET_SCHEDULER_Task *pow_task;
101/** 101/**
102 * Proof-of-work object 102 * Proof-of-work object
103 */ 103 */
104static struct GNUNET_REVOCATION_PowP proof_of_work; 104static struct GNUNET_REVOCATION_PowP *proof_of_work;
105 105
106/** 106/**
107 * Function run if the user aborts with CTRL-C. 107 * Function run if the user aborts with CTRL-C.
@@ -213,7 +213,7 @@ static void
213perform_revocation () 213perform_revocation ()
214{ 214{
215 h = GNUNET_REVOCATION_revoke (cfg, 215 h = GNUNET_REVOCATION_revoke (cfg,
216 &proof_of_work, 216 proof_of_work,
217 &print_revocation_result, 217 &print_revocation_result,
218 NULL); 218 NULL);
219} 219}
@@ -228,11 +228,12 @@ perform_revocation ()
228static void 228static void
229sync_pow () 229sync_pow ()
230{ 230{
231 size_t psize = GNUNET_REVOCATION_proof_get_size (proof_of_work);
231 if ((NULL != filename) && 232 if ((NULL != filename) &&
232 (sizeof(struct GNUNET_REVOCATION_PowP) != 233 (psize !=
233 GNUNET_DISK_fn_write (filename, 234 GNUNET_DISK_fn_write (filename,
234 &proof_of_work, 235 proof_of_work,
235 sizeof(struct GNUNET_REVOCATION_PowP), 236 psize,
236 GNUNET_DISK_PERM_USER_READ 237 GNUNET_DISK_PERM_USER_READ
237 | GNUNET_DISK_PERM_USER_WRITE))) 238 | GNUNET_DISK_PERM_USER_WRITE)))
238 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename); 239 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename);
@@ -269,6 +270,7 @@ static void
269calculate_pow (void *cls) 270calculate_pow (void *cls)
270{ 271{
271 struct GNUNET_REVOCATION_PowCalculationHandle *ph = cls; 272 struct GNUNET_REVOCATION_PowCalculationHandle *ph = cls;
273 size_t psize;
272 274
273 /* store temporary results */ 275 /* store temporary results */
274 pow_task = NULL; 276 pow_task = NULL;
@@ -277,11 +279,12 @@ calculate_pow (void *cls)
277 /* actually do POW calculation */ 279 /* actually do POW calculation */
278 if (GNUNET_OK == GNUNET_REVOCATION_pow_round (ph)) 280 if (GNUNET_OK == GNUNET_REVOCATION_pow_round (ph))
279 { 281 {
282 psize = GNUNET_REVOCATION_proof_get_size (proof_of_work);
280 if ((NULL != filename) && 283 if ((NULL != filename) &&
281 (sizeof(struct GNUNET_REVOCATION_PowP) != 284 (psize !=
282 GNUNET_DISK_fn_write (filename, 285 GNUNET_DISK_fn_write (filename,
283 &proof_of_work, 286 proof_of_work,
284 sizeof(struct GNUNET_REVOCATION_PowP), 287 psize,
285 GNUNET_DISK_PERM_USER_READ 288 GNUNET_DISK_PERM_USER_READ
286 | GNUNET_DISK_PERM_USER_WRITE))) 289 | GNUNET_DISK_PERM_USER_WRITE)))
287 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename); 290 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename);
@@ -325,9 +328,10 @@ calculate_pow (void *cls)
325static void 328static void
326ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego) 329ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego)
327{ 330{
328 struct GNUNET_CRYPTO_EcdsaPublicKey key; 331 struct GNUNET_IDENTITY_PublicKey key;
329 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 332 const struct GNUNET_IDENTITY_PrivateKey *privkey;
330 struct GNUNET_REVOCATION_PowCalculationHandle *ph = NULL; 333 struct GNUNET_REVOCATION_PowCalculationHandle *ph = NULL;
334 size_t psize;
331 335
332 el = NULL; 336 el = NULL;
333 if (NULL == ego) 337 if (NULL == ego)
@@ -338,12 +342,15 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego)
338 } 342 }
339 GNUNET_IDENTITY_ego_get_public_key (ego, &key); 343 GNUNET_IDENTITY_ego_get_public_key (ego, &key);
340 privkey = GNUNET_IDENTITY_ego_get_private_key (ego); 344 privkey = GNUNET_IDENTITY_ego_get_private_key (ego);
341 memset (&proof_of_work, 0, sizeof (proof_of_work)); 345 proof_of_work = GNUNET_malloc (GNUNET_REVOCATION_MAX_PROOF_SIZE);
342 if ((NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) && 346 if ((NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) &&
343 (sizeof(proof_of_work) == 347 (0 < (psize =
344 GNUNET_DISK_fn_read (filename, &proof_of_work, sizeof(proof_of_work)))) 348 GNUNET_DISK_fn_read (filename, proof_of_work,
349 GNUNET_REVOCATION_MAX_PROOF_SIZE))))
345 { 350 {
346 if (0 != GNUNET_memcmp (&proof_of_work.key, &key)) 351 size_t ksize = GNUNET_IDENTITY_key_get_length (&key);
352 if (((psize - sizeof (*proof_of_work)) < ksize) || // Key too small
353 (0 != memcmp (&proof_of_work[1], &key, ksize))) // Keys do not match
347 { 354 {
348 fprintf (stderr, 355 fprintf (stderr,
349 _ ("Error: revocation certificate in `%s' is not for `%s'\n"), 356 _ ("Error: revocation certificate in `%s' is not for `%s'\n"),
@@ -352,7 +359,7 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego)
352 return; 359 return;
353 } 360 }
354 if (GNUNET_YES == 361 if (GNUNET_YES ==
355 GNUNET_REVOCATION_check_pow (&proof_of_work, 362 GNUNET_REVOCATION_check_pow (proof_of_work,
356 (unsigned int) matching_bits, 363 (unsigned int) matching_bits,
357 epoch_duration)) 364 epoch_duration))
358 { 365 {
@@ -369,7 +376,7 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego)
369 fprintf (stderr, 376 fprintf (stderr,
370 "%s", 377 "%s",
371 _ ("Continuing calculation where left off...\n")); 378 _ ("Continuing calculation where left off...\n"));
372 ph = GNUNET_REVOCATION_pow_start (&proof_of_work, 379 ph = GNUNET_REVOCATION_pow_start (proof_of_work,
373 epochs, 380 epochs,
374 matching_bits); 381 matching_bits);
375 } 382 }
@@ -379,8 +386,8 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego)
379 if (NULL == ph) 386 if (NULL == ph)
380 { 387 {
381 GNUNET_REVOCATION_pow_init (privkey, 388 GNUNET_REVOCATION_pow_init (privkey,
382 &proof_of_work); 389 proof_of_work);
383 ph = GNUNET_REVOCATION_pow_start (&proof_of_work, 390 ph = GNUNET_REVOCATION_pow_start (proof_of_work,
384 epochs, /* Epochs */ 391 epochs, /* Epochs */
385 matching_bits); 392 matching_bits);
386 } 393 }
@@ -403,15 +410,15 @@ run (void *cls,
403 const char *cfgfile, 410 const char *cfgfile,
404 const struct GNUNET_CONFIGURATION_Handle *c) 411 const struct GNUNET_CONFIGURATION_Handle *c)
405{ 412{
406 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 413 struct GNUNET_IDENTITY_PublicKey pk;
414 size_t psize;
407 415
408 cfg = c; 416 cfg = c;
409 if (NULL != test_ego) 417 if (NULL != test_ego)
410 { 418 {
411 if (GNUNET_OK != 419 if (GNUNET_OK !=
412 GNUNET_CRYPTO_ecdsa_public_key_from_string (test_ego, 420 GNUNET_IDENTITY_public_key_from_string (test_ego,
413 strlen (test_ego), 421 &pk))
414 &pk))
415 { 422 {
416 fprintf (stderr, _ ("Public key `%s' malformed\n"), test_ego); 423 fprintf (stderr, _ ("Public key `%s' malformed\n"), test_ego);
417 return; 424 return;
@@ -463,23 +470,33 @@ run (void *cls,
463 } 470 }
464 if ((NULL != filename) && (perform)) 471 if ((NULL != filename) && (perform))
465 { 472 {
466 if (sizeof(proof_of_work) != GNUNET_DISK_fn_read (filename, 473 size_t bread;
467 &proof_of_work, 474 proof_of_work = GNUNET_malloc (GNUNET_REVOCATION_MAX_PROOF_SIZE);
468 sizeof(proof_of_work))) 475 if (0 < (bread = GNUNET_DISK_fn_read (filename,
476 proof_of_work,
477 GNUNET_REVOCATION_MAX_PROOF_SIZE)))
469 { 478 {
470 fprintf (stderr, 479 fprintf (stderr,
471 _ ("Failed to read revocation certificate from `%s'\n"), 480 _ ("Failed to read revocation certificate from `%s'\n"),
472 filename); 481 filename);
473 return; 482 return;
474 } 483 }
484 psize = GNUNET_REVOCATION_proof_get_size (proof_of_work);
485 if (bread != psize)
486 {
487 fprintf (stderr,
488 _ ("Revocation certificate corrupted in `%s'\n"),
489 filename);
490 return;
491 }
475 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); 492 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
476 if (GNUNET_YES != 493 if (GNUNET_YES !=
477 GNUNET_REVOCATION_check_pow (&proof_of_work, 494 GNUNET_REVOCATION_check_pow (proof_of_work,
478 (unsigned int) matching_bits, 495 (unsigned int) matching_bits,
479 epoch_duration)) 496 epoch_duration))
480 { 497 {
481 struct GNUNET_REVOCATION_PowCalculationHandle *ph; 498 struct GNUNET_REVOCATION_PowCalculationHandle *ph;
482 ph = GNUNET_REVOCATION_pow_start (&proof_of_work, 499 ph = GNUNET_REVOCATION_pow_start (proof_of_work,
483 epochs, /* Epochs */ 500 epochs, /* Epochs */
484 matching_bits); 501 matching_bits);
485 502
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index ddebb38ad..0fa92f4a6 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -172,7 +172,8 @@ new_peer_entry (const struct GNUNET_PeerIdentity *peer)
172static int 172static int
173verify_revoke_message (const struct RevokeMessage *rm) 173verify_revoke_message (const struct RevokeMessage *rm)
174{ 174{
175 if (GNUNET_YES != GNUNET_REVOCATION_check_pow (&rm->proof_of_work, 175 struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1];
176 if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow,
176 (unsigned 177 (unsigned
177 int) revocation_work_required, 178 int) revocation_work_required,
178 epoch_duration)) 179 epoch_duration))
@@ -236,7 +237,7 @@ handle_query_message (void *cls,
236 int res; 237 int res;
237 238
238 GNUNET_CRYPTO_hash (&qm->key, 239 GNUNET_CRYPTO_hash (&qm->key,
239 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 240 sizeof(struct GNUNET_IDENTITY_PublicKey),
240 &hc); 241 &hc);
241 res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, 242 res = GNUNET_CONTAINER_multihashmap_contains (revocation_map,
242 &hc); 243 &hc);
@@ -276,9 +277,11 @@ do_flood (void *cls,
276 return GNUNET_OK; /* peer connected to us via SET, 277 return GNUNET_OK; /* peer connected to us via SET,
277 but we have no direct CORE 278 but we have no direct CORE
278 connection for flooding */ 279 connection for flooding */
279 e = GNUNET_MQ_msg (cp, 280 e = GNUNET_MQ_msg_extra (cp,
281 htonl (rm->pow_size),
280 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); 282 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE);
281 *cp = *rm; 283 *cp = *rm;
284 memcpy (&cp[1], &rm[1], htonl (rm->pow_size));
282 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 285 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
283 "Flooding revocation to `%s'\n", 286 "Flooding revocation to `%s'\n",
284 GNUNET_i2s (target)); 287 GNUNET_i2s (target));
@@ -303,9 +306,12 @@ publicize_rm (const struct RevokeMessage *rm)
303 struct RevokeMessage *cp; 306 struct RevokeMessage *cp;
304 struct GNUNET_HashCode hc; 307 struct GNUNET_HashCode hc;
305 struct GNUNET_SETU_Element e; 308 struct GNUNET_SETU_Element e;
309 const struct GNUNET_IDENTITY_PublicKey *pk;
306 310
307 GNUNET_CRYPTO_hash (&rm->proof_of_work.key, 311 struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1];
308 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 312 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
313 GNUNET_CRYPTO_hash (pk,
314 GNUNET_IDENTITY_key_get_length (pk),
309 &hc); 315 &hc);
310 if (GNUNET_YES == 316 if (GNUNET_YES ==
311 GNUNET_CONTAINER_multihashmap_contains (revocation_map, 317 GNUNET_CONTAINER_multihashmap_contains (revocation_map,
@@ -371,6 +377,23 @@ publicize_rm (const struct RevokeMessage *rm)
371} 377}
372 378
373 379
380static int
381check_revoke_message (void *cls,
382 const struct RevokeMessage *rm)
383{
384 uint16_t size;
385
386 size = ntohs (rm->header.size);
387 if (size <= sizeof(struct RevokeMessage))
388 {
389 GNUNET_break (0);
390 return GNUNET_SYSERR;
391 }
392 return GNUNET_OK;
393
394}
395
396
374/** 397/**
375 * Handle REVOKE message from client. 398 * Handle REVOKE message from client.
376 * 399 *
@@ -403,6 +426,23 @@ handle_revoke_message (void *cls,
403} 426}
404 427
405 428
429static int
430check_p2p_revoke (void *cls,
431 const struct RevokeMessage *rm)
432{
433 uint16_t size;
434
435 size = ntohs (rm->header.size);
436 if (size <= sizeof(struct RevokeMessage))
437 {
438 GNUNET_break (0);
439 return GNUNET_SYSERR;
440 }
441 return GNUNET_OK;
442
443}
444
445
406/** 446/**
407 * Core handler for flooded revocation messages. 447 * Core handler for flooded revocation messages.
408 * 448 *
@@ -784,16 +824,17 @@ run (void *cls,
784 struct GNUNET_SERVICE_Handle *service) 824 struct GNUNET_SERVICE_Handle *service)
785{ 825{
786 struct GNUNET_MQ_MessageHandler core_handlers[] = { 826 struct GNUNET_MQ_MessageHandler core_handlers[] = {
787 GNUNET_MQ_hd_fixed_size (p2p_revoke, 827 GNUNET_MQ_hd_var_size (p2p_revoke,
788 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE, 828 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE,
789 struct RevokeMessage, 829 struct RevokeMessage,
790 NULL), 830 NULL),
791 GNUNET_MQ_handler_end () 831 GNUNET_MQ_handler_end ()
792 }; 832 };
793 char *fn; 833 char *fn;
794 uint64_t left; 834 uint64_t left;
795 struct RevokeMessage *rm; 835 struct RevokeMessage *rm;
796 struct GNUNET_HashCode hc; 836 struct GNUNET_HashCode hc;
837 const struct GNUNET_IDENTITY_PublicKey *pk;
797 838
798 GNUNET_CRYPTO_hash ("revocation-set-union-application-id", 839 GNUNET_CRYPTO_hash ("revocation-set-union-application-id",
799 strlen ("revocation-set-union-application-id"), 840 strlen ("revocation-set-union-application-id"),
@@ -892,9 +933,11 @@ run (void *cls,
892 GNUNET_free (fn); 933 GNUNET_free (fn);
893 return; 934 return;
894 } 935 }
895 GNUNET_break (0 == ntohl (rm->reserved)); 936 struct GNUNET_REVOCATION_PowP *pow = (struct
896 GNUNET_CRYPTO_hash (&rm->proof_of_work.key, 937 GNUNET_REVOCATION_PowP *) &rm[1];
897 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 938 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
939 GNUNET_CRYPTO_hash (pk,
940 GNUNET_IDENTITY_key_get_length (pk),
898 &hc); 941 &hc);
899 GNUNET_break (GNUNET_OK == 942 GNUNET_break (GNUNET_OK ==
900 GNUNET_CONTAINER_multihashmap_put (revocation_map, 943 GNUNET_CONTAINER_multihashmap_put (revocation_map,
@@ -939,10 +982,10 @@ GNUNET_SERVICE_MAIN
939 GNUNET_MESSAGE_TYPE_REVOCATION_QUERY, 982 GNUNET_MESSAGE_TYPE_REVOCATION_QUERY,
940 struct QueryMessage, 983 struct QueryMessage,
941 NULL), 984 NULL),
942 GNUNET_MQ_hd_fixed_size (revoke_message, 985 GNUNET_MQ_hd_var_size (revoke_message,
943 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE, 986 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE,
944 struct RevokeMessage, 987 struct RevokeMessage,
945 NULL), 988 NULL),
946 GNUNET_MQ_handler_end ()); 989 GNUNET_MQ_handler_end ());
947 990
948 991
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c
index 291c56f70..3c9344a49 100644
--- a/src/revocation/plugin_block_revocation.c
+++ b/src/revocation/plugin_block_revocation.c
@@ -143,16 +143,18 @@ block_plugin_revocation_evaluate (void *cls,
143 GNUNET_break_op (0); 143 GNUNET_break_op (0);
144 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 144 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
145 } 145 }
146 if (0 >= 146 struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1];
147 GNUNET_REVOCATION_check_pow (&rm->proof_of_work, 147 const struct GNUNET_IDENTITY_PublicKey *pk;
148 ic->matching_bits, 148 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
149 ic->epoch_duration)) 149 if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow,
150 ic->matching_bits,
151 ic->epoch_duration))
150 { 152 {
151 GNUNET_break_op (0); 153 GNUNET_break_op (0);
152 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 154 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
153 } 155 }
154 GNUNET_CRYPTO_hash (&rm->proof_of_work.key, 156 GNUNET_CRYPTO_hash (pk,
155 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 157 GNUNET_IDENTITY_key_get_length (pk),
156 &chash); 158 &chash);
157 if (GNUNET_YES == 159 if (GNUNET_YES ==
158 GNUNET_BLOCK_GROUP_bf_test_and_set (group, 160 GNUNET_BLOCK_GROUP_bf_test_and_set (group,
@@ -182,13 +184,16 @@ block_plugin_revocation_get_key (void *cls,
182{ 184{
183 const struct RevokeMessage *rm = block; 185 const struct RevokeMessage *rm = block;
184 186
185 if (block_size != sizeof(*rm)) 187 if (block_size <= sizeof(*rm))
186 { 188 {
187 GNUNET_break_op (0); 189 GNUNET_break_op (0);
188 return GNUNET_SYSERR; 190 return GNUNET_SYSERR;
189 } 191 }
190 GNUNET_CRYPTO_hash (&rm->proof_of_work.key, 192 struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1];
191 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 193 const struct GNUNET_IDENTITY_PublicKey *pk;
194 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
195 GNUNET_CRYPTO_hash (pk,
196 GNUNET_IDENTITY_key_get_length (pk),
192 key); 197 key);
193 return GNUNET_OK; 198 return GNUNET_OK;
194} 199}
diff --git a/src/revocation/revocation.h b/src/revocation/revocation.h
index 635c56cfc..c3a9c9e6b 100644
--- a/src/revocation/revocation.h
+++ b/src/revocation/revocation.h
@@ -49,7 +49,7 @@ struct QueryMessage
49 /** 49 /**
50 * Key to check. 50 * Key to check.
51 */ 51 */
52 struct GNUNET_CRYPTO_EcdsaPublicKey key; 52 struct GNUNET_IDENTITY_PublicKey key;
53}; 53};
54 54
55 55
@@ -85,14 +85,11 @@ struct RevokeMessage
85 struct GNUNET_MessageHeader header; 85 struct GNUNET_MessageHeader header;
86 86
87 /** 87 /**
88 * For alignment. 88 * Length of PoW with signature.
89 */ 89 */
90 uint32_t reserved GNUNET_PACKED; 90 uint32_t pow_size GNUNET_PACKED;
91 91
92 /** 92 /** Followed by the PoW **/
93 * Number that causes a hash collision with the @e public_key.
94 */
95 struct GNUNET_REVOCATION_PowP proof_of_work;
96}; 93};
97 94
98 95
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 75cfd8761..94fbc7022 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -160,7 +160,7 @@ handle_revocation_query_response (void *cls,
160 */ 160 */
161struct GNUNET_REVOCATION_Query * 161struct GNUNET_REVOCATION_Query *
162GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, 162GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg,
163 const struct GNUNET_CRYPTO_EcdsaPublicKey *key, 163 const struct GNUNET_IDENTITY_PublicKey *key,
164 GNUNET_REVOCATION_Callback func, 164 GNUNET_REVOCATION_Callback func,
165 void *func_cls) 165 void *func_cls)
166{ 166{
@@ -359,10 +359,12 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
359 } 359 }
360 h->func = func; 360 h->func = func;
361 h->func_cls = func_cls; 361 h->func_cls = func_cls;
362 env = GNUNET_MQ_msg (rm, 362 size_t extra_len = GNUNET_REVOCATION_proof_get_size (pow);
363 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); 363 env = GNUNET_MQ_msg_extra (rm,
364 rm->reserved = htonl (0); 364 extra_len,
365 rm->proof_of_work = *pow; 365 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE);
366 rm->pow_size = htonl (extra_len);
367 memcpy (&rm[1], pow, extra_len);
366 GNUNET_MQ_send (h->mq, 368 GNUNET_MQ_send (h->mq,
367 env); 369 env);
368 return h; 370 return h;
@@ -420,6 +422,58 @@ calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph)
420} 422}
421 423
422 424
425enum GNUNET_GenericReturnValue
426check_signature_ecdsa (const struct GNUNET_REVOCATION_PowP *pow,
427 const struct GNUNET_CRYPTO_EcdsaPublicKey *key)
428{
429 struct GNUNET_REVOCATION_EcdsaSignaturePurposePS spurp;
430 struct GNUNET_CRYPTO_EcdsaSignature *sig;
431 const struct GNUNET_IDENTITY_PublicKey *pk;
432 size_t ksize;
433
434 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
435 ksize = GNUNET_IDENTITY_key_get_length (pk);
436
437 spurp.ktype = pk->type;
438 spurp.key = pk->ecdsa_key;
439 spurp.timestamp = pow->timestamp;
440 spurp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
441 spurp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
442 + GNUNET_IDENTITY_key_get_length (pk)
443 + sizeof (struct GNUNET_TIME_AbsoluteNBO));
444 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
445 "Expected signature payload len: %u\n",
446 ntohl (spurp.purpose.size));
447 sig = (struct GNUNET_CRYPTO_EcdsaSignature *) ((char*)&pow[1] + ksize);
448 if (GNUNET_OK !=
449 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION,
450 &spurp.purpose,
451 sig,
452 key))
453 {
454 return GNUNET_SYSERR;
455 }
456 return GNUNET_OK;
457}
458
459
460enum GNUNET_GenericReturnValue
461check_signature (const struct GNUNET_REVOCATION_PowP *pow)
462{
463 const struct GNUNET_IDENTITY_PublicKey *pk;
464
465 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
466 switch (ntohl (pk->type))
467 {
468 case GNUNET_IDENTITY_TYPE_ECDSA:
469 return check_signature_ecdsa (pow, &pk->ecdsa_key);
470 default:
471 return GNUNET_SYSERR;
472 }
473 return GNUNET_SYSERR;
474}
475
476
423/** 477/**
424 * Check if the given proof-of-work is valid. 478 * Check if the given proof-of-work is valid.
425 * 479 *
@@ -433,10 +487,9 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
433 unsigned int difficulty, 487 unsigned int difficulty,
434 struct GNUNET_TIME_Relative epoch_duration) 488 struct GNUNET_TIME_Relative epoch_duration)
435{ 489{
436 char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) 490 char buf[sizeof(struct GNUNET_IDENTITY_PublicKey)
437 + sizeof (struct GNUNET_TIME_AbsoluteNBO) 491 + sizeof (struct GNUNET_TIME_AbsoluteNBO)
438 + sizeof (uint64_t)] GNUNET_ALIGN; 492 + sizeof (uint64_t)] GNUNET_ALIGN;
439 struct GNUNET_REVOCATION_SignaturePurposePS spurp;
440 struct GNUNET_HashCode result; 493 struct GNUNET_HashCode result;
441 struct GNUNET_TIME_Absolute ts; 494 struct GNUNET_TIME_Absolute ts;
442 struct GNUNET_TIME_Absolute exp; 495 struct GNUNET_TIME_Absolute exp;
@@ -446,25 +499,18 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
446 unsigned int tmp_score = 0; 499 unsigned int tmp_score = 0;
447 unsigned int epochs; 500 unsigned int epochs;
448 uint64_t pow_val; 501 uint64_t pow_val;
502 const struct GNUNET_IDENTITY_PublicKey *pk;
503
504 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
449 505
450 /** 506 /**
451 * Check if signature valid 507 * Check if signature valid
452 */ 508 */
453 spurp.key = pow->key; 509 if (GNUNET_OK != check_signature (pow))
454 spurp.timestamp = pow->timestamp;
455 spurp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
456 spurp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
457 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
458 + sizeof (struct GNUNET_TIME_AbsoluteNBO));
459 if (GNUNET_OK !=
460 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION,
461 &spurp.purpose,
462 &pow->signature,
463 &pow->key))
464 { 510 {
465 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 511 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
466 "Proof of work signature invalid!\n"); 512 "Proof of work signature invalid!\n");
467 return GNUNET_NO; 513 return GNUNET_SYSERR;
468 } 514 }
469 515
470 /** 516 /**
@@ -479,8 +525,8 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
479 &pow->timestamp, 525 &pow->timestamp,
480 sizeof (uint64_t)); 526 sizeof (uint64_t));
481 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], 527 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
482 &pow->key, 528 pk,
483 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 529 GNUNET_IDENTITY_key_get_length (pk));
484 for (unsigned int i = 0; i < POW_COUNT; i++) 530 for (unsigned int i = 0; i < POW_COUNT; i++)
485 { 531 {
486 pow_val = GNUNET_ntohll (pow->pow[i]); 532 pow_val = GNUNET_ntohll (pow->pow[i]);
@@ -529,18 +575,15 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
529} 575}
530 576
531 577
532/** 578enum GNUNET_GenericReturnValue
533 * Initializes a fresh PoW computation. 579sign_pow_ecdsa (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
534 * 580 struct GNUNET_REVOCATION_PowP *pow)
535 * @param key the key to calculate the PoW for.
536 * @param[out] pow starting point for PoW calculation (not yet valid)
537 */
538void
539GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
540 struct GNUNET_REVOCATION_PowP *pow)
541{ 581{
542 struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get (); 582 struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get ();
543 struct GNUNET_REVOCATION_SignaturePurposePS rp; 583 struct GNUNET_REVOCATION_EcdsaSignaturePurposePS rp;
584 const struct GNUNET_IDENTITY_PublicKey *pk;
585 size_t ksize;
586 char *sig;
544 587
545 /** 588 /**
546 * Predate the validity period to prevent rejections due to 589 * Predate the validity period to prevent rejections due to
@@ -548,19 +591,57 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
548 */ 591 */
549 ts = GNUNET_TIME_absolute_subtract (ts, 592 ts = GNUNET_TIME_absolute_subtract (ts,
550 GNUNET_TIME_UNIT_WEEKS); 593 GNUNET_TIME_UNIT_WEEKS);
551 594 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
595 ksize = GNUNET_IDENTITY_key_get_length (pk);
552 pow->timestamp = GNUNET_TIME_absolute_hton (ts); 596 pow->timestamp = GNUNET_TIME_absolute_hton (ts);
553 rp.timestamp = pow->timestamp; 597 rp.timestamp = pow->timestamp;
554 rp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); 598 rp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
555 rp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) 599 rp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
556 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) 600 + ksize
557 + sizeof (struct GNUNET_TIME_AbsoluteNBO)); 601 + sizeof (struct GNUNET_TIME_AbsoluteNBO));
558 GNUNET_CRYPTO_ecdsa_key_get_public (key, &pow->key); 602 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
559 rp.key = pow->key; 603 "Signature payload len: %u\n",
560 GNUNET_assert (GNUNET_OK == 604 ntohl (rp.purpose.size));
561 GNUNET_CRYPTO_ecdsa_sign_ (key, 605 rp.ktype = pk->type;
562 &rp.purpose, 606 rp.key = pk->ecdsa_key;
563 &pow->signature)); 607 sig = ((char*)&pow[1]) + ksize;
608 return GNUNET_CRYPTO_ecdsa_sign_ (key,
609 &rp.purpose,
610 (void*) sig);
611
612}
613
614
615enum GNUNET_GenericReturnValue
616sign_pow (const struct GNUNET_IDENTITY_PrivateKey *key,
617 struct GNUNET_REVOCATION_PowP *pow)
618{
619 struct GNUNET_IDENTITY_PublicKey *pk;
620
621 pk = (struct GNUNET_IDENTITY_PublicKey *) &pow[1];
622 GNUNET_IDENTITY_key_get_public (key, pk);
623 switch (ntohl (pk->type))
624 {
625 case GNUNET_IDENTITY_TYPE_ECDSA:
626 return sign_pow_ecdsa (&key->ecdsa_key, pow);
627 default:
628 return GNUNET_NO;
629 }
630 return GNUNET_NO;
631}
632
633
634/**
635 * Initializes a fresh PoW computation.
636 *
637 * @param key the key to calculate the PoW for.
638 * @param[out] pow starting point for PoW calculation (not yet valid)
639 */
640void
641GNUNET_REVOCATION_pow_init (const struct GNUNET_IDENTITY_PrivateKey *key,
642 struct GNUNET_REVOCATION_PowP *pow)
643{
644 GNUNET_assert (GNUNET_OK == sign_pow (key, pow));
564} 645}
565 646
566 647
@@ -622,15 +703,17 @@ cmp_pow_value (const void *a, const void *b)
622enum GNUNET_GenericReturnValue 703enum GNUNET_GenericReturnValue
623GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) 704GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
624{ 705{
625 char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) 706 char buf[sizeof(struct GNUNET_IDENTITY_PublicKey)
626 + sizeof (uint64_t) 707 + sizeof (uint64_t)
627 + sizeof (uint64_t)] GNUNET_ALIGN; 708 + sizeof (uint64_t)] GNUNET_ALIGN;
628 struct GNUNET_HashCode result; 709 struct GNUNET_HashCode result;
710 const struct GNUNET_IDENTITY_PublicKey *pk;
629 unsigned int zeros; 711 unsigned int zeros;
630 int ret; 712 int ret;
631 uint64_t pow_nbo; 713 uint64_t pow_nbo;
632 714
633 pc->current_pow++; 715 pc->current_pow++;
716 pk = (const struct GNUNET_IDENTITY_PublicKey *) &(pc->pow[1]);
634 717
635 /** 718 /**
636 * Do not try duplicates 719 * Do not try duplicates
@@ -644,8 +727,8 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
644 &pc->pow->timestamp, 727 &pc->pow->timestamp,
645 sizeof (uint64_t)); 728 sizeof (uint64_t));
646 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], 729 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
647 &pc->pow->key, 730 pk,
648 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 731 GNUNET_IDENTITY_key_get_length (pk));
649 GNUNET_CRYPTO_pow_hash (&salt, 732 GNUNET_CRYPTO_pow_hash (&salt,
650 buf, 733 buf,
651 sizeof(buf), 734 sizeof(buf),
@@ -690,4 +773,25 @@ GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
690} 773}
691 774
692 775
776size_t
777GNUNET_REVOCATION_proof_get_size (const struct GNUNET_REVOCATION_PowP *pow)
778{
779 size_t size;
780 const struct GNUNET_IDENTITY_PublicKey *pk;
781
782 size = sizeof (struct GNUNET_REVOCATION_PowP);
783 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
784 size += GNUNET_IDENTITY_key_get_length (pk);
785
786 switch (ntohl (pk->type))
787 {
788 case GNUNET_IDENTITY_TYPE_ECDSA:
789 return size + sizeof (struct GNUNET_CRYPTO_EcdsaSignature);
790 default:
791 return 0;
792 }
793 return 0;
794}
795
796
693/* end of revocation_api.c */ 797/* end of revocation_api.c */
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c
index b65567d79..c6457016f 100644
--- a/src/revocation/test_revocation.c
+++ b/src/revocation/test_revocation.c
@@ -38,8 +38,8 @@ struct TestPeer
38 struct GNUNET_TESTBED_Operation *core_op; 38 struct GNUNET_TESTBED_Operation *core_op;
39 struct GNUNET_IDENTITY_Handle *idh; 39 struct GNUNET_IDENTITY_Handle *idh;
40 const struct GNUNET_CONFIGURATION_Handle *cfg; 40 const struct GNUNET_CONFIGURATION_Handle *cfg;
41 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 41 const struct GNUNET_IDENTITY_PrivateKey *privkey;
42 struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 42 struct GNUNET_IDENTITY_PublicKey pubkey;
43 struct GNUNET_CRYPTO_EcdsaSignature sig; 43 struct GNUNET_CRYPTO_EcdsaSignature sig;
44 struct GNUNET_IDENTITY_Operation *create_id_op; 44 struct GNUNET_IDENTITY_Operation *create_id_op;
45 struct GNUNET_IDENTITY_EgoLookup *ego_lookup; 45 struct GNUNET_IDENTITY_EgoLookup *ego_lookup;
@@ -142,13 +142,13 @@ revocation_cb (void *cls, enum GNUNET_GenericReturnValue is_valid)
142} 142}
143 143
144 144
145static struct GNUNET_REVOCATION_PowP proof_of_work; 145static struct GNUNET_REVOCATION_PowP *proof_of_work;
146 146
147static void 147static void
148ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) 148ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
149{ 149{
150 static int completed = 0; 150 static int completed = 0;
151 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 151 const struct GNUNET_IDENTITY_PrivateKey *privkey;
152 152
153 if ((NULL != ego) && (cls == &testpeers[0])) 153 if ((NULL != ego) && (cls == &testpeers[0]))
154 { 154 {
@@ -164,10 +164,10 @@ ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
164 GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[1].pubkey); 164 GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[1].pubkey);
165 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Calculating proof of work...\n"); 165 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Calculating proof of work...\n");
166 privkey = GNUNET_IDENTITY_ego_get_private_key (ego); 166 privkey = GNUNET_IDENTITY_ego_get_private_key (ego);
167 memset (&proof_of_work, 0, sizeof (proof_of_work)); 167 proof_of_work = GNUNET_malloc (GNUNET_REVOCATION_MAX_PROOF_SIZE);
168 GNUNET_REVOCATION_pow_init (privkey, 168 GNUNET_REVOCATION_pow_init (privkey,
169 &proof_of_work); 169 proof_of_work);
170 testpeers[1].pow = GNUNET_REVOCATION_pow_start (&proof_of_work, 170 testpeers[1].pow = GNUNET_REVOCATION_pow_start (proof_of_work,
171 1, 171 1,
172 5); 172 5);
173 int res = 173 int res =
@@ -184,7 +184,7 @@ ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
184 { 184 {
185 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Egos retrieved\n"); 185 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Egos retrieved\n");
186 testpeers[1].revok_handle = GNUNET_REVOCATION_revoke (testpeers[1].cfg, 186 testpeers[1].revok_handle = GNUNET_REVOCATION_revoke (testpeers[1].cfg,
187 &proof_of_work, 187 proof_of_work,
188 &revocation_cb, 188 &revocation_cb,
189 NULL); 189 NULL);
190 GNUNET_REVOCATION_pow_stop (testpeers[1].pow); 190 GNUNET_REVOCATION_pow_stop (testpeers[1].pow);
@@ -194,7 +194,7 @@ ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
194 194
195static void 195static void
196identity_create_cb (void *cls, 196identity_create_cb (void *cls,
197 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 197 const struct GNUNET_IDENTITY_PrivateKey *pk,
198 const char *emsg) 198 const char *emsg)
199{ 199{
200 static int completed = 0; 200 static int completed = 0;
@@ -238,11 +238,13 @@ identity_completion_cb (void *cls,
238 testpeers[0].create_id_op = GNUNET_IDENTITY_create (testpeers[0].idh, 238 testpeers[0].create_id_op = GNUNET_IDENTITY_create (testpeers[0].idh,
239 "client", 239 "client",
240 NULL, 240 NULL,
241 GNUNET_IDENTITY_TYPE_ECDSA,
241 &identity_create_cb, 242 &identity_create_cb,
242 &testpeers[0]); 243 &testpeers[0]);
243 testpeers[1].create_id_op = GNUNET_IDENTITY_create (testpeers[1].idh, 244 testpeers[1].create_id_op = GNUNET_IDENTITY_create (testpeers[1].idh,
244 "toberevoked", 245 "toberevoked",
245 NULL, 246 NULL,
247 GNUNET_IDENTITY_TYPE_ECDSA,
246 &identity_create_cb, 248 &identity_create_cb,
247 &testpeers[1]); 249 &testpeers[1]);
248} 250}
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index 87c6faf98..931d7e753 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -563,8 +563,8 @@ prepare_ibf_iterator (void *cls,
563 struct IBF_Key salted_key; 563 struct IBF_Key salted_key;
564 564
565 LOG (GNUNET_ERROR_TYPE_DEBUG, 565 LOG (GNUNET_ERROR_TYPE_DEBUG,
566 "[OP %x] inserting %lx (hash %s) into ibf\n", 566 "[OP %p] inserting %lx (hash %s) into ibf\n",
567 (void *) op, 567 op,
568 (unsigned long) ke->ibf_key.key_val, 568 (unsigned long) ke->ibf_key.key_val,
569 GNUNET_h2s (&ke->element->element_hash)); 569 GNUNET_h2s (&ke->element->element_hash));
570 salt_key (&ke->ibf_key, 570 salt_key (&ke->ibf_key,
@@ -929,7 +929,7 @@ handle_union_p2p_strata_estimator (void *cls,
929 (0 == other_size)) 929 (0 == other_size))
930 { 930 {
931 LOG (GNUNET_ERROR_TYPE_DEBUG, 931 LOG (GNUNET_ERROR_TYPE_DEBUG,
932 "Deciding to go for full set transmission (diff=%d, own set=%u)\n", 932 "Deciding to go for full set transmission (diff=%d, own set=%llu)\n",
933 diff, 933 diff,
934 op->state->initial_size); 934 op->state->initial_size);
935 GNUNET_STATISTICS_update (_GSS_statistics, 935 GNUNET_STATISTICS_update (_GSS_statistics,
@@ -1004,8 +1004,8 @@ send_offers_iterator (void *cls,
1004 GNUNET_assert (NULL != ev); 1004 GNUNET_assert (NULL != ev);
1005 *(struct GNUNET_HashCode *) &mh[1] = ke->element->element_hash; 1005 *(struct GNUNET_HashCode *) &mh[1] = ke->element->element_hash;
1006 LOG (GNUNET_ERROR_TYPE_DEBUG, 1006 LOG (GNUNET_ERROR_TYPE_DEBUG,
1007 "[OP %x] sending element offer (%s) to peer\n", 1007 "[OP %p] sending element offer (%s) to peer\n",
1008 (void *) op, 1008 op,
1009 GNUNET_h2s (&ke->element->element_hash)); 1009 GNUNET_h2s (&ke->element->element_hash));
1010 GNUNET_MQ_send (op->mq, ev); 1010 GNUNET_MQ_send (op->mq, ev);
1011 return GNUNET_YES; 1011 return GNUNET_YES;
@@ -2004,8 +2004,8 @@ handle_union_p2p_demand (void *cls,
2004 emsg->reserved = htons (0); 2004 emsg->reserved = htons (0);
2005 emsg->element_type = htons (ee->element.element_type); 2005 emsg->element_type = htons (ee->element.element_type);
2006 LOG (GNUNET_ERROR_TYPE_DEBUG, 2006 LOG (GNUNET_ERROR_TYPE_DEBUG,
2007 "[OP %x] Sending demanded element (size %u, hash %s) to peer\n", 2007 "[OP %p] Sending demanded element (size %u, hash %s) to peer\n",
2008 (void *) op, 2008 op,
2009 (unsigned int) ee->element.size, 2009 (unsigned int) ee->element.size,
2010 GNUNET_h2s (&ee->element_hash)); 2010 GNUNET_h2s (&ee->element_hash));
2011 GNUNET_MQ_send (op->mq, ev); 2011 GNUNET_MQ_send (op->mq, ev);
@@ -2120,8 +2120,8 @@ handle_union_p2p_offer (void *cls,
2120 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); 2120 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
2121 2121
2122 LOG (GNUNET_ERROR_TYPE_DEBUG, 2122 LOG (GNUNET_ERROR_TYPE_DEBUG,
2123 "[OP %x] Requesting element (hash %s)\n", 2123 "[OP %p] Requesting element (hash %s)\n",
2124 (void *) op, GNUNET_h2s (hash)); 2124 op, GNUNET_h2s (hash));
2125 ev = GNUNET_MQ_msg_header_extra (demands, 2125 ev = GNUNET_MQ_msg_header_extra (demands,
2126 sizeof(struct GNUNET_HashCode), 2126 sizeof(struct GNUNET_HashCode),
2127 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DEMAND); 2127 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DEMAND);
diff --git a/src/set/set_api.c b/src/set/set_api.c
index ce4b1c965..a082c23c1 100644
--- a/src/set/set_api.c
+++ b/src/set/set_api.c
@@ -630,8 +630,7 @@ create_internal (const struct GNUNET_CONFIGURATION_Handle *cfg,
630 else 630 else
631 { 631 {
632 LOG (GNUNET_ERROR_TYPE_DEBUG, 632 LOG (GNUNET_ERROR_TYPE_DEBUG,
633 "Creating new set (lazy copy)\n", 633 "Creating new set (lazy copy)\n");
634 op);
635 mqm = GNUNET_MQ_msg (copy_msg, 634 mqm = GNUNET_MQ_msg (copy_msg,
636 GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_CONNECT); 635 GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_CONNECT);
637 copy_msg->cookie = *cookie; 636 copy_msg->cookie = *cookie;
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index 326589186..30f02ecac 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -1049,8 +1049,8 @@ prepare_ibf_iterator (void *cls,
1049 struct IBF_Key salted_key; 1049 struct IBF_Key salted_key;
1050 1050
1051 LOG (GNUNET_ERROR_TYPE_DEBUG, 1051 LOG (GNUNET_ERROR_TYPE_DEBUG,
1052 "[OP %x] inserting %lx (hash %s) into ibf\n", 1052 "[OP %p] inserting %lx (hash %s) into ibf\n",
1053 (void *) op, 1053 op,
1054 (unsigned long) ke->ibf_key.key_val, 1054 (unsigned long) ke->ibf_key.key_val,
1055 GNUNET_h2s (&ke->element->element_hash)); 1055 GNUNET_h2s (&ke->element->element_hash));
1056 salt_key (&ke->ibf_key, 1056 salt_key (&ke->ibf_key,
@@ -1429,7 +1429,7 @@ handle_union_p2p_strata_estimator (void *cls,
1429 (0 == other_size)) 1429 (0 == other_size))
1430 { 1430 {
1431 LOG (GNUNET_ERROR_TYPE_DEBUG, 1431 LOG (GNUNET_ERROR_TYPE_DEBUG,
1432 "Deciding to go for full set transmission (diff=%d, own set=%u)\n", 1432 "Deciding to go for full set transmission (diff=%d, own set=%llu)\n",
1433 diff, 1433 diff,
1434 op->initial_size); 1434 op->initial_size);
1435 GNUNET_STATISTICS_update (_GSS_statistics, 1435 GNUNET_STATISTICS_update (_GSS_statistics,
@@ -1504,8 +1504,8 @@ send_offers_iterator (void *cls,
1504 GNUNET_assert (NULL != ev); 1504 GNUNET_assert (NULL != ev);
1505 *(struct GNUNET_HashCode *) &mh[1] = ke->element->element_hash; 1505 *(struct GNUNET_HashCode *) &mh[1] = ke->element->element_hash;
1506 LOG (GNUNET_ERROR_TYPE_DEBUG, 1506 LOG (GNUNET_ERROR_TYPE_DEBUG,
1507 "[OP %x] sending element offer (%s) to peer\n", 1507 "[OP %p] sending element offer (%s) to peer\n",
1508 (void *) op, 1508 op,
1509 GNUNET_h2s (&ke->element->element_hash)); 1509 GNUNET_h2s (&ke->element->element_hash));
1510 GNUNET_MQ_send (op->mq, ev); 1510 GNUNET_MQ_send (op->mq, ev);
1511 return GNUNET_YES; 1511 return GNUNET_YES;
@@ -2403,8 +2403,8 @@ handle_union_p2p_demand (void *cls,
2403 emsg->reserved = htons (0); 2403 emsg->reserved = htons (0);
2404 emsg->element_type = htons (ee->element.element_type); 2404 emsg->element_type = htons (ee->element.element_type);
2405 LOG (GNUNET_ERROR_TYPE_DEBUG, 2405 LOG (GNUNET_ERROR_TYPE_DEBUG,
2406 "[OP %x] Sending demanded element (size %u, hash %s) to peer\n", 2406 "[OP %p] Sending demanded element (size %u, hash %s) to peer\n",
2407 (void *) op, 2407 op,
2408 (unsigned int) ee->element.size, 2408 (unsigned int) ee->element.size,
2409 GNUNET_h2s (&ee->element_hash)); 2409 GNUNET_h2s (&ee->element_hash));
2410 GNUNET_MQ_send (op->mq, ev); 2410 GNUNET_MQ_send (op->mq, ev);
@@ -2502,8 +2502,8 @@ handle_union_p2p_offer (void *cls,
2502 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); 2502 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
2503 2503
2504 LOG (GNUNET_ERROR_TYPE_DEBUG, 2504 LOG (GNUNET_ERROR_TYPE_DEBUG,
2505 "[OP %x] Requesting element (hash %s)\n", 2505 "[OP %p] Requesting element (hash %s)\n",
2506 (void *) op, GNUNET_h2s (hash)); 2506 op, GNUNET_h2s (hash));
2507 ev = GNUNET_MQ_msg_header_extra (demands, 2507 ev = GNUNET_MQ_msg_header_extra (demands,
2508 sizeof(struct GNUNET_HashCode), 2508 sizeof(struct GNUNET_HashCode),
2509 GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND); 2509 GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND);
diff --git a/src/testbed-logger/gnunet-service-testbed-logger.c b/src/testbed-logger/gnunet-service-testbed-logger.c
index 81652fa4f..bc2f0abe0 100644
--- a/src/testbed-logger/gnunet-service-testbed-logger.c
+++ b/src/testbed-logger/gnunet-service-testbed-logger.c
@@ -198,7 +198,7 @@ logger_run (void *cls,
198 GNUNET_asprintf (&fn, 198 GNUNET_asprintf (&fn,
199 "%s/%.*s_%jd.dat", 199 "%s/%.*s_%jd.dat",
200 dir, 200 dir,
201 hname_len, 201 (int) hname_len,
202 hname, 202 hname,
203 (intmax_t) pid); 203 (intmax_t) pid);
204 GNUNET_free (hname); 204 GNUNET_free (hname);
diff --git a/src/testbed/gnunet-service-testbed_cpustatus.c b/src/testbed/gnunet-service-testbed_cpustatus.c
index 70b865c73..440f2c24f 100644
--- a/src/testbed/gnunet-service-testbed_cpustatus.c
+++ b/src/testbed/gnunet-service-testbed_cpustatus.c
@@ -608,7 +608,7 @@ GST_stats_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
608 return; 608 return;
609 } 609 }
610 fn = NULL; 610 fn = NULL;
611 (void) GNUNET_asprintf (&fn, "%s/%.*s-%jd.dat", stats_dir, len, 611 (void) GNUNET_asprintf (&fn, "%s/%.*s-%jd.dat", stats_dir, (int)len,
612 hostname, (intmax_t) getpid ()); 612 hostname, (intmax_t) getpid ());
613 GNUNET_free (stats_dir); 613 GNUNET_free (stats_dir);
614 GNUNET_free (hostname); 614 GNUNET_free (hostname);
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 697783d96..09752ba28 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -448,7 +448,7 @@ handle_opsuccess (
448 uint64_t op_id; 448 uint64_t op_id;
449 449
450 op_id = GNUNET_ntohll (msg->operation_id); 450 op_id = GNUNET_ntohll (msg->operation_id);
451 LOG_DEBUG ("Operation %lu successful\n", op_id); 451 LOG_DEBUG ("Operation %llu successful\n", op_id);
452 if (NULL == (opc = find_opc (c, op_id))) 452 if (NULL == (opc = find_opc (c, op_id)))
453 { 453 {
454 LOG_DEBUG ("Operation not found\n"); 454 LOG_DEBUG ("Operation not found\n");
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c
index 1d765af92..a9a340e99 100644
--- a/src/testbed/testbed_api_topology.c
+++ b/src/testbed/testbed_api_topology.c
@@ -1089,7 +1089,7 @@ gen_topo_from_file (struct TopologyContext *tc,
1089 if (tc->num_peers <= peer_id) 1089 if (tc->num_peers <= peer_id)
1090 { 1090 {
1091 LOG (GNUNET_ERROR_TYPE_ERROR, 1091 LOG (GNUNET_ERROR_TYPE_ERROR,
1092 _ ("Topology file needs more peers than given ones\n"), filename); 1092 _ ("Topology file needs more peers than given ones\n"));
1093 goto _exit; 1093 goto _exit;
1094 } 1094 }
1095 state = OTHER_PEER_INDEX; 1095 state = OTHER_PEER_INDEX;
@@ -1114,7 +1114,7 @@ gen_topo_from_file (struct TopologyContext *tc,
1114 if (tc->num_peers <= other_peer_id) 1114 if (tc->num_peers <= other_peer_id)
1115 { 1115 {
1116 LOG (GNUNET_ERROR_TYPE_ERROR, 1116 LOG (GNUNET_ERROR_TYPE_ERROR,
1117 _ ("Topology file needs more peers than given ones\n"), filename); 1117 _ ("Topology file needs more peers than given ones\n"));
1118 goto _exit; 1118 goto _exit;
1119 } 1119 }
1120 if (peer_id != other_peer_id) 1120 if (peer_id != other_peer_id)
@@ -1150,7 +1150,7 @@ gen_topo_from_file (struct TopologyContext *tc,
1150 } 1150 }
1151 else 1151 else
1152 LOG (GNUNET_ERROR_TYPE_WARNING, 1152 LOG (GNUNET_ERROR_TYPE_WARNING,
1153 _ ("Ignoring to connect peer %u to peer %u\n"), 1153 _ ("Ignoring to connect peer %lu to peer %lu\n"),
1154 peer_id, 1154 peer_id,
1155 other_peer_id); 1155 other_peer_id);
1156 while (('\n' != data[offset]) && ('|' != data[offset]) && (offset < fs)) 1156 while (('\n' != data[offset]) && ('|' != data[offset]) && (offset < fs))
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 92ed2fe52..219fae57b 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -769,10 +769,10 @@ http_client_plugin_send (void *cls,
769 char *stat_txt; 769 char *stat_txt;
770 770
771 LOG (GNUNET_ERROR_TYPE_DEBUG, 771 LOG (GNUNET_ERROR_TYPE_DEBUG,
772 "Session %p/request %p: Sending message with %u to peer `%s' \n", 772 "Session %p/request %p: Sending message with %lu to peer `%s' \n",
773 s, 773 s,
774 s->put.easyhandle, 774 s->put.easyhandle,
775 msgbuf_size, 775 (unsigned long) msgbuf_size,
776 GNUNET_i2s (&s->address->peer)); 776 GNUNET_i2s (&s->address->peer));
777 777
778 /* create new message and schedule */ 778 /* create new message and schedule */
@@ -1087,11 +1087,10 @@ client_send_cb (void *stream,
1087 if (msg->pos == msg->size) 1087 if (msg->pos == msg->size)
1088 { 1088 {
1089 LOG (GNUNET_ERROR_TYPE_DEBUG, 1089 LOG (GNUNET_ERROR_TYPE_DEBUG,
1090 "Session %p/request %p: sent message with %u bytes sent, removing message from queue\n", 1090 "Session %p/request %p: sent message with %lu bytes sent, removing message from queue\n",
1091 s, 1091 s,
1092 s->put.easyhandle, 1092 s->put.easyhandle,
1093 msg->size, 1093 (unsigned long) msg->size);
1094 msg->pos);
1095 /* Calling transmit continuation */ 1094 /* Calling transmit continuation */
1096 GNUNET_CONTAINER_DLL_remove (s->msg_head, 1095 GNUNET_CONTAINER_DLL_remove (s->msg_head,
1097 s->msg_tail, 1096 s->msg_tail,
@@ -1249,10 +1248,10 @@ client_receive (void *stream,
1249 size_t len = size * nmemb; 1248 size_t len = size * nmemb;
1250 1249
1251 LOG (GNUNET_ERROR_TYPE_DEBUG, 1250 LOG (GNUNET_ERROR_TYPE_DEBUG,
1252 "Session %p / request %p: Received %u bytes from peer `%s'\n", 1251 "Session %p / request %p: Received %lu bytes from peer `%s'\n",
1253 s, 1252 s,
1254 s->get.easyhandle, 1253 s->get.easyhandle,
1255 len, 1254 (unsigned long) len,
1256 GNUNET_i2s (&s->address->peer)); 1255 GNUNET_i2s (&s->address->peer));
1257 now = GNUNET_TIME_absolute_get (); 1256 now = GNUNET_TIME_absolute_get ();
1258 if (now.abs_value_us < s->next_receive.abs_value_us) 1257 if (now.abs_value_us < s->next_receive.abs_value_us)
@@ -1346,7 +1345,7 @@ client_run (void *cls)
1346 /* Log status of terminated request */ 1345 /* Log status of terminated request */
1347 if ((0 != msg->data.result) || (http_statuscode != 200)) 1346 if ((0 != msg->data.result) || (http_statuscode != 200))
1348 LOG (GNUNET_ERROR_TYPE_DEBUG, 1347 LOG (GNUNET_ERROR_TYPE_DEBUG,
1349 "Session %p/request %p: %s request to `%s' ended with status %i reason %i: `%s'\n", 1348 "Session %p/request %p: %s request to `%s' ended with status %li reason %i: `%s'\n",
1350 s, msg->easy_handle, 1349 s, msg->easy_handle,
1351 (GNUNET_YES == put_request) ? "PUT" : "GET", 1350 (GNUNET_YES == put_request) ? "PUT" : "GET",
1352 GNUNET_i2s (&s->address->peer), 1351 GNUNET_i2s (&s->address->peer),
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c
index d81d6db9c..0e3778837 100644
--- a/src/transport/plugin_transport_http_common.c
+++ b/src/transport/plugin_transport_http_common.c
@@ -629,7 +629,7 @@ http_common_plugin_address_to_string (const char *plugin,
629 if (addr_str[ntohl (address->urlen) - 1] != '\0') 629 if (addr_str[ntohl (address->urlen) - 1] != '\0')
630 return NULL; 630 return NULL;
631 GNUNET_asprintf (&res, "%s.%u.%s", plugin, ntohl (address->options), 631 GNUNET_asprintf (&res, "%s.%u.%s", plugin, ntohl (address->options),
632 &address[1]); 632 (char*)&address[1]);
633 if (strlen (res) + 1 < 500) 633 if (strlen (res) + 1 < 500)
634 { 634 {
635 GNUNET_memcpy (rbuf, res, strlen (res) + 1); 635 GNUNET_memcpy (rbuf, res, strlen (res) + 1);
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index d1b21ba9c..6e95ca00c 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -745,10 +745,10 @@ http_server_plugin_send (void *cls,
745 char *stat_txt; 745 char *stat_txt;
746 746
747 LOG (GNUNET_ERROR_TYPE_DEBUG, 747 LOG (GNUNET_ERROR_TYPE_DEBUG,
748 "Session %p/request %p: Sending message with %u to peer `%s'\n", 748 "Session %p/request %p: Sending message with %lu to peer `%s'\n",
749 session, 749 session,
750 session->server_send, 750 session->server_send,
751 msgbuf_size, 751 (unsigned long) msgbuf_size,
752 GNUNET_i2s (&session->target)); 752 GNUNET_i2s (&session->target));
753 753
754 /* create new message and schedule */ 754 /* create new message and schedule */
@@ -1270,8 +1270,8 @@ server_parse_url (struct HTTP_Server_Plugin *plugin,
1270 if (hash_length != plugin->peer_id_length) 1270 if (hash_length != plugin->peer_id_length)
1271 { 1271 {
1272 LOG (GNUNET_ERROR_TYPE_DEBUG, 1272 LOG (GNUNET_ERROR_TYPE_DEBUG,
1273 "URL target is %u bytes, expecting %u\n", 1273 "URL target is %lu bytes, expecting %u\n",
1274 hash_length, plugin->peer_id_length); 1274 (unsigned long) hash_length, plugin->peer_id_length);
1275 return GNUNET_SYSERR; 1275 return GNUNET_SYSERR;
1276 } 1276 }
1277 if (GNUNET_OK != 1277 if (GNUNET_OK !=
@@ -1616,8 +1616,8 @@ server_send_callback (void *cls,
1616 { 1616 {
1617 sc->connected = GNUNET_YES; 1617 sc->connected = GNUNET_YES;
1618 LOG (GNUNET_ERROR_TYPE_DEBUG, 1618 LOG (GNUNET_ERROR_TYPE_DEBUG,
1619 "Sent %u bytes to peer `%s' with session %p \n", 1619 "Sent %lu bytes to peer `%s' with session %p \n",
1620 bytes_read, 1620 (unsigned long) bytes_read,
1621 GNUNET_i2s (&s->target), 1621 GNUNET_i2s (&s->target),
1622 s); 1622 s);
1623 GNUNET_asprintf (&stat_txt, 1623 GNUNET_asprintf (&stat_txt,
@@ -1761,14 +1761,14 @@ server_access_cb (void *cls,
1761 1761
1762 LOG (GNUNET_ERROR_TYPE_DEBUG, 1762 LOG (GNUNET_ERROR_TYPE_DEBUG,
1763 _ ( 1763 _ (
1764 "Access from connection %p (%u of %u) for `%s' `%s' url `%s' with upload data size %u\n"), 1764 "Access from connection %p (%u of %u) for `%s' `%s' url `%s' with upload data size %lu\n"),
1765 sc, 1765 sc,
1766 plugin->cur_request, 1766 plugin->cur_request,
1767 plugin->max_request, 1767 plugin->max_request,
1768 method, 1768 method,
1769 version, 1769 version,
1770 url, 1770 url,
1771 (*upload_data_size)); 1771 (unsigned long) (*upload_data_size));
1772 if (NULL == sc) 1772 if (NULL == sc)
1773 { 1773 {
1774 /* CORS pre-flight request */ 1774 /* CORS pre-flight request */
@@ -1868,19 +1868,19 @@ server_access_cb (void *cls,
1868 1868
1869 /* (*upload_data_size > 0) for every segment received */ 1869 /* (*upload_data_size > 0) for every segment received */
1870 LOG (GNUNET_ERROR_TYPE_DEBUG, 1870 LOG (GNUNET_ERROR_TYPE_DEBUG,
1871 "Session %p / Connection %p: Peer `%s' PUT on address `%s' received %u bytes\n", 1871 "Session %p / Connection %p: Peer `%s' PUT on address `%s' received %lu bytes\n",
1872 s, sc, 1872 s, sc,
1873 GNUNET_i2s (&s->target), 1873 GNUNET_i2s (&s->target),
1874 http_common_plugin_address_to_string (plugin->protocol, 1874 http_common_plugin_address_to_string (plugin->protocol,
1875 s->address->address, 1875 s->address->address,
1876 s->address->address_length), 1876 s->address->address_length),
1877 *upload_data_size); 1877 (unsigned long) *upload_data_size);
1878 delay = GNUNET_TIME_absolute_get_remaining (s->next_receive); 1878 delay = GNUNET_TIME_absolute_get_remaining (s->next_receive);
1879 if (0 == delay.rel_value_us) 1879 if (0 == delay.rel_value_us)
1880 { 1880 {
1881 LOG (GNUNET_ERROR_TYPE_DEBUG, 1881 LOG (GNUNET_ERROR_TYPE_DEBUG,
1882 "PUT with %u bytes forwarded to MST\n", 1882 "PUT with %lu bytes forwarded to MST\n",
1883 *upload_data_size); 1883 (unsigned long) *upload_data_size);
1884 if (s->msg_tk == NULL) 1884 if (s->msg_tk == NULL)
1885 { 1885 {
1886 s->msg_tk = GNUNET_MST_create (&server_receive_mst_cb, 1886 s->msg_tk = GNUNET_MST_create (&server_receive_mst_cb,
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index e3bc21543..8378a64dd 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -2010,8 +2010,8 @@ do_transmit (void *cls, size_t size, void *buf)
2010 GNUNET_assert (pos->message_size <= session->bytes_in_queue); 2010 GNUNET_assert (pos->message_size <= session->bytes_in_queue);
2011 session->bytes_in_queue -= pos->message_size; 2011 session->bytes_in_queue -= pos->message_size;
2012 LOG (GNUNET_ERROR_TYPE_DEBUG, 2012 LOG (GNUNET_ERROR_TYPE_DEBUG,
2013 "Failed to transmit %u byte message to `%s'.\n", 2013 "Failed to transmit %lu byte message to `%s'.\n",
2014 pos->message_size, 2014 (unsigned long) pos->message_size,
2015 GNUNET_i2s (&session->target)); 2015 GNUNET_i2s (&session->target));
2016 ret += pos->message_size; 2016 ret += pos->message_size;
2017 GNUNET_CONTAINER_DLL_insert_after (hd, tl, tl, pos); 2017 GNUNET_CONTAINER_DLL_insert_after (hd, tl, tl, pos);
@@ -2067,9 +2067,9 @@ do_transmit (void *cls, size_t size, void *buf)
2067 session->bytes_in_queue -= pos->message_size; 2067 session->bytes_in_queue -= pos->message_size;
2068 GNUNET_assert (size >= pos->message_size); 2068 GNUNET_assert (size >= pos->message_size);
2069 LOG (GNUNET_ERROR_TYPE_DEBUG, 2069 LOG (GNUNET_ERROR_TYPE_DEBUG,
2070 "Transmitting message of type %u size %u to peer %s at %s\n", 2070 "Transmitting message of type %u size %lu to peer %s at %s\n",
2071 ntohs (((struct GNUNET_MessageHeader *) pos->msg)->type), 2071 ntohs (((struct GNUNET_MessageHeader *) pos->msg)->type),
2072 pos->message_size, 2072 (unsigned long) pos->message_size,
2073 GNUNET_i2s (&session->target), 2073 GNUNET_i2s (&session->target),
2074 tcp_plugin_address_to_string (session->plugin, 2074 tcp_plugin_address_to_string (session->plugin,
2075 session->address->address, 2075 session->address->address,
@@ -2192,8 +2192,8 @@ tcp_plugin_send (void *cls,
2192 pm->transmit_cont_cls = cont_cls; 2192 pm->transmit_cont_cls = cont_cls;
2193 2193
2194 LOG (GNUNET_ERROR_TYPE_DEBUG, 2194 LOG (GNUNET_ERROR_TYPE_DEBUG,
2195 "Asked to transmit %u bytes to `%s', added message to list.\n", 2195 "Asked to transmit %lu bytes to `%s', added message to list.\n",
2196 msgbuf_size, 2196 (unsigned long) msgbuf_size,
2197 GNUNET_i2s (&session->target)); 2197 GNUNET_i2s (&session->target));
2198 2198
2199 if (GNUNET_YES == 2199 if (GNUNET_YES ==
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index ec3a0edd8..49e84dfe7 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1821,7 +1821,8 @@ enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg)
1821 struct GNUNET_ATS_Session *session = frag_ctx->session; 1821 struct GNUNET_ATS_Session *session = frag_ctx->session;
1822 size_t msg_len = ntohs (msg->size); 1822 size_t msg_len = ntohs (msg->size);
1823 1823
1824 LOG (GNUNET_ERROR_TYPE_DEBUG, "Enqueuing fragment with %u bytes\n", msg_len); 1824 LOG (GNUNET_ERROR_TYPE_DEBUG, "Enqueuing fragment with %lu bytes\n",
1825 (unsigned long) msg_len);
1825 udpw = GNUNET_malloc (sizeof(struct UDP_MessageWrapper) + msg_len); 1826 udpw = GNUNET_malloc (sizeof(struct UDP_MessageWrapper) + msg_len);
1826 udpw->session = session; 1827 udpw->session = session;
1827 udpw->msg_buf = (char *) &udpw[1]; 1828 udpw->msg_buf = (char *) &udpw[1];
@@ -1996,8 +1997,8 @@ udp_plugin_send (void *cls,
1996 return GNUNET_SYSERR; 1997 return GNUNET_SYSERR;
1997 } 1998 }
1998 LOG (GNUNET_ERROR_TYPE_DEBUG, 1999 LOG (GNUNET_ERROR_TYPE_DEBUG,
1999 "UDP transmits %u-byte message to `%s' using address `%s'\n", 2000 "UDP transmits %lu-byte message to `%s' using address `%s'\n",
2000 udpmlen, 2001 (unsigned long) udpmlen,
2001 GNUNET_i2s (&s->target), 2002 GNUNET_i2s (&s->target),
2002 udp_address_to_string (plugin, 2003 udp_address_to_string (plugin,
2003 s->address->address, 2004 s->address->address,
@@ -3113,18 +3114,18 @@ remove_timeout_messages_and_select (struct Plugin *plugin,
3113 { 3114 {
3114 /* this message is not delayed */ 3115 /* this message is not delayed */
3115 LOG (GNUNET_ERROR_TYPE_DEBUG, 3116 LOG (GNUNET_ERROR_TYPE_DEBUG,
3116 "Message for peer `%s' (%u bytes) is not delayed \n", 3117 "Message for peer `%s' (%lu bytes) is not delayed \n",
3117 GNUNET_i2s (&udpw->session->target), 3118 GNUNET_i2s (&udpw->session->target),
3118 udpw->payload_size); 3119 (unsigned long) udpw->payload_size);
3119 break; /* Found message to send, break */ 3120 break; /* Found message to send, break */
3120 } 3121 }
3121 else 3122 else
3122 { 3123 {
3123 /* Message is delayed, try next */ 3124 /* Message is delayed, try next */
3124 LOG (GNUNET_ERROR_TYPE_DEBUG, 3125 LOG (GNUNET_ERROR_TYPE_DEBUG,
3125 "Message for peer `%s' (%u bytes) is delayed for %s\n", 3126 "Message for peer `%s' (%lu bytes) is delayed for %s\n",
3126 GNUNET_i2s (&udpw->session->target), 3127 GNUNET_i2s (&udpw->session->target),
3127 udpw->payload_size, 3128 (unsigned long) udpw->payload_size,
3128 GNUNET_STRINGS_relative_time_to_string (remaining, GNUNET_YES)); 3129 GNUNET_STRINGS_relative_time_to_string (remaining, GNUNET_YES));
3129 udpw = udpw->next; 3130 udpw = udpw->next;
3130 } 3131 }
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index 9d3e7d354..2324914c9 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -1304,8 +1304,8 @@ unix_plugin_send (void *cls,
1304 return GNUNET_SYSERR; 1304 return GNUNET_SYSERR;
1305 } 1305 }
1306 LOG (GNUNET_ERROR_TYPE_DEBUG, 1306 LOG (GNUNET_ERROR_TYPE_DEBUG,
1307 "Sending %u bytes with session for peer `%s' `%s'\n", 1307 "Sending %lu bytes with session for peer `%s' `%s'\n",
1308 msgbuf_size, 1308 (unsigned long) msgbuf_size,
1309 GNUNET_i2s (&session->target), 1309 GNUNET_i2s (&session->target),
1310 unix_plugin_address_to_string (NULL, 1310 unix_plugin_address_to_string (NULL,
1311 session->address->address, 1311 session->address->address,
diff --git a/src/transport/tcp_connection_legacy.c b/src/transport/tcp_connection_legacy.c
index 3e173b8a4..924362ef2 100644
--- a/src/transport/tcp_connection_legacy.c
+++ b/src/transport/tcp_connection_legacy.c
@@ -1142,9 +1142,9 @@ RETRY:
1142 return; 1142 return;
1143 } 1143 }
1144 LOG (GNUNET_ERROR_TYPE_DEBUG, 1144 LOG (GNUNET_ERROR_TYPE_DEBUG,
1145 "receive_ready read %u/%u bytes from `%s' (%p)!\n", 1145 "receive_ready read %lu/%lu bytes from `%s' (%p)!\n",
1146 (unsigned int) ret, 1146 (unsigned long) ret,
1147 connection->max, 1147 (unsigned long) connection->max,
1148 GNUNET_a2s (connection->addr, connection->addrlen), 1148 GNUNET_a2s (connection->addr, connection->addrlen),
1149 connection); 1149 connection);
1150 GNUNET_assert (NULL != (receiver = connection->receiver)); 1150 GNUNET_assert (NULL != (receiver = connection->receiver));
@@ -1327,8 +1327,8 @@ connect_error (void *cls)
1327 GNUNET_CONNECTION_TransmitReadyNotify notify; 1327 GNUNET_CONNECTION_TransmitReadyNotify notify;
1328 1328
1329 LOG (GNUNET_ERROR_TYPE_DEBUG, 1329 LOG (GNUNET_ERROR_TYPE_DEBUG,
1330 "Transmission request of size %u fails (%s/%u), connection failed (%p).\n", 1330 "Transmission request of size %lu fails (%s/%u), connection failed (%p).\n",
1331 connection->nth.notify_size, 1331 (unsigned long) connection->nth.notify_size,
1332 connection->hostname, 1332 connection->hostname,
1333 connection->port, 1333 connection->port,
1334 connection); 1334 connection);
@@ -1423,9 +1423,9 @@ RETRY:
1423 return; 1423 return;
1424 } 1424 }
1425 LOG (GNUNET_ERROR_TYPE_DEBUG, 1425 LOG (GNUNET_ERROR_TYPE_DEBUG,
1426 "Connection transmitted %u/%u bytes to `%s' (%p)\n", 1426 "Connection transmitted %lu/%lu bytes to `%s' (%p)\n",
1427 (unsigned int) ret, 1427 (unsigned long) ret,
1428 have, 1428 (unsigned long) have,
1429 GNUNET_a2s (connection->addr, connection->addrlen), 1429 GNUNET_a2s (connection->addr, connection->addrlen),
1430 connection); 1430 connection);
1431 connection->write_buffer_pos += ret; 1431 connection->write_buffer_pos += ret;
diff --git a/src/transport/tcp_service_legacy.c b/src/transport/tcp_service_legacy.c
index 12dce3993..8606b353b 100644
--- a/src/transport/tcp_service_legacy.c
+++ b/src/transport/tcp_service_legacy.c
@@ -1433,7 +1433,7 @@ LEGACY_SERVICE_run (int argc,
1433 { 1433 {
1434 clock_offset = skew_offset - skew_variance; 1434 clock_offset = skew_offset - skew_variance;
1435 GNUNET_TIME_set_offset (clock_offset); 1435 GNUNET_TIME_set_offset (clock_offset);
1436 LOG (GNUNET_ERROR_TYPE_DEBUG, "Skewing clock by %dll ms\n", clock_offset); 1436 LOG (GNUNET_ERROR_TYPE_DEBUG, "Skewing clock by %lld ms\n", clock_offset);
1437 } 1437 }
1438 /* actually run service */ 1438 /* actually run service */
1439 err = 0; 1439 err = 0;
diff --git a/src/util/bio.c b/src/util/bio.c
index 39050bb87..43a2abc89 100644
--- a/src/util/bio.c
+++ b/src/util/bio.c
@@ -356,10 +356,10 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h,
356 if (big > max_length) 356 if (big > max_length)
357 { 357 {
358 GNUNET_asprintf (&h->emsg, 358 GNUNET_asprintf (&h->emsg,
359 _ ("String `%s' longer than allowed (%u > %u)"), 359 _ ("String `%s' longer than allowed (%u > %lu)"),
360 what, 360 what,
361 big, 361 big,
362 max_length); 362 (unsigned long) max_length);
363 return GNUNET_SYSERR; 363 return GNUNET_SYSERR;
364 } 364 }
365 buf = GNUNET_malloc (big); 365 buf = GNUNET_malloc (big);
diff --git a/src/zonemaster/Makefile.am b/src/zonemaster/Makefile.am
index 3d248efd8..f2d569c75 100644
--- a/src/zonemaster/Makefile.am
+++ b/src/zonemaster/Makefile.am
@@ -24,6 +24,7 @@ gnunet_service_zonemaster_SOURCES = \
24gnunet_service_zonemaster_LDADD = \ 24gnunet_service_zonemaster_LDADD = \
25 $(top_builddir)/src/dht/libgnunetdht.la \ 25 $(top_builddir)/src/dht/libgnunetdht.la \
26 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 26 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
27 $(top_builddir)/src/identity/libgnunetidentity.la \
27 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 28 $(top_builddir)/src/statistics/libgnunetstatistics.la \
28 $(top_builddir)/src/util/libgnunetutil.la \ 29 $(top_builddir)/src/util/libgnunetutil.la \
29 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 30 $(top_builddir)/src/namestore/libgnunetnamestore.la \
@@ -32,10 +33,10 @@ gnunet_service_zonemaster_LDADD = \
32 33
33gnunet_service_zonemaster_monitor_SOURCES = \ 34gnunet_service_zonemaster_monitor_SOURCES = \
34 gnunet-service-zonemaster-monitor.c 35 gnunet-service-zonemaster-monitor.c
35
36gnunet_service_zonemaster_monitor_LDADD = \ 36gnunet_service_zonemaster_monitor_LDADD = \
37 $(top_builddir)/src/dht/libgnunetdht.la \ 37 $(top_builddir)/src/dht/libgnunetdht.la \
38 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 38 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
39 $(top_builddir)/src/identity/libgnunetidentity.la \
39 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 40 $(top_builddir)/src/statistics/libgnunetstatistics.la \
40 $(top_builddir)/src/util/libgnunetutil.la \ 41 $(top_builddir)/src/util/libgnunetutil.la \
41 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 42 $(top_builddir)/src/namestore/libgnunetnamestore.la \
diff --git a/src/zonemaster/gnunet-service-zonemaster-monitor.c b/src/zonemaster/gnunet-service-zonemaster-monitor.c
index 4a368048e..c6dd2b6ca 100644
--- a/src/zonemaster/gnunet-service-zonemaster-monitor.c
+++ b/src/zonemaster/gnunet-service-zonemaster-monitor.c
@@ -240,7 +240,7 @@ convert_records_for_export (const struct GNUNET_GNSRECORD_Data *rd,
240 * @return DHT PUT handle, NULL on error 240 * @return DHT PUT handle, NULL on error
241 */ 241 */
242static struct GNUNET_DHT_PutHandle * 242static struct GNUNET_DHT_PutHandle *
243perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 243perform_dht_put (const struct GNUNET_IDENTITY_PrivateKey *key,
244 const char *label, 244 const char *label,
245 const struct GNUNET_GNSRECORD_Data *rd_public, 245 const struct GNUNET_GNSRECORD_Data *rd_public,
246 unsigned int rd_public_count, 246 unsigned int rd_public_count,
@@ -271,9 +271,7 @@ perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
271 GNUNET_break (0); 271 GNUNET_break (0);
272 return NULL; /* whoops */ 272 return NULL; /* whoops */
273 } 273 }
274 block_size = ntohl (block->purpose.size) 274 block_size = GNUNET_GNSRECORD_block_get_size (block);
275 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature)
276 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey);
277 GNUNET_GNSRECORD_query_from_private_key (key, 275 GNUNET_GNSRECORD_query_from_private_key (key,
278 label, 276 label,
279 &query); 277 &query);
@@ -314,7 +312,7 @@ perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
314 */ 312 */
315static void 313static void
316handle_monitor_event (void *cls, 314handle_monitor_event (void *cls,
317 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 315 const struct GNUNET_IDENTITY_PrivateKey *zone,
318 const char *label, 316 const char *label,
319 unsigned int rd_count, 317 unsigned int rd_count,
320 const struct GNUNET_GNSRECORD_Data *rd) 318 const struct GNUNET_GNSRECORD_Data *rd)
diff --git a/src/zonemaster/gnunet-service-zonemaster.c b/src/zonemaster/gnunet-service-zonemaster.c
index c5aab8d92..11fa9921d 100644
--- a/src/zonemaster/gnunet-service-zonemaster.c
+++ b/src/zonemaster/gnunet-service-zonemaster.c
@@ -579,7 +579,7 @@ convert_records_for_export (const struct GNUNET_GNSRECORD_Data *rd,
579 * @return DHT PUT handle, NULL on error 579 * @return DHT PUT handle, NULL on error
580 */ 580 */
581static struct GNUNET_DHT_PutHandle * 581static struct GNUNET_DHT_PutHandle *
582perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 582perform_dht_put (const struct GNUNET_IDENTITY_PrivateKey *key,
583 const char *label, 583 const char *label,
584 const struct GNUNET_GNSRECORD_Data *rd_public, 584 const struct GNUNET_GNSRECORD_Data *rd_public,
585 unsigned int rd_public_count, 585 unsigned int rd_public_count,
@@ -610,9 +610,7 @@ perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
610 GNUNET_break (0); 610 GNUNET_break (0);
611 return NULL; /* whoops */ 611 return NULL; /* whoops */
612 } 612 }
613 block_size = ntohl (block->purpose.size) 613 block_size = GNUNET_GNSRECORD_block_get_size (block);
614 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature)
615 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey);
616 GNUNET_GNSRECORD_query_from_private_key (key, 614 GNUNET_GNSRECORD_query_from_private_key (key,
617 label, 615 label,
618 &query); 616 &query);
@@ -725,7 +723,7 @@ zone_iteration_finished (void *cls)
725 */ 723 */
726static void 724static void
727put_gns_record (void *cls, 725put_gns_record (void *cls,
728 const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 726 const struct GNUNET_IDENTITY_PrivateKey *key,
729 const char *label, 727 const char *label,
730 unsigned int rd_count, 728 unsigned int rd_count,
731 const struct GNUNET_GNSRECORD_Data *rd) 729 const struct GNUNET_GNSRECORD_Data *rd)