aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.mailmap16
-rw-r--r--AUTHORS6
-rw-r--r--README3
-rw-r--r--configure.ac129
-rwxr-xr-xcontrib/scripts/gnunet-bugreport2
-rw-r--r--doc/handbook/chapters/keyconcepts.texi15
-rw-r--r--doc/index.html2
-rw-r--r--doc/man/gnunet-revocation.13
-rw-r--r--po/POTFILES.in106
-rw-r--r--po/de.po998
-rw-r--r--po/it.po966
-rw-r--r--po/sv.po1002
-rw-r--r--po/vi.po1010
-rw-r--r--po/zh_CN.po984
-rw-r--r--src/Makefile.am11
-rw-r--r--src/abd/abd.h8
-rw-r--r--src/abd/abd_serialization.c4
-rw-r--r--src/abd/delegate_misc.c8
-rw-r--r--src/abd/gnunet-abd.c39
-rw-r--r--src/abd/plugin_gnsrecord_abd.c6
-rw-r--r--src/arm/gnunet-arm.c4
-rw-r--r--src/ats-tool/gnunet-ats.c2
-rw-r--r--src/auction/gnunet-auction-create.c2
-rw-r--r--src/auction/gnunet-auction-info.c2
-rw-r--r--src/auction/gnunet-auction-join.c2
-rw-r--r--src/cadet/gnunet-cadet.c2
-rw-r--r--src/cadet/gnunet-service-cadet_tunnels.c6
-rw-r--r--src/cadet/test_cadeT.c47
-rw-r--r--src/conversation/gnunet-conversation-test.c2
-rw-r--r--src/conversation/gnunet-conversation.c2
-rw-r--r--src/conversation/gnunet-service-conversation.c8
-rw-r--r--src/core/gnunet-core.c2
-rw-r--r--src/core/gnunet-service-core.c26
-rw-r--r--src/core/gnunet-service-core_kx.c61
-rw-r--r--src/curl/Makefile.am2
-rw-r--r--src/curl/curl.c82
-rw-r--r--src/datastore/gnunet-datastore.c2
-rw-r--r--src/dns/gnunet-dns-monitor.c2
-rw-r--r--src/dns/gnunet-dns-redirector.c2
-rw-r--r--src/dns/plugin_block_dns.c8
-rw-r--r--src/exit/gnunet-daemon-exit.c6
-rw-r--r--src/exit/gnunet-helper-exit.c2
-rw-r--r--src/fs/fs_publish_ublock.c6
-rw-r--r--src/fs/fs_uri.c9
-rw-r--r--src/fs/gnunet-auto-share.c2
-rw-r--r--src/fs/gnunet-directory.c2
-rw-r--r--src/fs/gnunet-download.c2
-rw-r--r--src/fs/gnunet-fs-profiler.c2
-rw-r--r--src/fs/gnunet-fs.c2
-rw-r--r--src/fs/gnunet-publish.c2
-rw-r--r--src/fs/gnunet-search.c2
-rw-r--r--src/fs/gnunet-service-fs.c19
-rw-r--r--src/fs/gnunet-unindex.c2
-rw-r--r--src/fs/plugin_block_fs.c8
-rw-r--r--src/fs/test_fs_namespace.c16
-rw-r--r--src/fs/test_fs_namespace_list_updateable.c21
-rw-r--r--src/fs/test_fs_uri.c14
-rw-r--r--src/gns/Makefile.am4
-rw-r--r--src/gns/gnunet-bcd.c7
-rw-r--r--src/gns/gnunet-dns2gns.c4
-rw-r--r--src/gns/gnunet-gns-benchmark.c2
-rw-r--r--src/gns/gnunet-gns-import.c2
-rw-r--r--src/gns/gnunet-gns-proxy-setup-ca.in10
-rw-r--r--src/gns/gnunet-gns-proxy.c9
-rw-r--r--src/gns/gnunet-gns.c10
-rw-r--r--src/gns/gnunet-service-gns_interceptor.c2
-rw-r--r--src/gns/gnunet-service-gns_resolver.c19
-rw-r--r--src/gns/nss/nss_gns_query.c15
-rw-r--r--src/gns/plugin_rest_gns.c4
-rw-r--r--src/gns/test_gns_lookup_peer1.conf13
-rw-r--r--src/gns/test_gns_lookup_peer2.conf16
-rwxr-xr-xsrc/gns/test_gns_multiple_record_lookup.sh32
-rw-r--r--src/gnsrecord/Makefile.am12
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c14
-rw-r--r--src/gnsrecord/gnunet-gnsrecord-tvg.c202
-rw-r--r--src/gnsrecord/perf_gnsrecord_crypto.c12
-rw-r--r--src/gnsrecord/test_gnsrecord_crypto.c14
-rw-r--r--src/gnsrecord/test_gnsrecord_serialization.c2
-rw-r--r--src/hello/hello-ng.c5
-rw-r--r--src/hostlist/gnunet-daemon-hostlist.c2
-rw-r--r--src/hostlist/gnunet-daemon-hostlist_server.c5
-rw-r--r--src/identity/Makefile.am4
-rw-r--r--src/identity/gnunet-identity.c70
-rw-r--r--src/identity/gnunet-service-identity.c135
-rw-r--r--src/identity/identity.h17
-rw-r--r--src/identity/identity_api.c179
-rw-r--r--src/identity/identity_api_lookup.c2
-rw-r--r--src/identity/plugin_rest_identity.c14
-rw-r--r--src/include/Makefile.am5
-rw-r--r--src/include/gnunet_common.h160
-rw-r--r--src/include/gnunet_container_lib.h7
-rw-r--r--src/include/gnunet_crypto_lib.h257
-rw-r--r--src/include/gnunet_curl_lib.h17
-rw-r--r--src/include/gnunet_disk_lib.h29
-rw-r--r--src/include/gnunet_gnsrecord_lib.h17
-rw-r--r--src/include/gnunet_identity_service.h32
-rw-r--r--src/include/gnunet_json_lib.h46
-rw-r--r--src/include/gnunet_mhd_compat.h43
-rw-r--r--src/include/gnunet_namestore_service.h18
-rw-r--r--src/include/gnunet_pq_lib.h24
-rw-r--r--src/include/gnunet_protocols.h17
-rw-r--r--src/include/gnunet_reclaim_attribute_plugin.h176
-rw-r--r--src/include/gnunet_reclaim_lib.h (renamed from src/include/gnunet_reclaim_attribute_lib.h)368
-rw-r--r--src/include/gnunet_reclaim_plugin.h296
-rw-r--r--src/include/gnunet_reclaim_service.h145
-rw-r--r--src/include/gnunet_revocation_service.h147
-rw-r--r--src/include/gnunet_strings_lib.h26
-rw-r--r--src/include/platform.h4
-rw-r--r--src/json/Makefile.am1
-rw-r--r--src/json/json_generator.c145
-rw-r--r--src/json/json_gnsrecord.c42
-rw-r--r--src/json/json_helper.c107
-rw-r--r--src/json/test_json_mhd.c3
-rw-r--r--src/namecache/gnunet-namecache.c4
-rw-r--r--src/namecache/plugin_namecache_flat.c2
-rw-r--r--src/namecache/test_namecache_api_cache_block.c19
-rw-r--r--src/namestore/Makefile.am4
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c13
-rw-r--r--src/namestore/gnunet-namestore.c56
-rw-r--r--src/namestore/gnunet-service-namestore.c4
-rw-r--r--src/namestore/gnunet-zoneimport.c2
-rw-r--r--src/namestore/namestore_api.c37
-rw-r--r--src/namestore/perf_namestore_api_zone_iteration.c14
-rw-r--r--src/namestore/plugin_rest_namestore.c364
-rw-r--r--src/namestore/test_namestore_api_lookup_nick.c45
-rw-r--r--src/namestore/test_namestore_api_lookup_private.c20
-rw-r--r--src/namestore/test_namestore_api_lookup_public.c26
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow.c26
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow_filter.c28
-rw-r--r--src/namestore/test_namestore_api_monitoring.c39
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c36
-rw-r--r--src/namestore/test_namestore_api_remove.c18
-rw-r--r--src/namestore/test_namestore_api_remove_not_existing_record.c18
-rw-r--r--src/namestore/test_namestore_api_store.c16
-rw-r--r--src/namestore/test_namestore_api_store_update.c20
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c42
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_nick.c77
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c39
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c45
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c18
-rw-r--r--src/nat-auto/gnunet-nat-auto.c2
-rw-r--r--src/nat/gnunet-nat.c2
-rw-r--r--src/nse/gnunet-service-nse.c15
-rw-r--r--src/peerinfo-tool/Makefile.am4
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c2
-rw-r--r--src/peerinfo-tool/plugin_rest_peerinfo.c4
-rw-r--r--src/peerstore/plugin_peerstore_flat.c2
-rw-r--r--src/pq/pq_connect.c279
-rw-r--r--src/pq/pq_query_helper.c66
-rw-r--r--src/pq/pq_result_helper.c92
-rw-r--r--src/pq/test_pq.c6
-rw-r--r--src/pt/gnunet-daemon-pt.c2
-rw-r--r--src/pt/test_gns_vpn.c5
-rw-r--r--src/pt/test_gnunet_vpn.c3
-rw-r--r--src/reclaim-attribute/Makefile.am41
-rw-r--r--src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c290
-rw-r--r--src/reclaim-attribute/reclaim_attribute.c1055
-rw-r--r--src/reclaim/Makefile.am39
-rw-r--r--src/reclaim/gnunet-reclaim.c330
-rw-r--r--src/reclaim/gnunet-service-reclaim.c955
-rw-r--r--src/reclaim/gnunet-service-reclaim_tickets.c365
-rw-r--r--src/reclaim/gnunet-service-reclaim_tickets.h7
-rw-r--r--src/reclaim/json_reclaim.c169
-rw-r--r--src/reclaim/json_reclaim.h16
-rw-r--r--src/reclaim/oidc_helper.c345
-rw-r--r--src/reclaim/oidc_helper.h9
-rw-r--r--src/reclaim/plugin_gnsrecord_reclaim.c30
-rw-r--r--src/reclaim/plugin_reclaim_attestation_jwt.c321
-rw-r--r--src/reclaim/plugin_reclaim_attribute_basic.c180
-rw-r--r--src/reclaim/plugin_rest_openid_connect.c581
-rw-r--r--src/reclaim/plugin_rest_reclaim.c714
-rw-r--r--src/reclaim/reclaim.h82
-rw-r--r--src/reclaim/reclaim_api.c556
-rw-r--r--src/reclaim/reclaim_attestation.c570
-rw-r--r--src/reclaim/reclaim_attestation.h64
-rw-r--r--src/reclaim/reclaim_attribute.c546
-rw-r--r--src/reclaim/reclaim_attribute.h (renamed from src/reclaim-attribute/reclaim_attribute.h)46
-rw-r--r--src/regex/gnunet-daemon-regexprofiler.c2
-rw-r--r--src/regex/plugin_block_regex.c8
-rw-r--r--src/regex/regex_internal_dht.c6
-rw-r--r--src/rest/gnunet-rest-server.c22
-rw-r--r--src/rest/plugin_rest_config.c1
-rw-r--r--src/revocation/Makefile.am12
-rw-r--r--src/revocation/gnunet-revocation-tvg.c123
-rw-r--r--src/revocation/gnunet-revocation.c214
-rw-r--r--src/revocation/gnunet-service-revocation.c40
-rw-r--r--src/revocation/plugin_block_revocation.c30
-rw-r--r--src/revocation/revocation.conf.in1
-rw-r--r--src/revocation/revocation.h19
-rw-r--r--src/revocation/revocation_api.c360
-rw-r--r--src/revocation/test_revocation.c27
-rw-r--r--src/revocation/test_revocation.conf1
-rw-r--r--src/secretsharing/gnunet-service-secretsharing.c24
-rw-r--r--src/sq/sq_query_helper.c4
-rw-r--r--src/statistics/gnunet-statistics.c126
-rw-r--r--src/template/gnunet-template.c2
-rw-r--r--src/testbed/gnunet-daemon-latency-logger.c2
-rw-r--r--src/testbed/gnunet-daemon-testbed-blacklist.c2
-rw-r--r--src/testbed/gnunet-daemon-testbed-underlay.c2
-rw-r--r--src/testbed/gnunet-testbed-profiler.c2
-rw-r--r--src/testing/gnunet-testing.c2
-rw-r--r--src/testing/testing.c2
-rw-r--r--src/topology/gnunet-daemon-topology.c2
-rw-r--r--src/transport/Makefile.am8
-rw-r--r--src/transport/gnunet-communicator-tcp.c39
-rw-r--r--src/transport/gnunet-communicator-udp.c36
-rw-r--r--src/transport/gnunet-communicator-unix.c2
-rw-r--r--src/transport/gnunet-service-tng.c77
-rw-r--r--src/transport/gnunet-service-transport.c32
-rw-r--r--src/transport/gnunet-service-transport.h2
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c8
-rw-r--r--src/transport/gnunet-service-transport_validation.c7
-rw-r--r--src/transport/gnunet-transport-profiler.c2
-rw-r--r--src/transport/gnunet-transport.c2
-rw-r--r--src/transport/plugin_transport_http_server.c12
-rw-r--r--src/transport/tcp_service_legacy.c4
-rw-r--r--src/transport/test_communicator_basic.c56
-rw-r--r--src/transport/test_communicator_udp_basic_peer1.conf9
-rw-r--r--src/transport/test_communicator_udp_basic_peer2.conf11
-rw-r--r--src/transport/test_plugin_transport.c14
-rw-r--r--src/transport/transport-testing2.c189
-rw-r--r--src/transport/transport-testing2.h16
-rw-r--r--src/util/Makefile.am5
-rw-r--r--src/util/buffer.c17
-rw-r--r--src/util/common_allocation.c21
-rw-r--r--src/util/common_logging.c28
-rw-r--r--src/util/configuration.c3
-rw-r--r--src/util/consttime_memcmp.c279
-rw-r--r--src/util/crypto_ecc.c241
-rw-r--r--src/util/crypto_ecc_setup.c581
-rw-r--r--src/util/crypto_hkdf.c39
-rw-r--r--src/util/crypto_mpi.c28
-rw-r--r--src/util/crypto_pow.c46
-rw-r--r--src/util/crypto_rsa.c57
-rw-r--r--src/util/disk.c65
-rw-r--r--src/util/getopt_helpers.c32
-rw-r--r--src/util/gnunet-config.c2
-rw-r--r--src/util/gnunet-crypto-tvg.c186
-rw-r--r--src/util/gnunet-ecc.c110
-rw-r--r--src/util/gnunet-resolver.c12
-rw-r--r--src/util/gnunet-scrypt.c13
-rw-r--r--src/util/gnunet-timeout.c2
-rw-r--r--src/util/gnunet-uri.c2
-rw-r--r--src/util/mq.c6
-rw-r--r--src/util/os_priority.c4
-rw-r--r--src/util/perf_crypto_asymmetric.c14
-rw-r--r--src/util/scheduler.c16
-rw-r--r--src/util/service.c3
-rw-r--r--src/util/strings.c162
-rw-r--r--src/util/test_common_allocation.c26
-rw-r--r--src/util/test_crypto_ecdh_ecdsa.c27
-rw-r--r--src/util/test_crypto_ecdh_eddsa.c24
-rw-r--r--src/util/test_crypto_ecdhe.c27
-rw-r--r--src/util/test_crypto_ecdsa.c119
-rw-r--r--src/util/test_crypto_eddsa.c113
-rw-r--r--src/util/test_crypto_rsa.c6
-rw-r--r--src/util/test_scheduler.c2
-rw-r--r--src/util/tweetnacl-gnunet.c560
-rw-r--r--src/util/tweetnacl-gnunet.h54
-rw-r--r--src/vpn/gnunet-helper-vpn.c2
-rw-r--r--src/vpn/gnunet-vpn.c2
261 files changed, 11961 insertions, 10035 deletions
diff --git a/.mailmap b/.mailmap
index a468dd48d..2ca867b4e 100644
--- a/.mailmap
+++ b/.mailmap
@@ -14,13 +14,15 @@ Jeffrey Burdges <burdges@gnunet.org>
14Martin Schanzenbach <martin.schanzenbach@aisec.fraunhofer.de> Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> 14Martin Schanzenbach <martin.schanzenbach@aisec.fraunhofer.de> Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>
15Martin Schanzenbach <martin.schanzenbach@aisec.fraunhofer.de> Schanzenbach, Martin <mschanzenbach@posteo.de> 15Martin Schanzenbach <martin.schanzenbach@aisec.fraunhofer.de> Schanzenbach, Martin <mschanzenbach@posteo.de>
16Martin Schanzenbach <martin.schanzenbach@aisec.fraunhofer.de> Martin Schanzenbach <mschanzenbach@posteo.de> 16Martin Schanzenbach <martin.schanzenbach@aisec.fraunhofer.de> Martin Schanzenbach <mschanzenbach@posteo.de>
17ng0@n0.is <ng0@n0.is> 17nikita <nikita@n0.is>
18ng0 <ng0@n0.is> ng0 <ng0@n0.is> 18nikita <nikita@n0.is> nikita <tek.no.katze@gmail.com>
19ng0 <ng0@n0.is> ng0 <contact.ng0@cryptolab.net> 19nikita <nikita@n0.is> ng0@n0.is <ng0@n0.is>
20ng0 <ng0@n0.is> ng0 <ng0@infotropique.org> 20nikita <nikita@n0.is> ng0 <ng0@n0.is>
21ng0 <ng0@n0.is> N. 'ng0' Gillmann <ngillmann@runbox.com> 21nikita <nikita@n0.is> ng0 <contact.ng0@cryptolab.net>
22ng0 <ng0@n0.is> ng0 <ng0@we.make.ritual.n0.is> 22nikita <nikita@n0.is> ng0 <ng0@infotropique.org>
23ng0 <ng0@n0.is> Nils Gillmann <ng0@n0.is> 23nikita <nikita@n0.is> N. 'ng0' Gillmann <ngillmann@runbox.com>
24nikita <nikita@n0.is> ng0 <ng0@we.make.ritual.n0.is>
25nikita <nikita@n0.is> Nils Gillmann <ng0@n0.is>
24t3sserakt <t3ss@posteo.de> 26t3sserakt <t3ss@posteo.de>
25t3sserakt <t3ss@posteo.de> <t3sserakt@posteo.de> 27t3sserakt <t3ss@posteo.de> <t3sserakt@posteo.de>
26tg(x) <*@tg-x.net> 28tg(x) <*@tg-x.net>
diff --git a/AUTHORS b/AUTHORS
index d44dc3920..061d51379 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -70,7 +70,7 @@ Marko Räihä
70Michael John Wensley <michael@wensley.org.uk> 70Michael John Wensley <michael@wensley.org.uk>
71Milan Bouchet-Valat <nalimilan@club.fr> 71Milan Bouchet-Valat <nalimilan@club.fr>
72Nathan Evans <evans@net.in.tum.de> 72Nathan Evans <evans@net.in.tum.de>
73Nils Gillmann <ng0@n0.is> [ Documentation export to Texinfo ] 73nikita <nikita@n0.is> [ Documentation export to Texinfo ]
74Paul Ruth <ruth@cs.purdue.edu> 74Paul Ruth <ruth@cs.purdue.edu>
75Philipp Tölke <toelke@in.tum.de>, <pt@philipptoelke.de> 75Philipp Tölke <toelke@in.tum.de>, <pt@philipptoelke.de>
76Renaldo Ferreira <rf@cs.purdue.edu> 76Renaldo Ferreira <rf@cs.purdue.edu>
@@ -124,8 +124,8 @@ Nix: viric, rahul
124OpenWrt/LEDE: Daniel Golle <daniel@makrotopia.org> 124OpenWrt/LEDE: Daniel Golle <daniel@makrotopia.org>
125macOS: Jussi Eloranta <eloranta@cc.jyu.fi> 125macOS: Jussi Eloranta <eloranta@cc.jyu.fi>
126Gentoo: Carlo von lynX <psyc://loupsycedyglgamf.onion/~lynX> 126Gentoo: Carlo von lynX <psyc://loupsycedyglgamf.onion/~lynX>
127 N. Gillmann <ng0@n0.is> 127 nikita <nikita@n0.is>
128NetBSD pkgsrc: N. Gillmann <ng0@n0.is> 128NetBSD pkgsrc: nikita <nikita@NetBSD.org>
129 129
130If you have contributed and are not listed here, please 130If you have contributed and are not listed here, please
131notify one of the maintainers in order to be added. 131notify one of the maintainers in order to be added.
diff --git a/README b/README
index f8fd811f8..87d4d635e 100644
--- a/README
+++ b/README
@@ -96,6 +96,9 @@ These are the direct dependencies for running GNUnet:
96- which (contrib/apparmor(?), gnunet-bugreport, 96- which (contrib/apparmor(?), gnunet-bugreport,
97 and possibly more) 97 and possibly more)
98- zlib 98- zlib
99- argon2 >= 20190702 (for proof-of-work calculations in
100 revocation)
101- libsodium >= 1.0.11 (for elliptic curve cryptography)
99 102
100These are the dependencies for GNUnet's testsuite: 103These are the dependencies for GNUnet's testsuite:
101~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/configure.ac b/configure.ac
index 23ca78dbb..94c0a7689 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,6 +97,9 @@ AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
97# We make heavy use of this, llvm/gcc and gcc-9 give warnings so disable. 97# We make heavy use of this, llvm/gcc and gcc-9 give warnings so disable.
98CC_CHECK_CFLAG_APPEND([address-of-packed-member]) 98CC_CHECK_CFLAG_APPEND([address-of-packed-member])
99 99
100# We make heavy use of this, llvm/gcc and gcc-9 give warnings so disable.
101CC_CHECK_CFLAG_APPEND([tautological-constant-out-of-range-compare])
102
100# Use Linux interface name unless the OS has a different preference 103# Use Linux interface name unless the OS has a different preference
101DEFAULT_INTERFACE="\"eth0\"" 104DEFAULT_INTERFACE="\"eth0\""
102 105
@@ -691,6 +694,14 @@ AC_RUN_IFELSE(
691AC_LANG_POP(C) 694AC_LANG_POP(C)
692]) # $build = $target 695]) # $build = $target
693 696
697AC_COMPILE_IFELSE([AC_LANG_SOURCE(
698 [[int main() {
699 _Static_assert(sizeof(int) >= 4, "not big enough");
700 return 0;
701 };]])],
702 [AC_DEFINE([HAVE_STATIC_ASSERT],[1],[Static assertions supported])],
703 [AC_DEFINE([HAVE_STATIC_ASSERT],[0],[Static assertions not supported])])
704
694# check for bluetooth library 705# check for bluetooth library
695bluetooth=0 706bluetooth=0
696AC_MSG_CHECKING(for libbluetooth) 707AC_MSG_CHECKING(for libbluetooth)
@@ -1025,6 +1036,24 @@ AS_IF([test x$nss = xfalse],
1025AC_CHECK_LIB([kvm],[kvm_open]) 1036AC_CHECK_LIB([kvm],[kvm_open])
1026AC_CHECK_LIB([kstat],[kstat_open]) 1037AC_CHECK_LIB([kstat],[kstat_open])
1027 1038
1039argon=0
1040# test for argon2 (for POW)
1041AC_CHECK_LIB([argon2],[argon2d_hash_raw], argon=1, argon=0)
1042AS_IF([test x$argon = x1],
1043[
1044 AC_MSG_RESULT([argon2 found])
1045],[
1046 AC_MSG_ERROR([GNUnet requires argon2.])
1047])
1048
1049libsodium=0
1050# test for libsodium
1051AC_CHECK_HEADER([sodium.h],
1052 [AC_CHECK_LIB([sodium], [sodium_init],
1053 [libsodium=1])])
1054
1055AS_IF([test x$libsodium = x0],
1056 [AC_MSG_ERROR([GNUnet requires libsodium.])])
1028 1057
1029# test for libextractor 1058# test for libextractor
1030extractor=0 1059extractor=0
@@ -1442,6 +1471,7 @@ AM_CONDITIONAL(HAVE_MHD, test x$lmhd = x1)
1442AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd]) 1471AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd])
1443 1472
1444AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1]) 1473AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1])
1474AM_CONDITIONAL(HAVE_REST, [test x$jansson = x1 -a x$lmhd = x1])
1445 1475
1446# restore LIBS 1476# restore LIBS
1447LIBS=$SAVE_LIBS 1477LIBS=$SAVE_LIBS
@@ -1504,20 +1534,6 @@ LIBS=$SAVE_LIBS
1504 1534
1505GN_INTLINCL="" 1535GN_INTLINCL=""
1506GN_LIBINTL="$LTLIBINTL" 1536GN_LIBINTL="$LTLIBINTL"
1507AC_ARG_ENABLE(framework,
1508 [AS_HELP_STRING([--enable-framework],[enable Mac OS X framework build helpers])],
1509 enable_framework_build=$enableval)
1510AM_CONDITIONAL(WANT_FRAMEWORK,
1511 test x$enable_framework_build = xyes)
1512AS_IF([test x$enable_framework_build = xyes],
1513 [AC_DEFINE([FRAMEWORK_BUILD],
1514 1,
1515 [Build a Mac OS X Framework])
1516 GN_INTLINCL='-I$(top_srcdir)/src/intlemu'
1517 GN_LIBINTL='$(top_builddir)/src/intlemu/libintlemu.la -framework CoreFoundation'
1518 AC_LIB_APPENDTOVAR([CPPFLAGS],
1519 [$GN_INTLINCL])])
1520
1521GN_LIB_LDFLAGS="-export-dynamic -no-undefined" 1537GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
1522GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" 1538GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
1523 1539
@@ -1933,7 +1949,6 @@ src/zonemaster/Makefile
1933src/zonemaster/zonemaster.conf 1949src/zonemaster/zonemaster.conf
1934src/rest/Makefile 1950src/rest/Makefile
1935src/abe/Makefile 1951src/abe/Makefile
1936src/reclaim-attribute/Makefile
1937src/reclaim/Makefile 1952src/reclaim/Makefile
1938pkgconfig/Makefile 1953pkgconfig/Makefile
1939pkgconfig/gnunetarm.pc 1954pkgconfig/gnunetarm.pc
@@ -1986,14 +2001,13 @@ AS_IF([test "x$enable_java_ports" = "xyes"],
1986#### This could be moved to the checks above, 2001#### This could be moved to the checks above,
1987#### but for now let's keep it here. 2002#### but for now let's keep it here.
1988#### 2003####
1989 2004transport_msg="tcp udp unix"
2005AS_IF([test "x$build_target" = "xlinux" -a "x$enable_experimental" = "xyes"],
2006 [transport_msg="$transport_msg wlan"])
1990# -- print message regarding enabled experimental features 2007# -- print message regarding enabled experimental features
2008experimental_msg="no"
1991AS_IF([test "x$enable_experimental" = "xyes"], 2009AS_IF([test "x$enable_experimental" = "xyes"],
1992 [experimental_msg="experimental features enabled"]) 2010 [experimental_msg="yes"])
1993# -- OSX Framework
1994AS_IF([test "$enable_framework_build" = "yes"],
1995 [macosx_framework_msg="yes"],
1996 [macosx_framework_msg="no"])
1997# -- libidn 2 2011# -- libidn 2
1998AS_IF([test "x$working_libidn2" = x1], 2012AS_IF([test "x$working_libidn2" = x1],
1999 [libidn2_msg="libidn2"]) 2013 [libidn2_msg="libidn2"])
@@ -2019,31 +2033,39 @@ AS_IF([test "x$makeinfo" != "x1"],
2019 [texinfo_msg="no"], 2033 [texinfo_msg="no"],
2020 [texinfo_msg="yes"]) 2034 [texinfo_msg="yes"])
2021# -- conversation 2035# -- conversation
2036conversation_msg="no"
2022AS_IF([test "x$conversation_backend" = "xnone"], 2037AS_IF([test "x$conversation_backend" = "xnone"],
2023 [AS_IF([test "x$pulse" != "x1"], 2038 [AS_IF([test "x$pulse" != "x1"],
2024 [AC_MSG_WARN([libpulse(audio) not found (required to build conversation).]) 2039 [libpulse_msg="no (required for conversation)"],
2025 libpulse_msg="no (required for conversation)"],
2026 [libpulse_msg="yes"]) 2040 [libpulse_msg="yes"])
2027 AS_IF([test "x$opus" != "x1"], 2041 AS_IF([test "x$opus" != "x1"],
2028 [AC_MSG_WARN([libopus not found (required to build conversation)]) 2042 [libopus_msg="no (required for conversation)"],
2029 libopus_msg="no (required for conversation)"],
2030 [libopus_msg="yes"]) 2043 [libopus_msg="yes"])
2031 AS_IF([test "x$gst" != "x1"], 2044 AS_IF([test "x$gst" != "x1"],
2032 [AC_MSG_WARN([GStreamer not found (required to build conversation).]) 2045 [gstreamer_msg="no (required for conversation)"],
2033 gstreamer_msg="no (required for conversation)"],
2034 [gstreamer_msg="yes"])], 2046 [gstreamer_msg="yes"])],
2035 [AS_IF([test "x$opus" = x1], 2047 [AS_IF([test "x$opus" = x1],
2036 [features_msg="$features_msg conversation"], 2048 [conversation_msg="yes (x$conversation_backend)"],
2037 [AC_MSG_WARN([libopus not found (required to build conversation)])])]) 2049 [AC_MSG_WARN([libopus not found (required to build conversation)])])])
2050# -- rest / oidc
2051rest_msg="no"
2052AS_IF([test "x$lmhd" = "x1" -a "x$jansson" = "x1"],
2053 [rest_msg="yes"
2054 reclaim_msg="yes (with OpenID Connect)"],
2055 [rest_msg="no"
2056 reclaim_msg="yes (without OpenID Connect)"])
2057
2058
2038# -- interface 2059# -- interface
2039interface_msg=`echo $DEFAULT_INTERFACE | tr -d \"` 2060interface_msg=`echo $DEFAULT_INTERFACE | tr -d \"`
2040# -- libmicrohttpd 2061# -- libmicrohttpd
2041AS_IF([test "x$lmhd" != "x1"], 2062AS_IF([test "x$lmhd" = "x0"],
2042 [libmicrohttpd_msg="no (optional)"], 2063 [libmicrohttpd_msg="no (REST service and HTTP transport will not be built)"],
2043 [libmicrohttpd_msg="yes"]) 2064 [libmicrohttpd_msg="yes"
2065 transport_msg="$transport_msg http_server"])
2044# -- jansson 2066# -- jansson
2045AS_IF([test "x$jansson" = "x0"], 2067AS_IF([test "x$jansson" = "x0"],
2046 [jansson_msg="no (optional)"], 2068 [jansson_msg="no (REST service will not be built)"],
2047 [jansson_msg="yes"]) 2069 [jansson_msg="yes"])
2048# -- libextractor 2070# -- libextractor
2049AS_IF([test "$extractor" != 1], 2071AS_IF([test "$extractor" != 1],
@@ -2051,10 +2073,8 @@ AS_IF([test "$extractor" != 1],
2051 [libextractor_msg="yes"]) 2073 [libextractor_msg="yes"])
2052# -- libzbar 2074# -- libzbar
2053AS_IF([test "x$zbar" = "x1"], 2075AS_IF([test "x$zbar" = "x1"],
2054 [libzbar_msg="yes" 2076 [libzbar_msg="yes"],
2055 features_msg="$features_msg gnunet-qr"], 2077 [libzbar_msg="no (gnunet-qr will not be built)"])
2056 [AC_MSG_NOTICE([zbar not found, gnunet-qr will not be built.])
2057 libzbar_msg="no"])
2058# -- libgnurl 2078# -- libgnurl
2059AS_IF([test "$gnurl" = "0"], 2079AS_IF([test "$gnurl" = "0"],
2060 [AS_IF([test "x$curl" = "xfalse"], 2080 [AS_IF([test "x$curl" = "xfalse"],
@@ -2063,31 +2083,29 @@ AS_IF([test "$gnurl" = "0"],
2063 curl_msg="no"], 2083 curl_msg="no"],
2064 [AC_MSG_NOTICE([libgnurl not found, trying to use libcurl-gnutls instead.]) 2084 [AC_MSG_NOTICE([libgnurl not found, trying to use libcurl-gnutls instead.])
2065 curl_msg="yes"])], 2085 curl_msg="yes"])],
2066 [gnurl_msg="yes"]) 2086 [gnurl_msg="yes"
2087 transport_msg="$transport_msg http_client"])
2067# -- ifconfig 2088# -- ifconfig
2068AS_IF([test "$VAR_IFCONFIG_BINARY" = "false"], 2089AS_IF([test "$VAR_IFCONFIG_BINARY" = "false"],
2069 [AC_MSG_WARN([ifconfig not found, some features will not work]) 2090 [ifconfig_msg="no (optional, some features will not work)"],
2070 ifconfig_msg="no (optional)"],
2071 [ifconfig_msg="yes"]) 2091 [ifconfig_msg="yes"])
2072# -- upnpc 2092# -- upnpc
2073AS_IF([test "$VAR_UPNPC_BINARY" = "false"], 2093AS_IF([test "$VAR_UPNPC_BINARY" = "false"],
2074 [AC_MSG_WARN([upnpc binary not found, NAT traversal using UPnPc will not work]) 2094 [upnpc_msg="no (optional, NAT traversal using UPnPc will not work)"],
2075 upnpc_msg="no (optional)"],
2076 [upnpc_msg="yes"]) 2095 [upnpc_msg="yes"])
2077# -- iptables 2096# -- iptables
2078AS_IF([test "$VAR_IPTABLES_BINARY" = "false"], 2097AS_IF([test "$VAR_IPTABLES_BINARY" = "false"],
2079 [AC_MSG_WARN([iptables not found, DNS query interception will not work]) 2098 [iptables_msg="no (optional, DNS query interception will not work)"],
2080 iptables_msg="no (optional)"],
2081 [iptables_msg="yes"]) 2099 [iptables_msg="yes"])
2082# -- bluetooth 2100# -- bluetooth
2083AS_IF([test "x$bluetooth" = "x0"], 2101AS_IF([test "x$bluetooth" = "x0"],
2084 [AC_MSG_NOTICE([bluetooth library not found, will not be able to use Bluetooth]) 2102 [bluetooth_msg="no (optional)"],
2085 bluetooth_msg="no (optional)"], 2103 [bluetooth_msg="yes"
2086 [bluetooth_msg="yes"]) 2104 transport_msg="$transport_msg bluetooth"])
2087# -- gnutls 2105# -- gnutls
2088AS_IF([test x$gnutls != xtrue], 2106AS_IF([test x$gnutls != xtrue],
2089 [AC_MSG_WARN([GnuTLS not found, gnunet-gns-proxy will not be built]) 2107 [AC_MSG_WARN([GnuTLS not found, gnunet-gns-proxy will not be built])
2090 gnutls_msg="no"], 2108 gnutls_msg="no (gnunet-gns-proxy will not be built)"],
2091 [AS_IF([test "x$gnutls_dane" != "x1"], 2109 [AS_IF([test "x$gnutls_dane" != "x1"],
2092 [AC_MSG_WARN([GnuTLS lacks DANE support, DANE validation will not be possible]) 2110 [AC_MSG_WARN([GnuTLS lacks DANE support, DANE validation will not be possible])
2093 gnutls_msg="yes (without DANE support)"], 2111 gnutls_msg="yes (without DANE support)"],
@@ -2123,8 +2141,8 @@ AC_SUBST(features_msg)
2123# TODO: reduce the length of the last message block, following "IMPORTANT". 2141# TODO: reduce the length of the last message block, following "IMPORTANT".
2124 2142
2125AC_MSG_NOTICE([ 2143AC_MSG_NOTICE([
2126GNUnet Configuration 2144Detected system
2127==================== 2145===============
2128 2146
2129GNUnet version: ${VERSION} 2147GNUnet version: ${VERSION}
2130 2148
@@ -2136,7 +2154,6 @@ CPPFLAGS: ${CPPFLAGS}
2136LDFLAGS: ${LDFLAGS} 2154LDFLAGS: ${LDFLAGS}
2137LIBS: ${LIBS} 2155LIBS: ${LIBS}
2138Build Target: $build_target 2156Build Target: $build_target
2139Mac OSX framework build: ${macosx_framework_msg}
2140 2157
2141Default Interface: ${interface_msg} 2158Default Interface: ${interface_msg}
2142 2159
@@ -2162,11 +2179,17 @@ libextractor: ${libextractor_msg}
2162texi2mdoc: ${texi2mdoc_msg} 2179texi2mdoc: ${texi2mdoc_msg}
2163mandoc: ${mandoc_msg} 2180mandoc: ${mandoc_msg}
2164 2181
2182GNUnet configuration:
2183=====================
2184transports: ${transport_msg}
2185reclaimID: ${reclaim_msg}
2186conversation: ${conversation_msg}
2187rest: ${rest_msg}
2188database backends: ${features_msg}
2189experimental: ${experimental_msg}
2190
2165texinfo manual: ${texinfo_msg} 2191texinfo manual: ${texinfo_msg}
2166transpiled mdocml manual: ${mdocml_msg} 2192transpiled mdocml manual: ${mdocml_msg}
2167
2168features: ${features_msg}
2169experimental: ${experimental_msg}
2170]) 2193])
2171 2194
2172AS_IF([test x$MSG_USER_SETUP != xfalse], 2195AS_IF([test x$MSG_USER_SETUP != xfalse],
diff --git a/contrib/scripts/gnunet-bugreport b/contrib/scripts/gnunet-bugreport
index 21808273a..4c12313df 100755
--- a/contrib/scripts/gnunet-bugreport
+++ b/contrib/scripts/gnunet-bugreport
@@ -1,4 +1,4 @@
1#!/usr/bin/env sh 1#!/bin/sh
2# 2#
3# Caveats: 3# Caveats:
4# - checks with textprocessing assuming that system language is English. 4# - checks with textprocessing assuming that system language is English.
diff --git a/doc/handbook/chapters/keyconcepts.texi b/doc/handbook/chapters/keyconcepts.texi
index d2646fb82..eb95dbf78 100644
--- a/doc/handbook/chapters/keyconcepts.texi
+++ b/doc/handbook/chapters/keyconcepts.texi
@@ -284,12 +284,7 @@ You can find your peer identity by running @command{gnunet-peerinfo -s}.
284@c FIXME: Explain or link to an explanation of the concept of public keys 284@c FIXME: Explain or link to an explanation of the concept of public keys
285@c and private keys. 285@c and private keys.
286@c FIXME: Rewrite for the latest GNS changes. 286@c FIXME: Rewrite for the latest GNS changes.
287GNS (Matthias Wachs, Martin Schanzenbach, and Christian Grothoff. 287GNS zones are similar to those of DNS zones, but instead of a hierarchy of
288A Censorship-Resistant, Privacy-Enhancing and Fully Decentralized Name
289System. In proceedings of 13th International Conference on Cryptology and
290Network Security (CANS 2014). 2014.
291@uref{https://git.gnunet.org/bibliography.git/plain/docs/gns2014wachs.pdf, https://git.gnunet.org/bibliography.git/plain/docs/gns2014wachs.pdf})
292zones are similar to those of DNS zones, but instead of a hierarchy of
293authorities to governing their use, GNS zones are controlled by a private 288authorities to governing their use, GNS zones are controlled by a private
294key. 289key.
295When you create a record in a DNS zone, that information is stored in your 290When you create a record in a DNS zone, that information is stored in your
@@ -309,6 +304,14 @@ the private key.
309And a user accessing a zone needs to somehow specify the corresponding 304And a user accessing a zone needs to somehow specify the corresponding
310public key first. 305public key first.
311 306
307For more information, refer to the following paper:
308
309Matthias Wachs, Martin Schanzenbach, and Christian Grothoff.
310A Censorship-Resistant, Privacy-Enhancing and Fully Decentralized Name
311System. In proceedings of 13th International Conference on Cryptology and
312Network Security (CANS 2014). 2014.
313@uref{https://git.gnunet.org/bibliography.git/plain/docs/gns2014wachs.pdf, https://git.gnunet.org/bibliography.git/plain/docs/gns2014wachs.pdf}
314
312@cindex Egos 315@cindex Egos
313@node Egos 316@node Egos
314@section Egos 317@section Egos
diff --git a/doc/index.html b/doc/index.html
index af7a72e22..827c04a71 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -26,7 +26,7 @@
26 26
27 <ul> 27 <ul>
28 <li><a href="/handbook/gnunet.html">GNUnet Reference Manual</li> 28 <li><a href="/handbook/gnunet.html">GNUnet Reference Manual</li>
29 <li><a href="/tutorial/tutorial.html">GNUnet C Tutorial</li> 29 <li><a href="/gnunet-tutorial/tutorial.html">GNUnet C Tutorial</li>
30 <li><a href="/doxygen/">GNUnet Doxygen</li> 30 <li><a href="/doxygen/">GNUnet Doxygen</li>
31 <li><a href="https://rest.gnunet.org/">REST API</a></li> 31 <li><a href="https://rest.gnunet.org/">REST API</a></li>
32 <li><a href="https://bib.gnunet.org/">Bibliography</a></li> 32 <li><a href="https://bib.gnunet.org/">Bibliography</a></li>
diff --git a/doc/man/gnunet-revocation.1 b/doc/man/gnunet-revocation.1
index 0c447a94f..05d80178a 100644
--- a/doc/man/gnunet-revocation.1
+++ b/doc/man/gnunet-revocation.1
@@ -30,6 +30,7 @@
30.Sh SYNOPSIS 30.Sh SYNOPSIS
31.Nm 31.Nm
32.Op Fl t Ar KEY | Fl -test= Ns Ar KEY 32.Op Fl t Ar KEY | Fl -test= Ns Ar KEY
33.Op Fl e Ar EPOCHS | Fl -epochs= Ns Ar EPOCHS
33.Op Fl R Ar NAME | Fl -revoke= Ns Ar NAME 34.Op Fl R Ar NAME | Fl -revoke= Ns Ar NAME
34.Op Fl p | -perform 35.Op Fl p | -perform
35.Op Fl f Ar NAME | Fl -filename= Ns Ar NAME 36.Op Fl f Ar NAME | Fl -filename= Ns Ar NAME
@@ -50,6 +51,8 @@ Depending on your CPU, the calculation can take days or weeks.
50.Bl -tag -width indent 51.Bl -tag -width indent
51.It Fl t Ar KEY | Fl -test= Ns Ar KEY 52.It Fl t Ar KEY | Fl -test= Ns Ar KEY
52Check if the given KEY (ASCII-encoded public key required) has been revoked. 53Check if the given KEY (ASCII-encoded public key required) has been revoked.
54.It Fl e Ar EPOCHS | Fl -epochs= Ns Ar EPOCHS
55Number of epochs for which the revocation should be valid (default: 1)
53.It Fl R Ar NAME | Fl -revoke= Ns Ar NAME 56.It Fl R Ar NAME | Fl -revoke= Ns Ar NAME
54Calculate or perform revocation for the ego with the given NAME. 57Calculate or perform revocation for the ego with the given NAME.
55.It Fl p | -perform 58.It Fl p | -perform
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 441d0f91d..f38c81f49 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -10,21 +10,13 @@ src/arm/arm_monitor_api.c
10src/arm/gnunet-arm.c 10src/arm/gnunet-arm.c
11src/arm/gnunet-service-arm.c 11src/arm/gnunet-service-arm.c
12src/arm/mockup-service.c 12src/arm/mockup-service.c
13src/ats-tests/ats-testing-experiment.c
14src/ats-tests/ats-testing-log.c
15src/ats-tests/ats-testing-preferences.c
16src/ats-tests/ats-testing-traffic.c
17src/ats-tests/ats-testing.c
18src/ats-tests/gnunet-ats-sim.c
19src/ats-tests/gnunet-solver-eval.c
20src/ats-tool/gnunet-ats.c
21src/ats/ats_api_connectivity.c 13src/ats/ats_api_connectivity.c
22src/ats/ats_api_performance.c 14src/ats/ats_api_performance.c
23src/ats/ats_api_scanner.c 15src/ats/ats_api_scanner.c
24src/ats/ats_api_scheduling.c 16src/ats/ats_api_scheduling.c
25src/ats/gnunet-ats-solver-eval.c 17src/ats/gnunet-ats-solver-eval.c
26src/ats/gnunet-service-ats.c
27src/ats/gnunet-service-ats_addresses.c 18src/ats/gnunet-service-ats_addresses.c
19src/ats/gnunet-service-ats.c
28src/ats/gnunet-service-ats_connectivity.c 20src/ats/gnunet-service-ats_connectivity.c
29src/ats/gnunet-service-ats_normalization.c 21src/ats/gnunet-service-ats_normalization.c
30src/ats/gnunet-service-ats_performance.c 22src/ats/gnunet-service-ats_performance.c
@@ -33,6 +25,14 @@ src/ats/gnunet-service-ats_preferences.c
33src/ats/gnunet-service-ats_reservations.c 25src/ats/gnunet-service-ats_reservations.c
34src/ats/gnunet-service-ats_scheduling.c 26src/ats/gnunet-service-ats_scheduling.c
35src/ats/plugin_ats_proportional.c 27src/ats/plugin_ats_proportional.c
28src/ats-tests/ats-testing.c
29src/ats-tests/ats-testing-experiment.c
30src/ats-tests/ats-testing-log.c
31src/ats-tests/ats-testing-preferences.c
32src/ats-tests/ats-testing-traffic.c
33src/ats-tests/gnunet-ats-sim.c
34src/ats-tests/gnunet-solver-eval.c
35src/ats-tool/gnunet-ats.c
36src/auction/gnunet-auction-create.c 36src/auction/gnunet-auction-create.c
37src/auction/gnunet-auction-info.c 37src/auction/gnunet-auction-info.c
38src/auction/gnunet-auction-join.c 38src/auction/gnunet-auction-join.c
@@ -49,8 +49,8 @@ src/cadet/cadet_api_list_peers.c
49src/cadet/cadet_api_list_tunnels.c 49src/cadet/cadet_api_list_tunnels.c
50src/cadet/cadet_test_lib.c 50src/cadet/cadet_test_lib.c
51src/cadet/desirability_table.c 51src/cadet/desirability_table.c
52src/cadet/gnunet-cadet-profiler.c
53src/cadet/gnunet-cadet.c 52src/cadet/gnunet-cadet.c
53src/cadet/gnunet-cadet-profiler.c
54src/cadet/gnunet-service-cadet.c 54src/cadet/gnunet-service-cadet.c
55src/cadet/gnunet-service-cadet_channel.c 55src/cadet/gnunet-service-cadet_channel.c
56src/cadet/gnunet-service-cadet_connection.c 56src/cadet/gnunet-service-cadet_connection.c
@@ -66,15 +66,15 @@ src/consensus/gnunet-service-consensus.c
66src/consensus/plugin_block_consensus.c 66src/consensus/plugin_block_consensus.c
67src/conversation/conversation_api.c 67src/conversation/conversation_api.c
68src/conversation/conversation_api_call.c 68src/conversation/conversation_api_call.c
69src/conversation/gnunet-conversation-test.c
70src/conversation/gnunet-conversation.c 69src/conversation/gnunet-conversation.c
71src/conversation/gnunet-helper-audio-playback-gst.c 70src/conversation/gnunet-conversation-test.c
71src/conversation/gnunet_gst.c
72src/conversation/gnunet_gst_test.c
72src/conversation/gnunet-helper-audio-playback.c 73src/conversation/gnunet-helper-audio-playback.c
73src/conversation/gnunet-helper-audio-record-gst.c 74src/conversation/gnunet-helper-audio-playback-gst.c
74src/conversation/gnunet-helper-audio-record.c 75src/conversation/gnunet-helper-audio-record.c
76src/conversation/gnunet-helper-audio-record-gst.c
75src/conversation/gnunet-service-conversation.c 77src/conversation/gnunet-service-conversation.c
76src/conversation/gnunet_gst.c
77src/conversation/gnunet_gst_test.c
78src/conversation/microphone.c 78src/conversation/microphone.c
79src/conversation/plugin_gnsrecord_conversation.c 79src/conversation/plugin_gnsrecord_conversation.c
80src/conversation/speaker.c 80src/conversation/speaker.c
@@ -104,6 +104,7 @@ src/dht/dht_api.c
104src/dht/dht_test_lib.c 104src/dht/dht_test_lib.c
105src/dht/gnunet-dht-get.c 105src/dht/gnunet-dht-get.c
106src/dht/gnunet-dht-monitor.c 106src/dht/gnunet-dht-monitor.c
107src/dht/gnunet_dht_profiler.c
107src/dht/gnunet-dht-put.c 108src/dht/gnunet-dht-put.c
108src/dht/gnunet-service-dht.c 109src/dht/gnunet-service-dht.c
109src/dht/gnunet-service-dht_clients.c 110src/dht/gnunet-service-dht_clients.c
@@ -112,7 +113,6 @@ src/dht/gnunet-service-dht_hello.c
112src/dht/gnunet-service-dht_neighbours.c 113src/dht/gnunet-service-dht_neighbours.c
113src/dht/gnunet-service-dht_nse.c 114src/dht/gnunet-service-dht_nse.c
114src/dht/gnunet-service-dht_routing.c 115src/dht/gnunet-service-dht_routing.c
115src/dht/gnunet_dht_profiler.c
116src/dht/plugin_block_dht.c 116src/dht/plugin_block_dht.c
117src/dns/dns_api.c 117src/dns/dns_api.c
118src/dns/gnunet-dns-monitor.c 118src/dns/gnunet-dns-monitor.c
@@ -147,8 +147,8 @@ src/fs/gnunet-auto-share.c
147src/fs/gnunet-daemon-fsprofiler.c 147src/fs/gnunet-daemon-fsprofiler.c
148src/fs/gnunet-directory.c 148src/fs/gnunet-directory.c
149src/fs/gnunet-download.c 149src/fs/gnunet-download.c
150src/fs/gnunet-fs-profiler.c
151src/fs/gnunet-fs.c 150src/fs/gnunet-fs.c
151src/fs/gnunet-fs-profiler.c
152src/fs/gnunet-helper-fs-publish.c 152src/fs/gnunet-helper-fs-publish.c
153src/fs/gnunet-publish.c 153src/fs/gnunet-publish.c
154src/fs/gnunet-search.c 154src/fs/gnunet-search.c
@@ -168,9 +168,9 @@ src/gns/gns_tld_api.c
168src/gns/gnunet-bcd.c 168src/gns/gnunet-bcd.c
169src/gns/gnunet-dns2gns.c 169src/gns/gnunet-dns2gns.c
170src/gns/gnunet-gns-benchmark.c 170src/gns/gnunet-gns-benchmark.c
171src/gns/gnunet-gns.c
171src/gns/gnunet-gns-import.c 172src/gns/gnunet-gns-import.c
172src/gns/gnunet-gns-proxy.c 173src/gns/gnunet-gns-proxy.c
173src/gns/gnunet-gns.c
174src/gns/gnunet-service-gns.c 174src/gns/gnunet-service-gns.c
175src/gns/gnunet-service-gns_interceptor.c 175src/gns/gnunet-service-gns_interceptor.c
176src/gns/gnunet-service-gns_resolver.c 176src/gns/gnunet-service-gns_resolver.c
@@ -186,8 +186,8 @@ src/gnsrecord/gnsrecord_serialization.c
186src/gnsrecord/plugin_gnsrecord_dns.c 186src/gnsrecord/plugin_gnsrecord_dns.c
187src/hello/address.c 187src/hello/address.c
188src/hello/gnunet-hello.c 188src/hello/gnunet-hello.c
189src/hello/hello-ng.c
190src/hello/hello.c 189src/hello/hello.c
190src/hello/hello-ng.c
191src/hostlist/gnunet-daemon-hostlist.c 191src/hostlist/gnunet-daemon-hostlist.c
192src/hostlist/gnunet-daemon-hostlist_client.c 192src/hostlist/gnunet-daemon-hostlist_client.c
193src/hostlist/gnunet-daemon-hostlist_server.c 193src/hostlist/gnunet-daemon-hostlist_server.c
@@ -212,8 +212,8 @@ src/namecache/namecache_api.c
212src/namecache/plugin_namecache_flat.c 212src/namecache/plugin_namecache_flat.c
213src/namecache/plugin_namecache_postgres.c 213src/namecache/plugin_namecache_postgres.c
214src/namecache/plugin_namecache_sqlite.c 214src/namecache/plugin_namecache_sqlite.c
215src/namestore/gnunet-namestore-fcfsd.c
216src/namestore/gnunet-namestore.c 215src/namestore/gnunet-namestore.c
216src/namestore/gnunet-namestore-fcfsd.c
217src/namestore/gnunet-service-namestore.c 217src/namestore/gnunet-service-namestore.c
218src/namestore/gnunet-zoneimport.c 218src/namestore/gnunet-zoneimport.c
219src/namestore/namestore_api.c 219src/namestore/namestore_api.c
@@ -239,17 +239,17 @@ src/nat/gnunet-service-nat_mini.c
239src/nat/gnunet-service-nat_stun.c 239src/nat/gnunet-service-nat_stun.c
240src/nat/nat_api.c 240src/nat/nat_api.c
241src/nat/nat_api_stun.c 241src/nat/nat_api_stun.c
242src/nse/gnunet-nse-profiler.c
243src/nse/gnunet-nse.c 242src/nse/gnunet-nse.c
243src/nse/gnunet-nse-profiler.c
244src/nse/gnunet-service-nse.c 244src/nse/gnunet-service-nse.c
245src/nse/nse_api.c 245src/nse/nse_api.c
246src/nt/nt.c 246src/nt/nt.c
247src/peerinfo-tool/gnunet-peerinfo.c
248src/peerinfo-tool/gnunet-peerinfo_plugins.c
249src/peerinfo-tool/plugin_rest_peerinfo.c
250src/peerinfo/gnunet-service-peerinfo.c 247src/peerinfo/gnunet-service-peerinfo.c
251src/peerinfo/peerinfo_api.c 248src/peerinfo/peerinfo_api.c
252src/peerinfo/peerinfo_api_notify.c 249src/peerinfo/peerinfo_api_notify.c
250src/peerinfo-tool/gnunet-peerinfo.c
251src/peerinfo-tool/gnunet-peerinfo_plugins.c
252src/peerinfo-tool/plugin_rest_peerinfo.c
253src/peerstore/gnunet-peerstore.c 253src/peerstore/gnunet-peerstore.c
254src/peerstore/gnunet-service-peerstore.c 254src/peerstore/gnunet-service-peerstore.c
255src/peerstore/peerstore_api.c 255src/peerstore/peerstore_api.c
@@ -264,17 +264,19 @@ src/pq/pq_prepare.c
264src/pq/pq_query_helper.c 264src/pq/pq_query_helper.c
265src/pq/pq_result_helper.c 265src/pq/pq_result_helper.c
266src/pt/gnunet-daemon-pt.c 266src/pt/gnunet-daemon-pt.c
267src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c
268src/reclaim-attribute/reclaim_attribute.c
269src/reclaim/gnunet-reclaim.c 267src/reclaim/gnunet-reclaim.c
270src/reclaim/gnunet-service-reclaim.c 268src/reclaim/gnunet-service-reclaim.c
271src/reclaim/gnunet-service-reclaim_tickets.c 269src/reclaim/gnunet-service-reclaim_tickets.c
272src/reclaim/json_reclaim.c 270src/reclaim/json_reclaim.c
273src/reclaim/oidc_helper.c 271src/reclaim/oidc_helper.c
274src/reclaim/plugin_gnsrecord_reclaim.c 272src/reclaim/plugin_gnsrecord_reclaim.c
273src/reclaim/plugin_reclaim_attestation_jwt.c
274src/reclaim/plugin_reclaim_attribute_basic.c
275src/reclaim/plugin_rest_openid_connect.c 275src/reclaim/plugin_rest_openid_connect.c
276src/reclaim/plugin_rest_reclaim.c 276src/reclaim/plugin_rest_reclaim.c
277src/reclaim/reclaim_api.c 277src/reclaim/reclaim_api.c
278src/reclaim/reclaim_attestation.c
279src/reclaim/reclaim_attribute.c
278src/regex/gnunet-daemon-regexprofiler.c 280src/regex/gnunet-daemon-regexprofiler.c
279src/regex/gnunet-regex-profiler.c 281src/regex/gnunet-regex-profiler.c
280src/regex/gnunet-regex-simulation-profiler.c 282src/regex/gnunet-regex-simulation-profiler.c
@@ -297,22 +299,22 @@ src/revocation/gnunet-revocation.c
297src/revocation/gnunet-service-revocation.c 299src/revocation/gnunet-service-revocation.c
298src/revocation/plugin_block_revocation.c 300src/revocation/plugin_block_revocation.c
299src/revocation/revocation_api.c 301src/revocation/revocation_api.c
300src/rps/gnunet-rps-profiler.c
301src/rps/gnunet-rps.c 302src/rps/gnunet-rps.c
303src/rps/gnunet-rps-profiler.c
302src/rps/gnunet-service-rps.c 304src/rps/gnunet-service-rps.c
303src/rps/gnunet-service-rps_custommap.c 305src/rps/gnunet-service-rps_custommap.c
304src/rps/gnunet-service-rps_sampler.c 306src/rps/gnunet-service-rps_sampler.c
305src/rps/gnunet-service-rps_sampler_elem.c 307src/rps/gnunet-service-rps_sampler_elem.c
306src/rps/gnunet-service-rps_view.c 308src/rps/gnunet-service-rps_view.c
309src/rps/rps_api.c
307src/rps/rps-sampler_client.c 310src/rps/rps-sampler_client.c
308src/rps/rps-sampler_common.c 311src/rps/rps-sampler_common.c
309src/rps/rps-test_util.c 312src/rps/rps-test_util.c
310src/rps/rps_api.c
311src/scalarproduct/gnunet-scalarproduct.c 313src/scalarproduct/gnunet-scalarproduct.c
312src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
313src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
314src/scalarproduct/gnunet-service-scalarproduct_alice.c 314src/scalarproduct/gnunet-service-scalarproduct_alice.c
315src/scalarproduct/gnunet-service-scalarproduct_bob.c 315src/scalarproduct/gnunet-service-scalarproduct_bob.c
316src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
317src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
316src/scalarproduct/scalarproduct_api.c 318src/scalarproduct/scalarproduct_api.c
317src/secretsharing/gnunet-secretsharing-profiler.c 319src/secretsharing/gnunet-secretsharing-profiler.c
318src/secretsharing/gnunet-service-secretsharing.c 320src/secretsharing/gnunet-service-secretsharing.c
@@ -338,16 +340,15 @@ src/statistics/gnunet-statistics.c
338src/statistics/statistics_api.c 340src/statistics/statistics_api.c
339src/template/gnunet-service-template.c 341src/template/gnunet-service-template.c
340src/template/gnunet-template.c 342src/template/gnunet-template.c
341src/testbed-logger/gnunet-service-testbed-logger.c
342src/testbed-logger/testbed_logger_api.c
343src/testbed/generate-underlay-topology.c 343src/testbed/generate-underlay-topology.c
344src/testbed/gnunet-daemon-latency-logger.c 344src/testbed/gnunet-daemon-latency-logger.c
345src/testbed/gnunet-daemon-testbed-blacklist.c 345src/testbed/gnunet-daemon-testbed-blacklist.c
346src/testbed/gnunet-daemon-testbed-underlay.c 346src/testbed/gnunet-daemon-testbed-underlay.c
347src/testbed/gnunet-helper-testbed.c 347src/testbed/gnunet-helper-testbed.c
348src/testbed/gnunet_mpi_test.c
348src/testbed/gnunet-service-test-barriers.c 349src/testbed/gnunet-service-test-barriers.c
349src/testbed/gnunet-service-testbed.c
350src/testbed/gnunet-service-testbed_barriers.c 350src/testbed/gnunet-service-testbed_barriers.c
351src/testbed/gnunet-service-testbed.c
351src/testbed/gnunet-service-testbed_cache.c 352src/testbed/gnunet-service-testbed_cache.c
352src/testbed/gnunet-service-testbed_connectionpool.c 353src/testbed/gnunet-service-testbed_connectionpool.c
353src/testbed/gnunet-service-testbed_cpustatus.c 354src/testbed/gnunet-service-testbed_cpustatus.c
@@ -355,19 +356,20 @@ src/testbed/gnunet-service-testbed_links.c
355src/testbed/gnunet-service-testbed_meminfo.c 356src/testbed/gnunet-service-testbed_meminfo.c
356src/testbed/gnunet-service-testbed_oc.c 357src/testbed/gnunet-service-testbed_oc.c
357src/testbed/gnunet-service-testbed_peers.c 358src/testbed/gnunet-service-testbed_peers.c
358src/testbed/gnunet-testbed-profiler.c
359src/testbed/gnunet_mpi_test.c
360src/testbed/gnunet_testbed_mpi_spawn.c 359src/testbed/gnunet_testbed_mpi_spawn.c
361src/testbed/testbed_api.c 360src/testbed/gnunet-testbed-profiler.c
361src/testbed-logger/gnunet-service-testbed-logger.c
362src/testbed-logger/testbed_logger_api.c
362src/testbed/testbed_api_barriers.c 363src/testbed/testbed_api_barriers.c
364src/testbed/testbed_api.c
363src/testbed/testbed_api_hosts.c 365src/testbed/testbed_api_hosts.c
364src/testbed/testbed_api_operations.c 366src/testbed/testbed_api_operations.c
365src/testbed/testbed_api_peers.c 367src/testbed/testbed_api_peers.c
366src/testbed/testbed_api_sd.c 368src/testbed/testbed_api_sd.c
367src/testbed/testbed_api_services.c 369src/testbed/testbed_api_services.c
368src/testbed/testbed_api_statistics.c 370src/testbed/testbed_api_statistics.c
369src/testbed/testbed_api_test.c
370src/testbed/testbed_api_testbed.c 371src/testbed/testbed_api_testbed.c
372src/testbed/testbed_api_test.c
371src/testbed/testbed_api_topology.c 373src/testbed/testbed_api_topology.c
372src/testbed/testbed_api_underlay.c 374src/testbed/testbed_api_underlay.c
373src/testing/gnunet-testing.c 375src/testing/gnunet-testing.c
@@ -379,40 +381,34 @@ src/transport/gnunet-communicator-tcp.c
379src/transport/gnunet-communicator-udp.c 381src/transport/gnunet-communicator-udp.c
380src/transport/gnunet-communicator-unix.c 382src/transport/gnunet-communicator-unix.c
381src/transport/gnunet-helper-transport-bluetooth.c 383src/transport/gnunet-helper-transport-bluetooth.c
382src/transport/gnunet-helper-transport-wlan-dummy.c
383src/transport/gnunet-helper-transport-wlan.c 384src/transport/gnunet-helper-transport-wlan.c
385src/transport/gnunet-helper-transport-wlan-dummy.c
384src/transport/gnunet-service-tng.c 386src/transport/gnunet-service-tng.c
385src/transport/gnunet-service-transport.c
386src/transport/gnunet-service-transport_ats.c 387src/transport/gnunet-service-transport_ats.c
388src/transport/gnunet-service-transport.c
387src/transport/gnunet-service-transport_hello.c 389src/transport/gnunet-service-transport_hello.c
388src/transport/gnunet-service-transport_manipulation.c 390src/transport/gnunet-service-transport_manipulation.c
389src/transport/gnunet-service-transport_neighbours.c 391src/transport/gnunet-service-transport_neighbours.c
390src/transport/gnunet-service-transport_plugins.c 392src/transport/gnunet-service-transport_plugins.c
391src/transport/gnunet-service-transport_validation.c 393src/transport/gnunet-service-transport_validation.c
394src/transport/gnunet-transport.c
392src/transport/gnunet-transport-profiler.c 395src/transport/gnunet-transport-profiler.c
393src/transport/gnunet-transport-wlan-receiver.c 396src/transport/gnunet-transport-wlan-receiver.c
394src/transport/gnunet-transport-wlan-sender.c 397src/transport/gnunet-transport-wlan-sender.c
395src/transport/gnunet-transport.c
396src/transport/plugin_transport_http_client.c 398src/transport/plugin_transport_http_client.c
397src/transport/plugin_transport_http_common.c 399src/transport/plugin_transport_http_common.c
398src/transport/plugin_transport_http_server.c 400src/transport/plugin_transport_http_server.c
399src/transport/plugin_transport_smtp.c 401src/transport/plugin_transport_smtp.c
400src/transport/plugin_transport_tcp.c 402src/transport/plugin_transport_tcp.c
401src/transport/plugin_transport_template.c 403src/transport/plugin_transport_template.c
402src/transport/plugin_transport_udp.c
403src/transport/plugin_transport_udp_broadcasting.c 404src/transport/plugin_transport_udp_broadcasting.c
405src/transport/plugin_transport_udp.c
404src/transport/plugin_transport_unix.c 406src/transport/plugin_transport_unix.c
405src/transport/plugin_transport_wlan.c 407src/transport/plugin_transport_wlan.c
406src/transport/tcp_connection_legacy.c 408src/transport/tcp_connection_legacy.c
407src/transport/tcp_server_legacy.c 409src/transport/tcp_server_legacy.c
408src/transport/tcp_server_mst_legacy.c 410src/transport/tcp_server_mst_legacy.c
409src/transport/tcp_service_legacy.c 411src/transport/tcp_service_legacy.c
410src/transport/transport-testing-filenames.c
411src/transport/transport-testing-loggers.c
412src/transport/transport-testing-main.c
413src/transport/transport-testing-send.c
414src/transport/transport-testing.c
415src/transport/transport-testing2.c
416src/transport/transport_api2_application.c 412src/transport/transport_api2_application.c
417src/transport/transport_api2_communication.c 413src/transport/transport_api2_communication.c
418src/transport/transport_api2_core.c 414src/transport/transport_api2_core.c
@@ -425,20 +421,28 @@ src/transport/transport_api_manipulation.c
425src/transport/transport_api_monitor_peers.c 421src/transport/transport_api_monitor_peers.c
426src/transport/transport_api_monitor_plugins.c 422src/transport/transport_api_monitor_plugins.c
427src/transport/transport_api_offer_hello.c 423src/transport/transport_api_offer_hello.c
424src/transport/transport-testing2.c
425src/transport/transport-testing.c
426src/transport/transport-testing-filenames.c
427src/transport/transport-testing-loggers.c
428src/transport/transport-testing-main.c
429src/transport/transport-testing-send.c
428src/util/bandwidth.c 430src/util/bandwidth.c
429src/util/benchmark.c 431src/util/benchmark.c
430src/util/bio.c 432src/util/bio.c
433src/util/buffer.c
431src/util/client.c 434src/util/client.c
432src/util/common_allocation.c 435src/util/common_allocation.c
433src/util/common_endian.c 436src/util/common_endian.c
434src/util/common_logging.c 437src/util/common_logging.c
435src/util/configuration.c 438src/util/configuration.c
436src/util/configuration_loader.c 439src/util/configuration_loader.c
440src/util/consttime_memcmp.c
437src/util/container_bloomfilter.c 441src/util/container_bloomfilter.c
438src/util/container_heap.c 442src/util/container_heap.c
439src/util/container_meta_data.c 443src/util/container_meta_data.c
440src/util/container_multihashmap.c
441src/util/container_multihashmap32.c 444src/util/container_multihashmap32.c
445src/util/container_multihashmap.c
442src/util/container_multipeermap.c 446src/util/container_multipeermap.c
443src/util/container_multishortmap.c 447src/util/container_multishortmap.c
444src/util/container_multiuuidmap.c 448src/util/container_multiuuidmap.c
@@ -462,8 +466,9 @@ src/util/dnsparser.c
462src/util/dnsstub.c 466src/util/dnsstub.c
463src/util/getopt.c 467src/util/getopt.c
464src/util/getopt_helpers.c 468src/util/getopt_helpers.c
465src/util/gnunet-config-diff.c
466src/util/gnunet-config.c 469src/util/gnunet-config.c
470src/util/gnunet-config-diff.c
471src/util/gnunet-crypto-tvg.c
467src/util/gnunet-ecc.c 472src/util/gnunet-ecc.c
468src/util/gnunet-qr.c 473src/util/gnunet-qr.c
469src/util/gnunet-resolver.c 474src/util/gnunet-resolver.c
@@ -495,13 +500,12 @@ src/util/speedup.c
495src/util/strings.c 500src/util/strings.c
496src/util/time.c 501src/util/time.c
497src/util/tun.c 502src/util/tun.c
498src/util/tweetnacl-gnunet.c
499src/vpn/gnunet-helper-vpn.c 503src/vpn/gnunet-helper-vpn.c
500src/vpn/gnunet-service-vpn.c 504src/vpn/gnunet-service-vpn.c
501src/vpn/gnunet-vpn.c 505src/vpn/gnunet-vpn.c
502src/vpn/vpn_api.c 506src/vpn/vpn_api.c
503src/zonemaster/gnunet-service-zonemaster-monitor.c
504src/zonemaster/gnunet-service-zonemaster.c 507src/zonemaster/gnunet-service-zonemaster.c
508src/zonemaster/gnunet-service-zonemaster-monitor.c
505src/fs/fs_api.h 509src/fs/fs_api.h
506src/testbed/testbed_api.h 510src/testbed/testbed_api.h
507src/testbed/testbed_api_operations.h 511src/testbed/testbed_api_operations.h
diff --git a/po/de.po b/po/de.po
index 216f67f68..0257436d6 100644
--- a/po/de.po
+++ b/po/de.po
@@ -10,7 +10,7 @@ msgid ""
10msgstr "" 10msgstr ""
11"Project-Id-Version: gnunet 0.10.1\n" 11"Project-Id-Version: gnunet 0.10.1\n"
12"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 12"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
13"POT-Creation-Date: 2020-01-13 14:01+0000\n" 13"POT-Creation-Date: 2020-02-13 20:41+0100\n"
14"PO-Revision-Date: 2015-03-08 16:16+0100\n" 14"PO-Revision-Date: 2015-03-08 16:16+0100\n"
15"Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n" 15"Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n"
16"Language-Team: German <translation-team-de@lists.sourceforge.net>\n" 16"Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
@@ -32,8 +32,8 @@ msgid "Issuer public key `%s' is not well-formed\n"
32msgstr "" 32msgstr ""
33 33
34#: src/abd/gnunet-abd.c:558 src/abd/gnunet-service-abd.c:1747 34#: src/abd/gnunet-abd.c:558 src/abd/gnunet-service-abd.c:1747
35#: src/namestore/gnunet-namestore-fcfsd.c:1153
36#: src/namestore/gnunet-namestore.c:1001 35#: src/namestore/gnunet-namestore.c:1001
36#: src/namestore/gnunet-namestore-fcfsd.c:1153
37#, fuzzy, c-format 37#, fuzzy, c-format
38msgid "Failed to connect to namestore\n" 38msgid "Failed to connect to namestore\n"
39msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" 39msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
@@ -143,7 +143,7 @@ msgstr ""
143msgid "GNUnet abd resolver tool" 143msgid "GNUnet abd resolver tool"
144msgstr "GNUnet Netzwerk Topologie tracen." 144msgstr "GNUnet Netzwerk Topologie tracen."
145 145
146#: src/abd/gnunet-service-abd.c:1742 src/gns/gnunet-gns.c:288 146#: src/abd/gnunet-service-abd.c:1742 src/gns/gnunet-gns.c:292
147#, fuzzy, c-format 147#, fuzzy, c-format
148msgid "Failed to connect to GNS\n" 148msgid "Failed to connect to GNS\n"
149msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" 149msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
@@ -383,28 +383,28 @@ msgstr ""
383#: src/transport/plugin_transport_tcp.c:1129 383#: src/transport/plugin_transport_tcp.c:1129
384#: src/transport/plugin_transport_tcp.c:3706 384#: src/transport/plugin_transport_tcp.c:3706
385#: src/transport/tcp_service_legacy.c:594 385#: src/transport/tcp_service_legacy.c:594
386#: src/transport/tcp_service_legacy.c:600 src/util/service.c:1094 386#: src/transport/tcp_service_legacy.c:600 src/util/service.c:1091
387#: src/util/service.c:1100 387#: src/util/service.c:1097
388#, c-format 388#, c-format
389msgid "Require valid port number for service `%s' in configuration!\n" 389msgid "Require valid port number for service `%s' in configuration!\n"
390msgstr "" 390msgstr ""
391 391
392#: src/arm/gnunet-service-arm.c:452 src/transport/plugin_transport_tcp.c:1163 392#: src/arm/gnunet-service-arm.c:452 src/transport/plugin_transport_tcp.c:1163
393#: src/transport/tcp_service_legacy.c:634 src/util/client.c:519 393#: src/transport/tcp_service_legacy.c:634 src/util/client.c:527
394#: src/util/service.c:1133 394#: src/util/service.c:1130
395#, c-format 395#, c-format
396msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 396msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
397msgstr "" 397msgstr ""
398 398
399#: src/arm/gnunet-service-arm.c:456 src/transport/plugin_transport_tcp.c:1167 399#: src/arm/gnunet-service-arm.c:456 src/transport/plugin_transport_tcp.c:1167
400#: src/transport/tcp_service_legacy.c:638 src/util/client.c:524 400#: src/transport/tcp_service_legacy.c:638 src/util/client.c:532
401#: src/util/service.c:1137 401#: src/util/service.c:1134
402#, c-format 402#, c-format
403msgid "Using `%s' instead\n" 403msgid "Using `%s' instead\n"
404msgstr "" 404msgstr ""
405 405
406#: src/arm/gnunet-service-arm.c:484 src/transport/plugin_transport_tcp.c:1195 406#: src/arm/gnunet-service-arm.c:484 src/transport/plugin_transport_tcp.c:1195
407#: src/transport/tcp_service_legacy.c:666 src/util/service.c:1157 407#: src/transport/tcp_service_legacy.c:666 src/util/service.c:1154
408#, c-format 408#, c-format
409msgid "" 409msgid ""
410"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 410"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
@@ -412,7 +412,7 @@ msgid ""
412msgstr "" 412msgstr ""
413 413
414#: src/arm/gnunet-service-arm.c:505 src/transport/plugin_transport_tcp.c:1213 414#: src/arm/gnunet-service-arm.c:505 src/transport/plugin_transport_tcp.c:1213
415#: src/transport/tcp_service_legacy.c:684 src/util/service.c:1175 415#: src/transport/tcp_service_legacy.c:684 src/util/service.c:1172
416#, c-format 416#, c-format
417msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 417msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
418msgstr "" 418msgstr ""
@@ -420,7 +420,7 @@ msgstr ""
420#: src/arm/gnunet-service-arm.c:536 420#: src/arm/gnunet-service-arm.c:536
421#: src/transport/plugin_transport_http_server.c:2718 421#: src/transport/plugin_transport_http_server.c:2718
422#: src/transport/plugin_transport_tcp.c:1244 422#: src/transport/plugin_transport_tcp.c:1244
423#: src/transport/tcp_service_legacy.c:715 src/util/service.c:1206 423#: src/transport/tcp_service_legacy.c:715 src/util/service.c:1203
424#, c-format 424#, c-format
425msgid "Failed to resolve `%s': %s\n" 425msgid "Failed to resolve `%s': %s\n"
426msgstr "»%s« konnte nicht aufgelöst werden: %s\n" 426msgstr "»%s« konnte nicht aufgelöst werden: %s\n"
@@ -428,7 +428,7 @@ msgstr "»%s« konnte nicht aufgelöst werden: %s\n"
428#: src/arm/gnunet-service-arm.c:555 428#: src/arm/gnunet-service-arm.c:555
429#: src/transport/plugin_transport_http_server.c:2736 429#: src/transport/plugin_transport_http_server.c:2736
430#: src/transport/plugin_transport_tcp.c:1263 430#: src/transport/plugin_transport_tcp.c:1263
431#: src/transport/tcp_service_legacy.c:734 src/util/service.c:1225 431#: src/transport/tcp_service_legacy.c:734 src/util/service.c:1222
432#, fuzzy, c-format 432#, fuzzy, c-format
433msgid "Failed to find %saddress for `%s'.\n" 433msgid "Failed to find %saddress for `%s'.\n"
434msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" 434msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n"
@@ -499,14 +499,81 @@ msgstr ""
499msgid "Initiating shutdown as requested by client.\n" 499msgid "Initiating shutdown as requested by client.\n"
500msgstr "" 500msgstr ""
501 501
502#: src/ats-tests/ats-testing-log.c:896 502#: src/ats/gnunet-ats-solver-eval.c:2992 src/ats/gnunet-ats-solver-eval.c:3044
503msgid "Stop logging\n" 503#, c-format
504msgstr "Protokollierung stoppen\n" 504msgid ""
505"Could not load quota for network `%s': `%s', assigning default bandwidth "
506"%llu\n"
507msgstr ""
505 508
506#: src/ats-tests/ats-testing-log.c:952 509#: src/ats/gnunet-ats-solver-eval.c:3011
510#, c-format
511msgid ""
512"No outbound quota configured for network `%s', assigning default bandwidth "
513"%llu\n"
514msgstr ""
515
516#: src/ats/gnunet-ats-solver-eval.c:3063
517#, c-format
518msgid ""
519"No outbound quota configure for network `%s', assigning default bandwidth "
520"%llu\n"
521msgstr ""
522
523#: src/ats/gnunet-ats-solver-eval.c:3552 src/ats-tests/gnunet-solver-eval.c:997
524msgid "solver to use"
525msgstr ""
526
527#: src/ats/gnunet-ats-solver-eval.c:3557
528#: src/ats-tests/gnunet-solver-eval.c:1003
529#: src/ats-tests/gnunet-solver-eval.c:1008
530msgid "experiment to use"
531msgstr ""
532
533#: src/ats/gnunet-ats-solver-eval.c:3564
534msgid "print logging"
535msgstr ""
536
537#: src/ats/gnunet-ats-solver-eval.c:3569
538msgid "save logging to disk"
539msgstr ""
540
541#: src/ats/gnunet-ats-solver-eval.c:3574
542msgid "disable normalization"
543msgstr ""
544
545#: src/ats/gnunet-service-ats_plugins.c:326
546#, c-format
547msgid ""
548"Could not load %s quota for network `%s': `%s', assigning default bandwidth "
549"%llu\n"
550msgstr ""
551
552#: src/ats/gnunet-service-ats_plugins.c:336
553#, c-format
554msgid "%s quota configured for network `%s' is %llu\n"
555msgstr ""
556
557#: src/ats/gnunet-service-ats_plugins.c:382
558#, c-format
559msgid ""
560"No %s-quota configured for network `%s', assigning default bandwidth %llu\n"
561msgstr ""
562
563#: src/ats/gnunet-service-ats_plugins.c:474
507#, fuzzy, c-format 564#, fuzzy, c-format
508msgid "Start logging `%s'\n" 565msgid "Failed to initialize solver `%s'!\n"
509msgstr "Collection `%s' begonnen.\n" 566msgstr "SQLite Datenbank konnte nicht initialisiert werden.\n"
567
568#: src/ats/plugin_ats_proportional.c:1140
569#, fuzzy, c-format
570msgid "Invalid %s configuration %f \n"
571msgstr "Konfiguration konnte nicht aus %s geladen werden\n"
572
573#: src/ats/plugin_ats_proportional.c:1163
574#, fuzzy, c-format
575msgid "Invalid %s configuration %f\n"
576msgstr " gconfig\tGTK Konfiguration\n"
510 577
511#: src/ats-tests/ats-testing.c:420 578#: src/ats-tests/ats-testing.c:420
512#, c-format 579#, c-format
@@ -518,6 +585,15 @@ msgstr ""
518msgid "Failed to connect master peer [%u] with slave [%u]\n" 585msgid "Failed to connect master peer [%u] with slave [%u]\n"
519msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" 586msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
520 587
588#: src/ats-tests/ats-testing-log.c:896
589msgid "Stop logging\n"
590msgstr "Protokollierung stoppen\n"
591
592#: src/ats-tests/ats-testing-log.c:952
593#, fuzzy, c-format
594msgid "Start logging `%s'\n"
595msgstr "Collection `%s' begonnen.\n"
596
521#: src/ats-tests/gnunet-ats-sim.c:92 597#: src/ats-tests/gnunet-ats-sim.c:92
522#, c-format 598#, c-format
523msgid "" 599msgid ""
@@ -525,16 +601,6 @@ msgid ""
525"= %u KiB/s\n" 601"= %u KiB/s\n"
526msgstr "" 602msgstr ""
527 603
528#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552
529msgid "solver to use"
530msgstr ""
531
532#: src/ats-tests/gnunet-solver-eval.c:1003
533#: src/ats-tests/gnunet-solver-eval.c:1008
534#: src/ats/gnunet-ats-solver-eval.c:3557
535msgid "experiment to use"
536msgstr ""
537
538#: src/ats-tool/gnunet-ats.c:299 604#: src/ats-tool/gnunet-ats.c:299
539#, c-format 605#, c-format
540msgid "%u address resolutions had a timeout\n" 606msgid "%u address resolutions had a timeout\n"
@@ -652,72 +718,6 @@ msgstr ""
652msgid "Print information about ATS state" 718msgid "Print information about ATS state"
653msgstr "Informationen über andere GNUnet Knoten ausgeben." 719msgstr "Informationen über andere GNUnet Knoten ausgeben."
654 720
655#: src/ats/gnunet-ats-solver-eval.c:2992 src/ats/gnunet-ats-solver-eval.c:3044
656#, c-format
657msgid ""
658"Could not load quota for network `%s': `%s', assigning default bandwidth "
659"%llu\n"
660msgstr ""
661
662#: src/ats/gnunet-ats-solver-eval.c:3011
663#, c-format
664msgid ""
665"No outbound quota configured for network `%s', assigning default bandwidth "
666"%llu\n"
667msgstr ""
668
669#: src/ats/gnunet-ats-solver-eval.c:3063
670#, c-format
671msgid ""
672"No outbound quota configure for network `%s', assigning default bandwidth "
673"%llu\n"
674msgstr ""
675
676#: src/ats/gnunet-ats-solver-eval.c:3564
677msgid "print logging"
678msgstr ""
679
680#: src/ats/gnunet-ats-solver-eval.c:3569
681msgid "save logging to disk"
682msgstr ""
683
684#: src/ats/gnunet-ats-solver-eval.c:3574
685msgid "disable normalization"
686msgstr ""
687
688#: src/ats/gnunet-service-ats_plugins.c:326
689#, c-format
690msgid ""
691"Could not load %s quota for network `%s': `%s', assigning default bandwidth "
692"%llu\n"
693msgstr ""
694
695#: src/ats/gnunet-service-ats_plugins.c:336
696#, c-format
697msgid "%s quota configured for network `%s' is %llu\n"
698msgstr ""
699
700#: src/ats/gnunet-service-ats_plugins.c:382
701#, c-format
702msgid ""
703"No %s-quota configured for network `%s', assigning default bandwidth %llu\n"
704msgstr ""
705
706#: src/ats/gnunet-service-ats_plugins.c:474
707#, fuzzy, c-format
708msgid "Failed to initialize solver `%s'!\n"
709msgstr "SQLite Datenbank konnte nicht initialisiert werden.\n"
710
711#: src/ats/plugin_ats_proportional.c:1140
712#, fuzzy, c-format
713msgid "Invalid %s configuration %f \n"
714msgstr "Konfiguration konnte nicht aus %s geladen werden\n"
715
716#: src/ats/plugin_ats_proportional.c:1163
717#, fuzzy, c-format
718msgid "Invalid %s configuration %f\n"
719msgstr " gconfig\tGTK Konfiguration\n"
720
721#: src/auction/gnunet-auction-create.c:163 721#: src/auction/gnunet-auction-create.c:163
722msgid "description of the item to be sold" 722msgid "description of the item to be sold"
723msgstr "" 723msgstr ""
@@ -850,28 +850,6 @@ msgstr "Ausführlicherer Modus (empfangene Werte ausgeben)"
850msgid "Connection to conversation service lost, trying to reconnect\n" 850msgid "Connection to conversation service lost, trying to reconnect\n"
851msgstr "" 851msgstr ""
852 852
853#: src/conversation/gnunet-conversation-test.c:120
854#, c-format
855msgid ""
856"\n"
857"End of transmission. Have a GNU day.\n"
858msgstr ""
859
860#: src/conversation/gnunet-conversation-test.c:146
861#, c-format
862msgid ""
863"\n"
864"We are now playing your recording back. If you can hear it, your audio "
865"settings are working..."
866msgstr ""
867
868#: src/conversation/gnunet-conversation-test.c:218
869#, c-format
870msgid ""
871"We will now be recording you for %s. After that time, the recording will be "
872"played back to you..."
873msgstr ""
874
875#: src/conversation/gnunet-conversation.c:264 853#: src/conversation/gnunet-conversation.c:264
876#, c-format 854#, c-format
877msgid "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n" 855msgid "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n"
@@ -1131,8 +1109,30 @@ msgstr ""
1131msgid "Enables having a conversation with other GNUnet users." 1109msgid "Enables having a conversation with other GNUnet users."
1132msgstr "" 1110msgstr ""
1133 1111
1134#: src/conversation/gnunet-helper-audio-playback-gst.c:363 1112#: src/conversation/gnunet-conversation-test.c:120
1113#, c-format
1114msgid ""
1115"\n"
1116"End of transmission. Have a GNU day.\n"
1117msgstr ""
1118
1119#: src/conversation/gnunet-conversation-test.c:146
1120#, c-format
1121msgid ""
1122"\n"
1123"We are now playing your recording back. If you can hear it, your audio "
1124"settings are working..."
1125msgstr ""
1126
1127#: src/conversation/gnunet-conversation-test.c:218
1128#, c-format
1129msgid ""
1130"We will now be recording you for %s. After that time, the recording will be "
1131"played back to you..."
1132msgstr ""
1133
1135#: src/conversation/gnunet_gst.c:664 1134#: src/conversation/gnunet_gst.c:664
1135#: src/conversation/gnunet-helper-audio-playback-gst.c:363
1136#, c-format 1136#, c-format
1137msgid "Read error from STDIN: %d %s\n" 1137msgid "Read error from STDIN: %d %s\n"
1138msgstr "Fehler beim Lesen aus STDIN: %d %s\n" 1138msgstr "Fehler beim Lesen aus STDIN: %d %s\n"
@@ -1938,17 +1938,17 @@ msgstr "`%s' an `%s' schlug fehl bei %s:%d mit dem Fehler: %s\n"
1938msgid "Mysql database running\n" 1938msgid "Mysql database running\n"
1939msgstr "MySQL-Datenbank läuft\n" 1939msgstr "MySQL-Datenbank läuft\n"
1940 1940
1941#: src/datastore/plugin_datastore_postgres.c:277 1941#: src/datastore/plugin_datastore_postgres.c:278
1942#: src/datastore/plugin_datastore_postgres.c:890 1942#: src/datastore/plugin_datastore_postgres.c:891
1943msgid "Postgress exec failure" 1943msgid "Postgress exec failure"
1944msgstr "" 1944msgstr ""
1945 1945
1946#: src/datastore/plugin_datastore_postgres.c:851 1946#: src/datastore/plugin_datastore_postgres.c:852
1947#, fuzzy 1947#, fuzzy
1948msgid "Failed to drop table from database.\n" 1948msgid "Failed to drop table from database.\n"
1949msgstr "Fehler beim Binden an UDP Port %d.\n" 1949msgstr "Fehler beim Binden an UDP Port %d.\n"
1950 1950
1951#: src/datastore/plugin_datastore_postgres.c:949 1951#: src/datastore/plugin_datastore_postgres.c:950
1952msgid "Postgres database running\n" 1952msgid "Postgres database running\n"
1953msgstr "PostgreSQL-Datenbank läuft\n" 1953msgstr "PostgreSQL-Datenbank läuft\n"
1954 1954
@@ -2055,6 +2055,53 @@ msgstr ""
2055msgid "Prints all packets that go through the DHT." 2055msgid "Prints all packets that go through the DHT."
2056msgstr "" 2056msgstr ""
2057 2057
2058#: src/dht/gnunet_dht_profiler.c:922 src/testbed/gnunet-testbed-profiler.c:255
2059#, c-format
2060msgid "Exiting as the number of peers is %u\n"
2061msgstr ""
2062
2063#: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194
2064#, fuzzy
2065msgid "number of peers to start"
2066msgstr "Anzahl an Durchläufen"
2067
2068#: src/dht/gnunet_dht_profiler.c:961
2069msgid "number of PUTs to perform per peer"
2070msgstr ""
2071
2072#: src/dht/gnunet_dht_profiler.c:967 src/nse/gnunet-nse-profiler.c:872
2073#: src/testbed/gnunet-testbed-profiler.c:305
2074msgid "name of the file with the login information for the testbed"
2075msgstr ""
2076
2077#: src/dht/gnunet_dht_profiler.c:973
2078msgid "delay between rounds for collecting statistics (default: 30 sec)"
2079msgstr ""
2080
2081#: src/dht/gnunet_dht_profiler.c:979
2082msgid "delay to start doing PUTs (default: 1 sec)"
2083msgstr ""
2084
2085#: src/dht/gnunet_dht_profiler.c:985
2086msgid "delay to start doing GETs (default: 5 min)"
2087msgstr ""
2088
2089#: src/dht/gnunet_dht_profiler.c:990
2090msgid "replication degree for DHT PUTs"
2091msgstr ""
2092
2093#: src/dht/gnunet_dht_profiler.c:996
2094msgid "chance that a peer is selected at random for PUTs"
2095msgstr ""
2096
2097#: src/dht/gnunet_dht_profiler.c:1002
2098msgid "timeout for DHT PUT and GET requests (default: 1 min)"
2099msgstr ""
2100
2101#: src/dht/gnunet_dht_profiler.c:1023
2102msgid "Measure quality and performance of the DHT service."
2103msgstr ""
2104
2058#: src/dht/gnunet-dht-put.c:133 2105#: src/dht/gnunet-dht-put.c:133
2059msgid "Must provide KEY and DATA for DHT put!\n" 2106msgid "Must provide KEY and DATA for DHT put!\n"
2060msgstr "" 2107msgstr ""
@@ -2319,53 +2366,6 @@ msgstr ""
2319msgid "# DHT requests combined" 2366msgid "# DHT requests combined"
2320msgstr "# dht Anfragen weitergeleitet" 2367msgstr "# dht Anfragen weitergeleitet"
2321 2368
2322#: src/dht/gnunet_dht_profiler.c:922 src/testbed/gnunet-testbed-profiler.c:255
2323#, c-format
2324msgid "Exiting as the number of peers is %u\n"
2325msgstr ""
2326
2327#: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194
2328#, fuzzy
2329msgid "number of peers to start"
2330msgstr "Anzahl an Durchläufen"
2331
2332#: src/dht/gnunet_dht_profiler.c:961
2333msgid "number of PUTs to perform per peer"
2334msgstr ""
2335
2336#: src/dht/gnunet_dht_profiler.c:967 src/nse/gnunet-nse-profiler.c:872
2337#: src/testbed/gnunet-testbed-profiler.c:305
2338msgid "name of the file with the login information for the testbed"
2339msgstr ""
2340
2341#: src/dht/gnunet_dht_profiler.c:973
2342msgid "delay between rounds for collecting statistics (default: 30 sec)"
2343msgstr ""
2344
2345#: src/dht/gnunet_dht_profiler.c:979
2346msgid "delay to start doing PUTs (default: 1 sec)"
2347msgstr ""
2348
2349#: src/dht/gnunet_dht_profiler.c:985
2350msgid "delay to start doing GETs (default: 5 min)"
2351msgstr ""
2352
2353#: src/dht/gnunet_dht_profiler.c:990
2354msgid "replication degree for DHT PUTs"
2355msgstr ""
2356
2357#: src/dht/gnunet_dht_profiler.c:996
2358msgid "chance that a peer is selected at random for PUTs"
2359msgstr ""
2360
2361#: src/dht/gnunet_dht_profiler.c:1002
2362msgid "timeout for DHT PUT and GET requests (default: 1 min)"
2363msgstr ""
2364
2365#: src/dht/gnunet_dht_profiler.c:1023
2366msgid "Measure quality and performance of the DHT service."
2367msgstr ""
2368
2369#: src/dht/plugin_block_dht.c:189 2369#: src/dht/plugin_block_dht.c:189
2370#, fuzzy, c-format 2370#, fuzzy, c-format
2371msgid "Block not of type %u\n" 2371msgid "Block not of type %u\n"
@@ -3315,6 +3315,15 @@ msgid ""
3315"chk/...)" 3315"chk/...)"
3316msgstr "" 3316msgstr ""
3317 3317
3318#: src/fs/gnunet-fs.c:128
3319msgid "print a list of all indexed files"
3320msgstr ""
3321
3322#: src/fs/gnunet-fs.c:141
3323#, fuzzy
3324msgid "Special file-sharing operations"
3325msgstr "Alle Optionen anzeigen"
3326
3318#: src/fs/gnunet-fs-profiler.c:211 3327#: src/fs/gnunet-fs-profiler.c:211
3319msgid "run the experiment with COUNT peers" 3328msgid "run the experiment with COUNT peers"
3320msgstr "" 3329msgstr ""
@@ -3331,15 +3340,6 @@ msgstr ""
3331msgid "run a testbed to measure file-sharing performance" 3340msgid "run a testbed to measure file-sharing performance"
3332msgstr "" 3341msgstr ""
3333 3342
3334#: src/fs/gnunet-fs.c:128
3335msgid "print a list of all indexed files"
3336msgstr ""
3337
3338#: src/fs/gnunet-fs.c:141
3339#, fuzzy
3340msgid "Special file-sharing operations"
3341msgstr "Alle Optionen anzeigen"
3342
3343#: src/fs/gnunet-publish.c:219 src/fs/gnunet-publish.c:234 3343#: src/fs/gnunet-publish.c:219 src/fs/gnunet-publish.c:234
3344#, c-format 3344#, c-format
3345msgid "Publishing `%s' at %llu/%llu (%s remaining)\n" 3345msgid "Publishing `%s' at %llu/%llu (%s remaining)\n"
@@ -4038,6 +4038,52 @@ msgstr ""
4038msgid "look for GNS2DNS records instead of ANY" 4038msgid "look for GNS2DNS records instead of ANY"
4039msgstr "" 4039msgstr ""
4040 4040
4041#: src/gns/gnunet-gns.c:257
4042#, fuzzy, c-format
4043msgid "`%s' is not a valid DNS domain name\n"
4044msgstr "»%s« ist keine gültige IP-Adresse.\n"
4045
4046#: src/gns/gnunet-gns.c:267 src/util/dnsparser.c:254
4047#, c-format
4048msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
4049msgstr ""
4050
4051#: src/gns/gnunet-gns.c:281
4052msgid "Cannot resolve using GNS: GNUnet peer not running\n"
4053msgstr ""
4054
4055#: src/gns/gnunet-gns.c:305
4056#, c-format
4057msgid "Invalid typename specified, assuming `ANY'\n"
4058msgstr ""
4059
4060#: src/gns/gnunet-gns.c:340
4061msgid "Lookup a record for the given name"
4062msgstr ""
4063
4064#: src/gns/gnunet-gns.c:346
4065#, fuzzy
4066msgid "Specify the type of the record to lookup"
4067msgstr "Die Priorität des Inhalts angeben"
4068
4069#: src/gns/gnunet-gns.c:352
4070#, fuzzy
4071msgid "Specify a timeout for the lookup"
4072msgstr "Die Priorität des Inhalts angeben"
4073
4074#: src/gns/gnunet-gns.c:356
4075msgid "No unneeded output"
4076msgstr ""
4077
4078#: src/gns/gnunet-gns.c:361
4079msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
4080msgstr ""
4081
4082#: src/gns/gnunet-gns.c:375
4083#, fuzzy
4084msgid "GNUnet GNS resolver tool"
4085msgstr "GNUnet Netzwerk Topologie tracen."
4086
4041#: src/gns/gnunet-gns-import.c:486 4087#: src/gns/gnunet-gns-import.c:486
4042msgid "This program will import some GNS authorities into your GNS namestore." 4088msgid "This program will import some GNS authorities into your GNS namestore."
4043msgstr "" 4089msgstr ""
@@ -4158,52 +4204,6 @@ msgstr ""
4158msgid "GNUnet GNS proxy" 4204msgid "GNUnet GNS proxy"
4159msgstr "" 4205msgstr ""
4160 4206
4161#: src/gns/gnunet-gns.c:253
4162#, fuzzy, c-format
4163msgid "`%s' is not a valid DNS domain name\n"
4164msgstr "»%s« ist keine gültige IP-Adresse.\n"
4165
4166#: src/gns/gnunet-gns.c:263 src/util/dnsparser.c:254
4167#, c-format
4168msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
4169msgstr ""
4170
4171#: src/gns/gnunet-gns.c:277
4172msgid "Cannot resolve using GNS: GNUnet peer not running\n"
4173msgstr ""
4174
4175#: src/gns/gnunet-gns.c:301
4176#, c-format
4177msgid "Invalid typename specified, assuming `ANY'\n"
4178msgstr ""
4179
4180#: src/gns/gnunet-gns.c:336
4181msgid "Lookup a record for the given name"
4182msgstr ""
4183
4184#: src/gns/gnunet-gns.c:342
4185#, fuzzy
4186msgid "Specify the type of the record to lookup"
4187msgstr "Die Priorität des Inhalts angeben"
4188
4189#: src/gns/gnunet-gns.c:348
4190#, fuzzy
4191msgid "Specify a timeout for the lookup"
4192msgstr "Die Priorität des Inhalts angeben"
4193
4194#: src/gns/gnunet-gns.c:352
4195msgid "No unneeded output"
4196msgstr ""
4197
4198#: src/gns/gnunet-gns.c:357
4199msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
4200msgstr ""
4201
4202#: src/gns/gnunet-gns.c:371
4203#, fuzzy
4204msgid "GNUnet GNS resolver tool"
4205msgstr "GNUnet Netzwerk Topologie tracen."
4206
4207#: src/gns/gnunet-service-gns.c:505 4207#: src/gns/gnunet-service-gns.c:505
4208#, fuzzy 4208#, fuzzy
4209msgid "Properly base32-encoded public key required" 4209msgid "Properly base32-encoded public key required"
@@ -4215,8 +4215,8 @@ msgid "Failed to connect to the namecache!\n"
4215msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" 4215msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
4216 4216
4217#: src/gns/gnunet-service-gns.c:560 4217#: src/gns/gnunet-service-gns.c:560
4218#: src/zonemaster/gnunet-service-zonemaster-monitor.c:444
4219#: src/zonemaster/gnunet-service-zonemaster.c:887 4218#: src/zonemaster/gnunet-service-zonemaster.c:887
4219#: src/zonemaster/gnunet-service-zonemaster-monitor.c:444
4220#, fuzzy 4220#, fuzzy
4221msgid "Could not connect to DHT!\n" 4221msgid "Could not connect to DHT!\n"
4222msgstr "Verbindung zu gnunetd konnte nicht hergestellt werden.\n" 4222msgstr "Verbindung zu gnunetd konnte nicht hergestellt werden.\n"
@@ -4276,21 +4276,21 @@ msgstr ""
4276msgid "GNS lookup failed (zero records found for `%s')\n" 4276msgid "GNS lookup failed (zero records found for `%s')\n"
4277msgstr "Dienst `%s' konnte nicht ordentlich entladen werden!\n" 4277msgstr "Dienst `%s' konnte nicht ordentlich entladen werden!\n"
4278 4278
4279#: src/gns/gnunet-service-gns_resolver.c:2376 4279#: src/gns/gnunet-service-gns_resolver.c:2372
4280msgid "GNS lookup recursion failed (no delegation record found)\n" 4280msgid "GNS lookup recursion failed (no delegation record found)\n"
4281msgstr "" 4281msgstr ""
4282 4282
4283#: src/gns/gnunet-service-gns_resolver.c:2399 4283#: src/gns/gnunet-service-gns_resolver.c:2395
4284#, fuzzy, c-format 4284#, fuzzy, c-format
4285msgid "Failed to cache GNS resolution: %s\n" 4285msgid "Failed to cache GNS resolution: %s\n"
4286msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" 4286msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
4287 4287
4288#: src/gns/gnunet-service-gns_resolver.c:2567 4288#: src/gns/gnunet-service-gns_resolver.c:2563
4289#, c-format 4289#, c-format
4290msgid "GNS namecache returned empty result for `%s'\n" 4290msgid "GNS namecache returned empty result for `%s'\n"
4291msgstr "" 4291msgstr ""
4292 4292
4293#: src/gns/gnunet-service-gns_resolver.c:2707 4293#: src/gns/gnunet-service-gns_resolver.c:2703
4294#, c-format 4294#, c-format
4295msgid "Zone %s was revoked, resolution fails\n" 4295msgid "Zone %s was revoked, resolution fails\n"
4296msgstr "" 4296msgstr ""
@@ -4966,70 +4966,6 @@ msgstr "Sqlite-Datenbank läuft\n"
4966msgid "Failed to setup database at `%s'\n" 4966msgid "Failed to setup database at `%s'\n"
4967msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" 4967msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
4968 4968
4969#: src/namestore/gnunet-namestore-fcfsd.c:551
4970#, fuzzy, c-format
4971msgid "Unsupported form value `%s'\n"
4972msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n"
4973
4974#: src/namestore/gnunet-namestore-fcfsd.c:578
4975#, fuzzy, c-format
4976msgid "Failed to create record for domain `%s': %s\n"
4977msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n"
4978
4979#: src/namestore/gnunet-namestore-fcfsd.c:599
4980msgid "Error when mapping zone to name\n"
4981msgstr ""
4982
4983#: src/namestore/gnunet-namestore-fcfsd.c:631
4984#, c-format
4985msgid "Found existing name `%s' for the given key\n"
4986msgstr ""
4987
4988#: src/namestore/gnunet-namestore-fcfsd.c:693
4989#, c-format
4990msgid "Found %u existing records for domain `%s'\n"
4991msgstr ""
4992
4993#: src/namestore/gnunet-namestore-fcfsd.c:783
4994#, fuzzy, c-format
4995msgid "Failed to create page for `%s'\n"
4996msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n"
4997
4998#: src/namestore/gnunet-namestore-fcfsd.c:802
4999#, fuzzy, c-format
5000msgid "Failed to setup post processor for `%s'\n"
5001msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n"
5002
5003#: src/namestore/gnunet-namestore-fcfsd.c:839
5004msgid "Domain name must not contain `.'\n"
5005msgstr ""
5006
5007#: src/namestore/gnunet-namestore-fcfsd.c:848
5008msgid "Domain name must not contain `+'\n"
5009msgstr ""
5010
5011#: src/namestore/gnunet-namestore-fcfsd.c:1083
5012msgid "No ego configured for `fcfsd` subsystem\n"
5013msgstr ""
5014
5015#: src/namestore/gnunet-namestore-fcfsd.c:1114
5016#, fuzzy
5017msgid "Failed to start HTTP server\n"
5018msgstr "Fehler beim Senden einer `%s' Anfrage an den SMTP Server.\n"
5019
5020#: src/namestore/gnunet-namestore-fcfsd.c:1162
5021#, fuzzy
5022msgid "Failed to connect to identity\n"
5023msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
5024
5025#: src/namestore/gnunet-namestore-fcfsd.c:1189
5026msgid "name of the zone that is to be managed by FCFSD"
5027msgstr ""
5028
5029#: src/namestore/gnunet-namestore-fcfsd.c:1209
5030msgid "GNU Name System First Come First Serve name registration service"
5031msgstr ""
5032
5033#: src/namestore/gnunet-namestore.c:334 4969#: src/namestore/gnunet-namestore.c:334
5034#, c-format 4970#, c-format
5035msgid "Adding record failed: %s\n" 4971msgid "Adding record failed: %s\n"
@@ -5249,7 +5185,71 @@ msgstr ""
5249msgid "name of the ego controlling the zone" 5185msgid "name of the ego controlling the zone"
5250msgstr "" 5186msgstr ""
5251 5187
5252#: src/namestore/gnunet-service-namestore.c:864 5188#: src/namestore/gnunet-namestore-fcfsd.c:551
5189#, fuzzy, c-format
5190msgid "Unsupported form value `%s'\n"
5191msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n"
5192
5193#: src/namestore/gnunet-namestore-fcfsd.c:578
5194#, fuzzy, c-format
5195msgid "Failed to create record for domain `%s': %s\n"
5196msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n"
5197
5198#: src/namestore/gnunet-namestore-fcfsd.c:599
5199msgid "Error when mapping zone to name\n"
5200msgstr ""
5201
5202#: src/namestore/gnunet-namestore-fcfsd.c:631
5203#, c-format
5204msgid "Found existing name `%s' for the given key\n"
5205msgstr ""
5206
5207#: src/namestore/gnunet-namestore-fcfsd.c:693
5208#, c-format
5209msgid "Found %u existing records for domain `%s'\n"
5210msgstr ""
5211
5212#: src/namestore/gnunet-namestore-fcfsd.c:783
5213#, fuzzy, c-format
5214msgid "Failed to create page for `%s'\n"
5215msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n"
5216
5217#: src/namestore/gnunet-namestore-fcfsd.c:802
5218#, fuzzy, c-format
5219msgid "Failed to setup post processor for `%s'\n"
5220msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n"
5221
5222#: src/namestore/gnunet-namestore-fcfsd.c:839
5223msgid "Domain name must not contain `.'\n"
5224msgstr ""
5225
5226#: src/namestore/gnunet-namestore-fcfsd.c:848
5227msgid "Domain name must not contain `+'\n"
5228msgstr ""
5229
5230#: src/namestore/gnunet-namestore-fcfsd.c:1083
5231msgid "No ego configured for `fcfsd` subsystem\n"
5232msgstr ""
5233
5234#: src/namestore/gnunet-namestore-fcfsd.c:1114
5235#, fuzzy
5236msgid "Failed to start HTTP server\n"
5237msgstr "Fehler beim Senden einer `%s' Anfrage an den SMTP Server.\n"
5238
5239#: src/namestore/gnunet-namestore-fcfsd.c:1162
5240#, fuzzy
5241msgid "Failed to connect to identity\n"
5242msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
5243
5244#: src/namestore/gnunet-namestore-fcfsd.c:1189
5245msgid "name of the zone that is to be managed by FCFSD"
5246msgstr ""
5247
5248#: src/namestore/gnunet-namestore-fcfsd.c:1209
5249msgid "GNU Name System First Come First Serve name registration service"
5250msgstr ""
5251
5252#: src/namestore/gnunet-service-namestore.c:866
5253#, c-format 5253#, c-format
5254msgid "Failed to replicate block in namecache: %s\n" 5254msgid "Failed to replicate block in namecache: %s\n"
5255msgstr "" 5255msgstr ""
@@ -5571,6 +5571,10 @@ msgstr "Kommando `%s' wurde nicht gefunden!\n"
5571msgid "`upnpc' command not found\n" 5571msgid "`upnpc' command not found\n"
5572msgstr "Kommando `%s' wurde nicht gefunden!\n" 5572msgstr "Kommando `%s' wurde nicht gefunden!\n"
5573 5573
5574#: src/nse/gnunet-nse.c:124
5575msgid "Show network size estimates from NSE service."
5576msgstr ""
5577
5574#: src/nse/gnunet-nse-profiler.c:857 5578#: src/nse/gnunet-nse-profiler.c:857
5575msgid "limit to the number of connections to NSE services, 0 for none" 5579msgid "limit to the number of connections to NSE services, 0 for none"
5576msgstr "" 5580msgstr ""
@@ -5595,15 +5599,68 @@ msgstr ""
5595msgid "Measure quality and performance of the NSE service." 5599msgid "Measure quality and performance of the NSE service."
5596msgstr "" 5600msgstr ""
5597 5601
5598#: src/nse/gnunet-nse.c:124
5599msgid "Show network size estimates from NSE service."
5600msgstr ""
5601
5602#: src/nse/gnunet-service-nse.c:1437 5602#: src/nse/gnunet-service-nse.c:1437
5603#: src/revocation/gnunet-service-revocation.c:846 src/util/gnunet-scrypt.c:247 5603#: src/revocation/gnunet-service-revocation.c:846 src/util/gnunet-scrypt.c:247
5604msgid "Value is too large.\n" 5604msgid "Value is too large.\n"
5605msgstr "" 5605msgstr ""
5606 5606
5607#: src/peerinfo/gnunet-service-peerinfo.c:175
5608#, fuzzy, c-format
5609msgid "Removing expired address of transport `%s'\n"
5610msgstr "Verfügbare(r) Transport(e): %s\n"
5611
5612#: src/peerinfo/gnunet-service-peerinfo.c:306
5613#, fuzzy, c-format
5614msgid "Failed to parse HELLO in file `%s': %s\n"
5615msgstr "Datei wurde als `%s' gespeichert.\n"
5616
5617#: src/peerinfo/gnunet-service-peerinfo.c:323
5618#: src/peerinfo/gnunet-service-peerinfo.c:348
5619#, fuzzy, c-format
5620msgid "Failed to parse HELLO in file `%s'\n"
5621msgstr "Datei wurde als `%s' gespeichert.\n"
5622
5623#: src/peerinfo/gnunet-service-peerinfo.c:426
5624msgid "# peers known"
5625msgstr ""
5626
5627#: src/peerinfo/gnunet-service-peerinfo.c:468
5628#, c-format
5629msgid ""
5630"File `%s' in directory `%s' does not match naming convention. Removed.\n"
5631msgstr ""
5632"Die Datei »%s« im Verzeichnis »%s« entspricht nicht der Namenskonvention. "
5633"Die Datei wurde entfernt.\n"
5634
5635#: src/peerinfo/gnunet-service-peerinfo.c:624
5636#, fuzzy, c-format
5637msgid "Scanning directory `%s'\n"
5638msgstr "==> Verzeichnis `%s':\n"
5639
5640#: src/peerinfo/gnunet-service-peerinfo.c:631
5641#, fuzzy, c-format
5642msgid "Still no peers found in `%s'!\n"
5643msgstr "Dienst `%s' konnte nicht ordentlich entladen werden!\n"
5644
5645#: src/peerinfo/gnunet-service-peerinfo.c:1024
5646#, fuzzy, c-format
5647msgid "Cleaning up directory `%s'\n"
5648msgstr "==> Verzeichnis `%s':\n"
5649
5650#: src/peerinfo/gnunet-service-peerinfo.c:1319
5651#, c-format
5652msgid "Importing HELLOs from `%s'\n"
5653msgstr ""
5654
5655#: src/peerinfo/gnunet-service-peerinfo.c:1332
5656msgid "Skipping import of included HELLOs\n"
5657msgstr ""
5658
5659#: src/peerinfo/peerinfo_api.c:217
5660#, fuzzy
5661msgid "Failed to receive response from `PEERINFO' service."
5662msgstr "Fehler beim Empfangen der Antwort von gnunetd auf die `%s' Nachricht\n"
5663
5607#: src/peerinfo-tool/gnunet-peerinfo.c:237 5664#: src/peerinfo-tool/gnunet-peerinfo.c:237
5608#, fuzzy, c-format 5665#, fuzzy, c-format
5609msgid "%sPeer `%s'\n" 5666msgid "%sPeer `%s'\n"
@@ -5700,63 +5757,6 @@ msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n"
5700msgid "Peerinfo REST API initialized\n" 5757msgid "Peerinfo REST API initialized\n"
5701msgstr " Verbindung fehlgeschlagen\n" 5758msgstr " Verbindung fehlgeschlagen\n"
5702 5759
5703#: src/peerinfo/gnunet-service-peerinfo.c:175
5704#, fuzzy, c-format
5705msgid "Removing expired address of transport `%s'\n"
5706msgstr "Verfügbare(r) Transport(e): %s\n"
5707
5708#: src/peerinfo/gnunet-service-peerinfo.c:306
5709#, fuzzy, c-format
5710msgid "Failed to parse HELLO in file `%s': %s\n"
5711msgstr "Datei wurde als `%s' gespeichert.\n"
5712
5713#: src/peerinfo/gnunet-service-peerinfo.c:323
5714#: src/peerinfo/gnunet-service-peerinfo.c:348
5715#, fuzzy, c-format
5716msgid "Failed to parse HELLO in file `%s'\n"
5717msgstr "Datei wurde als `%s' gespeichert.\n"
5718
5719#: src/peerinfo/gnunet-service-peerinfo.c:426
5720msgid "# peers known"
5721msgstr ""
5722
5723#: src/peerinfo/gnunet-service-peerinfo.c:468
5724#, c-format
5725msgid ""
5726"File `%s' in directory `%s' does not match naming convention. Removed.\n"
5727msgstr ""
5728"Die Datei »%s« im Verzeichnis »%s« entspricht nicht der Namenskonvention. "
5729"Die Datei wurde entfernt.\n"
5730
5731#: src/peerinfo/gnunet-service-peerinfo.c:624
5732#, fuzzy, c-format
5733msgid "Scanning directory `%s'\n"
5734msgstr "==> Verzeichnis `%s':\n"
5735
5736#: src/peerinfo/gnunet-service-peerinfo.c:631
5737#, fuzzy, c-format
5738msgid "Still no peers found in `%s'!\n"
5739msgstr "Dienst `%s' konnte nicht ordentlich entladen werden!\n"
5740
5741#: src/peerinfo/gnunet-service-peerinfo.c:1024
5742#, fuzzy, c-format
5743msgid "Cleaning up directory `%s'\n"
5744msgstr "==> Verzeichnis `%s':\n"
5745
5746#: src/peerinfo/gnunet-service-peerinfo.c:1319
5747#, c-format
5748msgid "Importing HELLOs from `%s'\n"
5749msgstr ""
5750
5751#: src/peerinfo/gnunet-service-peerinfo.c:1332
5752msgid "Skipping import of included HELLOs\n"
5753msgstr ""
5754
5755#: src/peerinfo/peerinfo_api.c:217
5756#, fuzzy
5757msgid "Failed to receive response from `PEERINFO' service."
5758msgstr "Fehler beim Empfangen der Antwort von gnunetd auf die `%s' Nachricht\n"
5759
5760#: src/peerstore/gnunet-peerstore.c:92 5760#: src/peerstore/gnunet-peerstore.c:92
5761msgid "peerstore" 5761msgid "peerstore"
5762msgstr "" 5762msgstr ""
@@ -6181,6 +6181,18 @@ msgstr ""
6181msgid "Could not open revocation database file!" 6181msgid "Could not open revocation database file!"
6182msgstr "Knoten `%s' konnte nicht in der Routing Tabelle gefunden werden!\n" 6182msgstr "Knoten `%s' konnte nicht in der Routing Tabelle gefunden werden!\n"
6183 6183
6184#: src/rps/gnunet-rps.c:270
6185msgid "Seed a PeerID"
6186msgstr ""
6187
6188#: src/rps/gnunet-rps.c:275
6189msgid "Get updates of view (0 for infinite updates)"
6190msgstr ""
6191
6192#: src/rps/gnunet-rps.c:279
6193msgid "Get peers from biased stream"
6194msgstr ""
6195
6184#: src/rps/gnunet-rps-profiler.c:3200 6196#: src/rps/gnunet-rps-profiler.c:3200
6185msgid "duration of the profiling" 6197msgid "duration of the profiling"
6186msgstr "" 6198msgstr ""
@@ -6198,18 +6210,6 @@ msgstr "Anzahl an Durchläufen"
6198msgid "Measure quality and performance of the RPS service." 6210msgid "Measure quality and performance of the RPS service."
6199msgstr "" 6211msgstr ""
6200 6212
6201#: src/rps/gnunet-rps.c:270
6202msgid "Seed a PeerID"
6203msgstr ""
6204
6205#: src/rps/gnunet-rps.c:275
6206msgid "Get updates of view (0 for infinite updates)"
6207msgstr ""
6208
6209#: src/rps/gnunet-rps.c:279
6210msgid "Get peers from biased stream"
6211msgstr ""
6212
6213#: src/scalarproduct/gnunet-scalarproduct.c:229 6213#: src/scalarproduct/gnunet-scalarproduct.c:229
6214#, fuzzy 6214#, fuzzy
6215msgid "You must specify at least one message ID to check!\n" 6215msgid "You must specify at least one message ID to check!\n"
@@ -6265,10 +6265,10 @@ msgstr ""
6265msgid "Calculate the Vectorproduct with a GNUnet peer." 6265msgid "Calculate the Vectorproduct with a GNUnet peer."
6266msgstr "" 6266msgstr ""
6267 6267
6268#: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1127
6269#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1073
6270#: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1363 6268#: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1363
6271#: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1366 6269#: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1366
6270#: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1127
6271#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1073
6272#, fuzzy 6272#, fuzzy
6273msgid "Connect to CADET failed\n" 6273msgid "Connect to CADET failed\n"
6274msgstr " Verbindung fehlgeschlagen\n" 6274msgstr " Verbindung fehlgeschlagen\n"
@@ -6612,17 +6612,6 @@ msgstr ""
6612msgid "%.s Unknown result code." 6612msgid "%.s Unknown result code."
6613msgstr "" 6613msgstr ""
6614 6614
6615#: src/testbed/gnunet-testbed-profiler.c:290
6616msgid "tolerate COUNT number of continious timeout failures"
6617msgstr ""
6618
6619#: src/testbed/gnunet-testbed-profiler.c:295
6620msgid ""
6621"run profiler in non-interactive mode where upon testbed setup the profiler "
6622"does not wait for a keystroke but continues to run until a termination "
6623"signal is received"
6624msgstr ""
6625
6626#: src/testbed/gnunet_testbed_mpi_spawn.c:119 6615#: src/testbed/gnunet_testbed_mpi_spawn.c:119
6627#, fuzzy 6616#, fuzzy
6628msgid "Waiting for child to exit.\n" 6617msgid "Waiting for child to exit.\n"
@@ -6635,6 +6624,17 @@ msgstr ""
6635msgid "Spawning process `%s'\n" 6624msgid "Spawning process `%s'\n"
6636msgstr "Ungültige Antwort auf `%s'.\n" 6625msgstr "Ungültige Antwort auf `%s'.\n"
6637 6626
6627#: src/testbed/gnunet-testbed-profiler.c:290
6628msgid "tolerate COUNT number of continious timeout failures"
6629msgstr ""
6630
6631#: src/testbed/gnunet-testbed-profiler.c:295
6632msgid ""
6633"run profiler in non-interactive mode where upon testbed setup the profiler "
6634"does not wait for a keystroke but continues to run until a termination "
6635"signal is received"
6636msgstr ""
6637
6638#: src/testbed/testbed_api.c:399 6638#: src/testbed/testbed_api.c:399
6639#, fuzzy, c-format 6639#, fuzzy, c-format
6640msgid "Adding host %u failed with error: %s\n" 6640msgid "Adding host %u failed with error: %s\n"
@@ -6963,6 +6963,10 @@ msgstr "Pfad zu »%s« kann nicht erstellt werden\n"
6963msgid "GNUnet UNIX domain socket communicator" 6963msgid "GNUnet UNIX domain socket communicator"
6964msgstr "" 6964msgstr ""
6965 6965
6966#: src/transport/gnunet-service-transport_ats.c:137
6967msgid "# Addresses given to ATS"
6968msgstr ""
6969
6966#: src/transport/gnunet-service-transport.c:445 6970#: src/transport/gnunet-service-transport.c:445
6967msgid "# messages dropped due to slow client" 6971msgid "# messages dropped due to slow client"
6968msgstr "" 6972msgstr ""
@@ -7003,10 +7007,6 @@ msgstr ""
7003msgid "Adding blacklisting entry for peer `%s':`%s'\n" 7007msgid "Adding blacklisting entry for peer `%s':`%s'\n"
7004msgstr "" 7008msgstr ""
7005 7009
7006#: src/transport/gnunet-service-transport_ats.c:137
7007msgid "# Addresses given to ATS"
7008msgstr ""
7009
7010#: src/transport/gnunet-service-transport_hello.c:195 7010#: src/transport/gnunet-service-transport_hello.c:195
7011msgid "# refreshed my HELLO" 7011msgid "# refreshed my HELLO"
7012msgstr "" 7012msgstr ""
@@ -7332,43 +7332,6 @@ msgstr ""
7332msgid "# HELLOs given to peerinfo" 7332msgid "# HELLOs given to peerinfo"
7333msgstr "" 7333msgstr ""
7334 7334
7335#: src/transport/gnunet-transport-profiler.c:220
7336#, c-format
7337msgid "%llu B in %llu ms == %.2f KB/s!\n"
7338msgstr ""
7339
7340#: src/transport/gnunet-transport-profiler.c:577
7341msgid "send data to peer"
7342msgstr ""
7343
7344#: src/transport/gnunet-transport-profiler.c:581
7345#, fuzzy
7346msgid "receive data from peer"
7347msgstr "# Bytes des Typs %d empfangen"
7348
7349#: src/transport/gnunet-transport-profiler.c:586
7350msgid "iterations"
7351msgstr ""
7352
7353#: src/transport/gnunet-transport-profiler.c:591
7354#, fuzzy
7355msgid "number of messages to send"
7356msgstr "Anzahl an Durchläufen"
7357
7358#: src/transport/gnunet-transport-profiler.c:596
7359msgid "message size to use"
7360msgstr ""
7361
7362#: src/transport/gnunet-transport-profiler.c:601
7363#: src/transport/gnunet-transport.c:1404
7364msgid "peer identity"
7365msgstr ""
7366
7367#: src/transport/gnunet-transport-profiler.c:614
7368#: src/transport/gnunet-transport.c:1426
7369msgid "Direct access to transport service."
7370msgstr "Direkter Zugriff auf den Transportdienst"
7371
7372#: src/transport/gnunet-transport.c:406 7335#: src/transport/gnunet-transport.c:406
7373#, c-format 7336#, c-format
7374msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" 7337msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n"
@@ -7501,6 +7464,11 @@ msgstr ""
7501msgid "do not resolve hostnames" 7464msgid "do not resolve hostnames"
7502msgstr "Keine Rechnernamen auflösen" 7465msgstr "Keine Rechnernamen auflösen"
7503 7466
7467#: src/transport/gnunet-transport.c:1404
7468#: src/transport/gnunet-transport-profiler.c:601
7469msgid "peer identity"
7470msgstr ""
7471
7504#: src/transport/gnunet-transport.c:1408 7472#: src/transport/gnunet-transport.c:1408
7505msgid "monitor plugin sessions" 7473msgid "monitor plugin sessions"
7506msgstr "" 7474msgstr ""
@@ -7509,6 +7477,38 @@ msgstr ""
7509msgid "send data for benchmarking to the other peer (until CTRL-C)" 7477msgid "send data for benchmarking to the other peer (until CTRL-C)"
7510msgstr "" 7478msgstr ""
7511 7479
7480#: src/transport/gnunet-transport.c:1426
7481#: src/transport/gnunet-transport-profiler.c:614
7482msgid "Direct access to transport service."
7483msgstr "Direkter Zugriff auf den Transportdienst"
7484
7485#: src/transport/gnunet-transport-profiler.c:220
7486#, c-format
7487msgid "%llu B in %llu ms == %.2f KB/s!\n"
7488msgstr ""
7489
7490#: src/transport/gnunet-transport-profiler.c:577
7491msgid "send data to peer"
7492msgstr ""
7493
7494#: src/transport/gnunet-transport-profiler.c:581
7495#, fuzzy
7496msgid "receive data from peer"
7497msgstr "# Bytes des Typs %d empfangen"
7498
7499#: src/transport/gnunet-transport-profiler.c:586
7500msgid "iterations"
7501msgstr ""
7502
7503#: src/transport/gnunet-transport-profiler.c:591
7504#, fuzzy
7505msgid "number of messages to send"
7506msgstr "Anzahl an Durchläufen"
7507
7508#: src/transport/gnunet-transport-profiler.c:596
7509msgid "message size to use"
7510msgstr ""
7511
7512#: src/transport/plugin_transport_http_client.c:1489 7512#: src/transport/plugin_transport_http_client.c:1489
7513#: src/transport/plugin_transport_http_server.c:2331 7513#: src/transport/plugin_transport_http_server.c:2331
7514#: src/transport/plugin_transport_http_server.c:3562 7514#: src/transport/plugin_transport_http_server.c:3562
@@ -7781,6 +7781,21 @@ msgstr ""
7781msgid "TCP transport advertises itself as being on port %llu\n" 7781msgid "TCP transport advertises itself as being on port %llu\n"
7782msgstr "" 7782msgstr ""
7783 7783
7784#: src/transport/plugin_transport_udp_broadcasting.c:169
7785#, fuzzy
7786msgid "# Multicast HELLO beacons received via UDP"
7787msgstr "# Bytes empfangen über TCP"
7788
7789#: src/transport/plugin_transport_udp_broadcasting.c:553
7790msgid ""
7791"Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"
7792msgstr ""
7793
7794#: src/transport/plugin_transport_udp_broadcasting.c:571
7795#, fuzzy, c-format
7796msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n"
7797msgstr "Der Transportdienst auf Port %d konnte nicht gestartet werden.\n"
7798
7784#: src/transport/plugin_transport_udp.c:3169 7799#: src/transport/plugin_transport_udp.c:3169
7785#, c-format 7800#, c-format
7786msgid "" 7801msgid ""
@@ -7828,21 +7843,6 @@ msgstr "»%s« ist keine gültige IP-Adresse.\n"
7828msgid "Failed to create UDP network sockets\n" 7843msgid "Failed to create UDP network sockets\n"
7829msgstr "UDP-Sockets können nicht geöffnet werden\n" 7844msgstr "UDP-Sockets können nicht geöffnet werden\n"
7830 7845
7831#: src/transport/plugin_transport_udp_broadcasting.c:169
7832#, fuzzy
7833msgid "# Multicast HELLO beacons received via UDP"
7834msgstr "# Bytes empfangen über TCP"
7835
7836#: src/transport/plugin_transport_udp_broadcasting.c:553
7837msgid ""
7838"Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"
7839msgstr ""
7840
7841#: src/transport/plugin_transport_udp_broadcasting.c:571
7842#, fuzzy, c-format
7843msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n"
7844msgstr "Der Transportdienst auf Port %d konnte nicht gestartet werden.\n"
7845
7846#: src/transport/plugin_transport_unix.c:1396 7846#: src/transport/plugin_transport_unix.c:1396
7847#, fuzzy, c-format 7847#, fuzzy, c-format
7848msgid "Cannot bind to `%s'\n" 7848msgid "Cannot bind to `%s'\n"
@@ -7929,17 +7929,17 @@ msgstr "Zugriff verweigert auf »%s«\n"
7929msgid "Accepting connection from `%s': %p\n" 7929msgid "Accepting connection from `%s': %p\n"
7930msgstr "" 7930msgstr ""
7931 7931
7932#: src/transport/tcp_server_legacy.c:478 src/util/service.c:1400 7932#: src/transport/tcp_server_legacy.c:478 src/util/service.c:1397
7933#, fuzzy, c-format 7933#, fuzzy, c-format
7934msgid "`%s' failed for port %d (%s).\n" 7934msgid "`%s' failed for port %d (%s).\n"
7935msgstr "`%s' fehlgeschlagen für Laufwerk %s: %u\n" 7935msgstr "`%s' fehlgeschlagen für Laufwerk %s: %u\n"
7936 7936
7937#: src/transport/tcp_server_legacy.c:488 src/util/service.c:1412 7937#: src/transport/tcp_server_legacy.c:488 src/util/service.c:1409
7938#, fuzzy, c-format 7938#, fuzzy, c-format
7939msgid "`%s' failed for port %d (%s): address already in use\n" 7939msgid "`%s' failed for port %d (%s): address already in use\n"
7940msgstr "`%s' schlug fehl für Port %d: %s. Läuft gnunetd bereits?\n" 7940msgstr "`%s' schlug fehl für Port %d: %s. Läuft gnunetd bereits?\n"
7941 7941
7942#: src/transport/tcp_server_legacy.c:494 src/util/service.c:1419 7942#: src/transport/tcp_server_legacy.c:494 src/util/service.c:1416
7943#, fuzzy, c-format 7943#, fuzzy, c-format
7944msgid "`%s' failed for `%s': address already in use\n" 7944msgid "`%s' failed for `%s': address already in use\n"
7945msgstr "%s schlug fehl, Nachrichten Typ %d ist bereits in Verwendung.\n" 7945msgstr "%s schlug fehl, Nachrichten Typ %d ist bereits in Verwendung.\n"
@@ -7951,7 +7951,7 @@ msgid ""
7951"`GNUNET_SERVER_receive_done' after %s\n" 7951"`GNUNET_SERVER_receive_done' after %s\n"
7952msgstr "" 7952msgstr ""
7953 7953
7954#: src/transport/tcp_service_legacy.c:345 src/util/service.c:837 7954#: src/transport/tcp_service_legacy.c:345 src/util/service.c:834
7955#, c-format 7955#, c-format
7956msgid "Unknown address family %d\n" 7956msgid "Unknown address family %d\n"
7957msgstr "" 7957msgstr ""
@@ -7961,23 +7961,23 @@ msgstr ""
7961msgid "Access from `%s' denied to service `%s'\n" 7961msgid "Access from `%s' denied to service `%s'\n"
7962msgstr "" 7962msgstr ""
7963 7963
7964#: src/transport/tcp_service_legacy.c:410 src/util/service.c:950 7964#: src/transport/tcp_service_legacy.c:410 src/util/service.c:947
7965#, c-format 7965#, c-format
7966msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 7966msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
7967msgstr "" 7967msgstr ""
7968 7968
7969#: src/transport/tcp_service_legacy.c:451 src/util/service.c:991 7969#: src/transport/tcp_service_legacy.c:451 src/util/service.c:988
7970#, c-format 7970#, c-format
7971msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 7971msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
7972msgstr "" 7972msgstr ""
7973 7973
7974#: src/transport/tcp_service_legacy.c:890 7974#: src/transport/tcp_service_legacy.c:890
7975#: src/transport/tcp_service_legacy.c:910 src/util/service.c:1480 7975#: src/transport/tcp_service_legacy.c:910 src/util/service.c:1477
7976#, c-format 7976#, c-format
7977msgid "Specified value for `%s' of service `%s' is invalid\n" 7977msgid "Specified value for `%s' of service `%s' is invalid\n"
7978msgstr "" 7978msgstr ""
7979 7979
7980#: src/transport/tcp_service_legacy.c:935 src/util/service.c:1504 7980#: src/transport/tcp_service_legacy.c:935 src/util/service.c:1501
7981#, c-format 7981#, c-format
7982msgid "Could not access pre-bound socket %u, will try to bind myself\n" 7982msgid "Could not access pre-bound socket %u, will try to bind myself\n"
7983msgstr "" 7983msgstr ""
@@ -7992,45 +7992,45 @@ msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
7992msgid "Service `%s' runs at %s\n" 7992msgid "Service `%s' runs at %s\n"
7993msgstr "Dienst »%s« läuft auf %s\n" 7993msgstr "Dienst »%s« läuft auf %s\n"
7994 7994
7995#: src/transport/tcp_service_legacy.c:1193 src/util/service.c:1750 7995#: src/transport/tcp_service_legacy.c:1193 src/util/service.c:1747
7996msgid "Service process failed to initialize\n" 7996msgid "Service process failed to initialize\n"
7997msgstr "" 7997msgstr ""
7998 7998
7999#: src/transport/tcp_service_legacy.c:1198 src/util/service.c:1755 7999#: src/transport/tcp_service_legacy.c:1198 src/util/service.c:1752
8000msgid "Service process could not initialize server function\n" 8000msgid "Service process could not initialize server function\n"
8001msgstr "" 8001msgstr ""
8002 8002
8003#: src/transport/tcp_service_legacy.c:1203 src/util/service.c:1760 8003#: src/transport/tcp_service_legacy.c:1203 src/util/service.c:1757
8004msgid "Service process failed to report status\n" 8004msgid "Service process failed to report status\n"
8005msgstr "" 8005msgstr ""
8006 8006
8007#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1177 8007#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1177
8008#: src/util/service.c:1641 8008#: src/util/service.c:1638
8009#, fuzzy, c-format 8009#, fuzzy, c-format
8010msgid "Cannot obtain information about user `%s': %s\n" 8010msgid "Cannot obtain information about user `%s': %s\n"
8011msgstr "Fehler beim Speichern der Konfigurationsdatei: `%s': %s.\n" 8011msgstr "Fehler beim Speichern der Konfigurationsdatei: `%s': %s.\n"
8012 8012
8013#: src/transport/tcp_service_legacy.c:1255 src/util/service.c:1643 8013#: src/transport/tcp_service_legacy.c:1255 src/util/service.c:1640
8014msgid "No such user" 8014msgid "No such user"
8015msgstr "" 8015msgstr ""
8016 8016
8017#: src/transport/tcp_service_legacy.c:1269 src/util/service.c:1657 8017#: src/transport/tcp_service_legacy.c:1269 src/util/service.c:1654
8018#, c-format 8018#, c-format
8019msgid "Cannot change user/group to `%s': %s\n" 8019msgid "Cannot change user/group to `%s': %s\n"
8020msgstr "Benutzer/Gruppe kann nicht zu »%s« geändert werden: %s\n" 8020msgstr "Benutzer/Gruppe kann nicht zu »%s« geändert werden: %s\n"
8021 8021
8022#: src/transport/tcp_service_legacy.c:1348 src/util/service.c:1999 8022#: src/transport/tcp_service_legacy.c:1348 src/util/service.c:1996
8023msgid "do daemonize (detach from terminal)" 8023msgid "do daemonize (detach from terminal)"
8024msgstr "" 8024msgstr ""
8025 8025
8026#: src/transport/tcp_service_legacy.c:1397 8026#: src/transport/tcp_service_legacy.c:1397
8027#: src/transport/transport-testing2.c:906 src/util/service.c:2073 8027#: src/transport/transport-testing2.c:906 src/util/service.c:2070
8028#: src/util/service.c:2085 8028#: src/util/service.c:2082
8029#, fuzzy, c-format 8029#, fuzzy, c-format
8030msgid "Malformed configuration file `%s', exit ...\n" 8030msgid "Malformed configuration file `%s', exit ...\n"
8031msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" 8031msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n"
8032 8032
8033#: src/transport/tcp_service_legacy.c:1407 src/util/service.c:2095 8033#: src/transport/tcp_service_legacy.c:1407 src/util/service.c:2092
8034#, fuzzy 8034#, fuzzy
8035msgid "Malformed configuration, exit ...\n" 8035msgid "Malformed configuration, exit ...\n"
8036msgstr "GNUnet Konfiguration" 8036msgstr "GNUnet Konfiguration"
@@ -8073,69 +8073,69 @@ msgstr ""
8073msgid "Metadata `%s' failed to deserialize" 8073msgid "Metadata `%s' failed to deserialize"
8074msgstr "" 8074msgstr ""
8075 8075
8076#: src/util/client.c:739 src/util/client.c:931 8076#: src/util/client.c:747 src/util/client.c:937
8077msgid "not a valid filename" 8077msgid "not a valid filename"
8078msgstr "" 8078msgstr ""
8079 8079
8080#: src/util/client.c:1097 8080#: src/util/client.c:1103
8081#, c-format 8081#, c-format
8082msgid "Need a non-empty hostname for service `%s'.\n" 8082msgid "Need a non-empty hostname for service `%s'.\n"
8083msgstr "" 8083msgstr ""
8084 8084
8085#: src/util/common_logging.c:259 src/util/common_logging.c:1116 8085#: src/util/common_logging.c:259 src/util/common_logging.c:1112
8086msgid "DEBUG" 8086msgid "DEBUG"
8087msgstr "DEBUG" 8087msgstr "DEBUG"
8088 8088
8089#: src/util/common_logging.c:261 src/util/common_logging.c:1114 8089#: src/util/common_logging.c:261 src/util/common_logging.c:1110
8090msgid "INFO" 8090msgid "INFO"
8091msgstr "INFO" 8091msgstr "INFO"
8092 8092
8093#: src/util/common_logging.c:263 src/util/common_logging.c:1112 8093#: src/util/common_logging.c:263 src/util/common_logging.c:1108
8094msgid "MESSAGE" 8094msgid "MESSAGE"
8095msgstr "" 8095msgstr ""
8096 8096
8097#: src/util/common_logging.c:265 src/util/common_logging.c:1110 8097#: src/util/common_logging.c:265 src/util/common_logging.c:1106
8098msgid "WARNING" 8098msgid "WARNING"
8099msgstr "WARNUNG" 8099msgstr "WARNUNG"
8100 8100
8101#: src/util/common_logging.c:267 src/util/common_logging.c:1108 8101#: src/util/common_logging.c:267 src/util/common_logging.c:1104
8102msgid "ERROR" 8102msgid "ERROR"
8103msgstr "FEHLER" 8103msgstr "FEHLER"
8104 8104
8105#: src/util/common_logging.c:269 src/util/common_logging.c:1118 8105#: src/util/common_logging.c:269 src/util/common_logging.c:1114
8106msgid "NONE" 8106msgid "NONE"
8107msgstr "" 8107msgstr ""
8108 8108
8109#: src/util/common_logging.c:630 src/util/common_logging.c:669 8109#: src/util/common_logging.c:626 src/util/common_logging.c:665
8110#, c-format 8110#, c-format
8111msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" 8111msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n"
8112msgstr "" 8112msgstr ""
8113 8113
8114#: src/util/common_logging.c:906 8114#: src/util/common_logging.c:902
8115#, c-format 8115#, c-format
8116msgid "Message `%.*s' repeated %u times in the last %s\n" 8116msgid "Message `%.*s' repeated %u times in the last %s\n"
8117msgstr "" 8117msgstr ""
8118 8118
8119#: src/util/common_logging.c:1119 8119#: src/util/common_logging.c:1115
8120msgid "INVALID" 8120msgid "INVALID"
8121msgstr "" 8121msgstr ""
8122 8122
8123#: src/util/common_logging.c:1400 8123#: src/util/common_logging.c:1396
8124msgid "unknown address" 8124msgid "unknown address"
8125msgstr "Unbekannte Adresse" 8125msgstr "Unbekannte Adresse"
8126 8126
8127#: src/util/common_logging.c:1445 8127#: src/util/common_logging.c:1441
8128msgid "invalid address" 8128msgid "invalid address"
8129msgstr "Ungültige Adresse" 8129msgstr "Ungültige Adresse"
8130 8130
8131#: src/util/common_logging.c:1464 8131#: src/util/common_logging.c:1460
8132#, fuzzy, c-format 8132#, fuzzy, c-format
8133msgid "Configuration fails to specify option `%s' in section `%s'!\n" 8133msgid "Configuration fails to specify option `%s' in section `%s'!\n"
8134msgstr "" 8134msgstr ""
8135"Die Konfigurationsdatei muss in der Sektion `%s' unter `%s' ein Verzeichnis " 8135"Die Konfigurationsdatei muss in der Sektion `%s' unter `%s' ein Verzeichnis "
8136"angeben, in dem FS Daten gespeichert werden.\n" 8136"angeben, in dem FS Daten gespeichert werden.\n"
8137 8137
8138#: src/util/common_logging.c:1487 8138#: src/util/common_logging.c:1483
8139#, fuzzy, c-format 8139#, fuzzy, c-format
8140msgid "" 8140msgid ""
8141"Configuration specifies invalid value for option `%s' in section `%s': %s\n" 8141"Configuration specifies invalid value for option `%s' in section `%s': %s\n"
@@ -8143,38 +8143,38 @@ msgstr ""
8143"Die Konfigurationsdatei muss in der Sektion `%s' unter `%s' ein Verzeichnis " 8143"Die Konfigurationsdatei muss in der Sektion `%s' unter `%s' ein Verzeichnis "
8144"angeben, in dem FS Daten gespeichert werden.\n" 8144"angeben, in dem FS Daten gespeichert werden.\n"
8145 8145
8146#: src/util/configuration.c:325 8146#: src/util/configuration.c:402
8147#, fuzzy, c-format 8147#, fuzzy, c-format
8148msgid "Syntax error while deserializing in line %u\n" 8148msgid "Syntax error while deserializing in line %u\n"
8149msgstr "Syntaxfehler in Konfigurationsdatei `%s' in Zeile %d.\n" 8149msgstr "Syntaxfehler in Konfigurationsdatei `%s' in Zeile %d.\n"
8150 8150
8151#: src/util/configuration.c:383 8151#: src/util/configuration.c:460
8152#, fuzzy, c-format 8152#, fuzzy, c-format
8153msgid "Error while reading file `%s'\n" 8153msgid "Error while reading file `%s'\n"
8154msgstr "Konfigurationsdatei `%s' konnte nicht geöffnet werden.\n" 8154msgstr "Konfigurationsdatei `%s' konnte nicht geöffnet werden.\n"
8155 8155
8156#: src/util/configuration.c:986 8156#: src/util/configuration.c:1063
8157msgid "Not a valid relative time specification" 8157msgid "Not a valid relative time specification"
8158msgstr "" 8158msgstr ""
8159 8159
8160#: src/util/configuration.c:1077 8160#: src/util/configuration.c:1154
8161#, c-format 8161#, c-format
8162msgid "" 8162msgid ""
8163"Configuration value '%s' for '%s' in section '%s' is not in set of legal " 8163"Configuration value '%s' for '%s' in section '%s' is not in set of legal "
8164"choices\n" 8164"choices\n"
8165msgstr "" 8165msgstr ""
8166 8166
8167#: src/util/configuration.c:1192 8167#: src/util/configuration.c:1269
8168#, c-format 8168#, c-format
8169msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" 8169msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n"
8170msgstr "" 8170msgstr ""
8171 8171
8172#: src/util/configuration.c:1224 8172#: src/util/configuration.c:1301
8173#, c-format 8173#, c-format
8174msgid "Missing closing `%s' in option `%s'\n" 8174msgid "Missing closing `%s' in option `%s'\n"
8175msgstr "" 8175msgstr ""
8176 8176
8177#: src/util/configuration.c:1290 8177#: src/util/configuration.c:1367
8178#, c-format 8178#, c-format
8179msgid "" 8179msgid ""
8180"Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " 8180"Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined "
@@ -8239,7 +8239,7 @@ msgstr ""
8239msgid "RSA signing failed at %s:%d: %s\n" 8239msgid "RSA signing failed at %s:%d: %s\n"
8240msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" 8240msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n"
8241 8241
8242#: src/util/crypto_rsa.c:1313 8242#: src/util/crypto_rsa.c:1314
8243#, fuzzy, c-format 8243#, fuzzy, c-format
8244msgid "RSA signature verification failed at %s:%d: %s\n" 8244msgid "RSA signature verification failed at %s:%d: %s\n"
8245msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n" 8245msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n"
@@ -8344,11 +8344,11 @@ msgstr "Die Option »%s« ergibt keinen Sinn ohne die Option »%s«.\n"
8344msgid "Missing mandatory option `%s'.\n" 8344msgid "Missing mandatory option `%s'.\n"
8345msgstr "Unbekannte Operation `%s'\n" 8345msgstr "Unbekannte Operation `%s'\n"
8346 8346
8347#: src/util/getopt_helpers.c:68 8347#: src/util/getopt_helpers.c:69
8348msgid "print the version number" 8348msgid "print the version number"
8349msgstr "" 8349msgstr ""
8350 8350
8351#: src/util/getopt_helpers.c:114 8351#: src/util/getopt_helpers.c:116
8352#, c-format 8352#, c-format
8353msgid "" 8353msgid ""
8354"Arguments mandatory for long options are also mandatory for short options.\n" 8354"Arguments mandatory for long options are also mandatory for short options.\n"
@@ -8356,55 +8356,63 @@ msgstr ""
8356"Argumente, die für lange Optionen zwingend sind, sind auch für kurze " 8356"Argumente, die für lange Optionen zwingend sind, sind auch für kurze "
8357"Optionen zwingend.\n" 8357"Optionen zwingend.\n"
8358 8358
8359#: src/util/getopt_helpers.c:205 8359#: src/util/getopt_helpers.c:208
8360msgid "print this help" 8360msgid "print this help"
8361msgstr "" 8361msgstr ""
8362 8362
8363#: src/util/getopt_helpers.c:281 8363#: src/util/getopt_helpers.c:288
8364msgid "be verbose" 8364msgid "be verbose"
8365msgstr "" 8365msgstr ""
8366 8366
8367#: src/util/getopt_helpers.c:417 8367#: src/util/getopt_helpers.c:429
8368msgid "configure logging to use LOGLEVEL" 8368msgid "configure logging to use LOGLEVEL"
8369msgstr "" 8369msgstr ""
8370 8370
8371#: src/util/getopt_helpers.c:495 8371#: src/util/getopt_helpers.c:510
8372msgid "configure logging to write logs to FILENAME" 8372msgid "configure logging to write logs to FILENAME"
8373msgstr "" 8373msgstr ""
8374 8374
8375#: src/util/getopt_helpers.c:516 8375#: src/util/getopt_helpers.c:532
8376#, fuzzy 8376#, fuzzy
8377msgid "use configuration file FILENAME" 8377msgid "use configuration file FILENAME"
8378msgstr "" 8378msgstr ""
8379"Einen Wert aus der Konfigurationsdatei auf der Standardausgabe ausgeben" 8379"Einen Wert aus der Konfigurationsdatei auf der Standardausgabe ausgeben"
8380 8380
8381#: src/util/getopt_helpers.c:551 src/util/getopt_helpers.c:747 8381#: src/util/getopt_helpers.c:568 src/util/getopt_helpers.c:634
8382#: src/util/getopt_helpers.c:810 8382#: src/util/getopt_helpers.c:835 src/util/getopt_helpers.c:900
8383#, c-format 8383#, c-format
8384msgid "You must pass a number to the `%s' option.\n" 8384msgid "You must pass a number to the `%s' option.\n"
8385msgstr "Sie müssen für die Option »%s« zusätzlich eine Zahl angeben.\n" 8385msgstr "Sie müssen für die Option »%s« zusätzlich eine Zahl angeben.\n"
8386 8386
8387#: src/util/getopt_helpers.c:612 8387#: src/util/getopt_helpers.c:659
8388msgid "[+/-]MICROSECONDS"
8389msgstr ""
8390
8391#: src/util/getopt_helpers.c:661
8392msgid "modify system time by given offset (for debugging/testing only)"
8393msgstr ""
8394
8395#: src/util/getopt_helpers.c:696
8388#, c-format 8396#, c-format
8389msgid "You must pass relative time to the `%s' option.\n" 8397msgid "You must pass relative time to the `%s' option.\n"
8390msgstr "Sie müssen eine relative Zeit zu der Option »%s« übergeben.\n" 8398msgstr "Sie müssen eine relative Zeit zu der Option »%s« übergeben.\n"
8391 8399
8392#: src/util/getopt_helpers.c:675 8400#: src/util/getopt_helpers.c:761
8393#, fuzzy, c-format 8401#, fuzzy, c-format
8394msgid "You must pass absolute time to the `%s' option.\n" 8402msgid "You must pass absolute time to the `%s' option.\n"
8395msgstr "Sie müssen eine relative Zeit zu der Option »%s« übergeben.\n" 8403msgstr "Sie müssen eine relative Zeit zu der Option »%s« übergeben.\n"
8396 8404
8397#: src/util/getopt_helpers.c:740 8405#: src/util/getopt_helpers.c:828
8398#, c-format 8406#, c-format
8399msgid "Your input for the '%s' option has to be a non negative number \n" 8407msgid "Your input for the '%s' option has to be a non negative number\n"
8400msgstr "" 8408msgstr ""
8401 8409
8402#: src/util/getopt_helpers.c:817 8410#: src/util/getopt_helpers.c:907
8403#, fuzzy, c-format 8411#, fuzzy, c-format
8404msgid "You must pass a number below %u to the `%s' option.\n" 8412msgid "You must pass a number below %u to the `%s' option.\n"
8405msgstr "Sie müssen für die Option »%s« zusätzlich eine Zahl angeben.\n" 8413msgstr "Sie müssen für die Option »%s« zusätzlich eine Zahl angeben.\n"
8406 8414
8407#: src/util/getopt_helpers.c:902 8415#: src/util/getopt_helpers.c:994
8408#, c-format 8416#, c-format
8409msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 8417msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
8410msgstr "" 8418msgstr ""
@@ -8746,14 +8754,14 @@ msgstr "Standarddienst »%s« ist nicht korrekt eingerichtet!\n"
8746msgid "Could not resolve our FQDN: %s\n" 8754msgid "Could not resolve our FQDN: %s\n"
8747msgstr "`%s' konnte nicht aufgelöst werden: %s\n" 8755msgstr "`%s' konnte nicht aufgelöst werden: %s\n"
8748 8756
8749#: src/util/service.c:657 8757#: src/util/service.c:654
8750#, c-format 8758#, c-format
8751msgid "" 8759msgid ""
8752"Processing code for message of type %u did not call " 8760"Processing code for message of type %u did not call "
8753"`GNUNET_SERVICE_client_continue' after %s\n" 8761"`GNUNET_SERVICE_client_continue' after %s\n"
8754msgstr "" 8762msgstr ""
8755 8763
8756#: src/util/service.c:1572 8764#: src/util/service.c:1569
8757msgid "" 8765msgid ""
8758"Could not bind to any of the ports I was supposed to, refusing to run!\n" 8766"Could not bind to any of the ports I was supposed to, refusing to run!\n"
8759msgstr "" 8767msgstr ""
@@ -9067,8 +9075,8 @@ msgstr "Dienst wird über UDP angeboten"
9067msgid "Setup tunnels via VPN." 9075msgid "Setup tunnels via VPN."
9068msgstr "Tunnel über VPN einrichten." 9076msgstr "Tunnel über VPN einrichten."
9069 9077
9070#: src/zonemaster/gnunet-service-zonemaster-monitor.c:420
9071#: src/zonemaster/gnunet-service-zonemaster.c:849 9078#: src/zonemaster/gnunet-service-zonemaster.c:849
9079#: src/zonemaster/gnunet-service-zonemaster-monitor.c:420
9072#, fuzzy 9080#, fuzzy
9073msgid "Failed to connect to the namestore!\n" 9081msgid "Failed to connect to the namestore!\n"
9074msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" 9082msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
diff --git a/po/it.po b/po/it.po
index 58c8b81ac..986bc8b64 100644
--- a/po/it.po
+++ b/po/it.po
@@ -8,7 +8,7 @@ msgid ""
8msgstr "" 8msgstr ""
9"Project-Id-Version: gnunet 0.10.1\n" 9"Project-Id-Version: gnunet 0.10.1\n"
10"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 10"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
11"POT-Creation-Date: 2020-01-13 14:01+0000\n" 11"POT-Creation-Date: 2020-02-13 20:41+0100\n"
12"PO-Revision-Date: 2019-10-16 11:00+0200\n" 12"PO-Revision-Date: 2019-10-16 11:00+0200\n"
13"Last-Translator: Sebastiano Pistore <sebastianopistore.info@protonmail.ch>\n" 13"Last-Translator: Sebastiano Pistore <sebastianopistore.info@protonmail.ch>\n"
14"Language-Team: Italian <tp@lists.linux.it>\n" 14"Language-Team: Italian <tp@lists.linux.it>\n"
@@ -31,8 +31,8 @@ msgid "Issuer public key `%s' is not well-formed\n"
31msgstr "" 31msgstr ""
32 32
33#: src/abd/gnunet-abd.c:558 src/abd/gnunet-service-abd.c:1747 33#: src/abd/gnunet-abd.c:558 src/abd/gnunet-service-abd.c:1747
34#: src/namestore/gnunet-namestore-fcfsd.c:1153
35#: src/namestore/gnunet-namestore.c:1001 34#: src/namestore/gnunet-namestore.c:1001
35#: src/namestore/gnunet-namestore-fcfsd.c:1153
36#, c-format 36#, c-format
37msgid "Failed to connect to namestore\n" 37msgid "Failed to connect to namestore\n"
38msgstr "" 38msgstr ""
@@ -140,7 +140,7 @@ msgstr ""
140msgid "GNUnet abd resolver tool" 140msgid "GNUnet abd resolver tool"
141msgstr "" 141msgstr ""
142 142
143#: src/abd/gnunet-service-abd.c:1742 src/gns/gnunet-gns.c:288 143#: src/abd/gnunet-service-abd.c:1742 src/gns/gnunet-gns.c:292
144#, c-format 144#, c-format
145msgid "Failed to connect to GNS\n" 145msgid "Failed to connect to GNS\n"
146msgstr "" 146msgstr ""
@@ -376,28 +376,28 @@ msgstr ""
376#: src/transport/plugin_transport_tcp.c:1129 376#: src/transport/plugin_transport_tcp.c:1129
377#: src/transport/plugin_transport_tcp.c:3706 377#: src/transport/plugin_transport_tcp.c:3706
378#: src/transport/tcp_service_legacy.c:594 378#: src/transport/tcp_service_legacy.c:594
379#: src/transport/tcp_service_legacy.c:600 src/util/service.c:1094 379#: src/transport/tcp_service_legacy.c:600 src/util/service.c:1091
380#: src/util/service.c:1100 380#: src/util/service.c:1097
381#, c-format 381#, c-format
382msgid "Require valid port number for service `%s' in configuration!\n" 382msgid "Require valid port number for service `%s' in configuration!\n"
383msgstr "" 383msgstr ""
384 384
385#: src/arm/gnunet-service-arm.c:452 src/transport/plugin_transport_tcp.c:1163 385#: src/arm/gnunet-service-arm.c:452 src/transport/plugin_transport_tcp.c:1163
386#: src/transport/tcp_service_legacy.c:634 src/util/client.c:519 386#: src/transport/tcp_service_legacy.c:634 src/util/client.c:527
387#: src/util/service.c:1133 387#: src/util/service.c:1130
388#, c-format 388#, c-format
389msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 389msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
390msgstr "" 390msgstr ""
391 391
392#: src/arm/gnunet-service-arm.c:456 src/transport/plugin_transport_tcp.c:1167 392#: src/arm/gnunet-service-arm.c:456 src/transport/plugin_transport_tcp.c:1167
393#: src/transport/tcp_service_legacy.c:638 src/util/client.c:524 393#: src/transport/tcp_service_legacy.c:638 src/util/client.c:532
394#: src/util/service.c:1137 394#: src/util/service.c:1134
395#, c-format 395#, c-format
396msgid "Using `%s' instead\n" 396msgid "Using `%s' instead\n"
397msgstr "" 397msgstr ""
398 398
399#: src/arm/gnunet-service-arm.c:484 src/transport/plugin_transport_tcp.c:1195 399#: src/arm/gnunet-service-arm.c:484 src/transport/plugin_transport_tcp.c:1195
400#: src/transport/tcp_service_legacy.c:666 src/util/service.c:1157 400#: src/transport/tcp_service_legacy.c:666 src/util/service.c:1154
401#, c-format 401#, c-format
402msgid "" 402msgid ""
403"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 403"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
@@ -405,7 +405,7 @@ msgid ""
405msgstr "" 405msgstr ""
406 406
407#: src/arm/gnunet-service-arm.c:505 src/transport/plugin_transport_tcp.c:1213 407#: src/arm/gnunet-service-arm.c:505 src/transport/plugin_transport_tcp.c:1213
408#: src/transport/tcp_service_legacy.c:684 src/util/service.c:1175 408#: src/transport/tcp_service_legacy.c:684 src/util/service.c:1172
409#, c-format 409#, c-format
410msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 410msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
411msgstr "" 411msgstr ""
@@ -413,7 +413,7 @@ msgstr ""
413#: src/arm/gnunet-service-arm.c:536 413#: src/arm/gnunet-service-arm.c:536
414#: src/transport/plugin_transport_http_server.c:2718 414#: src/transport/plugin_transport_http_server.c:2718
415#: src/transport/plugin_transport_tcp.c:1244 415#: src/transport/plugin_transport_tcp.c:1244
416#: src/transport/tcp_service_legacy.c:715 src/util/service.c:1206 416#: src/transport/tcp_service_legacy.c:715 src/util/service.c:1203
417#, c-format 417#, c-format
418msgid "Failed to resolve `%s': %s\n" 418msgid "Failed to resolve `%s': %s\n"
419msgstr "" 419msgstr ""
@@ -421,7 +421,7 @@ msgstr ""
421#: src/arm/gnunet-service-arm.c:555 421#: src/arm/gnunet-service-arm.c:555
422#: src/transport/plugin_transport_http_server.c:2736 422#: src/transport/plugin_transport_http_server.c:2736
423#: src/transport/plugin_transport_tcp.c:1263 423#: src/transport/plugin_transport_tcp.c:1263
424#: src/transport/tcp_service_legacy.c:734 src/util/service.c:1225 424#: src/transport/tcp_service_legacy.c:734 src/util/service.c:1222
425#, c-format 425#, c-format
426msgid "Failed to find %saddress for `%s'.\n" 426msgid "Failed to find %saddress for `%s'.\n"
427msgstr "" 427msgstr ""
@@ -492,13 +492,80 @@ msgstr ""
492msgid "Initiating shutdown as requested by client.\n" 492msgid "Initiating shutdown as requested by client.\n"
493msgstr "" 493msgstr ""
494 494
495#: src/ats-tests/ats-testing-log.c:896 495#: src/ats/gnunet-ats-solver-eval.c:2992 src/ats/gnunet-ats-solver-eval.c:3044
496msgid "Stop logging\n" 496#, c-format
497msgid ""
498"Could not load quota for network `%s': `%s', assigning default bandwidth "
499"%llu\n"
497msgstr "" 500msgstr ""
498 501
499#: src/ats-tests/ats-testing-log.c:952 502#: src/ats/gnunet-ats-solver-eval.c:3011
500#, c-format 503#, c-format
501msgid "Start logging `%s'\n" 504msgid ""
505"No outbound quota configured for network `%s', assigning default bandwidth "
506"%llu\n"
507msgstr ""
508
509#: src/ats/gnunet-ats-solver-eval.c:3063
510#, c-format
511msgid ""
512"No outbound quota configure for network `%s', assigning default bandwidth "
513"%llu\n"
514msgstr ""
515
516#: src/ats/gnunet-ats-solver-eval.c:3552 src/ats-tests/gnunet-solver-eval.c:997
517msgid "solver to use"
518msgstr ""
519
520#: src/ats/gnunet-ats-solver-eval.c:3557
521#: src/ats-tests/gnunet-solver-eval.c:1003
522#: src/ats-tests/gnunet-solver-eval.c:1008
523msgid "experiment to use"
524msgstr ""
525
526#: src/ats/gnunet-ats-solver-eval.c:3564
527msgid "print logging"
528msgstr ""
529
530#: src/ats/gnunet-ats-solver-eval.c:3569
531msgid "save logging to disk"
532msgstr ""
533
534#: src/ats/gnunet-ats-solver-eval.c:3574
535msgid "disable normalization"
536msgstr ""
537
538#: src/ats/gnunet-service-ats_plugins.c:326
539#, c-format
540msgid ""
541"Could not load %s quota for network `%s': `%s', assigning default bandwidth "
542"%llu\n"
543msgstr ""
544
545#: src/ats/gnunet-service-ats_plugins.c:336
546#, c-format
547msgid "%s quota configured for network `%s' is %llu\n"
548msgstr ""
549
550#: src/ats/gnunet-service-ats_plugins.c:382
551#, c-format
552msgid ""
553"No %s-quota configured for network `%s', assigning default bandwidth %llu\n"
554msgstr ""
555
556#: src/ats/gnunet-service-ats_plugins.c:474
557#, c-format
558msgid "Failed to initialize solver `%s'!\n"
559msgstr ""
560
561#: src/ats/plugin_ats_proportional.c:1140
562#, c-format
563msgid "Invalid %s configuration %f \n"
564msgstr ""
565
566#: src/ats/plugin_ats_proportional.c:1163
567#, c-format
568msgid "Invalid %s configuration %f\n"
502msgstr "" 569msgstr ""
503 570
504#: src/ats-tests/ats-testing.c:420 571#: src/ats-tests/ats-testing.c:420
@@ -511,6 +578,15 @@ msgstr ""
511msgid "Failed to connect master peer [%u] with slave [%u]\n" 578msgid "Failed to connect master peer [%u] with slave [%u]\n"
512msgstr "" 579msgstr ""
513 580
581#: src/ats-tests/ats-testing-log.c:896
582msgid "Stop logging\n"
583msgstr ""
584
585#: src/ats-tests/ats-testing-log.c:952
586#, c-format
587msgid "Start logging `%s'\n"
588msgstr ""
589
514#: src/ats-tests/gnunet-ats-sim.c:92 590#: src/ats-tests/gnunet-ats-sim.c:92
515#, c-format 591#, c-format
516msgid "" 592msgid ""
@@ -518,16 +594,6 @@ msgid ""
518"= %u KiB/s\n" 594"= %u KiB/s\n"
519msgstr "" 595msgstr ""
520 596
521#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552
522msgid "solver to use"
523msgstr ""
524
525#: src/ats-tests/gnunet-solver-eval.c:1003
526#: src/ats-tests/gnunet-solver-eval.c:1008
527#: src/ats/gnunet-ats-solver-eval.c:3557
528msgid "experiment to use"
529msgstr ""
530
531#: src/ats-tool/gnunet-ats.c:299 597#: src/ats-tool/gnunet-ats.c:299
532#, c-format 598#, c-format
533msgid "%u address resolutions had a timeout\n" 599msgid "%u address resolutions had a timeout\n"
@@ -644,72 +710,6 @@ msgstr ""
644msgid "Print information about ATS state" 710msgid "Print information about ATS state"
645msgstr "" 711msgstr ""
646 712
647#: src/ats/gnunet-ats-solver-eval.c:2992 src/ats/gnunet-ats-solver-eval.c:3044
648#, c-format
649msgid ""
650"Could not load quota for network `%s': `%s', assigning default bandwidth "
651"%llu\n"
652msgstr ""
653
654#: src/ats/gnunet-ats-solver-eval.c:3011
655#, c-format
656msgid ""
657"No outbound quota configured for network `%s', assigning default bandwidth "
658"%llu\n"
659msgstr ""
660
661#: src/ats/gnunet-ats-solver-eval.c:3063
662#, c-format
663msgid ""
664"No outbound quota configure for network `%s', assigning default bandwidth "
665"%llu\n"
666msgstr ""
667
668#: src/ats/gnunet-ats-solver-eval.c:3564
669msgid "print logging"
670msgstr ""
671
672#: src/ats/gnunet-ats-solver-eval.c:3569
673msgid "save logging to disk"
674msgstr ""
675
676#: src/ats/gnunet-ats-solver-eval.c:3574
677msgid "disable normalization"
678msgstr ""
679
680#: src/ats/gnunet-service-ats_plugins.c:326
681#, c-format
682msgid ""
683"Could not load %s quota for network `%s': `%s', assigning default bandwidth "
684"%llu\n"
685msgstr ""
686
687#: src/ats/gnunet-service-ats_plugins.c:336
688#, c-format
689msgid "%s quota configured for network `%s' is %llu\n"
690msgstr ""
691
692#: src/ats/gnunet-service-ats_plugins.c:382
693#, c-format
694msgid ""
695"No %s-quota configured for network `%s', assigning default bandwidth %llu\n"
696msgstr ""
697
698#: src/ats/gnunet-service-ats_plugins.c:474
699#, c-format
700msgid "Failed to initialize solver `%s'!\n"
701msgstr ""
702
703#: src/ats/plugin_ats_proportional.c:1140
704#, c-format
705msgid "Invalid %s configuration %f \n"
706msgstr ""
707
708#: src/ats/plugin_ats_proportional.c:1163
709#, c-format
710msgid "Invalid %s configuration %f\n"
711msgstr ""
712
713#: src/auction/gnunet-auction-create.c:163 713#: src/auction/gnunet-auction-create.c:163
714msgid "description of the item to be sold" 714msgid "description of the item to be sold"
715msgstr "" 715msgstr ""
@@ -836,28 +836,6 @@ msgstr ""
836msgid "Connection to conversation service lost, trying to reconnect\n" 836msgid "Connection to conversation service lost, trying to reconnect\n"
837msgstr "" 837msgstr ""
838 838
839#: src/conversation/gnunet-conversation-test.c:120
840#, c-format
841msgid ""
842"\n"
843"End of transmission. Have a GNU day.\n"
844msgstr ""
845
846#: src/conversation/gnunet-conversation-test.c:146
847#, c-format
848msgid ""
849"\n"
850"We are now playing your recording back. If you can hear it, your audio "
851"settings are working..."
852msgstr ""
853
854#: src/conversation/gnunet-conversation-test.c:218
855#, c-format
856msgid ""
857"We will now be recording you for %s. After that time, the recording will be "
858"played back to you..."
859msgstr ""
860
861#: src/conversation/gnunet-conversation.c:264 839#: src/conversation/gnunet-conversation.c:264
862#, c-format 840#, c-format
863msgid "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n" 841msgid "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n"
@@ -1114,8 +1092,30 @@ msgstr ""
1114msgid "Enables having a conversation with other GNUnet users." 1092msgid "Enables having a conversation with other GNUnet users."
1115msgstr "" 1093msgstr ""
1116 1094
1117#: src/conversation/gnunet-helper-audio-playback-gst.c:363 1095#: src/conversation/gnunet-conversation-test.c:120
1096#, c-format
1097msgid ""
1098"\n"
1099"End of transmission. Have a GNU day.\n"
1100msgstr ""
1101
1102#: src/conversation/gnunet-conversation-test.c:146
1103#, c-format
1104msgid ""
1105"\n"
1106"We are now playing your recording back. If you can hear it, your audio "
1107"settings are working..."
1108msgstr ""
1109
1110#: src/conversation/gnunet-conversation-test.c:218
1111#, c-format
1112msgid ""
1113"We will now be recording you for %s. After that time, the recording will be "
1114"played back to you..."
1115msgstr ""
1116
1118#: src/conversation/gnunet_gst.c:664 1117#: src/conversation/gnunet_gst.c:664
1118#: src/conversation/gnunet-helper-audio-playback-gst.c:363
1119#, c-format 1119#, c-format
1120msgid "Read error from STDIN: %d %s\n" 1120msgid "Read error from STDIN: %d %s\n"
1121msgstr "" 1121msgstr ""
@@ -1887,16 +1887,16 @@ msgstr ""
1887msgid "Mysql database running\n" 1887msgid "Mysql database running\n"
1888msgstr "" 1888msgstr ""
1889 1889
1890#: src/datastore/plugin_datastore_postgres.c:277 1890#: src/datastore/plugin_datastore_postgres.c:278
1891#: src/datastore/plugin_datastore_postgres.c:890 1891#: src/datastore/plugin_datastore_postgres.c:891
1892msgid "Postgress exec failure" 1892msgid "Postgress exec failure"
1893msgstr "" 1893msgstr ""
1894 1894
1895#: src/datastore/plugin_datastore_postgres.c:851 1895#: src/datastore/plugin_datastore_postgres.c:852
1896msgid "Failed to drop table from database.\n" 1896msgid "Failed to drop table from database.\n"
1897msgstr "" 1897msgstr ""
1898 1898
1899#: src/datastore/plugin_datastore_postgres.c:949 1899#: src/datastore/plugin_datastore_postgres.c:950
1900msgid "Postgres database running\n" 1900msgid "Postgres database running\n"
1901msgstr "" 1901msgstr ""
1902 1902
@@ -2003,6 +2003,52 @@ msgstr ""
2003msgid "Prints all packets that go through the DHT." 2003msgid "Prints all packets that go through the DHT."
2004msgstr "" 2004msgstr ""
2005 2005
2006#: src/dht/gnunet_dht_profiler.c:922 src/testbed/gnunet-testbed-profiler.c:255
2007#, c-format
2008msgid "Exiting as the number of peers is %u\n"
2009msgstr ""
2010
2011#: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194
2012msgid "number of peers to start"
2013msgstr ""
2014
2015#: src/dht/gnunet_dht_profiler.c:961
2016msgid "number of PUTs to perform per peer"
2017msgstr ""
2018
2019#: src/dht/gnunet_dht_profiler.c:967 src/nse/gnunet-nse-profiler.c:872
2020#: src/testbed/gnunet-testbed-profiler.c:305
2021msgid "name of the file with the login information for the testbed"
2022msgstr ""
2023
2024#: src/dht/gnunet_dht_profiler.c:973
2025msgid "delay between rounds for collecting statistics (default: 30 sec)"
2026msgstr ""
2027
2028#: src/dht/gnunet_dht_profiler.c:979
2029msgid "delay to start doing PUTs (default: 1 sec)"
2030msgstr ""
2031
2032#: src/dht/gnunet_dht_profiler.c:985
2033msgid "delay to start doing GETs (default: 5 min)"
2034msgstr ""
2035
2036#: src/dht/gnunet_dht_profiler.c:990
2037msgid "replication degree for DHT PUTs"
2038msgstr ""
2039
2040#: src/dht/gnunet_dht_profiler.c:996
2041msgid "chance that a peer is selected at random for PUTs"
2042msgstr ""
2043
2044#: src/dht/gnunet_dht_profiler.c:1002
2045msgid "timeout for DHT PUT and GET requests (default: 1 min)"
2046msgstr ""
2047
2048#: src/dht/gnunet_dht_profiler.c:1023
2049msgid "Measure quality and performance of the DHT service."
2050msgstr ""
2051
2006#: src/dht/gnunet-dht-put.c:133 2052#: src/dht/gnunet-dht-put.c:133
2007msgid "Must provide KEY and DATA for DHT put!\n" 2053msgid "Must provide KEY and DATA for DHT put!\n"
2008msgstr "" 2054msgstr ""
@@ -2248,52 +2294,6 @@ msgstr ""
2248msgid "# DHT requests combined" 2294msgid "# DHT requests combined"
2249msgstr "" 2295msgstr ""
2250 2296
2251#: src/dht/gnunet_dht_profiler.c:922 src/testbed/gnunet-testbed-profiler.c:255
2252#, c-format
2253msgid "Exiting as the number of peers is %u\n"
2254msgstr ""
2255
2256#: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194
2257msgid "number of peers to start"
2258msgstr ""
2259
2260#: src/dht/gnunet_dht_profiler.c:961
2261msgid "number of PUTs to perform per peer"
2262msgstr ""
2263
2264#: src/dht/gnunet_dht_profiler.c:967 src/nse/gnunet-nse-profiler.c:872
2265#: src/testbed/gnunet-testbed-profiler.c:305
2266msgid "name of the file with the login information for the testbed"
2267msgstr ""
2268
2269#: src/dht/gnunet_dht_profiler.c:973
2270msgid "delay between rounds for collecting statistics (default: 30 sec)"
2271msgstr ""
2272
2273#: src/dht/gnunet_dht_profiler.c:979
2274msgid "delay to start doing PUTs (default: 1 sec)"
2275msgstr ""
2276
2277#: src/dht/gnunet_dht_profiler.c:985
2278msgid "delay to start doing GETs (default: 5 min)"
2279msgstr ""
2280
2281#: src/dht/gnunet_dht_profiler.c:990
2282msgid "replication degree for DHT PUTs"
2283msgstr ""
2284
2285#: src/dht/gnunet_dht_profiler.c:996
2286msgid "chance that a peer is selected at random for PUTs"
2287msgstr ""
2288
2289#: src/dht/gnunet_dht_profiler.c:1002
2290msgid "timeout for DHT PUT and GET requests (default: 1 min)"
2291msgstr ""
2292
2293#: src/dht/gnunet_dht_profiler.c:1023
2294msgid "Measure quality and performance of the DHT service."
2295msgstr ""
2296
2297#: src/dht/plugin_block_dht.c:189 2297#: src/dht/plugin_block_dht.c:189
2298#, c-format 2298#, c-format
2299msgid "Block not of type %u\n" 2299msgid "Block not of type %u\n"
@@ -3203,6 +3203,14 @@ msgid ""
3203"chk/...)" 3203"chk/...)"
3204msgstr "" 3204msgstr ""
3205 3205
3206#: src/fs/gnunet-fs.c:128
3207msgid "print a list of all indexed files"
3208msgstr ""
3209
3210#: src/fs/gnunet-fs.c:141
3211msgid "Special file-sharing operations"
3212msgstr ""
3213
3206#: src/fs/gnunet-fs-profiler.c:211 3214#: src/fs/gnunet-fs-profiler.c:211
3207msgid "run the experiment with COUNT peers" 3215msgid "run the experiment with COUNT peers"
3208msgstr "" 3216msgstr ""
@@ -3219,14 +3227,6 @@ msgstr ""
3219msgid "run a testbed to measure file-sharing performance" 3227msgid "run a testbed to measure file-sharing performance"
3220msgstr "" 3228msgstr ""
3221 3229
3222#: src/fs/gnunet-fs.c:128
3223msgid "print a list of all indexed files"
3224msgstr ""
3225
3226#: src/fs/gnunet-fs.c:141
3227msgid "Special file-sharing operations"
3228msgstr ""
3229
3230#: src/fs/gnunet-publish.c:219 src/fs/gnunet-publish.c:234 3230#: src/fs/gnunet-publish.c:219 src/fs/gnunet-publish.c:234
3231#, c-format 3231#, c-format
3232msgid "Publishing `%s' at %llu/%llu (%s remaining)\n" 3232msgid "Publishing `%s' at %llu/%llu (%s remaining)\n"
@@ -3881,6 +3881,49 @@ msgstr ""
3881msgid "look for GNS2DNS records instead of ANY" 3881msgid "look for GNS2DNS records instead of ANY"
3882msgstr "" 3882msgstr ""
3883 3883
3884#: src/gns/gnunet-gns.c:257
3885#, fuzzy, c-format
3886msgid "`%s' is not a valid DNS domain name\n"
3887msgstr "`%s' non è un indirizzo IP valido.\n"
3888
3889#: src/gns/gnunet-gns.c:267 src/util/dnsparser.c:254
3890#, c-format
3891msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
3892msgstr ""
3893
3894#: src/gns/gnunet-gns.c:281
3895msgid "Cannot resolve using GNS: GNUnet peer not running\n"
3896msgstr ""
3897
3898#: src/gns/gnunet-gns.c:305
3899#, c-format
3900msgid "Invalid typename specified, assuming `ANY'\n"
3901msgstr ""
3902
3903#: src/gns/gnunet-gns.c:340
3904msgid "Lookup a record for the given name"
3905msgstr ""
3906
3907#: src/gns/gnunet-gns.c:346
3908msgid "Specify the type of the record to lookup"
3909msgstr ""
3910
3911#: src/gns/gnunet-gns.c:352
3912msgid "Specify a timeout for the lookup"
3913msgstr ""
3914
3915#: src/gns/gnunet-gns.c:356
3916msgid "No unneeded output"
3917msgstr ""
3918
3919#: src/gns/gnunet-gns.c:361
3920msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
3921msgstr ""
3922
3923#: src/gns/gnunet-gns.c:375
3924msgid "GNUnet GNS resolver tool"
3925msgstr ""
3926
3884#: src/gns/gnunet-gns-import.c:486 3927#: src/gns/gnunet-gns-import.c:486
3885msgid "This program will import some GNS authorities into your GNS namestore." 3928msgid "This program will import some GNS authorities into your GNS namestore."
3886msgstr "" 3929msgstr ""
@@ -4000,49 +4043,6 @@ msgstr ""
4000msgid "GNUnet GNS proxy" 4043msgid "GNUnet GNS proxy"
4001msgstr "" 4044msgstr ""
4002 4045
4003#: src/gns/gnunet-gns.c:253
4004#, fuzzy, c-format
4005msgid "`%s' is not a valid DNS domain name\n"
4006msgstr "`%s' non è un indirizzo IP valido.\n"
4007
4008#: src/gns/gnunet-gns.c:263 src/util/dnsparser.c:254
4009#, c-format
4010msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
4011msgstr ""
4012
4013#: src/gns/gnunet-gns.c:277
4014msgid "Cannot resolve using GNS: GNUnet peer not running\n"
4015msgstr ""
4016
4017#: src/gns/gnunet-gns.c:301
4018#, c-format
4019msgid "Invalid typename specified, assuming `ANY'\n"
4020msgstr ""
4021
4022#: src/gns/gnunet-gns.c:336
4023msgid "Lookup a record for the given name"
4024msgstr ""
4025
4026#: src/gns/gnunet-gns.c:342
4027msgid "Specify the type of the record to lookup"
4028msgstr ""
4029
4030#: src/gns/gnunet-gns.c:348
4031msgid "Specify a timeout for the lookup"
4032msgstr ""
4033
4034#: src/gns/gnunet-gns.c:352
4035msgid "No unneeded output"
4036msgstr ""
4037
4038#: src/gns/gnunet-gns.c:357
4039msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
4040msgstr ""
4041
4042#: src/gns/gnunet-gns.c:371
4043msgid "GNUnet GNS resolver tool"
4044msgstr ""
4045
4046#: src/gns/gnunet-service-gns.c:505 4046#: src/gns/gnunet-service-gns.c:505
4047#, fuzzy 4047#, fuzzy
4048msgid "Properly base32-encoded public key required" 4048msgid "Properly base32-encoded public key required"
@@ -4053,8 +4053,8 @@ msgid "Failed to connect to the namecache!\n"
4053msgstr "" 4053msgstr ""
4054 4054
4055#: src/gns/gnunet-service-gns.c:560 4055#: src/gns/gnunet-service-gns.c:560
4056#: src/zonemaster/gnunet-service-zonemaster-monitor.c:444
4057#: src/zonemaster/gnunet-service-zonemaster.c:887 4056#: src/zonemaster/gnunet-service-zonemaster.c:887
4057#: src/zonemaster/gnunet-service-zonemaster-monitor.c:444
4058msgid "Could not connect to DHT!\n" 4058msgid "Could not connect to DHT!\n"
4059msgstr "" 4059msgstr ""
4060 4060
@@ -4110,21 +4110,21 @@ msgstr ""
4110msgid "GNS lookup failed (zero records found for `%s')\n" 4110msgid "GNS lookup failed (zero records found for `%s')\n"
4111msgstr "" 4111msgstr ""
4112 4112
4113#: src/gns/gnunet-service-gns_resolver.c:2376 4113#: src/gns/gnunet-service-gns_resolver.c:2372
4114msgid "GNS lookup recursion failed (no delegation record found)\n" 4114msgid "GNS lookup recursion failed (no delegation record found)\n"
4115msgstr "" 4115msgstr ""
4116 4116
4117#: src/gns/gnunet-service-gns_resolver.c:2399 4117#: src/gns/gnunet-service-gns_resolver.c:2395
4118#, c-format 4118#, c-format
4119msgid "Failed to cache GNS resolution: %s\n" 4119msgid "Failed to cache GNS resolution: %s\n"
4120msgstr "" 4120msgstr ""
4121 4121
4122#: src/gns/gnunet-service-gns_resolver.c:2567 4122#: src/gns/gnunet-service-gns_resolver.c:2563
4123#, c-format 4123#, c-format
4124msgid "GNS namecache returned empty result for `%s'\n" 4124msgid "GNS namecache returned empty result for `%s'\n"
4125msgstr "" 4125msgstr ""
4126 4126
4127#: src/gns/gnunet-service-gns_resolver.c:2707 4127#: src/gns/gnunet-service-gns_resolver.c:2703
4128#, c-format 4128#, c-format
4129msgid "Zone %s was revoked, resolution fails\n" 4129msgid "Zone %s was revoked, resolution fails\n"
4130msgstr "" 4130msgstr ""
@@ -4784,68 +4784,6 @@ msgstr ""
4784msgid "Failed to setup database at `%s'\n" 4784msgid "Failed to setup database at `%s'\n"
4785msgstr "Impossibile avviare il servizio ' %s'\n" 4785msgstr "Impossibile avviare il servizio ' %s'\n"
4786 4786
4787#: src/namestore/gnunet-namestore-fcfsd.c:551
4788#, c-format
4789msgid "Unsupported form value `%s'\n"
4790msgstr ""
4791
4792#: src/namestore/gnunet-namestore-fcfsd.c:578
4793#, c-format
4794msgid "Failed to create record for domain `%s': %s\n"
4795msgstr ""
4796
4797#: src/namestore/gnunet-namestore-fcfsd.c:599
4798msgid "Error when mapping zone to name\n"
4799msgstr ""
4800
4801#: src/namestore/gnunet-namestore-fcfsd.c:631
4802#, c-format
4803msgid "Found existing name `%s' for the given key\n"
4804msgstr ""
4805
4806#: src/namestore/gnunet-namestore-fcfsd.c:693
4807#, c-format
4808msgid "Found %u existing records for domain `%s'\n"
4809msgstr ""
4810
4811#: src/namestore/gnunet-namestore-fcfsd.c:783
4812#, c-format
4813msgid "Failed to create page for `%s'\n"
4814msgstr ""
4815
4816#: src/namestore/gnunet-namestore-fcfsd.c:802
4817#, c-format
4818msgid "Failed to setup post processor for `%s'\n"
4819msgstr ""
4820
4821#: src/namestore/gnunet-namestore-fcfsd.c:839
4822msgid "Domain name must not contain `.'\n"
4823msgstr ""
4824
4825#: src/namestore/gnunet-namestore-fcfsd.c:848
4826msgid "Domain name must not contain `+'\n"
4827msgstr ""
4828
4829#: src/namestore/gnunet-namestore-fcfsd.c:1083
4830msgid "No ego configured for `fcfsd` subsystem\n"
4831msgstr ""
4832
4833#: src/namestore/gnunet-namestore-fcfsd.c:1114
4834msgid "Failed to start HTTP server\n"
4835msgstr "Impossibile avviare il server HTTP\n"
4836
4837#: src/namestore/gnunet-namestore-fcfsd.c:1162
4838msgid "Failed to connect to identity\n"
4839msgstr ""
4840
4841#: src/namestore/gnunet-namestore-fcfsd.c:1189
4842msgid "name of the zone that is to be managed by FCFSD"
4843msgstr ""
4844
4845#: src/namestore/gnunet-namestore-fcfsd.c:1209
4846msgid "GNU Name System First Come First Serve name registration service"
4847msgstr ""
4848
4849#: src/namestore/gnunet-namestore.c:334 4787#: src/namestore/gnunet-namestore.c:334
4850#, c-format 4788#, c-format
4851msgid "Adding record failed: %s\n" 4789msgid "Adding record failed: %s\n"
@@ -5065,7 +5003,69 @@ msgstr ""
5065msgid "name of the ego controlling the zone" 5003msgid "name of the ego controlling the zone"
5066msgstr "" 5004msgstr ""
5067 5005
5068#: src/namestore/gnunet-service-namestore.c:864 5006#: src/namestore/gnunet-namestore-fcfsd.c:551
5007#, c-format
5008msgid "Unsupported form value `%s'\n"
5009msgstr ""
5010
5011#: src/namestore/gnunet-namestore-fcfsd.c:578
5012#, c-format
5013msgid "Failed to create record for domain `%s': %s\n"
5014msgstr ""
5015
5016#: src/namestore/gnunet-namestore-fcfsd.c:599
5017msgid "Error when mapping zone to name\n"
5018msgstr ""
5019
5020#: src/namestore/gnunet-namestore-fcfsd.c:631
5021#, c-format
5022msgid "Found existing name `%s' for the given key\n"
5023msgstr ""
5024
5025#: src/namestore/gnunet-namestore-fcfsd.c:693
5026#, c-format
5027msgid "Found %u existing records for domain `%s'\n"
5028msgstr ""
5029
5030#: src/namestore/gnunet-namestore-fcfsd.c:783
5031#, c-format
5032msgid "Failed to create page for `%s'\n"
5033msgstr ""
5034
5035#: src/namestore/gnunet-namestore-fcfsd.c:802
5036#, c-format
5037msgid "Failed to setup post processor for `%s'\n"
5038msgstr ""
5039
5040#: src/namestore/gnunet-namestore-fcfsd.c:839
5041msgid "Domain name must not contain `.'\n"
5042msgstr ""
5043
5044#: src/namestore/gnunet-namestore-fcfsd.c:848
5045msgid "Domain name must not contain `+'\n"
5046msgstr ""
5047
5048#: src/namestore/gnunet-namestore-fcfsd.c:1083
5049msgid "No ego configured for `fcfsd` subsystem\n"
5050msgstr ""
5051
5052#: src/namestore/gnunet-namestore-fcfsd.c:1114
5053msgid "Failed to start HTTP server\n"
5054msgstr "Impossibile avviare il server HTTP\n"
5055
5056#: src/namestore/gnunet-namestore-fcfsd.c:1162
5057msgid "Failed to connect to identity\n"
5058msgstr ""
5059
5060#: src/namestore/gnunet-namestore-fcfsd.c:1189
5061msgid "name of the zone that is to be managed by FCFSD"
5062msgstr ""
5063
5064#: src/namestore/gnunet-namestore-fcfsd.c:1209
5065msgid "GNU Name System First Come First Serve name registration service"
5066msgstr ""
5067
5068#: src/namestore/gnunet-service-namestore.c:866
5069#, c-format 5069#, c-format
5070msgid "Failed to replicate block in namecache: %s\n" 5070msgid "Failed to replicate block in namecache: %s\n"
5071msgstr "" 5071msgstr ""
@@ -5371,6 +5371,10 @@ msgstr ""
5371msgid "`upnpc' command not found\n" 5371msgid "`upnpc' command not found\n"
5372msgstr "" 5372msgstr ""
5373 5373
5374#: src/nse/gnunet-nse.c:124
5375msgid "Show network size estimates from NSE service."
5376msgstr ""
5377
5374#: src/nse/gnunet-nse-profiler.c:857 5378#: src/nse/gnunet-nse-profiler.c:857
5375msgid "limit to the number of connections to NSE services, 0 for none" 5379msgid "limit to the number of connections to NSE services, 0 for none"
5376msgstr "" 5380msgstr ""
@@ -5395,15 +5399,65 @@ msgstr ""
5395msgid "Measure quality and performance of the NSE service." 5399msgid "Measure quality and performance of the NSE service."
5396msgstr "" 5400msgstr ""
5397 5401
5398#: src/nse/gnunet-nse.c:124
5399msgid "Show network size estimates from NSE service."
5400msgstr ""
5401
5402#: src/nse/gnunet-service-nse.c:1437 5402#: src/nse/gnunet-service-nse.c:1437
5403#: src/revocation/gnunet-service-revocation.c:846 src/util/gnunet-scrypt.c:247 5403#: src/revocation/gnunet-service-revocation.c:846 src/util/gnunet-scrypt.c:247
5404msgid "Value is too large.\n" 5404msgid "Value is too large.\n"
5405msgstr "" 5405msgstr ""
5406 5406
5407#: src/peerinfo/gnunet-service-peerinfo.c:175
5408#, c-format
5409msgid "Removing expired address of transport `%s'\n"
5410msgstr ""
5411
5412#: src/peerinfo/gnunet-service-peerinfo.c:306
5413#, c-format
5414msgid "Failed to parse HELLO in file `%s': %s\n"
5415msgstr ""
5416
5417#: src/peerinfo/gnunet-service-peerinfo.c:323
5418#: src/peerinfo/gnunet-service-peerinfo.c:348
5419#, c-format
5420msgid "Failed to parse HELLO in file `%s'\n"
5421msgstr ""
5422
5423#: src/peerinfo/gnunet-service-peerinfo.c:426
5424msgid "# peers known"
5425msgstr "# peer conosciuti"
5426
5427#: src/peerinfo/gnunet-service-peerinfo.c:468
5428#, c-format
5429msgid ""
5430"File `%s' in directory `%s' does not match naming convention. Removed.\n"
5431msgstr ""
5432
5433#: src/peerinfo/gnunet-service-peerinfo.c:624
5434#, c-format
5435msgid "Scanning directory `%s'\n"
5436msgstr ""
5437
5438#: src/peerinfo/gnunet-service-peerinfo.c:631
5439#, c-format
5440msgid "Still no peers found in `%s'!\n"
5441msgstr ""
5442
5443#: src/peerinfo/gnunet-service-peerinfo.c:1024
5444#, c-format
5445msgid "Cleaning up directory `%s'\n"
5446msgstr ""
5447
5448#: src/peerinfo/gnunet-service-peerinfo.c:1319
5449#, c-format
5450msgid "Importing HELLOs from `%s'\n"
5451msgstr ""
5452
5453#: src/peerinfo/gnunet-service-peerinfo.c:1332
5454msgid "Skipping import of included HELLOs\n"
5455msgstr ""
5456
5457#: src/peerinfo/peerinfo_api.c:217
5458msgid "Failed to receive response from `PEERINFO' service."
5459msgstr ""
5460
5407#: src/peerinfo-tool/gnunet-peerinfo.c:237 5461#: src/peerinfo-tool/gnunet-peerinfo.c:237
5408#, c-format 5462#, c-format
5409msgid "%sPeer `%s'\n" 5463msgid "%sPeer `%s'\n"
@@ -5498,60 +5552,6 @@ msgstr ""
5498msgid "Peerinfo REST API initialized\n" 5552msgid "Peerinfo REST API initialized\n"
5499msgstr "" 5553msgstr ""
5500 5554
5501#: src/peerinfo/gnunet-service-peerinfo.c:175
5502#, c-format
5503msgid "Removing expired address of transport `%s'\n"
5504msgstr ""
5505
5506#: src/peerinfo/gnunet-service-peerinfo.c:306
5507#, c-format
5508msgid "Failed to parse HELLO in file `%s': %s\n"
5509msgstr ""
5510
5511#: src/peerinfo/gnunet-service-peerinfo.c:323
5512#: src/peerinfo/gnunet-service-peerinfo.c:348
5513#, c-format
5514msgid "Failed to parse HELLO in file `%s'\n"
5515msgstr ""
5516
5517#: src/peerinfo/gnunet-service-peerinfo.c:426
5518msgid "# peers known"
5519msgstr "# peer conosciuti"
5520
5521#: src/peerinfo/gnunet-service-peerinfo.c:468
5522#, c-format
5523msgid ""
5524"File `%s' in directory `%s' does not match naming convention. Removed.\n"
5525msgstr ""
5526
5527#: src/peerinfo/gnunet-service-peerinfo.c:624
5528#, c-format
5529msgid "Scanning directory `%s'\n"
5530msgstr ""
5531
5532#: src/peerinfo/gnunet-service-peerinfo.c:631
5533#, c-format
5534msgid "Still no peers found in `%s'!\n"
5535msgstr ""
5536
5537#: src/peerinfo/gnunet-service-peerinfo.c:1024
5538#, c-format
5539msgid "Cleaning up directory `%s'\n"
5540msgstr ""
5541
5542#: src/peerinfo/gnunet-service-peerinfo.c:1319
5543#, c-format
5544msgid "Importing HELLOs from `%s'\n"
5545msgstr ""
5546
5547#: src/peerinfo/gnunet-service-peerinfo.c:1332
5548msgid "Skipping import of included HELLOs\n"
5549msgstr ""
5550
5551#: src/peerinfo/peerinfo_api.c:217
5552msgid "Failed to receive response from `PEERINFO' service."
5553msgstr ""
5554
5555#: src/peerstore/gnunet-peerstore.c:92 5555#: src/peerstore/gnunet-peerstore.c:92
5556msgid "peerstore" 5556msgid "peerstore"
5557msgstr "" 5557msgstr ""
@@ -5958,6 +5958,18 @@ msgstr ""
5958msgid "Could not open revocation database file!" 5958msgid "Could not open revocation database file!"
5959msgstr "" 5959msgstr ""
5960 5960
5961#: src/rps/gnunet-rps.c:270
5962msgid "Seed a PeerID"
5963msgstr ""
5964
5965#: src/rps/gnunet-rps.c:275
5966msgid "Get updates of view (0 for infinite updates)"
5967msgstr ""
5968
5969#: src/rps/gnunet-rps.c:279
5970msgid "Get peers from biased stream"
5971msgstr ""
5972
5961#: src/rps/gnunet-rps-profiler.c:3200 5973#: src/rps/gnunet-rps-profiler.c:3200
5962msgid "duration of the profiling" 5974msgid "duration of the profiling"
5963msgstr "" 5975msgstr ""
@@ -5974,18 +5986,6 @@ msgstr ""
5974msgid "Measure quality and performance of the RPS service." 5986msgid "Measure quality and performance of the RPS service."
5975msgstr "" 5987msgstr ""
5976 5988
5977#: src/rps/gnunet-rps.c:270
5978msgid "Seed a PeerID"
5979msgstr ""
5980
5981#: src/rps/gnunet-rps.c:275
5982msgid "Get updates of view (0 for infinite updates)"
5983msgstr ""
5984
5985#: src/rps/gnunet-rps.c:279
5986msgid "Get peers from biased stream"
5987msgstr ""
5988
5989#: src/scalarproduct/gnunet-scalarproduct.c:229 5989#: src/scalarproduct/gnunet-scalarproduct.c:229
5990msgid "You must specify at least one message ID to check!\n" 5990msgid "You must specify at least one message ID to check!\n"
5991msgstr "" 5991msgstr ""
@@ -6040,10 +6040,10 @@ msgstr ""
6040msgid "Calculate the Vectorproduct with a GNUnet peer." 6040msgid "Calculate the Vectorproduct with a GNUnet peer."
6041msgstr "" 6041msgstr ""
6042 6042
6043#: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1127
6044#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1073
6045#: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1363 6043#: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1363
6046#: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1366 6044#: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1366
6045#: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1127
6046#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1073
6047msgid "Connect to CADET failed\n" 6047msgid "Connect to CADET failed\n"
6048msgstr "" 6048msgstr ""
6049 6049
@@ -6382,6 +6382,15 @@ msgstr ""
6382msgid "%.s Unknown result code." 6382msgid "%.s Unknown result code."
6383msgstr "" 6383msgstr ""
6384 6384
6385#: src/testbed/gnunet_testbed_mpi_spawn.c:119
6386msgid "Waiting for child to exit.\n"
6387msgstr ""
6388
6389#: src/testbed/gnunet_testbed_mpi_spawn.c:242
6390#, c-format
6391msgid "Spawning process `%s'\n"
6392msgstr ""
6393
6385#: src/testbed/gnunet-testbed-profiler.c:290 6394#: src/testbed/gnunet-testbed-profiler.c:290
6386msgid "tolerate COUNT number of continious timeout failures" 6395msgid "tolerate COUNT number of continious timeout failures"
6387msgstr "" 6396msgstr ""
@@ -6393,15 +6402,6 @@ msgid ""
6393"signal is received" 6402"signal is received"
6394msgstr "" 6403msgstr ""
6395 6404
6396#: src/testbed/gnunet_testbed_mpi_spawn.c:119
6397msgid "Waiting for child to exit.\n"
6398msgstr ""
6399
6400#: src/testbed/gnunet_testbed_mpi_spawn.c:242
6401#, c-format
6402msgid "Spawning process `%s'\n"
6403msgstr ""
6404
6405#: src/testbed/testbed_api.c:399 6405#: src/testbed/testbed_api.c:399
6406#, c-format 6406#, c-format
6407msgid "Adding host %u failed with error: %s\n" 6407msgid "Adding host %u failed with error: %s\n"
@@ -6723,6 +6723,10 @@ msgstr ""
6723msgid "GNUnet UNIX domain socket communicator" 6723msgid "GNUnet UNIX domain socket communicator"
6724msgstr "" 6724msgstr ""
6725 6725
6726#: src/transport/gnunet-service-transport_ats.c:137
6727msgid "# Addresses given to ATS"
6728msgstr ""
6729
6726#: src/transport/gnunet-service-transport.c:445 6730#: src/transport/gnunet-service-transport.c:445
6727msgid "# messages dropped due to slow client" 6731msgid "# messages dropped due to slow client"
6728msgstr "" 6732msgstr ""
@@ -6763,10 +6767,6 @@ msgstr ""
6763msgid "Adding blacklisting entry for peer `%s':`%s'\n" 6767msgid "Adding blacklisting entry for peer `%s':`%s'\n"
6764msgstr "" 6768msgstr ""
6765 6769
6766#: src/transport/gnunet-service-transport_ats.c:137
6767msgid "# Addresses given to ATS"
6768msgstr ""
6769
6770#: src/transport/gnunet-service-transport_hello.c:195 6770#: src/transport/gnunet-service-transport_hello.c:195
6771msgid "# refreshed my HELLO" 6771msgid "# refreshed my HELLO"
6772msgstr "" 6772msgstr ""
@@ -7084,41 +7084,6 @@ msgstr ""
7084msgid "# HELLOs given to peerinfo" 7084msgid "# HELLOs given to peerinfo"
7085msgstr "" 7085msgstr ""
7086 7086
7087#: src/transport/gnunet-transport-profiler.c:220
7088#, c-format
7089msgid "%llu B in %llu ms == %.2f KB/s!\n"
7090msgstr ""
7091
7092#: src/transport/gnunet-transport-profiler.c:577
7093msgid "send data to peer"
7094msgstr ""
7095
7096#: src/transport/gnunet-transport-profiler.c:581
7097msgid "receive data from peer"
7098msgstr ""
7099
7100#: src/transport/gnunet-transport-profiler.c:586
7101msgid "iterations"
7102msgstr ""
7103
7104#: src/transport/gnunet-transport-profiler.c:591
7105msgid "number of messages to send"
7106msgstr ""
7107
7108#: src/transport/gnunet-transport-profiler.c:596
7109msgid "message size to use"
7110msgstr ""
7111
7112#: src/transport/gnunet-transport-profiler.c:601
7113#: src/transport/gnunet-transport.c:1404
7114msgid "peer identity"
7115msgstr ""
7116
7117#: src/transport/gnunet-transport-profiler.c:614
7118#: src/transport/gnunet-transport.c:1426
7119msgid "Direct access to transport service."
7120msgstr ""
7121
7122#: src/transport/gnunet-transport.c:406 7087#: src/transport/gnunet-transport.c:406
7123#, c-format 7088#, c-format
7124msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" 7089msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n"
@@ -7251,6 +7216,11 @@ msgstr ""
7251msgid "do not resolve hostnames" 7216msgid "do not resolve hostnames"
7252msgstr "" 7217msgstr ""
7253 7218
7219#: src/transport/gnunet-transport.c:1404
7220#: src/transport/gnunet-transport-profiler.c:601
7221msgid "peer identity"
7222msgstr ""
7223
7254#: src/transport/gnunet-transport.c:1408 7224#: src/transport/gnunet-transport.c:1408
7255msgid "monitor plugin sessions" 7225msgid "monitor plugin sessions"
7256msgstr "" 7226msgstr ""
@@ -7259,6 +7229,36 @@ msgstr ""
7259msgid "send data for benchmarking to the other peer (until CTRL-C)" 7229msgid "send data for benchmarking to the other peer (until CTRL-C)"
7260msgstr "" 7230msgstr ""
7261 7231
7232#: src/transport/gnunet-transport.c:1426
7233#: src/transport/gnunet-transport-profiler.c:614
7234msgid "Direct access to transport service."
7235msgstr ""
7236
7237#: src/transport/gnunet-transport-profiler.c:220
7238#, c-format
7239msgid "%llu B in %llu ms == %.2f KB/s!\n"
7240msgstr ""
7241
7242#: src/transport/gnunet-transport-profiler.c:577
7243msgid "send data to peer"
7244msgstr ""
7245
7246#: src/transport/gnunet-transport-profiler.c:581
7247msgid "receive data from peer"
7248msgstr ""
7249
7250#: src/transport/gnunet-transport-profiler.c:586
7251msgid "iterations"
7252msgstr ""
7253
7254#: src/transport/gnunet-transport-profiler.c:591
7255msgid "number of messages to send"
7256msgstr ""
7257
7258#: src/transport/gnunet-transport-profiler.c:596
7259msgid "message size to use"
7260msgstr ""
7261
7262#: src/transport/plugin_transport_http_client.c:1489 7262#: src/transport/plugin_transport_http_client.c:1489
7263#: src/transport/plugin_transport_http_server.c:2331 7263#: src/transport/plugin_transport_http_server.c:2331
7264#: src/transport/plugin_transport_http_server.c:3562 7264#: src/transport/plugin_transport_http_server.c:3562
@@ -7525,6 +7525,21 @@ msgstr ""
7525msgid "TCP transport advertises itself as being on port %llu\n" 7525msgid "TCP transport advertises itself as being on port %llu\n"
7526msgstr "" 7526msgstr ""
7527 7527
7528#: src/transport/plugin_transport_udp_broadcasting.c:169
7529#, fuzzy
7530msgid "# Multicast HELLO beacons received via UDP"
7531msgstr "# messaggi PONG ricevuti"
7532
7533#: src/transport/plugin_transport_udp_broadcasting.c:553
7534msgid ""
7535"Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"
7536msgstr ""
7537
7538#: src/transport/plugin_transport_udp_broadcasting.c:571
7539#, c-format
7540msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n"
7541msgstr ""
7542
7528#: src/transport/plugin_transport_udp.c:3169 7543#: src/transport/plugin_transport_udp.c:3169
7529#, c-format 7544#, c-format
7530msgid "" 7545msgid ""
@@ -7571,21 +7586,6 @@ msgstr "deve essere un indirizzo IPv4 valido"
7571msgid "Failed to create UDP network sockets\n" 7586msgid "Failed to create UDP network sockets\n"
7572msgstr "Generazione statistiche fallita\n" 7587msgstr "Generazione statistiche fallita\n"
7573 7588
7574#: src/transport/plugin_transport_udp_broadcasting.c:169
7575#, fuzzy
7576msgid "# Multicast HELLO beacons received via UDP"
7577msgstr "# messaggi PONG ricevuti"
7578
7579#: src/transport/plugin_transport_udp_broadcasting.c:553
7580msgid ""
7581"Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"
7582msgstr ""
7583
7584#: src/transport/plugin_transport_udp_broadcasting.c:571
7585#, c-format
7586msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n"
7587msgstr ""
7588
7589#: src/transport/plugin_transport_unix.c:1396 7589#: src/transport/plugin_transport_unix.c:1396
7590#, fuzzy, c-format 7590#, fuzzy, c-format
7591msgid "Cannot bind to `%s'\n" 7591msgid "Cannot bind to `%s'\n"
@@ -7669,17 +7669,17 @@ msgstr ""
7669msgid "Accepting connection from `%s': %p\n" 7669msgid "Accepting connection from `%s': %p\n"
7670msgstr "" 7670msgstr ""
7671 7671
7672#: src/transport/tcp_server_legacy.c:478 src/util/service.c:1400 7672#: src/transport/tcp_server_legacy.c:478 src/util/service.c:1397
7673#, c-format 7673#, c-format
7674msgid "`%s' failed for port %d (%s).\n" 7674msgid "`%s' failed for port %d (%s).\n"
7675msgstr "" 7675msgstr ""
7676 7676
7677#: src/transport/tcp_server_legacy.c:488 src/util/service.c:1412 7677#: src/transport/tcp_server_legacy.c:488 src/util/service.c:1409
7678#, c-format 7678#, c-format
7679msgid "`%s' failed for port %d (%s): address already in use\n" 7679msgid "`%s' failed for port %d (%s): address already in use\n"
7680msgstr "" 7680msgstr ""
7681 7681
7682#: src/transport/tcp_server_legacy.c:494 src/util/service.c:1419 7682#: src/transport/tcp_server_legacy.c:494 src/util/service.c:1416
7683#, c-format 7683#, c-format
7684msgid "`%s' failed for `%s': address already in use\n" 7684msgid "`%s' failed for `%s': address already in use\n"
7685msgstr "" 7685msgstr ""
@@ -7691,7 +7691,7 @@ msgid ""
7691"`GNUNET_SERVER_receive_done' after %s\n" 7691"`GNUNET_SERVER_receive_done' after %s\n"
7692msgstr "" 7692msgstr ""
7693 7693
7694#: src/transport/tcp_service_legacy.c:345 src/util/service.c:837 7694#: src/transport/tcp_service_legacy.c:345 src/util/service.c:834
7695#, c-format 7695#, c-format
7696msgid "Unknown address family %d\n" 7696msgid "Unknown address family %d\n"
7697msgstr "" 7697msgstr ""
@@ -7701,23 +7701,23 @@ msgstr ""
7701msgid "Access from `%s' denied to service `%s'\n" 7701msgid "Access from `%s' denied to service `%s'\n"
7702msgstr "" 7702msgstr ""
7703 7703
7704#: src/transport/tcp_service_legacy.c:410 src/util/service.c:950 7704#: src/transport/tcp_service_legacy.c:410 src/util/service.c:947
7705#, c-format 7705#, c-format
7706msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 7706msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
7707msgstr "" 7707msgstr ""
7708 7708
7709#: src/transport/tcp_service_legacy.c:451 src/util/service.c:991 7709#: src/transport/tcp_service_legacy.c:451 src/util/service.c:988
7710#, c-format 7710#, c-format
7711msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 7711msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
7712msgstr "" 7712msgstr ""
7713 7713
7714#: src/transport/tcp_service_legacy.c:890 7714#: src/transport/tcp_service_legacy.c:890
7715#: src/transport/tcp_service_legacy.c:910 src/util/service.c:1480 7715#: src/transport/tcp_service_legacy.c:910 src/util/service.c:1477
7716#, c-format 7716#, c-format
7717msgid "Specified value for `%s' of service `%s' is invalid\n" 7717msgid "Specified value for `%s' of service `%s' is invalid\n"
7718msgstr "" 7718msgstr ""
7719 7719
7720#: src/transport/tcp_service_legacy.c:935 src/util/service.c:1504 7720#: src/transport/tcp_service_legacy.c:935 src/util/service.c:1501
7721#, c-format 7721#, c-format
7722msgid "Could not access pre-bound socket %u, will try to bind myself\n" 7722msgid "Could not access pre-bound socket %u, will try to bind myself\n"
7723msgstr "" 7723msgstr ""
@@ -7732,45 +7732,45 @@ msgstr ""
7732msgid "Service `%s' runs at %s\n" 7732msgid "Service `%s' runs at %s\n"
7733msgstr "" 7733msgstr ""
7734 7734
7735#: src/transport/tcp_service_legacy.c:1193 src/util/service.c:1750 7735#: src/transport/tcp_service_legacy.c:1193 src/util/service.c:1747
7736msgid "Service process failed to initialize\n" 7736msgid "Service process failed to initialize\n"
7737msgstr "" 7737msgstr ""
7738 7738
7739#: src/transport/tcp_service_legacy.c:1198 src/util/service.c:1755 7739#: src/transport/tcp_service_legacy.c:1198 src/util/service.c:1752
7740msgid "Service process could not initialize server function\n" 7740msgid "Service process could not initialize server function\n"
7741msgstr "" 7741msgstr ""
7742 7742
7743#: src/transport/tcp_service_legacy.c:1203 src/util/service.c:1760 7743#: src/transport/tcp_service_legacy.c:1203 src/util/service.c:1757
7744msgid "Service process failed to report status\n" 7744msgid "Service process failed to report status\n"
7745msgstr "" 7745msgstr ""
7746 7746
7747#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1177 7747#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1177
7748#: src/util/service.c:1641 7748#: src/util/service.c:1638
7749#, c-format 7749#, c-format
7750msgid "Cannot obtain information about user `%s': %s\n" 7750msgid "Cannot obtain information about user `%s': %s\n"
7751msgstr "" 7751msgstr ""
7752 7752
7753#: src/transport/tcp_service_legacy.c:1255 src/util/service.c:1643 7753#: src/transport/tcp_service_legacy.c:1255 src/util/service.c:1640
7754msgid "No such user" 7754msgid "No such user"
7755msgstr "" 7755msgstr ""
7756 7756
7757#: src/transport/tcp_service_legacy.c:1269 src/util/service.c:1657 7757#: src/transport/tcp_service_legacy.c:1269 src/util/service.c:1654
7758#, c-format 7758#, c-format
7759msgid "Cannot change user/group to `%s': %s\n" 7759msgid "Cannot change user/group to `%s': %s\n"
7760msgstr "" 7760msgstr ""
7761 7761
7762#: src/transport/tcp_service_legacy.c:1348 src/util/service.c:1999 7762#: src/transport/tcp_service_legacy.c:1348 src/util/service.c:1996
7763msgid "do daemonize (detach from terminal)" 7763msgid "do daemonize (detach from terminal)"
7764msgstr "" 7764msgstr ""
7765 7765
7766#: src/transport/tcp_service_legacy.c:1397 7766#: src/transport/tcp_service_legacy.c:1397
7767#: src/transport/transport-testing2.c:906 src/util/service.c:2073 7767#: src/transport/transport-testing2.c:906 src/util/service.c:2070
7768#: src/util/service.c:2085 7768#: src/util/service.c:2082
7769#, c-format 7769#, c-format
7770msgid "Malformed configuration file `%s', exit ...\n" 7770msgid "Malformed configuration file `%s', exit ...\n"
7771msgstr "" 7771msgstr ""
7772 7772
7773#: src/transport/tcp_service_legacy.c:1407 src/util/service.c:2095 7773#: src/transport/tcp_service_legacy.c:1407 src/util/service.c:2092
7774msgid "Malformed configuration, exit ...\n" 7774msgid "Malformed configuration, exit ...\n"
7775msgstr "" 7775msgstr ""
7776 7776
@@ -7812,104 +7812,104 @@ msgstr ""
7812msgid "Metadata `%s' failed to deserialize" 7812msgid "Metadata `%s' failed to deserialize"
7813msgstr "" 7813msgstr ""
7814 7814
7815#: src/util/client.c:739 src/util/client.c:931 7815#: src/util/client.c:747 src/util/client.c:937
7816msgid "not a valid filename" 7816msgid "not a valid filename"
7817msgstr "" 7817msgstr ""
7818 7818
7819#: src/util/client.c:1097 7819#: src/util/client.c:1103
7820#, c-format 7820#, c-format
7821msgid "Need a non-empty hostname for service `%s'.\n" 7821msgid "Need a non-empty hostname for service `%s'.\n"
7822msgstr "" 7822msgstr ""
7823 7823
7824#: src/util/common_logging.c:259 src/util/common_logging.c:1116 7824#: src/util/common_logging.c:259 src/util/common_logging.c:1112
7825msgid "DEBUG" 7825msgid "DEBUG"
7826msgstr "DEBUG" 7826msgstr "DEBUG"
7827 7827
7828#: src/util/common_logging.c:261 src/util/common_logging.c:1114 7828#: src/util/common_logging.c:261 src/util/common_logging.c:1110
7829msgid "INFO" 7829msgid "INFO"
7830msgstr "INFO" 7830msgstr "INFO"
7831 7831
7832#: src/util/common_logging.c:263 src/util/common_logging.c:1112 7832#: src/util/common_logging.c:263 src/util/common_logging.c:1108
7833msgid "MESSAGE" 7833msgid "MESSAGE"
7834msgstr "" 7834msgstr ""
7835 7835
7836#: src/util/common_logging.c:265 src/util/common_logging.c:1110 7836#: src/util/common_logging.c:265 src/util/common_logging.c:1106
7837msgid "WARNING" 7837msgid "WARNING"
7838msgstr "ATTENZIONE" 7838msgstr "ATTENZIONE"
7839 7839
7840#: src/util/common_logging.c:267 src/util/common_logging.c:1108 7840#: src/util/common_logging.c:267 src/util/common_logging.c:1104
7841msgid "ERROR" 7841msgid "ERROR"
7842msgstr "ERRORE" 7842msgstr "ERRORE"
7843 7843
7844#: src/util/common_logging.c:269 src/util/common_logging.c:1118 7844#: src/util/common_logging.c:269 src/util/common_logging.c:1114
7845msgid "NONE" 7845msgid "NONE"
7846msgstr "NESSUNA" 7846msgstr "NESSUNA"
7847 7847
7848#: src/util/common_logging.c:630 src/util/common_logging.c:669 7848#: src/util/common_logging.c:626 src/util/common_logging.c:665
7849#, c-format 7849#, c-format
7850msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" 7850msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n"
7851msgstr "" 7851msgstr ""
7852 7852
7853#: src/util/common_logging.c:906 7853#: src/util/common_logging.c:902
7854#, c-format 7854#, c-format
7855msgid "Message `%.*s' repeated %u times in the last %s\n" 7855msgid "Message `%.*s' repeated %u times in the last %s\n"
7856msgstr "" 7856msgstr ""
7857 7857
7858#: src/util/common_logging.c:1119 7858#: src/util/common_logging.c:1115
7859msgid "INVALID" 7859msgid "INVALID"
7860msgstr "NON VALIDO" 7860msgstr "NON VALIDO"
7861 7861
7862#: src/util/common_logging.c:1400 7862#: src/util/common_logging.c:1396
7863msgid "unknown address" 7863msgid "unknown address"
7864msgstr "indirizzo sconosciuto" 7864msgstr "indirizzo sconosciuto"
7865 7865
7866#: src/util/common_logging.c:1445 7866#: src/util/common_logging.c:1441
7867msgid "invalid address" 7867msgid "invalid address"
7868msgstr "indirizzo non valido" 7868msgstr "indirizzo non valido"
7869 7869
7870#: src/util/common_logging.c:1464 7870#: src/util/common_logging.c:1460
7871#, c-format 7871#, c-format
7872msgid "Configuration fails to specify option `%s' in section `%s'!\n" 7872msgid "Configuration fails to specify option `%s' in section `%s'!\n"
7873msgstr "" 7873msgstr ""
7874 7874
7875#: src/util/common_logging.c:1487 7875#: src/util/common_logging.c:1483
7876#, c-format 7876#, c-format
7877msgid "" 7877msgid ""
7878"Configuration specifies invalid value for option `%s' in section `%s': %s\n" 7878"Configuration specifies invalid value for option `%s' in section `%s': %s\n"
7879msgstr "" 7879msgstr ""
7880 7880
7881#: src/util/configuration.c:325 7881#: src/util/configuration.c:402
7882#, c-format 7882#, c-format
7883msgid "Syntax error while deserializing in line %u\n" 7883msgid "Syntax error while deserializing in line %u\n"
7884msgstr "" 7884msgstr ""
7885 7885
7886#: src/util/configuration.c:383 7886#: src/util/configuration.c:460
7887#, c-format 7887#, c-format
7888msgid "Error while reading file `%s'\n" 7888msgid "Error while reading file `%s'\n"
7889msgstr "Errore di lettura del file `%s'\n" 7889msgstr "Errore di lettura del file `%s'\n"
7890 7890
7891#: src/util/configuration.c:986 7891#: src/util/configuration.c:1063
7892msgid "Not a valid relative time specification" 7892msgid "Not a valid relative time specification"
7893msgstr "" 7893msgstr ""
7894 7894
7895#: src/util/configuration.c:1077 7895#: src/util/configuration.c:1154
7896#, c-format 7896#, c-format
7897msgid "" 7897msgid ""
7898"Configuration value '%s' for '%s' in section '%s' is not in set of legal " 7898"Configuration value '%s' for '%s' in section '%s' is not in set of legal "
7899"choices\n" 7899"choices\n"
7900msgstr "" 7900msgstr ""
7901 7901
7902#: src/util/configuration.c:1192 7902#: src/util/configuration.c:1269
7903#, c-format 7903#, c-format
7904msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" 7904msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n"
7905msgstr "" 7905msgstr ""
7906 7906
7907#: src/util/configuration.c:1224 7907#: src/util/configuration.c:1301
7908#, c-format 7908#, c-format
7909msgid "Missing closing `%s' in option `%s'\n" 7909msgid "Missing closing `%s' in option `%s'\n"
7910msgstr "" 7910msgstr ""
7911 7911
7912#: src/util/configuration.c:1290 7912#: src/util/configuration.c:1367
7913#, c-format 7913#, c-format
7914msgid "" 7914msgid ""
7915"Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " 7915"Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined "
@@ -7971,7 +7971,7 @@ msgstr ""
7971msgid "RSA signing failed at %s:%d: %s\n" 7971msgid "RSA signing failed at %s:%d: %s\n"
7972msgstr "" 7972msgstr ""
7973 7973
7974#: src/util/crypto_rsa.c:1313 7974#: src/util/crypto_rsa.c:1314
7975#, c-format 7975#, c-format
7976msgid "RSA signature verification failed at %s:%d: %s\n" 7976msgid "RSA signature verification failed at %s:%d: %s\n"
7977msgstr "" 7977msgstr ""
@@ -8076,63 +8076,71 @@ msgstr ""
8076msgid "Missing mandatory option `%s'.\n" 8076msgid "Missing mandatory option `%s'.\n"
8077msgstr "" 8077msgstr ""
8078 8078
8079#: src/util/getopt_helpers.c:68 8079#: src/util/getopt_helpers.c:69
8080msgid "print the version number" 8080msgid "print the version number"
8081msgstr "" 8081msgstr ""
8082 8082
8083#: src/util/getopt_helpers.c:114 8083#: src/util/getopt_helpers.c:116
8084#, c-format 8084#, c-format
8085msgid "" 8085msgid ""
8086"Arguments mandatory for long options are also mandatory for short options.\n" 8086"Arguments mandatory for long options are also mandatory for short options.\n"
8087msgstr "" 8087msgstr ""
8088 8088
8089#: src/util/getopt_helpers.c:205 8089#: src/util/getopt_helpers.c:208
8090msgid "print this help" 8090msgid "print this help"
8091msgstr "" 8091msgstr ""
8092 8092
8093#: src/util/getopt_helpers.c:281 8093#: src/util/getopt_helpers.c:288
8094msgid "be verbose" 8094msgid "be verbose"
8095msgstr "" 8095msgstr ""
8096 8096
8097#: src/util/getopt_helpers.c:417 8097#: src/util/getopt_helpers.c:429
8098msgid "configure logging to use LOGLEVEL" 8098msgid "configure logging to use LOGLEVEL"
8099msgstr "" 8099msgstr ""
8100 8100
8101#: src/util/getopt_helpers.c:495 8101#: src/util/getopt_helpers.c:510
8102msgid "configure logging to write logs to FILENAME" 8102msgid "configure logging to write logs to FILENAME"
8103msgstr "" 8103msgstr ""
8104 8104
8105#: src/util/getopt_helpers.c:516 8105#: src/util/getopt_helpers.c:532
8106msgid "use configuration file FILENAME" 8106msgid "use configuration file FILENAME"
8107msgstr "" 8107msgstr ""
8108 8108
8109#: src/util/getopt_helpers.c:551 src/util/getopt_helpers.c:747 8109#: src/util/getopt_helpers.c:568 src/util/getopt_helpers.c:634
8110#: src/util/getopt_helpers.c:810 8110#: src/util/getopt_helpers.c:835 src/util/getopt_helpers.c:900
8111#, c-format 8111#, c-format
8112msgid "You must pass a number to the `%s' option.\n" 8112msgid "You must pass a number to the `%s' option.\n"
8113msgstr "" 8113msgstr ""
8114 8114
8115#: src/util/getopt_helpers.c:612 8115#: src/util/getopt_helpers.c:659
8116msgid "[+/-]MICROSECONDS"
8117msgstr ""
8118
8119#: src/util/getopt_helpers.c:661
8120msgid "modify system time by given offset (for debugging/testing only)"
8121msgstr ""
8122
8123#: src/util/getopt_helpers.c:696
8116#, c-format 8124#, c-format
8117msgid "You must pass relative time to the `%s' option.\n" 8125msgid "You must pass relative time to the `%s' option.\n"
8118msgstr "" 8126msgstr ""
8119 8127
8120#: src/util/getopt_helpers.c:675 8128#: src/util/getopt_helpers.c:761
8121#, c-format 8129#, c-format
8122msgid "You must pass absolute time to the `%s' option.\n" 8130msgid "You must pass absolute time to the `%s' option.\n"
8123msgstr "" 8131msgstr ""
8124 8132
8125#: src/util/getopt_helpers.c:740 8133#: src/util/getopt_helpers.c:828
8126#, c-format 8134#, c-format
8127msgid "Your input for the '%s' option has to be a non negative number \n" 8135msgid "Your input for the '%s' option has to be a non negative number\n"
8128msgstr "" 8136msgstr ""
8129 8137
8130#: src/util/getopt_helpers.c:817 8138#: src/util/getopt_helpers.c:907
8131#, c-format 8139#, c-format
8132msgid "You must pass a number below %u to the `%s' option.\n" 8140msgid "You must pass a number below %u to the `%s' option.\n"
8133msgstr "" 8141msgstr ""
8134 8142
8135#: src/util/getopt_helpers.c:902 8143#: src/util/getopt_helpers.c:994
8136#, c-format 8144#, c-format
8137msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 8145msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
8138msgstr "" 8146msgstr ""
@@ -8465,14 +8473,14 @@ msgstr ""
8465msgid "Could not resolve our FQDN: %s\n" 8473msgid "Could not resolve our FQDN: %s\n"
8466msgstr "" 8474msgstr ""
8467 8475
8468#: src/util/service.c:657 8476#: src/util/service.c:654
8469#, c-format 8477#, c-format
8470msgid "" 8478msgid ""
8471"Processing code for message of type %u did not call " 8479"Processing code for message of type %u did not call "
8472"`GNUNET_SERVICE_client_continue' after %s\n" 8480"`GNUNET_SERVICE_client_continue' after %s\n"
8473msgstr "" 8481msgstr ""
8474 8482
8475#: src/util/service.c:1572 8483#: src/util/service.c:1569
8476msgid "" 8484msgid ""
8477"Could not bind to any of the ports I was supposed to, refusing to run!\n" 8485"Could not bind to any of the ports I was supposed to, refusing to run!\n"
8478msgstr "" 8486msgstr ""
@@ -8780,8 +8788,8 @@ msgstr ""
8780msgid "Setup tunnels via VPN." 8788msgid "Setup tunnels via VPN."
8781msgstr "" 8789msgstr ""
8782 8790
8783#: src/zonemaster/gnunet-service-zonemaster-monitor.c:420
8784#: src/zonemaster/gnunet-service-zonemaster.c:849 8791#: src/zonemaster/gnunet-service-zonemaster.c:849
8792#: src/zonemaster/gnunet-service-zonemaster-monitor.c:420
8785msgid "Failed to connect to the namestore!\n" 8793msgid "Failed to connect to the namestore!\n"
8786msgstr "" 8794msgstr ""
8787 8795
diff --git a/po/sv.po b/po/sv.po
index 8631b6f13..804d41284 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -7,7 +7,7 @@ msgid ""
7msgstr "" 7msgstr ""
8"Project-Id-Version: GNUnet 0.7.0b\n" 8"Project-Id-Version: GNUnet 0.7.0b\n"
9"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 9"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
10"POT-Creation-Date: 2020-01-13 14:01+0000\n" 10"POT-Creation-Date: 2020-02-13 20:41+0100\n"
11"PO-Revision-Date: 2006-01-21 17:16+0100\n" 11"PO-Revision-Date: 2006-01-21 17:16+0100\n"
12"Last-Translator: Daniel Nylander <po@danielnylander.se>\n" 12"Last-Translator: Daniel Nylander <po@danielnylander.se>\n"
13"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" 13"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
@@ -27,8 +27,8 @@ msgid "Issuer public key `%s' is not well-formed\n"
27msgstr "Ogiltigt argument: \"%s\"\n" 27msgstr "Ogiltigt argument: \"%s\"\n"
28 28
29#: src/abd/gnunet-abd.c:558 src/abd/gnunet-service-abd.c:1747 29#: src/abd/gnunet-abd.c:558 src/abd/gnunet-service-abd.c:1747
30#: src/namestore/gnunet-namestore-fcfsd.c:1153
31#: src/namestore/gnunet-namestore.c:1001 30#: src/namestore/gnunet-namestore.c:1001
31#: src/namestore/gnunet-namestore-fcfsd.c:1153
32#, fuzzy, c-format 32#, fuzzy, c-format
33msgid "Failed to connect to namestore\n" 33msgid "Failed to connect to namestore\n"
34msgstr "Misslyckades att ansluta till gnunetd.\n" 34msgstr "Misslyckades att ansluta till gnunetd.\n"
@@ -140,7 +140,7 @@ msgstr ""
140msgid "GNUnet abd resolver tool" 140msgid "GNUnet abd resolver tool"
141msgstr "Spåra GNUnets nätverkstopologi." 141msgstr "Spåra GNUnets nätverkstopologi."
142 142
143#: src/abd/gnunet-service-abd.c:1742 src/gns/gnunet-gns.c:288 143#: src/abd/gnunet-service-abd.c:1742 src/gns/gnunet-gns.c:292
144#, fuzzy, c-format 144#, fuzzy, c-format
145msgid "Failed to connect to GNS\n" 145msgid "Failed to connect to GNS\n"
146msgstr "Misslyckades att ansluta till gnunetd.\n" 146msgstr "Misslyckades att ansluta till gnunetd.\n"
@@ -385,28 +385,28 @@ msgstr ""
385#: src/transport/plugin_transport_tcp.c:1129 385#: src/transport/plugin_transport_tcp.c:1129
386#: src/transport/plugin_transport_tcp.c:3706 386#: src/transport/plugin_transport_tcp.c:3706
387#: src/transport/tcp_service_legacy.c:594 387#: src/transport/tcp_service_legacy.c:594
388#: src/transport/tcp_service_legacy.c:600 src/util/service.c:1094 388#: src/transport/tcp_service_legacy.c:600 src/util/service.c:1091
389#: src/util/service.c:1100 389#: src/util/service.c:1097
390#, c-format 390#, c-format
391msgid "Require valid port number for service `%s' in configuration!\n" 391msgid "Require valid port number for service `%s' in configuration!\n"
392msgstr "" 392msgstr ""
393 393
394#: src/arm/gnunet-service-arm.c:452 src/transport/plugin_transport_tcp.c:1163 394#: src/arm/gnunet-service-arm.c:452 src/transport/plugin_transport_tcp.c:1163
395#: src/transport/tcp_service_legacy.c:634 src/util/client.c:519 395#: src/transport/tcp_service_legacy.c:634 src/util/client.c:527
396#: src/util/service.c:1133 396#: src/util/service.c:1130
397#, c-format 397#, c-format
398msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 398msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
399msgstr "" 399msgstr ""
400 400
401#: src/arm/gnunet-service-arm.c:456 src/transport/plugin_transport_tcp.c:1167 401#: src/arm/gnunet-service-arm.c:456 src/transport/plugin_transport_tcp.c:1167
402#: src/transport/tcp_service_legacy.c:638 src/util/client.c:524 402#: src/transport/tcp_service_legacy.c:638 src/util/client.c:532
403#: src/util/service.c:1137 403#: src/util/service.c:1134
404#, fuzzy, c-format 404#, fuzzy, c-format
405msgid "Using `%s' instead\n" 405msgid "Using `%s' instead\n"
406msgstr "%s: flagga \"%s\" är tvetydig\n" 406msgstr "%s: flagga \"%s\" är tvetydig\n"
407 407
408#: src/arm/gnunet-service-arm.c:484 src/transport/plugin_transport_tcp.c:1195 408#: src/arm/gnunet-service-arm.c:484 src/transport/plugin_transport_tcp.c:1195
409#: src/transport/tcp_service_legacy.c:666 src/util/service.c:1157 409#: src/transport/tcp_service_legacy.c:666 src/util/service.c:1154
410#, c-format 410#, c-format
411msgid "" 411msgid ""
412"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 412"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
@@ -414,7 +414,7 @@ msgid ""
414msgstr "" 414msgstr ""
415 415
416#: src/arm/gnunet-service-arm.c:505 src/transport/plugin_transport_tcp.c:1213 416#: src/arm/gnunet-service-arm.c:505 src/transport/plugin_transport_tcp.c:1213
417#: src/transport/tcp_service_legacy.c:684 src/util/service.c:1175 417#: src/transport/tcp_service_legacy.c:684 src/util/service.c:1172
418#, c-format 418#, c-format
419msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 419msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
420msgstr "" 420msgstr ""
@@ -422,7 +422,7 @@ msgstr ""
422#: src/arm/gnunet-service-arm.c:536 422#: src/arm/gnunet-service-arm.c:536
423#: src/transport/plugin_transport_http_server.c:2718 423#: src/transport/plugin_transport_http_server.c:2718
424#: src/transport/plugin_transport_tcp.c:1244 424#: src/transport/plugin_transport_tcp.c:1244
425#: src/transport/tcp_service_legacy.c:715 src/util/service.c:1206 425#: src/transport/tcp_service_legacy.c:715 src/util/service.c:1203
426#, fuzzy, c-format 426#, fuzzy, c-format
427msgid "Failed to resolve `%s': %s\n" 427msgid "Failed to resolve `%s': %s\n"
428msgstr "Misslyckades att leverera \"%s\" meddelande.\n" 428msgstr "Misslyckades att leverera \"%s\" meddelande.\n"
@@ -430,7 +430,7 @@ msgstr "Misslyckades att leverera \"%s\" meddelande.\n"
430#: src/arm/gnunet-service-arm.c:555 430#: src/arm/gnunet-service-arm.c:555
431#: src/transport/plugin_transport_http_server.c:2736 431#: src/transport/plugin_transport_http_server.c:2736
432#: src/transport/plugin_transport_tcp.c:1263 432#: src/transport/plugin_transport_tcp.c:1263
433#: src/transport/tcp_service_legacy.c:734 src/util/service.c:1225 433#: src/transport/tcp_service_legacy.c:734 src/util/service.c:1222
434#, fuzzy, c-format 434#, fuzzy, c-format
435msgid "Failed to find %saddress for `%s'.\n" 435msgid "Failed to find %saddress for `%s'.\n"
436msgstr "Misslyckades att binda till UDP-port %d.\n" 436msgstr "Misslyckades att binda till UDP-port %d.\n"
@@ -502,15 +502,83 @@ msgstr ""
502msgid "Initiating shutdown as requested by client.\n" 502msgid "Initiating shutdown as requested by client.\n"
503msgstr "" 503msgstr ""
504 504
505#: src/ats-tests/ats-testing-log.c:896 505#: src/ats/gnunet-ats-solver-eval.c:2992 src/ats/gnunet-ats-solver-eval.c:3044
506msgid "Stop logging\n" 506#, c-format
507msgid ""
508"Could not load quota for network `%s': `%s', assigning default bandwidth "
509"%llu\n"
507msgstr "" 510msgstr ""
508 511
509#: src/ats-tests/ats-testing-log.c:952 512#: src/ats/gnunet-ats-solver-eval.c:3011
510#, fuzzy, c-format 513#, c-format
511msgid "Start logging `%s'\n" 514msgid ""
515"No outbound quota configured for network `%s', assigning default bandwidth "
516"%llu\n"
517msgstr ""
518
519#: src/ats/gnunet-ats-solver-eval.c:3063
520#, c-format
521msgid ""
522"No outbound quota configure for network `%s', assigning default bandwidth "
523"%llu\n"
524msgstr ""
525
526#: src/ats/gnunet-ats-solver-eval.c:3552 src/ats-tests/gnunet-solver-eval.c:997
527msgid "solver to use"
528msgstr ""
529
530#: src/ats/gnunet-ats-solver-eval.c:3557
531#: src/ats-tests/gnunet-solver-eval.c:1003
532#: src/ats-tests/gnunet-solver-eval.c:1008
533msgid "experiment to use"
534msgstr ""
535
536#: src/ats/gnunet-ats-solver-eval.c:3564
537#, fuzzy
538msgid "print logging"
512msgstr "Startade samling \"%s\".\n" 539msgstr "Startade samling \"%s\".\n"
513 540
541#: src/ats/gnunet-ats-solver-eval.c:3569
542msgid "save logging to disk"
543msgstr ""
544
545#: src/ats/gnunet-ats-solver-eval.c:3574
546msgid "disable normalization"
547msgstr ""
548
549#: src/ats/gnunet-service-ats_plugins.c:326
550#, c-format
551msgid ""
552"Could not load %s quota for network `%s': `%s', assigning default bandwidth "
553"%llu\n"
554msgstr ""
555
556#: src/ats/gnunet-service-ats_plugins.c:336
557#, c-format
558msgid "%s quota configured for network `%s' is %llu\n"
559msgstr ""
560
561#: src/ats/gnunet-service-ats_plugins.c:382
562#, c-format
563msgid ""
564"No %s-quota configured for network `%s', assigning default bandwidth %llu\n"
565msgstr ""
566
567#: src/ats/gnunet-service-ats_plugins.c:474
568#, fuzzy, c-format
569msgid "Failed to initialize solver `%s'!\n"
570msgstr "Kunde inte initiera SQLite.\n"
571
572#: src/ats/plugin_ats_proportional.c:1140
573#, fuzzy, c-format
574msgid "Invalid %s configuration %f \n"
575msgstr "Kunde inte spara konfigurationsfil \"%s\":"
576
577#: src/ats/plugin_ats_proportional.c:1163
578#, fuzzy, c-format
579msgid "Invalid %s configuration %f\n"
580msgstr "Kunde inte spara konfigurationsfil \"%s\":"
581
514#: src/ats-tests/ats-testing.c:420 582#: src/ats-tests/ats-testing.c:420
515#, c-format 583#, c-format
516msgid "Connected master [%u] with slave [%u]\n" 584msgid "Connected master [%u] with slave [%u]\n"
@@ -521,6 +589,15 @@ msgstr ""
521msgid "Failed to connect master peer [%u] with slave [%u]\n" 589msgid "Failed to connect master peer [%u] with slave [%u]\n"
522msgstr "Misslyckades att ansluta till gnunetd.\n" 590msgstr "Misslyckades att ansluta till gnunetd.\n"
523 591
592#: src/ats-tests/ats-testing-log.c:896
593msgid "Stop logging\n"
594msgstr ""
595
596#: src/ats-tests/ats-testing-log.c:952
597#, fuzzy, c-format
598msgid "Start logging `%s'\n"
599msgstr "Startade samling \"%s\".\n"
600
524#: src/ats-tests/gnunet-ats-sim.c:92 601#: src/ats-tests/gnunet-ats-sim.c:92
525#, c-format 602#, c-format
526msgid "" 603msgid ""
@@ -528,16 +605,6 @@ msgid ""
528"= %u KiB/s\n" 605"= %u KiB/s\n"
529msgstr "" 606msgstr ""
530 607
531#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552
532msgid "solver to use"
533msgstr ""
534
535#: src/ats-tests/gnunet-solver-eval.c:1003
536#: src/ats-tests/gnunet-solver-eval.c:1008
537#: src/ats/gnunet-ats-solver-eval.c:3557
538msgid "experiment to use"
539msgstr ""
540
541#: src/ats-tool/gnunet-ats.c:299 608#: src/ats-tool/gnunet-ats.c:299
542#, c-format 609#, c-format
543msgid "%u address resolutions had a timeout\n" 610msgid "%u address resolutions had a timeout\n"
@@ -659,73 +726,6 @@ msgstr ""
659msgid "Print information about ATS state" 726msgid "Print information about ATS state"
660msgstr "Skriv ut information om GNUnets motparter." 727msgstr "Skriv ut information om GNUnets motparter."
661 728
662#: src/ats/gnunet-ats-solver-eval.c:2992 src/ats/gnunet-ats-solver-eval.c:3044
663#, c-format
664msgid ""
665"Could not load quota for network `%s': `%s', assigning default bandwidth "
666"%llu\n"
667msgstr ""
668
669#: src/ats/gnunet-ats-solver-eval.c:3011
670#, c-format
671msgid ""
672"No outbound quota configured for network `%s', assigning default bandwidth "
673"%llu\n"
674msgstr ""
675
676#: src/ats/gnunet-ats-solver-eval.c:3063
677#, c-format
678msgid ""
679"No outbound quota configure for network `%s', assigning default bandwidth "
680"%llu\n"
681msgstr ""
682
683#: src/ats/gnunet-ats-solver-eval.c:3564
684#, fuzzy
685msgid "print logging"
686msgstr "Startade samling \"%s\".\n"
687
688#: src/ats/gnunet-ats-solver-eval.c:3569
689msgid "save logging to disk"
690msgstr ""
691
692#: src/ats/gnunet-ats-solver-eval.c:3574
693msgid "disable normalization"
694msgstr ""
695
696#: src/ats/gnunet-service-ats_plugins.c:326
697#, c-format
698msgid ""
699"Could not load %s quota for network `%s': `%s', assigning default bandwidth "
700"%llu\n"
701msgstr ""
702
703#: src/ats/gnunet-service-ats_plugins.c:336
704#, c-format
705msgid "%s quota configured for network `%s' is %llu\n"
706msgstr ""
707
708#: src/ats/gnunet-service-ats_plugins.c:382
709#, c-format
710msgid ""
711"No %s-quota configured for network `%s', assigning default bandwidth %llu\n"
712msgstr ""
713
714#: src/ats/gnunet-service-ats_plugins.c:474
715#, fuzzy, c-format
716msgid "Failed to initialize solver `%s'!\n"
717msgstr "Kunde inte initiera SQLite.\n"
718
719#: src/ats/plugin_ats_proportional.c:1140
720#, fuzzy, c-format
721msgid "Invalid %s configuration %f \n"
722msgstr "Kunde inte spara konfigurationsfil \"%s\":"
723
724#: src/ats/plugin_ats_proportional.c:1163
725#, fuzzy, c-format
726msgid "Invalid %s configuration %f\n"
727msgstr "Kunde inte spara konfigurationsfil \"%s\":"
728
729#: src/auction/gnunet-auction-create.c:163 729#: src/auction/gnunet-auction-create.c:163
730msgid "description of the item to be sold" 730msgid "description of the item to be sold"
731msgstr "" 731msgstr ""
@@ -861,28 +861,6 @@ msgstr ""
861msgid "Connection to conversation service lost, trying to reconnect\n" 861msgid "Connection to conversation service lost, trying to reconnect\n"
862msgstr "" 862msgstr ""
863 863
864#: src/conversation/gnunet-conversation-test.c:120
865#, c-format
866msgid ""
867"\n"
868"End of transmission. Have a GNU day.\n"
869msgstr ""
870
871#: src/conversation/gnunet-conversation-test.c:146
872#, c-format
873msgid ""
874"\n"
875"We are now playing your recording back. If you can hear it, your audio "
876"settings are working..."
877msgstr ""
878
879#: src/conversation/gnunet-conversation-test.c:218
880#, c-format
881msgid ""
882"We will now be recording you for %s. After that time, the recording will be "
883"played back to you..."
884msgstr ""
885
886#: src/conversation/gnunet-conversation.c:264 864#: src/conversation/gnunet-conversation.c:264
887#, c-format 865#, c-format
888msgid "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n" 866msgid "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n"
@@ -1142,8 +1120,30 @@ msgstr ""
1142msgid "Enables having a conversation with other GNUnet users." 1120msgid "Enables having a conversation with other GNUnet users."
1143msgstr "" 1121msgstr ""
1144 1122
1145#: src/conversation/gnunet-helper-audio-playback-gst.c:363 1123#: src/conversation/gnunet-conversation-test.c:120
1124#, c-format
1125msgid ""
1126"\n"
1127"End of transmission. Have a GNU day.\n"
1128msgstr ""
1129
1130#: src/conversation/gnunet-conversation-test.c:146
1131#, c-format
1132msgid ""
1133"\n"
1134"We are now playing your recording back. If you can hear it, your audio "
1135"settings are working..."
1136msgstr ""
1137
1138#: src/conversation/gnunet-conversation-test.c:218
1139#, c-format
1140msgid ""
1141"We will now be recording you for %s. After that time, the recording will be "
1142"played back to you..."
1143msgstr ""
1144
1146#: src/conversation/gnunet_gst.c:664 1145#: src/conversation/gnunet_gst.c:664
1146#: src/conversation/gnunet-helper-audio-playback-gst.c:363
1147#, c-format 1147#, c-format
1148msgid "Read error from STDIN: %d %s\n" 1148msgid "Read error from STDIN: %d %s\n"
1149msgstr "" 1149msgstr ""
@@ -1971,17 +1971,17 @@ msgstr "\"%s\" till \"%s\" misslyckades vid %s:%d med fel: %s\n"
1971msgid "Mysql database running\n" 1971msgid "Mysql database running\n"
1972msgstr "" 1972msgstr ""
1973 1973
1974#: src/datastore/plugin_datastore_postgres.c:277 1974#: src/datastore/plugin_datastore_postgres.c:278
1975#: src/datastore/plugin_datastore_postgres.c:890 1975#: src/datastore/plugin_datastore_postgres.c:891
1976msgid "Postgress exec failure" 1976msgid "Postgress exec failure"
1977msgstr "" 1977msgstr ""
1978 1978
1979#: src/datastore/plugin_datastore_postgres.c:851 1979#: src/datastore/plugin_datastore_postgres.c:852
1980#, fuzzy 1980#, fuzzy
1981msgid "Failed to drop table from database.\n" 1981msgid "Failed to drop table from database.\n"
1982msgstr "Misslyckades att ta emot svar till \"%s\" meddelande från gnunetd\n" 1982msgstr "Misslyckades att ta emot svar till \"%s\" meddelande från gnunetd\n"
1983 1983
1984#: src/datastore/plugin_datastore_postgres.c:949 1984#: src/datastore/plugin_datastore_postgres.c:950
1985msgid "Postgres database running\n" 1985msgid "Postgres database running\n"
1986msgstr "" 1986msgstr ""
1987 1987
@@ -2089,6 +2089,54 @@ msgstr ""
2089msgid "Prints all packets that go through the DHT." 2089msgid "Prints all packets that go through the DHT."
2090msgstr "" 2090msgstr ""
2091 2091
2092#: src/dht/gnunet_dht_profiler.c:922 src/testbed/gnunet-testbed-profiler.c:255
2093#, fuzzy, c-format
2094msgid "Exiting as the number of peers is %u\n"
2095msgstr "Maximalt antal chattklienter uppnått.\n"
2096
2097#: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194
2098#, fuzzy
2099msgid "number of peers to start"
2100msgstr "antal iterationer"
2101
2102#: src/dht/gnunet_dht_profiler.c:961
2103msgid "number of PUTs to perform per peer"
2104msgstr ""
2105
2106#: src/dht/gnunet_dht_profiler.c:967 src/nse/gnunet-nse-profiler.c:872
2107#: src/testbed/gnunet-testbed-profiler.c:305
2108msgid "name of the file with the login information for the testbed"
2109msgstr ""
2110
2111#: src/dht/gnunet_dht_profiler.c:973
2112msgid "delay between rounds for collecting statistics (default: 30 sec)"
2113msgstr ""
2114
2115#: src/dht/gnunet_dht_profiler.c:979
2116msgid "delay to start doing PUTs (default: 1 sec)"
2117msgstr ""
2118
2119#: src/dht/gnunet_dht_profiler.c:985
2120msgid "delay to start doing GETs (default: 5 min)"
2121msgstr ""
2122
2123#: src/dht/gnunet_dht_profiler.c:990
2124msgid "replication degree for DHT PUTs"
2125msgstr ""
2126
2127#: src/dht/gnunet_dht_profiler.c:996
2128msgid "chance that a peer is selected at random for PUTs"
2129msgstr ""
2130
2131#: src/dht/gnunet_dht_profiler.c:1002
2132msgid "timeout for DHT PUT and GET requests (default: 1 min)"
2133msgstr ""
2134
2135#: src/dht/gnunet_dht_profiler.c:1023
2136#, fuzzy
2137msgid "Measure quality and performance of the DHT service."
2138msgstr "Kan inte tillgå tjänsten"
2139
2092#: src/dht/gnunet-dht-put.c:133 2140#: src/dht/gnunet-dht-put.c:133
2093msgid "Must provide KEY and DATA for DHT put!\n" 2141msgid "Must provide KEY and DATA for DHT put!\n"
2094msgstr "" 2142msgstr ""
@@ -2359,54 +2407,6 @@ msgstr ""
2359msgid "# DHT requests combined" 2407msgid "# DHT requests combined"
2360msgstr "# byte mottogs via TCP" 2408msgstr "# byte mottogs via TCP"
2361 2409
2362#: src/dht/gnunet_dht_profiler.c:922 src/testbed/gnunet-testbed-profiler.c:255
2363#, fuzzy, c-format
2364msgid "Exiting as the number of peers is %u\n"
2365msgstr "Maximalt antal chattklienter uppnått.\n"
2366
2367#: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194
2368#, fuzzy
2369msgid "number of peers to start"
2370msgstr "antal iterationer"
2371
2372#: src/dht/gnunet_dht_profiler.c:961
2373msgid "number of PUTs to perform per peer"
2374msgstr ""
2375
2376#: src/dht/gnunet_dht_profiler.c:967 src/nse/gnunet-nse-profiler.c:872
2377#: src/testbed/gnunet-testbed-profiler.c:305
2378msgid "name of the file with the login information for the testbed"
2379msgstr ""
2380
2381#: src/dht/gnunet_dht_profiler.c:973
2382msgid "delay between rounds for collecting statistics (default: 30 sec)"
2383msgstr ""
2384
2385#: src/dht/gnunet_dht_profiler.c:979
2386msgid "delay to start doing PUTs (default: 1 sec)"
2387msgstr ""
2388
2389#: src/dht/gnunet_dht_profiler.c:985
2390msgid "delay to start doing GETs (default: 5 min)"
2391msgstr ""
2392
2393#: src/dht/gnunet_dht_profiler.c:990
2394msgid "replication degree for DHT PUTs"
2395msgstr ""
2396
2397#: src/dht/gnunet_dht_profiler.c:996
2398msgid "chance that a peer is selected at random for PUTs"
2399msgstr ""
2400
2401#: src/dht/gnunet_dht_profiler.c:1002
2402msgid "timeout for DHT PUT and GET requests (default: 1 min)"
2403msgstr ""
2404
2405#: src/dht/gnunet_dht_profiler.c:1023
2406#, fuzzy
2407msgid "Measure quality and performance of the DHT service."
2408msgstr "Kan inte tillgå tjänsten"
2409
2410#: src/dht/plugin_block_dht.c:189 2410#: src/dht/plugin_block_dht.c:189
2411#, fuzzy, c-format 2411#, fuzzy, c-format
2412msgid "Block not of type %u\n" 2412msgid "Block not of type %u\n"
@@ -3358,6 +3358,15 @@ msgid ""
3358"chk/...)" 3358"chk/...)"
3359msgstr "" 3359msgstr ""
3360 3360
3361#: src/fs/gnunet-fs.c:128
3362msgid "print a list of all indexed files"
3363msgstr ""
3364
3365#: src/fs/gnunet-fs.c:141
3366#, fuzzy
3367msgid "Special file-sharing operations"
3368msgstr "Visa alla alternativ"
3369
3361#: src/fs/gnunet-fs-profiler.c:211 3370#: src/fs/gnunet-fs-profiler.c:211
3362msgid "run the experiment with COUNT peers" 3371msgid "run the experiment with COUNT peers"
3363msgstr "" 3372msgstr ""
@@ -3374,15 +3383,6 @@ msgstr ""
3374msgid "run a testbed to measure file-sharing performance" 3383msgid "run a testbed to measure file-sharing performance"
3375msgstr "" 3384msgstr ""
3376 3385
3377#: src/fs/gnunet-fs.c:128
3378msgid "print a list of all indexed files"
3379msgstr ""
3380
3381#: src/fs/gnunet-fs.c:141
3382#, fuzzy
3383msgid "Special file-sharing operations"
3384msgstr "Visa alla alternativ"
3385
3386#: src/fs/gnunet-publish.c:219 src/fs/gnunet-publish.c:234 3386#: src/fs/gnunet-publish.c:219 src/fs/gnunet-publish.c:234
3387#, c-format 3387#, c-format
3388msgid "Publishing `%s' at %llu/%llu (%s remaining)\n" 3388msgid "Publishing `%s' at %llu/%llu (%s remaining)\n"
@@ -4069,6 +4069,52 @@ msgstr ""
4069msgid "look for GNS2DNS records instead of ANY" 4069msgid "look for GNS2DNS records instead of ANY"
4070msgstr "" 4070msgstr ""
4071 4071
4072#: src/gns/gnunet-gns.c:257
4073#, fuzzy, c-format
4074msgid "`%s' is not a valid DNS domain name\n"
4075msgstr "\"%s\" är inte tillgänglig."
4076
4077#: src/gns/gnunet-gns.c:267 src/util/dnsparser.c:254
4078#, fuzzy, c-format
4079msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
4080msgstr "Misslyckades att leverera \"%s\" meddelande.\n"
4081
4082#: src/gns/gnunet-gns.c:281
4083msgid "Cannot resolve using GNS: GNUnet peer not running\n"
4084msgstr ""
4085
4086#: src/gns/gnunet-gns.c:305
4087#, c-format
4088msgid "Invalid typename specified, assuming `ANY'\n"
4089msgstr ""
4090
4091#: src/gns/gnunet-gns.c:340
4092msgid "Lookup a record for the given name"
4093msgstr ""
4094
4095#: src/gns/gnunet-gns.c:346
4096#, fuzzy
4097msgid "Specify the type of the record to lookup"
4098msgstr "ange prioritet för innehållet"
4099
4100#: src/gns/gnunet-gns.c:352
4101#, fuzzy
4102msgid "Specify a timeout for the lookup"
4103msgstr "ange prioritet för innehållet"
4104
4105#: src/gns/gnunet-gns.c:356
4106msgid "No unneeded output"
4107msgstr ""
4108
4109#: src/gns/gnunet-gns.c:361
4110msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
4111msgstr ""
4112
4113#: src/gns/gnunet-gns.c:375
4114#, fuzzy
4115msgid "GNUnet GNS resolver tool"
4116msgstr "Spåra GNUnets nätverkstopologi."
4117
4072#: src/gns/gnunet-gns-import.c:486 4118#: src/gns/gnunet-gns-import.c:486
4073msgid "This program will import some GNS authorities into your GNS namestore." 4119msgid "This program will import some GNS authorities into your GNS namestore."
4074msgstr "" 4120msgstr ""
@@ -4189,52 +4235,6 @@ msgstr ""
4189msgid "GNUnet GNS proxy" 4235msgid "GNUnet GNS proxy"
4190msgstr "" 4236msgstr ""
4191 4237
4192#: src/gns/gnunet-gns.c:253
4193#, fuzzy, c-format
4194msgid "`%s' is not a valid DNS domain name\n"
4195msgstr "\"%s\" är inte tillgänglig."
4196
4197#: src/gns/gnunet-gns.c:263 src/util/dnsparser.c:254
4198#, fuzzy, c-format
4199msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
4200msgstr "Misslyckades att leverera \"%s\" meddelande.\n"
4201
4202#: src/gns/gnunet-gns.c:277
4203msgid "Cannot resolve using GNS: GNUnet peer not running\n"
4204msgstr ""
4205
4206#: src/gns/gnunet-gns.c:301
4207#, c-format
4208msgid "Invalid typename specified, assuming `ANY'\n"
4209msgstr ""
4210
4211#: src/gns/gnunet-gns.c:336
4212msgid "Lookup a record for the given name"
4213msgstr ""
4214
4215#: src/gns/gnunet-gns.c:342
4216#, fuzzy
4217msgid "Specify the type of the record to lookup"
4218msgstr "ange prioritet för innehållet"
4219
4220#: src/gns/gnunet-gns.c:348
4221#, fuzzy
4222msgid "Specify a timeout for the lookup"
4223msgstr "ange prioritet för innehållet"
4224
4225#: src/gns/gnunet-gns.c:352
4226msgid "No unneeded output"
4227msgstr ""
4228
4229#: src/gns/gnunet-gns.c:357
4230msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
4231msgstr ""
4232
4233#: src/gns/gnunet-gns.c:371
4234#, fuzzy
4235msgid "GNUnet GNS resolver tool"
4236msgstr "Spåra GNUnets nätverkstopologi."
4237
4238#: src/gns/gnunet-service-gns.c:505 4238#: src/gns/gnunet-service-gns.c:505
4239#, fuzzy 4239#, fuzzy
4240msgid "Properly base32-encoded public key required" 4240msgid "Properly base32-encoded public key required"
@@ -4246,8 +4246,8 @@ msgid "Failed to connect to the namecache!\n"
4246msgstr "Misslyckades att ansluta till gnunetd.\n" 4246msgstr "Misslyckades att ansluta till gnunetd.\n"
4247 4247
4248#: src/gns/gnunet-service-gns.c:560 4248#: src/gns/gnunet-service-gns.c:560
4249#: src/zonemaster/gnunet-service-zonemaster-monitor.c:444
4250#: src/zonemaster/gnunet-service-zonemaster.c:887 4249#: src/zonemaster/gnunet-service-zonemaster.c:887
4250#: src/zonemaster/gnunet-service-zonemaster-monitor.c:444
4251#, fuzzy 4251#, fuzzy
4252msgid "Could not connect to DHT!\n" 4252msgid "Could not connect to DHT!\n"
4253msgstr "Kunde inte ansluta till gnunetd.\n" 4253msgstr "Kunde inte ansluta till gnunetd.\n"
@@ -4306,21 +4306,21 @@ msgstr ""
4306msgid "GNS lookup failed (zero records found for `%s')\n" 4306msgid "GNS lookup failed (zero records found for `%s')\n"
4307msgstr "%d filer hittades i katalog.\n" 4307msgstr "%d filer hittades i katalog.\n"
4308 4308
4309#: src/gns/gnunet-service-gns_resolver.c:2376 4309#: src/gns/gnunet-service-gns_resolver.c:2372
4310msgid "GNS lookup recursion failed (no delegation record found)\n" 4310msgid "GNS lookup recursion failed (no delegation record found)\n"
4311msgstr "" 4311msgstr ""
4312 4312
4313#: src/gns/gnunet-service-gns_resolver.c:2399 4313#: src/gns/gnunet-service-gns_resolver.c:2395
4314#, fuzzy, c-format 4314#, fuzzy, c-format
4315msgid "Failed to cache GNS resolution: %s\n" 4315msgid "Failed to cache GNS resolution: %s\n"
4316msgstr "Misslyckades att skicka HTTP-begäran till värd \"%s\": %s\n" 4316msgstr "Misslyckades att skicka HTTP-begäran till värd \"%s\": %s\n"
4317 4317
4318#: src/gns/gnunet-service-gns_resolver.c:2567 4318#: src/gns/gnunet-service-gns_resolver.c:2563
4319#, c-format 4319#, c-format
4320msgid "GNS namecache returned empty result for `%s'\n" 4320msgid "GNS namecache returned empty result for `%s'\n"
4321msgstr "" 4321msgstr ""
4322 4322
4323#: src/gns/gnunet-service-gns_resolver.c:2707 4323#: src/gns/gnunet-service-gns_resolver.c:2703
4324#, c-format 4324#, c-format
4325msgid "Zone %s was revoked, resolution fails\n" 4325msgid "Zone %s was revoked, resolution fails\n"
4326msgstr "" 4326msgstr ""
@@ -4994,70 +4994,6 @@ msgstr ""
4994msgid "Failed to setup database at `%s'\n" 4994msgid "Failed to setup database at `%s'\n"
4995msgstr "Fel vid %s:%d.\n" 4995msgstr "Fel vid %s:%d.\n"
4996 4996
4997#: src/namestore/gnunet-namestore-fcfsd.c:551
4998#, fuzzy, c-format
4999msgid "Unsupported form value `%s'\n"
5000msgstr "Kommando \"%s\" stöds ej. Avbryter.\n"
5001
5002#: src/namestore/gnunet-namestore-fcfsd.c:578
5003#, fuzzy, c-format
5004msgid "Failed to create record for domain `%s': %s\n"
5005msgstr "Kunde inte tolka konfigurationsfil \"%s\".\n"
5006
5007#: src/namestore/gnunet-namestore-fcfsd.c:599
5008msgid "Error when mapping zone to name\n"
5009msgstr ""
5010
5011#: src/namestore/gnunet-namestore-fcfsd.c:631
5012#, c-format
5013msgid "Found existing name `%s' for the given key\n"
5014msgstr ""
5015
5016#: src/namestore/gnunet-namestore-fcfsd.c:693
5017#, c-format
5018msgid "Found %u existing records for domain `%s'\n"
5019msgstr ""
5020
5021#: src/namestore/gnunet-namestore-fcfsd.c:783
5022#, fuzzy, c-format
5023msgid "Failed to create page for `%s'\n"
5024msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n"
5025
5026#: src/namestore/gnunet-namestore-fcfsd.c:802
5027#, fuzzy, c-format
5028msgid "Failed to setup post processor for `%s'\n"
5029msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
5030
5031#: src/namestore/gnunet-namestore-fcfsd.c:839
5032msgid "Domain name must not contain `.'\n"
5033msgstr ""
5034
5035#: src/namestore/gnunet-namestore-fcfsd.c:848
5036msgid "Domain name must not contain `+'\n"
5037msgstr ""
5038
5039#: src/namestore/gnunet-namestore-fcfsd.c:1083
5040msgid "No ego configured for `fcfsd` subsystem\n"
5041msgstr ""
5042
5043#: src/namestore/gnunet-namestore-fcfsd.c:1114
5044#, fuzzy
5045msgid "Failed to start HTTP server\n"
5046msgstr "Misslyckades att starta samling.\n"
5047
5048#: src/namestore/gnunet-namestore-fcfsd.c:1162
5049#, fuzzy
5050msgid "Failed to connect to identity\n"
5051msgstr "Misslyckades att ansluta till gnunetd.\n"
5052
5053#: src/namestore/gnunet-namestore-fcfsd.c:1189
5054msgid "name of the zone that is to be managed by FCFSD"
5055msgstr ""
5056
5057#: src/namestore/gnunet-namestore-fcfsd.c:1209
5058msgid "GNU Name System First Come First Serve name registration service"
5059msgstr ""
5060
5061#: src/namestore/gnunet-namestore.c:334 4997#: src/namestore/gnunet-namestore.c:334
5062#, fuzzy, c-format 4998#, fuzzy, c-format
5063msgid "Adding record failed: %s\n" 4999msgid "Adding record failed: %s\n"
@@ -5287,7 +5223,71 @@ msgstr ""
5287msgid "name of the ego controlling the zone" 5223msgid "name of the ego controlling the zone"
5288msgstr "Visa värde av alternativet" 5224msgstr "Visa värde av alternativet"
5289 5225
5290#: src/namestore/gnunet-service-namestore.c:864 5226#: src/namestore/gnunet-namestore-fcfsd.c:551
5227#, fuzzy, c-format
5228msgid "Unsupported form value `%s'\n"
5229msgstr "Kommando \"%s\" stöds ej. Avbryter.\n"
5230
5231#: src/namestore/gnunet-namestore-fcfsd.c:578
5232#, fuzzy, c-format
5233msgid "Failed to create record for domain `%s': %s\n"
5234msgstr "Kunde inte tolka konfigurationsfil \"%s\".\n"
5235
5236#: src/namestore/gnunet-namestore-fcfsd.c:599
5237msgid "Error when mapping zone to name\n"
5238msgstr ""
5239
5240#: src/namestore/gnunet-namestore-fcfsd.c:631
5241#, c-format
5242msgid "Found existing name `%s' for the given key\n"
5243msgstr ""
5244
5245#: src/namestore/gnunet-namestore-fcfsd.c:693
5246#, c-format
5247msgid "Found %u existing records for domain `%s'\n"
5248msgstr ""
5249
5250#: src/namestore/gnunet-namestore-fcfsd.c:783
5251#, fuzzy, c-format
5252msgid "Failed to create page for `%s'\n"
5253msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n"
5254
5255#: src/namestore/gnunet-namestore-fcfsd.c:802
5256#, fuzzy, c-format
5257msgid "Failed to setup post processor for `%s'\n"
5258msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
5259
5260#: src/namestore/gnunet-namestore-fcfsd.c:839
5261msgid "Domain name must not contain `.'\n"
5262msgstr ""
5263
5264#: src/namestore/gnunet-namestore-fcfsd.c:848
5265msgid "Domain name must not contain `+'\n"
5266msgstr ""
5267
5268#: src/namestore/gnunet-namestore-fcfsd.c:1083
5269msgid "No ego configured for `fcfsd` subsystem\n"
5270msgstr ""
5271
5272#: src/namestore/gnunet-namestore-fcfsd.c:1114
5273#, fuzzy
5274msgid "Failed to start HTTP server\n"
5275msgstr "Misslyckades att starta samling.\n"
5276
5277#: src/namestore/gnunet-namestore-fcfsd.c:1162
5278#, fuzzy
5279msgid "Failed to connect to identity\n"
5280msgstr "Misslyckades att ansluta till gnunetd.\n"
5281
5282#: src/namestore/gnunet-namestore-fcfsd.c:1189
5283msgid "name of the zone that is to be managed by FCFSD"
5284msgstr ""
5285
5286#: src/namestore/gnunet-namestore-fcfsd.c:1209
5287msgid "GNU Name System First Come First Serve name registration service"
5288msgstr ""
5289
5290#: src/namestore/gnunet-service-namestore.c:866
5291#, fuzzy, c-format 5291#, fuzzy, c-format
5292msgid "Failed to replicate block in namecache: %s\n" 5292msgid "Failed to replicate block in namecache: %s\n"
5293msgstr "Misslyckades att läsa kompislista från \"%s\"\n" 5293msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
@@ -5609,6 +5609,11 @@ msgstr ""
5609msgid "`upnpc' command not found\n" 5609msgid "`upnpc' command not found\n"
5610msgstr "" 5610msgstr ""
5611 5611
5612#: src/nse/gnunet-nse.c:124
5613#, fuzzy
5614msgid "Show network size estimates from NSE service."
5615msgstr "# byte mottogs via TCP"
5616
5612#: src/nse/gnunet-nse-profiler.c:857 5617#: src/nse/gnunet-nse-profiler.c:857
5613#, fuzzy 5618#, fuzzy
5614msgid "limit to the number of connections to NSE services, 0 for none" 5619msgid "limit to the number of connections to NSE services, 0 for none"
@@ -5635,16 +5640,66 @@ msgstr ""
5635msgid "Measure quality and performance of the NSE service." 5640msgid "Measure quality and performance of the NSE service."
5636msgstr "Kan inte tillgå tjänsten" 5641msgstr "Kan inte tillgå tjänsten"
5637 5642
5638#: src/nse/gnunet-nse.c:124
5639#, fuzzy
5640msgid "Show network size estimates from NSE service."
5641msgstr "# byte mottogs via TCP"
5642
5643#: src/nse/gnunet-service-nse.c:1437 5643#: src/nse/gnunet-service-nse.c:1437
5644#: src/revocation/gnunet-service-revocation.c:846 src/util/gnunet-scrypt.c:247 5644#: src/revocation/gnunet-service-revocation.c:846 src/util/gnunet-scrypt.c:247
5645msgid "Value is too large.\n" 5645msgid "Value is too large.\n"
5646msgstr "" 5646msgstr ""
5647 5647
5648#: src/peerinfo/gnunet-service-peerinfo.c:175
5649#, fuzzy, c-format
5650msgid "Removing expired address of transport `%s'\n"
5651msgstr "Tillgängliga transport(er): %s\n"
5652
5653#: src/peerinfo/gnunet-service-peerinfo.c:306
5654#, fuzzy, c-format
5655msgid "Failed to parse HELLO in file `%s': %s\n"
5656msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
5657
5658#: src/peerinfo/gnunet-service-peerinfo.c:323
5659#: src/peerinfo/gnunet-service-peerinfo.c:348
5660#, fuzzy, c-format
5661msgid "Failed to parse HELLO in file `%s'\n"
5662msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
5663
5664#: src/peerinfo/gnunet-service-peerinfo.c:426
5665msgid "# peers known"
5666msgstr ""
5667
5668#: src/peerinfo/gnunet-service-peerinfo.c:468
5669#, c-format
5670msgid ""
5671"File `%s' in directory `%s' does not match naming convention. Removed.\n"
5672msgstr ""
5673
5674#: src/peerinfo/gnunet-service-peerinfo.c:624
5675#, fuzzy, c-format
5676msgid "Scanning directory `%s'\n"
5677msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
5678
5679#: src/peerinfo/gnunet-service-peerinfo.c:631
5680#, c-format
5681msgid "Still no peers found in `%s'!\n"
5682msgstr ""
5683
5684#: src/peerinfo/gnunet-service-peerinfo.c:1024
5685#, fuzzy, c-format
5686msgid "Cleaning up directory `%s'\n"
5687msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
5688
5689#: src/peerinfo/gnunet-service-peerinfo.c:1319
5690#, c-format
5691msgid "Importing HELLOs from `%s'\n"
5692msgstr ""
5693
5694#: src/peerinfo/gnunet-service-peerinfo.c:1332
5695msgid "Skipping import of included HELLOs\n"
5696msgstr ""
5697
5698#: src/peerinfo/peerinfo_api.c:217
5699#, fuzzy
5700msgid "Failed to receive response from `PEERINFO' service."
5701msgstr "Misslyckades att ta emot svar till \"%s\" meddelande från gnunetd\n"
5702
5648#: src/peerinfo-tool/gnunet-peerinfo.c:237 5703#: src/peerinfo-tool/gnunet-peerinfo.c:237
5649#, fuzzy, c-format 5704#, fuzzy, c-format
5650msgid "%sPeer `%s'\n" 5705msgid "%sPeer `%s'\n"
@@ -5741,61 +5796,6 @@ msgstr "Kunde inte slå upp \"%s\": %s\n"
5741msgid "Peerinfo REST API initialized\n" 5796msgid "Peerinfo REST API initialized\n"
5742msgstr " Anslutning misslyckades\n" 5797msgstr " Anslutning misslyckades\n"
5743 5798
5744#: src/peerinfo/gnunet-service-peerinfo.c:175
5745#, fuzzy, c-format
5746msgid "Removing expired address of transport `%s'\n"
5747msgstr "Tillgängliga transport(er): %s\n"
5748
5749#: src/peerinfo/gnunet-service-peerinfo.c:306
5750#, fuzzy, c-format
5751msgid "Failed to parse HELLO in file `%s': %s\n"
5752msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
5753
5754#: src/peerinfo/gnunet-service-peerinfo.c:323
5755#: src/peerinfo/gnunet-service-peerinfo.c:348
5756#, fuzzy, c-format
5757msgid "Failed to parse HELLO in file `%s'\n"
5758msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
5759
5760#: src/peerinfo/gnunet-service-peerinfo.c:426
5761msgid "# peers known"
5762msgstr ""
5763
5764#: src/peerinfo/gnunet-service-peerinfo.c:468
5765#, c-format
5766msgid ""
5767"File `%s' in directory `%s' does not match naming convention. Removed.\n"
5768msgstr ""
5769
5770#: src/peerinfo/gnunet-service-peerinfo.c:624
5771#, fuzzy, c-format
5772msgid "Scanning directory `%s'\n"
5773msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
5774
5775#: src/peerinfo/gnunet-service-peerinfo.c:631
5776#, c-format
5777msgid "Still no peers found in `%s'!\n"
5778msgstr ""
5779
5780#: src/peerinfo/gnunet-service-peerinfo.c:1024
5781#, fuzzy, c-format
5782msgid "Cleaning up directory `%s'\n"
5783msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
5784
5785#: src/peerinfo/gnunet-service-peerinfo.c:1319
5786#, c-format
5787msgid "Importing HELLOs from `%s'\n"
5788msgstr ""
5789
5790#: src/peerinfo/gnunet-service-peerinfo.c:1332
5791msgid "Skipping import of included HELLOs\n"
5792msgstr ""
5793
5794#: src/peerinfo/peerinfo_api.c:217
5795#, fuzzy
5796msgid "Failed to receive response from `PEERINFO' service."
5797msgstr "Misslyckades att ta emot svar till \"%s\" meddelande från gnunetd\n"
5798
5799#: src/peerstore/gnunet-peerstore.c:92 5799#: src/peerstore/gnunet-peerstore.c:92
5800msgid "peerstore" 5800msgid "peerstore"
5801msgstr "" 5801msgstr ""
@@ -6233,6 +6233,18 @@ msgstr ""
6233msgid "Could not open revocation database file!" 6233msgid "Could not open revocation database file!"
6234msgstr "Kunde inte ansluta till gnunetd.\n" 6234msgstr "Kunde inte ansluta till gnunetd.\n"
6235 6235
6236#: src/rps/gnunet-rps.c:270
6237msgid "Seed a PeerID"
6238msgstr ""
6239
6240#: src/rps/gnunet-rps.c:275
6241msgid "Get updates of view (0 for infinite updates)"
6242msgstr ""
6243
6244#: src/rps/gnunet-rps.c:279
6245msgid "Get peers from biased stream"
6246msgstr ""
6247
6236#: src/rps/gnunet-rps-profiler.c:3200 6248#: src/rps/gnunet-rps-profiler.c:3200
6237msgid "duration of the profiling" 6249msgid "duration of the profiling"
6238msgstr "" 6250msgstr ""
@@ -6252,18 +6264,6 @@ msgstr "antal iterationer"
6252msgid "Measure quality and performance of the RPS service." 6264msgid "Measure quality and performance of the RPS service."
6253msgstr "Kan inte tillgå tjänsten" 6265msgstr "Kan inte tillgå tjänsten"
6254 6266
6255#: src/rps/gnunet-rps.c:270
6256msgid "Seed a PeerID"
6257msgstr ""
6258
6259#: src/rps/gnunet-rps.c:275
6260msgid "Get updates of view (0 for infinite updates)"
6261msgstr ""
6262
6263#: src/rps/gnunet-rps.c:279
6264msgid "Get peers from biased stream"
6265msgstr ""
6266
6267#: src/scalarproduct/gnunet-scalarproduct.c:229 6267#: src/scalarproduct/gnunet-scalarproduct.c:229
6268#, fuzzy 6268#, fuzzy
6269msgid "You must specify at least one message ID to check!\n" 6269msgid "You must specify at least one message ID to check!\n"
@@ -6319,10 +6319,10 @@ msgstr ""
6319msgid "Calculate the Vectorproduct with a GNUnet peer." 6319msgid "Calculate the Vectorproduct with a GNUnet peer."
6320msgstr "" 6320msgstr ""
6321 6321
6322#: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1127
6323#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1073
6324#: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1363 6322#: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1363
6325#: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1366 6323#: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1366
6324#: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1127
6325#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1073
6326#, fuzzy 6326#, fuzzy
6327msgid "Connect to CADET failed\n" 6327msgid "Connect to CADET failed\n"
6328msgstr " Anslutning misslyckades (fel?)\n" 6328msgstr " Anslutning misslyckades (fel?)\n"
@@ -6666,6 +6666,16 @@ msgstr ""
6666msgid "%.s Unknown result code." 6666msgid "%.s Unknown result code."
6667msgstr "" 6667msgstr ""
6668 6668
6669#: src/testbed/gnunet_testbed_mpi_spawn.c:119
6670#, fuzzy
6671msgid "Waiting for child to exit.\n"
6672msgstr "Väntar på att motparter ska ansluta (%u iterationer kvar)...\n"
6673
6674#: src/testbed/gnunet_testbed_mpi_spawn.c:242
6675#, fuzzy, c-format
6676msgid "Spawning process `%s'\n"
6677msgstr "Startade samling \"%s\".\n"
6678
6669#: src/testbed/gnunet-testbed-profiler.c:290 6679#: src/testbed/gnunet-testbed-profiler.c:290
6670msgid "tolerate COUNT number of continious timeout failures" 6680msgid "tolerate COUNT number of continious timeout failures"
6671msgstr "" 6681msgstr ""
@@ -6677,16 +6687,6 @@ msgid ""
6677"signal is received" 6687"signal is received"
6678msgstr "" 6688msgstr ""
6679 6689
6680#: src/testbed/gnunet_testbed_mpi_spawn.c:119
6681#, fuzzy
6682msgid "Waiting for child to exit.\n"
6683msgstr "Väntar på att motparter ska ansluta (%u iterationer kvar)...\n"
6684
6685#: src/testbed/gnunet_testbed_mpi_spawn.c:242
6686#, fuzzy, c-format
6687msgid "Spawning process `%s'\n"
6688msgstr "Startade samling \"%s\".\n"
6689
6690#: src/testbed/testbed_api.c:399 6690#: src/testbed/testbed_api.c:399
6691#, fuzzy, c-format 6691#, fuzzy, c-format
6692msgid "Adding host %u failed with error: %s\n" 6692msgid "Adding host %u failed with error: %s\n"
@@ -7020,6 +7020,10 @@ msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n"
7020msgid "GNUnet UNIX domain socket communicator" 7020msgid "GNUnet UNIX domain socket communicator"
7021msgstr "" 7021msgstr ""
7022 7022
7023#: src/transport/gnunet-service-transport_ats.c:137
7024msgid "# Addresses given to ATS"
7025msgstr ""
7026
7023#: src/transport/gnunet-service-transport.c:445 7027#: src/transport/gnunet-service-transport.c:445
7024msgid "# messages dropped due to slow client" 7028msgid "# messages dropped due to slow client"
7025msgstr "" 7029msgstr ""
@@ -7063,10 +7067,6 @@ msgstr "Motpart \"%s\" med pålitlighet %8u och adress \"%s\"\n"
7063msgid "Adding blacklisting entry for peer `%s':`%s'\n" 7067msgid "Adding blacklisting entry for peer `%s':`%s'\n"
7064msgstr "" 7068msgstr ""
7065 7069
7066#: src/transport/gnunet-service-transport_ats.c:137
7067msgid "# Addresses given to ATS"
7068msgstr ""
7069
7070#: src/transport/gnunet-service-transport_hello.c:195 7070#: src/transport/gnunet-service-transport_hello.c:195
7071msgid "# refreshed my HELLO" 7071msgid "# refreshed my HELLO"
7072msgstr "" 7072msgstr ""
@@ -7403,46 +7403,6 @@ msgstr ""
7403msgid "# HELLOs given to peerinfo" 7403msgid "# HELLOs given to peerinfo"
7404msgstr "Meddelande mottaget från klient är ogiltig.\n" 7404msgstr "Meddelande mottaget från klient är ogiltig.\n"
7405 7405
7406#: src/transport/gnunet-transport-profiler.c:220
7407#, c-format
7408msgid "%llu B in %llu ms == %.2f KB/s!\n"
7409msgstr ""
7410
7411#: src/transport/gnunet-transport-profiler.c:577
7412msgid "send data to peer"
7413msgstr ""
7414
7415#: src/transport/gnunet-transport-profiler.c:581
7416#, fuzzy
7417msgid "receive data from peer"
7418msgstr "# byte mottagna av typen %d"
7419
7420#: src/transport/gnunet-transport-profiler.c:586
7421#, fuzzy
7422msgid "iterations"
7423msgstr "Visa alla alternativ"
7424
7425#: src/transport/gnunet-transport-profiler.c:591
7426#, fuzzy
7427msgid "number of messages to send"
7428msgstr "antal meddelanden att använda per iteration"
7429
7430#: src/transport/gnunet-transport-profiler.c:596
7431#, fuzzy
7432msgid "message size to use"
7433msgstr "meddelandestorlek"
7434
7435#: src/transport/gnunet-transport-profiler.c:601
7436#: src/transport/gnunet-transport.c:1404
7437msgid "peer identity"
7438msgstr ""
7439
7440#: src/transport/gnunet-transport-profiler.c:614
7441#: src/transport/gnunet-transport.c:1426
7442#, fuzzy
7443msgid "Direct access to transport service."
7444msgstr "Misslyckades att ansluta till gnunetd.\n"
7445
7446#: src/transport/gnunet-transport.c:406 7406#: src/transport/gnunet-transport.c:406
7447#, fuzzy, c-format 7407#, fuzzy, c-format
7448msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" 7408msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n"
@@ -7582,6 +7542,11 @@ msgstr "Skriv ut information om GNUnets motparter."
7582msgid "do not resolve hostnames" 7542msgid "do not resolve hostnames"
7583msgstr "Misslyckades att läsa kompislista från \"%s\"\n" 7543msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
7584 7544
7545#: src/transport/gnunet-transport.c:1404
7546#: src/transport/gnunet-transport-profiler.c:601
7547msgid "peer identity"
7548msgstr ""
7549
7585#: src/transport/gnunet-transport.c:1408 7550#: src/transport/gnunet-transport.c:1408
7586msgid "monitor plugin sessions" 7551msgid "monitor plugin sessions"
7587msgstr "" 7552msgstr ""
@@ -7590,6 +7555,41 @@ msgstr ""
7590msgid "send data for benchmarking to the other peer (until CTRL-C)" 7555msgid "send data for benchmarking to the other peer (until CTRL-C)"
7591msgstr "" 7556msgstr ""
7592 7557
7558#: src/transport/gnunet-transport.c:1426
7559#: src/transport/gnunet-transport-profiler.c:614
7560#, fuzzy
7561msgid "Direct access to transport service."
7562msgstr "Misslyckades att ansluta till gnunetd.\n"
7563
7564#: src/transport/gnunet-transport-profiler.c:220
7565#, c-format
7566msgid "%llu B in %llu ms == %.2f KB/s!\n"
7567msgstr ""
7568
7569#: src/transport/gnunet-transport-profiler.c:577
7570msgid "send data to peer"
7571msgstr ""
7572
7573#: src/transport/gnunet-transport-profiler.c:581
7574#, fuzzy
7575msgid "receive data from peer"
7576msgstr "# byte mottagna av typen %d"
7577
7578#: src/transport/gnunet-transport-profiler.c:586
7579#, fuzzy
7580msgid "iterations"
7581msgstr "Visa alla alternativ"
7582
7583#: src/transport/gnunet-transport-profiler.c:591
7584#, fuzzy
7585msgid "number of messages to send"
7586msgstr "antal meddelanden att använda per iteration"
7587
7588#: src/transport/gnunet-transport-profiler.c:596
7589#, fuzzy
7590msgid "message size to use"
7591msgstr "meddelandestorlek"
7592
7593#: src/transport/plugin_transport_http_client.c:1489 7593#: src/transport/plugin_transport_http_client.c:1489
7594#: src/transport/plugin_transport_http_server.c:2331 7594#: src/transport/plugin_transport_http_server.c:2331
7595#: src/transport/plugin_transport_http_server.c:3562 7595#: src/transport/plugin_transport_http_server.c:3562
@@ -7877,6 +7877,21 @@ msgstr ""
7877msgid "TCP transport advertises itself as being on port %llu\n" 7877msgid "TCP transport advertises itself as being on port %llu\n"
7878msgstr "" 7878msgstr ""
7879 7879
7880#: src/transport/plugin_transport_udp_broadcasting.c:169
7881#, fuzzy
7882msgid "# Multicast HELLO beacons received via UDP"
7883msgstr "# krypterade PONG-meddelanden mottagna"
7884
7885#: src/transport/plugin_transport_udp_broadcasting.c:553
7886msgid ""
7887"Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"
7888msgstr ""
7889
7890#: src/transport/plugin_transport_udp_broadcasting.c:571
7891#, c-format
7892msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n"
7893msgstr ""
7894
7880#: src/transport/plugin_transport_udp.c:3169 7895#: src/transport/plugin_transport_udp.c:3169
7881#, c-format 7896#, c-format
7882msgid "" 7897msgid ""
@@ -7925,21 +7940,6 @@ msgstr "\"%s\" är inte tillgänglig."
7925msgid "Failed to create UDP network sockets\n" 7940msgid "Failed to create UDP network sockets\n"
7926msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" 7941msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n"
7927 7942
7928#: src/transport/plugin_transport_udp_broadcasting.c:169
7929#, fuzzy
7930msgid "# Multicast HELLO beacons received via UDP"
7931msgstr "# krypterade PONG-meddelanden mottagna"
7932
7933#: src/transport/plugin_transport_udp_broadcasting.c:553
7934msgid ""
7935"Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"
7936msgstr ""
7937
7938#: src/transport/plugin_transport_udp_broadcasting.c:571
7939#, c-format
7940msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n"
7941msgstr ""
7942
7943#: src/transport/plugin_transport_unix.c:1396 7943#: src/transport/plugin_transport_unix.c:1396
7944#, fuzzy, c-format 7944#, fuzzy, c-format
7945msgid "Cannot bind to `%s'\n" 7945msgid "Cannot bind to `%s'\n"
@@ -8028,17 +8028,17 @@ msgid "Accepting connection from `%s': %p\n"
8028msgstr "" 8028msgstr ""
8029 8029
8030# drive = hard drive ? 8030# drive = hard drive ?
8031#: src/transport/tcp_server_legacy.c:478 src/util/service.c:1400 8031#: src/transport/tcp_server_legacy.c:478 src/util/service.c:1397
8032#, fuzzy, c-format 8032#, fuzzy, c-format
8033msgid "`%s' failed for port %d (%s).\n" 8033msgid "`%s' failed for port %d (%s).\n"
8034msgstr "\"%s\" misslyckades för enhet %s: %u\n" 8034msgstr "\"%s\" misslyckades för enhet %s: %u\n"
8035 8035
8036#: src/transport/tcp_server_legacy.c:488 src/util/service.c:1412 8036#: src/transport/tcp_server_legacy.c:488 src/util/service.c:1409
8037#, fuzzy, c-format 8037#, fuzzy, c-format
8038msgid "`%s' failed for port %d (%s): address already in use\n" 8038msgid "`%s' failed for port %d (%s): address already in use\n"
8039msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n" 8039msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n"
8040 8040
8041#: src/transport/tcp_server_legacy.c:494 src/util/service.c:1419 8041#: src/transport/tcp_server_legacy.c:494 src/util/service.c:1416
8042#, fuzzy, c-format 8042#, fuzzy, c-format
8043msgid "`%s' failed for `%s': address already in use\n" 8043msgid "`%s' failed for `%s': address already in use\n"
8044msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n" 8044msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n"
@@ -8050,7 +8050,7 @@ msgid ""
8050"`GNUNET_SERVER_receive_done' after %s\n" 8050"`GNUNET_SERVER_receive_done' after %s\n"
8051msgstr "" 8051msgstr ""
8052 8052
8053#: src/transport/tcp_service_legacy.c:345 src/util/service.c:837 8053#: src/transport/tcp_service_legacy.c:345 src/util/service.c:834
8054#, fuzzy, c-format 8054#, fuzzy, c-format
8055msgid "Unknown address family %d\n" 8055msgid "Unknown address family %d\n"
8056msgstr "Okänd operation \"%s\"\n" 8056msgstr "Okänd operation \"%s\"\n"
@@ -8060,23 +8060,23 @@ msgstr "Okänd operation \"%s\"\n"
8060msgid "Access from `%s' denied to service `%s'\n" 8060msgid "Access from `%s' denied to service `%s'\n"
8061msgstr "" 8061msgstr ""
8062 8062
8063#: src/transport/tcp_service_legacy.c:410 src/util/service.c:950 8063#: src/transport/tcp_service_legacy.c:410 src/util/service.c:947
8064#, c-format 8064#, c-format
8065msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 8065msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
8066msgstr "" 8066msgstr ""
8067 8067
8068#: src/transport/tcp_service_legacy.c:451 src/util/service.c:991 8068#: src/transport/tcp_service_legacy.c:451 src/util/service.c:988
8069#, c-format 8069#, c-format
8070msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 8070msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
8071msgstr "" 8071msgstr ""
8072 8072
8073#: src/transport/tcp_service_legacy.c:890 8073#: src/transport/tcp_service_legacy.c:890
8074#: src/transport/tcp_service_legacy.c:910 src/util/service.c:1480 8074#: src/transport/tcp_service_legacy.c:910 src/util/service.c:1477
8075#, c-format 8075#, c-format
8076msgid "Specified value for `%s' of service `%s' is invalid\n" 8076msgid "Specified value for `%s' of service `%s' is invalid\n"
8077msgstr "" 8077msgstr ""
8078 8078
8079#: src/transport/tcp_service_legacy.c:935 src/util/service.c:1504 8079#: src/transport/tcp_service_legacy.c:935 src/util/service.c:1501
8080#, c-format 8080#, c-format
8081msgid "Could not access pre-bound socket %u, will try to bind myself\n" 8081msgid "Could not access pre-bound socket %u, will try to bind myself\n"
8082msgstr "" 8082msgstr ""
@@ -8091,45 +8091,45 @@ msgstr "Fel vid %s:%d.\n"
8091msgid "Service `%s' runs at %s\n" 8091msgid "Service `%s' runs at %s\n"
8092msgstr "Motpart \"%s\" med pålitlighet %8u och adress \"%s\"\n" 8092msgstr "Motpart \"%s\" med pålitlighet %8u och adress \"%s\"\n"
8093 8093
8094#: src/transport/tcp_service_legacy.c:1193 src/util/service.c:1750 8094#: src/transport/tcp_service_legacy.c:1193 src/util/service.c:1747
8095msgid "Service process failed to initialize\n" 8095msgid "Service process failed to initialize\n"
8096msgstr "" 8096msgstr ""
8097 8097
8098#: src/transport/tcp_service_legacy.c:1198 src/util/service.c:1755 8098#: src/transport/tcp_service_legacy.c:1198 src/util/service.c:1752
8099msgid "Service process could not initialize server function\n" 8099msgid "Service process could not initialize server function\n"
8100msgstr "" 8100msgstr ""
8101 8101
8102#: src/transport/tcp_service_legacy.c:1203 src/util/service.c:1760 8102#: src/transport/tcp_service_legacy.c:1203 src/util/service.c:1757
8103msgid "Service process failed to report status\n" 8103msgid "Service process failed to report status\n"
8104msgstr "" 8104msgstr ""
8105 8105
8106#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1177 8106#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1177
8107#: src/util/service.c:1641 8107#: src/util/service.c:1638
8108#, fuzzy, c-format 8108#, fuzzy, c-format
8109msgid "Cannot obtain information about user `%s': %s\n" 8109msgid "Cannot obtain information about user `%s': %s\n"
8110msgstr "Kan inte öppna konfigurationsfil \"%s\".\n" 8110msgstr "Kan inte öppna konfigurationsfil \"%s\".\n"
8111 8111
8112#: src/transport/tcp_service_legacy.c:1255 src/util/service.c:1643 8112#: src/transport/tcp_service_legacy.c:1255 src/util/service.c:1640
8113msgid "No such user" 8113msgid "No such user"
8114msgstr "" 8114msgstr ""
8115 8115
8116#: src/transport/tcp_service_legacy.c:1269 src/util/service.c:1657 8116#: src/transport/tcp_service_legacy.c:1269 src/util/service.c:1654
8117#, c-format 8117#, c-format
8118msgid "Cannot change user/group to `%s': %s\n" 8118msgid "Cannot change user/group to `%s': %s\n"
8119msgstr "Kan inte ändra användare/grupp till \"%s\": %s\n" 8119msgstr "Kan inte ändra användare/grupp till \"%s\": %s\n"
8120 8120
8121#: src/transport/tcp_service_legacy.c:1348 src/util/service.c:1999 8121#: src/transport/tcp_service_legacy.c:1348 src/util/service.c:1996
8122msgid "do daemonize (detach from terminal)" 8122msgid "do daemonize (detach from terminal)"
8123msgstr "" 8123msgstr ""
8124 8124
8125#: src/transport/tcp_service_legacy.c:1397 8125#: src/transport/tcp_service_legacy.c:1397
8126#: src/transport/transport-testing2.c:906 src/util/service.c:2073 8126#: src/transport/transport-testing2.c:906 src/util/service.c:2070
8127#: src/util/service.c:2085 8127#: src/util/service.c:2082
8128#, fuzzy, c-format 8128#, fuzzy, c-format
8129msgid "Malformed configuration file `%s', exit ...\n" 8129msgid "Malformed configuration file `%s', exit ...\n"
8130msgstr "Kunde inte spara konfigurationsfil \"%s\":" 8130msgstr "Kunde inte spara konfigurationsfil \"%s\":"
8131 8131
8132#: src/transport/tcp_service_legacy.c:1407 src/util/service.c:2095 8132#: src/transport/tcp_service_legacy.c:1407 src/util/service.c:2092
8133#, fuzzy 8133#, fuzzy
8134msgid "Malformed configuration, exit ...\n" 8134msgid "Malformed configuration, exit ...\n"
8135msgstr "Kunde inte spara konfigurationsfil \"%s\":" 8135msgstr "Kunde inte spara konfigurationsfil \"%s\":"
@@ -8173,105 +8173,105 @@ msgstr ""
8173msgid "Metadata `%s' failed to deserialize" 8173msgid "Metadata `%s' failed to deserialize"
8174msgstr "" 8174msgstr ""
8175 8175
8176#: src/util/client.c:739 src/util/client.c:931 8176#: src/util/client.c:747 src/util/client.c:937
8177msgid "not a valid filename" 8177msgid "not a valid filename"
8178msgstr "" 8178msgstr ""
8179 8179
8180#: src/util/client.c:1097 8180#: src/util/client.c:1103
8181#, c-format 8181#, c-format
8182msgid "Need a non-empty hostname for service `%s'.\n" 8182msgid "Need a non-empty hostname for service `%s'.\n"
8183msgstr "" 8183msgstr ""
8184 8184
8185#: src/util/common_logging.c:259 src/util/common_logging.c:1116 8185#: src/util/common_logging.c:259 src/util/common_logging.c:1112
8186msgid "DEBUG" 8186msgid "DEBUG"
8187msgstr "FELSÖKNING" 8187msgstr "FELSÖKNING"
8188 8188
8189#: src/util/common_logging.c:261 src/util/common_logging.c:1114 8189#: src/util/common_logging.c:261 src/util/common_logging.c:1110
8190msgid "INFO" 8190msgid "INFO"
8191msgstr "INFO" 8191msgstr "INFO"
8192 8192
8193#: src/util/common_logging.c:263 src/util/common_logging.c:1112 8193#: src/util/common_logging.c:263 src/util/common_logging.c:1108
8194msgid "MESSAGE" 8194msgid "MESSAGE"
8195msgstr "MEDDELANDE" 8195msgstr "MEDDELANDE"
8196 8196
8197#: src/util/common_logging.c:265 src/util/common_logging.c:1110 8197#: src/util/common_logging.c:265 src/util/common_logging.c:1106
8198msgid "WARNING" 8198msgid "WARNING"
8199msgstr "VARNING" 8199msgstr "VARNING"
8200 8200
8201#: src/util/common_logging.c:267 src/util/common_logging.c:1108 8201#: src/util/common_logging.c:267 src/util/common_logging.c:1104
8202msgid "ERROR" 8202msgid "ERROR"
8203msgstr "FEL" 8203msgstr "FEL"
8204 8204
8205#: src/util/common_logging.c:269 src/util/common_logging.c:1118 8205#: src/util/common_logging.c:269 src/util/common_logging.c:1114
8206msgid "NONE" 8206msgid "NONE"
8207msgstr "" 8207msgstr ""
8208 8208
8209#: src/util/common_logging.c:630 src/util/common_logging.c:669 8209#: src/util/common_logging.c:626 src/util/common_logging.c:665
8210#, c-format 8210#, c-format
8211msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" 8211msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n"
8212msgstr "" 8212msgstr ""
8213 8213
8214#: src/util/common_logging.c:906 8214#: src/util/common_logging.c:902
8215#, c-format 8215#, c-format
8216msgid "Message `%.*s' repeated %u times in the last %s\n" 8216msgid "Message `%.*s' repeated %u times in the last %s\n"
8217msgstr "" 8217msgstr ""
8218 8218
8219#: src/util/common_logging.c:1119 8219#: src/util/common_logging.c:1115
8220msgid "INVALID" 8220msgid "INVALID"
8221msgstr "" 8221msgstr ""
8222 8222
8223#: src/util/common_logging.c:1400 8223#: src/util/common_logging.c:1396
8224msgid "unknown address" 8224msgid "unknown address"
8225msgstr "" 8225msgstr ""
8226 8226
8227#: src/util/common_logging.c:1445 8227#: src/util/common_logging.c:1441
8228msgid "invalid address" 8228msgid "invalid address"
8229msgstr "" 8229msgstr ""
8230 8230
8231#: src/util/common_logging.c:1464 8231#: src/util/common_logging.c:1460
8232#, fuzzy, c-format 8232#, fuzzy, c-format
8233msgid "Configuration fails to specify option `%s' in section `%s'!\n" 8233msgid "Configuration fails to specify option `%s' in section `%s'!\n"
8234msgstr "Konfigurationsfil \"%s\" skapad.\n" 8234msgstr "Konfigurationsfil \"%s\" skapad.\n"
8235 8235
8236#: src/util/common_logging.c:1487 8236#: src/util/common_logging.c:1483
8237#, fuzzy, c-format 8237#, fuzzy, c-format
8238msgid "" 8238msgid ""
8239"Configuration specifies invalid value for option `%s' in section `%s': %s\n" 8239"Configuration specifies invalid value for option `%s' in section `%s': %s\n"
8240msgstr "Konfigurationsfil \"%s\" hittades inte. Kör \"gnunet-setup -d\"!\n" 8240msgstr "Konfigurationsfil \"%s\" hittades inte. Kör \"gnunet-setup -d\"!\n"
8241 8241
8242#: src/util/configuration.c:325 8242#: src/util/configuration.c:402
8243#, fuzzy, c-format 8243#, fuzzy, c-format
8244msgid "Syntax error while deserializing in line %u\n" 8244msgid "Syntax error while deserializing in line %u\n"
8245msgstr "Syntaxfel i konfigurationsfil \"%s\" på rad %d.\n" 8245msgstr "Syntaxfel i konfigurationsfil \"%s\" på rad %d.\n"
8246 8246
8247#: src/util/configuration.c:383 8247#: src/util/configuration.c:460
8248#, fuzzy, c-format 8248#, fuzzy, c-format
8249msgid "Error while reading file `%s'\n" 8249msgid "Error while reading file `%s'\n"
8250msgstr "Fel vid nedladdning: %s\n" 8250msgstr "Fel vid nedladdning: %s\n"
8251 8251
8252#: src/util/configuration.c:986 8252#: src/util/configuration.c:1063
8253#, fuzzy 8253#, fuzzy
8254msgid "Not a valid relative time specification" 8254msgid "Not a valid relative time specification"
8255msgstr "Konfigurationsfil \"%s\" skapad.\n" 8255msgstr "Konfigurationsfil \"%s\" skapad.\n"
8256 8256
8257#: src/util/configuration.c:1077 8257#: src/util/configuration.c:1154
8258#, c-format 8258#, c-format
8259msgid "" 8259msgid ""
8260"Configuration value '%s' for '%s' in section '%s' is not in set of legal " 8260"Configuration value '%s' for '%s' in section '%s' is not in set of legal "
8261"choices\n" 8261"choices\n"
8262msgstr "" 8262msgstr ""
8263 8263
8264#: src/util/configuration.c:1192 8264#: src/util/configuration.c:1269
8265#, c-format 8265#, c-format
8266msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" 8266msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n"
8267msgstr "" 8267msgstr ""
8268 8268
8269#: src/util/configuration.c:1224 8269#: src/util/configuration.c:1301
8270#, fuzzy, c-format 8270#, fuzzy, c-format
8271msgid "Missing closing `%s' in option `%s'\n" 8271msgid "Missing closing `%s' in option `%s'\n"
8272msgstr "Konfigurationsfil \"%s\" skapad.\n" 8272msgstr "Konfigurationsfil \"%s\" skapad.\n"
8273 8273
8274#: src/util/configuration.c:1290 8274#: src/util/configuration.c:1367
8275#, c-format 8275#, c-format
8276msgid "" 8276msgid ""
8277"Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " 8277"Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined "
@@ -8335,7 +8335,7 @@ msgstr "libgcrypt har inte den förväntande versionen (version %s krävs).\n"
8335msgid "RSA signing failed at %s:%d: %s\n" 8335msgid "RSA signing failed at %s:%d: %s\n"
8336msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" 8336msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n"
8337 8337
8338#: src/util/crypto_rsa.c:1313 8338#: src/util/crypto_rsa.c:1314
8339#, fuzzy, c-format 8339#, fuzzy, c-format
8340msgid "RSA signature verification failed at %s:%d: %s\n" 8340msgid "RSA signature verification failed at %s:%d: %s\n"
8341msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" 8341msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n"
@@ -8440,11 +8440,11 @@ msgstr "Kommando \"%s\" kräver ett argument (\"%s\").\n"
8440msgid "Missing mandatory option `%s'.\n" 8440msgid "Missing mandatory option `%s'.\n"
8441msgstr "Konfigurationsfil \"%s\" skapad.\n" 8441msgstr "Konfigurationsfil \"%s\" skapad.\n"
8442 8442
8443#: src/util/getopt_helpers.c:68 8443#: src/util/getopt_helpers.c:69
8444msgid "print the version number" 8444msgid "print the version number"
8445msgstr "skriv ut versionsnummer" 8445msgstr "skriv ut versionsnummer"
8446 8446
8447#: src/util/getopt_helpers.c:114 8447#: src/util/getopt_helpers.c:116
8448#, c-format 8448#, c-format
8449msgid "" 8449msgid ""
8450"Arguments mandatory for long options are also mandatory for short options.\n" 8450"Arguments mandatory for long options are also mandatory for short options.\n"
@@ -8452,54 +8452,62 @@ msgstr ""
8452"Argument som är obligatoriska för långa flaggor är också obligatoriska för " 8452"Argument som är obligatoriska för långa flaggor är också obligatoriska för "
8453"korta flaggor.\n" 8453"korta flaggor.\n"
8454 8454
8455#: src/util/getopt_helpers.c:205 8455#: src/util/getopt_helpers.c:208
8456msgid "print this help" 8456msgid "print this help"
8457msgstr "skriv ut denna hjälp" 8457msgstr "skriv ut denna hjälp"
8458 8458
8459#: src/util/getopt_helpers.c:281 8459#: src/util/getopt_helpers.c:288
8460msgid "be verbose" 8460msgid "be verbose"
8461msgstr "var informativ" 8461msgstr "var informativ"
8462 8462
8463#: src/util/getopt_helpers.c:417 8463#: src/util/getopt_helpers.c:429
8464msgid "configure logging to use LOGLEVEL" 8464msgid "configure logging to use LOGLEVEL"
8465msgstr "" 8465msgstr ""
8466 8466
8467#: src/util/getopt_helpers.c:495 8467#: src/util/getopt_helpers.c:510
8468msgid "configure logging to write logs to FILENAME" 8468msgid "configure logging to write logs to FILENAME"
8469msgstr "" 8469msgstr ""
8470 8470
8471#: src/util/getopt_helpers.c:516 8471#: src/util/getopt_helpers.c:532
8472#, fuzzy 8472#, fuzzy
8473msgid "use configuration file FILENAME" 8473msgid "use configuration file FILENAME"
8474msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" 8474msgstr "skriv ut ett värde från konfigurationsfilen till standard ut"
8475 8475
8476#: src/util/getopt_helpers.c:551 src/util/getopt_helpers.c:747 8476#: src/util/getopt_helpers.c:568 src/util/getopt_helpers.c:634
8477#: src/util/getopt_helpers.c:810 8477#: src/util/getopt_helpers.c:835 src/util/getopt_helpers.c:900
8478#, c-format 8478#, c-format
8479msgid "You must pass a number to the `%s' option.\n" 8479msgid "You must pass a number to the `%s' option.\n"
8480msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n" 8480msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n"
8481 8481
8482#: src/util/getopt_helpers.c:612 8482#: src/util/getopt_helpers.c:659
8483msgid "[+/-]MICROSECONDS"
8484msgstr ""
8485
8486#: src/util/getopt_helpers.c:661
8487msgid "modify system time by given offset (for debugging/testing only)"
8488msgstr ""
8489
8490#: src/util/getopt_helpers.c:696
8483#, fuzzy, c-format 8491#, fuzzy, c-format
8484msgid "You must pass relative time to the `%s' option.\n" 8492msgid "You must pass relative time to the `%s' option.\n"
8485msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n" 8493msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n"
8486 8494
8487#: src/util/getopt_helpers.c:675 8495#: src/util/getopt_helpers.c:761
8488#, fuzzy, c-format 8496#, fuzzy, c-format
8489msgid "You must pass absolute time to the `%s' option.\n" 8497msgid "You must pass absolute time to the `%s' option.\n"
8490msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n" 8498msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n"
8491 8499
8492#: src/util/getopt_helpers.c:740 8500#: src/util/getopt_helpers.c:828
8493#, c-format 8501#, c-format
8494msgid "Your input for the '%s' option has to be a non negative number \n" 8502msgid "Your input for the '%s' option has to be a non negative number\n"
8495msgstr "" 8503msgstr ""
8496 8504
8497#: src/util/getopt_helpers.c:817 8505#: src/util/getopt_helpers.c:907
8498#, fuzzy, c-format 8506#, fuzzy, c-format
8499msgid "You must pass a number below %u to the `%s' option.\n" 8507msgid "You must pass a number below %u to the `%s' option.\n"
8500msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n" 8508msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n"
8501 8509
8502#: src/util/getopt_helpers.c:902 8510#: src/util/getopt_helpers.c:994
8503#, c-format 8511#, c-format
8504msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 8512msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
8505msgstr "" 8513msgstr ""
@@ -8839,14 +8847,14 @@ msgstr ""
8839msgid "Could not resolve our FQDN: %s\n" 8847msgid "Could not resolve our FQDN: %s\n"
8840msgstr "Kunde inte slå upp \"%s\": %s\n" 8848msgstr "Kunde inte slå upp \"%s\": %s\n"
8841 8849
8842#: src/util/service.c:657 8850#: src/util/service.c:654
8843#, c-format 8851#, c-format
8844msgid "" 8852msgid ""
8845"Processing code for message of type %u did not call " 8853"Processing code for message of type %u did not call "
8846"`GNUNET_SERVICE_client_continue' after %s\n" 8854"`GNUNET_SERVICE_client_continue' after %s\n"
8847msgstr "" 8855msgstr ""
8848 8856
8849#: src/util/service.c:1572 8857#: src/util/service.c:1569
8850msgid "" 8858msgid ""
8851"Could not bind to any of the ports I was supposed to, refusing to run!\n" 8859"Could not bind to any of the ports I was supposed to, refusing to run!\n"
8852msgstr "" 8860msgstr ""
@@ -9166,8 +9174,8 @@ msgstr "# byte mottagna via UDP"
9166msgid "Setup tunnels via VPN." 9174msgid "Setup tunnels via VPN."
9167msgstr "" 9175msgstr ""
9168 9176
9169#: src/zonemaster/gnunet-service-zonemaster-monitor.c:420
9170#: src/zonemaster/gnunet-service-zonemaster.c:849 9177#: src/zonemaster/gnunet-service-zonemaster.c:849
9178#: src/zonemaster/gnunet-service-zonemaster-monitor.c:420
9171#, fuzzy 9179#, fuzzy
9172msgid "Failed to connect to the namestore!\n" 9180msgid "Failed to connect to the namestore!\n"
9173msgstr "Misslyckades att ansluta till gnunetd.\n" 9181msgstr "Misslyckades att ansluta till gnunetd.\n"
diff --git a/po/vi.po b/po/vi.po
index 4f14469f8..49888c476 100644
--- a/po/vi.po
+++ b/po/vi.po
@@ -8,7 +8,7 @@ msgid ""
8msgstr "" 8msgstr ""
9"Project-Id-Version: gnunet 0.8.0a\n" 9"Project-Id-Version: gnunet 0.8.0a\n"
10"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 10"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
11"POT-Creation-Date: 2020-01-13 14:01+0000\n" 11"POT-Creation-Date: 2020-02-13 20:41+0100\n"
12"PO-Revision-Date: 2008-09-10 22:05+0930\n" 12"PO-Revision-Date: 2008-09-10 22:05+0930\n"
13"Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n" 13"Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n"
14"Language-Team: Vietnamese <vi-VN@googlegroups.com>\n" 14"Language-Team: Vietnamese <vi-VN@googlegroups.com>\n"
@@ -30,8 +30,8 @@ msgid "Issuer public key `%s' is not well-formed\n"
30msgstr "Đối số không hợp lệ cho « %s ».\n" 30msgstr "Đối số không hợp lệ cho « %s ».\n"
31 31
32#: src/abd/gnunet-abd.c:558 src/abd/gnunet-service-abd.c:1747 32#: src/abd/gnunet-abd.c:558 src/abd/gnunet-service-abd.c:1747
33#: src/namestore/gnunet-namestore-fcfsd.c:1153
34#: src/namestore/gnunet-namestore.c:1001 33#: src/namestore/gnunet-namestore.c:1001
34#: src/namestore/gnunet-namestore-fcfsd.c:1153
35#, fuzzy, c-format 35#, fuzzy, c-format
36msgid "Failed to connect to namestore\n" 36msgid "Failed to connect to namestore\n"
37msgstr "Không kết nối được đến trình nền gnunetd." 37msgstr "Không kết nối được đến trình nền gnunetd."
@@ -143,7 +143,7 @@ msgstr ""
143msgid "GNUnet abd resolver tool" 143msgid "GNUnet abd resolver tool"
144msgstr "Bản ghi lỗi GNUnet" 144msgstr "Bản ghi lỗi GNUnet"
145 145
146#: src/abd/gnunet-service-abd.c:1742 src/gns/gnunet-gns.c:288 146#: src/abd/gnunet-service-abd.c:1742 src/gns/gnunet-gns.c:292
147#, fuzzy, c-format 147#, fuzzy, c-format
148msgid "Failed to connect to GNS\n" 148msgid "Failed to connect to GNS\n"
149msgstr "Lỗi kết nối đến gnunetd.\n" 149msgstr "Lỗi kết nối đến gnunetd.\n"
@@ -392,28 +392,28 @@ msgstr ""
392#: src/transport/plugin_transport_tcp.c:1129 392#: src/transport/plugin_transport_tcp.c:1129
393#: src/transport/plugin_transport_tcp.c:3706 393#: src/transport/plugin_transport_tcp.c:3706
394#: src/transport/tcp_service_legacy.c:594 394#: src/transport/tcp_service_legacy.c:594
395#: src/transport/tcp_service_legacy.c:600 src/util/service.c:1094 395#: src/transport/tcp_service_legacy.c:600 src/util/service.c:1091
396#: src/util/service.c:1100 396#: src/util/service.c:1097
397#, c-format 397#, c-format
398msgid "Require valid port number for service `%s' in configuration!\n" 398msgid "Require valid port number for service `%s' in configuration!\n"
399msgstr "" 399msgstr ""
400 400
401#: src/arm/gnunet-service-arm.c:452 src/transport/plugin_transport_tcp.c:1163 401#: src/arm/gnunet-service-arm.c:452 src/transport/plugin_transport_tcp.c:1163
402#: src/transport/tcp_service_legacy.c:634 src/util/client.c:519 402#: src/transport/tcp_service_legacy.c:634 src/util/client.c:527
403#: src/util/service.c:1133 403#: src/util/service.c:1130
404#, c-format 404#, c-format
405msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 405msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
406msgstr "" 406msgstr ""
407 407
408#: src/arm/gnunet-service-arm.c:456 src/transport/plugin_transport_tcp.c:1167 408#: src/arm/gnunet-service-arm.c:456 src/transport/plugin_transport_tcp.c:1167
409#: src/transport/tcp_service_legacy.c:638 src/util/client.c:524 409#: src/transport/tcp_service_legacy.c:638 src/util/client.c:532
410#: src/util/service.c:1137 410#: src/util/service.c:1134
411#, fuzzy, c-format 411#, fuzzy, c-format
412msgid "Using `%s' instead\n" 412msgid "Using `%s' instead\n"
413msgstr "%s: tùy chọn « %s » là mơ hồ\n" 413msgstr "%s: tùy chọn « %s » là mơ hồ\n"
414 414
415#: src/arm/gnunet-service-arm.c:484 src/transport/plugin_transport_tcp.c:1195 415#: src/arm/gnunet-service-arm.c:484 src/transport/plugin_transport_tcp.c:1195
416#: src/transport/tcp_service_legacy.c:666 src/util/service.c:1157 416#: src/transport/tcp_service_legacy.c:666 src/util/service.c:1154
417#, c-format 417#, c-format
418msgid "" 418msgid ""
419"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 419"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
@@ -421,7 +421,7 @@ msgid ""
421msgstr "" 421msgstr ""
422 422
423#: src/arm/gnunet-service-arm.c:505 src/transport/plugin_transport_tcp.c:1213 423#: src/arm/gnunet-service-arm.c:505 src/transport/plugin_transport_tcp.c:1213
424#: src/transport/tcp_service_legacy.c:684 src/util/service.c:1175 424#: src/transport/tcp_service_legacy.c:684 src/util/service.c:1172
425#, c-format 425#, c-format
426msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 426msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
427msgstr "" 427msgstr ""
@@ -429,7 +429,7 @@ msgstr ""
429#: src/arm/gnunet-service-arm.c:536 429#: src/arm/gnunet-service-arm.c:536
430#: src/transport/plugin_transport_http_server.c:2718 430#: src/transport/plugin_transport_http_server.c:2718
431#: src/transport/plugin_transport_tcp.c:1244 431#: src/transport/plugin_transport_tcp.c:1244
432#: src/transport/tcp_service_legacy.c:715 src/util/service.c:1206 432#: src/transport/tcp_service_legacy.c:715 src/util/service.c:1203
433#, fuzzy, c-format 433#, fuzzy, c-format
434msgid "Failed to resolve `%s': %s\n" 434msgid "Failed to resolve `%s': %s\n"
435msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n" 435msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n"
@@ -437,7 +437,7 @@ msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n"
437#: src/arm/gnunet-service-arm.c:555 437#: src/arm/gnunet-service-arm.c:555
438#: src/transport/plugin_transport_http_server.c:2736 438#: src/transport/plugin_transport_http_server.c:2736
439#: src/transport/plugin_transport_tcp.c:1263 439#: src/transport/plugin_transport_tcp.c:1263
440#: src/transport/tcp_service_legacy.c:734 src/util/service.c:1225 440#: src/transport/tcp_service_legacy.c:734 src/util/service.c:1222
441#, fuzzy, c-format 441#, fuzzy, c-format
442msgid "Failed to find %saddress for `%s'.\n" 442msgid "Failed to find %saddress for `%s'.\n"
443msgstr "Lỗi đóng kết đến cổng %s %d.\n" 443msgstr "Lỗi đóng kết đến cổng %s %d.\n"
@@ -509,15 +509,82 @@ msgstr ""
509msgid "Initiating shutdown as requested by client.\n" 509msgid "Initiating shutdown as requested by client.\n"
510msgstr "" 510msgstr ""
511 511
512#: src/ats-tests/ats-testing-log.c:896 512#: src/ats/gnunet-ats-solver-eval.c:2992 src/ats/gnunet-ats-solver-eval.c:3044
513#, c-format
514msgid ""
515"Could not load quota for network `%s': `%s', assigning default bandwidth "
516"%llu\n"
517msgstr ""
518
519#: src/ats/gnunet-ats-solver-eval.c:3011
520#, c-format
521msgid ""
522"No outbound quota configured for network `%s', assigning default bandwidth "
523"%llu\n"
524msgstr ""
525
526#: src/ats/gnunet-ats-solver-eval.c:3063
527#, c-format
528msgid ""
529"No outbound quota configure for network `%s', assigning default bandwidth "
530"%llu\n"
531msgstr ""
532
533#: src/ats/gnunet-ats-solver-eval.c:3552 src/ats-tests/gnunet-solver-eval.c:997
534msgid "solver to use"
535msgstr ""
536
537#: src/ats/gnunet-ats-solver-eval.c:3557
538#: src/ats-tests/gnunet-solver-eval.c:1003
539#: src/ats-tests/gnunet-solver-eval.c:1008
540msgid "experiment to use"
541msgstr ""
542
543#: src/ats/gnunet-ats-solver-eval.c:3564
513#, fuzzy 544#, fuzzy
514msgid "Stop logging\n" 545msgid "print logging"
515msgstr "Theo dõi" 546msgstr "Theo dõi"
516 547
517#: src/ats-tests/ats-testing-log.c:952 548#: src/ats/gnunet-ats-solver-eval.c:3569
549msgid "save logging to disk"
550msgstr ""
551
552#: src/ats/gnunet-ats-solver-eval.c:3574
553msgid "disable normalization"
554msgstr ""
555
556#: src/ats/gnunet-service-ats_plugins.c:326
557#, c-format
558msgid ""
559"Could not load %s quota for network `%s': `%s', assigning default bandwidth "
560"%llu\n"
561msgstr ""
562
563#: src/ats/gnunet-service-ats_plugins.c:336
564#, c-format
565msgid "%s quota configured for network `%s' is %llu\n"
566msgstr ""
567
568#: src/ats/gnunet-service-ats_plugins.c:382
569#, c-format
570msgid ""
571"No %s-quota configured for network `%s', assigning default bandwidth %llu\n"
572msgstr ""
573
574#: src/ats/gnunet-service-ats_plugins.c:474
518#, fuzzy, c-format 575#, fuzzy, c-format
519msgid "Start logging `%s'\n" 576msgid "Failed to initialize solver `%s'!\n"
520msgstr "Đang bắt đầu tài về « %s »\n" 577msgstr "Không thể sơ khởi SQLite: %s.\n"
578
579#: src/ats/plugin_ats_proportional.c:1140
580#, fuzzy, c-format
581msgid "Invalid %s configuration %f \n"
582msgstr "Không thể lưu tập tin cấu hình « %s »:"
583
584#: src/ats/plugin_ats_proportional.c:1163
585#, fuzzy, c-format
586msgid "Invalid %s configuration %f\n"
587msgstr "Không thể lưu tập tin cấu hình « %s »:"
521 588
522#: src/ats-tests/ats-testing.c:420 589#: src/ats-tests/ats-testing.c:420
523#, c-format 590#, c-format
@@ -529,6 +596,16 @@ msgstr ""
529msgid "Failed to connect master peer [%u] with slave [%u]\n" 596msgid "Failed to connect master peer [%u] with slave [%u]\n"
530msgstr "Lỗi kết nối đến gnunetd.\n" 597msgstr "Lỗi kết nối đến gnunetd.\n"
531 598
599#: src/ats-tests/ats-testing-log.c:896
600#, fuzzy
601msgid "Stop logging\n"
602msgstr "Theo dõi"
603
604#: src/ats-tests/ats-testing-log.c:952
605#, fuzzy, c-format
606msgid "Start logging `%s'\n"
607msgstr "Đang bắt đầu tài về « %s »\n"
608
532#: src/ats-tests/gnunet-ats-sim.c:92 609#: src/ats-tests/gnunet-ats-sim.c:92
533#, c-format 610#, c-format
534msgid "" 611msgid ""
@@ -536,16 +613,6 @@ msgid ""
536"= %u KiB/s\n" 613"= %u KiB/s\n"
537msgstr "" 614msgstr ""
538 615
539#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552
540msgid "solver to use"
541msgstr ""
542
543#: src/ats-tests/gnunet-solver-eval.c:1003
544#: src/ats-tests/gnunet-solver-eval.c:1008
545#: src/ats/gnunet-ats-solver-eval.c:3557
546msgid "experiment to use"
547msgstr ""
548
549#: src/ats-tool/gnunet-ats.c:299 616#: src/ats-tool/gnunet-ats.c:299
550#, c-format 617#, c-format
551msgid "%u address resolutions had a timeout\n" 618msgid "%u address resolutions had a timeout\n"
@@ -668,73 +735,6 @@ msgstr ""
668msgid "Print information about ATS state" 735msgid "Print information about ATS state"
669msgstr "In ra thông tin về các đồng đẳng GNUnet." 736msgstr "In ra thông tin về các đồng đẳng GNUnet."
670 737
671#: src/ats/gnunet-ats-solver-eval.c:2992 src/ats/gnunet-ats-solver-eval.c:3044
672#, c-format
673msgid ""
674"Could not load quota for network `%s': `%s', assigning default bandwidth "
675"%llu\n"
676msgstr ""
677
678#: src/ats/gnunet-ats-solver-eval.c:3011
679#, c-format
680msgid ""
681"No outbound quota configured for network `%s', assigning default bandwidth "
682"%llu\n"
683msgstr ""
684
685#: src/ats/gnunet-ats-solver-eval.c:3063
686#, c-format
687msgid ""
688"No outbound quota configure for network `%s', assigning default bandwidth "
689"%llu\n"
690msgstr ""
691
692#: src/ats/gnunet-ats-solver-eval.c:3564
693#, fuzzy
694msgid "print logging"
695msgstr "Theo dõi"
696
697#: src/ats/gnunet-ats-solver-eval.c:3569
698msgid "save logging to disk"
699msgstr ""
700
701#: src/ats/gnunet-ats-solver-eval.c:3574
702msgid "disable normalization"
703msgstr ""
704
705#: src/ats/gnunet-service-ats_plugins.c:326
706#, c-format
707msgid ""
708"Could not load %s quota for network `%s': `%s', assigning default bandwidth "
709"%llu\n"
710msgstr ""
711
712#: src/ats/gnunet-service-ats_plugins.c:336
713#, c-format
714msgid "%s quota configured for network `%s' is %llu\n"
715msgstr ""
716
717#: src/ats/gnunet-service-ats_plugins.c:382
718#, c-format
719msgid ""
720"No %s-quota configured for network `%s', assigning default bandwidth %llu\n"
721msgstr ""
722
723#: src/ats/gnunet-service-ats_plugins.c:474
724#, fuzzy, c-format
725msgid "Failed to initialize solver `%s'!\n"
726msgstr "Không thể sơ khởi SQLite: %s.\n"
727
728#: src/ats/plugin_ats_proportional.c:1140
729#, fuzzy, c-format
730msgid "Invalid %s configuration %f \n"
731msgstr "Không thể lưu tập tin cấu hình « %s »:"
732
733#: src/ats/plugin_ats_proportional.c:1163
734#, fuzzy, c-format
735msgid "Invalid %s configuration %f\n"
736msgstr "Không thể lưu tập tin cấu hình « %s »:"
737
738#: src/auction/gnunet-auction-create.c:163 738#: src/auction/gnunet-auction-create.c:163
739msgid "description of the item to be sold" 739msgid "description of the item to be sold"
740msgstr "" 740msgstr ""
@@ -870,28 +870,6 @@ msgstr ""
870msgid "Connection to conversation service lost, trying to reconnect\n" 870msgid "Connection to conversation service lost, trying to reconnect\n"
871msgstr "" 871msgstr ""
872 872
873#: src/conversation/gnunet-conversation-test.c:120
874#, c-format
875msgid ""
876"\n"
877"End of transmission. Have a GNU day.\n"
878msgstr ""
879
880#: src/conversation/gnunet-conversation-test.c:146
881#, c-format
882msgid ""
883"\n"
884"We are now playing your recording back. If you can hear it, your audio "
885"settings are working..."
886msgstr ""
887
888#: src/conversation/gnunet-conversation-test.c:218
889#, c-format
890msgid ""
891"We will now be recording you for %s. After that time, the recording will be "
892"played back to you..."
893msgstr ""
894
895#: src/conversation/gnunet-conversation.c:264 873#: src/conversation/gnunet-conversation.c:264
896#, c-format 874#, c-format
897msgid "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n" 875msgid "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n"
@@ -1151,8 +1129,30 @@ msgstr ""
1151msgid "Enables having a conversation with other GNUnet users." 1129msgid "Enables having a conversation with other GNUnet users."
1152msgstr "" 1130msgstr ""
1153 1131
1154#: src/conversation/gnunet-helper-audio-playback-gst.c:363 1132#: src/conversation/gnunet-conversation-test.c:120
1133#, c-format
1134msgid ""
1135"\n"
1136"End of transmission. Have a GNU day.\n"
1137msgstr ""
1138
1139#: src/conversation/gnunet-conversation-test.c:146
1140#, c-format
1141msgid ""
1142"\n"
1143"We are now playing your recording back. If you can hear it, your audio "
1144"settings are working..."
1145msgstr ""
1146
1147#: src/conversation/gnunet-conversation-test.c:218
1148#, c-format
1149msgid ""
1150"We will now be recording you for %s. After that time, the recording will be "
1151"played back to you..."
1152msgstr ""
1153
1155#: src/conversation/gnunet_gst.c:664 1154#: src/conversation/gnunet_gst.c:664
1155#: src/conversation/gnunet-helper-audio-playback-gst.c:363
1156#, c-format 1156#, c-format
1157msgid "Read error from STDIN: %d %s\n" 1157msgid "Read error from STDIN: %d %s\n"
1158msgstr "" 1158msgstr ""
@@ -1990,19 +1990,19 @@ msgstr "« %s » bị lỗi tại %s:%d với lỗi: %s\n"
1990msgid "Mysql database running\n" 1990msgid "Mysql database running\n"
1991msgstr "" 1991msgstr ""
1992 1992
1993#: src/datastore/plugin_datastore_postgres.c:277 1993#: src/datastore/plugin_datastore_postgres.c:278
1994#: src/datastore/plugin_datastore_postgres.c:890 1994#: src/datastore/plugin_datastore_postgres.c:891
1995msgid "Postgress exec failure" 1995msgid "Postgress exec failure"
1996msgstr "" 1996msgstr ""
1997 1997
1998#: src/datastore/plugin_datastore_postgres.c:851 1998#: src/datastore/plugin_datastore_postgres.c:852
1999#, fuzzy 1999#, fuzzy
2000msgid "Failed to drop table from database.\n" 2000msgid "Failed to drop table from database.\n"
2001msgstr "" 2001msgstr ""
2002"\n" 2002"\n"
2003"Không nhận được đáp ứng từ gnunetd.\n" 2003"Không nhận được đáp ứng từ gnunetd.\n"
2004 2004
2005#: src/datastore/plugin_datastore_postgres.c:949 2005#: src/datastore/plugin_datastore_postgres.c:950
2006msgid "Postgres database running\n" 2006msgid "Postgres database running\n"
2007msgstr "" 2007msgstr ""
2008 2008
@@ -2111,6 +2111,54 @@ msgstr ""
2111msgid "Prints all packets that go through the DHT." 2111msgid "Prints all packets that go through the DHT."
2112msgstr "" 2112msgstr ""
2113 2113
2114#: src/dht/gnunet_dht_profiler.c:922 src/testbed/gnunet-testbed-profiler.c:255
2115#, fuzzy, c-format
2116msgid "Exiting as the number of peers is %u\n"
2117msgstr "tăng sổ tối đa các kết nối TCP/IP"
2118
2119#: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194
2120#, fuzzy
2121msgid "number of peers to start"
2122msgstr "số lần lặp lại"
2123
2124#: src/dht/gnunet_dht_profiler.c:961
2125msgid "number of PUTs to perform per peer"
2126msgstr ""
2127
2128#: src/dht/gnunet_dht_profiler.c:967 src/nse/gnunet-nse-profiler.c:872
2129#: src/testbed/gnunet-testbed-profiler.c:305
2130msgid "name of the file with the login information for the testbed"
2131msgstr ""
2132
2133#: src/dht/gnunet_dht_profiler.c:973
2134msgid "delay between rounds for collecting statistics (default: 30 sec)"
2135msgstr ""
2136
2137#: src/dht/gnunet_dht_profiler.c:979
2138msgid "delay to start doing PUTs (default: 1 sec)"
2139msgstr ""
2140
2141#: src/dht/gnunet_dht_profiler.c:985
2142msgid "delay to start doing GETs (default: 5 min)"
2143msgstr ""
2144
2145#: src/dht/gnunet_dht_profiler.c:990
2146msgid "replication degree for DHT PUTs"
2147msgstr ""
2148
2149#: src/dht/gnunet_dht_profiler.c:996
2150msgid "chance that a peer is selected at random for PUTs"
2151msgstr ""
2152
2153#: src/dht/gnunet_dht_profiler.c:1002
2154msgid "timeout for DHT PUT and GET requests (default: 1 min)"
2155msgstr ""
2156
2157#: src/dht/gnunet_dht_profiler.c:1023
2158#, fuzzy
2159msgid "Measure quality and performance of the DHT service."
2160msgstr "Không thể truy cập đến dịch vụ"
2161
2114#: src/dht/gnunet-dht-put.c:133 2162#: src/dht/gnunet-dht-put.c:133
2115msgid "Must provide KEY and DATA for DHT put!\n" 2163msgid "Must provide KEY and DATA for DHT put!\n"
2116msgstr "" 2164msgstr ""
@@ -2382,54 +2430,6 @@ msgstr ""
2382msgid "# DHT requests combined" 2430msgid "# DHT requests combined"
2383msgstr "# các yêu cầu get (lấy) dht được nhận" 2431msgstr "# các yêu cầu get (lấy) dht được nhận"
2384 2432
2385#: src/dht/gnunet_dht_profiler.c:922 src/testbed/gnunet-testbed-profiler.c:255
2386#, fuzzy, c-format
2387msgid "Exiting as the number of peers is %u\n"
2388msgstr "tăng sổ tối đa các kết nối TCP/IP"
2389
2390#: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194
2391#, fuzzy
2392msgid "number of peers to start"
2393msgstr "số lần lặp lại"
2394
2395#: src/dht/gnunet_dht_profiler.c:961
2396msgid "number of PUTs to perform per peer"
2397msgstr ""
2398
2399#: src/dht/gnunet_dht_profiler.c:967 src/nse/gnunet-nse-profiler.c:872
2400#: src/testbed/gnunet-testbed-profiler.c:305
2401msgid "name of the file with the login information for the testbed"
2402msgstr ""
2403
2404#: src/dht/gnunet_dht_profiler.c:973
2405msgid "delay between rounds for collecting statistics (default: 30 sec)"
2406msgstr ""
2407
2408#: src/dht/gnunet_dht_profiler.c:979
2409msgid "delay to start doing PUTs (default: 1 sec)"
2410msgstr ""
2411
2412#: src/dht/gnunet_dht_profiler.c:985
2413msgid "delay to start doing GETs (default: 5 min)"
2414msgstr ""
2415
2416#: src/dht/gnunet_dht_profiler.c:990
2417msgid "replication degree for DHT PUTs"
2418msgstr ""
2419
2420#: src/dht/gnunet_dht_profiler.c:996
2421msgid "chance that a peer is selected at random for PUTs"
2422msgstr ""
2423
2424#: src/dht/gnunet_dht_profiler.c:1002
2425msgid "timeout for DHT PUT and GET requests (default: 1 min)"
2426msgstr ""
2427
2428#: src/dht/gnunet_dht_profiler.c:1023
2429#, fuzzy
2430msgid "Measure quality and performance of the DHT service."
2431msgstr "Không thể truy cập đến dịch vụ"
2432
2433#: src/dht/plugin_block_dht.c:189 2433#: src/dht/plugin_block_dht.c:189
2434#, fuzzy, c-format 2434#, fuzzy, c-format
2435msgid "Block not of type %u\n" 2435msgid "Block not of type %u\n"
@@ -3381,6 +3381,15 @@ msgid ""
3381"chk/...)" 3381"chk/...)"
3382msgstr "" 3382msgstr ""
3383 3383
3384#: src/fs/gnunet-fs.c:128
3385msgid "print a list of all indexed files"
3386msgstr ""
3387
3388#: src/fs/gnunet-fs.c:141
3389#, fuzzy
3390msgid "Special file-sharing operations"
3391msgstr "Tùy chọn chia sẻ tập tin"
3392
3384#: src/fs/gnunet-fs-profiler.c:211 3393#: src/fs/gnunet-fs-profiler.c:211
3385msgid "run the experiment with COUNT peers" 3394msgid "run the experiment with COUNT peers"
3386msgstr "" 3395msgstr ""
@@ -3397,15 +3406,6 @@ msgstr ""
3397msgid "run a testbed to measure file-sharing performance" 3406msgid "run a testbed to measure file-sharing performance"
3398msgstr "" 3407msgstr ""
3399 3408
3400#: src/fs/gnunet-fs.c:128
3401msgid "print a list of all indexed files"
3402msgstr ""
3403
3404#: src/fs/gnunet-fs.c:141
3405#, fuzzy
3406msgid "Special file-sharing operations"
3407msgstr "Tùy chọn chia sẻ tập tin"
3408
3409#: src/fs/gnunet-publish.c:219 src/fs/gnunet-publish.c:234 3409#: src/fs/gnunet-publish.c:219 src/fs/gnunet-publish.c:234
3410#, c-format 3410#, c-format
3411msgid "Publishing `%s' at %llu/%llu (%s remaining)\n" 3411msgid "Publishing `%s' at %llu/%llu (%s remaining)\n"
@@ -4116,6 +4116,52 @@ msgstr ""
4116msgid "look for GNS2DNS records instead of ANY" 4116msgid "look for GNS2DNS records instead of ANY"
4117msgstr "" 4117msgstr ""
4118 4118
4119#: src/gns/gnunet-gns.c:257
4120#, fuzzy, c-format
4121msgid "`%s' is not a valid DNS domain name\n"
4122msgstr "« %s » không sẵn sàng.\n"
4123
4124#: src/gns/gnunet-gns.c:267 src/util/dnsparser.c:254
4125#, fuzzy, c-format
4126msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
4127msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n"
4128
4129#: src/gns/gnunet-gns.c:281
4130msgid "Cannot resolve using GNS: GNUnet peer not running\n"
4131msgstr ""
4132
4133#: src/gns/gnunet-gns.c:305
4134#, c-format
4135msgid "Invalid typename specified, assuming `ANY'\n"
4136msgstr ""
4137
4138#: src/gns/gnunet-gns.c:340
4139msgid "Lookup a record for the given name"
4140msgstr ""
4141
4142#: src/gns/gnunet-gns.c:346
4143#, fuzzy
4144msgid "Specify the type of the record to lookup"
4145msgstr "xác định mức ưu tiên của nội dung"
4146
4147#: src/gns/gnunet-gns.c:352
4148#, fuzzy
4149msgid "Specify a timeout for the lookup"
4150msgstr "xác định mức ưu tiên của nội dung"
4151
4152#: src/gns/gnunet-gns.c:356
4153msgid "No unneeded output"
4154msgstr ""
4155
4156#: src/gns/gnunet-gns.c:361
4157msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
4158msgstr ""
4159
4160#: src/gns/gnunet-gns.c:375
4161#, fuzzy
4162msgid "GNUnet GNS resolver tool"
4163msgstr "Bản ghi lỗi GNUnet"
4164
4119#: src/gns/gnunet-gns-import.c:486 4165#: src/gns/gnunet-gns-import.c:486
4120msgid "This program will import some GNS authorities into your GNS namestore." 4166msgid "This program will import some GNS authorities into your GNS namestore."
4121msgstr "" 4167msgstr ""
@@ -4236,52 +4282,6 @@ msgstr ""
4236msgid "GNUnet GNS proxy" 4282msgid "GNUnet GNS proxy"
4237msgstr "" 4283msgstr ""
4238 4284
4239#: src/gns/gnunet-gns.c:253
4240#, fuzzy, c-format
4241msgid "`%s' is not a valid DNS domain name\n"
4242msgstr "« %s » không sẵn sàng.\n"
4243
4244#: src/gns/gnunet-gns.c:263 src/util/dnsparser.c:254
4245#, fuzzy, c-format
4246msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
4247msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n"
4248
4249#: src/gns/gnunet-gns.c:277
4250msgid "Cannot resolve using GNS: GNUnet peer not running\n"
4251msgstr ""
4252
4253#: src/gns/gnunet-gns.c:301
4254#, c-format
4255msgid "Invalid typename specified, assuming `ANY'\n"
4256msgstr ""
4257
4258#: src/gns/gnunet-gns.c:336
4259msgid "Lookup a record for the given name"
4260msgstr ""
4261
4262#: src/gns/gnunet-gns.c:342
4263#, fuzzy
4264msgid "Specify the type of the record to lookup"
4265msgstr "xác định mức ưu tiên của nội dung"
4266
4267#: src/gns/gnunet-gns.c:348
4268#, fuzzy
4269msgid "Specify a timeout for the lookup"
4270msgstr "xác định mức ưu tiên của nội dung"
4271
4272#: src/gns/gnunet-gns.c:352
4273msgid "No unneeded output"
4274msgstr ""
4275
4276#: src/gns/gnunet-gns.c:357
4277msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
4278msgstr ""
4279
4280#: src/gns/gnunet-gns.c:371
4281#, fuzzy
4282msgid "GNUnet GNS resolver tool"
4283msgstr "Bản ghi lỗi GNUnet"
4284
4285#: src/gns/gnunet-service-gns.c:505 4285#: src/gns/gnunet-service-gns.c:505
4286#, fuzzy 4286#, fuzzy
4287msgid "Properly base32-encoded public key required" 4287msgid "Properly base32-encoded public key required"
@@ -4293,8 +4293,8 @@ msgid "Failed to connect to the namecache!\n"
4293msgstr "Không kết nối được đến trình nền gnunetd." 4293msgstr "Không kết nối được đến trình nền gnunetd."
4294 4294
4295#: src/gns/gnunet-service-gns.c:560 4295#: src/gns/gnunet-service-gns.c:560
4296#: src/zonemaster/gnunet-service-zonemaster-monitor.c:444
4297#: src/zonemaster/gnunet-service-zonemaster.c:887 4296#: src/zonemaster/gnunet-service-zonemaster.c:887
4297#: src/zonemaster/gnunet-service-zonemaster-monitor.c:444
4298#, fuzzy 4298#, fuzzy
4299msgid "Could not connect to DHT!\n" 4299msgid "Could not connect to DHT!\n"
4300msgstr "Không thể kết nối tới %s:%u: %s\n" 4300msgstr "Không thể kết nối tới %s:%u: %s\n"
@@ -4354,21 +4354,21 @@ msgstr ""
4354msgid "GNS lookup failed (zero records found for `%s')\n" 4354msgid "GNS lookup failed (zero records found for `%s')\n"
4355msgstr "Vẫn còn không tìm thấy đồng đẳng trong « %s ».\n" 4355msgstr "Vẫn còn không tìm thấy đồng đẳng trong « %s ».\n"
4356 4356
4357#: src/gns/gnunet-service-gns_resolver.c:2376 4357#: src/gns/gnunet-service-gns_resolver.c:2372
4358msgid "GNS lookup recursion failed (no delegation record found)\n" 4358msgid "GNS lookup recursion failed (no delegation record found)\n"
4359msgstr "" 4359msgstr ""
4360 4360
4361#: src/gns/gnunet-service-gns_resolver.c:2399 4361#: src/gns/gnunet-service-gns_resolver.c:2395
4362#, fuzzy, c-format 4362#, fuzzy, c-format
4363msgid "Failed to cache GNS resolution: %s\n" 4363msgid "Failed to cache GNS resolution: %s\n"
4364msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n" 4364msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n"
4365 4365
4366#: src/gns/gnunet-service-gns_resolver.c:2567 4366#: src/gns/gnunet-service-gns_resolver.c:2563
4367#, c-format 4367#, c-format
4368msgid "GNS namecache returned empty result for `%s'\n" 4368msgid "GNS namecache returned empty result for `%s'\n"
4369msgstr "" 4369msgstr ""
4370 4370
4371#: src/gns/gnunet-service-gns_resolver.c:2707 4371#: src/gns/gnunet-service-gns_resolver.c:2703
4372#, c-format 4372#, c-format
4373msgid "Zone %s was revoked, resolution fails\n" 4373msgid "Zone %s was revoked, resolution fails\n"
4374msgstr "" 4374msgstr ""
@@ -5056,70 +5056,6 @@ msgstr "kho dữ liệu sqlite"
5056msgid "Failed to setup database at `%s'\n" 5056msgid "Failed to setup database at `%s'\n"
5057msgstr "Lỗi chạy %s: %s %d\n" 5057msgstr "Lỗi chạy %s: %s %d\n"
5058 5058
5059#: src/namestore/gnunet-namestore-fcfsd.c:551
5060#, fuzzy, c-format
5061msgid "Unsupported form value `%s'\n"
5062msgstr "Lệnh không được hỗ trợ « %s ». Đang hủy bỏ.\n"
5063
5064#: src/namestore/gnunet-namestore-fcfsd.c:578
5065#, fuzzy, c-format
5066msgid "Failed to create record for domain `%s': %s\n"
5067msgstr "Không thể truy cập đến tập tin gnunet-directory « %s »\n"
5068
5069#: src/namestore/gnunet-namestore-fcfsd.c:599
5070msgid "Error when mapping zone to name\n"
5071msgstr ""
5072
5073#: src/namestore/gnunet-namestore-fcfsd.c:631
5074#, c-format
5075msgid "Found existing name `%s' for the given key\n"
5076msgstr ""
5077
5078#: src/namestore/gnunet-namestore-fcfsd.c:693
5079#, c-format
5080msgid "Found %u existing records for domain `%s'\n"
5081msgstr ""
5082
5083#: src/namestore/gnunet-namestore-fcfsd.c:783
5084#, fuzzy, c-format
5085msgid "Failed to create page for `%s'\n"
5086msgstr "Không thể tạo miền tên.\n"
5087
5088#: src/namestore/gnunet-namestore-fcfsd.c:802
5089#, fuzzy, c-format
5090msgid "Failed to setup post processor for `%s'\n"
5091msgstr "Lỗi cập nhật dữ liệu cho mô-đun « %s »\n"
5092
5093#: src/namestore/gnunet-namestore-fcfsd.c:839
5094msgid "Domain name must not contain `.'\n"
5095msgstr ""
5096
5097#: src/namestore/gnunet-namestore-fcfsd.c:848
5098msgid "Domain name must not contain `+'\n"
5099msgstr ""
5100
5101#: src/namestore/gnunet-namestore-fcfsd.c:1083
5102msgid "No ego configured for `fcfsd` subsystem\n"
5103msgstr ""
5104
5105#: src/namestore/gnunet-namestore-fcfsd.c:1114
5106#, fuzzy
5107msgid "Failed to start HTTP server\n"
5108msgstr "Lỗi bắt đầu thu thập.\n"
5109
5110#: src/namestore/gnunet-namestore-fcfsd.c:1162
5111#, fuzzy
5112msgid "Failed to connect to identity\n"
5113msgstr "Lỗi kết nối đến gnunetd.\n"
5114
5115#: src/namestore/gnunet-namestore-fcfsd.c:1189
5116msgid "name of the zone that is to be managed by FCFSD"
5117msgstr ""
5118
5119#: src/namestore/gnunet-namestore-fcfsd.c:1209
5120msgid "GNU Name System First Come First Serve name registration service"
5121msgstr ""
5122
5123#: src/namestore/gnunet-namestore.c:334 5059#: src/namestore/gnunet-namestore.c:334
5124#, fuzzy, c-format 5060#, fuzzy, c-format
5125msgid "Adding record failed: %s\n" 5061msgid "Adding record failed: %s\n"
@@ -5342,7 +5278,71 @@ msgstr ""
5342msgid "name of the ego controlling the zone" 5278msgid "name of the ego controlling the zone"
5343msgstr "" 5279msgstr ""
5344 5280
5345#: src/namestore/gnunet-service-namestore.c:864 5281#: src/namestore/gnunet-namestore-fcfsd.c:551
5282#, fuzzy, c-format
5283msgid "Unsupported form value `%s'\n"
5284msgstr "Lệnh không được hỗ trợ « %s ». Đang hủy bỏ.\n"
5285
5286#: src/namestore/gnunet-namestore-fcfsd.c:578
5287#, fuzzy, c-format
5288msgid "Failed to create record for domain `%s': %s\n"
5289msgstr "Không thể truy cập đến tập tin gnunet-directory « %s »\n"
5290
5291#: src/namestore/gnunet-namestore-fcfsd.c:599
5292msgid "Error when mapping zone to name\n"
5293msgstr ""
5294
5295#: src/namestore/gnunet-namestore-fcfsd.c:631
5296#, c-format
5297msgid "Found existing name `%s' for the given key\n"
5298msgstr ""
5299
5300#: src/namestore/gnunet-namestore-fcfsd.c:693
5301#, c-format
5302msgid "Found %u existing records for domain `%s'\n"
5303msgstr ""
5304
5305#: src/namestore/gnunet-namestore-fcfsd.c:783
5306#, fuzzy, c-format
5307msgid "Failed to create page for `%s'\n"
5308msgstr "Không thể tạo miền tên.\n"
5309
5310#: src/namestore/gnunet-namestore-fcfsd.c:802
5311#, fuzzy, c-format
5312msgid "Failed to setup post processor for `%s'\n"
5313msgstr "Lỗi cập nhật dữ liệu cho mô-đun « %s »\n"
5314
5315#: src/namestore/gnunet-namestore-fcfsd.c:839
5316msgid "Domain name must not contain `.'\n"
5317msgstr ""
5318
5319#: src/namestore/gnunet-namestore-fcfsd.c:848
5320msgid "Domain name must not contain `+'\n"
5321msgstr ""
5322
5323#: src/namestore/gnunet-namestore-fcfsd.c:1083
5324msgid "No ego configured for `fcfsd` subsystem\n"
5325msgstr ""
5326
5327#: src/namestore/gnunet-namestore-fcfsd.c:1114
5328#, fuzzy
5329msgid "Failed to start HTTP server\n"
5330msgstr "Lỗi bắt đầu thu thập.\n"
5331
5332#: src/namestore/gnunet-namestore-fcfsd.c:1162
5333#, fuzzy
5334msgid "Failed to connect to identity\n"
5335msgstr "Lỗi kết nối đến gnunetd.\n"
5336
5337#: src/namestore/gnunet-namestore-fcfsd.c:1189
5338msgid "name of the zone that is to be managed by FCFSD"
5339msgstr ""
5340
5341#: src/namestore/gnunet-namestore-fcfsd.c:1209
5342msgid "GNU Name System First Come First Serve name registration service"
5343msgstr ""
5344
5345#: src/namestore/gnunet-service-namestore.c:866
5346#, fuzzy, c-format 5346#, fuzzy, c-format
5347msgid "Failed to replicate block in namecache: %s\n" 5347msgid "Failed to replicate block in namecache: %s\n"
5348msgstr "Lỗi cập nhật dữ liệu cho mô-đun « %s »\n" 5348msgstr "Lỗi cập nhật dữ liệu cho mô-đun « %s »\n"
@@ -5661,6 +5661,11 @@ msgstr ""
5661msgid "`upnpc' command not found\n" 5661msgid "`upnpc' command not found\n"
5662msgstr "" 5662msgstr ""
5663 5663
5664#: src/nse/gnunet-nse.c:124
5665#, fuzzy
5666msgid "Show network size estimates from NSE service."
5667msgstr "# các yêu cầu get (lấy) dht được nhận"
5668
5664#: src/nse/gnunet-nse-profiler.c:857 5669#: src/nse/gnunet-nse-profiler.c:857
5665#, fuzzy 5670#, fuzzy
5666msgid "limit to the number of connections to NSE services, 0 for none" 5671msgid "limit to the number of connections to NSE services, 0 for none"
@@ -5687,17 +5692,71 @@ msgstr ""
5687msgid "Measure quality and performance of the NSE service." 5692msgid "Measure quality and performance of the NSE service."
5688msgstr "Không thể truy cập đến dịch vụ" 5693msgstr "Không thể truy cập đến dịch vụ"
5689 5694
5690#: src/nse/gnunet-nse.c:124
5691#, fuzzy
5692msgid "Show network size estimates from NSE service."
5693msgstr "# các yêu cầu get (lấy) dht được nhận"
5694
5695#: src/nse/gnunet-service-nse.c:1437 5695#: src/nse/gnunet-service-nse.c:1437
5696#: src/revocation/gnunet-service-revocation.c:846 src/util/gnunet-scrypt.c:247 5696#: src/revocation/gnunet-service-revocation.c:846 src/util/gnunet-scrypt.c:247
5697#, fuzzy 5697#, fuzzy
5698msgid "Value is too large.\n" 5698msgid "Value is too large.\n"
5699msgstr "Giá trị không nằm trong phạm vi được phép." 5699msgstr "Giá trị không nằm trong phạm vi được phép."
5700 5700
5701#: src/peerinfo/gnunet-service-peerinfo.c:175
5702#, fuzzy, c-format
5703msgid "Removing expired address of transport `%s'\n"
5704msgstr "Đã nạp truyền tải « %s »\n"
5705
5706#: src/peerinfo/gnunet-service-peerinfo.c:306
5707#, fuzzy, c-format
5708msgid "Failed to parse HELLO in file `%s': %s\n"
5709msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n"
5710
5711#: src/peerinfo/gnunet-service-peerinfo.c:323
5712#: src/peerinfo/gnunet-service-peerinfo.c:348
5713#, fuzzy, c-format
5714msgid "Failed to parse HELLO in file `%s'\n"
5715msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n"
5716
5717#: src/peerinfo/gnunet-service-peerinfo.c:426
5718msgid "# peers known"
5719msgstr ""
5720
5721#: src/peerinfo/gnunet-service-peerinfo.c:468
5722#, c-format
5723msgid ""
5724"File `%s' in directory `%s' does not match naming convention. Removed.\n"
5725msgstr ""
5726"Tập tin « %s » trong thư mục « %s » không tùy theo quy ước đặt tên. Bị gỡ "
5727"bỏ.\n"
5728
5729#: src/peerinfo/gnunet-service-peerinfo.c:624
5730#, fuzzy, c-format
5731msgid "Scanning directory `%s'\n"
5732msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n"
5733
5734#: src/peerinfo/gnunet-service-peerinfo.c:631
5735#, c-format
5736msgid "Still no peers found in `%s'!\n"
5737msgstr "Vẫn còn không tìm thấy đồng đẳng trong « %s ».\n"
5738
5739#: src/peerinfo/gnunet-service-peerinfo.c:1024
5740#, fuzzy, c-format
5741msgid "Cleaning up directory `%s'\n"
5742msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n"
5743
5744#: src/peerinfo/gnunet-service-peerinfo.c:1319
5745#, c-format
5746msgid "Importing HELLOs from `%s'\n"
5747msgstr ""
5748
5749#: src/peerinfo/gnunet-service-peerinfo.c:1332
5750msgid "Skipping import of included HELLOs\n"
5751msgstr ""
5752
5753#: src/peerinfo/peerinfo_api.c:217
5754#, fuzzy
5755msgid "Failed to receive response from `PEERINFO' service."
5756msgstr ""
5757"\n"
5758"Không nhận được đáp ứng từ gnunetd.\n"
5759
5701#: src/peerinfo-tool/gnunet-peerinfo.c:237 5760#: src/peerinfo-tool/gnunet-peerinfo.c:237
5702#, fuzzy, c-format 5761#, fuzzy, c-format
5703msgid "%sPeer `%s'\n" 5762msgid "%sPeer `%s'\n"
@@ -5795,65 +5854,6 @@ msgstr "Không thể nạp phần bổ sung truyền tải « %s »\n"
5795msgid "Peerinfo REST API initialized\n" 5854msgid "Peerinfo REST API initialized\n"
5796msgstr "Lỗi sơ khởi lõi.\n" 5855msgstr "Lỗi sơ khởi lõi.\n"
5797 5856
5798#: src/peerinfo/gnunet-service-peerinfo.c:175
5799#, fuzzy, c-format
5800msgid "Removing expired address of transport `%s'\n"
5801msgstr "Đã nạp truyền tải « %s »\n"
5802
5803#: src/peerinfo/gnunet-service-peerinfo.c:306
5804#, fuzzy, c-format
5805msgid "Failed to parse HELLO in file `%s': %s\n"
5806msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n"
5807
5808#: src/peerinfo/gnunet-service-peerinfo.c:323
5809#: src/peerinfo/gnunet-service-peerinfo.c:348
5810#, fuzzy, c-format
5811msgid "Failed to parse HELLO in file `%s'\n"
5812msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n"
5813
5814#: src/peerinfo/gnunet-service-peerinfo.c:426
5815msgid "# peers known"
5816msgstr ""
5817
5818#: src/peerinfo/gnunet-service-peerinfo.c:468
5819#, c-format
5820msgid ""
5821"File `%s' in directory `%s' does not match naming convention. Removed.\n"
5822msgstr ""
5823"Tập tin « %s » trong thư mục « %s » không tùy theo quy ước đặt tên. Bị gỡ "
5824"bỏ.\n"
5825
5826#: src/peerinfo/gnunet-service-peerinfo.c:624
5827#, fuzzy, c-format
5828msgid "Scanning directory `%s'\n"
5829msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n"
5830
5831#: src/peerinfo/gnunet-service-peerinfo.c:631
5832#, c-format
5833msgid "Still no peers found in `%s'!\n"
5834msgstr "Vẫn còn không tìm thấy đồng đẳng trong « %s ».\n"
5835
5836#: src/peerinfo/gnunet-service-peerinfo.c:1024
5837#, fuzzy, c-format
5838msgid "Cleaning up directory `%s'\n"
5839msgstr "Lỗi đọc danh sách bạn bè từ « %s »\n"
5840
5841#: src/peerinfo/gnunet-service-peerinfo.c:1319
5842#, c-format
5843msgid "Importing HELLOs from `%s'\n"
5844msgstr ""
5845
5846#: src/peerinfo/gnunet-service-peerinfo.c:1332
5847msgid "Skipping import of included HELLOs\n"
5848msgstr ""
5849
5850#: src/peerinfo/peerinfo_api.c:217
5851#, fuzzy
5852msgid "Failed to receive response from `PEERINFO' service."
5853msgstr ""
5854"\n"
5855"Không nhận được đáp ứng từ gnunetd.\n"
5856
5857#: src/peerstore/gnunet-peerstore.c:92 5857#: src/peerstore/gnunet-peerstore.c:92
5858msgid "peerstore" 5858msgid "peerstore"
5859msgstr "" 5859msgstr ""
@@ -6289,6 +6289,18 @@ msgstr ""
6289msgid "Could not open revocation database file!" 6289msgid "Could not open revocation database file!"
6290msgstr "« %s »: Không thể kết nối.\n" 6290msgstr "« %s »: Không thể kết nối.\n"
6291 6291
6292#: src/rps/gnunet-rps.c:270
6293msgid "Seed a PeerID"
6294msgstr ""
6295
6296#: src/rps/gnunet-rps.c:275
6297msgid "Get updates of view (0 for infinite updates)"
6298msgstr ""
6299
6300#: src/rps/gnunet-rps.c:279
6301msgid "Get peers from biased stream"
6302msgstr ""
6303
6292#: src/rps/gnunet-rps-profiler.c:3200 6304#: src/rps/gnunet-rps-profiler.c:3200
6293msgid "duration of the profiling" 6305msgid "duration of the profiling"
6294msgstr "" 6306msgstr ""
@@ -6308,18 +6320,6 @@ msgstr "số lần lặp lại"
6308msgid "Measure quality and performance of the RPS service." 6320msgid "Measure quality and performance of the RPS service."
6309msgstr "Không thể truy cập đến dịch vụ" 6321msgstr "Không thể truy cập đến dịch vụ"
6310 6322
6311#: src/rps/gnunet-rps.c:270
6312msgid "Seed a PeerID"
6313msgstr ""
6314
6315#: src/rps/gnunet-rps.c:275
6316msgid "Get updates of view (0 for infinite updates)"
6317msgstr ""
6318
6319#: src/rps/gnunet-rps.c:279
6320msgid "Get peers from biased stream"
6321msgstr ""
6322
6323#: src/scalarproduct/gnunet-scalarproduct.c:229 6323#: src/scalarproduct/gnunet-scalarproduct.c:229
6324#, fuzzy 6324#, fuzzy
6325msgid "You must specify at least one message ID to check!\n" 6325msgid "You must specify at least one message ID to check!\n"
@@ -6375,10 +6375,10 @@ msgstr ""
6375msgid "Calculate the Vectorproduct with a GNUnet peer." 6375msgid "Calculate the Vectorproduct with a GNUnet peer."
6376msgstr "" 6376msgstr ""
6377 6377
6378#: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1127
6379#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1073
6380#: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1363 6378#: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1363
6381#: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1366 6379#: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1366
6380#: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1127
6381#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1073
6382#, fuzzy 6382#, fuzzy
6383msgid "Connect to CADET failed\n" 6383msgid "Connect to CADET failed\n"
6384msgstr " Không kết nối được (lỗi ?)\n" 6384msgstr " Không kết nối được (lỗi ?)\n"
@@ -6722,6 +6722,16 @@ msgstr "« %s » đang tắt.\n"
6722msgid "%.s Unknown result code." 6722msgid "%.s Unknown result code."
6723msgstr "" 6723msgstr ""
6724 6724
6725#: src/testbed/gnunet_testbed_mpi_spawn.c:119
6726#, fuzzy
6727msgid "Waiting for child to exit.\n"
6728msgstr "Đang đợi các đồng đẳng kết nối"
6729
6730#: src/testbed/gnunet_testbed_mpi_spawn.c:242
6731#, fuzzy, c-format
6732msgid "Spawning process `%s'\n"
6733msgstr "Đang bắt đầu tài về « %s »\n"
6734
6725#: src/testbed/gnunet-testbed-profiler.c:290 6735#: src/testbed/gnunet-testbed-profiler.c:290
6726msgid "tolerate COUNT number of continious timeout failures" 6736msgid "tolerate COUNT number of continious timeout failures"
6727msgstr "" 6737msgstr ""
@@ -6733,16 +6743,6 @@ msgid ""
6733"signal is received" 6743"signal is received"
6734msgstr "" 6744msgstr ""
6735 6745
6736#: src/testbed/gnunet_testbed_mpi_spawn.c:119
6737#, fuzzy
6738msgid "Waiting for child to exit.\n"
6739msgstr "Đang đợi các đồng đẳng kết nối"
6740
6741#: src/testbed/gnunet_testbed_mpi_spawn.c:242
6742#, fuzzy, c-format
6743msgid "Spawning process `%s'\n"
6744msgstr "Đang bắt đầu tài về « %s »\n"
6745
6746#: src/testbed/testbed_api.c:399 6746#: src/testbed/testbed_api.c:399
6747#, fuzzy, c-format 6747#, fuzzy, c-format
6748msgid "Adding host %u failed with error: %s\n" 6748msgid "Adding host %u failed with error: %s\n"
@@ -7082,6 +7082,10 @@ msgstr "Không thể tạo miền tên.\n"
7082msgid "GNUnet UNIX domain socket communicator" 7082msgid "GNUnet UNIX domain socket communicator"
7083msgstr "" 7083msgstr ""
7084 7084
7085#: src/transport/gnunet-service-transport_ats.c:137
7086msgid "# Addresses given to ATS"
7087msgstr ""
7088
7085#: src/transport/gnunet-service-transport.c:445 7089#: src/transport/gnunet-service-transport.c:445
7086#, fuzzy 7090#, fuzzy
7087msgid "# messages dropped due to slow client" 7091msgid "# messages dropped due to slow client"
@@ -7126,10 +7130,6 @@ msgstr "Không thể lấy địa chỉ của đồng đẳng « %s ».\n"
7126msgid "Adding blacklisting entry for peer `%s':`%s'\n" 7130msgid "Adding blacklisting entry for peer `%s':`%s'\n"
7127msgstr "" 7131msgstr ""
7128 7132
7129#: src/transport/gnunet-service-transport_ats.c:137
7130msgid "# Addresses given to ATS"
7131msgstr ""
7132
7133#: src/transport/gnunet-service-transport_hello.c:195 7133#: src/transport/gnunet-service-transport_hello.c:195
7134msgid "# refreshed my HELLO" 7134msgid "# refreshed my HELLO"
7135msgstr "" 7135msgstr ""
@@ -7469,46 +7469,6 @@ msgstr ""
7469msgid "# HELLOs given to peerinfo" 7469msgid "# HELLOs given to peerinfo"
7470msgstr "Nhận được thông báo « %s » sai từ đồng đẳng « %s ».\n" 7470msgstr "Nhận được thông báo « %s » sai từ đồng đẳng « %s ».\n"
7471 7471
7472#: src/transport/gnunet-transport-profiler.c:220
7473#, c-format
7474msgid "%llu B in %llu ms == %.2f KB/s!\n"
7475msgstr ""
7476
7477#: src/transport/gnunet-transport-profiler.c:577
7478msgid "send data to peer"
7479msgstr ""
7480
7481#: src/transport/gnunet-transport-profiler.c:581
7482#, fuzzy
7483msgid "receive data from peer"
7484msgstr "Yêu cầu cấp %d từ đồng đẳng %d\n"
7485
7486#: src/transport/gnunet-transport-profiler.c:586
7487#, fuzzy
7488msgid "iterations"
7489msgstr "Tùy chọn chung"
7490
7491#: src/transport/gnunet-transport-profiler.c:591
7492#, fuzzy
7493msgid "number of messages to send"
7494msgstr "số tin nhắn cần dùng mỗi lần lặp"
7495
7496#: src/transport/gnunet-transport-profiler.c:596
7497#, fuzzy
7498msgid "message size to use"
7499msgstr "kích cỡ tin nhắn"
7500
7501#: src/transport/gnunet-transport-profiler.c:601
7502#: src/transport/gnunet-transport.c:1404
7503msgid "peer identity"
7504msgstr ""
7505
7506#: src/transport/gnunet-transport-profiler.c:614
7507#: src/transport/gnunet-transport.c:1426
7508#, fuzzy
7509msgid "Direct access to transport service."
7510msgstr "Lỗi kết nối đến gnunetd.\n"
7511
7512#: src/transport/gnunet-transport.c:406 7472#: src/transport/gnunet-transport.c:406
7513#, fuzzy, c-format 7473#, fuzzy, c-format
7514msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" 7474msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n"
@@ -7648,6 +7608,11 @@ msgstr "In ra thông tin về các đồng đẳng GNUnet."
7648msgid "do not resolve hostnames" 7608msgid "do not resolve hostnames"
7649msgstr "không quyết định các tên máy" 7609msgstr "không quyết định các tên máy"
7650 7610
7611#: src/transport/gnunet-transport.c:1404
7612#: src/transport/gnunet-transport-profiler.c:601
7613msgid "peer identity"
7614msgstr ""
7615
7651#: src/transport/gnunet-transport.c:1408 7616#: src/transport/gnunet-transport.c:1408
7652msgid "monitor plugin sessions" 7617msgid "monitor plugin sessions"
7653msgstr "" 7618msgstr ""
@@ -7656,6 +7621,41 @@ msgstr ""
7656msgid "send data for benchmarking to the other peer (until CTRL-C)" 7621msgid "send data for benchmarking to the other peer (until CTRL-C)"
7657msgstr "" 7622msgstr ""
7658 7623
7624#: src/transport/gnunet-transport.c:1426
7625#: src/transport/gnunet-transport-profiler.c:614
7626#, fuzzy
7627msgid "Direct access to transport service."
7628msgstr "Lỗi kết nối đến gnunetd.\n"
7629
7630#: src/transport/gnunet-transport-profiler.c:220
7631#, c-format
7632msgid "%llu B in %llu ms == %.2f KB/s!\n"
7633msgstr ""
7634
7635#: src/transport/gnunet-transport-profiler.c:577
7636msgid "send data to peer"
7637msgstr ""
7638
7639#: src/transport/gnunet-transport-profiler.c:581
7640#, fuzzy
7641msgid "receive data from peer"
7642msgstr "Yêu cầu cấp %d từ đồng đẳng %d\n"
7643
7644#: src/transport/gnunet-transport-profiler.c:586
7645#, fuzzy
7646msgid "iterations"
7647msgstr "Tùy chọn chung"
7648
7649#: src/transport/gnunet-transport-profiler.c:591
7650#, fuzzy
7651msgid "number of messages to send"
7652msgstr "số tin nhắn cần dùng mỗi lần lặp"
7653
7654#: src/transport/gnunet-transport-profiler.c:596
7655#, fuzzy
7656msgid "message size to use"
7657msgstr "kích cỡ tin nhắn"
7658
7659#: src/transport/plugin_transport_http_client.c:1489 7659#: src/transport/plugin_transport_http_client.c:1489
7660#: src/transport/plugin_transport_http_server.c:2331 7660#: src/transport/plugin_transport_http_server.c:2331
7661#: src/transport/plugin_transport_http_server.c:3562 7661#: src/transport/plugin_transport_http_server.c:3562
@@ -7934,6 +7934,21 @@ msgstr ""
7934msgid "TCP transport advertises itself as being on port %llu\n" 7934msgid "TCP transport advertises itself as being on port %llu\n"
7935msgstr "" 7935msgstr ""
7936 7936
7937#: src/transport/plugin_transport_udp_broadcasting.c:169
7938#, fuzzy
7939msgid "# Multicast HELLO beacons received via UDP"
7940msgstr "# các thông báo PONG đã mật mã được nhận"
7941
7942#: src/transport/plugin_transport_udp_broadcasting.c:553
7943msgid ""
7944"Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"
7945msgstr ""
7946
7947#: src/transport/plugin_transport_udp_broadcasting.c:571
7948#, c-format
7949msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n"
7950msgstr ""
7951
7937#: src/transport/plugin_transport_udp.c:3169 7952#: src/transport/plugin_transport_udp.c:3169
7938#, c-format 7953#, c-format
7939msgid "" 7954msgid ""
@@ -7982,21 +7997,6 @@ msgstr "« %s » không sẵn sàng.\n"
7982msgid "Failed to create UDP network sockets\n" 7997msgid "Failed to create UDP network sockets\n"
7983msgstr "Không thể tạo miền tên.\n" 7998msgstr "Không thể tạo miền tên.\n"
7984 7999
7985#: src/transport/plugin_transport_udp_broadcasting.c:169
7986#, fuzzy
7987msgid "# Multicast HELLO beacons received via UDP"
7988msgstr "# các thông báo PONG đã mật mã được nhận"
7989
7990#: src/transport/plugin_transport_udp_broadcasting.c:553
7991msgid ""
7992"Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"
7993msgstr ""
7994
7995#: src/transport/plugin_transport_udp_broadcasting.c:571
7996#, c-format
7997msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n"
7998msgstr ""
7999
8000#: src/transport/plugin_transport_unix.c:1396 8000#: src/transport/plugin_transport_unix.c:1396
8001#, fuzzy, c-format 8001#, fuzzy, c-format
8002msgid "Cannot bind to `%s'\n" 8002msgid "Cannot bind to `%s'\n"
@@ -8084,17 +8084,17 @@ msgstr "Không đủ quyền cho « %s ».\n"
8084msgid "Accepting connection from `%s': %p\n" 8084msgid "Accepting connection from `%s': %p\n"
8085msgstr "" 8085msgstr ""
8086 8086
8087#: src/transport/tcp_server_legacy.c:478 src/util/service.c:1400 8087#: src/transport/tcp_server_legacy.c:478 src/util/service.c:1397
8088#, fuzzy, c-format 8088#, fuzzy, c-format
8089msgid "`%s' failed for port %d (%s).\n" 8089msgid "`%s' failed for port %d (%s).\n"
8090msgstr "« %s » thất bại cho ổ đĩa « %s »: %u\n" 8090msgstr "« %s » thất bại cho ổ đĩa « %s »: %u\n"
8091 8091
8092#: src/transport/tcp_server_legacy.c:488 src/util/service.c:1412 8092#: src/transport/tcp_server_legacy.c:488 src/util/service.c:1409
8093#, fuzzy, c-format 8093#, fuzzy, c-format
8094msgid "`%s' failed for port %d (%s): address already in use\n" 8094msgid "`%s' failed for port %d (%s): address already in use\n"
8095msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n" 8095msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n"
8096 8096
8097#: src/transport/tcp_server_legacy.c:494 src/util/service.c:1419 8097#: src/transport/tcp_server_legacy.c:494 src/util/service.c:1416
8098#, fuzzy, c-format 8098#, fuzzy, c-format
8099msgid "`%s' failed for `%s': address already in use\n" 8099msgid "`%s' failed for `%s': address already in use\n"
8100msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n" 8100msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n"
@@ -8106,7 +8106,7 @@ msgid ""
8106"`GNUNET_SERVER_receive_done' after %s\n" 8106"`GNUNET_SERVER_receive_done' after %s\n"
8107msgstr "" 8107msgstr ""
8108 8108
8109#: src/transport/tcp_service_legacy.c:345 src/util/service.c:837 8109#: src/transport/tcp_service_legacy.c:345 src/util/service.c:834
8110#, fuzzy, c-format 8110#, fuzzy, c-format
8111msgid "Unknown address family %d\n" 8111msgid "Unknown address family %d\n"
8112msgstr "\tKhông rõ miền tên « %s »\n" 8112msgstr "\tKhông rõ miền tên « %s »\n"
@@ -8116,23 +8116,23 @@ msgstr "\tKhông rõ miền tên « %s »\n"
8116msgid "Access from `%s' denied to service `%s'\n" 8116msgid "Access from `%s' denied to service `%s'\n"
8117msgstr "" 8117msgstr ""
8118 8118
8119#: src/transport/tcp_service_legacy.c:410 src/util/service.c:950 8119#: src/transport/tcp_service_legacy.c:410 src/util/service.c:947
8120#, c-format 8120#, c-format
8121msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 8121msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
8122msgstr "" 8122msgstr ""
8123 8123
8124#: src/transport/tcp_service_legacy.c:451 src/util/service.c:991 8124#: src/transport/tcp_service_legacy.c:451 src/util/service.c:988
8125#, c-format 8125#, c-format
8126msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 8126msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
8127msgstr "" 8127msgstr ""
8128 8128
8129#: src/transport/tcp_service_legacy.c:890 8129#: src/transport/tcp_service_legacy.c:890
8130#: src/transport/tcp_service_legacy.c:910 src/util/service.c:1480 8130#: src/transport/tcp_service_legacy.c:910 src/util/service.c:1477
8131#, c-format 8131#, c-format
8132msgid "Specified value for `%s' of service `%s' is invalid\n" 8132msgid "Specified value for `%s' of service `%s' is invalid\n"
8133msgstr "" 8133msgstr ""
8134 8134
8135#: src/transport/tcp_service_legacy.c:935 src/util/service.c:1504 8135#: src/transport/tcp_service_legacy.c:935 src/util/service.c:1501
8136#, c-format 8136#, c-format
8137msgid "Could not access pre-bound socket %u, will try to bind myself\n" 8137msgid "Could not access pre-bound socket %u, will try to bind myself\n"
8138msgstr "" 8138msgstr ""
@@ -8147,45 +8147,45 @@ msgstr "Lỗi chạy %s: %s %d\n"
8147msgid "Service `%s' runs at %s\n" 8147msgid "Service `%s' runs at %s\n"
8148msgstr "Đồng đẳng « %s » có mức tin cậy %8u\n" 8148msgstr "Đồng đẳng « %s » có mức tin cậy %8u\n"
8149 8149
8150#: src/transport/tcp_service_legacy.c:1193 src/util/service.c:1750 8150#: src/transport/tcp_service_legacy.c:1193 src/util/service.c:1747
8151msgid "Service process failed to initialize\n" 8151msgid "Service process failed to initialize\n"
8152msgstr "" 8152msgstr ""
8153 8153
8154#: src/transport/tcp_service_legacy.c:1198 src/util/service.c:1755 8154#: src/transport/tcp_service_legacy.c:1198 src/util/service.c:1752
8155msgid "Service process could not initialize server function\n" 8155msgid "Service process could not initialize server function\n"
8156msgstr "" 8156msgstr ""
8157 8157
8158#: src/transport/tcp_service_legacy.c:1203 src/util/service.c:1760 8158#: src/transport/tcp_service_legacy.c:1203 src/util/service.c:1757
8159msgid "Service process failed to report status\n" 8159msgid "Service process failed to report status\n"
8160msgstr "" 8160msgstr ""
8161 8161
8162#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1177 8162#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1177
8163#: src/util/service.c:1641 8163#: src/util/service.c:1638
8164#, c-format 8164#, c-format
8165msgid "Cannot obtain information about user `%s': %s\n" 8165msgid "Cannot obtain information about user `%s': %s\n"
8166msgstr "Không thể lấy thông tin về người dùng « %s »: %s\n" 8166msgstr "Không thể lấy thông tin về người dùng « %s »: %s\n"
8167 8167
8168#: src/transport/tcp_service_legacy.c:1255 src/util/service.c:1643 8168#: src/transport/tcp_service_legacy.c:1255 src/util/service.c:1640
8169msgid "No such user" 8169msgid "No such user"
8170msgstr "Không có người dùng như vậy" 8170msgstr "Không có người dùng như vậy"
8171 8171
8172#: src/transport/tcp_service_legacy.c:1269 src/util/service.c:1657 8172#: src/transport/tcp_service_legacy.c:1269 src/util/service.c:1654
8173#, c-format 8173#, c-format
8174msgid "Cannot change user/group to `%s': %s\n" 8174msgid "Cannot change user/group to `%s': %s\n"
8175msgstr "Không thể thay đổi người dùng/nhóm thành « %s »: %s\n" 8175msgstr "Không thể thay đổi người dùng/nhóm thành « %s »: %s\n"
8176 8176
8177#: src/transport/tcp_service_legacy.c:1348 src/util/service.c:1999 8177#: src/transport/tcp_service_legacy.c:1348 src/util/service.c:1996
8178msgid "do daemonize (detach from terminal)" 8178msgid "do daemonize (detach from terminal)"
8179msgstr "" 8179msgstr ""
8180 8180
8181#: src/transport/tcp_service_legacy.c:1397 8181#: src/transport/tcp_service_legacy.c:1397
8182#: src/transport/transport-testing2.c:906 src/util/service.c:2073 8182#: src/transport/transport-testing2.c:906 src/util/service.c:2070
8183#: src/util/service.c:2085 8183#: src/util/service.c:2082
8184#, fuzzy, c-format 8184#, fuzzy, c-format
8185msgid "Malformed configuration file `%s', exit ...\n" 8185msgid "Malformed configuration file `%s', exit ...\n"
8186msgstr "Không thể lưu tập tin cấu hình « %s »:" 8186msgstr "Không thể lưu tập tin cấu hình « %s »:"
8187 8187
8188#: src/transport/tcp_service_legacy.c:1407 src/util/service.c:2095 8188#: src/transport/tcp_service_legacy.c:1407 src/util/service.c:2092
8189#, fuzzy 8189#, fuzzy
8190msgid "Malformed configuration, exit ...\n" 8190msgid "Malformed configuration, exit ...\n"
8191msgstr "Không thể lưu tập tin cấu hình « %s »:" 8191msgstr "Không thể lưu tập tin cấu hình « %s »:"
@@ -8228,90 +8228,90 @@ msgstr ""
8228msgid "Metadata `%s' failed to deserialize" 8228msgid "Metadata `%s' failed to deserialize"
8229msgstr "" 8229msgstr ""
8230 8230
8231#: src/util/client.c:739 src/util/client.c:931 8231#: src/util/client.c:747 src/util/client.c:937
8232msgid "not a valid filename" 8232msgid "not a valid filename"
8233msgstr "" 8233msgstr ""
8234 8234
8235#: src/util/client.c:1097 8235#: src/util/client.c:1103
8236#, c-format 8236#, c-format
8237msgid "Need a non-empty hostname for service `%s'.\n" 8237msgid "Need a non-empty hostname for service `%s'.\n"
8238msgstr "" 8238msgstr ""
8239 8239
8240#: src/util/common_logging.c:259 src/util/common_logging.c:1116 8240#: src/util/common_logging.c:259 src/util/common_logging.c:1112
8241msgid "DEBUG" 8241msgid "DEBUG"
8242msgstr "GỠ LỖI" 8242msgstr "GỠ LỖI"
8243 8243
8244#: src/util/common_logging.c:261 src/util/common_logging.c:1114 8244#: src/util/common_logging.c:261 src/util/common_logging.c:1110
8245msgid "INFO" 8245msgid "INFO"
8246msgstr "TIN" 8246msgstr "TIN"
8247 8247
8248#: src/util/common_logging.c:263 src/util/common_logging.c:1112 8248#: src/util/common_logging.c:263 src/util/common_logging.c:1108
8249msgid "MESSAGE" 8249msgid "MESSAGE"
8250msgstr "" 8250msgstr ""
8251 8251
8252#: src/util/common_logging.c:265 src/util/common_logging.c:1110 8252#: src/util/common_logging.c:265 src/util/common_logging.c:1106
8253msgid "WARNING" 8253msgid "WARNING"
8254msgstr "CẢNH BÁO" 8254msgstr "CẢNH BÁO"
8255 8255
8256#: src/util/common_logging.c:267 src/util/common_logging.c:1108 8256#: src/util/common_logging.c:267 src/util/common_logging.c:1104
8257msgid "ERROR" 8257msgid "ERROR"
8258msgstr "LỖI" 8258msgstr "LỖI"
8259 8259
8260#: src/util/common_logging.c:269 src/util/common_logging.c:1118 8260#: src/util/common_logging.c:269 src/util/common_logging.c:1114
8261msgid "NONE" 8261msgid "NONE"
8262msgstr "" 8262msgstr ""
8263 8263
8264#: src/util/common_logging.c:630 src/util/common_logging.c:669 8264#: src/util/common_logging.c:626 src/util/common_logging.c:665
8265#, c-format 8265#, c-format
8266msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" 8266msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n"
8267msgstr "" 8267msgstr ""
8268 8268
8269#: src/util/common_logging.c:906 8269#: src/util/common_logging.c:902
8270#, fuzzy, c-format 8270#, fuzzy, c-format
8271msgid "Message `%.*s' repeated %u times in the last %s\n" 8271msgid "Message `%.*s' repeated %u times in the last %s\n"
8272msgstr "Thông điệp « %.*s » đã lặp lại %u lần trong %llu giây trước\n" 8272msgstr "Thông điệp « %.*s » đã lặp lại %u lần trong %llu giây trước\n"
8273 8273
8274#: src/util/common_logging.c:1119 8274#: src/util/common_logging.c:1115
8275msgid "INVALID" 8275msgid "INVALID"
8276msgstr "" 8276msgstr ""
8277 8277
8278#: src/util/common_logging.c:1400 8278#: src/util/common_logging.c:1396
8279msgid "unknown address" 8279msgid "unknown address"
8280msgstr "" 8280msgstr ""
8281 8281
8282#: src/util/common_logging.c:1445 8282#: src/util/common_logging.c:1441
8283msgid "invalid address" 8283msgid "invalid address"
8284msgstr "" 8284msgstr ""
8285 8285
8286#: src/util/common_logging.c:1464 8286#: src/util/common_logging.c:1460
8287#, fuzzy, c-format 8287#, fuzzy, c-format
8288msgid "Configuration fails to specify option `%s' in section `%s'!\n" 8288msgid "Configuration fails to specify option `%s' in section `%s'!\n"
8289msgstr "" 8289msgstr ""
8290"Cấu hình không thỏa mãn các ràng buộc của tập tin đặc tả cấu hình « %s ».\n" 8290"Cấu hình không thỏa mãn các ràng buộc của tập tin đặc tả cấu hình « %s ».\n"
8291 8291
8292#: src/util/common_logging.c:1487 8292#: src/util/common_logging.c:1483
8293#, fuzzy, c-format 8293#, fuzzy, c-format
8294msgid "" 8294msgid ""
8295"Configuration specifies invalid value for option `%s' in section `%s': %s\n" 8295"Configuration specifies invalid value for option `%s' in section `%s': %s\n"
8296msgstr "" 8296msgstr ""
8297"Cấu hình không thỏa mãn các ràng buộc của tập tin đặc tả cấu hình « %s ».\n" 8297"Cấu hình không thỏa mãn các ràng buộc của tập tin đặc tả cấu hình « %s ».\n"
8298 8298
8299#: src/util/configuration.c:325 8299#: src/util/configuration.c:402
8300#, fuzzy, c-format 8300#, fuzzy, c-format
8301msgid "Syntax error while deserializing in line %u\n" 8301msgid "Syntax error while deserializing in line %u\n"
8302msgstr "Gặp lỗi cú pháp trong tập tin cấu hình « %s » tại dòng %d.\n" 8302msgstr "Gặp lỗi cú pháp trong tập tin cấu hình « %s » tại dòng %d.\n"
8303 8303
8304#: src/util/configuration.c:383 8304#: src/util/configuration.c:460
8305#, fuzzy, c-format 8305#, fuzzy, c-format
8306msgid "Error while reading file `%s'\n" 8306msgid "Error while reading file `%s'\n"
8307msgstr "Gặp lỗi khi tải xuống: %s\n" 8307msgstr "Gặp lỗi khi tải xuống: %s\n"
8308 8308
8309#: src/util/configuration.c:986 8309#: src/util/configuration.c:1063
8310#, fuzzy 8310#, fuzzy
8311msgid "Not a valid relative time specification" 8311msgid "Not a valid relative time specification"
8312msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" 8312msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n"
8313 8313
8314#: src/util/configuration.c:1077 8314#: src/util/configuration.c:1154
8315#, c-format 8315#, c-format
8316msgid "" 8316msgid ""
8317"Configuration value '%s' for '%s' in section '%s' is not in set of legal " 8317"Configuration value '%s' for '%s' in section '%s' is not in set of legal "
@@ -8320,17 +8320,17 @@ msgstr ""
8320"Giá trị cấu hình « %s » cho « %s » trong phần « %s » không phải nằm trong " 8320"Giá trị cấu hình « %s » cho « %s » trong phần « %s » không phải nằm trong "
8321"tập hợp các sự chọn được phép\n" 8321"tập hợp các sự chọn được phép\n"
8322 8322
8323#: src/util/configuration.c:1192 8323#: src/util/configuration.c:1269
8324#, c-format 8324#, c-format
8325msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" 8325msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n"
8326msgstr "" 8326msgstr ""
8327 8327
8328#: src/util/configuration.c:1224 8328#: src/util/configuration.c:1301
8329#, fuzzy, c-format 8329#, fuzzy, c-format
8330msgid "Missing closing `%s' in option `%s'\n" 8330msgid "Missing closing `%s' in option `%s'\n"
8331msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" 8331msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n"
8332 8332
8333#: src/util/configuration.c:1290 8333#: src/util/configuration.c:1367
8334#, c-format 8334#, c-format
8335msgid "" 8335msgid ""
8336"Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " 8336"Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined "
@@ -8394,7 +8394,7 @@ msgstr "libgcrypt không có phiên bản mong đợi (yêu cầu phiên bản %
8394msgid "RSA signing failed at %s:%d: %s\n" 8394msgid "RSA signing failed at %s:%d: %s\n"
8395msgstr "%s bị lỗi tại %s:%d: « %s »\n" 8395msgstr "%s bị lỗi tại %s:%d: « %s »\n"
8396 8396
8397#: src/util/crypto_rsa.c:1313 8397#: src/util/crypto_rsa.c:1314
8398#, c-format 8398#, c-format
8399msgid "RSA signature verification failed at %s:%d: %s\n" 8399msgid "RSA signature verification failed at %s:%d: %s\n"
8400msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n" 8400msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n"
@@ -8500,11 +8500,11 @@ msgstr "Tùy chọn « %s » không có nghĩa khi không có tùy chọn « %s
8500msgid "Missing mandatory option `%s'.\n" 8500msgid "Missing mandatory option `%s'.\n"
8501msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" 8501msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n"
8502 8502
8503#: src/util/getopt_helpers.c:68 8503#: src/util/getopt_helpers.c:69
8504msgid "print the version number" 8504msgid "print the version number"
8505msgstr "hiển thị số thứ tự phiên bản" 8505msgstr "hiển thị số thứ tự phiên bản"
8506 8506
8507#: src/util/getopt_helpers.c:114 8507#: src/util/getopt_helpers.c:116
8508#, c-format 8508#, c-format
8509msgid "" 8509msgid ""
8510"Arguments mandatory for long options are also mandatory for short options.\n" 8510"Arguments mandatory for long options are also mandatory for short options.\n"
@@ -8512,55 +8512,63 @@ msgstr ""
8512"Mọi đối số bắt buộc phải sử dụng với tùy chọn dài cũng bắt buộc với tùy chọn " 8512"Mọi đối số bắt buộc phải sử dụng với tùy chọn dài cũng bắt buộc với tùy chọn "
8513"ngắn.\n" 8513"ngắn.\n"
8514 8514
8515#: src/util/getopt_helpers.c:205 8515#: src/util/getopt_helpers.c:208
8516msgid "print this help" 8516msgid "print this help"
8517msgstr "hiển thị trợ giúp này" 8517msgstr "hiển thị trợ giúp này"
8518 8518
8519#: src/util/getopt_helpers.c:281 8519#: src/util/getopt_helpers.c:288
8520msgid "be verbose" 8520msgid "be verbose"
8521msgstr "xuất chi tiết" 8521msgstr "xuất chi tiết"
8522 8522
8523#: src/util/getopt_helpers.c:417 8523#: src/util/getopt_helpers.c:429
8524msgid "configure logging to use LOGLEVEL" 8524msgid "configure logging to use LOGLEVEL"
8525msgstr "cấu hình chức năng ghi sự kiện để dùng CẤP_GHI_LƯU" 8525msgstr "cấu hình chức năng ghi sự kiện để dùng CẤP_GHI_LƯU"
8526 8526
8527#: src/util/getopt_helpers.c:495 8527#: src/util/getopt_helpers.c:510
8528#, fuzzy 8528#, fuzzy
8529msgid "configure logging to write logs to FILENAME" 8529msgid "configure logging to write logs to FILENAME"
8530msgstr "cấu hình chức năng ghi sự kiện để dùng CẤP_GHI_LƯU" 8530msgstr "cấu hình chức năng ghi sự kiện để dùng CẤP_GHI_LƯU"
8531 8531
8532#: src/util/getopt_helpers.c:516 8532#: src/util/getopt_helpers.c:532
8533#, fuzzy 8533#, fuzzy
8534msgid "use configuration file FILENAME" 8534msgid "use configuration file FILENAME"
8535msgstr "cập nhật một giá trị trong tập tin cấu hình" 8535msgstr "cập nhật một giá trị trong tập tin cấu hình"
8536 8536
8537#: src/util/getopt_helpers.c:551 src/util/getopt_helpers.c:747 8537#: src/util/getopt_helpers.c:568 src/util/getopt_helpers.c:634
8538#: src/util/getopt_helpers.c:810 8538#: src/util/getopt_helpers.c:835 src/util/getopt_helpers.c:900
8539#, c-format 8539#, c-format
8540msgid "You must pass a number to the `%s' option.\n" 8540msgid "You must pass a number to the `%s' option.\n"
8541msgstr "Phải gửi một con số cho tùy chọn « %s ».\n" 8541msgstr "Phải gửi một con số cho tùy chọn « %s ».\n"
8542 8542
8543#: src/util/getopt_helpers.c:612 8543#: src/util/getopt_helpers.c:659
8544msgid "[+/-]MICROSECONDS"
8545msgstr ""
8546
8547#: src/util/getopt_helpers.c:661
8548msgid "modify system time by given offset (for debugging/testing only)"
8549msgstr ""
8550
8551#: src/util/getopt_helpers.c:696
8544#, fuzzy, c-format 8552#, fuzzy, c-format
8545msgid "You must pass relative time to the `%s' option.\n" 8553msgid "You must pass relative time to the `%s' option.\n"
8546msgstr "Phải gửi một con số cho tùy chọn « %s ».\n" 8554msgstr "Phải gửi một con số cho tùy chọn « %s ».\n"
8547 8555
8548#: src/util/getopt_helpers.c:675 8556#: src/util/getopt_helpers.c:761
8549#, fuzzy, c-format 8557#, fuzzy, c-format
8550msgid "You must pass absolute time to the `%s' option.\n" 8558msgid "You must pass absolute time to the `%s' option.\n"
8551msgstr "Phải gửi một con số cho tùy chọn « %s ».\n" 8559msgstr "Phải gửi một con số cho tùy chọn « %s ».\n"
8552 8560
8553#: src/util/getopt_helpers.c:740 8561#: src/util/getopt_helpers.c:828
8554#, c-format 8562#, c-format
8555msgid "Your input for the '%s' option has to be a non negative number \n" 8563msgid "Your input for the '%s' option has to be a non negative number\n"
8556msgstr "" 8564msgstr ""
8557 8565
8558#: src/util/getopt_helpers.c:817 8566#: src/util/getopt_helpers.c:907
8559#, fuzzy, c-format 8567#, fuzzy, c-format
8560msgid "You must pass a number below %u to the `%s' option.\n" 8568msgid "You must pass a number below %u to the `%s' option.\n"
8561msgstr "Phải gửi một con số cho tùy chọn « %s ».\n" 8569msgstr "Phải gửi một con số cho tùy chọn « %s ».\n"
8562 8570
8563#: src/util/getopt_helpers.c:902 8571#: src/util/getopt_helpers.c:994
8564#, c-format 8572#, c-format
8565msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 8573msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
8566msgstr "" 8574msgstr ""
@@ -8897,14 +8905,14 @@ msgstr ""
8897msgid "Could not resolve our FQDN: %s\n" 8905msgid "Could not resolve our FQDN: %s\n"
8898msgstr "Không thể giải quyết « %s » (%s): %s\n" 8906msgstr "Không thể giải quyết « %s » (%s): %s\n"
8899 8907
8900#: src/util/service.c:657 8908#: src/util/service.c:654
8901#, c-format 8909#, c-format
8902msgid "" 8910msgid ""
8903"Processing code for message of type %u did not call " 8911"Processing code for message of type %u did not call "
8904"`GNUNET_SERVICE_client_continue' after %s\n" 8912"`GNUNET_SERVICE_client_continue' after %s\n"
8905msgstr "" 8913msgstr ""
8906 8914
8907#: src/util/service.c:1572 8915#: src/util/service.c:1569
8908msgid "" 8916msgid ""
8909"Could not bind to any of the ports I was supposed to, refusing to run!\n" 8917"Could not bind to any of the ports I was supposed to, refusing to run!\n"
8910msgstr "" 8918msgstr ""
@@ -9225,8 +9233,8 @@ msgstr "# các byte đã nhận qua UDP"
9225msgid "Setup tunnels via VPN." 9233msgid "Setup tunnels via VPN."
9226msgstr "" 9234msgstr ""
9227 9235
9228#: src/zonemaster/gnunet-service-zonemaster-monitor.c:420
9229#: src/zonemaster/gnunet-service-zonemaster.c:849 9236#: src/zonemaster/gnunet-service-zonemaster.c:849
9237#: src/zonemaster/gnunet-service-zonemaster-monitor.c:420
9230#, fuzzy 9238#, fuzzy
9231msgid "Failed to connect to the namestore!\n" 9239msgid "Failed to connect to the namestore!\n"
9232msgstr "Không kết nối được đến trình nền gnunetd." 9240msgstr "Không kết nối được đến trình nền gnunetd."
diff --git a/po/zh_CN.po b/po/zh_CN.po
index f2889d502..66c21260f 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -7,7 +7,7 @@ msgid ""
7msgstr "" 7msgstr ""
8"Project-Id-Version: gnunet-0.8.1\n" 8"Project-Id-Version: gnunet-0.8.1\n"
9"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 9"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
10"POT-Creation-Date: 2020-01-13 14:01+0000\n" 10"POT-Creation-Date: 2020-02-13 20:41+0100\n"
11"PO-Revision-Date: 2011-07-09 12:12+0800\n" 11"PO-Revision-Date: 2011-07-09 12:12+0800\n"
12"Last-Translator: Wylmer Wang <wantinghard@gmail.com>\n" 12"Last-Translator: Wylmer Wang <wantinghard@gmail.com>\n"
13"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n" 13"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
@@ -27,8 +27,8 @@ msgid "Issuer public key `%s' is not well-formed\n"
27msgstr "“%s”的参数无效。\n" 27msgstr "“%s”的参数无效。\n"
28 28
29#: src/abd/gnunet-abd.c:558 src/abd/gnunet-service-abd.c:1747 29#: src/abd/gnunet-abd.c:558 src/abd/gnunet-service-abd.c:1747
30#: src/namestore/gnunet-namestore-fcfsd.c:1153
31#: src/namestore/gnunet-namestore.c:1001 30#: src/namestore/gnunet-namestore.c:1001
31#: src/namestore/gnunet-namestore-fcfsd.c:1153
32#, fuzzy, c-format 32#, fuzzy, c-format
33msgid "Failed to connect to namestore\n" 33msgid "Failed to connect to namestore\n"
34msgstr "初始化“%s”服务失败。\n" 34msgstr "初始化“%s”服务失败。\n"
@@ -138,7 +138,7 @@ msgstr ""
138msgid "GNUnet abd resolver tool" 138msgid "GNUnet abd resolver tool"
139msgstr "GNUnet 错误日志" 139msgstr "GNUnet 错误日志"
140 140
141#: src/abd/gnunet-service-abd.c:1742 src/gns/gnunet-gns.c:288 141#: src/abd/gnunet-service-abd.c:1742 src/gns/gnunet-gns.c:292
142#, fuzzy, c-format 142#, fuzzy, c-format
143msgid "Failed to connect to GNS\n" 143msgid "Failed to connect to GNS\n"
144msgstr "初始化“%s”服务失败。\n" 144msgstr "初始化“%s”服务失败。\n"
@@ -377,28 +377,28 @@ msgstr ""
377#: src/transport/plugin_transport_tcp.c:1129 377#: src/transport/plugin_transport_tcp.c:1129
378#: src/transport/plugin_transport_tcp.c:3706 378#: src/transport/plugin_transport_tcp.c:3706
379#: src/transport/tcp_service_legacy.c:594 379#: src/transport/tcp_service_legacy.c:594
380#: src/transport/tcp_service_legacy.c:600 src/util/service.c:1094 380#: src/transport/tcp_service_legacy.c:600 src/util/service.c:1091
381#: src/util/service.c:1100 381#: src/util/service.c:1097
382#, c-format 382#, c-format
383msgid "Require valid port number for service `%s' in configuration!\n" 383msgid "Require valid port number for service `%s' in configuration!\n"
384msgstr "" 384msgstr ""
385 385
386#: src/arm/gnunet-service-arm.c:452 src/transport/plugin_transport_tcp.c:1163 386#: src/arm/gnunet-service-arm.c:452 src/transport/plugin_transport_tcp.c:1163
387#: src/transport/tcp_service_legacy.c:634 src/util/client.c:519 387#: src/transport/tcp_service_legacy.c:634 src/util/client.c:527
388#: src/util/service.c:1133 388#: src/util/service.c:1130
389#, c-format 389#, c-format
390msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 390msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
391msgstr "" 391msgstr ""
392 392
393#: src/arm/gnunet-service-arm.c:456 src/transport/plugin_transport_tcp.c:1167 393#: src/arm/gnunet-service-arm.c:456 src/transport/plugin_transport_tcp.c:1167
394#: src/transport/tcp_service_legacy.c:638 src/util/client.c:524 394#: src/transport/tcp_service_legacy.c:638 src/util/client.c:532
395#: src/util/service.c:1137 395#: src/util/service.c:1134
396#, fuzzy, c-format 396#, fuzzy, c-format
397msgid "Using `%s' instead\n" 397msgid "Using `%s' instead\n"
398msgstr "%s:选项“%s”有歧义\n" 398msgstr "%s:选项“%s”有歧义\n"
399 399
400#: src/arm/gnunet-service-arm.c:484 src/transport/plugin_transport_tcp.c:1195 400#: src/arm/gnunet-service-arm.c:484 src/transport/plugin_transport_tcp.c:1195
401#: src/transport/tcp_service_legacy.c:666 src/util/service.c:1157 401#: src/transport/tcp_service_legacy.c:666 src/util/service.c:1154
402#, c-format 402#, c-format
403msgid "" 403msgid ""
404"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 404"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
@@ -406,7 +406,7 @@ msgid ""
406msgstr "" 406msgstr ""
407 407
408#: src/arm/gnunet-service-arm.c:505 src/transport/plugin_transport_tcp.c:1213 408#: src/arm/gnunet-service-arm.c:505 src/transport/plugin_transport_tcp.c:1213
409#: src/transport/tcp_service_legacy.c:684 src/util/service.c:1175 409#: src/transport/tcp_service_legacy.c:684 src/util/service.c:1172
410#, c-format 410#, c-format
411msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 411msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
412msgstr "" 412msgstr ""
@@ -414,7 +414,7 @@ msgstr ""
414#: src/arm/gnunet-service-arm.c:536 414#: src/arm/gnunet-service-arm.c:536
415#: src/transport/plugin_transport_http_server.c:2718 415#: src/transport/plugin_transport_http_server.c:2718
416#: src/transport/plugin_transport_tcp.c:1244 416#: src/transport/plugin_transport_tcp.c:1244
417#: src/transport/tcp_service_legacy.c:715 src/util/service.c:1206 417#: src/transport/tcp_service_legacy.c:715 src/util/service.c:1203
418#, fuzzy, c-format 418#, fuzzy, c-format
419msgid "Failed to resolve `%s': %s\n" 419msgid "Failed to resolve `%s': %s\n"
420msgstr "打开日志文件“%s”失败:%s\n" 420msgstr "打开日志文件“%s”失败:%s\n"
@@ -422,7 +422,7 @@ msgstr "打开日志文件“%s”失败:%s\n"
422#: src/arm/gnunet-service-arm.c:555 422#: src/arm/gnunet-service-arm.c:555
423#: src/transport/plugin_transport_http_server.c:2736 423#: src/transport/plugin_transport_http_server.c:2736
424#: src/transport/plugin_transport_tcp.c:1263 424#: src/transport/plugin_transport_tcp.c:1263
425#: src/transport/tcp_service_legacy.c:734 src/util/service.c:1225 425#: src/transport/tcp_service_legacy.c:734 src/util/service.c:1222
426#, fuzzy, c-format 426#, fuzzy, c-format
427msgid "Failed to find %saddress for `%s'.\n" 427msgid "Failed to find %saddress for `%s'.\n"
428msgstr "找不到接口“%s”的一个 IP 地址。\n" 428msgstr "找不到接口“%s”的一个 IP 地址。\n"
@@ -494,15 +494,83 @@ msgstr ""
494msgid "Initiating shutdown as requested by client.\n" 494msgid "Initiating shutdown as requested by client.\n"
495msgstr "" 495msgstr ""
496 496
497#: src/ats-tests/ats-testing-log.c:896 497#: src/ats/gnunet-ats-solver-eval.c:2992 src/ats/gnunet-ats-solver-eval.c:3044
498msgid "Stop logging\n" 498#, c-format
499msgid ""
500"Could not load quota for network `%s': `%s', assigning default bandwidth "
501"%llu\n"
499msgstr "" 502msgstr ""
500 503
501#: src/ats-tests/ats-testing-log.c:952 504#: src/ats/gnunet-ats-solver-eval.c:3011
502#, fuzzy, c-format 505#, c-format
503msgid "Start logging `%s'\n" 506msgid ""
507"No outbound quota configured for network `%s', assigning default bandwidth "
508"%llu\n"
509msgstr ""
510
511#: src/ats/gnunet-ats-solver-eval.c:3063
512#, c-format
513msgid ""
514"No outbound quota configure for network `%s', assigning default bandwidth "
515"%llu\n"
516msgstr ""
517
518#: src/ats/gnunet-ats-solver-eval.c:3552 src/ats-tests/gnunet-solver-eval.c:997
519msgid "solver to use"
520msgstr ""
521
522#: src/ats/gnunet-ats-solver-eval.c:3557
523#: src/ats-tests/gnunet-solver-eval.c:1003
524#: src/ats-tests/gnunet-solver-eval.c:1008
525msgid "experiment to use"
526msgstr ""
527
528#: src/ats/gnunet-ats-solver-eval.c:3564
529#, fuzzy
530msgid "print logging"
504msgstr "未知的命令“%s”。\n" 531msgstr "未知的命令“%s”。\n"
505 532
533#: src/ats/gnunet-ats-solver-eval.c:3569
534msgid "save logging to disk"
535msgstr ""
536
537#: src/ats/gnunet-ats-solver-eval.c:3574
538msgid "disable normalization"
539msgstr ""
540
541#: src/ats/gnunet-service-ats_plugins.c:326
542#, c-format
543msgid ""
544"Could not load %s quota for network `%s': `%s', assigning default bandwidth "
545"%llu\n"
546msgstr ""
547
548#: src/ats/gnunet-service-ats_plugins.c:336
549#, c-format
550msgid "%s quota configured for network `%s' is %llu\n"
551msgstr ""
552
553#: src/ats/gnunet-service-ats_plugins.c:382
554#, c-format
555msgid ""
556"No %s-quota configured for network `%s', assigning default bandwidth %llu\n"
557msgstr ""
558
559#: src/ats/gnunet-service-ats_plugins.c:474
560#, fuzzy, c-format
561msgid "Failed to initialize solver `%s'!\n"
562msgstr "无法初始化 SQLite:%s。\n"
563
564#: src/ats/plugin_ats_proportional.c:1140
565#, fuzzy, c-format
566msgid "Invalid %s configuration %f \n"
567msgstr "解析配置文件“%s”失败\n"
568
569#: src/ats/plugin_ats_proportional.c:1163
570#, fuzzy, c-format
571msgid "Invalid %s configuration %f\n"
572msgstr "解析配置文件“%s”失败\n"
573
506#: src/ats-tests/ats-testing.c:420 574#: src/ats-tests/ats-testing.c:420
507#, c-format 575#, c-format
508msgid "Connected master [%u] with slave [%u]\n" 576msgid "Connected master [%u] with slave [%u]\n"
@@ -513,6 +581,15 @@ msgstr ""
513msgid "Failed to connect master peer [%u] with slave [%u]\n" 581msgid "Failed to connect master peer [%u] with slave [%u]\n"
514msgstr "初始化“%s”服务失败。\n" 582msgstr "初始化“%s”服务失败。\n"
515 583
584#: src/ats-tests/ats-testing-log.c:896
585msgid "Stop logging\n"
586msgstr ""
587
588#: src/ats-tests/ats-testing-log.c:952
589#, fuzzy, c-format
590msgid "Start logging `%s'\n"
591msgstr "未知的命令“%s”。\n"
592
516#: src/ats-tests/gnunet-ats-sim.c:92 593#: src/ats-tests/gnunet-ats-sim.c:92
517#, c-format 594#, c-format
518msgid "" 595msgid ""
@@ -520,16 +597,6 @@ msgid ""
520"= %u KiB/s\n" 597"= %u KiB/s\n"
521msgstr "" 598msgstr ""
522 599
523#: src/ats-tests/gnunet-solver-eval.c:997 src/ats/gnunet-ats-solver-eval.c:3552
524msgid "solver to use"
525msgstr ""
526
527#: src/ats-tests/gnunet-solver-eval.c:1003
528#: src/ats-tests/gnunet-solver-eval.c:1008
529#: src/ats/gnunet-ats-solver-eval.c:3557
530msgid "experiment to use"
531msgstr ""
532
533#: src/ats-tool/gnunet-ats.c:299 600#: src/ats-tool/gnunet-ats.c:299
534#, c-format 601#, c-format
535msgid "%u address resolutions had a timeout\n" 602msgid "%u address resolutions had a timeout\n"
@@ -651,73 +718,6 @@ msgstr ""
651msgid "Print information about ATS state" 718msgid "Print information about ATS state"
652msgstr "无法获取有关用户“%s”的信息:%s\n" 719msgstr "无法获取有关用户“%s”的信息:%s\n"
653 720
654#: src/ats/gnunet-ats-solver-eval.c:2992 src/ats/gnunet-ats-solver-eval.c:3044
655#, c-format
656msgid ""
657"Could not load quota for network `%s': `%s', assigning default bandwidth "
658"%llu\n"
659msgstr ""
660
661#: src/ats/gnunet-ats-solver-eval.c:3011
662#, c-format
663msgid ""
664"No outbound quota configured for network `%s', assigning default bandwidth "
665"%llu\n"
666msgstr ""
667
668#: src/ats/gnunet-ats-solver-eval.c:3063
669#, c-format
670msgid ""
671"No outbound quota configure for network `%s', assigning default bandwidth "
672"%llu\n"
673msgstr ""
674
675#: src/ats/gnunet-ats-solver-eval.c:3564
676#, fuzzy
677msgid "print logging"
678msgstr "未知的命令“%s”。\n"
679
680#: src/ats/gnunet-ats-solver-eval.c:3569
681msgid "save logging to disk"
682msgstr ""
683
684#: src/ats/gnunet-ats-solver-eval.c:3574
685msgid "disable normalization"
686msgstr ""
687
688#: src/ats/gnunet-service-ats_plugins.c:326
689#, c-format
690msgid ""
691"Could not load %s quota for network `%s': `%s', assigning default bandwidth "
692"%llu\n"
693msgstr ""
694
695#: src/ats/gnunet-service-ats_plugins.c:336
696#, c-format
697msgid "%s quota configured for network `%s' is %llu\n"
698msgstr ""
699
700#: src/ats/gnunet-service-ats_plugins.c:382
701#, c-format
702msgid ""
703"No %s-quota configured for network `%s', assigning default bandwidth %llu\n"
704msgstr ""
705
706#: src/ats/gnunet-service-ats_plugins.c:474
707#, fuzzy, c-format
708msgid "Failed to initialize solver `%s'!\n"
709msgstr "无法初始化 SQLite:%s。\n"
710
711#: src/ats/plugin_ats_proportional.c:1140
712#, fuzzy, c-format
713msgid "Invalid %s configuration %f \n"
714msgstr "解析配置文件“%s”失败\n"
715
716#: src/ats/plugin_ats_proportional.c:1163
717#, fuzzy, c-format
718msgid "Invalid %s configuration %f\n"
719msgstr "解析配置文件“%s”失败\n"
720
721#: src/auction/gnunet-auction-create.c:163 721#: src/auction/gnunet-auction-create.c:163
722msgid "description of the item to be sold" 722msgid "description of the item to be sold"
723msgstr "" 723msgstr ""
@@ -850,28 +850,6 @@ msgstr ""
850msgid "Connection to conversation service lost, trying to reconnect\n" 850msgid "Connection to conversation service lost, trying to reconnect\n"
851msgstr "" 851msgstr ""
852 852
853#: src/conversation/gnunet-conversation-test.c:120
854#, c-format
855msgid ""
856"\n"
857"End of transmission. Have a GNU day.\n"
858msgstr ""
859
860#: src/conversation/gnunet-conversation-test.c:146
861#, c-format
862msgid ""
863"\n"
864"We are now playing your recording back. If you can hear it, your audio "
865"settings are working..."
866msgstr ""
867
868#: src/conversation/gnunet-conversation-test.c:218
869#, c-format
870msgid ""
871"We will now be recording you for %s. After that time, the recording will be "
872"played back to you..."
873msgstr ""
874
875#: src/conversation/gnunet-conversation.c:264 853#: src/conversation/gnunet-conversation.c:264
876#, c-format 854#, c-format
877msgid "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n" 855msgid "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n"
@@ -1130,8 +1108,30 @@ msgstr ""
1130msgid "Enables having a conversation with other GNUnet users." 1108msgid "Enables having a conversation with other GNUnet users."
1131msgstr "" 1109msgstr ""
1132 1110
1133#: src/conversation/gnunet-helper-audio-playback-gst.c:363 1111#: src/conversation/gnunet-conversation-test.c:120
1112#, c-format
1113msgid ""
1114"\n"
1115"End of transmission. Have a GNU day.\n"
1116msgstr ""
1117
1118#: src/conversation/gnunet-conversation-test.c:146
1119#, c-format
1120msgid ""
1121"\n"
1122"We are now playing your recording back. If you can hear it, your audio "
1123"settings are working..."
1124msgstr ""
1125
1126#: src/conversation/gnunet-conversation-test.c:218
1127#, c-format
1128msgid ""
1129"We will now be recording you for %s. After that time, the recording will be "
1130"played back to you..."
1131msgstr ""
1132
1134#: src/conversation/gnunet_gst.c:664 1133#: src/conversation/gnunet_gst.c:664
1134#: src/conversation/gnunet-helper-audio-playback-gst.c:363
1135#, c-format 1135#, c-format
1136msgid "Read error from STDIN: %d %s\n" 1136msgid "Read error from STDIN: %d %s\n"
1137msgstr "" 1137msgstr ""
@@ -1913,17 +1913,17 @@ msgstr "“%s”于 %s:%d 处失败,错误为:%s\n"
1913msgid "Mysql database running\n" 1913msgid "Mysql database running\n"
1914msgstr "" 1914msgstr ""
1915 1915
1916#: src/datastore/plugin_datastore_postgres.c:277 1916#: src/datastore/plugin_datastore_postgres.c:278
1917#: src/datastore/plugin_datastore_postgres.c:890 1917#: src/datastore/plugin_datastore_postgres.c:891
1918msgid "Postgress exec failure" 1918msgid "Postgress exec failure"
1919msgstr "" 1919msgstr ""
1920 1920
1921#: src/datastore/plugin_datastore_postgres.c:851 1921#: src/datastore/plugin_datastore_postgres.c:852
1922#, fuzzy 1922#, fuzzy
1923msgid "Failed to drop table from database.\n" 1923msgid "Failed to drop table from database.\n"
1924msgstr "发送消息失败。\n" 1924msgstr "发送消息失败。\n"
1925 1925
1926#: src/datastore/plugin_datastore_postgres.c:949 1926#: src/datastore/plugin_datastore_postgres.c:950
1927msgid "Postgres database running\n" 1927msgid "Postgres database running\n"
1928msgstr "" 1928msgstr ""
1929 1929
@@ -2032,6 +2032,54 @@ msgstr ""
2032msgid "Prints all packets that go through the DHT." 2032msgid "Prints all packets that go through the DHT."
2033msgstr "" 2033msgstr ""
2034 2034
2035#: src/dht/gnunet_dht_profiler.c:922 src/testbed/gnunet-testbed-profiler.c:255
2036#, fuzzy, c-format
2037msgid "Exiting as the number of peers is %u\n"
2038msgstr "增加 TCP/IP 的最大连接数"
2039
2040#: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194
2041#, fuzzy
2042msgid "number of peers to start"
2043msgstr "迭代次数"
2044
2045#: src/dht/gnunet_dht_profiler.c:961
2046msgid "number of PUTs to perform per peer"
2047msgstr ""
2048
2049#: src/dht/gnunet_dht_profiler.c:967 src/nse/gnunet-nse-profiler.c:872
2050#: src/testbed/gnunet-testbed-profiler.c:305
2051msgid "name of the file with the login information for the testbed"
2052msgstr ""
2053
2054#: src/dht/gnunet_dht_profiler.c:973
2055msgid "delay between rounds for collecting statistics (default: 30 sec)"
2056msgstr ""
2057
2058#: src/dht/gnunet_dht_profiler.c:979
2059msgid "delay to start doing PUTs (default: 1 sec)"
2060msgstr ""
2061
2062#: src/dht/gnunet_dht_profiler.c:985
2063msgid "delay to start doing GETs (default: 5 min)"
2064msgstr ""
2065
2066#: src/dht/gnunet_dht_profiler.c:990
2067msgid "replication degree for DHT PUTs"
2068msgstr ""
2069
2070#: src/dht/gnunet_dht_profiler.c:996
2071msgid "chance that a peer is selected at random for PUTs"
2072msgstr ""
2073
2074#: src/dht/gnunet_dht_profiler.c:1002
2075msgid "timeout for DHT PUT and GET requests (default: 1 min)"
2076msgstr ""
2077
2078#: src/dht/gnunet_dht_profiler.c:1023
2079#, fuzzy
2080msgid "Measure quality and performance of the DHT service."
2081msgstr "无法访问该服务"
2082
2035#: src/dht/gnunet-dht-put.c:133 2083#: src/dht/gnunet-dht-put.c:133
2036msgid "Must provide KEY and DATA for DHT put!\n" 2084msgid "Must provide KEY and DATA for DHT put!\n"
2037msgstr "" 2085msgstr ""
@@ -2277,54 +2325,6 @@ msgstr ""
2277msgid "# DHT requests combined" 2325msgid "# DHT requests combined"
2278msgstr "" 2326msgstr ""
2279 2327
2280#: src/dht/gnunet_dht_profiler.c:922 src/testbed/gnunet-testbed-profiler.c:255
2281#, fuzzy, c-format
2282msgid "Exiting as the number of peers is %u\n"
2283msgstr "增加 TCP/IP 的最大连接数"
2284
2285#: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194
2286#, fuzzy
2287msgid "number of peers to start"
2288msgstr "迭代次数"
2289
2290#: src/dht/gnunet_dht_profiler.c:961
2291msgid "number of PUTs to perform per peer"
2292msgstr ""
2293
2294#: src/dht/gnunet_dht_profiler.c:967 src/nse/gnunet-nse-profiler.c:872
2295#: src/testbed/gnunet-testbed-profiler.c:305
2296msgid "name of the file with the login information for the testbed"
2297msgstr ""
2298
2299#: src/dht/gnunet_dht_profiler.c:973
2300msgid "delay between rounds for collecting statistics (default: 30 sec)"
2301msgstr ""
2302
2303#: src/dht/gnunet_dht_profiler.c:979
2304msgid "delay to start doing PUTs (default: 1 sec)"
2305msgstr ""
2306
2307#: src/dht/gnunet_dht_profiler.c:985
2308msgid "delay to start doing GETs (default: 5 min)"
2309msgstr ""
2310
2311#: src/dht/gnunet_dht_profiler.c:990
2312msgid "replication degree for DHT PUTs"
2313msgstr ""
2314
2315#: src/dht/gnunet_dht_profiler.c:996
2316msgid "chance that a peer is selected at random for PUTs"
2317msgstr ""
2318
2319#: src/dht/gnunet_dht_profiler.c:1002
2320msgid "timeout for DHT PUT and GET requests (default: 1 min)"
2321msgstr ""
2322
2323#: src/dht/gnunet_dht_profiler.c:1023
2324#, fuzzy
2325msgid "Measure quality and performance of the DHT service."
2326msgstr "无法访问该服务"
2327
2328#: src/dht/plugin_block_dht.c:189 2328#: src/dht/plugin_block_dht.c:189
2329#, c-format 2329#, c-format
2330msgid "Block not of type %u\n" 2330msgid "Block not of type %u\n"
@@ -3244,6 +3244,14 @@ msgid ""
3244"chk/...)" 3244"chk/...)"
3245msgstr "" 3245msgstr ""
3246 3246
3247#: src/fs/gnunet-fs.c:128
3248msgid "print a list of all indexed files"
3249msgstr ""
3250
3251#: src/fs/gnunet-fs.c:141
3252msgid "Special file-sharing operations"
3253msgstr ""
3254
3247#: src/fs/gnunet-fs-profiler.c:211 3255#: src/fs/gnunet-fs-profiler.c:211
3248msgid "run the experiment with COUNT peers" 3256msgid "run the experiment with COUNT peers"
3249msgstr "" 3257msgstr ""
@@ -3260,14 +3268,6 @@ msgstr ""
3260msgid "run a testbed to measure file-sharing performance" 3268msgid "run a testbed to measure file-sharing performance"
3261msgstr "" 3269msgstr ""
3262 3270
3263#: src/fs/gnunet-fs.c:128
3264msgid "print a list of all indexed files"
3265msgstr ""
3266
3267#: src/fs/gnunet-fs.c:141
3268msgid "Special file-sharing operations"
3269msgstr ""
3270
3271#: src/fs/gnunet-publish.c:219 src/fs/gnunet-publish.c:234 3271#: src/fs/gnunet-publish.c:219 src/fs/gnunet-publish.c:234
3272#, c-format 3272#, c-format
3273msgid "Publishing `%s' at %llu/%llu (%s remaining)\n" 3273msgid "Publishing `%s' at %llu/%llu (%s remaining)\n"
@@ -3922,6 +3922,50 @@ msgstr ""
3922msgid "look for GNS2DNS records instead of ANY" 3922msgid "look for GNS2DNS records instead of ANY"
3923msgstr "" 3923msgstr ""
3924 3924
3925#: src/gns/gnunet-gns.c:257
3926#, fuzzy, c-format
3927msgid "`%s' is not a valid DNS domain name\n"
3928msgstr "“%s”不可用。\n"
3929
3930#: src/gns/gnunet-gns.c:267 src/util/dnsparser.c:254
3931#, fuzzy, c-format
3932msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
3933msgstr "打开日志文件“%s”失败:%s\n"
3934
3935#: src/gns/gnunet-gns.c:281
3936msgid "Cannot resolve using GNS: GNUnet peer not running\n"
3937msgstr ""
3938
3939#: src/gns/gnunet-gns.c:305
3940#, c-format
3941msgid "Invalid typename specified, assuming `ANY'\n"
3942msgstr ""
3943
3944#: src/gns/gnunet-gns.c:340
3945msgid "Lookup a record for the given name"
3946msgstr ""
3947
3948#: src/gns/gnunet-gns.c:346
3949msgid "Specify the type of the record to lookup"
3950msgstr ""
3951
3952#: src/gns/gnunet-gns.c:352
3953msgid "Specify a timeout for the lookup"
3954msgstr ""
3955
3956#: src/gns/gnunet-gns.c:356
3957msgid "No unneeded output"
3958msgstr ""
3959
3960#: src/gns/gnunet-gns.c:361
3961msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
3962msgstr ""
3963
3964#: src/gns/gnunet-gns.c:375
3965#, fuzzy
3966msgid "GNUnet GNS resolver tool"
3967msgstr "GNUnet 错误日志"
3968
3925#: src/gns/gnunet-gns-import.c:486 3969#: src/gns/gnunet-gns-import.c:486
3926msgid "This program will import some GNS authorities into your GNS namestore." 3970msgid "This program will import some GNS authorities into your GNS namestore."
3927msgstr "" 3971msgstr ""
@@ -4042,50 +4086,6 @@ msgstr ""
4042msgid "GNUnet GNS proxy" 4086msgid "GNUnet GNS proxy"
4043msgstr "" 4087msgstr ""
4044 4088
4045#: src/gns/gnunet-gns.c:253
4046#, fuzzy, c-format
4047msgid "`%s' is not a valid DNS domain name\n"
4048msgstr "“%s”不可用。\n"
4049
4050#: src/gns/gnunet-gns.c:263 src/util/dnsparser.c:254
4051#, fuzzy, c-format
4052msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
4053msgstr "打开日志文件“%s”失败:%s\n"
4054
4055#: src/gns/gnunet-gns.c:277
4056msgid "Cannot resolve using GNS: GNUnet peer not running\n"
4057msgstr ""
4058
4059#: src/gns/gnunet-gns.c:301
4060#, c-format
4061msgid "Invalid typename specified, assuming `ANY'\n"
4062msgstr ""
4063
4064#: src/gns/gnunet-gns.c:336
4065msgid "Lookup a record for the given name"
4066msgstr ""
4067
4068#: src/gns/gnunet-gns.c:342
4069msgid "Specify the type of the record to lookup"
4070msgstr ""
4071
4072#: src/gns/gnunet-gns.c:348
4073msgid "Specify a timeout for the lookup"
4074msgstr ""
4075
4076#: src/gns/gnunet-gns.c:352
4077msgid "No unneeded output"
4078msgstr ""
4079
4080#: src/gns/gnunet-gns.c:357
4081msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
4082msgstr ""
4083
4084#: src/gns/gnunet-gns.c:371
4085#, fuzzy
4086msgid "GNUnet GNS resolver tool"
4087msgstr "GNUnet 错误日志"
4088
4089#: src/gns/gnunet-service-gns.c:505 4089#: src/gns/gnunet-service-gns.c:505
4090#, fuzzy 4090#, fuzzy
4091msgid "Properly base32-encoded public key required" 4091msgid "Properly base32-encoded public key required"
@@ -4097,8 +4097,8 @@ msgid "Failed to connect to the namecache!\n"
4097msgstr "初始化“%s”服务失败。\n" 4097msgstr "初始化“%s”服务失败。\n"
4098 4098
4099#: src/gns/gnunet-service-gns.c:560 4099#: src/gns/gnunet-service-gns.c:560
4100#: src/zonemaster/gnunet-service-zonemaster-monitor.c:444
4101#: src/zonemaster/gnunet-service-zonemaster.c:887 4100#: src/zonemaster/gnunet-service-zonemaster.c:887
4101#: src/zonemaster/gnunet-service-zonemaster-monitor.c:444
4102#, fuzzy 4102#, fuzzy
4103msgid "Could not connect to DHT!\n" 4103msgid "Could not connect to DHT!\n"
4104msgstr "无法连接到 %s:%u:%s\n" 4104msgstr "无法连接到 %s:%u:%s\n"
@@ -4157,21 +4157,21 @@ msgstr ""
4157msgid "GNS lookup failed (zero records found for `%s')\n" 4157msgid "GNS lookup failed (zero records found for `%s')\n"
4158msgstr "运行 %s失败:%s %d\n" 4158msgstr "运行 %s失败:%s %d\n"
4159 4159
4160#: src/gns/gnunet-service-gns_resolver.c:2376 4160#: src/gns/gnunet-service-gns_resolver.c:2372
4161msgid "GNS lookup recursion failed (no delegation record found)\n" 4161msgid "GNS lookup recursion failed (no delegation record found)\n"
4162msgstr "" 4162msgstr ""
4163 4163
4164#: src/gns/gnunet-service-gns_resolver.c:2399 4164#: src/gns/gnunet-service-gns_resolver.c:2395
4165#, fuzzy, c-format 4165#, fuzzy, c-format
4166msgid "Failed to cache GNS resolution: %s\n" 4166msgid "Failed to cache GNS resolution: %s\n"
4167msgstr "打开日志文件“%s”失败:%s\n" 4167msgstr "打开日志文件“%s”失败:%s\n"
4168 4168
4169#: src/gns/gnunet-service-gns_resolver.c:2567 4169#: src/gns/gnunet-service-gns_resolver.c:2563
4170#, c-format 4170#, c-format
4171msgid "GNS namecache returned empty result for `%s'\n" 4171msgid "GNS namecache returned empty result for `%s'\n"
4172msgstr "" 4172msgstr ""
4173 4173
4174#: src/gns/gnunet-service-gns_resolver.c:2707 4174#: src/gns/gnunet-service-gns_resolver.c:2703
4175#, c-format 4175#, c-format
4176msgid "Zone %s was revoked, resolution fails\n" 4176msgid "Zone %s was revoked, resolution fails\n"
4177msgstr "" 4177msgstr ""
@@ -4838,70 +4838,6 @@ msgstr "sqlite 数据仓库"
4838msgid "Failed to setup database at `%s'\n" 4838msgid "Failed to setup database at `%s'\n"
4839msgstr "运行 %s失败:%s %d\n" 4839msgstr "运行 %s失败:%s %d\n"
4840 4840
4841#: src/namestore/gnunet-namestore-fcfsd.c:551
4842#, fuzzy, c-format
4843msgid "Unsupported form value `%s'\n"
4844msgstr "未知的命令“%s”。\n"
4845
4846#: src/namestore/gnunet-namestore-fcfsd.c:578
4847#, fuzzy, c-format
4848msgid "Failed to create record for domain `%s': %s\n"
4849msgstr "解析配置文件“%s”失败\n"
4850
4851#: src/namestore/gnunet-namestore-fcfsd.c:599
4852msgid "Error when mapping zone to name\n"
4853msgstr ""
4854
4855#: src/namestore/gnunet-namestore-fcfsd.c:631
4856#, c-format
4857msgid "Found existing name `%s' for the given key\n"
4858msgstr ""
4859
4860#: src/namestore/gnunet-namestore-fcfsd.c:693
4861#, c-format
4862msgid "Found %u existing records for domain `%s'\n"
4863msgstr ""
4864
4865#: src/namestore/gnunet-namestore-fcfsd.c:783
4866#, fuzzy, c-format
4867msgid "Failed to create page for `%s'\n"
4868msgstr "发送消息失败。\n"
4869
4870#: src/namestore/gnunet-namestore-fcfsd.c:802
4871#, fuzzy, c-format
4872msgid "Failed to setup post processor for `%s'\n"
4873msgstr "解析配置文件“%s”失败\n"
4874
4875#: src/namestore/gnunet-namestore-fcfsd.c:839
4876msgid "Domain name must not contain `.'\n"
4877msgstr ""
4878
4879#: src/namestore/gnunet-namestore-fcfsd.c:848
4880msgid "Domain name must not contain `+'\n"
4881msgstr ""
4882
4883#: src/namestore/gnunet-namestore-fcfsd.c:1083
4884msgid "No ego configured for `fcfsd` subsystem\n"
4885msgstr ""
4886
4887#: src/namestore/gnunet-namestore-fcfsd.c:1114
4888#, fuzzy
4889msgid "Failed to start HTTP server\n"
4890msgstr "初始化“%s”服务失败。\n"
4891
4892#: src/namestore/gnunet-namestore-fcfsd.c:1162
4893#, fuzzy
4894msgid "Failed to connect to identity\n"
4895msgstr "初始化“%s”服务失败。\n"
4896
4897#: src/namestore/gnunet-namestore-fcfsd.c:1189
4898msgid "name of the zone that is to be managed by FCFSD"
4899msgstr ""
4900
4901#: src/namestore/gnunet-namestore-fcfsd.c:1209
4902msgid "GNU Name System First Come First Serve name registration service"
4903msgstr ""
4904
4905#: src/namestore/gnunet-namestore.c:334 4841#: src/namestore/gnunet-namestore.c:334
4906#, c-format 4842#, c-format
4907msgid "Adding record failed: %s\n" 4843msgid "Adding record failed: %s\n"
@@ -5124,7 +5060,71 @@ msgstr ""
5124msgid "name of the ego controlling the zone" 5060msgid "name of the ego controlling the zone"
5125msgstr "" 5061msgstr ""
5126 5062
5127#: src/namestore/gnunet-service-namestore.c:864 5063#: src/namestore/gnunet-namestore-fcfsd.c:551
5064#, fuzzy, c-format
5065msgid "Unsupported form value `%s'\n"
5066msgstr "未知的命令“%s”。\n"
5067
5068#: src/namestore/gnunet-namestore-fcfsd.c:578
5069#, fuzzy, c-format
5070msgid "Failed to create record for domain `%s': %s\n"
5071msgstr "解析配置文件“%s”失败\n"
5072
5073#: src/namestore/gnunet-namestore-fcfsd.c:599
5074msgid "Error when mapping zone to name\n"
5075msgstr ""
5076
5077#: src/namestore/gnunet-namestore-fcfsd.c:631
5078#, c-format
5079msgid "Found existing name `%s' for the given key\n"
5080msgstr ""
5081
5082#: src/namestore/gnunet-namestore-fcfsd.c:693
5083#, c-format
5084msgid "Found %u existing records for domain `%s'\n"
5085msgstr ""
5086
5087#: src/namestore/gnunet-namestore-fcfsd.c:783
5088#, fuzzy, c-format
5089msgid "Failed to create page for `%s'\n"
5090msgstr "发送消息失败。\n"
5091
5092#: src/namestore/gnunet-namestore-fcfsd.c:802
5093#, fuzzy, c-format
5094msgid "Failed to setup post processor for `%s'\n"
5095msgstr "解析配置文件“%s”失败\n"
5096
5097#: src/namestore/gnunet-namestore-fcfsd.c:839
5098msgid "Domain name must not contain `.'\n"
5099msgstr ""
5100
5101#: src/namestore/gnunet-namestore-fcfsd.c:848
5102msgid "Domain name must not contain `+'\n"
5103msgstr ""
5104
5105#: src/namestore/gnunet-namestore-fcfsd.c:1083
5106msgid "No ego configured for `fcfsd` subsystem\n"
5107msgstr ""
5108
5109#: src/namestore/gnunet-namestore-fcfsd.c:1114
5110#, fuzzy
5111msgid "Failed to start HTTP server\n"
5112msgstr "初始化“%s”服务失败。\n"
5113
5114#: src/namestore/gnunet-namestore-fcfsd.c:1162
5115#, fuzzy
5116msgid "Failed to connect to identity\n"
5117msgstr "初始化“%s”服务失败。\n"
5118
5119#: src/namestore/gnunet-namestore-fcfsd.c:1189
5120msgid "name of the zone that is to be managed by FCFSD"
5121msgstr ""
5122
5123#: src/namestore/gnunet-namestore-fcfsd.c:1209
5124msgid "GNU Name System First Come First Serve name registration service"
5125msgstr ""
5126
5127#: src/namestore/gnunet-service-namestore.c:866
5128#, fuzzy, c-format 5128#, fuzzy, c-format
5129msgid "Failed to replicate block in namecache: %s\n" 5129msgid "Failed to replicate block in namecache: %s\n"
5130msgstr "发送消息失败。\n" 5130msgstr "发送消息失败。\n"
@@ -5439,6 +5439,10 @@ msgstr ""
5439msgid "`upnpc' command not found\n" 5439msgid "`upnpc' command not found\n"
5440msgstr "" 5440msgstr ""
5441 5441
5442#: src/nse/gnunet-nse.c:124
5443msgid "Show network size estimates from NSE service."
5444msgstr ""
5445
5442#: src/nse/gnunet-nse-profiler.c:857 5446#: src/nse/gnunet-nse-profiler.c:857
5443msgid "limit to the number of connections to NSE services, 0 for none" 5447msgid "limit to the number of connections to NSE services, 0 for none"
5444msgstr "" 5448msgstr ""
@@ -5464,16 +5468,66 @@ msgstr ""
5464msgid "Measure quality and performance of the NSE service." 5468msgid "Measure quality and performance of the NSE service."
5465msgstr "无法访问该服务" 5469msgstr "无法访问该服务"
5466 5470
5467#: src/nse/gnunet-nse.c:124
5468msgid "Show network size estimates from NSE service."
5469msgstr ""
5470
5471#: src/nse/gnunet-service-nse.c:1437 5471#: src/nse/gnunet-service-nse.c:1437
5472#: src/revocation/gnunet-service-revocation.c:846 src/util/gnunet-scrypt.c:247 5472#: src/revocation/gnunet-service-revocation.c:846 src/util/gnunet-scrypt.c:247
5473#, fuzzy 5473#, fuzzy
5474msgid "Value is too large.\n" 5474msgid "Value is too large.\n"
5475msgstr "值不在合法范围内。" 5475msgstr "值不在合法范围内。"
5476 5476
5477#: src/peerinfo/gnunet-service-peerinfo.c:175
5478#, c-format
5479msgid "Removing expired address of transport `%s'\n"
5480msgstr ""
5481
5482#: src/peerinfo/gnunet-service-peerinfo.c:306
5483#, fuzzy, c-format
5484msgid "Failed to parse HELLO in file `%s': %s\n"
5485msgstr "解析配置文件“%s”失败\n"
5486
5487#: src/peerinfo/gnunet-service-peerinfo.c:323
5488#: src/peerinfo/gnunet-service-peerinfo.c:348
5489#, fuzzy, c-format
5490msgid "Failed to parse HELLO in file `%s'\n"
5491msgstr "解析配置文件“%s”失败\n"
5492
5493#: src/peerinfo/gnunet-service-peerinfo.c:426
5494msgid "# peers known"
5495msgstr ""
5496
5497#: src/peerinfo/gnunet-service-peerinfo.c:468
5498#, c-format
5499msgid ""
5500"File `%s' in directory `%s' does not match naming convention. Removed.\n"
5501msgstr ""
5502
5503#: src/peerinfo/gnunet-service-peerinfo.c:624
5504#, fuzzy, c-format
5505msgid "Scanning directory `%s'\n"
5506msgstr "解析配置文件“%s”失败\n"
5507
5508#: src/peerinfo/gnunet-service-peerinfo.c:631
5509#, c-format
5510msgid "Still no peers found in `%s'!\n"
5511msgstr ""
5512
5513#: src/peerinfo/gnunet-service-peerinfo.c:1024
5514#, fuzzy, c-format
5515msgid "Cleaning up directory `%s'\n"
5516msgstr "解析配置文件“%s”失败\n"
5517
5518#: src/peerinfo/gnunet-service-peerinfo.c:1319
5519#, c-format
5520msgid "Importing HELLOs from `%s'\n"
5521msgstr ""
5522
5523#: src/peerinfo/gnunet-service-peerinfo.c:1332
5524msgid "Skipping import of included HELLOs\n"
5525msgstr ""
5526
5527#: src/peerinfo/peerinfo_api.c:217
5528msgid "Failed to receive response from `PEERINFO' service."
5529msgstr ""
5530
5477#: src/peerinfo-tool/gnunet-peerinfo.c:237 5531#: src/peerinfo-tool/gnunet-peerinfo.c:237
5478#, fuzzy, c-format 5532#, fuzzy, c-format
5479msgid "%sPeer `%s'\n" 5533msgid "%sPeer `%s'\n"
@@ -5570,60 +5624,6 @@ msgstr "解析配置文件“%s”失败\n"
5570msgid "Peerinfo REST API initialized\n" 5624msgid "Peerinfo REST API initialized\n"
5571msgstr "" 5625msgstr ""
5572 5626
5573#: src/peerinfo/gnunet-service-peerinfo.c:175
5574#, c-format
5575msgid "Removing expired address of transport `%s'\n"
5576msgstr ""
5577
5578#: src/peerinfo/gnunet-service-peerinfo.c:306
5579#, fuzzy, c-format
5580msgid "Failed to parse HELLO in file `%s': %s\n"
5581msgstr "解析配置文件“%s”失败\n"
5582
5583#: src/peerinfo/gnunet-service-peerinfo.c:323
5584#: src/peerinfo/gnunet-service-peerinfo.c:348
5585#, fuzzy, c-format
5586msgid "Failed to parse HELLO in file `%s'\n"
5587msgstr "解析配置文件“%s”失败\n"
5588
5589#: src/peerinfo/gnunet-service-peerinfo.c:426
5590msgid "# peers known"
5591msgstr ""
5592
5593#: src/peerinfo/gnunet-service-peerinfo.c:468
5594#, c-format
5595msgid ""
5596"File `%s' in directory `%s' does not match naming convention. Removed.\n"
5597msgstr ""
5598
5599#: src/peerinfo/gnunet-service-peerinfo.c:624
5600#, fuzzy, c-format
5601msgid "Scanning directory `%s'\n"
5602msgstr "解析配置文件“%s”失败\n"
5603
5604#: src/peerinfo/gnunet-service-peerinfo.c:631
5605#, c-format
5606msgid "Still no peers found in `%s'!\n"
5607msgstr ""
5608
5609#: src/peerinfo/gnunet-service-peerinfo.c:1024
5610#, fuzzy, c-format
5611msgid "Cleaning up directory `%s'\n"
5612msgstr "解析配置文件“%s”失败\n"
5613
5614#: src/peerinfo/gnunet-service-peerinfo.c:1319
5615#, c-format
5616msgid "Importing HELLOs from `%s'\n"
5617msgstr ""
5618
5619#: src/peerinfo/gnunet-service-peerinfo.c:1332
5620msgid "Skipping import of included HELLOs\n"
5621msgstr ""
5622
5623#: src/peerinfo/peerinfo_api.c:217
5624msgid "Failed to receive response from `PEERINFO' service."
5625msgstr ""
5626
5627#: src/peerstore/gnunet-peerstore.c:92 5627#: src/peerstore/gnunet-peerstore.c:92
5628msgid "peerstore" 5628msgid "peerstore"
5629msgstr "" 5629msgstr ""
@@ -6044,6 +6044,18 @@ msgstr ""
6044msgid "Could not open revocation database file!" 6044msgid "Could not open revocation database file!"
6045msgstr "无法连接到 %s:%u:%s\n" 6045msgstr "无法连接到 %s:%u:%s\n"
6046 6046
6047#: src/rps/gnunet-rps.c:270
6048msgid "Seed a PeerID"
6049msgstr ""
6050
6051#: src/rps/gnunet-rps.c:275
6052msgid "Get updates of view (0 for infinite updates)"
6053msgstr ""
6054
6055#: src/rps/gnunet-rps.c:279
6056msgid "Get peers from biased stream"
6057msgstr ""
6058
6047#: src/rps/gnunet-rps-profiler.c:3200 6059#: src/rps/gnunet-rps-profiler.c:3200
6048msgid "duration of the profiling" 6060msgid "duration of the profiling"
6049msgstr "" 6061msgstr ""
@@ -6062,18 +6074,6 @@ msgstr "迭代次数"
6062msgid "Measure quality and performance of the RPS service." 6074msgid "Measure quality and performance of the RPS service."
6063msgstr "无法访问该服务" 6075msgstr "无法访问该服务"
6064 6076
6065#: src/rps/gnunet-rps.c:270
6066msgid "Seed a PeerID"
6067msgstr ""
6068
6069#: src/rps/gnunet-rps.c:275
6070msgid "Get updates of view (0 for infinite updates)"
6071msgstr ""
6072
6073#: src/rps/gnunet-rps.c:279
6074msgid "Get peers from biased stream"
6075msgstr ""
6076
6077#: src/scalarproduct/gnunet-scalarproduct.c:229 6077#: src/scalarproduct/gnunet-scalarproduct.c:229
6078#, fuzzy 6078#, fuzzy
6079msgid "You must specify at least one message ID to check!\n" 6079msgid "You must specify at least one message ID to check!\n"
@@ -6129,10 +6129,10 @@ msgstr ""
6129msgid "Calculate the Vectorproduct with a GNUnet peer." 6129msgid "Calculate the Vectorproduct with a GNUnet peer."
6130msgstr "" 6130msgstr ""
6131 6131
6132#: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1127
6133#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1073
6134#: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1363 6132#: src/scalarproduct/gnunet-service-scalarproduct_alice.c:1363
6135#: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1366 6133#: src/scalarproduct/gnunet-service-scalarproduct_bob.c:1366
6134#: src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c:1127
6135#: src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c:1073
6136#, fuzzy 6136#, fuzzy
6137msgid "Connect to CADET failed\n" 6137msgid "Connect to CADET failed\n"
6138msgstr "“%s”已连接到“%s”。\n" 6138msgstr "“%s”已连接到“%s”。\n"
@@ -6476,6 +6476,15 @@ msgstr ""
6476msgid "%.s Unknown result code." 6476msgid "%.s Unknown result code."
6477msgstr "" 6477msgstr ""
6478 6478
6479#: src/testbed/gnunet_testbed_mpi_spawn.c:119
6480msgid "Waiting for child to exit.\n"
6481msgstr ""
6482
6483#: src/testbed/gnunet_testbed_mpi_spawn.c:242
6484#, fuzzy, c-format
6485msgid "Spawning process `%s'\n"
6486msgstr "卸载 GNUnet 服务"
6487
6479#: src/testbed/gnunet-testbed-profiler.c:290 6488#: src/testbed/gnunet-testbed-profiler.c:290
6480msgid "tolerate COUNT number of continious timeout failures" 6489msgid "tolerate COUNT number of continious timeout failures"
6481msgstr "" 6490msgstr ""
@@ -6487,15 +6496,6 @@ msgid ""
6487"signal is received" 6496"signal is received"
6488msgstr "" 6497msgstr ""
6489 6498
6490#: src/testbed/gnunet_testbed_mpi_spawn.c:119
6491msgid "Waiting for child to exit.\n"
6492msgstr ""
6493
6494#: src/testbed/gnunet_testbed_mpi_spawn.c:242
6495#, fuzzy, c-format
6496msgid "Spawning process `%s'\n"
6497msgstr "卸载 GNUnet 服务"
6498
6499#: src/testbed/testbed_api.c:399 6499#: src/testbed/testbed_api.c:399
6500#, fuzzy, c-format 6500#, fuzzy, c-format
6501msgid "Adding host %u failed with error: %s\n" 6501msgid "Adding host %u failed with error: %s\n"
@@ -6829,6 +6829,10 @@ msgstr "发送消息失败。\n"
6829msgid "GNUnet UNIX domain socket communicator" 6829msgid "GNUnet UNIX domain socket communicator"
6830msgstr "" 6830msgstr ""
6831 6831
6832#: src/transport/gnunet-service-transport_ats.c:137
6833msgid "# Addresses given to ATS"
6834msgstr ""
6835
6832#: src/transport/gnunet-service-transport.c:445 6836#: src/transport/gnunet-service-transport.c:445
6833msgid "# messages dropped due to slow client" 6837msgid "# messages dropped due to slow client"
6834msgstr "" 6838msgstr ""
@@ -6869,10 +6873,6 @@ msgstr "卸载 GNUnet 服务"
6869msgid "Adding blacklisting entry for peer `%s':`%s'\n" 6873msgid "Adding blacklisting entry for peer `%s':`%s'\n"
6870msgstr "" 6874msgstr ""
6871 6875
6872#: src/transport/gnunet-service-transport_ats.c:137
6873msgid "# Addresses given to ATS"
6874msgstr ""
6875
6876#: src/transport/gnunet-service-transport_hello.c:195 6876#: src/transport/gnunet-service-transport_hello.c:195
6877msgid "# refreshed my HELLO" 6877msgid "# refreshed my HELLO"
6878msgstr "" 6878msgstr ""
@@ -7181,44 +7181,6 @@ msgstr ""
7181msgid "# HELLOs given to peerinfo" 7181msgid "# HELLOs given to peerinfo"
7182msgstr "" 7182msgstr ""
7183 7183
7184#: src/transport/gnunet-transport-profiler.c:220
7185#, c-format
7186msgid "%llu B in %llu ms == %.2f KB/s!\n"
7187msgstr ""
7188
7189#: src/transport/gnunet-transport-profiler.c:577
7190msgid "send data to peer"
7191msgstr ""
7192
7193#: src/transport/gnunet-transport-profiler.c:581
7194msgid "receive data from peer"
7195msgstr ""
7196
7197#: src/transport/gnunet-transport-profiler.c:586
7198msgid "iterations"
7199msgstr ""
7200
7201#: src/transport/gnunet-transport-profiler.c:591
7202#, fuzzy
7203msgid "number of messages to send"
7204msgstr "每次迭代所使用的消息数量"
7205
7206#: src/transport/gnunet-transport-profiler.c:596
7207#, fuzzy
7208msgid "message size to use"
7209msgstr "消息尺寸"
7210
7211#: src/transport/gnunet-transport-profiler.c:601
7212#: src/transport/gnunet-transport.c:1404
7213msgid "peer identity"
7214msgstr ""
7215
7216#: src/transport/gnunet-transport-profiler.c:614
7217#: src/transport/gnunet-transport.c:1426
7218#, fuzzy
7219msgid "Direct access to transport service."
7220msgstr "初始化“%s”服务失败。\n"
7221
7222#: src/transport/gnunet-transport.c:406 7184#: src/transport/gnunet-transport.c:406
7223#, c-format 7185#, c-format
7224msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" 7186msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n"
@@ -7355,6 +7317,11 @@ msgstr ""
7355msgid "do not resolve hostnames" 7317msgid "do not resolve hostnames"
7356msgstr "" 7318msgstr ""
7357 7319
7320#: src/transport/gnunet-transport.c:1404
7321#: src/transport/gnunet-transport-profiler.c:601
7322msgid "peer identity"
7323msgstr ""
7324
7358#: src/transport/gnunet-transport.c:1408 7325#: src/transport/gnunet-transport.c:1408
7359msgid "monitor plugin sessions" 7326msgid "monitor plugin sessions"
7360msgstr "" 7327msgstr ""
@@ -7363,6 +7330,39 @@ msgstr ""
7363msgid "send data for benchmarking to the other peer (until CTRL-C)" 7330msgid "send data for benchmarking to the other peer (until CTRL-C)"
7364msgstr "" 7331msgstr ""
7365 7332
7333#: src/transport/gnunet-transport.c:1426
7334#: src/transport/gnunet-transport-profiler.c:614
7335#, fuzzy
7336msgid "Direct access to transport service."
7337msgstr "初始化“%s”服务失败。\n"
7338
7339#: src/transport/gnunet-transport-profiler.c:220
7340#, c-format
7341msgid "%llu B in %llu ms == %.2f KB/s!\n"
7342msgstr ""
7343
7344#: src/transport/gnunet-transport-profiler.c:577
7345msgid "send data to peer"
7346msgstr ""
7347
7348#: src/transport/gnunet-transport-profiler.c:581
7349msgid "receive data from peer"
7350msgstr ""
7351
7352#: src/transport/gnunet-transport-profiler.c:586
7353msgid "iterations"
7354msgstr ""
7355
7356#: src/transport/gnunet-transport-profiler.c:591
7357#, fuzzy
7358msgid "number of messages to send"
7359msgstr "每次迭代所使用的消息数量"
7360
7361#: src/transport/gnunet-transport-profiler.c:596
7362#, fuzzy
7363msgid "message size to use"
7364msgstr "消息尺寸"
7365
7366#: src/transport/plugin_transport_http_client.c:1489 7366#: src/transport/plugin_transport_http_client.c:1489
7367#: src/transport/plugin_transport_http_server.c:2331 7367#: src/transport/plugin_transport_http_server.c:2331
7368#: src/transport/plugin_transport_http_server.c:3562 7368#: src/transport/plugin_transport_http_server.c:3562
@@ -7639,6 +7639,20 @@ msgstr ""
7639msgid "TCP transport advertises itself as being on port %llu\n" 7639msgid "TCP transport advertises itself as being on port %llu\n"
7640msgstr "" 7640msgstr ""
7641 7641
7642#: src/transport/plugin_transport_udp_broadcasting.c:169
7643msgid "# Multicast HELLO beacons received via UDP"
7644msgstr ""
7645
7646#: src/transport/plugin_transport_udp_broadcasting.c:553
7647msgid ""
7648"Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"
7649msgstr ""
7650
7651#: src/transport/plugin_transport_udp_broadcasting.c:571
7652#, c-format
7653msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n"
7654msgstr ""
7655
7642#: src/transport/plugin_transport_udp.c:3169 7656#: src/transport/plugin_transport_udp.c:3169
7643#, c-format 7657#, c-format
7644msgid "" 7658msgid ""
@@ -7687,20 +7701,6 @@ msgstr "“%s”不可用。\n"
7687msgid "Failed to create UDP network sockets\n" 7701msgid "Failed to create UDP network sockets\n"
7688msgstr "发送消息失败。\n" 7702msgstr "发送消息失败。\n"
7689 7703
7690#: src/transport/plugin_transport_udp_broadcasting.c:169
7691msgid "# Multicast HELLO beacons received via UDP"
7692msgstr ""
7693
7694#: src/transport/plugin_transport_udp_broadcasting.c:553
7695msgid ""
7696"Disabling HELLO broadcasting due to friend-to-friend only configuration!\n"
7697msgstr ""
7698
7699#: src/transport/plugin_transport_udp_broadcasting.c:571
7700#, c-format
7701msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n"
7702msgstr ""
7703
7704#: src/transport/plugin_transport_unix.c:1396 7704#: src/transport/plugin_transport_unix.c:1396
7705#, fuzzy, c-format 7705#, fuzzy, c-format
7706msgid "Cannot bind to `%s'\n" 7706msgid "Cannot bind to `%s'\n"
@@ -7778,17 +7778,17 @@ msgstr "“%s”已连接到“%s”。\n"
7778msgid "Accepting connection from `%s': %p\n" 7778msgid "Accepting connection from `%s': %p\n"
7779msgstr "" 7779msgstr ""
7780 7780
7781#: src/transport/tcp_server_legacy.c:478 src/util/service.c:1400 7781#: src/transport/tcp_server_legacy.c:478 src/util/service.c:1397
7782#, fuzzy, c-format 7782#, fuzzy, c-format
7783msgid "`%s' failed for port %d (%s).\n" 7783msgid "`%s' failed for port %d (%s).\n"
7784msgstr "对驱动器“%2$s”的“%1$s”操作失败:%3$u\n" 7784msgstr "对驱动器“%2$s”的“%1$s”操作失败:%3$u\n"
7785 7785
7786#: src/transport/tcp_server_legacy.c:488 src/util/service.c:1412 7786#: src/transport/tcp_server_legacy.c:488 src/util/service.c:1409
7787#, c-format 7787#, c-format
7788msgid "`%s' failed for port %d (%s): address already in use\n" 7788msgid "`%s' failed for port %d (%s): address already in use\n"
7789msgstr "" 7789msgstr ""
7790 7790
7791#: src/transport/tcp_server_legacy.c:494 src/util/service.c:1419 7791#: src/transport/tcp_server_legacy.c:494 src/util/service.c:1416
7792#, fuzzy, c-format 7792#, fuzzy, c-format
7793msgid "`%s' failed for `%s': address already in use\n" 7793msgid "`%s' failed for `%s': address already in use\n"
7794msgstr "对驱动器“%2$s”的“%1$s”操作失败:%3$u\n" 7794msgstr "对驱动器“%2$s”的“%1$s”操作失败:%3$u\n"
@@ -7800,7 +7800,7 @@ msgid ""
7800"`GNUNET_SERVER_receive_done' after %s\n" 7800"`GNUNET_SERVER_receive_done' after %s\n"
7801msgstr "" 7801msgstr ""
7802 7802
7803#: src/transport/tcp_service_legacy.c:345 src/util/service.c:837 7803#: src/transport/tcp_service_legacy.c:345 src/util/service.c:834
7804#, c-format 7804#, c-format
7805msgid "Unknown address family %d\n" 7805msgid "Unknown address family %d\n"
7806msgstr "" 7806msgstr ""
@@ -7810,23 +7810,23 @@ msgstr ""
7810msgid "Access from `%s' denied to service `%s'\n" 7810msgid "Access from `%s' denied to service `%s'\n"
7811msgstr "" 7811msgstr ""
7812 7812
7813#: src/transport/tcp_service_legacy.c:410 src/util/service.c:950 7813#: src/transport/tcp_service_legacy.c:410 src/util/service.c:947
7814#, c-format 7814#, c-format
7815msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 7815msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
7816msgstr "" 7816msgstr ""
7817 7817
7818#: src/transport/tcp_service_legacy.c:451 src/util/service.c:991 7818#: src/transport/tcp_service_legacy.c:451 src/util/service.c:988
7819#, c-format 7819#, c-format
7820msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 7820msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
7821msgstr "" 7821msgstr ""
7822 7822
7823#: src/transport/tcp_service_legacy.c:890 7823#: src/transport/tcp_service_legacy.c:890
7824#: src/transport/tcp_service_legacy.c:910 src/util/service.c:1480 7824#: src/transport/tcp_service_legacy.c:910 src/util/service.c:1477
7825#, c-format 7825#, c-format
7826msgid "Specified value for `%s' of service `%s' is invalid\n" 7826msgid "Specified value for `%s' of service `%s' is invalid\n"
7827msgstr "" 7827msgstr ""
7828 7828
7829#: src/transport/tcp_service_legacy.c:935 src/util/service.c:1504 7829#: src/transport/tcp_service_legacy.c:935 src/util/service.c:1501
7830#, c-format 7830#, c-format
7831msgid "Could not access pre-bound socket %u, will try to bind myself\n" 7831msgid "Could not access pre-bound socket %u, will try to bind myself\n"
7832msgstr "" 7832msgstr ""
@@ -7841,45 +7841,45 @@ msgstr "运行 %s失败:%s %d\n"
7841msgid "Service `%s' runs at %s\n" 7841msgid "Service `%s' runs at %s\n"
7842msgstr "" 7842msgstr ""
7843 7843
7844#: src/transport/tcp_service_legacy.c:1193 src/util/service.c:1750 7844#: src/transport/tcp_service_legacy.c:1193 src/util/service.c:1747
7845msgid "Service process failed to initialize\n" 7845msgid "Service process failed to initialize\n"
7846msgstr "" 7846msgstr ""
7847 7847
7848#: src/transport/tcp_service_legacy.c:1198 src/util/service.c:1755 7848#: src/transport/tcp_service_legacy.c:1198 src/util/service.c:1752
7849msgid "Service process could not initialize server function\n" 7849msgid "Service process could not initialize server function\n"
7850msgstr "" 7850msgstr ""
7851 7851
7852#: src/transport/tcp_service_legacy.c:1203 src/util/service.c:1760 7852#: src/transport/tcp_service_legacy.c:1203 src/util/service.c:1757
7853msgid "Service process failed to report status\n" 7853msgid "Service process failed to report status\n"
7854msgstr "" 7854msgstr ""
7855 7855
7856#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1177 7856#: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1177
7857#: src/util/service.c:1641 7857#: src/util/service.c:1638
7858#, c-format 7858#, c-format
7859msgid "Cannot obtain information about user `%s': %s\n" 7859msgid "Cannot obtain information about user `%s': %s\n"
7860msgstr "无法获取有关用户“%s”的信息:%s\n" 7860msgstr "无法获取有关用户“%s”的信息:%s\n"
7861 7861
7862#: src/transport/tcp_service_legacy.c:1255 src/util/service.c:1643 7862#: src/transport/tcp_service_legacy.c:1255 src/util/service.c:1640
7863msgid "No such user" 7863msgid "No such user"
7864msgstr "无此用户" 7864msgstr "无此用户"
7865 7865
7866#: src/transport/tcp_service_legacy.c:1269 src/util/service.c:1657 7866#: src/transport/tcp_service_legacy.c:1269 src/util/service.c:1654
7867#, c-format 7867#, c-format
7868msgid "Cannot change user/group to `%s': %s\n" 7868msgid "Cannot change user/group to `%s': %s\n"
7869msgstr "无法更改用户/组为“%s”:%s\n" 7869msgstr "无法更改用户/组为“%s”:%s\n"
7870 7870
7871#: src/transport/tcp_service_legacy.c:1348 src/util/service.c:1999 7871#: src/transport/tcp_service_legacy.c:1348 src/util/service.c:1996
7872msgid "do daemonize (detach from terminal)" 7872msgid "do daemonize (detach from terminal)"
7873msgstr "" 7873msgstr ""
7874 7874
7875#: src/transport/tcp_service_legacy.c:1397 7875#: src/transport/tcp_service_legacy.c:1397
7876#: src/transport/transport-testing2.c:906 src/util/service.c:2073 7876#: src/transport/transport-testing2.c:906 src/util/service.c:2070
7877#: src/util/service.c:2085 7877#: src/util/service.c:2082
7878#, fuzzy, c-format 7878#, fuzzy, c-format
7879msgid "Malformed configuration file `%s', exit ...\n" 7879msgid "Malformed configuration file `%s', exit ...\n"
7880msgstr "解析配置文件“%s”失败\n" 7880msgstr "解析配置文件“%s”失败\n"
7881 7881
7882#: src/transport/tcp_service_legacy.c:1407 src/util/service.c:2095 7882#: src/transport/tcp_service_legacy.c:1407 src/util/service.c:2092
7883#, fuzzy 7883#, fuzzy
7884msgid "Malformed configuration, exit ...\n" 7884msgid "Malformed configuration, exit ...\n"
7885msgstr "解析配置文件“%s”失败\n" 7885msgstr "解析配置文件“%s”失败\n"
@@ -7922,105 +7922,105 @@ msgstr ""
7922msgid "Metadata `%s' failed to deserialize" 7922msgid "Metadata `%s' failed to deserialize"
7923msgstr "" 7923msgstr ""
7924 7924
7925#: src/util/client.c:739 src/util/client.c:931 7925#: src/util/client.c:747 src/util/client.c:937
7926msgid "not a valid filename" 7926msgid "not a valid filename"
7927msgstr "" 7927msgstr ""
7928 7928
7929#: src/util/client.c:1097 7929#: src/util/client.c:1103
7930#, c-format 7930#, c-format
7931msgid "Need a non-empty hostname for service `%s'.\n" 7931msgid "Need a non-empty hostname for service `%s'.\n"
7932msgstr "" 7932msgstr ""
7933 7933
7934#: src/util/common_logging.c:259 src/util/common_logging.c:1116 7934#: src/util/common_logging.c:259 src/util/common_logging.c:1112
7935msgid "DEBUG" 7935msgid "DEBUG"
7936msgstr "调试" 7936msgstr "调试"
7937 7937
7938#: src/util/common_logging.c:261 src/util/common_logging.c:1114 7938#: src/util/common_logging.c:261 src/util/common_logging.c:1110
7939msgid "INFO" 7939msgid "INFO"
7940msgstr "信息" 7940msgstr "信息"
7941 7941
7942#: src/util/common_logging.c:263 src/util/common_logging.c:1112 7942#: src/util/common_logging.c:263 src/util/common_logging.c:1108
7943msgid "MESSAGE" 7943msgid "MESSAGE"
7944msgstr "" 7944msgstr ""
7945 7945
7946#: src/util/common_logging.c:265 src/util/common_logging.c:1110 7946#: src/util/common_logging.c:265 src/util/common_logging.c:1106
7947msgid "WARNING" 7947msgid "WARNING"
7948msgstr "警告" 7948msgstr "警告"
7949 7949
7950#: src/util/common_logging.c:267 src/util/common_logging.c:1108 7950#: src/util/common_logging.c:267 src/util/common_logging.c:1104
7951msgid "ERROR" 7951msgid "ERROR"
7952msgstr "错误" 7952msgstr "错误"
7953 7953
7954#: src/util/common_logging.c:269 src/util/common_logging.c:1118 7954#: src/util/common_logging.c:269 src/util/common_logging.c:1114
7955msgid "NONE" 7955msgid "NONE"
7956msgstr "" 7956msgstr ""
7957 7957
7958#: src/util/common_logging.c:630 src/util/common_logging.c:669 7958#: src/util/common_logging.c:626 src/util/common_logging.c:665
7959#, c-format 7959#, c-format
7960msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n" 7960msgid "ERROR: Unable to parse log definition: Syntax error at `%s'.\n"
7961msgstr "" 7961msgstr ""
7962 7962
7963#: src/util/common_logging.c:906 7963#: src/util/common_logging.c:902
7964#, fuzzy, c-format 7964#, fuzzy, c-format
7965msgid "Message `%.*s' repeated %u times in the last %s\n" 7965msgid "Message `%.*s' repeated %u times in the last %s\n"
7966msgstr "消息“%.*s”重复了 %u 次,在最近 %llu 秒内\n" 7966msgstr "消息“%.*s”重复了 %u 次,在最近 %llu 秒内\n"
7967 7967
7968#: src/util/common_logging.c:1119 7968#: src/util/common_logging.c:1115
7969msgid "INVALID" 7969msgid "INVALID"
7970msgstr "" 7970msgstr ""
7971 7971
7972#: src/util/common_logging.c:1400 7972#: src/util/common_logging.c:1396
7973msgid "unknown address" 7973msgid "unknown address"
7974msgstr "" 7974msgstr ""
7975 7975
7976#: src/util/common_logging.c:1445 7976#: src/util/common_logging.c:1441
7977msgid "invalid address" 7977msgid "invalid address"
7978msgstr "" 7978msgstr ""
7979 7979
7980#: src/util/common_logging.c:1464 7980#: src/util/common_logging.c:1460
7981#, fuzzy, c-format 7981#, fuzzy, c-format
7982msgid "Configuration fails to specify option `%s' in section `%s'!\n" 7982msgid "Configuration fails to specify option `%s' in section `%s'!\n"
7983msgstr "配置不满足配置规范文件“%s”的约束!\n" 7983msgstr "配置不满足配置规范文件“%s”的约束!\n"
7984 7984
7985#: src/util/common_logging.c:1487 7985#: src/util/common_logging.c:1483
7986#, fuzzy, c-format 7986#, fuzzy, c-format
7987msgid "" 7987msgid ""
7988"Configuration specifies invalid value for option `%s' in section `%s': %s\n" 7988"Configuration specifies invalid value for option `%s' in section `%s': %s\n"
7989msgstr "配置不满足配置规范文件“%s”的约束!\n" 7989msgstr "配置不满足配置规范文件“%s”的约束!\n"
7990 7990
7991#: src/util/configuration.c:325 7991#: src/util/configuration.c:402
7992#, fuzzy, c-format 7992#, fuzzy, c-format
7993msgid "Syntax error while deserializing in line %u\n" 7993msgid "Syntax error while deserializing in line %u\n"
7994msgstr "配置文件“%s”第 %d 行有语法错误。\n" 7994msgstr "配置文件“%s”第 %d 行有语法错误。\n"
7995 7995
7996#: src/util/configuration.c:383 7996#: src/util/configuration.c:460
7997#, fuzzy, c-format 7997#, fuzzy, c-format
7998msgid "Error while reading file `%s'\n" 7998msgid "Error while reading file `%s'\n"
7999msgstr "解析 dscl 输出时出错。\n" 7999msgstr "解析 dscl 输出时出错。\n"
8000 8000
8001#: src/util/configuration.c:986 8001#: src/util/configuration.c:1063
8002#, fuzzy 8002#, fuzzy
8003msgid "Not a valid relative time specification" 8003msgid "Not a valid relative time specification"
8004msgstr "配置文件“%s”已写入。\n" 8004msgstr "配置文件“%s”已写入。\n"
8005 8005
8006#: src/util/configuration.c:1077 8006#: src/util/configuration.c:1154
8007#, c-format 8007#, c-format
8008msgid "" 8008msgid ""
8009"Configuration value '%s' for '%s' in section '%s' is not in set of legal " 8009"Configuration value '%s' for '%s' in section '%s' is not in set of legal "
8010"choices\n" 8010"choices\n"
8011msgstr "" 8011msgstr ""
8012 8012
8013#: src/util/configuration.c:1192 8013#: src/util/configuration.c:1269
8014#, c-format 8014#, c-format
8015msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" 8015msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n"
8016msgstr "" 8016msgstr ""
8017 8017
8018#: src/util/configuration.c:1224 8018#: src/util/configuration.c:1301
8019#, fuzzy, c-format 8019#, fuzzy, c-format
8020msgid "Missing closing `%s' in option `%s'\n" 8020msgid "Missing closing `%s' in option `%s'\n"
8021msgstr "配置文件“%s”已写入。\n" 8021msgstr "配置文件“%s”已写入。\n"
8022 8022
8023#: src/util/configuration.c:1290 8023#: src/util/configuration.c:1367
8024#, c-format 8024#, c-format
8025msgid "" 8025msgid ""
8026"Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " 8026"Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined "
@@ -8084,7 +8084,7 @@ msgstr "libgcrypt 的版本不符合预期(要求版本 %s)。\n"
8084msgid "RSA signing failed at %s:%d: %s\n" 8084msgid "RSA signing failed at %s:%d: %s\n"
8085msgstr "对驱动器“%2$s”的“%1$s”操作失败:%3$u\n" 8085msgstr "对驱动器“%2$s”的“%1$s”操作失败:%3$u\n"
8086 8086
8087#: src/util/crypto_rsa.c:1313 8087#: src/util/crypto_rsa.c:1314
8088#, fuzzy, c-format 8088#, fuzzy, c-format
8089msgid "RSA signature verification failed at %s:%d: %s\n" 8089msgid "RSA signature verification failed at %s:%d: %s\n"
8090msgstr "对驱动器“%2$s”的“%1$s”操作失败:%3$u\n" 8090msgstr "对驱动器“%2$s”的“%1$s”操作失败:%3$u\n"
@@ -8189,64 +8189,72 @@ msgstr ""
8189msgid "Missing mandatory option `%s'.\n" 8189msgid "Missing mandatory option `%s'.\n"
8190msgstr "配置文件“%s”已写入。\n" 8190msgstr "配置文件“%s”已写入。\n"
8191 8191
8192#: src/util/getopt_helpers.c:68 8192#: src/util/getopt_helpers.c:69
8193msgid "print the version number" 8193msgid "print the version number"
8194msgstr "" 8194msgstr ""
8195 8195
8196#: src/util/getopt_helpers.c:114 8196#: src/util/getopt_helpers.c:116
8197#, c-format 8197#, c-format
8198msgid "" 8198msgid ""
8199"Arguments mandatory for long options are also mandatory for short options.\n" 8199"Arguments mandatory for long options are also mandatory for short options.\n"
8200msgstr "长选项的必选参数对短选项也是必选的。\n" 8200msgstr "长选项的必选参数对短选项也是必选的。\n"
8201 8201
8202#: src/util/getopt_helpers.c:205 8202#: src/util/getopt_helpers.c:208
8203msgid "print this help" 8203msgid "print this help"
8204msgstr "" 8204msgstr ""
8205 8205
8206#: src/util/getopt_helpers.c:281 8206#: src/util/getopt_helpers.c:288
8207msgid "be verbose" 8207msgid "be verbose"
8208msgstr "" 8208msgstr ""
8209 8209
8210#: src/util/getopt_helpers.c:417 8210#: src/util/getopt_helpers.c:429
8211msgid "configure logging to use LOGLEVEL" 8211msgid "configure logging to use LOGLEVEL"
8212msgstr "" 8212msgstr ""
8213 8213
8214#: src/util/getopt_helpers.c:495 8214#: src/util/getopt_helpers.c:510
8215msgid "configure logging to write logs to FILENAME" 8215msgid "configure logging to write logs to FILENAME"
8216msgstr "" 8216msgstr ""
8217 8217
8218#: src/util/getopt_helpers.c:516 8218#: src/util/getopt_helpers.c:532
8219#, fuzzy 8219#, fuzzy
8220msgid "use configuration file FILENAME" 8220msgid "use configuration file FILENAME"
8221msgstr "更改配置文件中的一个值" 8221msgstr "更改配置文件中的一个值"
8222 8222
8223#: src/util/getopt_helpers.c:551 src/util/getopt_helpers.c:747 8223#: src/util/getopt_helpers.c:568 src/util/getopt_helpers.c:634
8224#: src/util/getopt_helpers.c:810 8224#: src/util/getopt_helpers.c:835 src/util/getopt_helpers.c:900
8225#, c-format 8225#, c-format
8226msgid "You must pass a number to the `%s' option.\n" 8226msgid "You must pass a number to the `%s' option.\n"
8227msgstr "您必须向“%s”选项传递一个数字。\n" 8227msgstr "您必须向“%s”选项传递一个数字。\n"
8228 8228
8229#: src/util/getopt_helpers.c:612 8229#: src/util/getopt_helpers.c:659
8230msgid "[+/-]MICROSECONDS"
8231msgstr ""
8232
8233#: src/util/getopt_helpers.c:661
8234msgid "modify system time by given offset (for debugging/testing only)"
8235msgstr ""
8236
8237#: src/util/getopt_helpers.c:696
8230#, fuzzy, c-format 8238#, fuzzy, c-format
8231msgid "You must pass relative time to the `%s' option.\n" 8239msgid "You must pass relative time to the `%s' option.\n"
8232msgstr "您必须向“%s”选项传递一个数字。\n" 8240msgstr "您必须向“%s”选项传递一个数字。\n"
8233 8241
8234#: src/util/getopt_helpers.c:675 8242#: src/util/getopt_helpers.c:761
8235#, fuzzy, c-format 8243#, fuzzy, c-format
8236msgid "You must pass absolute time to the `%s' option.\n" 8244msgid "You must pass absolute time to the `%s' option.\n"
8237msgstr "您必须向“%s”选项传递一个数字。\n" 8245msgstr "您必须向“%s”选项传递一个数字。\n"
8238 8246
8239#: src/util/getopt_helpers.c:740 8247#: src/util/getopt_helpers.c:828
8240#, c-format 8248#, c-format
8241msgid "Your input for the '%s' option has to be a non negative number \n" 8249msgid "Your input for the '%s' option has to be a non negative number\n"
8242msgstr "" 8250msgstr ""
8243 8251
8244#: src/util/getopt_helpers.c:817 8252#: src/util/getopt_helpers.c:907
8245#, fuzzy, c-format 8253#, fuzzy, c-format
8246msgid "You must pass a number below %u to the `%s' option.\n" 8254msgid "You must pass a number below %u to the `%s' option.\n"
8247msgstr "您必须向“%s”选项传递一个数字。\n" 8255msgstr "您必须向“%s”选项传递一个数字。\n"
8248 8256
8249#: src/util/getopt_helpers.c:902 8257#: src/util/getopt_helpers.c:994
8250#, c-format 8258#, c-format
8251msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 8259msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
8252msgstr "" 8260msgstr ""
@@ -8583,14 +8591,14 @@ msgstr ""
8583msgid "Could not resolve our FQDN: %s\n" 8591msgid "Could not resolve our FQDN: %s\n"
8584msgstr "无法解析“%s”(%s):%s\n" 8592msgstr "无法解析“%s”(%s):%s\n"
8585 8593
8586#: src/util/service.c:657 8594#: src/util/service.c:654
8587#, c-format 8595#, c-format
8588msgid "" 8596msgid ""
8589"Processing code for message of type %u did not call " 8597"Processing code for message of type %u did not call "
8590"`GNUNET_SERVICE_client_continue' after %s\n" 8598"`GNUNET_SERVICE_client_continue' after %s\n"
8591msgstr "" 8599msgstr ""
8592 8600
8593#: src/util/service.c:1572 8601#: src/util/service.c:1569
8594msgid "" 8602msgid ""
8595"Could not bind to any of the ports I was supposed to, refusing to run!\n" 8603"Could not bind to any of the ports I was supposed to, refusing to run!\n"
8596msgstr "" 8604msgstr ""
@@ -8902,8 +8910,8 @@ msgstr ""
8902msgid "Setup tunnels via VPN." 8910msgid "Setup tunnels via VPN."
8903msgstr "" 8911msgstr ""
8904 8912
8905#: src/zonemaster/gnunet-service-zonemaster-monitor.c:420
8906#: src/zonemaster/gnunet-service-zonemaster.c:849 8913#: src/zonemaster/gnunet-service-zonemaster.c:849
8914#: src/zonemaster/gnunet-service-zonemaster-monitor.c:420
8907#, fuzzy 8915#, fuzzy
8908msgid "Failed to connect to the namestore!\n" 8916msgid "Failed to connect to the namestore!\n"
8909msgstr "初始化“%s”服务失败。\n" 8917msgstr "初始化“%s”服务失败。\n"
diff --git a/src/Makefile.am b/src/Makefile.am
index 7b73a4bb8..4642b6215 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,6 +28,7 @@ if HAVE_MHD
28 JSON_DIR = json 28 JSON_DIR = json
29endif 29endif
30endif 30endif
31if HAVE_MHD
31if HAVE_LIBGNURL 32if HAVE_LIBGNURL
32 CURL_DIR = curl 33 CURL_DIR = curl
33else 34else
@@ -35,6 +36,7 @@ if HAVE_LIBCURL
35 CURL_DIR = curl 36 CURL_DIR = curl
36endif 37endif
37endif 38endif
39endif
38 40
39if BUILD_PULSE_HELPERS 41if BUILD_PULSE_HELPERS
40CONVERSATION_DIR = conversation 42CONVERSATION_DIR = conversation
@@ -56,13 +58,8 @@ if HAVE_POSTGRESQL
56 POSTGRES_DIR = pq 58 POSTGRES_DIR = pq
57endif 59endif
58 60
59if HAVE_MHD 61if HAVE_REST
60if HAVE_JSON
61 REST_DIR = rest 62 REST_DIR = rest
62 RECLAIM_DIR = \
63 reclaim-attribute \
64 reclaim
65endif
66endif 63endif
67 64
68 65
@@ -119,6 +116,6 @@ SUBDIRS = \
119 exit \ 116 exit \
120 pt \ 117 pt \
121 secretsharing \ 118 secretsharing \
122 $(RECLAIM_DIR) \ 119 reclaim \
123 $(EXP_DIR) \ 120 $(EXP_DIR) \
124 integration-tests 121 integration-tests
diff --git a/src/abd/abd.h b/src/abd/abd.h
index 1e9d6bcea..0af0d43ca 100644
--- a/src/abd/abd.h
+++ b/src/abd/abd.h
@@ -245,14 +245,14 @@ struct DelegateEntry
245{ 245{
246 246
247 /** 247 /**
248 * The signature for this credential by the issuer 248 * Signature meta
249 */ 249 */
250 struct GNUNET_CRYPTO_EcdsaSignature signature; 250 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
251 251
252 /** 252 /**
253 * Signature meta 253 * The signature for this credential by the issuer
254 */ 254 */
255 struct GNUNET_CRYPTO_EccSignaturePurpose purpose; 255 struct GNUNET_CRYPTO_EcdsaSignature signature;
256 256
257 /** 257 /**
258 * Public key of the issuer 258 * Public key of the issuer
diff --git a/src/abd/abd_serialization.c b/src/abd/abd_serialization.c
index 90a89886b..c03fab7dc 100644
--- a/src/abd/abd_serialization.c
+++ b/src/abd/abd_serialization.c
@@ -451,7 +451,7 @@ GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *dele,
451 451
452 if (GNUNET_OK != 452 if (GNUNET_OK !=
453 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE, 453 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
454 &cdata->purpose, 454 cdata,
455 &cdata->signature, 455 &cdata->signature,
456 &cdata->issuer_key)) 456 &cdata->issuer_key))
457 { 457 {
@@ -474,7 +474,7 @@ GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size)
474 cdata = (struct DelegateEntry *) data; 474 cdata = (struct DelegateEntry *) data;
475 if (GNUNET_OK != 475 if (GNUNET_OK !=
476 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE, 476 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
477 &cdata->purpose, 477 cdata,
478 &cdata->signature, 478 &cdata->signature,
479 &cdata->issuer_key)) 479 &cdata->issuer_key))
480 { 480 {
diff --git a/src/abd/delegate_misc.c b/src/abd/delegate_misc.c
index df34cff8b..4740a3e30 100644
--- a/src/abd/delegate_misc.c
+++ b/src/abd/delegate_misc.c
@@ -240,13 +240,7 @@ GNUNET_ABD_delegate_issue (
240 240
241 GNUNET_memcpy (&del[1], tmp_str, attr_len); 241 GNUNET_memcpy (&del[1], tmp_str, attr_len);
242 242
243 if (GNUNET_OK != 243 GNUNET_CRYPTO_ecdsa_sign (issuer, del, &del->signature);
244 GNUNET_CRYPTO_ecdsa_sign (issuer, &del->purpose, &del->signature))
245 {
246 GNUNET_break (0);
247 GNUNET_free (del);
248 return NULL;
249 }
250 244
251 dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len); 245 dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len);
252 dele->signature = del->signature; 246 dele->signature = del->signature;
diff --git a/src/abd/gnunet-abd.c b/src/abd/gnunet-abd.c
index a5d32c3dd..f7e03fb4a 100644
--- a/src/abd/gnunet-abd.c
+++ b/src/abd/gnunet-abd.c
@@ -384,7 +384,7 @@ handle_verify_result (void *cls,
384 * @param ego an ego known to identity service, or NULL 384 * @param ego an ego known to identity service, or NULL
385 */ 385 */
386static void 386static void
387identity_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) 387identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
388{ 388{
389 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 389 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
390 390
@@ -512,11 +512,13 @@ get_existing_record (void *cls,
512 unsigned int rd_count, 512 unsigned int rd_count,
513 const struct GNUNET_GNSRECORD_Data *rd) 513 const struct GNUNET_GNSRECORD_Data *rd)
514{ 514{
515 struct GNUNET_GNSRECORD_Data rdn[rd_count + 1];
516 struct GNUNET_GNSRECORD_Data *rde; 515 struct GNUNET_GNSRECORD_Data *rde;
516 struct GNUNET_GNSRECORD_Data* rdn =
517 GNUNET_malloc(sizeof(*rdn)*(rd_count + 1));
517 518
518 memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data)); 519 memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data));
519 GNUNET_memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data)); 520 GNUNET_memcpy (&rdn[1], rd,
521 rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
520 rde = &rdn[0]; 522 rde = &rdn[0];
521 rde->data = data; 523 rde->data = data;
522 rde->data_size = data_size; 524 rde->data_size = data_size;
@@ -539,13 +541,13 @@ get_existing_record (void *cls,
539 rde, 541 rde,
540 &add_continuation, 542 &add_continuation,
541 &add_qe); 543 &add_qe);
542 544 GNUNET_free(rdn);
543 return; 545 return;
544} 546}
545 547
546 548
547static void 549static void
548store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) 550store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
549{ 551{
550 const struct GNUNET_CONFIGURATION_Handle *cfg = cls; 552 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
551 553
@@ -602,10 +604,18 @@ store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
602 if (GNUNET_OK != 604 if (GNUNET_OK !=
603 GNUNET_GNSRECORD_string_to_value (type, subject, &data, &data_size)) 605 GNUNET_GNSRECORD_string_to_value (type, subject, &data, &data_size))
604 { 606 {
605 fprintf (stderr, 607 if(typestring == NULL) {
606 "Value `%s' invalid for record type `%s'\n", 608 fputs("No value for unknown record type\n", stderr);
607 subject, 609 } else if(subject == NULL) {
608 typestring); 610 fprintf(stderr,
611 "No value for record type`%s'\n",
612 typestring);
613 } else {
614 fprintf (stderr,
615 "Value `%s' invalid for record type `%s'\n",
616 subject,
617 typestring);
618 }
609 GNUNET_SCHEDULER_shutdown (); 619 GNUNET_SCHEDULER_shutdown ();
610 return; 620 return;
611 } 621 }
@@ -638,7 +648,7 @@ store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
638 648
639 649
640static void 650static void
641sign_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) 651sign_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
642{ 652{
643 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 653 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
644 struct GNUNET_ABD_Delegate *dele; 654 struct GNUNET_ABD_Delegate *dele;
@@ -917,7 +927,8 @@ run (void *cls,
917 int i; 927 int i;
918 while (NULL != (tok = strtok (NULL, ","))) 928 while (NULL != (tok = strtok (NULL, ",")))
919 count++; 929 count++;
920 struct GNUNET_ABD_Delegate delegates[count]; 930 struct GNUNET_ABD_Delegate* delegates =
931 GNUNET_malloc(sizeof(*delegates)*count);
921 struct GNUNET_ABD_Delegate *dele; 932 struct GNUNET_ABD_Delegate *dele;
922 GNUNET_free (tmp); 933 GNUNET_free (tmp);
923 tmp = GNUNET_strdup (subject_delegate); 934 tmp = GNUNET_strdup (subject_delegate);
@@ -946,9 +957,11 @@ run (void *cls,
946 NULL); 957 NULL);
947 for (i = 0; i < count; i++) 958 for (i = 0; i < count; i++)
948 { 959 {
949 GNUNET_free ((char *) delegates[i].issuer_attribute); 960 GNUNET_free_nz ((char *) delegates[i].issuer_attribute);
961 delegates[i].issuer_attribute = NULL;
950 } 962 }
951 GNUNET_free (tmp); 963 GNUNET_free (tmp);
964 GNUNET_free(delegates);
952 } 965 }
953 else 966 else
954 { 967 {
@@ -1074,7 +1087,7 @@ main (int argc, char *const *argv)
1074 &run, 1087 &run,
1075 NULL)) 1088 NULL))
1076 ret = 1; 1089 ret = 1;
1077 GNUNET_free ((void *) argv); 1090 GNUNET_free_nz ((void *) argv);
1078 return ret; 1091 return ret;
1079} 1092}
1080 1093
diff --git a/src/abd/plugin_gnsrecord_abd.c b/src/abd/plugin_gnsrecord_abd.c
index c7635b997..850fa9a45 100644
--- a/src/abd/plugin_gnsrecord_abd.c
+++ b/src/abd/plugin_gnsrecord_abd.c
@@ -235,8 +235,10 @@ abd_string_to_value (void *cls,
235 (char *) &sets[1]); 235 (char *) &sets[1]);
236 for (i = 0; i < entries; i++) 236 for (i = 0; i < entries; i++)
237 { 237 {
238 if (0 != set[i].subject_attribute_len) 238 if (0 != set[i].subject_attribute_len) {
239 GNUNET_free ((char *) set[i].subject_attribute); 239 GNUNET_free_nz ((char *) set[i].subject_attribute);
240 set[i].subject_attribute = NULL;
241 }
240 } 242 }
241 sets->set_count = htonl (entries); 243 sets->set_count = htonl (entries);
242 sets->data_size = GNUNET_htonll (tmp_data_size); 244 sets->data_size = GNUNET_htonll (tmp_data_size);
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c
index 3b4e770b0..ea3a012ab 100644
--- a/src/arm/gnunet-arm.c
+++ b/src/arm/gnunet-arm.c
@@ -1054,10 +1054,10 @@ main (int argc, char *const *argv)
1054 &run, 1054 &run,
1055 NULL))) 1055 NULL)))
1056 { 1056 {
1057 GNUNET_free ((void *) argv); 1057 GNUNET_free_nz ((void *) argv);
1058 return ret; 1058 return ret;
1059 } 1059 }
1060 GNUNET_free ((void *) argv); 1060 GNUNET_free_nz ((void *) argv);
1061 return lret; 1061 return lret;
1062} 1062}
1063 1063
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c
index 16636e505..947ed7798 100644
--- a/src/ats-tool/gnunet-ats.c
+++ b/src/ats-tool/gnunet-ats.c
@@ -980,7 +980,7 @@ main (int argc, char *const *argv)
980 NULL); 980 NULL);
981 GNUNET_free_non_null (opt_pid_str); 981 GNUNET_free_non_null (opt_pid_str);
982 GNUNET_free_non_null (opt_type_str); 982 GNUNET_free_non_null (opt_type_str);
983 GNUNET_free ((void *) argv); 983 GNUNET_free_nz ((void *) argv);
984 984
985 if (GNUNET_OK == res) 985 if (GNUNET_OK == res)
986 return ret; 986 return ret;
diff --git a/src/auction/gnunet-auction-create.c b/src/auction/gnunet-auction-create.c
index 79106d8e8..93947b89c 100644
--- a/src/auction/gnunet-auction-create.c
+++ b/src/auction/gnunet-auction-create.c
@@ -214,6 +214,6 @@ main (int argc, char *const *argv)
214 options, 214 options,
215 &run, 215 &run,
216 NULL)) ? ret : 1; 216 NULL)) ? ret : 1;
217 GNUNET_free ((void *) argv); 217 GNUNET_free_nz ((void *) argv);
218 return ret; 218 return ret;
219} 219}
diff --git a/src/auction/gnunet-auction-info.c b/src/auction/gnunet-auction-info.c
index f20565835..dded45ce6 100644
--- a/src/auction/gnunet-auction-info.c
+++ b/src/auction/gnunet-auction-info.c
@@ -78,7 +78,7 @@ main (int argc, char *const *argv)
78 options, 78 options,
79 &run, 79 &run,
80 NULL)) ? ret : 1; 80 NULL)) ? ret : 1;
81 GNUNET_free ((void *) argv); 81 GNUNET_free_nz ((void *) argv);
82 return ret; 82 return ret;
83} 83}
84 84
diff --git a/src/auction/gnunet-auction-join.c b/src/auction/gnunet-auction-join.c
index f20565835..dded45ce6 100644
--- a/src/auction/gnunet-auction-join.c
+++ b/src/auction/gnunet-auction-join.c
@@ -78,7 +78,7 @@ main (int argc, char *const *argv)
78 options, 78 options,
79 &run, 79 &run,
80 NULL)) ? ret : 1; 80 NULL)) ? ret : 1;
81 GNUNET_free ((void *) argv); 81 GNUNET_free_nz ((void *) argv);
82 return ret; 82 return ret;
83} 83}
84 84
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c
index f3ccd9883..9b7538ae7 100644
--- a/src/cadet/gnunet-cadet.c
+++ b/src/cadet/gnunet-cadet.c
@@ -840,7 +840,7 @@ main (int argc, char *const *argv)
840 &run, 840 &run,
841 NULL); 841 NULL);
842 842
843 GNUNET_free ((void *) argv); 843 GNUNET_free_nz ((void *) argv);
844 844
845 if (GNUNET_OK == res) 845 if (GNUNET_OK == res)
846 return 0; 846 return 0;
diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c
index ae201ed2d..f1f2ec81f 100644
--- a/src/cadet/gnunet-service-cadet_tunnels.c
+++ b/src/cadet/gnunet-service-cadet_tunnels.c
@@ -677,8 +677,7 @@ new_ephemeral (struct CadetTunnelAxolotl *ax)
677{ 677{
678 LOG (GNUNET_ERROR_TYPE_DEBUG, 678 LOG (GNUNET_ERROR_TYPE_DEBUG,
679 "Creating new ephemeral ratchet key (DHRs)\n"); 679 "Creating new ephemeral ratchet key (DHRs)\n");
680 GNUNET_assert (GNUNET_OK == 680 GNUNET_CRYPTO_ecdhe_key_create (&ax->DHRs);
681 GNUNET_CRYPTO_ecdhe_key_create2 (&ax->DHRs));
682} 681}
683 682
684 683
@@ -3186,8 +3185,7 @@ GCT_create_tunnel (struct CadetPeer *destination)
3186 3185
3187 t->kx_retry_delay = INITIAL_KX_RETRY_DELAY; 3186 t->kx_retry_delay = INITIAL_KX_RETRY_DELAY;
3188 new_ephemeral (&t->ax); 3187 new_ephemeral (&t->ax);
3189 GNUNET_assert (GNUNET_OK == 3188 GNUNET_CRYPTO_ecdhe_key_create (&t->ax.kx_0);
3190 GNUNET_CRYPTO_ecdhe_key_create2 (&t->ax.kx_0));
3191 t->destination = destination; 3189 t->destination = destination;
3192 t->channels = GNUNET_CONTAINER_multihashmap32_create (8); 3190 t->channels = GNUNET_CONTAINER_multihashmap32_create (8);
3193 t->maintain_connections_task 3191 t->maintain_connections_task
diff --git a/src/cadet/test_cadeT.c b/src/cadet/test_cadeT.c
index 3bf8e2ad9..97f315167 100644
--- a/src/cadet/test_cadeT.c
+++ b/src/cadet/test_cadeT.c
@@ -62,29 +62,50 @@
62/****************************** TEST LOGIC ********************************/ 62/****************************** TEST LOGIC ********************************/
63 63
64static int kx_initiator; 64static int kx_initiator;
65 65static struct GNUNET_TESTBED_UnderlayLinkModel *model;
66void
67handle_message (void *cls,
68 const struct GNUNET_MessageHeader *msg)
69{
70 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
71}
72 66
73static void 67static void
74send_message () 68send_message ()
75{ 69{
76 struct GNUNET_MQ_Envelope *envelope; 70 struct GNUNET_MQ_Envelope *envelope;
77 struct GNUNET_MessageHeader *msg; 71 struct GNUNET_MessageHeader *msg;
72 int *data;
78 73
79 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__); 74 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
80 75
81 envelope = GNUNET_MQ_msg (msg, 76 envelope = GNUNET_MQ_msg_extra (msg, 10000,
82 GNUNET_MESSAGE_TYPE_DUMMY); 77 GNUNET_MESSAGE_TYPE_DUMMY);
78 data = (int *) &msg[1];
79 *data = 1000;
83 80
84 GNUNET_MQ_send (GNUNET_CADET_get_mq (test_peers[0].channel), 81 GNUNET_MQ_send (GNUNET_CADET_get_mq (test_peers[0].channel),
85 envelope); 82 envelope);
86} 83}
87 84
85int
86check_message (void *cls,
87 const struct GNUNET_MessageHeader *message)
88{
89 return GNUNET_OK; /* all is well-formed */
90}
91
92void
93handle_message (void *cls,
94 const struct GNUNET_MessageHeader *msg)
95{
96 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
97
98/*
99 model = GNUNET_TESTBED_underlaylinkmodel_create (test_peers[1].testbed_peer,
100 GNUNET_TESTBED_UNDERLAYLINKMODELTYPE_BLACKLIST);
101 GNUNET_TESTBED_underlaylinkmodel_set_link (model,
102 test_peers[0].testbed_peer,
103 0, 100, 0);
104 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s: Modified link model.\n", __func__);
105*/
106 send_message();
107}
108
88/** 109/**
89 * This function is called after all testbed management is done and the 110 * This function is called after all testbed management is done and the
90 * testbed peers are ready for the actual test logic. 111 * testbed peers are ready for the actual test logic.
@@ -98,10 +119,12 @@ run_test ()
98 kx_initiator = (0 < GNUNET_memcmp (&test_peers[0].id, &test_peers[1].id)) ? 1 : 0; 119 kx_initiator = (0 < GNUNET_memcmp (&test_peers[0].id, &test_peers[1].id)) ? 1 : 0;
99 120
100 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 121 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
101 "KX initiator is peer %s\n", 122 "KX initiator is peer %s (idx:%i)\n",
102 GNUNET_i2s (&test_peers[kx_initiator].id)); 123 GNUNET_i2s (&test_peers[kx_initiator].id),
124 kx_initiator);
103 125
104 send_message(); 126 for (int i=0; i<10; i++)
127 send_message();
105} 128}
106 129
107 130
diff --git a/src/conversation/gnunet-conversation-test.c b/src/conversation/gnunet-conversation-test.c
index 2e6772d92..9f8e54033 100644
--- a/src/conversation/gnunet-conversation-test.c
+++ b/src/conversation/gnunet-conversation-test.c
@@ -257,7 +257,7 @@ main (int argc,
257 options, 257 options,
258 &run, 258 &run,
259 NULL)) ? ret : 1; 259 NULL)) ? ret : 1;
260 GNUNET_free ((void *) argv); 260 GNUNET_free_nz ((void *) argv);
261 return ret; 261 return ret;
262} 262}
263 263
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c
index 6c0a6e42f..b908cd82c 100644
--- a/src/conversation/gnunet-conversation.c
+++ b/src/conversation/gnunet-conversation.c
@@ -1219,7 +1219,7 @@ main (int argc, char *const *argv)
1219 options, 1219 options,
1220 &run, 1220 &run,
1221 NULL); 1221 NULL);
1222 GNUNET_free ((void *) argv); 1222 GNUNET_free_nz ((void *) argv);
1223 if (NULL != cfg) 1223 if (NULL != cfg)
1224 { 1224 {
1225 GNUNET_CONFIGURATION_destroy (cfg); 1225 GNUNET_CONFIGURATION_destroy (cfg);
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index 12b943217..502146255 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -753,7 +753,7 @@ handle_cadet_ring_message (void *cls, const struct CadetPhoneRingMessage *msg)
753 753
754 if (GNUNET_OK != 754 if (GNUNET_OK !=
755 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING, 755 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING,
756 &rs.purpose, 756 &rs,
757 &msg->signature, 757 &msg->signature,
758 &msg->caller_id)) 758 &msg->caller_id))
759 { 759 {
@@ -1138,9 +1138,9 @@ handle_client_call_message (void *cls, const struct ClientCallMessage *msg)
1138 e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING); 1138 e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING);
1139 GNUNET_CRYPTO_ecdsa_key_get_public (&msg->caller_id, &ring->caller_id); 1139 GNUNET_CRYPTO_ecdsa_key_get_public (&msg->caller_id, &ring->caller_id);
1140 ring->expiration_time = rs.expiration_time; 1140 ring->expiration_time = rs.expiration_time;
1141 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdsa_sign (&msg->caller_id, 1141 GNUNET_CRYPTO_ecdsa_sign (&msg->caller_id,
1142 &rs.purpose, 1142 &rs,
1143 &ring->signature)); 1143 &ring->signature);
1144 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending RING message via CADET\n"); 1144 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending RING message via CADET\n");
1145 GNUNET_MQ_send (ch->mq, e); 1145 GNUNET_MQ_send (ch->mq, e);
1146 GNUNET_SERVICE_client_continue (line->client); 1146 GNUNET_SERVICE_client_continue (line->client);
diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c
index 90777a7a8..d90c8e1f5 100644
--- a/src/core/gnunet-core.c
+++ b/src/core/gnunet-core.c
@@ -198,7 +198,7 @@ main (int argc, char *const *argv)
198 &run, 198 &run,
199 NULL); 199 NULL);
200 200
201 GNUNET_free ((void *) argv); 201 GNUNET_free_nz ((void *) argv);
202 if (GNUNET_OK == res) 202 if (GNUNET_OK == res)
203 return 0; 203 return 0;
204 return 1; 204 return 1;
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index 04e6d0141..34f8440ae 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -912,14 +912,15 @@ run (void *cls,
912 const struct GNUNET_CONFIGURATION_Handle *c, 912 const struct GNUNET_CONFIGURATION_Handle *c,
913 struct GNUNET_SERVICE_Handle *service) 913 struct GNUNET_SERVICE_Handle *service)
914{ 914{
915 struct GNUNET_CRYPTO_EddsaPrivateKey *pk; 915 struct GNUNET_CRYPTO_EddsaPrivateKey pk;
916 char *keyfile; 916 char *keyfile;
917 917
918 GSC_cfg = c; 918 GSC_cfg = c;
919 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (GSC_cfg, 919 if (GNUNET_OK !=
920 "PEER", 920 GNUNET_CONFIGURATION_get_value_filename (GSC_cfg,
921 "PRIVATE_KEY", 921 "PEER",
922 &keyfile)) 922 "PRIVATE_KEY",
923 &keyfile))
923 { 924 {
924 GNUNET_log ( 925 GNUNET_log (
925 GNUNET_ERROR_TYPE_ERROR, 926 GNUNET_ERROR_TYPE_ERROR,
@@ -931,10 +932,19 @@ run (void *cls,
931 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); 932 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
932 GNUNET_SERVICE_suspend (service); 933 GNUNET_SERVICE_suspend (service);
933 GSC_TYPEMAP_init (); 934 GSC_TYPEMAP_init ();
934 pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); 935 if (GNUNET_SYSERR ==
936 GNUNET_CRYPTO_eddsa_key_from_file (keyfile,
937 GNUNET_YES,
938 &pk))
939 {
940 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
941 "Failed to setup peer's private key\n");
942 GNUNET_SCHEDULER_shutdown ();
943 GNUNET_free (keyfile);
944 return;
945 }
935 GNUNET_free (keyfile); 946 GNUNET_free (keyfile);
936 GNUNET_assert (NULL != pk); 947 if (GNUNET_OK != GSC_KX_init (&pk))
937 if (GNUNET_OK != GSC_KX_init (pk))
938 { 948 {
939 GNUNET_SCHEDULER_shutdown (); 949 GNUNET_SCHEDULER_shutdown ();
940 return; 950 return;
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c
index 2f43f7d13..cafe658e8 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -366,12 +366,12 @@ static struct GNUNET_TRANSPORT_CoreHandle *transport;
366/** 366/**
367 * Our private key. 367 * Our private key.
368 */ 368 */
369static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; 369static struct GNUNET_CRYPTO_EddsaPrivateKey my_private_key;
370 370
371/** 371/**
372 * Our ephemeral private key. 372 * Our ephemeral private key.
373 */ 373 */
374static struct GNUNET_CRYPTO_EcdhePrivateKey *my_ephemeral_key; 374static struct GNUNET_CRYPTO_EcdhePrivateKey my_ephemeral_key;
375 375
376/** 376/**
377 * Current message we send for a key exchange. 377 * Current message we send for a key exchange.
@@ -935,9 +935,10 @@ derive_session_keys (struct GSC_KeyExchangeInfo *kx)
935{ 935{
936 struct GNUNET_HashCode key_material; 936 struct GNUNET_HashCode key_material;
937 937
938 if (GNUNET_OK != GNUNET_CRYPTO_ecc_ecdh (my_ephemeral_key, 938 if (GNUNET_OK !=
939 &kx->other_ephemeral_key, 939 GNUNET_CRYPTO_ecc_ecdh (&my_ephemeral_key,
940 &key_material)) 940 &kx->other_ephemeral_key,
941 &key_material))
941 { 942 {
942 GNUNET_break (0); 943 GNUNET_break (0);
943 return; 944 return;
@@ -1015,10 +1016,10 @@ handle_ephemeral_key (void *cls, const struct EphemeralKeyMessage *m)
1015 + sizeof(struct GNUNET_CRYPTO_EddsaPublicKey) 1016 + sizeof(struct GNUNET_CRYPTO_EddsaPublicKey)
1016 + sizeof(struct GNUNET_CRYPTO_EddsaPublicKey)) || 1017 + sizeof(struct GNUNET_CRYPTO_EddsaPublicKey)) ||
1017 (GNUNET_OK != 1018 (GNUNET_OK !=
1018 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY, 1019 GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY,
1019 &m->purpose, 1020 &m->purpose,
1020 &m->signature, 1021 &m->signature,
1021 &m->origin_identity.public_key))) 1022 &m->origin_identity.public_key)))
1022 { 1023 {
1023 /* invalid signature */ 1024 /* invalid signature */
1024 GNUNET_break_op (0); 1025 GNUNET_break_op (0);
@@ -1850,13 +1851,13 @@ sign_ephemeral_key ()
1850 current_ekm.expiration_time = 1851 current_ekm.expiration_time =
1851 GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS); 1852 GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS);
1852 } 1853 }
1853 GNUNET_CRYPTO_ecdhe_key_get_public (my_ephemeral_key, 1854 GNUNET_CRYPTO_ecdhe_key_get_public (&my_ephemeral_key,
1854 &current_ekm.ephemeral_key); 1855 &current_ekm.ephemeral_key);
1855 current_ekm.origin_identity = GSC_my_identity; 1856 current_ekm.origin_identity = GSC_my_identity;
1856 GNUNET_assert (GNUNET_OK == 1857 GNUNET_assert (GNUNET_OK ==
1857 GNUNET_CRYPTO_eddsa_sign (my_private_key, 1858 GNUNET_CRYPTO_eddsa_sign_ (&my_private_key,
1858 &current_ekm.purpose, 1859 &current_ekm.purpose,
1859 &current_ekm.signature)); 1860 &current_ekm.signature));
1860} 1861}
1861 1862
1862 1863
@@ -1871,10 +1872,7 @@ do_rekey (void *cls)
1871 struct GSC_KeyExchangeInfo *pos; 1872 struct GSC_KeyExchangeInfo *pos;
1872 1873
1873 rekey_task = GNUNET_SCHEDULER_add_delayed (REKEY_FREQUENCY, &do_rekey, NULL); 1874 rekey_task = GNUNET_SCHEDULER_add_delayed (REKEY_FREQUENCY, &do_rekey, NULL);
1874 if (NULL != my_ephemeral_key) 1875 GNUNET_CRYPTO_ecdhe_key_create (&my_ephemeral_key);
1875 GNUNET_free (my_ephemeral_key);
1876 my_ephemeral_key = GNUNET_CRYPTO_ecdhe_key_create ();
1877 GNUNET_assert (NULL != my_ephemeral_key);
1878 sign_ephemeral_key (); 1876 sign_ephemeral_key ();
1879 { 1877 {
1880 struct GNUNET_HashCode eh; 1878 struct GNUNET_HashCode eh;
@@ -1931,17 +1929,10 @@ GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk)
1931 NULL), 1929 NULL),
1932 GNUNET_MQ_handler_end () }; 1930 GNUNET_MQ_handler_end () };
1933 1931
1934 my_private_key = pk; 1932 my_private_key = *pk;
1935 GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, 1933 GNUNET_CRYPTO_eddsa_key_get_public (&my_private_key,
1936 &GSC_my_identity.public_key); 1934 &GSC_my_identity.public_key);
1937 my_ephemeral_key = GNUNET_CRYPTO_ecdhe_key_create (); 1935 GNUNET_CRYPTO_ecdhe_key_create (&my_ephemeral_key);
1938 if (NULL == my_ephemeral_key)
1939 {
1940 GNUNET_break (0);
1941 GNUNET_free (my_private_key);
1942 my_private_key = NULL;
1943 return GNUNET_SYSERR;
1944 }
1945 sign_ephemeral_key (); 1936 sign_ephemeral_key ();
1946 { 1937 {
1947 struct GNUNET_HashCode eh; 1938 struct GNUNET_HashCode eh;
@@ -1989,16 +1980,12 @@ GSC_KX_done ()
1989 GNUNET_SCHEDULER_cancel (rekey_task); 1980 GNUNET_SCHEDULER_cancel (rekey_task);
1990 rekey_task = NULL; 1981 rekey_task = NULL;
1991 } 1982 }
1992 if (NULL != my_ephemeral_key) 1983 memset (&my_ephemeral_key,
1993 { 1984 0,
1994 GNUNET_free (my_ephemeral_key); 1985 sizeof (my_ephemeral_key));
1995 my_ephemeral_key = NULL; 1986 memset (&my_private_key,
1996 } 1987 0,
1997 if (NULL != my_private_key) 1988 sizeof (my_private_key));
1998 {
1999 GNUNET_free (my_private_key);
2000 my_private_key = NULL;
2001 }
2002 if (NULL != nc) 1989 if (NULL != nc)
2003 { 1990 {
2004 GNUNET_notification_context_destroy (nc); 1991 GNUNET_notification_context_destroy (nc);
diff --git a/src/curl/Makefile.am b/src/curl/Makefile.am
index ed5819dee..c6b350bc7 100644
--- a/src/curl/Makefile.am
+++ b/src/curl/Makefile.am
@@ -32,7 +32,7 @@ libgnunetcurl_la_LIBADD = \
32 $(LIB_GNURL) \ 32 $(LIB_GNURL) \
33 $(XLIB) 33 $(XLIB)
34libgnunetcurl_la_CPPFLAGS = \ 34libgnunetcurl_la_CPPFLAGS = \
35 $(CPP_GNURL) $(AM_CPPFLAGS) 35 $(CPP_GNURL) $(AM_CPPFLAGS) $(MHD_CFLAGS)
36 36
37#check_PROGRAMS = \ 37#check_PROGRAMS = \
38# test_curl 38# test_curl
diff --git a/src/curl/curl.c b/src/curl/curl.c
index 01c7c5fca..b7452330f 100644
--- a/src/curl/curl.c
+++ b/src/curl/curl.c
@@ -25,6 +25,7 @@
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include <jansson.h> 27#include <jansson.h>
28#include <microhttpd.h>
28#include "gnunet_curl_lib.h" 29#include "gnunet_curl_lib.h"
29 30
30#if ENABLE_BENCHMARK 31#if ENABLE_BENCHMARK
@@ -181,7 +182,8 @@ struct GNUNET_CURL_Context
181 * @return library context 182 * @return library context
182 */ 183 */
183struct GNUNET_CURL_Context * 184struct GNUNET_CURL_Context *
184GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb, void *cb_cls) 185GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb,
186 void *cb_cls)
185{ 187{
186 struct GNUNET_CURL_Context *ctx; 188 struct GNUNET_CURL_Context *ctx;
187 CURLM *multi; 189 CURLM *multi;
@@ -189,7 +191,8 @@ GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb, void *cb_cls)
189 191
190 if (curl_fail) 192 if (curl_fail)
191 { 193 {
192 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Curl was not initialised properly\n"); 194 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
195 "Curl was not initialised properly\n");
193 return NULL; 196 return NULL;
194 } 197 }
195 if (NULL == (multi = curl_multi_init ())) 198 if (NULL == (multi = curl_multi_init ()))
@@ -228,6 +231,27 @@ GNUNET_CURL_enable_async_scope_header (struct GNUNET_CURL_Context *ctx,
228 231
229 232
230/** 233/**
234 * Return #GNUNET_YES if given a valid scope ID and
235 * #GNUNET_NO otherwise. See #setup_job_headers,
236 * logic related to
237 * #GNUNET_CURL_enable_async_scope_header() for the
238 * code that generates such a @a scope_id.
239 *
240 * @returns #GNUNET_YES iff given a valid scope ID
241 */
242int
243GNUNET_CURL_is_valid_scope_id (const char *scope_id)
244{
245 if (strlen (scope_id) >= 64)
246 return GNUNET_NO;
247 for (size_t i = 0; i < strlen (scope_id); i++)
248 if (! (isalnum (scope_id[i]) || (scope_id[i] == '-')))
249 return GNUNET_NO;
250 return GNUNET_YES;
251}
252
253
254/**
231 * Callback used when downloading the reply to an HTTP request. 255 * Callback used when downloading the reply to an HTTP request.
232 * Just appends all of the data to the `buf` in the 256 * Just appends all of the data to the `buf` in the
233 * `struct DownloadBuffer` for further processing. The size of 257 * `struct DownloadBuffer` for further processing. The size of
@@ -241,7 +265,10 @@ GNUNET_CURL_enable_async_scope_header (struct GNUNET_CURL_Context *ctx,
241 * @return number of bytes processed from @a bufptr 265 * @return number of bytes processed from @a bufptr
242 */ 266 */
243static size_t 267static size_t
244download_cb (char *bufptr, size_t size, size_t nitems, void *cls) 268download_cb (char *bufptr,
269 size_t size,
270 size_t nitems,
271 void *cls)
245{ 272{
246 struct GNUNET_CURL_DownloadBuffer *db = cls; 273 struct GNUNET_CURL_DownloadBuffer *db = cls;
247 size_t msize; 274 size_t msize;
@@ -354,7 +381,9 @@ setup_job (CURL *eh,
354 } 381 }
355 job->easy_handle = eh; 382 job->easy_handle = eh;
356 job->ctx = ctx; 383 job->ctx = ctx;
357 GNUNET_CONTAINER_DLL_insert (ctx->jobs_head, ctx->jobs_tail, job); 384 GNUNET_CONTAINER_DLL_insert (ctx->jobs_head,
385 ctx->jobs_tail,
386 job);
358 return job; 387 return job;
359} 388}
360 389
@@ -475,7 +504,11 @@ GNUNET_CURL_job_add (struct GNUNET_CURL_Context *ctx,
475 curl_slist_append (NULL, "Content-Type: application/json"))); 504 curl_slist_append (NULL, "Content-Type: application/json")));
476 } 505 }
477 506
478 job = GNUNET_CURL_job_add2 (ctx, eh, job_headers, jcc, jcc_cls); 507 job = GNUNET_CURL_job_add2 (ctx,
508 eh,
509 job_headers,
510 jcc,
511 jcc_cls);
479 curl_slist_free_all (job_headers); 512 curl_slist_free_all (job_headers);
480 return job; 513 return job;
481} 514}
@@ -504,6 +537,40 @@ GNUNET_CURL_job_cancel (struct GNUNET_CURL_Job *job)
504 537
505 538
506/** 539/**
540 * Test if the given content type @a ct is JSON
541 *
542 * @param ct a content type, i.e. "application/json; charset=UTF-8"
543 * @return true if @a ct denotes JSON
544 */
545static bool
546is_json (const char *ct)
547{
548 const char *semi;
549
550 /* check for "application/json" exact match */
551 if (0 == strcasecmp (ct,
552 "application/json"))
553 return true;
554 /* check for "application/json;[ANYTHING]" */
555 semi = strchr (ct,
556 ';');
557 /* also allow "application/json [ANYTHING]" (note the space!) */
558 if (NULL == semi)
559 semi = strchr (ct,
560 ' ');
561 if (NULL == semi)
562 return false; /* no delimiter we accept, forget it */
563 if (semi - ct != strlen ("application/json"))
564 return false; /* delimiter past desired length, forget it */
565 if (0 == strncasecmp (ct,
566 "application/json",
567 strlen ("application/json")))
568 return true; /* OK */
569 return false;
570}
571
572
573/**
507 * Obtain information about the final result about the 574 * Obtain information about the final result about the
508 * HTTP download. If the download was successful, parses 575 * HTTP download. If the download was successful, parses
509 * the JSON in the @a db and returns it. Also returns 576 * the JSON in the @a db and returns it. Also returns
@@ -540,8 +607,7 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db,
540 CURLINFO_CONTENT_TYPE, 607 CURLINFO_CONTENT_TYPE,
541 &ct)) || 608 &ct)) ||
542 (NULL == ct) || 609 (NULL == ct) ||
543 (0 != strcasecmp (ct, 610 (! is_json (ct)))
544 "application/json")))
545 { 611 {
546 /* No content type or explicitly not JSON, refuse to parse 612 /* No content type or explicitly not JSON, refuse to parse
547 (but keep response code) */ 613 (but keep response code) */
@@ -561,6 +627,8 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db,
561 (const char *) db->buf); 627 (const char *) db->buf);
562 return NULL; 628 return NULL;
563 } 629 }
630 if (MHD_HTTP_NO_CONTENT == *response_code)
631 return NULL;
564 json = NULL; 632 json = NULL;
565 if (0 == db->eno) 633 if (0 == db->eno)
566 { 634 {
diff --git a/src/datastore/gnunet-datastore.c b/src/datastore/gnunet-datastore.c
index 54d087bc4..5901cce54 100644
--- a/src/datastore/gnunet-datastore.c
+++ b/src/datastore/gnunet-datastore.c
@@ -500,7 +500,7 @@ main (int argc, char *const *argv)
500 &run, 500 &run,
501 NULL)) 501 NULL))
502 ret = 1; 502 ret = 1;
503 GNUNET_free ((void *) argv); 503 GNUNET_free_nz ((void *) argv);
504 return ret; 504 return ret;
505} 505}
506 506
diff --git a/src/dns/gnunet-dns-monitor.c b/src/dns/gnunet-dns-monitor.c
index 7be792fc5..f6c0d0660 100644
--- a/src/dns/gnunet-dns-monitor.c
+++ b/src/dns/gnunet-dns-monitor.c
@@ -387,7 +387,7 @@ main (int argc, char *const *argv)
387 gettext_noop 387 gettext_noop
388 ("Monitor DNS queries."), options, 388 ("Monitor DNS queries."), options,
389 &run, NULL)) ? ret : 1; 389 &run, NULL)) ? ret : 1;
390 GNUNET_free ((void *) argv); 390 GNUNET_free_nz ((void *) argv);
391 return ret; 391 return ret;
392} 392}
393 393
diff --git a/src/dns/gnunet-dns-redirector.c b/src/dns/gnunet-dns-redirector.c
index f7051f70b..606864c8a 100644
--- a/src/dns/gnunet-dns-redirector.c
+++ b/src/dns/gnunet-dns-redirector.c
@@ -260,7 +260,7 @@ main (int argc, char *const *argv)
260 ("Change DNS replies to point elsewhere."), 260 ("Change DNS replies to point elsewhere."),
261 options, 261 options,
262 &run, NULL)) ? ret : 1; 262 &run, NULL)) ? ret : 1;
263 GNUNET_free ((void *) argv); 263 GNUNET_free_nz ((void *) argv);
264 return ret; 264 return ret;
265} 265}
266 266
diff --git a/src/dns/plugin_block_dns.c b/src/dns/plugin_block_dns.c
index 029474b49..e0beccb52 100644
--- a/src/dns/plugin_block_dns.c
+++ b/src/dns/plugin_block_dns.c
@@ -153,10 +153,10 @@ block_plugin_dns_evaluate (void *cls,
153 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 153 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
154 } 154 }
155 if (GNUNET_OK != 155 if (GNUNET_OK !=
156 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD, 156 GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD,
157 &ad->purpose, 157 &ad->purpose,
158 &ad->signature, 158 &ad->signature,
159 &ad->peer.public_key)) 159 &ad->peer.public_key))
160 { 160 {
161 GNUNET_break_op (0); 161 GNUNET_break_op (0);
162 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 162 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 6ac4fc38c..b193176c4 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -3595,9 +3595,9 @@ do_dht_put (void *cls)
3595 expiration = GNUNET_TIME_relative_to_absolute (DNS_ADVERTISEMENT_TIMEOUT); 3595 expiration = GNUNET_TIME_relative_to_absolute (DNS_ADVERTISEMENT_TIMEOUT);
3596 dns_advertisement.expiration_time = GNUNET_TIME_absolute_hton (expiration); 3596 dns_advertisement.expiration_time = GNUNET_TIME_absolute_hton (expiration);
3597 GNUNET_assert (GNUNET_OK == 3597 GNUNET_assert (GNUNET_OK ==
3598 GNUNET_CRYPTO_eddsa_sign (peer_key, 3598 GNUNET_CRYPTO_eddsa_sign_ (peer_key,
3599 &dns_advertisement.purpose, 3599 &dns_advertisement.purpose,
3600 &dns_advertisement.signature)); 3600 &dns_advertisement.signature));
3601 } 3601 }
3602 if (NULL != dht_put) 3602 if (NULL != dht_put)
3603 GNUNET_DHT_put_cancel (dht_put); 3603 GNUNET_DHT_put_cancel (dht_put);
diff --git a/src/exit/gnunet-helper-exit.c b/src/exit/gnunet-helper-exit.c
index d46032662..4a6c66deb 100644
--- a/src/exit/gnunet-helper-exit.c
+++ b/src/exit/gnunet-helper-exit.c
@@ -85,6 +85,7 @@ static const char *sbin_sysctl;
85static const char *sbin_iptables; 85static const char *sbin_iptables;
86 86
87 87
88#if ! defined(__ANDROID__)
88#if ! defined(_LINUX_IN6_H) && defined(__linux__) 89#if ! defined(_LINUX_IN6_H) && defined(__linux__)
89/** 90/**
90 * This is in linux/include/net/ipv6.h, but not always exported. 91 * This is in linux/include/net/ipv6.h, but not always exported.
@@ -96,6 +97,7 @@ struct in6_ifreq
96 int ifr6_ifindex; 97 int ifr6_ifindex;
97}; 98};
98#endif 99#endif
100#endif
99 101
100 102
101/** 103/**
diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c
index 2d118ee51..fd6f2bd72 100644
--- a/src/fs/fs_publish_ublock.c
+++ b/src/fs/fs_publish_ublock.c
@@ -268,9 +268,9 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h,
268 GNUNET_CRYPTO_ecdsa_key_get_public (nsd, 268 GNUNET_CRYPTO_ecdsa_key_get_public (nsd,
269 &ub_enc->verification_key); 269 &ub_enc->verification_key);
270 GNUNET_assert (GNUNET_OK == 270 GNUNET_assert (GNUNET_OK ==
271 GNUNET_CRYPTO_ecdsa_sign (nsd, 271 GNUNET_CRYPTO_ecdsa_sign_ (nsd,
272 &ub_enc->purpose, 272 &ub_enc->purpose,
273 &ub_enc->signature)); 273 &ub_enc->signature));
274 GNUNET_CRYPTO_hash (&ub_enc->verification_key, 274 GNUNET_CRYPTO_hash (&ub_enc->verification_key,
275 sizeof(ub_enc->verification_key), 275 sizeof(ub_enc->verification_key),
276 &query); 276 &query);
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c
index c1faf4f12..410f3c815 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -612,7 +612,7 @@ uri_loc_parse (const char *s, char **emsg)
612 ass.exptime = GNUNET_TIME_absolute_hton (et); 612 ass.exptime = GNUNET_TIME_absolute_hton (et);
613 if (GNUNET_OK != 613 if (GNUNET_OK !=
614 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT, 614 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT,
615 &ass.purpose, 615 &ass,
616 &sig, 616 &sig,
617 &ass.peer.public_key)) 617 &ass.peer.public_key))
618 { 618 {
@@ -900,10 +900,9 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *base_uri,
900 uri->data.loc.fi = base_uri->data.chk; 900 uri->data.loc.fi = base_uri->data.chk;
901 uri->data.loc.expirationTime = et; 901 uri->data.loc.expirationTime = et;
902 uri->data.loc.peer.public_key = my_public_key; 902 uri->data.loc.peer.public_key = my_public_key;
903 GNUNET_assert (GNUNET_OK == 903 GNUNET_CRYPTO_eddsa_sign (sign_key,
904 GNUNET_CRYPTO_eddsa_sign (sign_key, 904 &ass,
905 &ass.purpose, 905 &uri->data.loc.contentSignature);
906 &uri->data.loc.contentSignature));
907 return uri; 906 return uri;
908} 907}
909 908
diff --git a/src/fs/gnunet-auto-share.c b/src/fs/gnunet-auto-share.c
index 53c64ab04..13bc908e8 100644
--- a/src/fs/gnunet-auto-share.c
+++ b/src/fs/gnunet-auto-share.c
@@ -775,7 +775,7 @@ main (int argc, char *const *argv)
775 sigpipe = NULL; 775 sigpipe = NULL;
776 GNUNET_free_non_null (cfg_filename); 776 GNUNET_free_non_null (cfg_filename);
777 cfg_filename = NULL; 777 cfg_filename = NULL;
778 GNUNET_free ((void *) argv); 778 GNUNET_free_nz ((void *) argv);
779 return ok; 779 return ok;
780} 780}
781 781
diff --git a/src/fs/gnunet-directory.c b/src/fs/gnunet-directory.c
index 58950bceb..10a09f73b 100644
--- a/src/fs/gnunet-directory.c
+++ b/src/fs/gnunet-directory.c
@@ -203,7 +203,7 @@ main (int argc, char *const *argv)
203 NULL)) 203 NULL))
204 ? ret 204 ? ret
205 : 1; 205 : 1;
206 GNUNET_free ((void *) argv); 206 GNUNET_free_nz ((void *) argv);
207 return ret; 207 return ret;
208} 208}
209 209
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c
index 63bb02958..eebf8e993 100644
--- a/src/fs/gnunet-download.c
+++ b/src/fs/gnunet-download.c
@@ -376,7 +376,7 @@ main (int argc, char *const *argv)
376 NULL)) 376 NULL))
377 ? ret 377 ? ret
378 : 1; 378 : 1;
379 GNUNET_free ((void *) argv); 379 GNUNET_free_nz ((void *) argv);
380 return ret; 380 return ret;
381} 381}
382 382
diff --git a/src/fs/gnunet-fs-profiler.c b/src/fs/gnunet-fs-profiler.c
index fe86cf21f..62da46834 100644
--- a/src/fs/gnunet-fs-profiler.c
+++ b/src/fs/gnunet-fs-profiler.c
@@ -237,7 +237,7 @@ main (int argc, char *const *argv)
237 "run a testbed to measure file-sharing performance"), 237 "run a testbed to measure file-sharing performance"),
238 options, &run, 238 options, &run,
239 NULL)) ? ret : 1; 239 NULL)) ? ret : 1;
240 GNUNET_free ((void *) argv); 240 GNUNET_free_nz ((void *) argv);
241 return ret; 241 return ret;
242} 242}
243 243
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c
index 35d410d37..70a0034a0 100644
--- a/src/fs/gnunet-fs.c
+++ b/src/fs/gnunet-fs.c
@@ -144,7 +144,7 @@ main (int argc, char *const *argv)
144 NULL)) 144 NULL))
145 ? ret 145 ? ret
146 : 1; 146 : 1;
147 GNUNET_free ((void *) argv); 147 GNUNET_free_nz ((void *) argv);
148 return ret; 148 return ret;
149} 149}
150 150
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index ac310b785..b10e6163c 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -992,7 +992,7 @@ main (int argc, char *const *argv)
992 NULL)) 992 NULL))
993 ? ret 993 ? ret
994 : 1; 994 : 1;
995 GNUNET_free ((void *) argv); 995 GNUNET_free_nz ((void *) argv);
996 return ret; 996 return ret;
997} 997}
998 998
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c
index e0b9a31fd..098633379 100644
--- a/src/fs/gnunet-search.c
+++ b/src/fs/gnunet-search.c
@@ -371,7 +371,7 @@ main (int argc, char *const *argv)
371 NULL)) 371 NULL))
372 ? ret 372 ? ret
373 : 1; 373 : 1;
374 GNUNET_free ((void *) argv); 374 GNUNET_free_nz ((void *) argv);
375 return ret; 375 return ret;
376} 376}
377 377
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 29e6de9d5..cf9069918 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -315,7 +315,7 @@ static struct GNUNET_CONFIGURATION_Handle *block_cfg;
315/** 315/**
316 * Private key of this peer. Used to sign LOC URI requests. 316 * Private key of this peer. Used to sign LOC URI requests.
317 */ 317 */
318static struct GNUNET_CRYPTO_EddsaPrivateKey *pk; 318static struct GNUNET_CRYPTO_EddsaPrivateKey pk;
319 319
320/** 320/**
321 * ID of our task that we use to age the cover counters. 321 * ID of our task that we use to age the cover counters.
@@ -939,7 +939,7 @@ handle_client_loc_sign (void *cls,
939 base.data.chk.chk = msg->chk; 939 base.data.chk.chk = msg->chk;
940 base.data.chk.file_length = GNUNET_ntohll (msg->file_length); 940 base.data.chk.file_length = GNUNET_ntohll (msg->file_length);
941 loc = GNUNET_FS_uri_loc_create (&base, 941 loc = GNUNET_FS_uri_loc_create (&base,
942 pk, 942 &pk,
943 GNUNET_TIME_absolute_ntoh ( 943 GNUNET_TIME_absolute_ntoh (
944 msg->expiration_time)); 944 msg->expiration_time));
945 env = GNUNET_MQ_msg (resp, 945 env = GNUNET_MQ_msg (resp,
@@ -1283,10 +1283,19 @@ main_init (const struct GNUNET_CONFIGURATION_Handle *c)
1283 GNUNET_SCHEDULER_shutdown (); 1283 GNUNET_SCHEDULER_shutdown ();
1284 return GNUNET_SYSERR; 1284 return GNUNET_SYSERR;
1285 } 1285 }
1286 pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); 1286 if (GNUNET_SYSERR ==
1287 GNUNET_CRYPTO_eddsa_key_from_file (keyfile,
1288 GNUNET_YES,
1289 &pk))
1290 {
1291 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1292 "Failed to setup peer's private key\n");
1293 GNUNET_SCHEDULER_shutdown ();
1294 GNUNET_free (keyfile);
1295 return GNUNET_SYSERR;
1296 }
1287 GNUNET_free (keyfile); 1297 GNUNET_free (keyfile);
1288 GNUNET_assert (NULL != pk); 1298 GNUNET_CRYPTO_eddsa_key_get_public (&pk,
1289 GNUNET_CRYPTO_eddsa_key_get_public (pk,
1290 &GSF_my_id.public_key); 1299 &GSF_my_id.public_key);
1291 1300
1292 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1301 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c
index bf32de812..afc547127 100644
--- a/src/fs/gnunet-unindex.c
+++ b/src/fs/gnunet-unindex.c
@@ -197,7 +197,7 @@ main (int argc, char *const *argv)
197 NULL)) 197 NULL))
198 ? ret 198 ? ret
199 : 1; 199 : 1;
200 GNUNET_free ((void *) argv); 200 GNUNET_free_nz ((void *) argv);
201 return ret; 201 return ret;
202} 202}
203 203
diff --git a/src/fs/plugin_block_fs.c b/src/fs/plugin_block_fs.c
index 02855f418..6a9ab3f41 100644
--- a/src/fs/plugin_block_fs.c
+++ b/src/fs/plugin_block_fs.c
@@ -191,10 +191,10 @@ block_plugin_fs_evaluate (void *cls,
191 } 191 }
192 if ((0 == (eo & GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO)) && 192 if ((0 == (eo & GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO)) &&
193 (GNUNET_OK != 193 (GNUNET_OK !=
194 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK, 194 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK,
195 &ub->purpose, 195 &ub->purpose,
196 &ub->signature, 196 &ub->signature,
197 &ub->verification_key))) 197 &ub->verification_key)))
198 { 198 {
199 GNUNET_break_op (0); 199 GNUNET_break_op (0);
200 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 200 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c
index cdcb4d8fd..484884243 100644
--- a/src/fs/test_fs_namespace.c
+++ b/src/fs/test_fs_namespace.c
@@ -239,7 +239,7 @@ static void
239adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) 239adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
240{ 240{
241 struct GNUNET_CONTAINER_MetaData *meta; 241 struct GNUNET_CONTAINER_MetaData *meta;
242 struct GNUNET_CRYPTO_EcdsaPrivateKey *ns; 242 struct GNUNET_CRYPTO_EcdsaPrivateKey ns;
243 struct GNUNET_FS_BlockOptions bo; 243 struct GNUNET_FS_BlockOptions bo;
244 244
245 if (NULL != emsg) 245 if (NULL != emsg)
@@ -249,7 +249,7 @@ adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
249 GNUNET_FS_stop (fs); 249 GNUNET_FS_stop (fs);
250 return; 250 return;
251 } 251 }
252 ns = GNUNET_CRYPTO_ecdsa_key_create (); 252 GNUNET_CRYPTO_ecdsa_key_create (&ns);
253 meta = GNUNET_CONTAINER_meta_data_create (); 253 meta = GNUNET_CONTAINER_meta_data_create ();
254 sks_expect_uri = GNUNET_FS_uri_dup (uri); 254 sks_expect_uri = GNUNET_FS_uri_dup (uri);
255 bo.content_priority = 1; 255 bo.content_priority = 1;
@@ -257,24 +257,23 @@ adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
257 bo.replication_level = 0; 257 bo.replication_level = 0;
258 bo.expiration_time = 258 bo.expiration_time =
259 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES); 259 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
260 GNUNET_CRYPTO_ecdsa_key_get_public (ns, &nsid); 260 GNUNET_CRYPTO_ecdsa_key_get_public (&ns,
261 GNUNET_FS_publish_sks (fs, ns, "this", "next", meta, uri, 261 &nsid);
262 GNUNET_FS_publish_sks (fs,
263 &ns, "this", "next", meta, uri,
262 &bo, GNUNET_FS_PUBLISH_OPTION_NONE, &sks_cont, NULL); 264 &bo, GNUNET_FS_PUBLISH_OPTION_NONE, &sks_cont, NULL);
263 GNUNET_CONTAINER_meta_data_destroy (meta); 265 GNUNET_CONTAINER_meta_data_destroy (meta);
264 GNUNET_free (ns);
265} 266}
266 267
267 268
268static void 269static void
269testNamespace () 270testNamespace (void)
270{ 271{
271 struct GNUNET_CRYPTO_EcdsaPrivateKey *ns;
272 struct GNUNET_FS_BlockOptions bo; 272 struct GNUNET_FS_BlockOptions bo;
273 struct GNUNET_CONTAINER_MetaData *meta; 273 struct GNUNET_CONTAINER_MetaData *meta;
274 struct GNUNET_FS_Uri *ksk_uri; 274 struct GNUNET_FS_Uri *ksk_uri;
275 struct GNUNET_FS_Uri *sks_uri; 275 struct GNUNET_FS_Uri *sks_uri;
276 276
277 ns = GNUNET_CRYPTO_ecdsa_key_create ();
278 meta = GNUNET_CONTAINER_meta_data_create (); 277 meta = GNUNET_CONTAINER_meta_data_create ();
279 ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/testnsa", NULL); 278 ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/testnsa", NULL);
280 bo.content_priority = 1; 279 bo.content_priority = 1;
@@ -293,7 +292,6 @@ testNamespace ()
293 NULL); 292 NULL);
294 GNUNET_FS_uri_destroy (ksk_uri); 293 GNUNET_FS_uri_destroy (ksk_uri);
295 GNUNET_CONTAINER_meta_data_destroy (meta); 294 GNUNET_CONTAINER_meta_data_destroy (meta);
296 GNUNET_free (ns);
297} 295}
298 296
299 297
diff --git a/src/fs/test_fs_namespace_list_updateable.c b/src/fs/test_fs_namespace_list_updateable.c
index 4311f0110..2132220fb 100644
--- a/src/fs/test_fs_namespace_list_updateable.c
+++ b/src/fs/test_fs_namespace_list_updateable.c
@@ -33,7 +33,7 @@ static struct GNUNET_FS_Handle *fs;
33 33
34static int err; 34static int err;
35 35
36static struct GNUNET_CRYPTO_EcdsaPrivateKey *ns; 36static struct GNUNET_CRYPTO_EcdsaPrivateKey ns;
37 37
38static struct GNUNET_CONTAINER_MetaData *meta; 38static struct GNUNET_CONTAINER_MetaData *meta;
39 39
@@ -58,8 +58,6 @@ do_shutdown ()
58 GNUNET_FS_uri_destroy (uri_this); 58 GNUNET_FS_uri_destroy (uri_this);
59 if (uri_next != NULL) 59 if (uri_next != NULL)
60 GNUNET_FS_uri_destroy (uri_next); 60 GNUNET_FS_uri_destroy (uri_next);
61 if (ns != NULL)
62 GNUNET_free (ns);
63 if (meta != NULL) 61 if (meta != NULL)
64 GNUNET_CONTAINER_meta_data_destroy (meta); 62 GNUNET_CONTAINER_meta_data_destroy (meta);
65} 63}
@@ -87,7 +85,7 @@ check_this_next (void *cls, const char *last_id,
87 GNUNET_break (0 == strcmp (next_id, "next")); 85 GNUNET_break (0 == strcmp (next_id, "next"));
88 err -= 2; 86 err -= 2;
89 err += 4; 87 err += 4;
90 GNUNET_FS_namespace_list_updateable (fs, ns, next_id, &check_next, NULL); 88 GNUNET_FS_namespace_list_updateable (fs, &ns, next_id, &check_next, NULL);
91} 89}
92 90
93 91
@@ -96,7 +94,7 @@ sks_cont_next (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
96{ 94{
97 GNUNET_assert (NULL == emsg); 95 GNUNET_assert (NULL == emsg);
98 err += 2; 96 err += 2;
99 GNUNET_FS_namespace_list_updateable (fs, ns, NULL, &check_this_next, NULL); 97 GNUNET_FS_namespace_list_updateable (fs, &ns, NULL, &check_this_next, NULL);
100} 98}
101 99
102 100
@@ -117,17 +115,17 @@ sks_cont_this (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
117{ 115{
118 GNUNET_assert (NULL == emsg); 116 GNUNET_assert (NULL == emsg);
119 err = 1; 117 err = 1;
120 GNUNET_FS_namespace_list_updateable (fs, ns, NULL, &check_this, NULL); 118 GNUNET_FS_namespace_list_updateable (fs, &ns, NULL, &check_this, NULL);
121 GNUNET_FS_publish_sks (fs, ns, "next", "future", meta, uri_next, &bo, 119 GNUNET_FS_publish_sks (fs,
120 &ns, "next", "future", meta, uri_next, &bo,
122 GNUNET_FS_PUBLISH_OPTION_NONE, &sks_cont_next, NULL); 121 GNUNET_FS_PUBLISH_OPTION_NONE, &sks_cont_next, NULL);
123} 122}
124 123
125 124
126static void 125static void
127testNamespace () 126testNamespace (void)
128{ 127{
129 ns = GNUNET_CRYPTO_ecdsa_key_create (); 128 GNUNET_CRYPTO_ecdsa_key_create (&ns);
130 GNUNET_assert (NULL != ns);
131 bo.content_priority = 1; 129 bo.content_priority = 1;
132 bo.anonymity_level = 1; 130 bo.anonymity_level = 1;
133 bo.replication_level = 0; 131 bo.replication_level = 0;
@@ -145,7 +143,8 @@ testNamespace ()
145 ( 143 (
146 "gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.43", 144 "gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.43",
147 NULL); 145 NULL);
148 GNUNET_FS_publish_sks (fs, ns, "this", "next", meta, uri_this, &bo, 146 GNUNET_FS_publish_sks (fs,
147 &ns, "this", "next", meta, uri_this, &bo,
149 GNUNET_FS_PUBLISH_OPTION_NONE, &sks_cont_this, NULL); 148 GNUNET_FS_PUBLISH_OPTION_NONE, &sks_cont_this, NULL);
150} 149}
151 150
diff --git a/src/fs/test_fs_uri.c b/src/fs/test_fs_uri.c
index 2a324af9a..30eafab9a 100644
--- a/src/fs/test_fs_uri.c
+++ b/src/fs/test_fs_uri.c
@@ -81,7 +81,7 @@ testLocation ()
81 struct GNUNET_FS_Uri *uri2; 81 struct GNUNET_FS_Uri *uri2;
82 struct GNUNET_FS_Uri *baseURI; 82 struct GNUNET_FS_Uri *baseURI;
83 char *emsg; 83 char *emsg;
84 struct GNUNET_CRYPTO_EddsaPrivateKey *pk; 84 struct GNUNET_CRYPTO_EddsaPrivateKey pk;
85 85
86 baseURI = 86 baseURI =
87 GNUNET_FS_uri_parse 87 GNUNET_FS_uri_parse
@@ -90,11 +90,10 @@ testLocation ()
90 &emsg); 90 &emsg);
91 GNUNET_assert (baseURI != NULL); 91 GNUNET_assert (baseURI != NULL);
92 GNUNET_assert (emsg == NULL); 92 GNUNET_assert (emsg == NULL);
93 pk = GNUNET_CRYPTO_eddsa_key_create (); 93 GNUNET_CRYPTO_eddsa_key_create (&pk);
94 uri = GNUNET_FS_uri_loc_create (baseURI, 94 uri = GNUNET_FS_uri_loc_create (baseURI,
95 pk, 95 &pk,
96 GNUNET_TIME_absolute_get ()); 96 GNUNET_TIME_absolute_get ());
97 GNUNET_free (pk);
98 if (NULL == uri) 97 if (NULL == uri)
99 { 98 {
100 GNUNET_break (0); 99 GNUNET_break (0);
@@ -154,7 +153,7 @@ testNamespace (int i)
154 char *uri; 153 char *uri;
155 struct GNUNET_FS_Uri *ret; 154 struct GNUNET_FS_Uri *ret;
156 char *emsg; 155 char *emsg;
157 struct GNUNET_CRYPTO_EcdsaPrivateKey *ph; 156 struct GNUNET_CRYPTO_EcdsaPrivateKey ph;
158 struct GNUNET_CRYPTO_EcdsaPublicKey id; 157 struct GNUNET_CRYPTO_EcdsaPublicKey id;
159 char buf[1024]; 158 char buf[1024];
160 char ubuf[1024]; 159 char ubuf[1024];
@@ -187,8 +186,9 @@ testNamespace (int i)
187 GNUNET_assert (0); 186 GNUNET_assert (0);
188 } 187 }
189 GNUNET_free (emsg); 188 GNUNET_free (emsg);
190 ph = GNUNET_CRYPTO_ecdsa_key_create (); 189 GNUNET_CRYPTO_ecdsa_key_create (&ph);
191 GNUNET_CRYPTO_ecdsa_key_get_public (ph, &id); 190 GNUNET_CRYPTO_ecdsa_key_get_public (&ph,
191 &id);
192 sret = GNUNET_STRINGS_data_to_string (&id, sizeof(id), 192 sret = GNUNET_STRINGS_data_to_string (&id, sizeof(id),
193 ubuf, sizeof(ubuf) - 1); 193 ubuf, sizeof(ubuf) - 1);
194 GNUNET_assert (NULL != sret); 194 GNUNET_assert (NULL != sret);
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index abd5d5b48..7a5f7cfd8 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -88,11 +88,9 @@ bin_PROGRAMS += gnunet-bcd
88endif 88endif
89endif 89endif
90 90
91if HAVE_MHD 91if HAVE_REST
92if HAVE_JSON
93REST_PLUGIN = libgnunet_plugin_rest_gns.la 92REST_PLUGIN = libgnunet_plugin_rest_gns.la
94endif 93endif
95endif
96 94
97plugin_LTLIBRARIES = \ 95plugin_LTLIBRARIES = \
98 libgnunet_plugin_block_gns.la \ 96 libgnunet_plugin_block_gns.la \
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c
index d6de86fa0..f71f477ef 100644
--- a/src/gns/gnunet-bcd.c
+++ b/src/gns/gnunet-bcd.c
@@ -27,6 +27,7 @@
27#include "platform.h" 27#include "platform.h"
28#include <microhttpd.h> 28#include <microhttpd.h>
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_mhd_compat.h"
30 31
31/** 32/**
32 * Error page to display if submitted GNS key is invalid. 33 * Error page to display if submitted GNS key is invalid.
@@ -91,7 +92,7 @@ struct Entry
91/** 92/**
92 * Main request handler. 93 * Main request handler.
93 */ 94 */
94static int 95static MHD_RESULT
95access_handler_callback (void *cls, 96access_handler_callback (void *cls,
96 struct MHD_Connection *connection, 97 struct MHD_Connection *connection,
97 const char *url, 98 const char *url,
@@ -153,7 +154,7 @@ access_handler_callback (void *cls,
153 struct stat st; 154 struct stat st;
154 struct MHD_Response *response; 155 struct MHD_Response *response;
155 int fd; 156 int fd;
156 int ret; 157 MHD_RESULT ret;
157 158
158 const char *gpg_fp = MHD_lookup_connection_value (connection, 159 const char *gpg_fp = MHD_lookup_connection_value (connection,
159 MHD_GET_ARGUMENT_KIND, 160 MHD_GET_ARGUMENT_KIND,
@@ -524,7 +525,7 @@ main (int argc, char *const *argv)
524 NULL)) 525 NULL))
525 ? 0 526 ? 0
526 : 1; 527 : 1;
527 GNUNET_free ((void *) argv); 528 GNUNET_free_nz ((void *) argv);
528 return ret; 529 return ret;
529} 530}
530 531
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index 8ec1f1cdb..1e88ef056 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -465,7 +465,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
465 request->lookup = GNUNET_GNS_lookup_with_tld (gns, 465 request->lookup = GNUNET_GNS_lookup_with_tld (gns,
466 packet->queries[0].name, 466 packet->queries[0].name,
467 packet->queries[0].type, 467 packet->queries[0].type,
468 GNUNET_NO, 468 GNUNET_GNS_LO_DEFAULT,
469 &result_processor, 469 &result_processor,
470 request); 470 request);
471} 471}
@@ -775,7 +775,7 @@ main (int argc,
775 _ ("GNUnet DNS-to-GNS proxy (a DNS server)"), 775 _ ("GNUnet DNS-to-GNS proxy (a DNS server)"),
776 options, 776 options,
777 &run, NULL)) ? 0 : 1; 777 &run, NULL)) ? 0 : 1;
778 GNUNET_free ((void *) argv); 778 GNUNET_free_nz ((void *) argv);
779 return ret; 779 return ret;
780} 780}
781 781
diff --git a/src/gns/gnunet-gns-benchmark.c b/src/gns/gnunet-gns-benchmark.c
index 0dcff7566..b36a83f21 100644
--- a/src/gns/gnunet-gns-benchmark.c
+++ b/src/gns/gnunet-gns-benchmark.c
@@ -610,7 +610,7 @@ main (int argc,
610 &run, 610 &run,
611 NULL)) 611 NULL))
612 ret = 1; 612 ret = 1;
613 GNUNET_free ((void *) argv); 613 GNUNET_free_nz ((void *) argv);
614 return ret; 614 return ret;
615} 615}
616 616
diff --git a/src/gns/gnunet-gns-import.c b/src/gns/gnunet-gns-import.c
index 0c104ee0d..2c7c56411 100644
--- a/src/gns/gnunet-gns-import.c
+++ b/src/gns/gnunet-gns-import.c
@@ -486,7 +486,7 @@ main (int argc, char *const *argv)
486 "This program will import some GNS authorities into your GNS namestore."), 486 "This program will import some GNS authorities into your GNS namestore."),
487 options, 487 options,
488 &run, NULL); 488 &run, NULL);
489 GNUNET_free ((void *) argv); 489 GNUNET_free_nz ((void *) argv);
490 return GNUNET_OK == r ? ret : 1; 490 return GNUNET_OK == r ? ret : 1;
491} 491}
492 492
diff --git a/src/gns/gnunet-gns-proxy-setup-ca.in b/src/gns/gnunet-gns-proxy-setup-ca.in
index 602aadb2a..412e53f8d 100644
--- a/src/gns/gnunet-gns-proxy-setup-ca.in
+++ b/src/gns/gnunet-gns-proxy-setup-ca.in
@@ -224,6 +224,16 @@ importbrowsers()
224 certutil -A -n "GNS Proxy CA" -t CT,, -d "$f" < $GNSCERT 224 certutil -A -n "GNS Proxy CA" -t CT,, -d "$f" < $GNSCERT
225 fi 225 fi
226 done 226 done
227 for f in ~/.mozilla/icecat/*.*/
228 do
229 if [ -d $f ]; then
230 infomsg "Importing CA into Icecat at $f"
231 # delete old certificate (if any)
232 certutil -D -n "GNS Proxy CA" -d "$f" >/dev/null 2>/dev/null
233 # add new certificate
234 certutil -A -n "GNS Proxy CA" -t CT,, -d "$f" < $GNSCERT
235 fi
236 done
227 # TODO: Error handling? 237 # TODO: Error handling?
228 if [ -d ~/.pki/nssdb/ ]; then 238 if [ -d ~/.pki/nssdb/ ]; then
229 statusmsg "Importing CA into Chrome at ~/.pki/nssdb/" 239 statusmsg "Importing CA into Chrome at ~/.pki/nssdb/"
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index 5b8348d43..eb6c6852e 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -43,7 +43,7 @@
43#include "gnunet_gns_service.h" 43#include "gnunet_gns_service.h"
44#include "gnunet_identity_service.h" 44#include "gnunet_identity_service.h"
45#include "gns.h" 45#include "gns.h"
46 46#include "gnunet_mhd_compat.h"
47 47
48/** 48/**
49 * Default Socks5 listen port. 49 * Default Socks5 listen port.
@@ -1827,7 +1827,7 @@ con_val_iter (void *cls,
1827 * #MHD_NO if the socket must be closed due to a serious 1827 * #MHD_NO if the socket must be closed due to a serious
1828 * error while handling the request 1828 * error while handling the request
1829 */ 1829 */
1830static int 1830static MHD_RESULT
1831create_response (void *cls, 1831create_response (void *cls,
1832 struct MHD_Connection *con, 1832 struct MHD_Connection *con,
1833 const char *url, 1833 const char *url,
@@ -3012,6 +3012,9 @@ signal_socks_failure (struct Socks5Request *s5r,
3012{ 3012{
3013 struct Socks5ServerResponseMessage *s_resp; 3013 struct Socks5ServerResponseMessage *s_resp;
3014 3014
3015 GNUNET_break (0 == s5r->wbuf_len); /* Should happen first in any transmission, right? */
3016 GNUNET_assert (SOCKS_BUFFERSIZE - s5r->wbuf_len >=
3017 sizeof(struct Socks5ServerResponseMessage));
3015 s_resp = (struct Socks5ServerResponseMessage *) &s5r->wbuf[s5r->wbuf_len]; 3018 s_resp = (struct Socks5ServerResponseMessage *) &s5r->wbuf[s5r->wbuf_len];
3016 memset (s_resp, 0, sizeof(struct Socks5ServerResponseMessage)); 3019 memset (s_resp, 0, sizeof(struct Socks5ServerResponseMessage));
3017 s_resp->version = SOCKS_VERSION_5; 3020 s_resp->version = SOCKS_VERSION_5;
@@ -3375,7 +3378,7 @@ do_s5r_read (void *cls)
3375 s5r->gns_lookup = GNUNET_GNS_lookup_with_tld (gns_handle, 3378 s5r->gns_lookup = GNUNET_GNS_lookup_with_tld (gns_handle,
3376 s5r->domain, 3379 s5r->domain,
3377 GNUNET_DNSPARSER_TYPE_A, 3380 GNUNET_DNSPARSER_TYPE_A,
3378 GNUNET_NO /* only cached */, 3381 GNUNET_GNS_LO_LOCAL_MASTER /* only cached */,
3379 &handle_gns_result, 3382 &handle_gns_result,
3380 s5r); 3383 s5r);
3381 break; 3384 break;
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c
index 37633daf1..5cf496808 100644
--- a/src/gns/gnunet-gns.c
+++ b/src/gns/gnunet-gns.c
@@ -205,7 +205,11 @@ process_lookup_result (void *cls,
205 if (raw) 205 if (raw)
206 printf ("%s\n", string_val); 206 printf ("%s\n", string_val);
207 else 207 else
208 printf ("Got `%s' record: %s\n", typename, string_val); 208 printf ("Got `%s' record: %s%s\n",
209 typename,
210 string_val,
211 (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL)) ?
212 " (supplemental)" : "");
209 GNUNET_free (string_val); 213 GNUNET_free (string_val);
210 } 214 }
211 GNUNET_SCHEDULER_shutdown (); 215 GNUNET_SCHEDULER_shutdown ();
@@ -275,7 +279,7 @@ run (void *cls,
275 { 279 {
276 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 280 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
277 _ ("Cannot resolve using GNS: GNUnet peer not running\n")); 281 _ ("Cannot resolve using GNS: GNUnet peer not running\n"));
278 global_ret = 2; 282 global_ret = 5;
279 return; 283 return;
280 } 284 }
281 to_task = GNUNET_SCHEDULER_add_delayed (timeout, 285 to_task = GNUNET_SCHEDULER_add_delayed (timeout,
@@ -372,7 +376,7 @@ main (int argc, char *const *argv)
372 options, 376 options,
373 &run, 377 &run,
374 NULL); 378 NULL);
375 GNUNET_free ((void *) argv); 379 GNUNET_free_nz ((void *) argv);
376 if (GNUNET_OK != ret) 380 if (GNUNET_OK != ret)
377 return 1; 381 return 1;
378 return global_ret; 382 return global_ret;
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c
index 9d6636e84..19416a506 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -352,7 +352,7 @@ handle_dns_request (void *cls,
352 ilh->lookup = GNS_resolver_lookup (&zone, 352 ilh->lookup = GNS_resolver_lookup (&zone,
353 p->queries[0].type, 353 p->queries[0].type,
354 p->queries[0].name, 354 p->queries[0].name,
355 GNUNET_NO, 355 GNUNET_GNS_LO_DEFAULT,
356 MAX_RECURSION, 356 MAX_RECURSION,
357 &reply_to_dns, ilh); 357 &reply_to_dns, ilh);
358 return; 358 return;
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 735742283..7d398c168 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -764,6 +764,12 @@ transmit_lookup_dns_result (struct GNS_ResolverHandle *rh)
764 rd[i].data = pos->data; 764 rd[i].data = pos->data;
765 rd[i].data_size = pos->data_size; 765 rd[i].data_size = pos->data_size;
766 rd[i].record_type = pos->record_type; 766 rd[i].record_type = pos->record_type;
767 /**
768 * If this is a LEHO, we added this before. It must be a supplemental
769 * record #LSD0001
770 */
771 if (GNUNET_GNSRECORD_TYPE_LEHO == rd[i].record_type)
772 rd[i].flags |= GNUNET_GNSRECORD_RF_SUPPLEMENTAL;
767 if (0 == pos->expiration_time) 773 if (0 == pos->expiration_time)
768 { 774 {
769 rd[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 775 rd[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
@@ -1130,6 +1136,7 @@ dns_result_parser (void *cls,
1130 { 1136 {
1131 rd[rd_count - skip].record_type = GNUNET_GNSRECORD_TYPE_LEHO; 1137 rd[rd_count - skip].record_type = GNUNET_GNSRECORD_TYPE_LEHO;
1132 rd[rd_count - skip].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 1138 rd[rd_count - skip].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1139 rd[rd_count - skip].flags |= GNUNET_GNSRECORD_RF_SUPPLEMENTAL;
1133 rd[rd_count - skip].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; 1140 rd[rd_count - skip].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us;
1134 rd[rd_count - skip].data = rh->leho; 1141 rd[rd_count - skip].data = rh->leho;
1135 rd[rd_count - skip].data_size = strlen (rh->leho); 1142 rd[rd_count - skip].data_size = strlen (rh->leho);
@@ -1350,6 +1357,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1350 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1351 "Doing standard DNS lookup for `%s'\n", 1358 "Doing standard DNS lookup for `%s'\n",
1352 rh->name); 1359 rh->name);
1360
1353 rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name, 1361 rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name,
1354 af, 1362 af,
1355 DNS_LOOKUP_TIMEOUT, 1363 DNS_LOOKUP_TIMEOUT,
@@ -1751,7 +1759,12 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
1751 struct sockaddr_in6 v6; 1759 struct sockaddr_in6 v6;
1752 1760
1753 if (GNUNET_GNSRECORD_TYPE_GNS2DNS != rd[i].record_type) 1761 if (GNUNET_GNSRECORD_TYPE_GNS2DNS != rd[i].record_type)
1754 continue; 1762 {
1763 /**
1764 * Records other than GNS2DNS not allowed
1765 */
1766 return GNUNET_SYSERR;
1767 }
1755 off = 0; 1768 off = 0;
1756 n = GNUNET_DNSPARSER_parse_name (rd[i].data, 1769 n = GNUNET_DNSPARSER_parse_name (rd[i].data,
1757 rd[i].data_size, 1770 rd[i].data_size,
@@ -2243,10 +2256,6 @@ handle_gns_resolution_result (void *cls,
2243 } 2256 }
2244 break; 2257 break;
2245 2258
2246 case GNUNET_GNSRECORD_TYPE_NICK:
2247 /* ignore */
2248 break;
2249
2250 case GNUNET_GNSRECORD_TYPE_PKEY: 2259 case GNUNET_GNSRECORD_TYPE_PKEY:
2251 { 2260 {
2252 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 2261 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c
index 77ad3a358..11e46ad7f 100644
--- a/src/gns/nss/nss_gns_query.c
+++ b/src/gns/nss/nss_gns_query.c
@@ -60,11 +60,14 @@ gns_resolve_name (int af, const char *name, struct userdata *u)
60 FILE *p; 60 FILE *p;
61 char line[128]; 61 char line[128];
62 int ret; 62 int ret;
63 int retry = 0;
63 int out[2]; 64 int out[2];
64 pid_t pid; 65 pid_t pid;
65 66
66 if (0 == getuid ()) 67 if (0 == getuid ())
67 return -2; /* GNS via NSS is NEVER for root */ 68 return -2; /* GNS via NSS is NEVER for root */
69
70query_gns:
68 if (0 != pipe (out)) 71 if (0 != pipe (out))
69 return -1; 72 return -1;
70 pid = fork (); 73 pid = fork ();
@@ -142,8 +145,16 @@ gns_resolve_name (int af, const char *name, struct userdata *u)
142 return -1; 145 return -1;
143 if (4 == WEXITSTATUS (ret)) 146 if (4 == WEXITSTATUS (ret))
144 return -2; /* not for GNS */ 147 return -2; /* not for GNS */
145 if (3 == ret) 148 if (5 == WEXITSTATUS (ret))
146 return -3; /* timeout -> not found */ 149 {
150 if (1 == retry)
151 return -2; /* no go -> service unavailable */
152 retry = 1;
153 system("gnunet-arm -s");
154 goto query_gns; /* Try again */
155 }
156 if (3 == WEXITSTATUS (ret))
157 return -2; /* timeout -> service unavailable */
147 if ((2 == WEXITSTATUS (ret)) || (1 == WEXITSTATUS (ret))) 158 if ((2 == WEXITSTATUS (ret)) || (1 == WEXITSTATUS (ret)))
148 return -2; /* launch failure -> service unavailable */ 159 return -2; /* launch failure -> service unavailable */
149 return 0; 160 return 0;
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index 6ae753a07..feb333350 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -200,6 +200,7 @@ do_error (void *cls)
200 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; 200 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
201 response = json_dumps (json_error, 0); 201 response = json_dumps (json_error, 0);
202 resp = GNUNET_REST_create_response (response); 202 resp = GNUNET_REST_create_response (response);
203 MHD_add_response_header (resp, "Content-Type", "application/json");
203 handle->proc (handle->proc_cls, resp, handle->response_code); 204 handle->proc (handle->proc_cls, resp, handle->response_code);
204 json_decref (json_error); 205 json_decref (json_error);
205 GNUNET_free (response); 206 GNUNET_free (response);
@@ -252,6 +253,7 @@ handle_gns_response (void *cls,
252 result = json_dumps (result_obj, 0); 253 result = json_dumps (result_obj, 0);
253 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); 254 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result);
254 resp = GNUNET_REST_create_response (result); 255 resp = GNUNET_REST_create_response (result);
256 MHD_add_response_header (resp, "Content-Type", "application/json");
255 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 257 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
256 GNUNET_free (result); 258 GNUNET_free (result);
257 json_decref (result_obj); 259 json_decref (result_obj);
@@ -319,7 +321,7 @@ get_gns_cont (struct GNUNET_REST_RequestHandle *con_handle,
319 handle->gns_lookup = GNUNET_GNS_lookup_with_tld (handle->gns, 321 handle->gns_lookup = GNUNET_GNS_lookup_with_tld (handle->gns,
320 handle->name, 322 handle->name,
321 handle->record_type, 323 handle->record_type,
322 GNUNET_NO, 324 GNUNET_GNS_LO_DEFAULT,
323 &handle_gns_response, 325 &handle_gns_response,
324 handle); 326 handle);
325} 327}
diff --git a/src/gns/test_gns_lookup_peer1.conf b/src/gns/test_gns_lookup_peer1.conf
index 3b034f8d5..1cf0ba628 100644
--- a/src/gns/test_gns_lookup_peer1.conf
+++ b/src/gns/test_gns_lookup_peer1.conf
@@ -5,6 +5,8 @@ DISABLE = YES
5 5
6[PATHS] 6[PATHS]
7GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-gns-peer-1/ 7GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-gns-peer-1/
8GNUNET_RUNTIME_DIR = $GNUNET_TMP/test-gnunet-gns-peer-1-system-runtime/
9GNUNET_USER_RUNTIME_DIR = $GNUNET_TMP/test-gnunet-gns-peer-1-user-runtime/
8 10
9[dht] 11[dht]
10START_ON_DEMAND = YES 12START_ON_DEMAND = YES
@@ -42,12 +44,17 @@ WAN_QUOTA_IN = 1 GB
42WAN_QUOTA_OUT = 1 GB 44WAN_QUOTA_OUT = 1 GB
43 45
44[transport] 46[transport]
45plugins = tcp 47plugins = unix
46NEIGHBOUR_LIMIT = 50 48NEIGHBOUR_LIMIT = 50
47PORT = 2091 49PORT = 2091
48 50
49[transport-tcp] 51[transport-unix]
50TIMEOUT = 300 s 52UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-transport-plugin-unix1.sock
53
54[hostlist]
55SERVERS = http://localhost:9999/
56OPTIONS = -b
57IMMEDIATE_START = YES
51 58
52[nat] 59[nat]
53DISABLEV6 = YES 60DISABLEV6 = YES
diff --git a/src/gns/test_gns_lookup_peer2.conf b/src/gns/test_gns_lookup_peer2.conf
index d64fdcda3..2e861ff0a 100644
--- a/src/gns/test_gns_lookup_peer2.conf
+++ b/src/gns/test_gns_lookup_peer2.conf
@@ -5,6 +5,8 @@ DISABLE = YES
5 5
6[PATHS] 6[PATHS]
7GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-gns-peer-2/ 7GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-gns-peer-2/
8GNUNET_RUNTIME_DIR = $GNUNET_TMP/test-gnunet-gns-peer-2-runtime/
9GNUNET_USER_RUNTIME_DIR = $GNUNET_TMP/test-gnunet-gns-peer-2-user-runtime/
8 10
9[dht] 11[dht]
10START_ON_DEMAND = YES 12START_ON_DEMAND = YES
@@ -42,17 +44,23 @@ AUTOCONNECT = YES
42FRIENDS-ONLY = NO 44FRIENDS-ONLY = NO
43MINIMUM-FRIENDS = 0 45MINIMUM-FRIENDS = 0
44 46
47[hostlist]
48SERVERS =
49HTTPPORT = 9999
50OPTIONS = -p
51IMMEDIATE_START = YES
52
53
45[ats] 54[ats]
46WAN_QUOTA_IN = 1 GB 55WAN_QUOTA_IN = 1 GB
47WAN_QUOTA_OUT = 1 GB 56WAN_QUOTA_OUT = 1 GB
48 57
49[transport] 58[transport]
50plugins = tcp 59plugins = unix
51NEIGHBOUR_LIMIT = 50 60NEIGHBOUR_LIMIT = 50
52PORT = 2092
53 61
54[transport-tcp] 62[transport-unix]
55TIMEOUT = 300 s 63UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-transport-plugin-unix2.sock
56 64
57[nat] 65[nat]
58DISABLEV6 = YES 66DISABLEV6 = YES
diff --git a/src/gns/test_gns_multiple_record_lookup.sh b/src/gns/test_gns_multiple_record_lookup.sh
index fbd9a6b13..2d00945d6 100755
--- a/src/gns/test_gns_multiple_record_lookup.sh
+++ b/src/gns/test_gns_multiple_record_lookup.sh
@@ -4,6 +4,10 @@ trap "gnunet-arm -e -c test_gns_lookup_peer1.conf" INT
4trap "gnunet-arm -e -c test_gns_lookup_peer2.conf" INT 4trap "gnunet-arm -e -c test_gns_lookup_peer2.conf" INT
5which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5" 5which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
6 6
7unset XDG_DATA_HOME
8unset XDG_CONFIG_HOME
9unset XDG_CACHE_HOME
10
7LOCATION=$(which gnunet-config) 11LOCATION=$(which gnunet-config)
8if [ -z $LOCATION ] 12if [ -z $LOCATION ]
9then 13then
@@ -27,18 +31,40 @@ LABEL="fnord"
27 31
28gnunet-arm -s -c test_gns_lookup_peer2.conf 32gnunet-arm -s -c test_gns_lookup_peer2.conf
29PKEY=`$DO_TIMEOUT gnunet-identity -V -C $OTHER_EGO -c test_gns_lookup_peer2.conf` 33PKEY=`$DO_TIMEOUT gnunet-identity -V -C $OTHER_EGO -c test_gns_lookup_peer2.conf`
34
35# Note: if zonemaster is kept running, it MAY publish the "A" record in the
36# DHT immediately and then _LATER_ also the "AAAA" record. But as then there
37# will be TWO valid blocks in the DHT (one with only A and one with A and
38# AAAA), the subsequent GET for both may fail and only return the result with
39# just the "A" record).
40# If we _waited_ until the original block with just "A" expired, everything
41# would be fine, but we don't want to do that for the test, so we
42# simply pause publishing to the DHT until all records are defined.
43# In the future, it would be good to have an enhanced gnunet-namestore command
44# that would read a series of changes to be made to a record set from
45# stdin and do them _all_ *atomically*. Then we would not need to do this.
46
47gnunet-arm -c test_gns_lookup_peer2.conf -k zonemaster
48gnunet-arm -c test_gns_lookup_peer2.conf -k zonemaster-monitor
49
30gnunet-namestore -p -z $OTHER_EGO -a -n $LABEL -t A -V $TEST_IP -e 3600s -c test_gns_lookup_peer2.conf 50gnunet-namestore -p -z $OTHER_EGO -a -n $LABEL -t A -V $TEST_IP -e 3600s -c test_gns_lookup_peer2.conf
31gnunet-namestore -p -z $OTHER_EGO -a -n $LABEL -t AAAA -V $TEST_IPV6 -e 3600s -c test_gns_lookup_peer2.conf 51gnunet-namestore -p -z $OTHER_EGO -a -n $LABEL -t AAAA -V $TEST_IPV6 -e 3600s -c test_gns_lookup_peer2.conf
32gnunet-namestore -D -z $OTHER_EGO -n $LABEL 52gnunet-namestore -D -z $OTHER_EGO -n $LABEL
33gnunet-arm -e -c test_gns_lookup_peer2.conf
34 53
35echo "Second peer" 54gnunet-arm -c test_gns_lookup_peer2.conf -i zonemaster
55gnunet-arm -c test_gns_lookup_peer2.conf -i zonemaster-monitor
56
57
36gnunet-arm -s -c test_gns_lookup_peer1.conf 58gnunet-arm -s -c test_gns_lookup_peer1.conf
37echo "Second peer started" 59
60
38RESP=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$PKEY -t ANY -c test_gns_lookup_peer1.conf` 61RESP=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$PKEY -t ANY -c test_gns_lookup_peer1.conf`
39RESP1=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$PKEY -t A -c test_gns_lookup_peer1.conf` 62RESP1=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$PKEY -t A -c test_gns_lookup_peer1.conf`
40RESP2=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$PKEY -t AAAA -c test_gns_lookup_peer1.conf` 63RESP2=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$PKEY -t AAAA -c test_gns_lookup_peer1.conf`
64
65
41gnunet-arm -e -c test_gns_lookup_peer1.conf 66gnunet-arm -e -c test_gns_lookup_peer1.conf
67gnunet-arm -e -c test_gns_lookup_peer2.conf
42 68
43rm -rf `gnunet-config -c test_gns_lookup_peer1.conf -f -s paths -o GNUNET_TEST_HOME` 69rm -rf `gnunet-config -c test_gns_lookup_peer1.conf -f -s paths -o GNUNET_TEST_HOME`
44rm -rf `gnunet-config -c test_gns_lookup_peer2.conf -f -s paths -o GNUNET_TEST_HOME` 70rm -rf `gnunet-config -c test_gns_lookup_peer2.conf -f -s paths -o GNUNET_TEST_HOME`
diff --git a/src/gnsrecord/Makefile.am b/src/gnsrecord/Makefile.am
index 3da9af9ca..2e6eca7ba 100644
--- a/src/gnsrecord/Makefile.am
+++ b/src/gnsrecord/Makefile.am
@@ -12,6 +12,10 @@ if USE_COVERAGE
12 XLIBS = -lgcov 12 XLIBS = -lgcov
13endif 13endif
14 14
15bin_PROGRAMS = \
16 gnunet-gnsrecord-tvg
17
18
15check_PROGRAMS = \ 19check_PROGRAMS = \
16 test_gnsrecord_crypto \ 20 test_gnsrecord_crypto \
17 test_gnsrecord_serialization \ 21 test_gnsrecord_serialization \
@@ -28,6 +32,14 @@ endif
28lib_LTLIBRARIES = \ 32lib_LTLIBRARIES = \
29 libgnunetgnsrecord.la 33 libgnunetgnsrecord.la
30 34
35gnunet_gnsrecord_tvg_SOURCES = \
36 gnunet-gnsrecord-tvg.c
37gnunet_gnsrecord_tvg_LDADD = \
38 $(top_builddir)/src/util/libgnunetutil.la \
39 libgnunetgnsrecord.la \
40 $(GN_LIBINTL)
41
42
31libgnunetgnsrecord_la_SOURCES = \ 43libgnunetgnsrecord_la_SOURCES = \
32 gnsrecord.c \ 44 gnsrecord.c \
33 gnsrecord_serialization.c \ 45 gnsrecord_serialization.c \
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
index ea8baa77d..c8919760a 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/gnsrecord/gnsrecord_crypto.c
@@ -166,9 +166,9 @@ block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
166 &block[1])); 166 &block[1]));
167 } 167 }
168 if (GNUNET_OK != 168 if (GNUNET_OK !=
169 GNUNET_CRYPTO_ecdsa_sign (dkey, 169 GNUNET_CRYPTO_ecdsa_sign_ (dkey,
170 &block->purpose, 170 &block->purpose,
171 &block->signature)) 171 &block->signature))
172 { 172 {
173 GNUNET_break (0); 173 GNUNET_break (0);
174 GNUNET_free (dkey); 174 GNUNET_free (dkey);
@@ -280,10 +280,10 @@ GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
280int 280int
281GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block) 281GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block)
282{ 282{
283 return GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, 283 return GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN,
284 &block->purpose, 284 &block->purpose,
285 &block->signature, 285 &block->signature,
286 &block->derived_key); 286 &block->derived_key);
287} 287}
288 288
289 289
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c
new file mode 100644
index 000000000..cf815d629
--- /dev/null
+++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c
@@ -0,0 +1,202 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020 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 * @file util/gnunet-gns-tvg.c
23 * @brief Generate test vectors for GNS.
24 * @author Martin Schanzenbach
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_signatures.h"
29#include "gnunet_gns_service.h"
30#include "gnunet_gnsrecord_lib.h"
31#include "gnunet_dnsparser_lib.h"
32#include "gnunet_testing_lib.h"
33#include <inttypes.h>
34
35#define TEST_RECORD_LABEL "test"
36#define TEST_RECORD_A "1.2.3.4"
37#define TEST_RRCOUNT 2
38
39static void
40print_record(const struct GNUNET_GNSRECORD_Data *rd)
41{
42 char *data_enc;
43 char *string_v;
44 string_v = GNUNET_GNSRECORD_value_to_string (rd->record_type,
45 rd->data,
46 rd->data_size);
47 fprintf (stdout,
48 "EXPIRATION: %"PRIu64"\n", rd->expiration_time);
49 fprintf (stdout,
50 "DATA_SIZE: %"PRIu64"\n", rd->data_size);
51 fprintf (stdout,
52 "TYPE: %d\n", rd->record_type);
53 fprintf (stdout,
54 "FLAGS: %d\n", rd->flags);
55 GNUNET_STRINGS_base64_encode (rd->data,
56 rd->data_size,
57 &data_enc);
58 fprintf (stdout,
59 "DATA (base64):\n%s\n",
60 data_enc);
61 fprintf (stdout,
62 "DATA (Human readable):\n%s\n\n", string_v);
63 GNUNET_free (string_v);
64
65 GNUNET_free (data_enc);
66}
67
68/**
69 * Main function that will be run.
70 *
71 * @param cls closure
72 * @param args remaining command-line arguments
73 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
74 * @param cfg configuration
75 */
76static void
77run (void *cls,
78 char *const *args,
79 const char *cfgfile,
80 const struct GNUNET_CONFIGURATION_Handle *cfg)
81{
82 struct GNUNET_GNSRECORD_Data rd[2];
83 struct GNUNET_TIME_Absolute exp_abs = GNUNET_TIME_absolute_get();
84 struct GNUNET_GNSRECORD_Block *rrblock;
85 char *bdata;
86 struct GNUNET_CRYPTO_EcdsaPrivateKey id_priv;
87 struct GNUNET_CRYPTO_EcdsaPublicKey id_pub;
88 struct GNUNET_CRYPTO_EcdsaPrivateKey pkey_data_p;
89 struct GNUNET_CRYPTO_EcdsaPublicKey pkey_data;
90 void *data;
91 size_t data_size;
92 char *rdata;
93 size_t rdata_size;
94 char* data_enc;
95
96 GNUNET_CRYPTO_ecdsa_key_create (&id_priv);
97 GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv,
98 &id_pub);
99 GNUNET_STRINGS_base64_encode (&id_priv,
100 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey),
101 &data_enc);
102 fprintf(stdout, "Zone private key (d):\n%s\n", data_enc);
103 GNUNET_free (data_enc);
104 GNUNET_STRINGS_base64_encode (&id_pub,
105 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey),
106 &data_enc);
107 fprintf(stdout, "Zone public key (zk):\n%s\n", data_enc);
108 GNUNET_free (data_enc);
109
110
111 GNUNET_CRYPTO_ecdsa_key_create (&pkey_data_p);
112 GNUNET_CRYPTO_ecdsa_key_get_public (&pkey_data_p,
113 &pkey_data);
114 fprintf (stdout,
115 "Label: %s\nRRCOUNT: %d\n\n", TEST_RECORD_LABEL, TEST_RRCOUNT);
116 memset (rd, 0, sizeof (struct GNUNET_GNSRECORD_Data) * 2);
117 GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_string_to_value (GNUNET_DNSPARSER_TYPE_A, TEST_RECORD_A, &data, &data_size));
118 rd[0].data = data;
119 rd[0].data_size = data_size;
120 rd[0].expiration_time = exp_abs.abs_value_us;
121 rd[0].record_type = GNUNET_DNSPARSER_TYPE_A;
122 fprintf (stdout, "Record #0\n");
123 print_record (&rd[0]);
124
125 rd[1].data = &pkey_data;
126 rd[1].data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
127 rd[1].expiration_time = exp_abs.abs_value_us;
128 rd[1].record_type = GNUNET_GNSRECORD_TYPE_PKEY;
129 rd[1].flags = GNUNET_GNSRECORD_RF_PRIVATE;
130 fprintf (stdout, "Record #1\n");
131 print_record (&rd[1]);
132
133 rdata_size = GNUNET_GNSRECORD_records_get_size (2,
134 rd);
135 rdata = GNUNET_malloc (rdata_size);
136 GNUNET_GNSRECORD_records_serialize (2,
137 rd,
138 rdata_size,
139 rdata);
140 GNUNET_STRINGS_base64_encode (rdata,
141 rdata_size,
142 &data_enc);
143 fprintf(stdout, "RDATA:\n%s\n\n", data_enc);
144 GNUNET_free (data_enc);
145 rrblock = GNUNET_GNSRECORD_block_create (&id_priv,
146 exp_abs,
147 TEST_RECORD_LABEL,
148 rd,
149 TEST_RRCOUNT);
150 size_t bdata_size = ntohl (rrblock->purpose.size) -
151 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) -
152 sizeof(struct GNUNET_TIME_AbsoluteNBO);
153 size_t rrblock_size = ntohl (rrblock->purpose.size) +
154 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) +
155 sizeof(struct GNUNET_CRYPTO_EcdsaSignature);
156
157 bdata = (char*)&rrblock[1];
158 GNUNET_STRINGS_base64_encode (bdata,
159 bdata_size,
160 &data_enc);
161 fprintf(stdout, "BDATA:\n%s\n\n", data_enc);
162 GNUNET_free (data_enc);
163 GNUNET_STRINGS_base64_encode (rrblock,
164 rrblock_size,
165 &data_enc);
166 fprintf(stdout, "RRBLOCK:\n%s\n", data_enc);
167 GNUNET_free (data_enc);
168
169}
170
171
172/**
173 * The main function of the test vector generation tool.
174 *
175 * @param argc number of arguments from the command line
176 * @param argv command line arguments
177 * @return 0 ok, 1 on error
178 */
179int
180main (int argc,
181 char *const *argv)
182{
183 const struct GNUNET_GETOPT_CommandLineOption options[] = {
184 GNUNET_GETOPT_OPTION_END
185 };
186
187 GNUNET_assert (GNUNET_OK ==
188 GNUNET_log_setup ("gnunet-gns-tvg",
189 "INFO",
190 NULL));
191 if (GNUNET_OK !=
192 GNUNET_PROGRAM_run (argc, argv,
193 "gnunet-gns-tvg",
194 "Generate test vectors for GNS",
195 options,
196 &run, NULL))
197 return 1;
198 return 0;
199}
200
201
202/* end of gnunet-gns-tvg.c */
diff --git a/src/gnsrecord/perf_gnsrecord_crypto.c b/src/gnsrecord/perf_gnsrecord_crypto.c
index 3bb4ca4e1..eb4633f75 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_CRYPTO_EcdsaPrivateKey privkey;
77 struct GNUNET_TIME_Absolute expire; 77 struct GNUNET_TIME_Absolute expire;
78 78
79 (void) cls; 79 (void) cls;
@@ -81,8 +81,7 @@ 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 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 84 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
85 GNUNET_assert (NULL != privkey);
86 85
87 /* test block creation */ 86 /* test block creation */
88 s_name = "DUMMY.dummy.gnunet"; 87 s_name = "DUMMY.dummy.gnunet";
@@ -91,12 +90,12 @@ run (void *cls,
91 for (unsigned int i = 0; i < ROUNDS; i++) 90 for (unsigned int i = 0; i < ROUNDS; i++)
92 { 91 {
93 GNUNET_assert (NULL != (block = 92 GNUNET_assert (NULL != (block =
94 GNUNET_GNSRECORD_block_create2 (privkey, 93 GNUNET_GNSRECORD_block_create2 (&privkey,
95 expire, 94 expire,
96 s_name, 95 s_name,
97 s_rd, 96 s_rd,
98 RECORDS))); 97 RECORDS)));
99 GNUNET_GNSRECORD_query_from_private_key (privkey, 98 GNUNET_GNSRECORD_query_from_private_key (&privkey,
100 s_name, 99 s_name,
101 &query); 100 &query);
102 GNUNET_free (block); 101 GNUNET_free (block);
@@ -108,9 +107,8 @@ run (void *cls,
108 GNUNET_YES), 107 GNUNET_YES),
109 ROUNDS); 108 ROUNDS);
110 for (unsigned int i = 0; i < RECORDS; i++) 109 for (unsigned int i = 0; i < RECORDS; i++)
111 GNUNET_free ((void *) s_rd[i].data); 110 GNUNET_free_nz ((void *) s_rd[i].data);
112 GNUNET_free (s_rd); 111 GNUNET_free (s_rd);
113 GNUNET_free (privkey);
114} 112}
115 113
116 114
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c b/src/gnsrecord/test_gnsrecord_crypto.c
index 0da19fbe9..b67e9a123 100644
--- a/src/gnsrecord/test_gnsrecord_crypto.c
+++ b/src/gnsrecord/test_gnsrecord_crypto.c
@@ -41,8 +41,6 @@
41#define TEST_REMOVE_RECORD_DATA 'b' 41#define TEST_REMOVE_RECORD_DATA 'b'
42 42
43 43
44static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
45
46static struct GNUNET_GNSRECORD_Data *s_rd; 44static struct GNUNET_GNSRECORD_Data *s_rd;
47 45
48static char *s_name; 46static char *s_name;
@@ -106,15 +104,16 @@ run (void *cls,
106 struct GNUNET_HashCode query_pub; 104 struct GNUNET_HashCode query_pub;
107 struct GNUNET_HashCode query_priv; 105 struct GNUNET_HashCode query_priv;
108 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;
108
109 109
110 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 110 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
111 GNUNET_assert (NULL != privkey);
112 /* get public key */ 111 /* get public key */
113 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, 112 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
114 &pubkey); 113 &pubkey);
115 114
116 /* test query derivation */ 115 /* test query derivation */
117 GNUNET_GNSRECORD_query_from_private_key (privkey, 116 GNUNET_GNSRECORD_query_from_private_key (&privkey,
118 "testlabel", 117 "testlabel",
119 &query_priv); 118 &query_priv);
120 GNUNET_GNSRECORD_query_from_public_key (&pubkey, 119 GNUNET_GNSRECORD_query_from_public_key (&pubkey,
@@ -129,7 +128,7 @@ run (void *cls,
129 128
130 /* Create block */ 129 /* Create block */
131 GNUNET_assert (NULL != (block = 130 GNUNET_assert (NULL != (block =
132 GNUNET_GNSRECORD_block_create (privkey, 131 GNUNET_GNSRECORD_block_create (&privkey,
133 expire, 132 expire,
134 s_name, 133 s_name,
135 s_rd, 134 s_rd,
@@ -143,7 +142,6 @@ run (void *cls,
143 &rd_decrypt_cb, 142 &rd_decrypt_cb,
144 s_name)); 143 s_name));
145 GNUNET_free (block); 144 GNUNET_free (block);
146 GNUNET_free (privkey);
147} 145}
148 146
149 147
diff --git a/src/gnsrecord/test_gnsrecord_serialization.c b/src/gnsrecord/test_gnsrecord_serialization.c
index 22d9f8396..d268cb7f3 100644
--- a/src/gnsrecord/test_gnsrecord_serialization.c
+++ b/src/gnsrecord/test_gnsrecord_serialization.c
@@ -132,7 +132,7 @@ run (void *cls,
132 132
133 for (c = 0; c < rd_count; c++) 133 for (c = 0; c < rd_count; c++)
134 { 134 {
135 GNUNET_free ((void *) src[c].data); 135 GNUNET_free_nz ((void *) src[c].data);
136 } 136 }
137} 137}
138 138
diff --git a/src/hello/hello-ng.c b/src/hello/hello-ng.c
index 8dea616b9..d06feadd5 100644
--- a/src/hello/hello-ng.c
+++ b/src/hello/hello-ng.c
@@ -79,8 +79,7 @@ GNUNET_HELLO_sign_address (
79 sa.purpose.size = htonl (sizeof(sa)); 79 sa.purpose.size = htonl (sizeof(sa));
80 sa.mono_time = GNUNET_TIME_absolute_hton (mono_time); 80 sa.mono_time = GNUNET_TIME_absolute_hton (mono_time);
81 GNUNET_CRYPTO_hash (address, strlen (address), &sa.h_addr); 81 GNUNET_CRYPTO_hash (address, strlen (address), &sa.h_addr);
82 GNUNET_assert (GNUNET_YES == 82 GNUNET_CRYPTO_eddsa_sign (private_key, &sa, &sig);
83 GNUNET_CRYPTO_eddsa_sign (private_key, &sa.purpose, &sig));
84 sig_str = NULL; 83 sig_str = NULL;
85 (void) GNUNET_STRINGS_base64_encode (&sig, sizeof(sig), &sig_str); 84 (void) GNUNET_STRINGS_base64_encode (&sig, sizeof(sig), &sig_str);
86 *result_size = 85 *result_size =
@@ -165,7 +164,7 @@ GNUNET_HELLO_extract_address (const void *raw,
165 GNUNET_CRYPTO_hash (raw_addr, strlen (raw_addr), &sa.h_addr); 164 GNUNET_CRYPTO_hash (raw_addr, strlen (raw_addr), &sa.h_addr);
166 if (GNUNET_YES != 165 if (GNUNET_YES !=
167 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS, 166 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS,
168 &sa.purpose, 167 &sa,
169 sig, 168 sig,
170 public_key)) 169 public_key))
171 { 170 {
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c
index ca77545cd..704c796b4 100644
--- a/src/hostlist/gnunet-daemon-hostlist.c
+++ b/src/hostlist/gnunet-daemon-hostlist.c
@@ -409,7 +409,7 @@ main (int argc, char *const *argv)
409 _ ("GNUnet hostlist server and client"), 409 _ ("GNUnet hostlist server and client"),
410 options, 410 options,
411 &run, NULL)) ? 0 : 1; 411 &run, NULL)) ? 0 : 1;
412 GNUNET_free ((void *) argv); 412 GNUNET_free_nz ((void *) argv);
413 return ret; 413 return ret;
414} 414}
415 415
diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c b/src/hostlist/gnunet-daemon-hostlist_server.c
index b2b7dac72..999730e3e 100644
--- a/src/hostlist/gnunet-daemon-hostlist_server.c
+++ b/src/hostlist/gnunet-daemon-hostlist_server.c
@@ -32,6 +32,7 @@
32#include "gnunet_peerinfo_service.h" 32#include "gnunet_peerinfo_service.h"
33#include "gnunet-daemon-hostlist.h" 33#include "gnunet-daemon-hostlist.h"
34#include "gnunet_resolver_service.h" 34#include "gnunet_resolver_service.h"
35#include "gnunet_mhd_compat.h"
35 36
36 37
37/** 38/**
@@ -294,7 +295,7 @@ host_processor (void *cls,
294 * @param addrlen length of @a addr 295 * @param addrlen length of @a addr
295 * @return #MHD_YES if connection is allowed, #MHD_NO if not (we are not ready) 296 * @return #MHD_YES if connection is allowed, #MHD_NO if not (we are not ready)
296 */ 297 */
297static int 298static MHD_RESULT
298accept_policy_callback (void *cls, 299accept_policy_callback (void *cls,
299 const struct sockaddr *addr, 300 const struct sockaddr *addr,
300 socklen_t addrlen) 301 socklen_t addrlen)
@@ -345,7 +346,7 @@ accept_policy_callback (void *cls,
345 * #MHD_NO if the socket must be closed due to a serios 346 * #MHD_NO if the socket must be closed due to a serios
346 * error while handling the request 347 * error while handling the request
347 */ 348 */
348static int 349static MHD_RESULT
349access_handler_callback (void *cls, 350access_handler_callback (void *cls,
350 struct MHD_Connection *connection, 351 struct MHD_Connection *connection,
351 const char *url, 352 const char *url,
diff --git a/src/identity/Makefile.am b/src/identity/Makefile.am
index 9f580f0f9..17e72c784 100644
--- a/src/identity/Makefile.am
+++ b/src/identity/Makefile.am
@@ -8,11 +8,9 @@ if USE_COVERAGE
8 XLIB = -lgcov 8 XLIB = -lgcov
9endif 9endif
10 10
11if HAVE_MHD 11if HAVE_REST
12if HAVE_JSON
13plugin_LTLIBRARIES = libgnunet_plugin_rest_identity.la 12plugin_LTLIBRARIES = libgnunet_plugin_rest_identity.la
14endif 13endif
15endif
16 14
17pkgcfgdir= $(pkgdatadir)/config.d/ 15pkgcfgdir= $(pkgdatadir)/config.d/
18 16
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index 1350376d9..fd73048c4 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -143,10 +143,14 @@ shutdown_task (void *cls)
143 * Test if we are finished yet. 143 * Test if we are finished yet.
144 */ 144 */
145static void 145static void
146test_finished () 146test_finished (void)
147{ 147{
148 if ((NULL == create_op) && (NULL == delete_op) && (NULL == set_op) && 148 if ( (NULL == create_op) &&
149 (NULL == set_subsystem) && (! list) && (! monitor)) 149 (NULL == delete_op) &&
150 (NULL == set_op) &&
151 (NULL == set_subsystem) &&
152 (! list) &&
153 (! monitor))
150 { 154 {
151 if (TIMEOUT_STATUS_CODE == global_ret) 155 if (TIMEOUT_STATUS_CODE == global_ret)
152 global_ret = 0; 156 global_ret = 0;
@@ -162,7 +166,8 @@ test_finished ()
162 * @param emsg NULL on success, otherwise an error message 166 * @param emsg NULL on success, otherwise an error message
163 */ 167 */
164static void 168static void
165delete_finished (void *cls, const char *emsg) 169delete_finished (void *cls,
170 const char *emsg)
166{ 171{
167 struct GNUNET_IDENTITY_Operation **op = cls; 172 struct GNUNET_IDENTITY_Operation **op = cls;
168 173
@@ -190,7 +195,9 @@ create_finished (void *cls,
190 *op = NULL; 195 *op = NULL;
191 if (NULL == pk) 196 if (NULL == pk)
192 { 197 {
193 fprintf (stderr, _ ("Failed to create ego: %s\n"), emsg); 198 fprintf (stderr,
199 _ ("Failed to create ego: %s\n"),
200 emsg);
194 global_ret = 1; 201 global_ret = 1;
195 } 202 }
196 else if (verbose) 203 else if (verbose)
@@ -280,16 +287,25 @@ print_ego (void *cls,
280 char *s; 287 char *s;
281 char *privs; 288 char *privs;
282 289
283 if ((NULL != set_ego) && (NULL != set_subsystem) && (NULL != ego) && 290 if ( (NULL != set_ego) &&
284 (NULL != identifier) && (0 == strcmp (identifier, set_ego))) 291 (NULL != set_subsystem) &&
292 (NULL != ego) &&
293 (NULL != identifier) &&
294 (0 == strcmp (identifier, set_ego)))
285 { 295 {
286 set_op = GNUNET_IDENTITY_set (sh, set_subsystem, ego, &set_done, NULL); 296 set_op = GNUNET_IDENTITY_set (sh,
297 set_subsystem,
298 ego,
299 &set_done,
300 NULL);
287 GNUNET_free (set_subsystem); 301 GNUNET_free (set_subsystem);
288 set_subsystem = NULL; 302 set_subsystem = NULL;
289 GNUNET_free (set_ego); 303 GNUNET_free (set_ego);
290 set_ego = NULL; 304 set_ego = NULL;
291 } 305 }
292 if ((NULL == ego) && (NULL != set_ego) && (NULL != set_subsystem)) 306 if ( (NULL == ego) &&
307 (NULL != set_ego) &&
308 (NULL != set_subsystem) )
293 { 309 {
294 fprintf (stderr, 310 fprintf (stderr,
295 "Could not set ego to `%s' for subsystem `%s', ego not known\n", 311 "Could not set ego to `%s' for subsystem `%s', ego not known\n",
@@ -308,9 +324,12 @@ print_ego (void *cls,
308 } 324 }
309 if (! (list | monitor)) 325 if (! (list | monitor))
310 return; 326 return;
311 if ((NULL == ego) || (NULL == identifier)) 327 if ( (NULL == ego) ||
328 (NULL == identifier) )
312 return; 329 return;
313 if ((NULL != set_ego) && (0 != strcmp (identifier, set_ego))) 330 if ( (NULL != set_ego) &&
331 (0 != strcmp (identifier,
332 set_ego)) )
314 return; 333 return;
315 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 334 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
316 s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 335 s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
@@ -358,18 +377,26 @@ run (void *cls,
358 return; 377 return;
359 } 378 }
360 sh = GNUNET_IDENTITY_connect (cfg, 379 sh = GNUNET_IDENTITY_connect (cfg,
361 (monitor | list) || (NULL != set_ego) || 380 (monitor | list) ||
381 (NULL != set_ego) ||
362 (NULL != set_subsystem) 382 (NULL != set_subsystem)
363 ? &print_ego 383 ? &print_ego
364 : NULL, 384 : NULL,
365 NULL); 385 NULL);
366 if (NULL != delete_ego) 386 if (NULL != delete_ego)
367 delete_op = 387 delete_op =
368 GNUNET_IDENTITY_delete (sh, delete_ego, &delete_finished, &delete_op); 388 GNUNET_IDENTITY_delete (sh,
389 delete_ego,
390 &delete_finished,
391 &delete_op);
369 if (NULL != create_ego) 392 if (NULL != create_ego)
370 create_op = 393 create_op =
371 GNUNET_IDENTITY_create (sh, create_ego, &create_finished, &create_op); 394 GNUNET_IDENTITY_create (sh,
372 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); 395 create_ego,
396 &create_finished,
397 &create_op);
398 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
399 NULL);
373 test_finished (); 400 test_finished ();
374} 401}
375 402
@@ -384,8 +411,8 @@ run (void *cls,
384int 411int
385main (int argc, char *const *argv) 412main (int argc, char *const *argv)
386{ 413{
387 struct GNUNET_GETOPT_CommandLineOption options[] = 414 struct GNUNET_GETOPT_CommandLineOption options[] = {
388 { GNUNET_GETOPT_option_string ('C', 415 GNUNET_GETOPT_option_string ('C',
389 "create", 416 "create",
390 "NAME", 417 "NAME",
391 gettext_noop ("create ego NAME"), 418 gettext_noop ("create ego NAME"),
@@ -426,10 +453,13 @@ main (int argc, char *const *argv)
426 "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)"), 453 "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)"),
427 &set_subsystem), 454 &set_subsystem),
428 GNUNET_GETOPT_option_verbose (&verbose), 455 GNUNET_GETOPT_option_verbose (&verbose),
429 GNUNET_GETOPT_OPTION_END }; 456 GNUNET_GETOPT_OPTION_END
457 };
430 int res; 458 int res;
431 459
432 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 460 if (GNUNET_OK !=
461 GNUNET_STRINGS_get_utf8_args (argc, argv,
462 &argc, &argv))
433 return 4; 463 return 4;
434 global_ret = TIMEOUT_STATUS_CODE; /* timeout */ 464 global_ret = TIMEOUT_STATUS_CODE; /* timeout */
435 res = GNUNET_PROGRAM_run (argc, 465 res = GNUNET_PROGRAM_run (argc,
@@ -439,7 +469,7 @@ main (int argc, char *const *argv)
439 options, 469 options,
440 &run, 470 &run,
441 NULL); 471 NULL);
442 GNUNET_free ((void *) argv); 472 GNUNET_free_nz ((void *) argv);
443 473
444 if (GNUNET_OK != res) 474 if (GNUNET_OK != res)
445 return 3; 475 return 3;
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c
index b509e7e9a..bdacf3ba0 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_CRYPTO_EcdsaPrivateKey pk;
61 61
62 /** 62 /**
63 * String identifier for the ego. 63 * String identifier for the ego.
@@ -140,7 +140,9 @@ client_disconnect_cb (void *cls,
140 struct GNUNET_SERVICE_Client *client, 140 struct GNUNET_SERVICE_Client *client,
141 void *app_ctx) 141 void *app_ctx)
142{ 142{
143 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); 143 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
144 "Client %p disconnected\n",
145 client);
144} 146}
145 147
146 148
@@ -189,8 +191,9 @@ shutdown_task (void *cls)
189 ego_directory = NULL; 191 ego_directory = NULL;
190 while (NULL != (e = ego_head)) 192 while (NULL != (e = ego_head))
191 { 193 {
192 GNUNET_CONTAINER_DLL_remove (ego_head, ego_tail, e); 194 GNUNET_CONTAINER_DLL_remove (ego_head,
193 GNUNET_free (e->pk); 195 ego_tail,
196 e);
194 GNUNET_free (e->identifier); 197 GNUNET_free (e->identifier);
195 GNUNET_free (e); 198 GNUNET_free (e);
196 } 199 }
@@ -247,7 +250,7 @@ create_update_message (struct Ego *ego)
247 env = GNUNET_MQ_msg_extra (um, name_len, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE); 250 env = GNUNET_MQ_msg_extra (um, name_len, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
248 um->name_len = htons (name_len); 251 um->name_len = htons (name_len);
249 um->end_of_list = htons (GNUNET_NO); 252 um->end_of_list = htons (GNUNET_NO);
250 um->private_key = *ego->pk; 253 um->private_key = ego->pk;
251 GNUNET_memcpy (&um[1], ego->identifier, name_len); 254 GNUNET_memcpy (&um[1], ego->identifier, name_len);
252 return env; 255 return env;
253} 256}
@@ -261,7 +264,8 @@ create_update_message (struct Ego *ego)
261 * @return corresponding set default message 264 * @return corresponding set default message
262 */ 265 */
263static struct GNUNET_MQ_Envelope * 266static struct GNUNET_MQ_Envelope *
264create_set_default_message (struct Ego *ego, const char *servicename) 267create_set_default_message (struct Ego *ego,
268 const char *servicename)
265{ 269{
266 struct SetDefaultMessage *sdm; 270 struct SetDefaultMessage *sdm;
267 struct GNUNET_MQ_Envelope *env; 271 struct GNUNET_MQ_Envelope *env;
@@ -273,7 +277,7 @@ create_set_default_message (struct Ego *ego, const char *servicename)
273 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT); 277 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
274 sdm->name_len = htons (name_len); 278 sdm->name_len = htons (name_len);
275 sdm->reserved = htons (0); 279 sdm->reserved = htons (0);
276 sdm->private_key = *ego->pk; 280 sdm->private_key = ego->pk;
277 GNUNET_memcpy (&sdm[1], servicename, name_len); 281 GNUNET_memcpy (&sdm[1], servicename, name_len);
278 return env; 282 return env;
279} 283}
@@ -289,26 +293,34 @@ create_set_default_message (struct Ego *ego, const char *servicename)
289 * @param message the message received 293 * @param message the message received
290 */ 294 */
291static void 295static void
292handle_start_message (void *cls, const struct GNUNET_MessageHeader *message) 296handle_start_message (void *cls,
297 const struct GNUNET_MessageHeader *message)
293{ 298{
294 struct GNUNET_SERVICE_Client *client = cls; 299 struct GNUNET_SERVICE_Client *client = cls;
295 struct UpdateMessage *ume;
296 struct GNUNET_MQ_Envelope *env;
297 struct Ego *ego;
298 300
299 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n"); 301 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
302 "Received START message from client\n");
300 GNUNET_SERVICE_client_mark_monitor (client); 303 GNUNET_SERVICE_client_mark_monitor (client);
301 GNUNET_SERVICE_client_disable_continue_warning (client); 304 GNUNET_SERVICE_client_disable_continue_warning (client);
302 GNUNET_notification_context_add (nc, GNUNET_SERVICE_client_get_mq (client)); 305 GNUNET_notification_context_add (nc,
303 for (ego = ego_head; NULL != ego; ego = ego->next) 306 GNUNET_SERVICE_client_get_mq (client));
307 for (struct Ego *ego = ego_head; NULL != ego; ego = ego->next)
304 { 308 {
305 env = create_update_message (ego); 309 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client),
306 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env); 310 create_update_message (ego));
311 }
312 {
313 struct UpdateMessage *ume;
314 struct GNUNET_MQ_Envelope *env;
315
316 env = GNUNET_MQ_msg_extra (ume,
317 0,
318 GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
319 ume->end_of_list = htons (GNUNET_YES);
320 ume->name_len = htons (0);
321 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client),
322 env);
307 } 323 }
308 env = GNUNET_MQ_msg_extra (ume, 0, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
309 ume->end_of_list = htons (GNUNET_YES);
310 ume->name_len = htons (0);
311 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
312 GNUNET_SERVICE_client_continue (client); 324 GNUNET_SERVICE_client_continue (client);
313} 325}
314 326
@@ -322,7 +334,8 @@ handle_start_message (void *cls, const struct GNUNET_MessageHeader *message)
322 * @return #GNUNET_SYSERR if message was ill-formed 334 * @return #GNUNET_SYSERR if message was ill-formed
323 */ 335 */
324static int 336static int
325check_lookup_message (void *cls, const struct LookupMessage *message) 337check_lookup_message (void *cls,
338 const struct LookupMessage *message)
326{ 339{
327 GNUNET_MQ_check_zero_termination (message); 340 GNUNET_MQ_check_zero_termination (message);
328 return GNUNET_OK; 341 return GNUNET_OK;
@@ -337,14 +350,16 @@ check_lookup_message (void *cls, const struct LookupMessage *message)
337 * @param message the message received 350 * @param message the message received
338 */ 351 */
339static void 352static void
340handle_lookup_message (void *cls, const struct LookupMessage *message) 353handle_lookup_message (void *cls,
354 const struct LookupMessage *message)
341{ 355{
342 struct GNUNET_SERVICE_Client *client = cls; 356 struct GNUNET_SERVICE_Client *client = cls;
343 const char *name; 357 const char *name;
344 struct GNUNET_MQ_Envelope *env; 358 struct GNUNET_MQ_Envelope *env;
345 struct Ego *ego; 359 struct Ego *ego;
346 360
347 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received LOOKUP message from client\n"); 361 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
362 "Received LOOKUP message from client\n");
348 name = (const char *) &message[1]; 363 name = (const char *) &message[1];
349 for (ego = ego_head; NULL != ego; ego = ego->next) 364 for (ego = ego_head; NULL != ego; ego = ego->next)
350 { 365 {
@@ -369,7 +384,8 @@ handle_lookup_message (void *cls, const struct LookupMessage *message)
369 * @return #GNUNET_SYSERR if message was ill-formed 384 * @return #GNUNET_SYSERR if message was ill-formed
370 */ 385 */
371static int 386static int
372check_lookup_by_suffix_message (void *cls, const struct LookupMessage *message) 387check_lookup_by_suffix_message (void *cls,
388 const struct LookupMessage *message)
373{ 389{
374 GNUNET_MQ_check_zero_termination (message); 390 GNUNET_MQ_check_zero_termination (message);
375 return GNUNET_OK; 391 return GNUNET_OK;
@@ -384,7 +400,8 @@ check_lookup_by_suffix_message (void *cls, const struct LookupMessage *message)
384 * @param message the message received 400 * @param message the message received
385 */ 401 */
386static void 402static void
387handle_lookup_by_suffix_message (void *cls, const struct LookupMessage *message) 403handle_lookup_by_suffix_message (void *cls,
404 const struct LookupMessage *message)
388{ 405{
389 struct GNUNET_SERVICE_Client *client = cls; 406 struct GNUNET_SERVICE_Client *client = cls;
390 const char *name; 407 const char *name;
@@ -429,7 +446,8 @@ handle_lookup_by_suffix_message (void *cls, const struct LookupMessage *message)
429 * @return #GNUNET_OK if @a msg is well-formed 446 * @return #GNUNET_OK if @a msg is well-formed
430 */ 447 */
431static int 448static int
432check_get_default_message (void *cls, const struct GetDefaultMessage *msg) 449check_get_default_message (void *cls,
450 const struct GetDefaultMessage *msg)
433{ 451{
434 uint16_t size; 452 uint16_t size;
435 uint16_t name_len; 453 uint16_t name_len;
@@ -462,31 +480,32 @@ check_get_default_message (void *cls, const struct GetDefaultMessage *msg)
462 * @param message the message received 480 * @param message the message received
463 */ 481 */
464static void 482static void
465handle_get_default_message (void *cls, const struct GetDefaultMessage *gdm) 483handle_get_default_message (void *cls,
484 const struct GetDefaultMessage *gdm)
466{ 485{
467 struct GNUNET_MQ_Envelope *env; 486 struct GNUNET_MQ_Envelope *env;
468 struct GNUNET_SERVICE_Client *client = cls; 487 struct GNUNET_SERVICE_Client *client = cls;
469 struct Ego *ego;
470 char *name; 488 char *name;
471 char *identifier; 489 char *identifier;
472 490
473
474 name = GNUNET_strdup ((const char *) &gdm[1]); 491 name = GNUNET_strdup ((const char *) &gdm[1]);
475 GNUNET_STRINGS_utf8_tolower ((const char *) &gdm[1], name); 492 GNUNET_STRINGS_utf8_tolower ((const char *) &gdm[1],
493 name);
476 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 494 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
477 "Received GET_DEFAULT for service `%s' from client\n", 495 "Received GET_DEFAULT for service `%s' from client\n",
478 name); 496 name);
479 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (subsystem_cfg, 497 if (GNUNET_OK !=
480 name, 498 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
481 "DEFAULT_IDENTIFIER", 499 name,
482 &identifier)) 500 "DEFAULT_IDENTIFIER",
501 &identifier))
483 { 502 {
484 send_result_code (client, 1, gettext_noop ("no default known")); 503 send_result_code (client, 1, gettext_noop ("no default known"));
485 GNUNET_SERVICE_client_continue (client); 504 GNUNET_SERVICE_client_continue (client);
486 GNUNET_free (name); 505 GNUNET_free (name);
487 return; 506 return;
488 } 507 }
489 for (ego = ego_head; NULL != ego; ego = ego->next) 508 for (struct Ego *ego = ego_head; NULL != ego; ego = ego->next)
490 { 509 {
491 if (0 == strcmp (ego->identifier, identifier)) 510 if (0 == strcmp (ego->identifier, identifier))
492 { 511 {
@@ -499,7 +518,9 @@ handle_get_default_message (void *cls, const struct GetDefaultMessage *gdm)
499 } 518 }
500 } 519 }
501 GNUNET_free (identifier); 520 GNUNET_free (identifier);
502 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to find ego `%s'\n", name); 521 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
522 "Failed to find ego `%s'\n",
523 name);
503 GNUNET_free (name); 524 GNUNET_free (name);
504 send_result_code (client, 525 send_result_code (client,
505 1, 526 1,
@@ -532,7 +553,8 @@ key_cmp (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1,
532 * @return #GNUNET_OK if @a msg is well-formed 553 * @return #GNUNET_OK if @a msg is well-formed
533 */ 554 */
534static int 555static int
535check_set_default_message (void *cls, const struct SetDefaultMessage *msg) 556check_set_default_message (void *cls,
557 const struct SetDefaultMessage *msg)
536{ 558{
537 uint16_t size; 559 uint16_t size;
538 uint16_t name_len; 560 uint16_t name_len;
@@ -570,7 +592,8 @@ check_set_default_message (void *cls, const struct SetDefaultMessage *msg)
570 * @param message the message received 592 * @param message the message received
571 */ 593 */
572static void 594static void
573handle_set_default_message (void *cls, const struct SetDefaultMessage *sdm) 595handle_set_default_message (void *cls,
596 const struct SetDefaultMessage *sdm)
574{ 597{
575 struct Ego *ego; 598 struct Ego *ego;
576 struct GNUNET_SERVICE_Client *client = cls; 599 struct GNUNET_SERVICE_Client *client = cls;
@@ -584,7 +607,8 @@ handle_set_default_message (void *cls, const struct SetDefaultMessage *sdm)
584 str); 607 str);
585 for (ego = ego_head; NULL != ego; ego = ego->next) 608 for (ego = ego_head; NULL != ego; ego = ego->next)
586 { 609 {
587 if (0 == key_cmp (ego->pk, &sdm->private_key)) 610 if (0 == key_cmp (&ego->pk,
611 &sdm->private_key))
588 { 612 {
589 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg, 613 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
590 str, 614 str,
@@ -627,7 +651,7 @@ notify_listeners (struct Ego *ego)
627 um->header.size = htons (sizeof(struct UpdateMessage) + name_len); 651 um->header.size = htons (sizeof(struct UpdateMessage) + name_len);
628 um->name_len = htons (name_len); 652 um->name_len = htons (name_len);
629 um->end_of_list = htons (GNUNET_NO); 653 um->end_of_list = htons (GNUNET_NO);
630 um->private_key = *ego->pk; 654 um->private_key = ego->pk;
631 GNUNET_memcpy (&um[1], ego->identifier, name_len); 655 GNUNET_memcpy (&um[1], ego->identifier, name_len);
632 GNUNET_notification_context_broadcast (nc, &um->header, GNUNET_NO); 656 GNUNET_notification_context_broadcast (nc, &um->header, GNUNET_NO);
633 GNUNET_free (um); 657 GNUNET_free (um);
@@ -642,7 +666,8 @@ notify_listeners (struct Ego *ego)
642 * @return #GNUNET_OK if @a msg is well-formed 666 * @return #GNUNET_OK if @a msg is well-formed
643 */ 667 */
644static int 668static int
645check_create_message (void *cls, const struct CreateRequestMessage *msg) 669check_create_message (void *cls,
670 const struct CreateRequestMessage *msg)
646{ 671{
647 uint16_t size; 672 uint16_t size;
648 uint16_t name_len; 673 uint16_t name_len;
@@ -680,7 +705,8 @@ check_create_message (void *cls, const struct CreateRequestMessage *msg)
680 * @param message the message received 705 * @param message the message received
681 */ 706 */
682static void 707static void
683handle_create_message (void *cls, const struct CreateRequestMessage *crm) 708handle_create_message (void *cls,
709 const struct CreateRequestMessage *crm)
684{ 710{
685 struct GNUNET_SERVICE_Client *client = cls; 711 struct GNUNET_SERVICE_Client *client = cls;
686 struct Ego *ego; 712 struct Ego *ego;
@@ -704,10 +730,11 @@ handle_create_message (void *cls, const struct CreateRequestMessage *crm)
704 } 730 }
705 } 731 }
706 ego = GNUNET_new (struct Ego); 732 ego = GNUNET_new (struct Ego);
707 ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); 733 ego->pk = crm->private_key;
708 *ego->pk = crm->private_key;
709 ego->identifier = GNUNET_strdup (str); 734 ego->identifier = GNUNET_strdup (str);
710 GNUNET_CONTAINER_DLL_insert (ego_head, ego_tail, ego); 735 GNUNET_CONTAINER_DLL_insert (ego_head,
736 ego_tail,
737 ego);
711 send_result_code (client, 0, NULL); 738 send_result_code (client, 0, NULL);
712 fn = get_ego_filename (ego); 739 fn = get_ego_filename (ego);
713 (void) GNUNET_DISK_directory_create_for_file (fn); 740 (void) GNUNET_DISK_directory_create_for_file (fn);
@@ -997,7 +1024,6 @@ handle_delete_message (void *cls, const struct DeleteMessage *dm)
997 GNUNET_free (ego->identifier); 1024 GNUNET_free (ego->identifier);
998 ego->identifier = NULL; 1025 ego->identifier = NULL;
999 notify_listeners (ego); 1026 notify_listeners (ego);
1000 GNUNET_free (ego->pk);
1001 GNUNET_free (ego); 1027 GNUNET_free (ego);
1002 GNUNET_free (name); 1028 GNUNET_free (name);
1003 send_result_code (client, 0, NULL); 1029 send_result_code (client, 0, NULL);
@@ -1023,7 +1049,8 @@ handle_delete_message (void *cls, const struct DeleteMessage *dm)
1023 * #GNUNET_SYSERR to abort iteration with error! 1049 * #GNUNET_SYSERR to abort iteration with error!
1024 */ 1050 */
1025static int 1051static int
1026process_ego_file (void *cls, const char *filename) 1052process_ego_file (void *cls,
1053 const char *filename)
1027{ 1054{
1028 struct Ego *ego; 1055 struct Ego *ego;
1029 const char *fn; 1056 const char *fn;
@@ -1035,8 +1062,10 @@ process_ego_file (void *cls, const char *filename)
1035 return GNUNET_OK; 1062 return GNUNET_OK;
1036 } 1063 }
1037 ego = GNUNET_new (struct Ego); 1064 ego = GNUNET_new (struct Ego);
1038 ego->pk = GNUNET_CRYPTO_ecdsa_key_create_from_file (filename); 1065 if (GNUNET_OK !=
1039 if (NULL == ego->pk) 1066 GNUNET_CRYPTO_ecdsa_key_from_file (filename,
1067 GNUNET_NO,
1068 &ego->pk))
1040 { 1069 {
1041 GNUNET_free (ego); 1070 GNUNET_free (ego);
1042 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1071 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -1044,7 +1073,9 @@ process_ego_file (void *cls, const char *filename)
1044 filename); 1073 filename);
1045 return GNUNET_OK; 1074 return GNUNET_OK;
1046 } 1075 }
1047 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loaded ego `%s'\n", fn + 1); 1076 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1077 "Loaded ego `%s'\n",
1078 fn + 1);
1048 ego->identifier = GNUNET_strdup (fn + 1); 1079 ego->identifier = GNUNET_strdup (fn + 1);
1049 GNUNET_CONTAINER_DLL_insert (ego_head, ego_tail, ego); 1080 GNUNET_CONTAINER_DLL_insert (ego_head, ego_tail, ego);
1050 return GNUNET_OK; 1081 return GNUNET_OK;
@@ -1108,7 +1139,9 @@ run (void *cls,
1108 _ ("Failed to create directory `%s' for storing egos\n"), 1139 _ ("Failed to create directory `%s' for storing egos\n"),
1109 ego_directory); 1140 ego_directory);
1110 } 1141 }
1111 GNUNET_DISK_directory_scan (ego_directory, &process_ego_file, NULL); 1142 GNUNET_DISK_directory_scan (ego_directory,
1143 &process_ego_file,
1144 NULL);
1112 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); 1145 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
1113} 1146}
1114 1147
diff --git a/src/identity/identity.h b/src/identity/identity.h
index b3c03d1ce..ef638fa36 100644
--- a/src/identity/identity.h
+++ b/src/identity/identity.h
@@ -245,9 +245,20 @@ GNUNET_NETWORK_STRUCT_END
245struct GNUNET_IDENTITY_Ego 245struct GNUNET_IDENTITY_Ego
246{ 246{
247 /** 247 /**
248 * Hash of the private key of this ego.
249 */
250 struct GNUNET_HashCode id;
251
252 /**
248 * Private key associated with this ego. 253 * Private key associated with this ego.
249 */ 254 */
250 struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; 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;
251 262
252 /** 263 /**
253 * Current name associated with this ego. 264 * Current name associated with this ego.
@@ -260,9 +271,9 @@ struct GNUNET_IDENTITY_Ego
260 void *ctx; 271 void *ctx;
261 272
262 /** 273 /**
263 * Hash of the public key of this ego. 274 * Set to true once @e pub was initialized
264 */ 275 */
265 struct GNUNET_HashCode id; 276 bool pub_initialized;
266}; 277};
267 278
268 279
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 29d9b9011..693d4392e 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_CRYPTO_EcdsaPrivateKey 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
@@ -105,7 +105,7 @@ struct GNUNET_IDENTITY_Handle
105 struct GNUNET_MQ_Handle *mq; 105 struct GNUNET_MQ_Handle *mq;
106 106
107 /** 107 /**
108 * Hash map from the hash of the public key to the 108 * Hash map from the hash of the private key to the
109 * respective `GNUNET_IDENTITY_Ego` handle. 109 * respective `GNUNET_IDENTITY_Ego` handle.
110 */ 110 */
111 struct GNUNET_CONTAINER_MultiHashMap *egos; 111 struct GNUNET_CONTAINER_MultiHashMap *egos;
@@ -156,14 +156,18 @@ const struct GNUNET_IDENTITY_Ego *
156GNUNET_IDENTITY_ego_get_anonymous () 156GNUNET_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 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 160 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
160 161
161 if (NULL != anon.pk) 162 if (setup)
162 return &anon; 163 return &anon;
163 anon.pk = (struct GNUNET_CRYPTO_EcdsaPrivateKey *) 164 anon.pk = *GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
164 GNUNET_CRYPTO_ecdsa_key_get_anonymous (); 165 GNUNET_CRYPTO_ecdsa_key_get_public (&anon.pk,
165 GNUNET_CRYPTO_ecdsa_key_get_public (anon.pk, &pub); 166 &pub);
166 GNUNET_CRYPTO_hash (&pub, sizeof(pub), &anon.id); 167 GNUNET_CRYPTO_hash (&anon.pk,
168 sizeof(anon.pk),
169 &anon.id);
170 setup = 1;
167 return &anon; 171 return &anon;
168} 172}
169 173
@@ -186,17 +190,22 @@ reconnect (void *cls);
186 * @return #GNUNET_OK (continue to iterate) 190 * @return #GNUNET_OK (continue to iterate)
187 */ 191 */
188static int 192static int
189free_ego (void *cls, const struct GNUNET_HashCode *key, void *value) 193free_ego (void *cls,
194 const struct GNUNET_HashCode *key,
195 void *value)
190{ 196{
191 struct GNUNET_IDENTITY_Handle *h = cls; 197 struct GNUNET_IDENTITY_Handle *h = cls;
192 struct GNUNET_IDENTITY_Ego *ego = value; 198 struct GNUNET_IDENTITY_Ego *ego = value;
193 199
194 if (NULL != h->cb) 200 if (NULL != h->cb)
195 h->cb (h->cb_cls, ego, &ego->ctx, NULL); 201 h->cb (h->cb_cls, ego,
196 GNUNET_free (ego->pk); 202 &ego->ctx,
203 NULL);
197 GNUNET_free (ego->name); 204 GNUNET_free (ego->name);
198 GNUNET_assert (GNUNET_YES == 205 GNUNET_assert (GNUNET_YES ==
199 GNUNET_CONTAINER_multihashmap_remove (h->egos, key, value)); 206 GNUNET_CONTAINER_multihashmap_remove (h->egos,
207 key,
208 value));
200 GNUNET_free (ego); 209 GNUNET_free (ego);
201 return GNUNET_OK; 210 return GNUNET_OK;
202} 211}
@@ -221,24 +230,31 @@ reschedule_connect (struct GNUNET_IDENTITY_Handle *h)
221 } 230 }
222 while (NULL != (op = h->op_head)) 231 while (NULL != (op = h->op_head))
223 { 232 {
224 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); 233 GNUNET_CONTAINER_DLL_remove (h->op_head,
234 h->op_tail,
235 op);
225 if (NULL != op->cont) 236 if (NULL != op->cont)
226 op->cont (op->cls, "Error in communication with the identity service"); 237 op->cont (op->cls,
238 "Error in communication with the identity service");
227 else if (NULL != op->cb) 239 else if (NULL != op->cb)
228 op->cb (op->cls, NULL, NULL, NULL); 240 op->cb (op->cls, NULL, NULL, NULL);
229 else if (NULL != op->create_cont) 241 else if (NULL != op->create_cont)
230 op->create_cont (op->cls, 242 op->create_cont (op->cls,
231 NULL, 243 NULL,
232 "Failed to communicate with the identity service"); 244 "Failed to communicate with the identity service");
233 GNUNET_free_non_null (op->pk);
234 GNUNET_free (op); 245 GNUNET_free (op);
235 } 246 }
236 GNUNET_CONTAINER_multihashmap_iterate (h->egos, &free_ego, h); 247 GNUNET_CONTAINER_multihashmap_iterate (h->egos,
248 &free_ego,
249 h);
237 LOG (GNUNET_ERROR_TYPE_DEBUG, 250 LOG (GNUNET_ERROR_TYPE_DEBUG,
238 "Scheduling task to reconnect to identity service in %s.\n", 251 "Scheduling task to reconnect to identity service in %s.\n",
239 GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay, GNUNET_YES)); 252 GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay,
253 GNUNET_YES));
240 h->reconnect_task = 254 h->reconnect_task =
241 GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); 255 GNUNET_SCHEDULER_add_delayed (h->reconnect_delay,
256 &reconnect,
257 h);
242 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay); 258 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
243} 259}
244 260
@@ -252,7 +268,8 @@ reschedule_connect (struct GNUNET_IDENTITY_Handle *h)
252 * @param error error code 268 * @param error error code
253 */ 269 */
254static void 270static void
255mq_error_handler (void *cls, enum GNUNET_MQ_Error error) 271mq_error_handler (void *cls,
272 enum GNUNET_MQ_Error error)
256{ 273{
257 struct GNUNET_IDENTITY_Handle *h = cls; 274 struct GNUNET_IDENTITY_Handle *h = cls;
258 275
@@ -269,7 +286,8 @@ mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
269 * @return #GNUNET_OK if the message is well-formed 286 * @return #GNUNET_OK if the message is well-formed
270 */ 287 */
271static int 288static int
272check_identity_result_code (void *cls, const struct ResultCodeMessage *rcm) 289check_identity_result_code (void *cls,
290 const struct ResultCodeMessage *rcm)
273{ 291{
274 if (sizeof(*rcm) != htons (rcm->header.size)) 292 if (sizeof(*rcm) != htons (rcm->header.size))
275 GNUNET_MQ_check_zero_termination (rcm); 293 GNUNET_MQ_check_zero_termination (rcm);
@@ -284,7 +302,8 @@ check_identity_result_code (void *cls, const struct ResultCodeMessage *rcm)
284 * @param rcm result message received 302 * @param rcm result message received
285 */ 303 */
286static void 304static void
287handle_identity_result_code (void *cls, const struct ResultCodeMessage *rcm) 305handle_identity_result_code (void *cls,
306 const struct ResultCodeMessage *rcm)
288{ 307{
289 struct GNUNET_IDENTITY_Handle *h = cls; 308 struct GNUNET_IDENTITY_Handle *h = cls;
290 struct GNUNET_IDENTITY_Operation *op; 309 struct GNUNET_IDENTITY_Operation *op;
@@ -304,8 +323,7 @@ handle_identity_result_code (void *cls, const struct ResultCodeMessage *rcm)
304 else if (NULL != op->cb) 323 else if (NULL != op->cb)
305 op->cb (op->cls, NULL, NULL, NULL); 324 op->cb (op->cls, NULL, NULL, NULL);
306 else if (NULL != op->create_cont) 325 else if (NULL != op->create_cont)
307 op->create_cont (op->cls, (NULL == str) ? op->pk : NULL, str); 326 op->create_cont (op->cls, (NULL == str) ? &op->pk : NULL, str);
308 GNUNET_free_non_null (op->pk);
309 GNUNET_free (op); 327 GNUNET_free (op);
310} 328}
311 329
@@ -318,7 +336,8 @@ handle_identity_result_code (void *cls, const struct ResultCodeMessage *rcm)
318 * @return #GNUNET_OK if the message is well-formed 336 * @return #GNUNET_OK if the message is well-formed
319 */ 337 */
320static int 338static int
321check_identity_update (void *cls, const struct UpdateMessage *um) 339check_identity_update (void *cls,
340 const struct UpdateMessage *um)
322{ 341{
323 uint16_t size = ntohs (um->header.size); 342 uint16_t size = ntohs (um->header.size);
324 uint16_t name_len = ntohs (um->name_len); 343 uint16_t name_len = ntohs (um->name_len);
@@ -341,12 +360,12 @@ check_identity_update (void *cls, const struct UpdateMessage *um)
341 * @param um message received 360 * @param um message received
342 */ 361 */
343static void 362static void
344handle_identity_update (void *cls, const struct UpdateMessage *um) 363handle_identity_update (void *cls,
364 const struct UpdateMessage *um)
345{ 365{
346 struct GNUNET_IDENTITY_Handle *h = cls; 366 struct GNUNET_IDENTITY_Handle *h = cls;
347 uint16_t name_len = ntohs (um->name_len); 367 uint16_t name_len = ntohs (um->name_len);
348 const char *str = (0 == name_len) ? NULL : (const char *) &um[1]; 368 const char *str = (0 == name_len) ? NULL : (const char *) &um[1];
349 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
350 struct GNUNET_HashCode id; 369 struct GNUNET_HashCode id;
351 struct GNUNET_IDENTITY_Ego *ego; 370 struct GNUNET_IDENTITY_Ego *ego;
352 371
@@ -357,9 +376,11 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
357 h->cb (h->cb_cls, NULL, NULL, NULL); 376 h->cb (h->cb_cls, NULL, NULL, NULL);
358 return; 377 return;
359 } 378 }
360 GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub); 379 GNUNET_CRYPTO_hash (&um->private_key,
361 GNUNET_CRYPTO_hash (&pub, sizeof(pub), &id); 380 sizeof (um->private_key),
362 ego = GNUNET_CONTAINER_multihashmap_get (h->egos, &id); 381 &id);
382 ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
383 &id);
363 if (NULL == ego) 384 if (NULL == ego)
364 { 385 {
365 /* ego was created */ 386 /* ego was created */
@@ -371,8 +392,7 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
371 return; 392 return;
372 } 393 }
373 ego = GNUNET_new (struct GNUNET_IDENTITY_Ego); 394 ego = GNUNET_new (struct GNUNET_IDENTITY_Ego);
374 ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); 395 ego->pk = um->private_key;
375 *ego->pk = um->private_key;
376 ego->name = GNUNET_strdup (str); 396 ego->name = GNUNET_strdup (str);
377 ego->id = id; 397 ego->id = id;
378 GNUNET_assert (GNUNET_YES == 398 GNUNET_assert (GNUNET_YES ==
@@ -385,9 +405,10 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
385 if (NULL == str) 405 if (NULL == str)
386 { 406 {
387 /* ego was deleted */ 407 /* ego was deleted */
388 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (h->egos, 408 GNUNET_assert (GNUNET_YES ==
389 &ego->id, 409 GNUNET_CONTAINER_multihashmap_remove (h->egos,
390 ego)); 410 &ego->id,
411 ego));
391 } 412 }
392 else 413 else
393 { 414 {
@@ -397,11 +418,13 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
397 } 418 }
398 /* inform application about change */ 419 /* inform application about change */
399 if (NULL != h->cb) 420 if (NULL != h->cb)
400 h->cb (h->cb_cls, ego, &ego->ctx, str); 421 h->cb (h->cb_cls,
422 ego,
423 &ego->ctx,
424 str);
401 /* complete deletion */ 425 /* complete deletion */
402 if (NULL == str) 426 if (NULL == str)
403 { 427 {
404 GNUNET_free (ego->pk);
405 GNUNET_free (ego->name); 428 GNUNET_free (ego->name);
406 GNUNET_free (ego); 429 GNUNET_free (ego);
407 } 430 }
@@ -417,7 +440,8 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
417 * @return #GNUNET_OK if the message is well-formed 440 * @return #GNUNET_OK if the message is well-formed
418 */ 441 */
419static int 442static int
420check_identity_set_default (void *cls, const struct SetDefaultMessage *sdm) 443check_identity_set_default (void *cls,
444 const struct SetDefaultMessage *sdm)
421{ 445{
422 uint16_t size = ntohs (sdm->header.size) - sizeof(*sdm); 446 uint16_t size = ntohs (sdm->header.size) - sizeof(*sdm);
423 uint16_t name_len = ntohs (sdm->name_len); 447 uint16_t name_len = ntohs (sdm->name_len);
@@ -441,17 +465,19 @@ check_identity_set_default (void *cls, const struct SetDefaultMessage *sdm)
441 * @param sdm message received 465 * @param sdm message received
442 */ 466 */
443static void 467static void
444handle_identity_set_default (void *cls, const struct SetDefaultMessage *sdm) 468handle_identity_set_default (void *cls,
469 const struct SetDefaultMessage *sdm)
445{ 470{
446 struct GNUNET_IDENTITY_Handle *h = cls; 471 struct GNUNET_IDENTITY_Handle *h = cls;
447 struct GNUNET_IDENTITY_Operation *op; 472 struct GNUNET_IDENTITY_Operation *op;
448 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
449 struct GNUNET_HashCode id; 473 struct GNUNET_HashCode id;
450 struct GNUNET_IDENTITY_Ego *ego; 474 struct GNUNET_IDENTITY_Ego *ego;
451 475
452 GNUNET_CRYPTO_ecdsa_key_get_public (&sdm->private_key, &pub); 476 GNUNET_CRYPTO_hash (&sdm->private_key,
453 GNUNET_CRYPTO_hash (&pub, sizeof(pub), &id); 477 sizeof(sdm->private_key),
454 ego = GNUNET_CONTAINER_multihashmap_get (h->egos, &id); 478 &id);
479 ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
480 &id);
455 if (NULL == ego) 481 if (NULL == ego)
456 { 482 {
457 GNUNET_break (0); 483 GNUNET_break (0);
@@ -467,9 +493,14 @@ handle_identity_set_default (void *cls, const struct SetDefaultMessage *sdm)
467 } 493 }
468 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 494 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
469 "Received SET_DEFAULT message from identity service\n"); 495 "Received SET_DEFAULT message from identity service\n");
470 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); 496 GNUNET_CONTAINER_DLL_remove (h->op_head,
497 h->op_tail,
498 op);
471 if (NULL != op->cb) 499 if (NULL != op->cb)
472 op->cb (op->cls, ego, &ego->ctx, ego->name); 500 op->cb (op->cls,
501 ego,
502 &ego->ctx,
503 ego->name);
473 GNUNET_free (op); 504 GNUNET_free (op);
474} 505}
475 506
@@ -483,8 +514,8 @@ static void
483reconnect (void *cls) 514reconnect (void *cls)
484{ 515{
485 struct GNUNET_IDENTITY_Handle *h = cls; 516 struct GNUNET_IDENTITY_Handle *h = cls;
486 struct GNUNET_MQ_MessageHandler handlers[] = 517 struct GNUNET_MQ_MessageHandler handlers[] = {
487 { GNUNET_MQ_hd_var_size (identity_result_code, 518 GNUNET_MQ_hd_var_size (identity_result_code,
488 GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, 519 GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE,
489 struct ResultCodeMessage, 520 struct ResultCodeMessage,
490 h), 521 h),
@@ -496,21 +527,28 @@ reconnect (void *cls)
496 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, 527 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT,
497 struct SetDefaultMessage, 528 struct SetDefaultMessage,
498 h), 529 h),
499 GNUNET_MQ_handler_end () }; 530 GNUNET_MQ_handler_end ()
531 };
500 struct GNUNET_MQ_Envelope *env; 532 struct GNUNET_MQ_Envelope *env;
501 struct GNUNET_MessageHeader *msg; 533 struct GNUNET_MessageHeader *msg;
502 534
503 h->reconnect_task = NULL; 535 h->reconnect_task = NULL;
504 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to identity service.\n"); 536 LOG (GNUNET_ERROR_TYPE_DEBUG,
537 "Connecting to identity service.\n");
505 GNUNET_assert (NULL == h->mq); 538 GNUNET_assert (NULL == h->mq);
506 h->mq = 539 h->mq = GNUNET_CLIENT_connect (h->cfg,
507 GNUNET_CLIENT_connect (h->cfg, "identity", handlers, &mq_error_handler, h); 540 "identity",
541 handlers,
542 &mq_error_handler,
543 h);
508 if (NULL == h->mq) 544 if (NULL == h->mq)
509 return; 545 return;
510 if (NULL != h->cb) 546 if (NULL != h->cb)
511 { 547 {
512 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_IDENTITY_START); 548 env = GNUNET_MQ_msg (msg,
513 GNUNET_MQ_send (h->mq, env); 549 GNUNET_MESSAGE_TYPE_IDENTITY_START);
550 GNUNET_MQ_send (h->mq,
551 env);
514 } 552 }
515} 553}
516 554
@@ -534,7 +572,8 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
534 h->cfg = cfg; 572 h->cfg = cfg;
535 h->cb = cb; 573 h->cb = cb;
536 h->cb_cls = cb_cls; 574 h->cb_cls = cb_cls;
537 h->egos = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES); 575 h->egos = GNUNET_CONTAINER_multihashmap_create (16,
576 GNUNET_YES);
538 reconnect (h); 577 reconnect (h);
539 if (NULL == h->mq) 578 if (NULL == h->mq)
540 { 579 {
@@ -554,7 +593,7 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
554const struct GNUNET_CRYPTO_EcdsaPrivateKey * 593const struct GNUNET_CRYPTO_EcdsaPrivateKey *
555GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) 594GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
556{ 595{
557 return ego->pk; 596 return &ego->pk;
558} 597}
559 598
560 599
@@ -565,10 +604,16 @@ GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
565 * @param pk set to ego's public key 604 * @param pk set to ego's public key
566 */ 605 */
567void 606void
568GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego, 607GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
569 struct GNUNET_CRYPTO_EcdsaPublicKey *pk) 608 struct GNUNET_CRYPTO_EcdsaPublicKey *pk)
570{ 609{
571 GNUNET_CRYPTO_ecdsa_key_get_public (ego->pk, pk); 610 if (! ego->pub_initialized)
611 {
612 GNUNET_CRYPTO_ecdsa_key_get_public (&ego->pk,
613 &ego->pub);
614 ego->pub_initialized = true;
615 }
616 *pk = ego->pub;
572} 617}
573 618
574 619
@@ -657,7 +702,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
657 GNUNET_MQ_msg_extra (sdm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT); 702 GNUNET_MQ_msg_extra (sdm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
658 sdm->name_len = htons (slen); 703 sdm->name_len = htons (slen);
659 sdm->reserved = htons (0); 704 sdm->reserved = htons (0);
660 sdm->private_key = *ego->pk; 705 sdm->private_key = ego->pk;
661 GNUNET_memcpy (&sdm[1], service_name, slen); 706 GNUNET_memcpy (&sdm[1], service_name, slen);
662 GNUNET_MQ_send (h->mq, env); 707 GNUNET_MQ_send (h->mq, env);
663 return op; 708 return op;
@@ -682,7 +727,6 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
682 struct GNUNET_IDENTITY_Operation *op; 727 struct GNUNET_IDENTITY_Operation *op;
683 struct GNUNET_MQ_Envelope *env; 728 struct GNUNET_MQ_Envelope *env;
684 struct CreateRequestMessage *crm; 729 struct CreateRequestMessage *crm;
685 struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
686 size_t slen; 730 size_t slen;
687 731
688 if (NULL == h->mq) 732 if (NULL == h->mq)
@@ -701,9 +745,8 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
701 env = GNUNET_MQ_msg_extra (crm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_CREATE); 745 env = GNUNET_MQ_msg_extra (crm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_CREATE);
702 crm->name_len = htons (slen); 746 crm->name_len = htons (slen);
703 crm->reserved = htons (0); 747 crm->reserved = htons (0);
704 pk = GNUNET_CRYPTO_ecdsa_key_create (); 748 GNUNET_CRYPTO_ecdsa_key_create (&crm->private_key);
705 crm->private_key = *pk; 749 op->pk = crm->private_key;
706 op->pk = pk;
707 GNUNET_memcpy (&crm[1], name, slen); 750 GNUNET_memcpy (&crm[1], name, slen);
708 GNUNET_MQ_send (h->mq, env); 751 GNUNET_MQ_send (h->mq, env);
709 return op; 752 return op;
@@ -820,11 +863,9 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op)
820 op->cont = NULL; 863 op->cont = NULL;
821 op->cb = NULL; 864 op->cb = NULL;
822 op->create_cont = NULL; 865 op->create_cont = NULL;
823 if (NULL != op->pk) 866 memset (&op->pk,
824 { 867 0,
825 GNUNET_free (op->pk); 868 sizeof (op->pk));
826 op->pk = NULL;
827 }
828} 869}
829 870
830 871
@@ -846,7 +887,9 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h)
846 } 887 }
847 if (NULL != h->egos) 888 if (NULL != h->egos)
848 { 889 {
849 GNUNET_CONTAINER_multihashmap_iterate (h->egos, &free_ego, h); 890 GNUNET_CONTAINER_multihashmap_iterate (h->egos,
891 &free_ego,
892 h);
850 GNUNET_CONTAINER_multihashmap_destroy (h->egos); 893 GNUNET_CONTAINER_multihashmap_destroy (h->egos);
851 h->egos = NULL; 894 h->egos = NULL;
852 } 895 }
@@ -854,7 +897,9 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h)
854 { 897 {
855 GNUNET_break (NULL == op->cont); 898 GNUNET_break (NULL == op->cont);
856 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); 899 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
857 GNUNET_free_non_null (op->pk); 900 memset (&op->pk,
901 0,
902 sizeof (op->pk));
858 GNUNET_free (op); 903 GNUNET_free (op);
859 } 904 }
860 if (NULL != h->mq) 905 if (NULL != h->mq)
diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c
index 108fc7fcf..6c61d3977 100644
--- a/src/identity/identity_api_lookup.c
+++ b/src/identity/identity_api_lookup.c
@@ -134,7 +134,7 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
134 GNUNET_break (GNUNET_YES != ntohs (um->end_of_list)); 134 GNUNET_break (GNUNET_YES != ntohs (um->end_of_list));
135 GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub); 135 GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub);
136 GNUNET_CRYPTO_hash (&pub, sizeof(pub), &id); 136 GNUNET_CRYPTO_hash (&pub, sizeof(pub), &id);
137 ego.pk = (struct GNUNET_CRYPTO_EcdsaPrivateKey *) &um->private_key; 137 ego.pk = um->private_key;
138 ego.name = (char *) str; 138 ego.name = (char *) str;
139 ego.id = id; 139 ego.id = id;
140 el->cb (el->cb_cls, &ego); 140 el->cb (el->cb_cls, &ego);
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index 65bbaaaba..97a7bf513 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -39,11 +39,6 @@
39/** 39/**
40 * Identity Namespace with public key specifier 40 * Identity Namespace with public key specifier
41 */ 41 */
42#define GNUNET_REST_API_NS_IDENTITY_ALL "/identity/all"
43
44/**
45 * Identity Namespace with public key specifier
46 */
47#define GNUNET_REST_API_NS_IDENTITY_PUBKEY "/identity/pubkey" 42#define GNUNET_REST_API_NS_IDENTITY_PUBKEY "/identity/pubkey"
48 43
49/** 44/**
@@ -314,6 +309,7 @@ do_error (void *cls)
314 handle->response_code = MHD_HTTP_OK; 309 handle->response_code = MHD_HTTP_OK;
315 response = json_dumps (json_error, 0); 310 response = json_dumps (json_error, 0);
316 resp = GNUNET_REST_create_response (response); 311 resp = GNUNET_REST_create_response (response);
312 MHD_add_response_header (resp, "Content-Type", "application/json");
317 handle->proc (handle->proc_cls, resp, handle->response_code); 313 handle->proc (handle->proc_cls, resp, handle->response_code);
318 json_decref (json_error); 314 json_decref (json_error);
319 GNUNET_free (response); 315 GNUNET_free (response);
@@ -403,7 +399,7 @@ ego_get_for_subsystem (void *cls,
403 result_str = json_dumps (json_root, 0); 399 result_str = json_dumps (json_root, 0);
404 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 400 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
405 resp = GNUNET_REST_create_response (result_str); 401 resp = GNUNET_REST_create_response (result_str);
406 402 MHD_add_response_header (resp, "Content-Type", "application/json");
407 json_decref (json_root); 403 json_decref (json_root);
408 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 404 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
409 GNUNET_free (result_str); 405 GNUNET_free (result_str);
@@ -490,7 +486,7 @@ ego_get_all (struct GNUNET_REST_RequestHandle *con_handle,
490 result_str = json_dumps (json_root, 0); 486 result_str = json_dumps (json_root, 0);
491 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 487 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
492 resp = GNUNET_REST_create_response (result_str); 488 resp = GNUNET_REST_create_response (result_str);
493 489 MHD_add_response_header (resp, "Content-Type", "application/json");
494 json_decref (json_root); 490 json_decref (json_root);
495 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 491 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
496 GNUNET_free (result_str); 492 GNUNET_free (result_str);
@@ -523,7 +519,7 @@ ego_get_response (struct RequestHandle *handle, struct EgoEntry *ego_entry)
523 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 519 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
524 resp = GNUNET_REST_create_response (result_str); 520 resp = GNUNET_REST_create_response (result_str);
525 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 521 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
526 522 MHD_add_response_header (resp, "Content-Type", "application/json");
527 json_decref (json_ego); 523 json_decref (json_ego);
528 GNUNET_free (result_str); 524 GNUNET_free (result_str);
529 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); 525 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
@@ -1155,7 +1151,7 @@ init_cont (struct RequestHandle *handle)
1155{ 1151{
1156 struct GNUNET_REST_RequestHandlerError err; 1152 struct GNUNET_REST_RequestHandlerError err;
1157 static const struct GNUNET_REST_RequestHandler handlers[] = 1153 static const struct GNUNET_REST_RequestHandler handlers[] =
1158 { { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_ALL, &ego_get_all }, 1154 { { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY, &ego_get_all },
1159 { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_PUBKEY, 1155 { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_PUBKEY,
1160 &ego_get_pubkey }, 1156 &ego_get_pubkey },
1161 { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_NAME, &ego_get_name }, 1157 { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_NAME, &ego_get_name },
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index b53f2420d..d2c254ae6 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -56,12 +56,13 @@ gnunetinclude_HEADERS = \
56 gnunet_helper_lib.h \ 56 gnunet_helper_lib.h \
57 gnunet_identity_service.h \ 57 gnunet_identity_service.h \
58 gnunet_abe_lib.h \ 58 gnunet_abe_lib.h \
59 gnunet_reclaim_attribute_lib.h \ 59 gnunet_reclaim_lib.h \
60 gnunet_reclaim_attribute_plugin.h \ 60 gnunet_reclaim_plugin.h \
61 gnunet_reclaim_service.h \ 61 gnunet_reclaim_service.h \
62 gnunet_json_lib.h \ 62 gnunet_json_lib.h \
63 gnunet_load_lib.h \ 63 gnunet_load_lib.h \
64 gnunet_cadet_service.h \ 64 gnunet_cadet_service.h \
65 gnunet_mhd_compat.h \
65 gnunet_microphone_lib.h \ 66 gnunet_microphone_lib.h \
66 gnunet_mst_lib.h \ 67 gnunet_mst_lib.h \
67 gnunet_mq_lib.h \ 68 gnunet_mq_lib.h \
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 6e185c314..34f419a49 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2006-2013 GNUnet e.V. 3 Copyright (C) 2006-2020 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 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 6 under the terms of the GNU Affero General Public License as published
@@ -80,10 +80,15 @@ extern "C" {
80 * GNUNET_SYSERR`, `GNUNET_OK != GNUNET_NO`, `GNUNET_NO != 80 * GNUNET_SYSERR`, `GNUNET_OK != GNUNET_NO`, `GNUNET_NO !=
81 * GNUNET_SYSERR` and finally `GNUNET_YES != GNUNET_NO`. 81 * GNUNET_SYSERR` and finally `GNUNET_YES != GNUNET_NO`.
82 */ 82 */
83#define GNUNET_OK 1 83enum GNUNET_GenericReturnValue
84#define GNUNET_SYSERR -1 84{
85#define GNUNET_YES 1 85 GNUNET_SYSERR = -1,
86#define GNUNET_NO 0 86 GNUNET_NO = 0,
87 GNUNET_OK = 1,
88 /* intentionally identical to #GNUNET_OK! */
89 GNUNET_YES = 1,
90};
91
87 92
88#define GNUNET_MIN(a, b) (((a) < (b)) ? (a) : (b)) 93#define GNUNET_MIN(a, b) (((a) < (b)) ? (a) : (b))
89 94
@@ -888,6 +893,28 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
888 } while (0) 893 } while (0)
889 894
890 895
896#if HAVE_STATIC_ASSERT
897/**
898 * Assertion to be checked (if supported by C compiler) at
899 * compile time, otherwise checked at runtime and resulting
900 * in an abort() on failure.
901 *
902 * @param cond condition to test, 0 implies failure
903 */
904#define GNUNET_static_assert(cond) _Static_assert (cond, "")
905#else
906/**
907 * Assertion to be checked (if supported by C compiler) at
908 * compile time, otherwise checked at runtime and resulting
909 * in an abort() on failure. This is the case where the
910 * compiler does not support static assertions.
911 *
912 * @param cond condition to test, 0 implies failure
913 */
914#define GNUNET_static_assert(cond) GNUNET_assert (cond)
915#endif
916
917
891/** 918/**
892 * @ingroup logging 919 * @ingroup logging
893 * Use this for internal assertion violations that are 920 * Use this for internal assertion violations that are
@@ -1089,6 +1116,9 @@ GNUNET_ntoh_double (double d);
1089/** 1116/**
1090 * Compare memory in @a a and @a b, where both must be of 1117 * Compare memory in @a a and @a b, where both must be of
1091 * the same pointer type. 1118 * the same pointer type.
1119 *
1120 * Do NOT use this function on arrays, it would only compare
1121 * the first element!
1092 */ 1122 */
1093#define GNUNET_memcmp(a, b) \ 1123#define GNUNET_memcmp(a, b) \
1094 ({ \ 1124 ({ \
@@ -1099,6 +1129,48 @@ GNUNET_ntoh_double (double d);
1099 1129
1100 1130
1101/** 1131/**
1132 * Compare memory in @a b1 and @a b2 in constant time, suitable for private
1133 * data.
1134 *
1135 * @param b1 some buffer of size @a len
1136 * @param b2 another buffer of size @a len
1137 * @param len number of bytes in @a b1 and @a b2
1138 * @return 0 if buffers are equal,
1139 */
1140int
1141GNUNET_memcmp_ct_ (const void *b1,
1142 const void *b2,
1143 size_t len);
1144
1145/**
1146 * Compare memory in @a a and @a b in constant time, suitable for private
1147 * data. Both @a a and @a b must be of the same pointer type.
1148 *
1149 * Do NOT use this function on arrays, it would only compare
1150 * the first element!
1151 */
1152#define GNUNET_memcmp_priv(a, b) \
1153 ({ \
1154 const typeof (*b) * _a = (a); \
1155 const typeof (*a) * _b = (b); \
1156 GNUNET_memcmp_ct_ (_a, _b, sizeof(*a)); \
1157 })
1158
1159
1160/**
1161 * Check that memory in @a a is all zeros. @a a must be a pointer.
1162 *
1163 * @param a pointer to @a n bytes which should be tested for the
1164 * entire memory being zero'ed out.
1165 * @param n number of bytes in @a to be tested
1166 * @return 0 if a is zero, non-zero otherwise
1167 */
1168int
1169GNUNET_is_zero_ (const void *a,
1170 size_t n);
1171
1172
1173/**
1102 * Check that memory in @a a is all zeros. @a a must be a pointer. 1174 * Check that memory in @a a is all zeros. @a a must be a pointer.
1103 * 1175 *
1104 * @param a pointer to a struct which should be tested for the 1176 * @param a pointer to a struct which should be tested for the
@@ -1106,10 +1178,7 @@ GNUNET_ntoh_double (double d);
1106 * @return 0 if a is zero, non-zero otherwise 1178 * @return 0 if a is zero, non-zero otherwise
1107 */ 1179 */
1108#define GNUNET_is_zero(a) \ 1180#define GNUNET_is_zero(a) \
1109 ({ \ 1181 GNUNET_is_zero_ (a, sizeof (*a))
1110 static const typeof (*a) _z; \
1111 memcmp ((a), &_z, sizeof(_z)); \
1112 })
1113 1182
1114 1183
1115/** 1184/**
@@ -1140,7 +1209,10 @@ GNUNET_ntoh_double (double d);
1140 * @param n number of elements in the array 1209 * @param n number of elements in the array
1141 * @param type name of the struct or union, i.e. pass 'struct Foo'. 1210 * @param type name of the struct or union, i.e. pass 'struct Foo'.
1142 */ 1211 */
1143#define GNUNET_new_array(n, type) (type *) GNUNET_malloc ((n) * sizeof(type)) 1212#define GNUNET_new_array(n, type) ({ \
1213 GNUNET_assert (SIZE_MAX / sizeof (type) >= n); \
1214 (type *) GNUNET_malloc ((n) * sizeof(type)); \
1215 })
1144 1216
1145/** 1217/**
1146 * @ingroup memory 1218 * @ingroup memory
@@ -1215,12 +1287,26 @@ GNUNET_ntoh_double (double d);
1215 * @ingroup memory 1287 * @ingroup memory
1216 * Wrapper around free. Frees the memory referred to by ptr. 1288 * Wrapper around free. Frees the memory referred to by ptr.
1217 * Note that it is generally better to free memory that was 1289 * Note that it is generally better to free memory that was
1290 * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_free_nz.
1291 *
1292 * @param ptr location where to free the memory. ptr must have
1293 * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier.
1294 */
1295#define GNUNET_free_nz(ptr) GNUNET_xfree_ (ptr, __FILE__, __LINE__)
1296
1297/**
1298 * @ingroup memory
1299 * Wrapper around free. Frees the memory referred to by ptr and sets ptr to NULL.
1300 * Note that it is generally better to free memory that was
1218 * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_free. 1301 * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_free.
1219 * 1302 *
1220 * @param ptr location where to free the memory. ptr must have 1303 * @param ptr location where to free the memory. ptr must have
1221 * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier. 1304 * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier.
1222 */ 1305 */
1223#define GNUNET_free(ptr) GNUNET_xfree_ (ptr, __FILE__, __LINE__) 1306#define GNUNET_free(ptr) do { \
1307 GNUNET_xfree_ (ptr, __FILE__, __LINE__); \
1308 ptr = NULL; \
1309} while (0)
1224 1310
1225/** 1311/**
1226 * @ingroup memory 1312 * @ingroup memory
@@ -1233,7 +1319,7 @@ GNUNET_ntoh_double (double d);
1233 do \ 1319 do \
1234 { \ 1320 { \
1235 void *__x__ = ptr; \ 1321 void *__x__ = ptr; \
1236 if (__x__ != NULL) \ 1322 if (NULL != __x__) \
1237 { \ 1323 { \
1238 GNUNET_free (__x__); \ 1324 GNUNET_free (__x__); \
1239 } \ 1325 } \
@@ -1306,22 +1392,58 @@ GNUNET_ntoh_double (double d);
1306 1392
1307/** 1393/**
1308 * @ingroup memory 1394 * @ingroup memory
1309 * Append an element to a list (growing the list by one). 1395 * Append an element to an array (growing the array by one).
1310 * 1396 *
1311 * @param arr base-pointer of the vector, may be NULL if size is 0; 1397 * @param arr base-pointer of the vector, may be NULL if @a len is 0;
1312 * will be updated to reflect the new address. The TYPE of 1398 * will be updated to reflect the new address. The TYPE of
1313 * arr is important since size is the number of elements and 1399 * arr is important since size is the number of elements and
1314 * not the size in bytes 1400 * not the size in bytes
1315 * @param size the number of elements in the existing vector (number 1401 * @param len the number of elements in the existing vector (number
1316 * of elements to copy over), will be updated with the new 1402 * of elements to copy over), will be updated with the new
1317 * array size 1403 * array length
1318 * @param element the element that will be appended to the array 1404 * @param element the element that will be appended to the array
1319 */ 1405 */
1320#define GNUNET_array_append(arr, size, element) \ 1406#define GNUNET_array_append(arr, len, element) \
1407 do \
1408 { \
1409 GNUNET_assert ((len) + 1 > (len)); \
1410 GNUNET_array_grow (arr, len, len + 1); \
1411 (arr) [len - 1] = element; \
1412 } while (0)
1413
1414
1415/**
1416 * @ingroup memory
1417 * Append @a arr2 to @a arr1 (growing @a arr1
1418 * as needed). The @a arr2 array is left unchanged. Naturally
1419 * this function performs a shallow copy. Both arrays must have
1420 * the same type for their elements.
1421 *
1422 * @param arr1 base-pointer of the vector, may be NULL if @a len is 0;
1423 * will be updated to reflect the new address. The TYPE of
1424 * arr is important since size is the number of elements and
1425 * not the size in bytes
1426 * @param len1 the number of elements in the existing vector (number
1427 * of elements to copy over), will be updated with the new
1428 * array size
1429 * @param arr2 base-pointer a second array to concatenate, may be NULL if @a len2 is 0;
1430 * will be updated to reflect the new address. The TYPE of
1431 * arr is important since size is the number of elements and
1432 * not the size in bytes
1433 * @param len the number of elements in the existing vector (number
1434 * of elements to copy over), will be updated with the new
1435 * array size
1436
1437 */
1438#define GNUNET_array_concatenate(arr1, len1, arr2, len2) \
1321 do \ 1439 do \
1322 { \ 1440 { \
1323 GNUNET_array_grow (arr, size, size + 1); \ 1441 const typeof (*arr2) * _a1 = (arr1); \
1324 (arr) [size - 1] = element; \ 1442 const typeof (*arr1) * _a2 = (arr2); \
1443 GNUNET_assert ((len1) + (len2) >= (len1)); \
1444 GNUNET_assert (SIZE_MAX / sizeof (*_a1) >= ((len1) + (len2))); \
1445 GNUNET_array_grow (arr1, len1, (len1) + (len2)); \
1446 memcpy (&(arr1) [(len1) - (len2)], _a2, (len2) * sizeof (*arr1)); \
1325 } while (0) 1447 } while (0)
1326 1448
1327/** 1449/**
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index a119a6632..f3325a064 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -789,7 +789,8 @@ typedef int (*GNUNET_CONTAINER_MulitHashMapIteratorCallback) (
789 * @return NULL on error 789 * @return NULL on error
790 */ 790 */
791struct GNUNET_CONTAINER_MultiHashMap * 791struct GNUNET_CONTAINER_MultiHashMap *
792GNUNET_CONTAINER_multihashmap_create (unsigned int len, int do_not_copy_keys); 792GNUNET_CONTAINER_multihashmap_create (unsigned int len,
793 int do_not_copy_keys);
793 794
794 795
795/** 796/**
@@ -800,8 +801,8 @@ GNUNET_CONTAINER_multihashmap_create (unsigned int len, int do_not_copy_keys);
800 * @param map the map 801 * @param map the map
801 */ 802 */
802void 803void
803GNUNET_CONTAINER_multihashmap_destroy ( 804GNUNET_CONTAINER_multihashmap_destroy (struct
804 struct GNUNET_CONTAINER_MultiHashMap *map); 805 GNUNET_CONTAINER_MultiHashMap *map);
805 806
806 807
807/** 808/**
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 00fe3fbef..a5a50e749 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -183,7 +183,9 @@ struct GNUNET_CRYPTO_EcdsaSignature
183 183
184/** 184/**
185 * Public ECC key (always for curve Ed25519) encoded in a format 185 * Public ECC key (always for curve Ed25519) encoded in a format
186 * suitable for network transmission and EdDSA signatures. 186 * suitable for network transmission and EdDSA signatures. Refer
187 * to section 5.1.3 of rfc8032, for a thorough explanation of how
188 * this value maps to the x- and y-coordinates.
187 */ 189 */
188struct GNUNET_CRYPTO_EddsaPublicKey 190struct GNUNET_CRYPTO_EddsaPublicKey
189{ 191{
@@ -1208,40 +1210,44 @@ GNUNET_CRYPTO_eddsa_public_key_from_string (
1208 1210
1209/** 1211/**
1210 * @ingroup crypto 1212 * @ingroup crypto
1211 * Create a new private key by reading it from a file. If the 1213 * @brief Create a new private key by reading it from a file.
1212 * files does not exist, create a new key and write it to the 1214 *
1213 * file. Caller must free return value. Note that this function 1215 * If the files does not exist and @a do_create is set, creates a new key and
1214 * can not guarantee that another process might not be trying 1216 * write it to the file.
1215 * the same operation on the same file at the same time. 1217 *
1216 * If the contents of the file 1218 * If the contents of the file are invalid, an error is returned.
1217 * are invalid the old file is deleted and a fresh key is
1218 * created.
1219 * 1219 *
1220 * @param filename name of file to use to store the key 1220 * @param filename name of file to use to store the key
1221 * @return new private key, NULL on error (for example, 1221 * @param do_create should a file be created?
1222 * permission denied); free using #GNUNET_free 1222 * @param[out] pkey set to the private key from @a filename on success
1223 * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but
1224 * we found an existing file, #GNUNET_SYSERR on failure
1223 */ 1225 */
1224struct GNUNET_CRYPTO_EcdsaPrivateKey * 1226int
1225GNUNET_CRYPTO_ecdsa_key_create_from_file (const char *filename); 1227GNUNET_CRYPTO_ecdsa_key_from_file (const char *filename,
1228 int do_create,
1229 struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey);
1226 1230
1227 1231
1228/** 1232/**
1229 * @ingroup crypto 1233 * @ingroup crypto
1230 * Create a new private key by reading it from a file. If the 1234 * @brief Create a new private key by reading it from a file.
1231 * files does not exist, create a new key and write it to the 1235 *
1232 * file. Caller must free return value. Note that this function 1236 * If the files does not exist and @a do_create is set, creates a new key and
1233 * can not guarantee that another process might not be trying 1237 * write it to the file.
1234 * the same operation on the same file at the same time. 1238 *
1235 * If the contents of the file 1239 * If the contents of the file are invalid, an error is returned.
1236 * are invalid the old file is deleted and a fresh key is
1237 * created.
1238 * 1240 *
1239 * @param filename name of file to use to store the key 1241 * @param filename name of file to use to store the key
1240 * @return new private key, NULL on error (for example, 1242 * @param do_create should a file be created?
1241 * permission denied); free using #GNUNET_free 1243 * @param[out] pkey set to the private key from @a filename on success
1244 * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but
1245 * we found an existing file, #GNUNET_SYSERR on failure
1242 */ 1246 */
1243struct GNUNET_CRYPTO_EddsaPrivateKey * 1247int
1244GNUNET_CRYPTO_eddsa_key_create_from_file (const char *filename); 1248GNUNET_CRYPTO_eddsa_key_from_file (const char *filename,
1249 int do_create,
1250 struct GNUNET_CRYPTO_EddsaPrivateKey *pkey);
1245 1251
1246 1252
1247/** 1253/**
@@ -1266,22 +1272,22 @@ GNUNET_CRYPTO_eddsa_key_create_from_configuration (
1266 1272
1267/** 1273/**
1268 * @ingroup crypto 1274 * @ingroup crypto
1269 * Create a new private key. Caller must free return value. 1275 * Create a new private key.
1270 * 1276 *
1271 * @return fresh private key; free using #GNUNET_free 1277 * @param[out] pk private key to initialize
1272 */ 1278 */
1273struct GNUNET_CRYPTO_EcdsaPrivateKey * 1279void
1274GNUNET_CRYPTO_ecdsa_key_create (void); 1280GNUNET_CRYPTO_ecdsa_key_create (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk);
1275 1281
1276 1282
1277/** 1283/**
1278 * @ingroup crypto 1284 * @ingroup crypto
1279 * Create a new private key. Caller must free return value. 1285 * Create a new private key.
1280 * 1286 *
1281 * @return fresh private key; free using #GNUNET_free 1287 * @param[out] pk private key to initialize
1282 */ 1288 */
1283struct GNUNET_CRYPTO_EddsaPrivateKey * 1289void
1284GNUNET_CRYPTO_eddsa_key_create (void); 1290GNUNET_CRYPTO_eddsa_key_create (struct GNUNET_CRYPTO_EddsaPrivateKey *pk);
1285 1291
1286 1292
1287/** 1293/**
@@ -1289,20 +1295,9 @@ GNUNET_CRYPTO_eddsa_key_create (void);
1289 * Create a new private key. Clear with #GNUNET_CRYPTO_ecdhe_key_clear(). 1295 * Create a new private key. Clear with #GNUNET_CRYPTO_ecdhe_key_clear().
1290 * 1296 *
1291 * @param[out] pk set to fresh private key; 1297 * @param[out] pk set to fresh private key;
1292 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
1293 */ 1298 */
1294int 1299void
1295GNUNET_CRYPTO_ecdhe_key_create2 (struct GNUNET_CRYPTO_EcdhePrivateKey *pk); 1300GNUNET_CRYPTO_ecdhe_key_create (struct GNUNET_CRYPTO_EcdhePrivateKey *pk);
1296
1297
1298/**
1299 * @ingroup crypto
1300 * Create a new private key. Caller must free return value.
1301 *
1302 * @return fresh private key; free using #GNUNET_free
1303 */
1304struct GNUNET_CRYPTO_EcdhePrivateKey *
1305GNUNET_CRYPTO_ecdhe_key_create (void);
1306 1301
1307 1302
1308/** 1303/**
@@ -1637,15 +1632,21 @@ GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1637 1632
1638/** 1633/**
1639 * @ingroup crypto 1634 * @ingroup crypto
1640 * EdDSA sign a given block. 1635 * @brief EdDSA sign a given block.
1636 *
1637 * The @a purpose data is the beginning of the data of which the signature is
1638 * to be created. The `size` field in @a purpose must correctly indicate the
1639 * number of bytes of the data structure, including its header. If possible,
1640 * use #GNUNET_CRYPTO_eddsa_sign() instead of this function (only if @a validate
1641 * is not fixed-size, you must use this function directly).
1641 * 1642 *
1642 * @param priv private key to use for the signing 1643 * @param priv private key to use for the signing
1643 * @param purpose what to sign (size, purpose) 1644 * @param purpose what to sign (size, purpose)
1644 * @param sig where to write the signature 1645 * @param[out] sig where to write the signature
1645 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 1646 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
1646 */ 1647 */
1647int 1648int
1648GNUNET_CRYPTO_eddsa_sign ( 1649GNUNET_CRYPTO_eddsa_sign_ (
1649 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, 1650 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1650 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, 1651 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
1651 struct GNUNET_CRYPTO_EddsaSignature *sig); 1652 struct GNUNET_CRYPTO_EddsaSignature *sig);
@@ -1653,22 +1654,87 @@ GNUNET_CRYPTO_eddsa_sign (
1653 1654
1654/** 1655/**
1655 * @ingroup crypto 1656 * @ingroup crypto
1656 * ECDSA Sign a given block. 1657 * @brief EdDSA sign a given block.
1658 *
1659 * The @a ps data must be a fixed-size struct for which the signature is to be
1660 * created. The `size` field in @a ps->purpose must correctly indicate the
1661 * number of bytes of the data structure, including its header.
1662 *
1663 * @param priv private key to use for the signing
1664 * @param ps packed struct with what to sign, MUST begin with a purpose
1665 * @param[out] sig where to write the signature
1666 */
1667#define GNUNET_CRYPTO_eddsa_sign(priv,ps,sig) do { \
1668 /* check size is set correctly */ \
1669 GNUNET_assert (htonl ((ps)->purpose.size) == sizeof (*ps)); \
1670 /* check 'ps' begins with the purpose */ \
1671 GNUNET_static_assert (((void*) (ps)) == \
1672 ((void*) &(ps)->purpose)); \
1673 GNUNET_assert (GNUNET_OK == \
1674 GNUNET_CRYPTO_eddsa_sign_ (priv, \
1675 &(ps)->purpose, \
1676 sig)); \
1677} while (0)
1678
1679
1680/**
1681 * @ingroup crypto
1682 * @brief ECDSA Sign a given block.
1683 *
1684 * The @a purpose data is the beginning of the data of which the signature is
1685 * to be created. The `size` field in @a purpose must correctly indicate the
1686 * number of bytes of the data structure, including its header. If possible,
1687 * use #GNUNET_CRYPTO_ecdsa_sign() instead of this function (only if @a validate
1688 * is not fixed-size, you must use this function directly).
1657 * 1689 *
1658 * @param priv private key to use for the signing 1690 * @param priv private key to use for the signing
1659 * @param purpose what to sign (size, purpose) 1691 * @param purpose what to sign (size, purpose)
1660 * @param sig where to write the signature 1692 * @param[out] sig where to write the signature
1661 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 1693 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
1662 */ 1694 */
1663int 1695int
1664GNUNET_CRYPTO_ecdsa_sign ( 1696GNUNET_CRYPTO_ecdsa_sign_ (
1665 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, 1697 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1666 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, 1698 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
1667 struct GNUNET_CRYPTO_EcdsaSignature *sig); 1699 struct GNUNET_CRYPTO_EcdsaSignature *sig);
1668 1700
1701
1669/** 1702/**
1670 * @ingroup crypto 1703 * @ingroup crypto
1671 * Verify EdDSA signature. 1704 * @brief ECDSA sign a given block.
1705 *
1706 * The @a ps data must be a fixed-size struct for which the signature is to be
1707 * created. The `size` field in @a ps->purpose must correctly indicate the
1708 * number of bytes of the data structure, including its header.
1709 *
1710 * @param priv private key to use for the signing
1711 * @param ps packed struct with what to sign, MUST begin with a purpose
1712 * @param[out] sig where to write the signature
1713 */
1714#define GNUNET_CRYPTO_ecdsa_sign(priv,ps,sig) do { \
1715 /* check size is set correctly */ \
1716 GNUNET_assert (htonl ((ps)->purpose.size) == sizeof (*(ps))); \
1717 /* check 'ps' begins with the purpose */ \
1718 GNUNET_static_assert (((void*) (ps)) == \
1719 ((void*) &(ps)->purpose)); \
1720 GNUNET_assert (GNUNET_OK == \
1721 GNUNET_CRYPTO_ecdsa_sign_ (priv, \
1722 &(ps)->purpose, \
1723 sig)); \
1724} while (0)
1725
1726
1727/**
1728 * @ingroup crypto
1729 * @brief Verify EdDSA signature.
1730 *
1731 * The @a validate data is the beginning of the data of which the signature
1732 * is to be verified. The `size` field in @a validate must correctly indicate
1733 * the number of bytes of the data structure, including its header. If @a
1734 * purpose does not match the purpose given in @a validate (the latter must be
1735 * in big endian), signature verification fails. If possible,
1736 * use #GNUNET_CRYPTO_eddsa_verify() instead of this function (only if @a validate
1737 * is not fixed-size, you must use this function directly).
1672 * 1738 *
1673 * @param purpose what is the purpose that the signature should have? 1739 * @param purpose what is the purpose that the signature should have?
1674 * @param validate block to validate (size, purpose, data) 1740 * @param validate block to validate (size, purpose, data)
@@ -1677,7 +1743,7 @@ GNUNET_CRYPTO_ecdsa_sign (
1677 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid 1743 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
1678 */ 1744 */
1679int 1745int
1680GNUNET_CRYPTO_eddsa_verify ( 1746GNUNET_CRYPTO_eddsa_verify_ (
1681 uint32_t purpose, 1747 uint32_t purpose,
1682 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, 1748 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
1683 const struct GNUNET_CRYPTO_EddsaSignature *sig, 1749 const struct GNUNET_CRYPTO_EddsaSignature *sig,
@@ -1686,7 +1752,42 @@ GNUNET_CRYPTO_eddsa_verify (
1686 1752
1687/** 1753/**
1688 * @ingroup crypto 1754 * @ingroup crypto
1689 * Verify ECDSA signature. 1755 * @brief Verify EdDSA signature.
1756 *
1757 * The @a ps data must be a fixed-size struct for which the signature is to be
1758 * created. The `size` field in @a ps->purpose must correctly indicate the
1759 * number of bytes of the data structure, including its header.
1760 *
1761 * @param purp purpose of the signature, must match 'ps->purpose.purpose'
1762 * (except in host byte order)
1763 * @param priv private key to use for the signing
1764 * @param ps packed struct with what to sign, MUST begin with a purpose
1765 * @param sig where to write the signature
1766 */
1767#define GNUNET_CRYPTO_eddsa_verify(purp,ps,sig,pub) ({ \
1768 /* check size is set correctly */ \
1769 GNUNET_assert (htonl ((ps)->purpose.size) == sizeof (*(ps))); \
1770 /* check 'ps' begins with the purpose */ \
1771 GNUNET_static_assert (((void*) (ps)) == \
1772 ((void*) &(ps)->purpose)); \
1773 GNUNET_CRYPTO_eddsa_verify_ (purp, \
1774 &(ps)->purpose, \
1775 sig, \
1776 pub); \
1777 })
1778
1779
1780/**
1781 * @ingroup crypto
1782 * @brief Verify ECDSA signature.
1783 *
1784 * The @a validate data is the beginning of the data of which the signature is
1785 * to be verified. The `size` field in @a validate must correctly indicate the
1786 * number of bytes of the data structure, including its header. If @a purpose
1787 * does not match the purpose given in @a validate (the latter must be in big
1788 * endian), signature verification fails. If possible, use
1789 * #GNUNET_CRYPTO_eddsa_verify() instead of this function (only if @a validate
1790 * is not fixed-size, you must use this function directly).
1690 * 1791 *
1691 * @param purpose what is the purpose that the signature should have? 1792 * @param purpose what is the purpose that the signature should have?
1692 * @param validate block to validate (size, purpose, data) 1793 * @param validate block to validate (size, purpose, data)
@@ -1695,7 +1796,7 @@ GNUNET_CRYPTO_eddsa_verify (
1695 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid 1796 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
1696 */ 1797 */
1697int 1798int
1698GNUNET_CRYPTO_ecdsa_verify ( 1799GNUNET_CRYPTO_ecdsa_verify_ (
1699 uint32_t purpose, 1800 uint32_t purpose,
1700 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, 1801 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
1701 const struct GNUNET_CRYPTO_EcdsaSignature *sig, 1802 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
@@ -1704,6 +1805,32 @@ GNUNET_CRYPTO_ecdsa_verify (
1704 1805
1705/** 1806/**
1706 * @ingroup crypto 1807 * @ingroup crypto
1808 * @brief Verify ECDSA signature.
1809 *
1810 * The @a ps data must be a fixed-size struct for which the signature is to be
1811 * created. The `size` field in @a ps->purpose must correctly indicate the
1812 * number of bytes of the data structure, including its header.
1813 *
1814 * @param purp purpose of the signature, must match 'ps->purpose.purpose'
1815 * (except in host byte order)
1816 * @param priv private key to use for the signing
1817 * @param ps packed struct with what to sign, MUST begin with a purpose
1818 * @param sig where to write the signature
1819 */
1820#define GNUNET_CRYPTO_ecdsa_verify(purp,ps,sig,pub) ({ \
1821 /* check size is set correctly */ \
1822 GNUNET_assert (htonl ((ps)->purpose.size) == sizeof (*(ps))); \
1823 /* check 'ps' begins with the purpose */ \
1824 GNUNET_static_assert (((void*) (ps)) == \
1825 ((void*) &(ps)->purpose)); \
1826 GNUNET_CRYPTO_ecdsa_verify_ (purp, \
1827 &(ps)->purpose, \
1828 sig, \
1829 pub); \
1830 })
1831
1832/**
1833 * @ingroup crypto
1707 * Derive a private key from a given private key and a label. 1834 * Derive a private key from a given private key and a label.
1708 * Essentially calculates a private key 'h = H(l,P) * d mod n' 1835 * Essentially calculates a private key 'h = H(l,P) * d mod n'
1709 * where n is the size of the ECC group and P is the public 1836 * where n is the size of the ECC group and P is the public
@@ -1908,7 +2035,7 @@ GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key);
1908size_t 2035size_t
1909GNUNET_CRYPTO_rsa_private_key_encode ( 2036GNUNET_CRYPTO_rsa_private_key_encode (
1910 const struct GNUNET_CRYPTO_RsaPrivateKey *key, 2037 const struct GNUNET_CRYPTO_RsaPrivateKey *key,
1911 char **buffer); 2038 void **buffer);
1912 2039
1913 2040
1914/** 2041/**
@@ -1916,11 +2043,12 @@ GNUNET_CRYPTO_rsa_private_key_encode (
1916 * to the "normal", internal format. 2043 * to the "normal", internal format.
1917 * 2044 *
1918 * @param buf the buffer where the private key data is stored 2045 * @param buf the buffer where the private key data is stored
1919 * @param len the length of the data in @a buf 2046 * @param buf_size the size of the data in @a buf
1920 * @return NULL on error 2047 * @return NULL on error
1921 */ 2048 */
1922struct GNUNET_CRYPTO_RsaPrivateKey * 2049struct GNUNET_CRYPTO_RsaPrivateKey *
1923GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, size_t len); 2050GNUNET_CRYPTO_rsa_private_key_decode (const void *buf,
2051 size_t buf_size);
1924 2052
1925 2053
1926/** 2054/**
@@ -1986,7 +2114,7 @@ GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_RsaPublicKey *key);
1986size_t 2114size_t
1987GNUNET_CRYPTO_rsa_public_key_encode ( 2115GNUNET_CRYPTO_rsa_public_key_encode (
1988 const struct GNUNET_CRYPTO_RsaPublicKey *key, 2116 const struct GNUNET_CRYPTO_RsaPublicKey *key,
1989 char **buffer); 2117 void **buffer);
1990 2118
1991 2119
1992/** 2120/**
@@ -2060,7 +2188,7 @@ int
2060GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, 2188GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash,
2061 const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, 2189 const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
2062 struct GNUNET_CRYPTO_RsaPublicKey *pkey, 2190 struct GNUNET_CRYPTO_RsaPublicKey *pkey,
2063 char **buf, 2191 void **buf,
2064 size_t *buf_size); 2192 size_t *buf_size);
2065 2193
2066 2194
@@ -2109,7 +2237,7 @@ GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_RsaSignature *sig);
2109size_t 2237size_t
2110GNUNET_CRYPTO_rsa_signature_encode ( 2238GNUNET_CRYPTO_rsa_signature_encode (
2111 const struct GNUNET_CRYPTO_RsaSignature *sig, 2239 const struct GNUNET_CRYPTO_RsaSignature *sig,
2112 char **buffer); 2240 void **buffer);
2113 2241
2114 2242
2115/** 2243/**
@@ -2117,11 +2245,12 @@ GNUNET_CRYPTO_rsa_signature_encode (
2117 * format. 2245 * format.
2118 * 2246 *
2119 * @param buf the buffer where the public key data is stored 2247 * @param buf the buffer where the public key data is stored
2120 * @param len the length of the data in @a buf 2248 * @param buf_size the number of bytes of the data in @a buf
2121 * @return NULL on error 2249 * @return NULL on error
2122 */ 2250 */
2123struct GNUNET_CRYPTO_RsaSignature * 2251struct GNUNET_CRYPTO_RsaSignature *
2124GNUNET_CRYPTO_rsa_signature_decode (const char *buf, size_t len); 2252GNUNET_CRYPTO_rsa_signature_decode (const void *buf,
2253 size_t buf_size);
2125 2254
2126 2255
2127/** 2256/**
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h
index 8e981e91e..875cfa3bd 100644
--- a/src/include/gnunet_curl_lib.h
+++ b/src/include/gnunet_curl_lib.h
@@ -360,8 +360,21 @@ GNUNET_CURL_gnunet_scheduler_reschedule (void *cls);
360 * @param header_name name of the header to send. 360 * @param header_name name of the header to send.
361 */ 361 */
362void 362void
363GNUNET_CURL_enable_async_scope_header (struct GNUNET_CURL_Context *ctx, const 363GNUNET_CURL_enable_async_scope_header (struct GNUNET_CURL_Context *ctx,
364 char *header_name); 364 const char *header_name);
365
366
367/**
368 * Return #GNUNET_YES if given a valid scope ID and
369 * #GNUNET_NO otherwise. See
370 * #GNUNET_CURL_enable_async_scope_header() for the
371 * code that generates such a @a scope_id in an HTTP
372 * header.
373 *
374 * @returns #GNUNET_YES iff given a valid scope ID
375 */
376int
377GNUNET_CURL_is_valid_scope_id (const char *scope_id);
365 378
366 379
367#endif 380#endif
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h
index b79be5f70..f43cf8943 100644
--- a/src/include/gnunet_disk_lib.h
+++ b/src/include/gnunet_disk_lib.h
@@ -691,35 +691,6 @@ GNUNET_DISK_directory_create (const char *dir);
691 691
692 692
693/** 693/**
694 * Lock a part of a file.
695 *
696 * @param fh file handle
697 * @param lock_start absolute position from where to lock
698 * @param lock_end absolute position until where to lock
699 * @param excl #GNUNET_YES for an exclusive lock
700 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
701 */
702int
703GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh,
704 off_t lock_start,
705 off_t lock_end, int excl);
706
707
708/**
709 * Unlock a part of a file.
710 *
711 * @param fh file handle
712 * @param unlock_start absolute position from where to unlock
713 * @param unlock_end absolute position until where to unlock
714 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
715 */
716int
717GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh,
718 off_t unlock_start,
719 off_t unlock_end);
720
721
722/**
723 * @brief Removes special characters as ':' from a filename. 694 * @brief Removes special characters as ':' from a filename.
724 * @param fn the filename to canonicalize 695 * @param fn the filename to canonicalize
725 */ 696 */
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index 797c71380..c976c89c5 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -95,7 +95,7 @@ extern "C" {
95/** 95/**
96 * Record type for identity attributes (of RECLAIM). 96 * Record type for identity attributes (of RECLAIM).
97 */ 97 */
98#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR 65544 98#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE 65544
99 99
100/** 100/**
101 * Record type for local ticket references 101 * Record type for local ticket references
@@ -123,7 +123,7 @@ extern "C" {
123/** 123/**
124 * Record type for reclaim records 124 * Record type for reclaim records
125 */ 125 */
126#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF 65550 126#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF 65550
127 127
128/** 128/**
129 * Record type for RECLAIM master 129 * Record type for RECLAIM master
@@ -141,14 +141,14 @@ extern "C" {
141#define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553 141#define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553
142 142
143/** 143/**
144 * Record type for reclaim identity attestation 144 * Record type for an attribute attestation
145 */ 145 */
146#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR 65554 146#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION 65554
147 147
148/** 148/**
149 * Record type for reclaim identity references 149 * Record type for an attestation reference in a ticket
150 */ 150 */
151#define GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE 65555 151#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF 65555
152 152
153 153
154/** 154/**
@@ -168,10 +168,9 @@ enum GNUNET_GNSRECORD_Flags
168 GNUNET_GNSRECORD_RF_PRIVATE = 2, 168 GNUNET_GNSRECORD_RF_PRIVATE = 2,
169 169
170 /** 170 /**
171 * This flag is currently unused; former RF_PENDING flag 171 * This is a supplemental record.
172 *
173 * GNUNET_GNSRECORD_RF_UNUSED = 4,
174 */ 172 */
173 GNUNET_GNSRECORD_RF_SUPPLEMENTAL = 4,
175 174
176 /** 175 /**
177 * This expiration time of the record is a relative 176 * This expiration time of the record is a relative
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h
index 674176e0e..81af671e2 100644
--- a/src/include/gnunet_identity_service.h
+++ b/src/include/gnunet_identity_service.h
@@ -99,7 +99,7 @@ GNUNET_IDENTITY_ego_get_anonymous (void);
99 * @param pk set to ego's public key 99 * @param pk set to ego's public key
100 */ 100 */
101void 101void
102GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego, 102GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
103 struct GNUNET_CRYPTO_EcdsaPublicKey *pk); 103 struct GNUNET_CRYPTO_EcdsaPublicKey *pk);
104 104
105 105
@@ -137,10 +137,11 @@ GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
137 * NULL if the user just deleted the ego and it 137 * NULL if the user just deleted the ego and it
138 * must thus no longer be used 138 * must thus no longer be used
139 */ 139 */
140typedef void (*GNUNET_IDENTITY_Callback) (void *cls, 140typedef void
141 struct GNUNET_IDENTITY_Ego *ego, 141(*GNUNET_IDENTITY_Callback) (void *cls,
142 void **ctx, 142 struct GNUNET_IDENTITY_Ego *ego,
143 const char *name); 143 void **ctx,
144 const char *name);
144 145
145 146
146/** 147/**
@@ -180,7 +181,9 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id,
180 * @param cls closure 181 * @param cls closure
181 * @param emsg NULL on success, otherwise an error message 182 * @param emsg NULL on success, otherwise an error message
182 */ 183 */
183typedef void (*GNUNET_IDENTITY_Continuation) (void *cls, const char *emsg); 184typedef void
185(*GNUNET_IDENTITY_Continuation) (void *cls,
186 const char *emsg);
184 187
185 188
186/** 189/**
@@ -218,7 +221,8 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h);
218 * @param pk private key, NULL on error 221 * @param pk private key, NULL on error
219 * @param emsg error message, NULL on success 222 * @param emsg error message, NULL on success
220 */ 223 */
221typedef void (*GNUNET_IDENTITY_CreateContinuation) ( 224typedef void
225(*GNUNET_IDENTITY_CreateContinuation) (
222 void *cls, 226 void *cls,
223 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 227 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk,
224 const char *emsg); 228 const char *emsg);
@@ -294,9 +298,9 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op);
294 * @param cls closure 298 * @param cls closure
295 * @param ego NULL on error / ego not found 299 * @param ego NULL on error / ego not found
296 */ 300 */
297typedef void (*GNUNET_IDENTITY_EgoCallback) ( 301typedef void
298 void *cls, 302(*GNUNET_IDENTITY_EgoCallback) (void *cls,
299 const struct GNUNET_IDENTITY_Ego *ego); 303 struct GNUNET_IDENTITY_Ego *ego);
300 304
301/** 305/**
302 * Handle for ego lookup. 306 * Handle for ego lookup.
@@ -335,7 +339,8 @@ GNUNET_IDENTITY_ego_lookup_cancel (struct GNUNET_IDENTITY_EgoLookup *el);
335 * @param ego NULL on error / ego not found 339 * @param ego NULL on error / ego not found
336 * @param ego_name NULL on error, name of the ego otherwise 340 * @param ego_name NULL on error, name of the ego otherwise
337 */ 341 */
338typedef void (*GNUNET_IDENTITY_EgoSuffixCallback) ( 342typedef void
343(*GNUNET_IDENTITY_EgoSuffixCallback) (
339 void *cls, 344 void *cls,
340 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, 345 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
341 const char *ego_name); 346 const char *ego_name);
@@ -373,8 +378,9 @@ GNUNET_IDENTITY_ego_lookup_by_suffix (const struct
373 * @param el handle for lookup to abort 378 * @param el handle for lookup to abort
374 */ 379 */
375void 380void
376GNUNET_IDENTITY_ego_lookup_by_suffix_cancel (struct 381GNUNET_IDENTITY_ego_lookup_by_suffix_cancel (
377 GNUNET_IDENTITY_EgoSuffixLookup *el); 382 struct GNUNET_IDENTITY_EgoSuffixLookup *el);
383
378 384
379#if 0 /* keep Emacsens' auto-indent happy */ 385#if 0 /* keep Emacsens' auto-indent happy */
380{ 386{
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h
index 064f38c9f..27996f18d 100644
--- a/src/include/gnunet_json_lib.h
+++ b/src/include/gnunet_json_lib.h
@@ -49,9 +49,10 @@ struct GNUNET_JSON_Specification;
49 * @return #GNUNET_SYSERR on error, 49 * @return #GNUNET_SYSERR on error,
50 * #GNUNET_OK on success 50 * #GNUNET_OK on success
51 */ 51 */
52typedef int (*GNUNET_JSON_Parser) (void *cls, 52typedef int
53 json_t *root, 53(*GNUNET_JSON_Parser) (void *cls,
54 struct GNUNET_JSON_Specification *spec); 54 json_t *root,
55 struct GNUNET_JSON_Specification *spec);
55 56
56 57
57/** 58/**
@@ -60,8 +61,9 @@ typedef int (*GNUNET_JSON_Parser) (void *cls,
60 * @param cls closure 61 * @param cls closure
61 * @param spec our specification entry with data to clean. 62 * @param spec our specification entry with data to clean.
62 */ 63 */
63typedef void (*GNUNET_JSON_Cleaner) (void *cls, 64typedef void
64 struct GNUNET_JSON_Specification *spec); 65(*GNUNET_JSON_Cleaner) (void *cls,
66 struct GNUNET_JSON_Specification *spec);
65 67
66 68
67/** 69/**
@@ -217,13 +219,25 @@ GNUNET_JSON_spec_json (const char *name, json_t **jsonp);
217 219
218 220
219/** 221/**
222 * boolean.
223 *
224 * @param name name of the JSON field
225 * @param[out] b where to store the boolean found under @a name
226 */
227struct GNUNET_JSON_Specification
228GNUNET_JSON_spec_bool (const char *name,
229 bool *b);
230
231
232/**
220 * 8-bit integer. 233 * 8-bit integer.
221 * 234 *
222 * @param name name of the JSON field 235 * @param name name of the JSON field
223 * @param[out] u8 where to store the integer found under @a name 236 * @param[out] u8 where to store the integer found under @a name
224 */ 237 */
225struct GNUNET_JSON_Specification 238struct GNUNET_JSON_Specification
226GNUNET_JSON_spec_uint8 (const char *name, uint8_t *u8); 239GNUNET_JSON_spec_uint8 (const char *name,
240 uint8_t *u8);
227 241
228 242
229/** 243/**
@@ -233,7 +247,8 @@ GNUNET_JSON_spec_uint8 (const char *name, uint8_t *u8);
233 * @param[out] u16 where to store the integer found under @a name 247 * @param[out] u16 where to store the integer found under @a name
234 */ 248 */
235struct GNUNET_JSON_Specification 249struct GNUNET_JSON_Specification
236GNUNET_JSON_spec_uint16 (const char *name, uint16_t *u16); 250GNUNET_JSON_spec_uint16 (const char *name,
251 uint16_t *u16);
237 252
238 253
239/** 254/**
@@ -243,7 +258,8 @@ GNUNET_JSON_spec_uint16 (const char *name, uint16_t *u16);
243 * @param[out] u32 where to store the integer found under @a name 258 * @param[out] u32 where to store the integer found under @a name
244 */ 259 */
245struct GNUNET_JSON_Specification 260struct GNUNET_JSON_Specification
246GNUNET_JSON_spec_uint32 (const char *name, uint32_t *u32); 261GNUNET_JSON_spec_uint32 (const char *name,
262 uint32_t *u32);
247 263
248 264
249/** 265/**
@@ -253,7 +269,19 @@ GNUNET_JSON_spec_uint32 (const char *name, uint32_t *u32);
253 * @param[out] u64 where to store the integer found under @a name 269 * @param[out] u64 where to store the integer found under @a name
254 */ 270 */
255struct GNUNET_JSON_Specification 271struct GNUNET_JSON_Specification
256GNUNET_JSON_spec_uint64 (const char *name, uint64_t *u64); 272GNUNET_JSON_spec_uint64 (const char *name,
273 uint64_t *u64);
274
275
276/**
277 * 64-bit signed integer.
278 *
279 * @param name name of the JSON field
280 * @param[out] i64 where to store the integer found under @a name
281 */
282struct GNUNET_JSON_Specification
283GNUNET_JSON_spec_int64 (const char *name,
284 int64_t *i64);
257 285
258 286
259/** 287/**
diff --git a/src/include/gnunet_mhd_compat.h b/src/include/gnunet_mhd_compat.h
new file mode 100644
index 000000000..0cfcc6445
--- /dev/null
+++ b/src/include/gnunet_mhd_compat.h
@@ -0,0 +1,43 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020 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 Christian Grothoff
23 *
24 * @file
25 * MHD compatibility definitions for warning-less compile of
26 * our code against MHD before and after #MHD_VERSION 0x00097002.
27 */
28#include <microhttpd.h>
29
30#if MHD_VERSION >= 0x00097002
31/**
32 * Data type to use for functions return an "MHD result".
33 */
34#define MHD_RESULT enum MHD_Result
35
36#else
37
38/**
39 * Data type to use for functions return an "MHD result".
40 */
41#define MHD_RESULT int
42
43#endif
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index a7b7c57b1..bf42c8d34 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -154,24 +154,6 @@ typedef void
154 154
155 155
156/** 156/**
157 * Set the desired nick name for a zone
158 *
159 * @param h handle to the namestore
160 * @param pkey private key of the zone
161 * @param nick the nick name to set
162 * @param cont continuation to call when done
163 * @param cont_cls closure for @a cont
164 * @return handle to abort the request
165 */
166struct GNUNET_NAMESTORE_QueueEntry *
167GNUNET_NAMESTORE_set_nick (struct GNUNET_NAMESTORE_Handle *h,
168 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
169 const char *nick,
170 GNUNET_NAMESTORE_ContinuationWithStatus cont,
171 void *cont_cls);
172
173
174/**
175 * Lookup an item in the namestore. 157 * Lookup an item in the namestore.
176 * 158 *
177 * @param h handle to the namestore 159 * @param h handle to the namestore
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h
index 090e81331..ca549f77c 100644
--- a/src/include/gnunet_pq_lib.h
+++ b/src/include/gnunet_pq_lib.h
@@ -152,6 +152,16 @@ GNUNET_PQ_query_param_rsa_signature (
152 152
153 153
154/** 154/**
155 * Generate query parameter for a relative time value.
156 * The database must store a 64-bit integer.
157 *
158 * @param x pointer to the query parameter to pass
159 */
160struct GNUNET_PQ_QueryParam
161GNUNET_PQ_query_param_relative_time (const struct GNUNET_TIME_Relative *x);
162
163
164/**
155 * Generate query parameter for an absolute time value. 165 * Generate query parameter for an absolute time value.
156 * The database must store a 64-bit integer. 166 * The database must store a 64-bit integer.
157 * 167 *
@@ -377,6 +387,18 @@ GNUNET_PQ_result_spec_absolute_time (const char *name,
377 387
378 388
379/** 389/**
390 * Relative time expected.
391 *
392 * @param name name of the field in the table
393 * @param[out] rt where to store the result
394 * @return array entry for the result specification to use
395 */
396struct GNUNET_PQ_ResultSpec
397GNUNET_PQ_result_spec_relative_time (const char *name,
398 struct GNUNET_TIME_Relative *rt);
399
400
401/**
380 * Absolute time expected. 402 * Absolute time expected.
381 * 403 *
382 * @param name name of the field in the table 404 * @param name name of the field in the table
@@ -756,7 +778,7 @@ GNUNET_PQ_connect (const char *config_str,
756struct GNUNET_PQ_Context * 778struct GNUNET_PQ_Context *
757GNUNET_PQ_connect_with_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg, 779GNUNET_PQ_connect_with_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
758 const char *section, 780 const char *section,
759 const char *load_path, 781 const char *load_path_suffix,
760 const struct GNUNET_PQ_ExecuteStatement *es, 782 const struct GNUNET_PQ_ExecuteStatement *es,
761 const struct GNUNET_PQ_PreparedStatement *ps); 783 const struct GNUNET_PQ_PreparedStatement *ps);
762 784
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 8091fb367..e67e35f38 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2720,21 +2720,26 @@ extern "C" {
2720 2720
2721#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979 2721#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979
2722 2722
2723#define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_STORE 980 2723#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START 980
2724
2725#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP 981
2726
2727#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT 982
2728
2724 2729
2725/************************************************** 2730/**************************************************
2726 * 2731 *
2727 * ABD MESSAGE TYPES 2732 * ABD MESSAGE TYPES
2728 */ 2733 */
2729#define GNUNET_MESSAGE_TYPE_ABD_VERIFY 981 2734#define GNUNET_MESSAGE_TYPE_ABD_VERIFY 991
2730 2735
2731#define GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT 982 2736#define GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT 992
2732 2737
2733#define GNUNET_MESSAGE_TYPE_ABD_COLLECT 983 2738#define GNUNET_MESSAGE_TYPE_ABD_COLLECT 993
2734 2739
2735#define GNUNET_MESSAGE_TYPE_ABD_COLLECT_RESULT 984 2740#define GNUNET_MESSAGE_TYPE_ABD_COLLECT_RESULT 994
2736 2741
2737#define GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT 985 2742#define GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT 995
2738 2743
2739/******************************************************************************/ 2744/******************************************************************************/
2740 2745
diff --git a/src/include/gnunet_reclaim_attribute_plugin.h b/src/include/gnunet_reclaim_attribute_plugin.h
deleted file mode 100644
index e61cca5b2..000000000
--- a/src/include/gnunet_reclaim_attribute_plugin.h
+++ /dev/null
@@ -1,176 +0,0 @@
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 * Plugin API for reclaim attribute types
26 *
27 * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims
28 * @{
29 */
30#ifndef GNUNET_RECLAIM_ATTRIBUTE_PLUGIN_H
31#define GNUNET_RECLAIM_ATTRIBUTE_PLUGIN_H
32
33#include "gnunet_util_lib.h"
34#include "gnunet_reclaim_attribute_lib.h"
35
36#ifdef __cplusplus
37extern "C" {
38#if 0 /* keep Emacsens' auto-indent happy */
39}
40#endif
41#endif
42
43
44/**
45 * Function called to convert the binary value @a data of an attribute of
46 * type @a type to a human-readable string.
47 *
48 * @param cls closure
49 * @param type type of the attribute
50 * @param data value in binary encoding
51 * @param data_size number of bytes in @a data
52 * @return NULL on error, otherwise human-readable representation of the value
53 */
54typedef char *(*GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction) (
55 void *cls,
56 uint32_t type,
57 const void *data,
58 size_t data_size);
59
60
61/**
62 * Function called to convert human-readable version of the value @a s
63 * of an attribute of type @a type to the respective binary
64 * representation.
65 *
66 * @param cls closure
67 * @param type type of the attribute
68 * @param s human-readable string
69 * @param data set to value in binary encoding (will be allocated)
70 * @param data_size set to number of bytes in @a data
71 * @return #GNUNET_OK on success
72 */
73typedef int (*GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction) (
74 void *cls,
75 uint32_t type,
76 const char *s,
77 void **data,
78 size_t *data_size);
79
80
81/**
82 * Function called to convert a type name to the
83 * corresponding number.
84 *
85 * @param cls closure
86 * @param typename name to convert
87 * @return corresponding number, UINT32_MAX on error
88 */
89typedef uint32_t (*GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction) (
90 void *cls,
91 const char *typename);
92
93
94/**
95 * Function called to convert a type number (i.e. 1) to the
96 * corresponding type string
97 *
98 * @param cls closure
99 * @param type number of a type to convert
100 * @return corresponding typestring, NULL on error
101 */
102typedef const char *(*GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction) (
103 void *cls,
104 uint32_t type);
105
106
107/**
108 * Each plugin is required to return a pointer to a struct of this
109 * type as the return value from its entry point.
110 */
111struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions
112{
113 /**
114 * Closure for all of the callbacks.
115 */
116 void *cls;
117
118 /**
119 * Conversion to string.
120 */
121 GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction value_to_string;
122
123 /**
124 * Conversion to binary.
125 */
126 GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction string_to_value;
127
128 /**
129 * Typename to number.
130 */
131 GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction typename_to_number;
132
133 /**
134 * Number to typename.
135 */
136 GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction number_to_typename;
137
138 /**
139 * FIXME: It is odd that attestation functions are withing the attribute
140 * plugin. An attribute type may be backed by an attestation, but not
141 * necessarily.
142 * Maybe it would make more sense to refactor this into an attestation
143 * plugin?
144 *
145 * Attestation Conversion to string.
146 */
147 GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction value_to_string_attest;
148
149 /**
150 * Attestation Conversion to binary.
151 */
152 GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction string_to_value_attest;
153
154 /**
155 * Attestation Typename to number.
156 */
157 GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction typename_to_number_attest;
158
159 /**
160 * Attestation Number to typename.
161 */
162 GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction number_to_typename_attest;
163
164};
165
166
167#if 0 /* keep Emacsens' auto-indent happy */
168{
169#endif
170#ifdef __cplusplus
171}
172#endif
173
174#endif
175
176/** @} */ /* end of group */
diff --git a/src/include/gnunet_reclaim_attribute_lib.h b/src/include/gnunet_reclaim_lib.h
index 004f2bd10..54d284f3c 100644
--- a/src/include/gnunet_reclaim_attribute_lib.h
+++ b/src/include/gnunet_reclaim_lib.h
@@ -61,14 +61,52 @@ extern "C" {
61#define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT 11 61#define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT 11
62 62
63/** 63/**
64 * We want an ID to be a 256-bit symmetric key
65 */
66#define GNUNET_RECLAIM_ID_LENGTH (256 / 8)
67
68/**
69 * A reclaim identifier
70 * FIXME maybe put this in a different namespace
71 */
72struct GNUNET_RECLAIM_Identifier
73{
74 char id[GNUNET_RECLAIM_ID_LENGTH];
75};
76
77static const struct GNUNET_RECLAIM_Identifier GNUNET_RECLAIM_ID_ZERO;
78
79#define GNUNET_RECLAIM_id_is_equal(a,b) ((0 == \
80 memcmp (a, \
81 b, \
82 sizeof (GNUNET_RECLAIM_ID_ZERO))) \
83 ? \
84 GNUNET_YES : GNUNET_NO)
85
86
87#define GNUNET_RECLAIM_id_is_zero(a) GNUNET_RECLAIM_id_is_equal (a, \
88 & \
89 GNUNET_RECLAIM_ID_ZERO)
90
91#define GNUNET_RECLAIM_id_generate(id) \
92 (GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, \
93 id, \
94 sizeof (GNUNET_RECLAIM_ID_ZERO)))
95
96/**
64 * An attribute. 97 * An attribute.
65 */ 98 */
66struct GNUNET_RECLAIM_ATTRIBUTE_Claim 99struct GNUNET_RECLAIM_Attribute
67{ 100{
68 /** 101 /**
69 * ID 102 * ID
70 */ 103 */
71 uint64_t id; 104 struct GNUNET_RECLAIM_Identifier id;
105
106 /**
107 * Referenced ID of Attestation (may be 0 if self-attested)
108 */
109 struct GNUNET_RECLAIM_Identifier attestation;
72 110
73 /** 111 /**
74 * Type of Claim 112 * Type of Claim
@@ -79,6 +117,7 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim
79 * Flags 117 * Flags
80 */ 118 */
81 uint32_t flag; 119 uint32_t flag;
120
82 /** 121 /**
83 * The name of the attribute. Note "name" must never be individually 122 * The name of the attribute. Note "name" must never be individually
84 * free'd 123 * free'd
@@ -101,12 +140,12 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim
101/** 140/**
102 * An attestation. 141 * An attestation.
103 */ 142 */
104struct GNUNET_RECLAIM_ATTESTATION_Claim 143struct GNUNET_RECLAIM_Attestation
105{ 144{
106 /** 145 /**
107 * ID 146 * ID
108 */ 147 */
109 uint64_t id; 148 struct GNUNET_RECLAIM_Identifier id;
110 149
111 /** 150 /**
112 * Type/Format of Claim 151 * Type/Format of Claim
@@ -114,9 +153,9 @@ struct GNUNET_RECLAIM_ATTESTATION_Claim
114 uint32_t type; 153 uint32_t type;
115 154
116 /** 155 /**
117 * Version 156 * Flag
118 */ 157 */
119 uint32_t version; 158 uint32_t flag;
120 159
121 /** 160 /**
122 * The name of the attribute. Note "name" must never be individually 161 * The name of the attribute. Note "name" must never be individually
@@ -137,81 +176,77 @@ struct GNUNET_RECLAIM_ATTESTATION_Claim
137 const void *data; 176 const void *data;
138}; 177};
139 178
179
140/** 180/**
141 * A reference to an Attestatiom. 181 * A list of GNUNET_RECLAIM_Attribute structures.
142 */ 182 */
143struct GNUNET_RECLAIM_ATTESTATION_REFERENCE 183struct GNUNET_RECLAIM_AttributeList
144{ 184{
145 /** 185 /**
146 * ID 186 * List head
187 */
188 struct GNUNET_RECLAIM_AttributeListEntry *list_head;
189
190 /**
191 * List tail
147 */ 192 */
148 uint64_t id; 193 struct GNUNET_RECLAIM_AttributeListEntry *list_tail;
194};
195
149 196
197struct GNUNET_RECLAIM_AttributeListEntry
198{
150 /** 199 /**
151 * Referenced ID of Attestation 200 * DLL
152 */ 201 */
153 uint64_t id_attest; 202 struct GNUNET_RECLAIM_AttributeListEntry *prev;
154 203
155 /** 204 /**
156 * The name of the attribute/attestation reference value. Note "name" must never be individually 205 * DLL
157 * free'd
158 */ 206 */
159 const char *name; 207 struct GNUNET_RECLAIM_AttributeListEntry *next;
160 208
161 /** 209 /**
162 * The name of the attribute/attestation reference value. Note "name" must never be individually 210 * The attribute claim
163 * free'd
164 */ 211 */
165 const char *reference_value; 212 struct GNUNET_RECLAIM_Attribute *attribute;
213
166}; 214};
167 215
168/** 216/**
169 * A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures. 217 * A list of GNUNET_RECLAIM_Attestation structures.
170 */ 218 */
171struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList 219struct GNUNET_RECLAIM_AttestationList
172{ 220{
173 /** 221 /**
174 * List head 222 * List head
175 */ 223 */
176 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *list_head; 224 struct GNUNET_RECLAIM_AttestationListEntry *list_head;
177 225
178 /** 226 /**
179 * List tail 227 * List tail
180 */ 228 */
181 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *list_tail; 229 struct GNUNET_RECLAIM_AttestationListEntry *list_tail;
182}; 230};
183 231
184 232
185struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry 233struct GNUNET_RECLAIM_AttestationListEntry
186{ 234{
187 /** 235 /**
188 * DLL 236 * DLL
189 */ 237 */
190 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *prev; 238 struct GNUNET_RECLAIM_AttestationListEntry *prev;
191 239
192 /** 240 /**
193 * DLL 241 * DLL
194 */ 242 */
195 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *next; 243 struct GNUNET_RECLAIM_AttestationListEntry *next;
196 244
197 /** 245 /**
198 * The attribute claim 246 * The attestation
199 */
200 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
201 /**
202 * The attestation claim
203 */ 247 */
204 struct GNUNET_RECLAIM_ATTESTATION_Claim *attest; 248 struct GNUNET_RECLAIM_Attestation *attestation;
205 249
206 /**
207 * The reference
208 */
209 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference;
210};
211
212struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType
213{
214 uint32_t type;
215}; 250};
216 251
217 252
@@ -219,16 +254,19 @@ struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType
219 * Create a new attribute claim. 254 * Create a new attribute claim.
220 * 255 *
221 * @param attr_name the attribute name 256 * @param attr_name the attribute name
257 * @param attestation ID of the attestation (may be NULL)
222 * @param type the attribute type 258 * @param type the attribute type
223 * @param data the attribute value 259 * @param data the attribute value. Must be the mapped name if attestation not NULL
224 * @param data_size the attribute value size 260 * @param data_size the attribute value size
225 * @return the new attribute 261 * @return the new attribute
226 */ 262 */
227struct GNUNET_RECLAIM_ATTRIBUTE_Claim * 263struct GNUNET_RECLAIM_Attribute *
228GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char *attr_name, 264GNUNET_RECLAIM_attribute_new (const char *attr_name,
229 uint32_t type, 265 const struct
230 const void *data, 266 GNUNET_RECLAIM_Identifier *attestation,
231 size_t data_size); 267 uint32_t type,
268 const void *data,
269 size_t data_size);
232 270
233 271
234/** 272/**
@@ -238,8 +276,8 @@ GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char *attr_name,
238 * @return the required buffer size 276 * @return the required buffer size
239 */ 277 */
240size_t 278size_t
241GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size ( 279GNUNET_RECLAIM_attribute_list_serialize_get_size (
242 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs); 280 const struct GNUNET_RECLAIM_AttributeList *attrs);
243 281
244 282
245/** 283/**
@@ -248,22 +286,25 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (
248 * @param attrs list to destroy 286 * @param attrs list to destroy
249 */ 287 */
250void 288void
251GNUNET_RECLAIM_ATTRIBUTE_list_destroy ( 289GNUNET_RECLAIM_attribute_list_destroy (
252 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs); 290 struct GNUNET_RECLAIM_AttributeList *attrs);
253 291
254 292
255/** 293/**
256 * Add a new attribute to a claim list 294 * Add a new attribute to a claim list
257 * 295 *
296 * @param attrs the attribute list to add to
258 * @param attr_name the name of the new attribute claim 297 * @param attr_name the name of the new attribute claim
298 * @param attestation attestation ID (may be NULL)
259 * @param type the type of the claim 299 * @param type the type of the claim
260 * @param data claim payload 300 * @param data claim payload
261 * @param data_size claim payload size 301 * @param data_size claim payload size
262 */ 302 */
263void 303void
264GNUNET_RECLAIM_ATTRIBUTE_list_add ( 304GNUNET_RECLAIM_attribute_list_add (
265 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 305 struct GNUNET_RECLAIM_AttributeList *attrs,
266 const char *attr_name, 306 const char *attr_name,
307 const struct GNUNET_RECLAIM_Identifier *attestation,
267 uint32_t type, 308 uint32_t type,
268 const void *data, 309 const void *data,
269 size_t data_size); 310 size_t data_size);
@@ -277,8 +318,8 @@ GNUNET_RECLAIM_ATTRIBUTE_list_add (
277 * @return length of serialized data 318 * @return length of serialized data
278 */ 319 */
279size_t 320size_t
280GNUNET_RECLAIM_ATTRIBUTE_list_serialize ( 321GNUNET_RECLAIM_attribute_list_serialize (
281 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 322 const struct GNUNET_RECLAIM_AttributeList *attrs,
282 char *result); 323 char *result);
283 324
284 325
@@ -289,17 +330,8 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize (
289 * @param data_size the length of the serialized data 330 * @param data_size the length of the serialized data
290 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller 331 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
291 */ 332 */
292struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * 333struct GNUNET_RECLAIM_AttributeList *
293GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char *data, size_t data_size); 334GNUNET_RECLAIM_attribute_list_deserialize (const char *data, size_t data_size);
294
295/**
296 * Count attestations in claim list
297 *
298 * @param attrs list
299 */
300int
301GNUNET_RECLAIM_ATTRIBUTE_list_count_attest (
302 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
303 335
304/** 336/**
305 * Get required size for serialization buffer 337 * Get required size for serialization buffer
@@ -308,8 +340,8 @@ GNUNET_RECLAIM_ATTRIBUTE_list_count_attest (
308 * @return the required buffer size 340 * @return the required buffer size
309 */ 341 */
310size_t 342size_t
311GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size ( 343GNUNET_RECLAIM_attribute_serialize_get_size (
312 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr); 344 const struct GNUNET_RECLAIM_Attribute *attr);
313 345
314 346
315/** 347/**
@@ -320,9 +352,8 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (
320 * @return length of serialized data 352 * @return length of serialized data
321 */ 353 */
322size_t 354size_t
323GNUNET_RECLAIM_ATTRIBUTE_serialize ( 355GNUNET_RECLAIM_attribute_serialize (const struct GNUNET_RECLAIM_Attribute *attr,
324 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 356 char *result);
325 char *result);
326 357
327 358
328/** 359/**
@@ -333,8 +364,8 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize (
333 * 364 *
334 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller 365 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
335 */ 366 */
336struct GNUNET_RECLAIM_ATTRIBUTE_Claim * 367struct GNUNET_RECLAIM_Attribute *
337GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char *data, size_t data_size); 368GNUNET_RECLAIM_attribute_deserialize (const char *data, size_t data_size);
338 369
339 370
340/** 371/**
@@ -342,9 +373,9 @@ GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char *data, size_t data_size);
342 * @param attrs claim list to copy 373 * @param attrs claim list to copy
343 * @return copied claim list 374 * @return copied claim list
344 */ 375 */
345struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * 376struct GNUNET_RECLAIM_AttributeList *
346GNUNET_RECLAIM_ATTRIBUTE_list_dup ( 377GNUNET_RECLAIM_attribute_list_dup (
347 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs); 378 const struct GNUNET_RECLAIM_AttributeList *attrs);
348 379
349 380
350/** 381/**
@@ -354,7 +385,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_dup (
354 * @return corresponding number, UINT32_MAX on error 385 * @return corresponding number, UINT32_MAX on error
355 */ 386 */
356uint32_t 387uint32_t
357GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename); 388GNUNET_RECLAIM_attribute_typename_to_number (const char *typename);
358 389
359/** 390/**
360 * Convert human-readable version of a 'claim' of an attribute to the binary 391 * Convert human-readable version of a 'claim' of an attribute to the binary
@@ -367,7 +398,7 @@ GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename);
367 * @return #GNUNET_OK on success 398 * @return #GNUNET_OK on success
368 */ 399 */
369int 400int
370GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type, 401GNUNET_RECLAIM_attribute_string_to_value (uint32_t type,
371 const char *s, 402 const char *s,
372 void **data, 403 void **data,
373 size_t *data_size); 404 size_t *data_size);
@@ -382,11 +413,10 @@ GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
382 * @return NULL on error, otherwise human-readable representation of the claim 413 * @return NULL on error, otherwise human-readable representation of the claim
383 */ 414 */
384char * 415char *
385GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type, 416GNUNET_RECLAIM_attribute_value_to_string (uint32_t type,
386 const void *data, 417 const void *data,
387 size_t data_size); 418 size_t data_size);
388 419
389
390/** 420/**
391 * Convert a type number to the corresponding type string 421 * Convert a type number to the corresponding type string
392 * 422 *
@@ -394,35 +424,91 @@ GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
394 * @return corresponding typestring, NULL on error 424 * @return corresponding typestring, NULL on error
395 */ 425 */
396const char * 426const char *
397GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type); 427GNUNET_RECLAIM_attribute_number_to_typename (uint32_t type);
398 428
399/** 429
400 * Get required size for serialization buffer 430/**
401 * FIXME: 431 * Get required size for serialization buffer
402 * 1. The naming convention is violated here. 432 *
403 * It should GNUNET_RECLAIM_ATTRIBUTE_<lowercase from here>. 433 * @param attrs the attribute list to serialize
404 * It might make sense to refactor attestations into a separate folder. 434 * @return the required buffer size
405 * 2. The struct should be called GNUNET_RECLAIM_ATTESTATION_Data or 435 */
406 * GNUNET_RECLAIM_ATTRIBUTE_Attestation depending on location in source. 436size_t
407 * 437GNUNET_RECLAIM_attestation_list_serialize_get_size (
408 * @param attr the attestation to serialize 438 const struct GNUNET_RECLAIM_AttestationList *attestations);
439
440
441/**
442 * Destroy claim list
443 *
444 * @param attrs list to destroy
445 */
446void
447GNUNET_RECLAIM_attestation_list_destroy (
448 struct GNUNET_RECLAIM_AttestationList *attestations);
449
450
451/**
452 * Add a new attribute to a claim list
453 *
454 * @param attr_name the name of the new attribute claim
455 * @param type the type of the claim
456 * @param data claim payload
457 * @param data_size claim payload size
458 */
459void
460GNUNET_RECLAIM_attestation_list_add (
461 struct GNUNET_RECLAIM_AttestationList *attrs,
462 const char *att_name,
463 uint32_t type,
464 const void *data,
465 size_t data_size);
466
467
468/**
469 * Serialize an attribute list
470 *
471 * @param attrs the attribute list to serialize
472 * @param result the serialized attribute
473 * @return length of serialized data
474 */
475size_t
476GNUNET_RECLAIM_attestation_list_serialize (
477 const struct GNUNET_RECLAIM_AttestationList *attrs,
478 char *result);
479
480
481/**
482 * Deserialize an attribute list
483 *
484 * @param data the serialized attribute list
485 * @param data_size the length of the serialized data
486 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
487 */
488struct GNUNET_RECLAIM_AttestationList *
489GNUNET_RECLAIM_attestation_list_deserialize (const char *data,
490 size_t data_size);
491
492
493/**
494 * @param attestation the attestation to serialize
409 * @return the required buffer size 495 * @return the required buffer size
410 */ 496 */
411size_t 497size_t
412GNUNET_RECLAIM_ATTESTATION_serialize_get_size ( 498GNUNET_RECLAIM_attestation_serialize_get_size (
413 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr); 499 const struct GNUNET_RECLAIM_Attestation *attestation);
414 500
415 501
416/** 502/**
417 * Serialize an attestation 503 * Serialize an attestation
418 * 504 *
419 * @param attr the attestation to serialize 505 * @param attestation the attestation to serialize
420 * @param result the serialized attestation 506 * @param result the serialized attestation
421 * @return length of serialized data 507 * @return length of serialized data
422 */ 508 */
423size_t 509size_t
424GNUNET_RECLAIM_ATTESTATION_serialize ( 510GNUNET_RECLAIM_attestation_serialize (
425 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, 511 const struct GNUNET_RECLAIM_Attestation *attestation,
426 char *result); 512 char *result);
427 513
428 514
@@ -434,24 +520,24 @@ GNUNET_RECLAIM_ATTESTATION_serialize (
434 * 520 *
435 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller 521 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
436 */ 522 */
437struct GNUNET_RECLAIM_ATTESTATION_Claim * 523struct GNUNET_RECLAIM_Attestation *
438GNUNET_RECLAIM_ATTESTATION_deserialize (const char *data, size_t data_size); 524GNUNET_RECLAIM_attestation_deserialize (const char *data, size_t data_size);
439 525
440 526
441/** 527/**
442 * Create a new attestation. 528 * Create a new attestation.
443 * 529 *
444 * @param attr_name the attestation name 530 * @param name the attestation name
445 * @param type the attestation type 531 * @param type the attestation type
446 * @param data the attestation value 532 * @param data the attestation value
447 * @param data_size the attestation value size 533 * @param data_size the attestation value size
448 * @return the new attestation 534 * @return the new attestation
449 */ 535 */
450struct GNUNET_RECLAIM_ATTESTATION_Claim * 536struct GNUNET_RECLAIM_Attestation *
451GNUNET_RECLAIM_ATTESTATION_claim_new (const char *attr_name, 537GNUNET_RECLAIM_attestation_new (const char *name,
452 uint32_t type, 538 uint32_t type,
453 const void *data, 539 const void *data,
454 size_t data_size); 540 size_t data_size);
455 541
456/** 542/**
457 * Convert the 'claim' of an attestation to a string 543 * Convert the 'claim' of an attestation to a string
@@ -462,7 +548,7 @@ GNUNET_RECLAIM_ATTESTATION_claim_new (const char *attr_name,
462 * @return NULL on error, otherwise human-readable representation of the claim 548 * @return NULL on error, otherwise human-readable representation of the claim
463 */ 549 */
464char * 550char *
465GNUNET_RECLAIM_ATTESTATION_value_to_string (uint32_t type, 551GNUNET_RECLAIM_attestation_value_to_string (uint32_t type,
466 const void *data, 552 const void *data,
467 size_t data_size); 553 size_t data_size);
468 554
@@ -477,7 +563,7 @@ GNUNET_RECLAIM_ATTESTATION_value_to_string (uint32_t type,
477 * @return #GNUNET_OK on success 563 * @return #GNUNET_OK on success
478 */ 564 */
479int 565int
480GNUNET_RECLAIM_ATTESTATION_string_to_value (uint32_t type, 566GNUNET_RECLAIM_attestation_string_to_value (uint32_t type,
481 const char *s, 567 const char *s,
482 void **data, 568 void **data,
483 size_t *data_size); 569 size_t *data_size);
@@ -489,7 +575,7 @@ GNUNET_RECLAIM_ATTESTATION_string_to_value (uint32_t type,
489 * @return corresponding typestring, NULL on error 575 * @return corresponding typestring, NULL on error
490 */ 576 */
491const char * 577const char *
492GNUNET_RECLAIM_ATTESTATION_number_to_typename (uint32_t type); 578GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type);
493 579
494/** 580/**
495 * Convert an attestation type name to the corresponding number 581 * Convert an attestation type name to the corresponding number
@@ -498,52 +584,26 @@ GNUNET_RECLAIM_ATTESTATION_number_to_typename (uint32_t type);
498 * @return corresponding number, UINT32_MAX on error 584 * @return corresponding number, UINT32_MAX on error
499 */ 585 */
500uint32_t 586uint32_t
501GNUNET_RECLAIM_ATTESTATION_typename_to_number (const char *typename); 587GNUNET_RECLAIM_attestation_typename_to_number (const char *typename);
502 588
503/** 589/**
504 * Create a new attestation reference. 590 * Convert an attestation type name to the corresponding number
505 *
506 * @param attr_name the referenced claim name
507 * @param ref_value the claim name in the attestation
508 * @return the new reference
509 */
510struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *
511GNUNET_RECLAIM_ATTESTATION_reference_new (const char *attr_name,
512 const char *ref_value);
513
514
515/**
516 * Get required size for serialization buffer
517 * 591 *
518 * @param attr the reference to serialize 592 * @param typename name to convert
519 * @return the required buffer size 593 * @return corresponding number, UINT32_MAX on error
520 */ 594 */
521size_t 595struct GNUNET_RECLAIM_AttributeList*
522GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size ( 596GNUNET_RECLAIM_attestation_get_attributes (const struct
523 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr); 597 GNUNET_RECLAIM_Attestation *attest);
524 598
525/** 599char*
526 * Serialize a reference 600GNUNET_RECLAIM_attestation_get_issuer (const struct
527 * 601 GNUNET_RECLAIM_Attestation *attest);
528 * @param attr the reference to serialize
529 * @param result the serialized reference
530 * @return length of serialized data
531 */
532size_t
533GNUNET_RECLAIM_ATTESTATION_REF_serialize (
534 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
535 char *result);
536 602
537/** 603int
538 * Deserialize a reference 604GNUNET_RECLAIM_attestation_get_expiration (const struct
539 * 605 GNUNET_RECLAIM_Attestation *attest,
540 * @param data the serialized reference 606 struct GNUNET_TIME_Absolute *exp);
541 * @param data_size the length of the serialized data
542 *
543 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
544 */
545struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *
546GNUNET_RECLAIM_ATTESTATION_REF_deserialize (const char *data, size_t data_size);
547 607
548#if 0 /* keep Emacsens' auto-indent happy */ 608#if 0 /* keep Emacsens' auto-indent happy */
549{ 609{
diff --git a/src/include/gnunet_reclaim_plugin.h b/src/include/gnunet_reclaim_plugin.h
new file mode 100644
index 000000000..992ad0cc3
--- /dev/null
+++ b/src/include/gnunet_reclaim_plugin.h
@@ -0,0 +1,296 @@
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 * Plugin API for reclaim attribute types
26 *
27 * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims
28 * @{
29 */
30#ifndef GNUNET_RECLAIM_AttributePLUGIN_H
31#define GNUNET_RECLAIM_AttributePLUGIN_H
32
33#include "gnunet_util_lib.h"
34#include "gnunet_reclaim_lib.h"
35
36#ifdef __cplusplus
37extern "C" {
38#if 0 /* keep Emacsens' auto-indent happy */
39}
40#endif
41#endif
42
43
44/**
45 * Function called to convert the binary value @a data of an attribute of
46 * type @a type to a human-readable string.
47 *
48 * @param cls closure
49 * @param type type of the attribute
50 * @param data value in binary encoding
51 * @param data_size number of bytes in @a data
52 * @return NULL on error, otherwise human-readable representation of the value
53 */
54typedef char *(*GNUNET_RECLAIM_AttributeValueToStringFunction) (
55 void *cls,
56 uint32_t type,
57 const void *data,
58 size_t data_size);
59
60
61/**
62 * Function called to convert human-readable version of the value @a s
63 * of an attribute of type @a type to the respective binary
64 * representation.
65 *
66 * @param cls closure
67 * @param type type of the attribute
68 * @param s human-readable string
69 * @param data set to value in binary encoding (will be allocated)
70 * @param data_size set to number of bytes in @a data
71 * @return #GNUNET_OK on success
72 */
73typedef int (*GNUNET_RECLAIM_AttributeStringToValueFunction) (
74 void *cls,
75 uint32_t type,
76 const char *s,
77 void **data,
78 size_t *data_size);
79
80
81/**
82 * Function called to convert a type name to the
83 * corresponding number.
84 *
85 * @param cls closure
86 * @param typename name to convert
87 * @return corresponding number, UINT32_MAX on error
88 */
89typedef uint32_t (*GNUNET_RECLAIM_AttributeTypenameToNumberFunction) (
90 void *cls,
91 const char *typename);
92
93
94/**
95 * Function called to convert a type number (i.e. 1) to the
96 * corresponding type string
97 *
98 * @param cls closure
99 * @param type number of a type to convert
100 * @return corresponding typestring, NULL on error
101 */
102typedef const char *(*GNUNET_RECLAIM_AttributeNumberToTypenameFunction) (
103 void *cls,
104 uint32_t type);
105
106/**
107 * Function called to convert the binary value @a data of an attribute of
108 * type @a type to a human-readable string.
109 *
110 * @param cls closure
111 * @param type type of the attribute
112 * @param data value in binary encoding
113 * @param data_size number of bytes in @a data
114 * @return NULL on error, otherwise human-readable representation of the value
115 */
116typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) (
117 void *cls,
118 uint32_t type,
119 const void *data,
120 size_t data_size);
121
122
123/**
124 * Function called to convert human-readable version of the value @a s
125 * of an attribute of type @a type to the respective binary
126 * representation.
127 *
128 * @param cls closure
129 * @param type type of the attribute
130 * @param s human-readable string
131 * @param data set to value in binary encoding (will be allocated)
132 * @param data_size set to number of bytes in @a data
133 * @return #GNUNET_OK on success
134 */
135typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) (
136 void *cls,
137 uint32_t type,
138 const char *s,
139 void **data,
140 size_t *data_size);
141
142
143/**
144 * Function called to convert a type name to the
145 * corresponding number.
146 *
147 * @param cls closure
148 * @param typename name to convert
149 * @return corresponding number, UINT32_MAX on error
150 */
151typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) (
152 void *cls,
153 const char *typename);
154
155
156/**
157 * Function called to convert a type number (i.e. 1) to the
158 * corresponding type string
159 *
160 * @param cls closure
161 * @param type number of a type to convert
162 * @return corresponding typestring, NULL on error
163 */
164typedef const char *(*GNUNET_RECLAIM_AttestationNumberToTypenameFunction) (
165 void *cls,
166 uint32_t type);
167
168/**
169 * Function called to extract attributes from an attestation
170 *
171 * @param cls closure
172 * @param attest the attestation object
173 * @return an attribute list
174 */
175typedef struct GNUNET_RECLAIM_AttributeList *(*GNUNET_RECLAIM_AttestationGetAttributesFunction) (
176 void *cls,
177 const struct GNUNET_RECLAIM_Attestation *attest);
178
179/**
180 * Function called to get the issuer of the attestation (as string)
181 *
182 * @param cls closure
183 * @param attest the attestation object
184 * @return corresponding issuer string
185 */
186typedef char *(*GNUNET_RECLAIM_AttestationGetIssuerFunction) (
187 void *cls,
188 const struct GNUNET_RECLAIM_Attestation *attest);
189
190/**
191 * Function called to get the expiration of the attestation
192 *
193 * @param cls closure
194 * @param attest the attestation object
195 * @param where to write the value
196 * @return GNUNET_OK if successful
197 */
198typedef int (*GNUNET_RECLAIM_AttestationGetExpirationFunction) (
199 void *cls,
200 const struct GNUNET_RECLAIM_Attestation *attest,
201 struct GNUNET_TIME_Absolute *expiration);
202
203
204
205/**
206 * Each plugin is required to return a pointer to a struct of this
207 * type as the return value from its entry point.
208 */
209struct GNUNET_RECLAIM_AttributePluginFunctions
210{
211 /**
212 * Closure for all of the callbacks.
213 */
214 void *cls;
215
216 /**
217 * Conversion to string.
218 */
219 GNUNET_RECLAIM_AttributeValueToStringFunction value_to_string;
220
221 /**
222 * Conversion to binary.
223 */
224 GNUNET_RECLAIM_AttributeStringToValueFunction string_to_value;
225
226 /**
227 * Typename to number.
228 */
229 GNUNET_RECLAIM_AttributeTypenameToNumberFunction typename_to_number;
230
231 /**
232 * Number to typename.
233 */
234 GNUNET_RECLAIM_AttributeNumberToTypenameFunction number_to_typename;
235
236};
237
238/**
239 * Each plugin is required to return a pointer to a struct of this
240 * type as the return value from its entry point.
241 */
242struct GNUNET_RECLAIM_AttestationPluginFunctions
243{
244 /**
245 * Closure for all of the callbacks.
246 */
247 void *cls;
248
249 /**
250 * Conversion to string.
251 */
252 GNUNET_RECLAIM_AttestationValueToStringFunction value_to_string;
253
254 /**
255 * Conversion to binary.
256 */
257 GNUNET_RECLAIM_AttestationStringToValueFunction string_to_value;
258
259 /**
260 * Typename to number.
261 */
262 GNUNET_RECLAIM_AttestationTypenameToNumberFunction typename_to_number;
263
264 /**
265 * Number to typename.
266 */
267 GNUNET_RECLAIM_AttestationNumberToTypenameFunction number_to_typename;
268
269 /**
270 * Attesation attributes.
271 */
272 GNUNET_RECLAIM_AttestationGetAttributesFunction get_attributes;
273
274 /**
275 * Attesation issuer.
276 */
277 GNUNET_RECLAIM_AttestationGetIssuerFunction get_issuer;
278
279 /**
280 * Expiration.
281 */
282 GNUNET_RECLAIM_AttestationGetExpirationFunction get_expiration;
283};
284
285
286
287#if 0 /* keep Emacsens' auto-indent happy */
288{
289#endif
290#ifdef __cplusplus
291}
292#endif
293
294#endif
295
296/** @} */ /* end of group */
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h
index 214cdba69..813bc1a59 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -38,7 +38,7 @@ extern "C" {
38#endif 38#endif
39#endif 39#endif
40 40
41#include "gnunet_reclaim_attribute_lib.h" 41#include "gnunet_reclaim_lib.h"
42#include "gnunet_util_lib.h" 42#include "gnunet_util_lib.h"
43 43
44/** 44/**
@@ -77,9 +77,9 @@ struct GNUNET_RECLAIM_Ticket
77 struct GNUNET_CRYPTO_EcdsaPublicKey audience; 77 struct GNUNET_CRYPTO_EcdsaPublicKey audience;
78 78
79 /** 79 /**
80 * The ticket random (NBO) 80 * The ticket random identifier
81 */ 81 */
82 uint64_t rnd; 82 struct GNUNET_RECLAIM_Identifier rnd;
83}; 83};
84 84
85 85
@@ -107,19 +107,43 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls,
107 int32_t success, 107 int32_t success,
108 const char *emsg); 108 const char *emsg);
109 109
110
111/** 110/**
112 * Callback used to notify the client of attribute results. 111 * Callback used to notify the client of attribute results.
113 * 112 *
114 * @param cls The callback closure 113 * @param cls The callback closure
115 * @param identity The identity authoritative over the attributes 114 * @param identity The identity authoritative over the attributes
116 * @param attr The attribute 115 * @param attr The attribute
116 * @param attestation The attestation for the attribute (may be NULL)
117 */ 117 */
118typedef void (*GNUNET_RECLAIM_AttributeResult) ( 118typedef void (*GNUNET_RECLAIM_AttributeResult) (
119 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 119 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
120 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 120 const struct GNUNET_RECLAIM_Attribute *attr);
121 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 121
122 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference); 122/**
123 * Callback used to notify the client of attribute results.
124 *
125 * @param cls The callback closure
126 * @param identity The identity authoritative over the attributes
127 * @param attr The attribute
128 * @param attestation The attestation for the attribute (may be NULL)
129 */
130typedef void (*GNUNET_RECLAIM_AttributeTicketResult) (
131 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
132 const struct GNUNET_RECLAIM_Attribute *attr,
133 const struct GNUNET_RECLAIM_Attestation *attestation);
134
135
136/**
137 * Callback used to notify the client of attestation results.
138 *
139 * @param cls The callback closure
140 * @param identity The identity authoritative over the attributes
141 * @param attestation The attestation
142 * @param attributes the parsed attributes
143 */
144typedef void (*GNUNET_RECLAIM_AttestationResult) (
145 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
146 const struct GNUNET_RECLAIM_Attestation *attestation);
123 147
124 148
125/** 149/**
@@ -148,7 +172,7 @@ struct GNUNET_RECLAIM_Operation *
148GNUNET_RECLAIM_attribute_store ( 172GNUNET_RECLAIM_attribute_store (
149 struct GNUNET_RECLAIM_Handle *h, 173 struct GNUNET_RECLAIM_Handle *h,
150 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 174 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
151 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 175 const struct GNUNET_RECLAIM_Attribute *attr,
152 const struct GNUNET_TIME_Relative *exp_interval, 176 const struct GNUNET_TIME_Relative *exp_interval,
153 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); 177 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
154 178
@@ -169,7 +193,7 @@ struct GNUNET_RECLAIM_Operation *
169GNUNET_RECLAIM_attestation_store ( 193GNUNET_RECLAIM_attestation_store (
170 struct GNUNET_RECLAIM_Handle *h, 194 struct GNUNET_RECLAIM_Handle *h,
171 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 195 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
172 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, 196 const struct GNUNET_RECLAIM_Attestation *attestation,
173 const struct GNUNET_TIME_Relative *exp_interval, 197 const struct GNUNET_TIME_Relative *exp_interval,
174 GNUNET_RECLAIM_ContinuationWithStatus cont, 198 GNUNET_RECLAIM_ContinuationWithStatus cont,
175 void *cont_cls); 199 void *cont_cls);
@@ -190,7 +214,7 @@ struct GNUNET_RECLAIM_Operation *
190GNUNET_RECLAIM_attribute_delete ( 214GNUNET_RECLAIM_attribute_delete (
191 struct GNUNET_RECLAIM_Handle *h, 215 struct GNUNET_RECLAIM_Handle *h,
192 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 216 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
193 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 217 const struct GNUNET_RECLAIM_Attribute *attr,
194 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); 218 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
195 219
196/** 220/**
@@ -208,29 +232,11 @@ struct GNUNET_RECLAIM_Operation *
208GNUNET_RECLAIM_attestation_delete ( 232GNUNET_RECLAIM_attestation_delete (
209 struct GNUNET_RECLAIM_Handle *h, 233 struct GNUNET_RECLAIM_Handle *h,
210 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 234 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
211 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, 235 const struct GNUNET_RECLAIM_Attestation *attr,
212 GNUNET_RECLAIM_ContinuationWithStatus cont, 236 GNUNET_RECLAIM_ContinuationWithStatus cont,
213 void *cont_cls); 237 void *cont_cls);
214 238
215/** 239/**
216 * Delete an attestation reference. Tickets used to share this reference are updated
217 * accordingly.
218 *
219 * @param h handle to the re:claimID service
220 * @param pkey Private key of the identity to delete the reference from
221 * @param attr The reference
222 * @param cont Continuation to call when done
223 * @param cont_cls Closure for @a cont
224 * @return handle Used to to abort the request
225 */
226struct GNUNET_RECLAIM_Operation *
227GNUNET_RECLAIM_attestation_reference_delete (
228 struct GNUNET_RECLAIM_Handle *h,
229 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
230 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
231 GNUNET_RECLAIM_ContinuationWithStatus cont,
232 void *cont_cls);
233/**
234 * List all attributes for a local identity. 240 * List all attributes for a local identity.
235 * This MUST lock the `struct GNUNET_RECLAIM_Handle` 241 * This MUST lock the `struct GNUNET_RECLAIM_Handle`
236 * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and 242 * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and
@@ -262,26 +268,6 @@ GNUNET_RECLAIM_get_attributes_start (
262 GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, 268 GNUNET_RECLAIM_AttributeResult proc, void *proc_cls,
263 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); 269 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
264 270
265/**
266 * Store an attestation reference. If the reference is already present,
267 * it is replaced with the new reference.
268 *
269 * @param h handle to the re:claimID service
270 * @param pkey private key of the identity
271 * @param attr the reference value
272 * @param exp_interval the relative expiration interval for the reference
273 * @param cont continuation to call when done
274 * @param cont_cls closure for @a cont
275 * @return handle to abort the request
276 */
277struct GNUNET_RECLAIM_Operation *
278GNUNET_RECLAIM_attestation_reference_store (
279 struct GNUNET_RECLAIM_Handle *h,
280 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
281 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
282 const struct GNUNET_TIME_Relative *exp_interval,
283 GNUNET_RECLAIM_ContinuationWithStatus cont,
284 void *cont_cls);
285 271
286/** 272/**
287 * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start 273 * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start
@@ -307,6 +293,63 @@ GNUNET_RECLAIM_get_attributes_stop (
307 293
308 294
309/** 295/**
296 * List all attestations for a local identity.
297 * This MUST lock the `struct GNUNET_RECLAIM_Handle`
298 * for any other calls than #GNUNET_RECLAIM_get_attestations_next() and
299 * #GNUNET_RECLAIM_get_attestations_stop. @a proc will be called once
300 * immediately, and then again after
301 * #GNUNET_RECLAIM_get_attestations_next() is invoked.
302 *
303 * On error (disconnect), @a error_cb will be invoked.
304 * On normal completion, @a finish_cb proc will be
305 * invoked.
306 *
307 * @param h Handle to the re:claimID service
308 * @param identity Identity to iterate over
309 * @param error_cb Function to call on error (i.e. disconnect),
310 * the handle is afterwards invalid
311 * @param error_cb_cls Closure for @a error_cb
312 * @param proc Function to call on each attestation
313 * @param proc_cls Closure for @a proc
314 * @param finish_cb Function to call on completion
315 * the handle is afterwards invalid
316 * @param finish_cb_cls Closure for @a finish_cb
317 * @return an iterator Handle to use for iteration
318 */
319struct GNUNET_RECLAIM_AttestationIterator *
320GNUNET_RECLAIM_get_attestations_start (
321 struct GNUNET_RECLAIM_Handle *h,
322 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
323 GNUNET_SCHEDULER_TaskCallback error_cb,
324 void *error_cb_cls,
325 GNUNET_RECLAIM_AttestationResult proc,
326 void *proc_cls,
327 GNUNET_SCHEDULER_TaskCallback finish_cb,
328 void *finish_cb_cls);
329
330
331/**
332 * Calls the record processor specified in #GNUNET_RECLAIM_get_attestation_start
333 * for the next record.
334 *
335 * @param it the iterator
336 */
337void
338GNUNET_RECLAIM_get_attestations_next (struct GNUNET_RECLAIM_AttestationIterator *ait);
339
340
341/**
342 * Stops iteration and releases the handle for further calls. Must
343 * be called on any iteration that has not yet completed prior to calling
344 * #GNUNET_RECLAIM_disconnect.
345 *
346 * @param it the iterator
347 */
348void
349GNUNET_RECLAIM_get_attestations_stop (struct GNUNET_RECLAIM_AttestationIterator *ait);
350
351
352/**
310 * Issues a ticket to a relying party. The identity may use 353 * Issues a ticket to a relying party. The identity may use
311 * GNUNET_RECLAIM_ticket_consume to consume the ticket 354 * GNUNET_RECLAIM_ticket_consume to consume the ticket
312 * and retrieve the attributes specified in the attribute list. 355 * and retrieve the attributes specified in the attribute list.
@@ -324,7 +367,7 @@ GNUNET_RECLAIM_ticket_issue (
324 struct GNUNET_RECLAIM_Handle *h, 367 struct GNUNET_RECLAIM_Handle *h,
325 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, 368 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss,
326 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, 369 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp,
327 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 370 const struct GNUNET_RECLAIM_AttributeList *attrs,
328 GNUNET_RECLAIM_TicketCallback cb, void *cb_cls); 371 GNUNET_RECLAIM_TicketCallback cb, void *cb_cls);
329 372
330 373
@@ -366,7 +409,7 @@ GNUNET_RECLAIM_ticket_consume (
366 struct GNUNET_RECLAIM_Handle *h, 409 struct GNUNET_RECLAIM_Handle *h,
367 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 410 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
368 const struct GNUNET_RECLAIM_Ticket *ticket, 411 const struct GNUNET_RECLAIM_Ticket *ticket,
369 GNUNET_RECLAIM_AttributeResult cb, void *cb_cls); 412 GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls);
370 413
371 414
372/** 415/**
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h
index 7222cedc1..105bb1149 100644
--- a/src/include/gnunet_revocation_service.h
+++ b/src/include/gnunet_revocation_service.h
@@ -48,7 +48,77 @@ extern "C"
48/** 48/**
49 * Version of the key revocation API. 49 * Version of the key revocation API.
50 */ 50 */
51#define GNUNET_REVOCATION_VERSION 0x00000000 51#define GNUNET_REVOCATION_VERSION 0x00000001
52
53/**
54 * The proof-of-work narrowing factor.
55 * The number of PoWs that are calculates as part of revocation.
56 */
57#define POW_COUNT 32
58
59
60GNUNET_NETWORK_STRUCT_BEGIN
61
62/**
63 * Struct for a proof of work as part of the revocation.
64 */
65struct GNUNET_REVOCATION_PowP
66{
67 /**
68 * The timestamp of the revocation
69 */
70 struct GNUNET_TIME_AbsoluteNBO timestamp;
71
72 /**
73 * The TTL of this revocation (purely informational)
74 */
75 struct GNUNET_TIME_RelativeNBO ttl;
76
77 /**
78 * The PoWs
79 */
80 uint64_t pow[POW_COUNT] GNUNET_PACKED;
81
82 /**
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
93
94/**
95 * The signature object we use for the PoW
96 */
97struct GNUNET_REVOCATION_SignaturePurposePS
98{
99 /**
100 * The signature purpose
101 */
102 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
103
104 /**
105 * The revoked public key
106 */
107 struct GNUNET_CRYPTO_EcdsaPublicKey key;
108
109 /**
110 * The timestamp of the revocation
111 */
112 struct GNUNET_TIME_AbsoluteNBO timestamp;
113};
114
115GNUNET_NETWORK_STRUCT_END
116
117
118/**
119 * Handle to a running proof-of-work calculation.
120 */
121struct GNUNET_REVOCATION_PowCalculationHandle;
52 122
53/** 123/**
54 * Handle for the key revocation query. 124 * Handle for the key revocation query.
@@ -65,7 +135,8 @@ struct GNUNET_REVOCATION_Query;
65 * 135 *
66 */ 136 */
67typedef void (*GNUNET_REVOCATION_Callback) (void *cls, 137typedef void (*GNUNET_REVOCATION_Callback) (void *cls,
68 int is_valid); 138 enum GNUNET_GenericReturnValue
139 is_valid);
69 140
70 141
71/** 142/**
@@ -102,12 +173,9 @@ struct GNUNET_REVOCATION_Handle;
102 * Perform key revocation. 173 * Perform key revocation.
103 * 174 *
104 * @param cfg the configuration to use 175 * @param cfg the configuration to use
105 * @param key public key of the key to revoke
106 * @param sig signature to use on the revocation (should have been
107 * created using #GNUNET_REVOCATION_sign_revocation).
108 * @param pow proof of work to use (should have been created by 176 * @param pow proof of work to use (should have been created by
109 * iteratively calling #GNUNET_REVOCATION_check_pow) 177 * iteratively calling #GNUNET_REVOCATION_pow_round)
110 * @param func funtion to call with the result of the check 178 * @param func function to call with the result of the check
111 * (called with `is_valid` being #GNUNET_NO if 179 * (called with `is_valid` being #GNUNET_NO if
112 * the revocation worked). 180 * the revocation worked).
113 * @param func_cls closure to pass to @a func 181 * @param func_cls closure to pass to @a func
@@ -115,9 +183,7 @@ struct GNUNET_REVOCATION_Handle;
115 */ 183 */
116struct GNUNET_REVOCATION_Handle * 184struct GNUNET_REVOCATION_Handle *
117GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, 185GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
118 const struct GNUNET_CRYPTO_EcdsaPublicKey *key, 186 const struct GNUNET_REVOCATION_PowP *pow,
119 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
120 uint64_t pow,
121 GNUNET_REVOCATION_Callback func, void *func_cls); 187 GNUNET_REVOCATION_Callback func, void *func_cls);
122 188
123 189
@@ -131,32 +197,65 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h);
131 197
132 198
133/** 199/**
134 * Check if the given proof-of-work value 200 * Check if the given proof-of-work is valid.
135 * would be acceptable for revoking the given key.
136 * 201 *
137 * @param key key to check for 202 * @param pow proof of work
138 * @param pow proof of work value
139 * @param matching_bits how many bits must match (configuration) 203 * @param matching_bits how many bits must match (configuration)
204 * @param epoch_duration length of single epoch in configuration
140 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not 205 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
141 */ 206 */
142int 207enum GNUNET_GenericReturnValue
143GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key, 208GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
144 uint64_t pow, 209 unsigned int matching_bits,
145 unsigned int matching_bits); 210 struct GNUNET_TIME_Relative epoch_duration);
146 211
147 212
148/** 213/**
149 * Create a revocation signature. 214 * Initializes a fresh PoW computation.
150 * 215 *
151 * @param key private key of the key to revoke 216 * @param key the key to calculate the PoW for.
152 * @param sig where to write the revocation signature 217 * @param pow the pow object to work with in the calculation.
153 */ 218 */
154void 219void
155GNUNET_REVOCATION_sign_revocation (const struct 220GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
156 GNUNET_CRYPTO_EcdsaPrivateKey *key, 221 struct GNUNET_REVOCATION_PowP *pow);
157 struct GNUNET_CRYPTO_EcdsaSignature *sig); 222
223
224/**
225 * Starts a proof-of-work calculation given the pow object as well as
226 * target epochs and difficulty.
227 *
228 * @param pow the PoW to based calculations on.
229 * @param epochs the number of epochs for which the PoW must be valid.
230 * @param difficulty the base difficulty of the PoW.
231 * @return a handle for use in PoW rounds
232 */
233struct GNUNET_REVOCATION_PowCalculationHandle*
234GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow,
235 int epochs,
236 unsigned int difficulty);
158 237
159 238
239/**
240 * Calculate a single round in the key revocation PoW.
241 *
242 * @param pc handle to the PoW, initially called with NULL.
243 * @return GNUNET_YES if the @a pow is acceptable, GNUNET_NO if not
244 */
245enum GNUNET_GenericReturnValue
246GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc);
247
248
249/**
250 * Stop a PoW calculation
251 *
252 * @param pc the calculation to clean up
253 * @return #GNUNET_YES if pow valid, #GNUNET_NO if pow was set but is not
254 * valid
255 */
256void
257GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc);
258
160#if 0 /* keep Emacsens' auto-indent happy */ 259#if 0 /* keep Emacsens' auto-indent happy */
161{ 260{
162#endif 261#endif
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h
index 5e8892c0d..4003590fc 100644
--- a/src/include/gnunet_strings_lib.h
+++ b/src/include/gnunet_strings_lib.h
@@ -349,6 +349,19 @@ GNUNET_STRINGS_base64_encode (const void *in,
349 349
350 350
351/** 351/**
352 * Encode into Base64url. RFC7515
353 *
354 * @param in the data to encode
355 * @param len the length of the input
356 * @param output where to write the output (*output should be NULL,
357 * is allocated)
358 * @return the size of the output
359 */
360size_t
361GNUNET_STRINGS_base64url_encode (const void *in, size_t len, char **output);
362
363
364/**
352 * Decode from Base64. 365 * Decode from Base64.
353 * 366 *
354 * @param data the data to encode 367 * @param data the data to encode
@@ -364,6 +377,19 @@ GNUNET_STRINGS_base64_decode (const char *data,
364 377
365 378
366/** 379/**
380 * Decode from Base64url. RFC7515
381 *
382 * @param data the data to decode
383 * @param len the length of the input
384 * @param output where to write the output (*output should be NULL,
385 * is allocated)
386 * @return the size of the output
387 */
388size_t
389GNUNET_STRINGS_base64url_decode (const char *data, size_t len, void **out);
390
391
392/**
367 * Convert a peer path to a human-readable string. 393 * Convert a peer path to a human-readable string.
368 * 394 *
369 * @param pids array of PIDs to convert to a string 395 * @param pids array of PIDs to convert to a string
diff --git a/src/include/platform.h b/src/include/platform.h
index 3b07f47ea..baaf26ad6 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -45,6 +45,10 @@
45#include <sys/types.h> 45#include <sys/types.h>
46#endif 46#endif
47 47
48#ifdef __clang__
49#undef HAVE_STATIC_ASSERT
50#endif
51
48/** 52/**
49 * These may be expensive, but good for debugging... 53 * These may be expensive, but good for debugging...
50 */ 54 */
diff --git a/src/json/Makefile.am b/src/json/Makefile.am
index 5968a3596..9cd80851c 100644
--- a/src/json/Makefile.am
+++ b/src/json/Makefile.am
@@ -37,6 +37,7 @@ TESTS = \
37 37
38test_json_SOURCES = \ 38test_json_SOURCES = \
39 test_json.c 39 test_json.c
40test_json_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
40test_json_LDADD = \ 41test_json_LDADD = \
41 libgnunetjson.la \ 42 libgnunetjson.la \
42 $(top_builddir)/src/util/libgnunetutil.la \ 43 $(top_builddir)/src/util/libgnunetutil.la \
diff --git a/src/json/json_generator.c b/src/json/json_generator.c
index 89fd53265..594fcaf27 100644
--- a/src/json/json_generator.c
+++ b/src/json/json_generator.c
@@ -45,6 +45,7 @@ GNUNET_JSON_from_data (const void *data,
45 buf = GNUNET_STRINGS_data_to_string_alloc (data, size); 45 buf = GNUNET_STRINGS_data_to_string_alloc (data, size);
46 json = json_string (buf); 46 json = json_string (buf);
47 GNUNET_free (buf); 47 GNUNET_free (buf);
48 GNUNET_break (NULL != json);
48 return json; 49 return json;
49} 50}
50 51
@@ -64,17 +65,34 @@ GNUNET_JSON_from_time_abs (struct GNUNET_TIME_Absolute stamp)
64 GNUNET_TIME_round_abs (&stamp)); 65 GNUNET_TIME_round_abs (&stamp));
65 66
66 j = json_object (); 67 j = json_object ();
67 68 if (NULL == j)
69 {
70 GNUNET_break (0);
71 return NULL;
72 }
68 if (stamp.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) 73 if (stamp.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us)
69 { 74 {
70 json_object_set_new (j, 75 if (0 !=
71 "t_ms", 76 json_object_set_new (j,
72 json_string ("never")); 77 "t_ms",
78 json_string ("never")))
79 {
80 GNUNET_break (0);
81 json_decref (j);
82 return NULL;
83 }
73 return j; 84 return j;
74 } 85 }
75 json_object_set_new (j, 86 if (0 !=
76 "t_ms", 87 json_object_set_new (j,
77 json_integer ((json_int_t) (stamp.abs_value_us / 1000LL))); 88 "t_ms",
89 json_integer ((json_int_t) (stamp.abs_value_us
90 / 1000LL))))
91 {
92 GNUNET_break (0);
93 json_decref (j);
94 return NULL;
95 }
78 return j; 96 return j;
79} 97}
80 98
@@ -107,17 +125,34 @@ GNUNET_JSON_from_time_rel (struct GNUNET_TIME_Relative stamp)
107 GNUNET_TIME_round_rel (&stamp)); 125 GNUNET_TIME_round_rel (&stamp));
108 126
109 j = json_object (); 127 j = json_object ();
110 128 if (NULL == j)
129 {
130 GNUNET_break (0);
131 return NULL;
132 }
111 if (stamp.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) 133 if (stamp.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
112 { 134 {
113 json_object_set_new (j, 135 if (0 !=
114 "d_ms", 136 json_object_set_new (j,
115 json_string ("forever")); 137 "d_ms",
138 json_string ("forever")))
139 {
140 GNUNET_break (0);
141 json_decref (j);
142 return NULL;
143 }
116 return j; 144 return j;
117 } 145 }
118 json_object_set_new (j, 146 if (0 !=
119 "d_ms", 147 json_object_set_new (j,
120 json_integer ((json_int_t) (stamp.rel_value_us / 1000LL))); 148 "d_ms",
149 json_integer ((json_int_t) (stamp.rel_value_us
150 / 1000LL))))
151 {
152 GNUNET_break (0);
153 json_decref (j);
154 return NULL;
155 }
121 return j; 156 return j;
122} 157}
123 158
@@ -131,7 +166,7 @@ GNUNET_JSON_from_time_rel (struct GNUNET_TIME_Relative stamp)
131json_t * 166json_t *
132GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *pk) 167GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *pk)
133{ 168{
134 char *buf; 169 void *buf;
135 size_t buf_len; 170 size_t buf_len;
136 json_t *ret; 171 json_t *ret;
137 172
@@ -153,7 +188,7 @@ GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *pk)
153json_t * 188json_t *
154GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig) 189GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig)
155{ 190{
156 char *buf; 191 void *buf;
157 size_t buf_len; 192 size_t buf_len;
158 json_t *ret; 193 json_t *ret;
159 194
@@ -178,7 +213,8 @@ GNUNET_JSON_from_gnsrecord (const char*rname,
178 const struct GNUNET_GNSRECORD_Data *rd, 213 const struct GNUNET_GNSRECORD_Data *rd,
179 unsigned int rd_count) 214 unsigned int rd_count)
180{ 215{
181 struct GNUNET_TIME_Absolute expiration_time; 216 struct GNUNET_TIME_Absolute abs_exp;
217 struct GNUNET_TIME_Relative rel_exp;
182 const char *expiration_time_str; 218 const char *expiration_time_str;
183 const char *record_type_str; 219 const char *record_type_str;
184 char *value_str; 220 char *value_str;
@@ -187,36 +223,87 @@ GNUNET_JSON_from_gnsrecord (const char*rname,
187 json_t *records; 223 json_t *records;
188 224
189 data = json_object (); 225 data = json_object ();
190 json_object_set_new (data, 226 if (NULL == data)
191 "record_name", 227 {
192 json_string (rname)); 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 }
193 records = json_array (); 240 records = json_array ();
241 if (NULL == records)
242 {
243 GNUNET_break (0);
244 json_decref (data);
245 return NULL;
246 }
194 for (int i = 0; i < rd_count; i++) 247 for (int i = 0; i < rd_count; i++)
195 { 248 {
196 value_str = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, 249 value_str = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
197 rd[i].data, 250 rd[i].data,
198 rd[i].data_size); 251 rd[i].data_size);
199 expiration_time = GNUNET_GNSRECORD_record_get_expiration_time (1, &rd[i]); 252 if (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION & rd[i].flags)
200 expiration_time_str = GNUNET_STRINGS_absolute_time_to_string ( 253 {
201 expiration_time); 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 } else {
258 abs_exp.abs_value_us = rd[i].expiration_time;
259 expiration_time_str = GNUNET_STRINGS_absolute_time_to_string (abs_exp);
260 }
202 record_type_str = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type); 261 record_type_str = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
204 "Packing %s %s %s %d\n", 263 "Packing %s %s %s %d\n",
205 value_str, record_type_str, expiration_time_str, rd[i].flags); 264 value_str, record_type_str, expiration_time_str, rd[i].flags);
206 record = json_pack ("{s:s,s:s,s:s,s:i}", 265 record = json_pack ("{s:s,s:s,s:s,s:b,s:b,s:b,s:b}",
207 "value", 266 "value",
208 value_str, 267 value_str,
209 "record_type", 268 "record_type",
210 record_type_str, 269 record_type_str,
211 "expiration_time", 270 "expiration_time",
212 expiration_time_str, 271 expiration_time_str,
213 "flag", 272 "private",
214 rd[i].flags); 273 rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE,
215 GNUNET_assert (NULL != record); 274 "relative_expiration",
275 rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION,
276 "supplemental",
277 rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL,
278 "shadow",
279 rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD);
216 GNUNET_free (value_str); 280 GNUNET_free (value_str);
217 json_array_append_new (records, record); 281 if (NULL == record)
282 {
283 GNUNET_break (0);
284 json_decref (records);
285 json_decref (data);
286 return NULL;
287 }
288 if (0 !=
289 json_array_append_new (records,
290 record))
291 {
292 GNUNET_break (0);
293 json_decref (records);
294 json_decref (data);
295 return NULL;
296 }
297 }
298 if (0 !=
299 json_object_set_new (data,
300 "data",
301 records))
302 {
303 GNUNET_break (0);
304 json_decref (data);
305 return NULL;
218 } 306 }
219 json_object_set_new (data, "data", records);
220 return data; 307 return data;
221} 308}
222 309
diff --git a/src/json/json_gnsrecord.c b/src/json/json_gnsrecord.c
index bfbdd96ee..fe5858f06 100644
--- a/src/json/json_gnsrecord.c
+++ b/src/json/json_gnsrecord.c
@@ -31,7 +31,10 @@
31#define GNUNET_JSON_GNSRECORD_RECORD_DATA "data" 31#define GNUNET_JSON_GNSRECORD_RECORD_DATA "data"
32#define GNUNET_JSON_GNSRECORD_TYPE "record_type" 32#define GNUNET_JSON_GNSRECORD_TYPE "record_type"
33#define GNUNET_JSON_GNSRECORD_EXPIRATION_TIME "expiration_time" 33#define GNUNET_JSON_GNSRECORD_EXPIRATION_TIME "expiration_time"
34#define GNUNET_JSON_GNSRECORD_FLAG "flag" 34#define GNUNET_JSON_GNSRECORD_FLAG_PRIVATE "private"
35#define GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL "supplemental"
36#define GNUNET_JSON_GNSRECORD_FLAG_RELATIVE "relative_expiration"
37#define GNUNET_JSON_GNSRECORD_FLAG_SHADOW "shadow"
35#define GNUNET_JSON_GNSRECORD_RECORD_NAME "record_name" 38#define GNUNET_JSON_GNSRECORD_RECORD_NAME "record_name"
36#define GNUNET_JSON_GNSRECORD_NEVER "never" 39#define GNUNET_JSON_GNSRECORD_NEVER "never"
37 40
@@ -48,12 +51,15 @@ struct GnsRecordInfo
48static void 51static void
49cleanup_recordinfo (struct GnsRecordInfo *gnsrecord_info) 52cleanup_recordinfo (struct GnsRecordInfo *gnsrecord_info)
50{ 53{
54 char *tmp;
55
51 if (NULL != *(gnsrecord_info->rd)) 56 if (NULL != *(gnsrecord_info->rd))
52 { 57 {
53 for (int i = 0; i < *(gnsrecord_info->rd_count); i++) 58 for (int i = 0; i < *(gnsrecord_info->rd_count); i++)
54 { 59 {
55 if (NULL != (*(gnsrecord_info->rd))[i].data) 60 tmp = (char*) (*(gnsrecord_info->rd))[i].data;
56 GNUNET_free ((char *) (*(gnsrecord_info->rd))[i].data); 61 if (NULL != tmp)
62 GNUNET_free (tmp);
57 } 63 }
58 GNUNET_free (*(gnsrecord_info->rd)); 64 GNUNET_free (*(gnsrecord_info->rd));
59 *(gnsrecord_info->rd) = NULL; 65 *(gnsrecord_info->rd) = NULL;
@@ -80,20 +86,29 @@ parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd)
80 const char *value; 86 const char *value;
81 const char *record_type; 87 const char *record_type;
82 const char *expiration_time; 88 const char *expiration_time;
83 int flag; 89 int private;
90 int supplemental;
91 int rel_exp;
92 int shadow;
84 int unpack_state = 0; 93 int unpack_state = 0;
85 94
86 // interpret single gns record 95 // interpret single gns record
87 unpack_state = json_unpack (data, 96 unpack_state = json_unpack (data,
88 "{s:s, s:s, s:s, s?:i!}", 97 "{s:s, s:s, s:s, s:b, s:b, s:b, s:b}",
89 GNUNET_JSON_GNSRECORD_VALUE, 98 GNUNET_JSON_GNSRECORD_VALUE,
90 &value, 99 &value,
91 GNUNET_JSON_GNSRECORD_TYPE, 100 GNUNET_JSON_GNSRECORD_TYPE,
92 &record_type, 101 &record_type,
93 GNUNET_JSON_GNSRECORD_EXPIRATION_TIME, 102 GNUNET_JSON_GNSRECORD_EXPIRATION_TIME,
94 &expiration_time, 103 &expiration_time,
95 GNUNET_JSON_GNSRECORD_FLAG, 104 GNUNET_JSON_GNSRECORD_FLAG_PRIVATE,
96 &flag); 105 &private,
106 GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL,
107 &supplemental,
108 GNUNET_JSON_GNSRECORD_FLAG_RELATIVE,
109 &rel_exp,
110 GNUNET_JSON_GNSRECORD_FLAG_SHADOW,
111 &shadow);
97 if (0 != unpack_state) 112 if (0 != unpack_state)
98 { 113 {
99 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 114 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -119,9 +134,10 @@ parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd)
119 { 134 {
120 rd->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 135 rd->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
121 } 136 }
122 else if (GNUNET_OK == 137 else if ((1 != rel_exp) &&
138 (GNUNET_OK ==
123 GNUNET_STRINGS_fancy_time_to_absolute (expiration_time, 139 GNUNET_STRINGS_fancy_time_to_absolute (expiration_time,
124 &abs_expiration_time)) 140 &abs_expiration_time)))
125 { 141 {
126 rd->expiration_time = abs_expiration_time.abs_value_us; 142 rd->expiration_time = abs_expiration_time.abs_value_us;
127 } 143 }
@@ -129,6 +145,7 @@ parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd)
129 GNUNET_STRINGS_fancy_time_to_relative (expiration_time, 145 GNUNET_STRINGS_fancy_time_to_relative (expiration_time,
130 &rel_expiration_time)) 146 &rel_expiration_time))
131 { 147 {
148 rd->flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
132 rd->expiration_time = rel_expiration_time.rel_value_us; 149 rd->expiration_time = rel_expiration_time.rel_value_us;
133 } 150 }
134 else 151 else
@@ -136,7 +153,12 @@ parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd)
136 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Expiration time invalid\n"); 153 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Expiration time invalid\n");
137 return GNUNET_SYSERR; 154 return GNUNET_SYSERR;
138 } 155 }
139 rd->flags = (enum GNUNET_GNSRECORD_Flags) flag; 156 if (1 == private)
157 rd->flags |= GNUNET_GNSRECORD_RF_PRIVATE;
158 if (1 == supplemental)
159 rd->flags |= GNUNET_GNSRECORD_RF_SUPPLEMENTAL;
160 if (1 == shadow)
161 rd->flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD;
140 return GNUNET_OK; 162 return GNUNET_OK;
141} 163}
142 164
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index a405b8c3b..02bd6bfab 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -327,6 +327,60 @@ GNUNET_JSON_spec_json (const char *name,
327 327
328 328
329/** 329/**
330 * Parse given JSON object to a bool.
331 *
332 * @param cls closure, NULL
333 * @param root the json object representing data
334 * @param[out] spec where to write the data
335 * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
336 */
337static int
338parse_bool (void *cls,
339 json_t *root,
340 struct GNUNET_JSON_Specification *spec)
341{
342 bool *b = spec->ptr;
343
344 if (json_true () == root)
345 {
346 *b = true;
347 return GNUNET_OK;
348 }
349 if (json_false () == root)
350 {
351 *b = false;
352 return GNUNET_OK;
353 }
354 GNUNET_break_op (0);
355 return GNUNET_SYSERR;
356}
357
358
359/**
360 * boolean.
361 *
362 * @param name name of the JSON field
363 * @param[out] b where to store the boolean found under @a name
364 */
365struct GNUNET_JSON_Specification
366GNUNET_JSON_spec_bool (const char *name,
367 bool *b)
368{
369 struct GNUNET_JSON_Specification ret = {
370 .parser = &parse_bool,
371 .cleaner = NULL,
372 .cls = NULL,
373 .field = name,
374 .ptr = b,
375 .ptr_size = sizeof(bool),
376 .size_ptr = NULL
377 };
378
379 return ret;
380}
381
382
383/**
330 * Parse given JSON object to a uint8_t. 384 * Parse given JSON object to a uint8_t.
331 * 385 *
332 * @param cls closure, NULL 386 * @param cls closure, NULL
@@ -495,7 +549,7 @@ GNUNET_JSON_spec_uint32 (const char *name,
495 549
496 550
497/** 551/**
498 * Parse given JSON object to a uint8_t. 552 * Parse given JSON object to a uint64_t.
499 * 553 *
500 * @param cls closure, NULL 554 * @param cls closure, NULL
501 * @param root the json object representing data 555 * @param root the json object representing data
@@ -545,6 +599,57 @@ GNUNET_JSON_spec_uint64 (const char *name,
545} 599}
546 600
547 601
602/**
603 * Parse given JSON object to a int64_t.
604 *
605 * @param cls closure, NULL
606 * @param root the json object representing data
607 * @param[out] spec where to write the data
608 * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
609 */
610static int
611parse_i64 (void *cls,
612 json_t *root,
613 struct GNUNET_JSON_Specification *spec)
614{
615 json_int_t val;
616 int64_t *up = spec->ptr;
617
618 if (! json_is_integer (root))
619 {
620 GNUNET_break_op (0);
621 return GNUNET_SYSERR;
622 }
623 val = json_integer_value (root);
624 *up = (int64_t) val;
625 return GNUNET_OK;
626}
627
628
629/**
630 * 64-bit signed integer.
631 *
632 * @param name name of the JSON field
633 * @param[out] i64 where to store the integer found under @a name
634 */
635struct GNUNET_JSON_Specification
636GNUNET_JSON_spec_int64 (const char *name,
637 int64_t *i64)
638{
639 struct GNUNET_JSON_Specification ret = {
640 .parser = &parse_i64,
641 .cleaner = NULL,
642 .cls = NULL,
643 .field = name,
644 .ptr = i64,
645 .ptr_size = sizeof(int64_t),
646 .size_ptr = NULL
647 };
648
649 return ret;
650}
651
652
548/* ************ GNUnet-specific parser specifications ******************* */ 653/* ************ GNUnet-specific parser specifications ******************* */
549 654
550/** 655/**
diff --git a/src/json/test_json_mhd.c b/src/json/test_json_mhd.c
index 5ab1b63ca..642715f25 100644
--- a/src/json/test_json_mhd.c
+++ b/src/json/test_json_mhd.c
@@ -27,6 +27,7 @@
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_curl_lib.h" 29#include "gnunet_curl_lib.h"
30#include "gnunet_mhd_compat.h"
30#include <zlib.h> 31#include <zlib.h>
31 32
32#define MAX_SIZE 1024 * 1024 33#define MAX_SIZE 1024 * 1024
@@ -36,7 +37,7 @@ static json_t *bigj;
36static int global_ret; 37static int global_ret;
37 38
38 39
39static int 40static MHD_RESULT
40access_handler_cb (void *cls, 41access_handler_cb (void *cls,
41 struct MHD_Connection *connection, 42 struct MHD_Connection *connection,
42 const char *url, 43 const char *url,
diff --git a/src/namecache/gnunet-namecache.c b/src/namecache/gnunet-namecache.c
index 15a0c96ee..2e3c733e6 100644
--- a/src/namecache/gnunet-namecache.c
+++ b/src/namecache/gnunet-namecache.c
@@ -235,10 +235,10 @@ main (int argc, char *const *argv)
235 &run, 235 &run,
236 NULL)) 236 NULL))
237 { 237 {
238 GNUNET_free ((void *) argv); 238 GNUNET_free_nz ((void *) argv);
239 return 1; 239 return 1;
240 } 240 }
241 GNUNET_free ((void *) argv); 241 GNUNET_free_nz ((void *) argv);
242 return ret; 242 return ret;
243} 243}
244 244
diff --git a/src/namecache/plugin_namecache_flat.c b/src/namecache/plugin_namecache_flat.c
index 91f53ce2b..24f4f2570 100644
--- a/src/namecache/plugin_namecache_flat.c
+++ b/src/namecache/plugin_namecache_flat.c
@@ -78,7 +78,7 @@ database_setup (struct Plugin *plugin)
78 char*line; 78 char*line;
79 char*query; 79 char*query;
80 char*block; 80 char*block;
81 size_t size; 81 uint64_t size;
82 struct FlatFileEntry *entry; 82 struct FlatFileEntry *entry;
83 struct GNUNET_DISK_FileHandle *fh; 83 struct GNUNET_DISK_FileHandle *fh;
84 84
diff --git a/src/namecache/test_namecache_api_cache_block.c b/src/namecache/test_namecache_api_cache_block.c
index 9b150c9d9..12b72d93b 100644
--- a/src/namecache/test_namecache_api_cache_block.c
+++ b/src/namecache/test_namecache_api_cache_block.c
@@ -39,7 +39,7 @@ 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_CRYPTO_EcdsaPrivateKey privkey;
43 43
44static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 44static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
45 45
@@ -56,11 +56,6 @@ cleanup ()
56 GNUNET_NAMECACHE_disconnect (nsh); 56 GNUNET_NAMECACHE_disconnect (nsh);
57 nsh = NULL; 57 nsh = NULL;
58 } 58 }
59 if (NULL != privkey)
60 {
61 GNUNET_free (privkey);
62 privkey = NULL;
63 }
64 GNUNET_SCHEDULER_shutdown (); 59 GNUNET_SCHEDULER_shutdown ();
65} 60}
66 61
@@ -188,10 +183,12 @@ run (void *cls,
188 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 183 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
189 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", 184 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n",
190 hostkey_file); 185 hostkey_file);
191 privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); 186 GNUNET_assert (GNUNET_SYSERR !=
187 GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file,
188 GNUNET_YES,
189 &privkey));
192 GNUNET_free (hostkey_file); 190 GNUNET_free (hostkey_file);
193 GNUNET_assert (privkey != NULL); 191 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey);
194 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey);
195 192
196 193
197 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 10000000000; 194 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 10000000000;
@@ -200,7 +197,7 @@ run (void *cls,
200 rd.data = GNUNET_malloc (TEST_RECORD_DATALEN); 197 rd.data = GNUNET_malloc (TEST_RECORD_DATALEN);
201 rd.flags = 0; 198 rd.flags = 0;
202 memset ((char *) rd.data, 'a', TEST_RECORD_DATALEN); 199 memset ((char *) rd.data, 'a', TEST_RECORD_DATALEN);
203 block = GNUNET_GNSRECORD_block_create (privkey, 200 block = GNUNET_GNSRECORD_block_create (&privkey,
204 GNUNET_TIME_UNIT_FOREVER_ABS, 201 GNUNET_TIME_UNIT_FOREVER_ABS,
205 name, &rd, 1); 202 name, &rd, 1);
206 if (NULL == block) 203 if (NULL == block)
@@ -232,7 +229,7 @@ run (void *cls,
232 _ ("Namecache cannot cache no block\n")); 229 _ ("Namecache cannot cache no block\n"));
233 } 230 }
234 GNUNET_free (block); 231 GNUNET_free (block);
235 GNUNET_free ((void *) rd.data); 232 GNUNET_free_nz ((void *) rd.data);
236} 233}
237 234
238 235
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index 12d730f36..94861b478 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -99,11 +99,9 @@ TESTS = \
99 $(check_SCRIPTS) 99 $(check_SCRIPTS)
100endif 100endif
101 101
102if HAVE_MHD 102if HAVE_REST
103if HAVE_JSON
104REST_PLUGIN = libgnunet_plugin_rest_namestore.la 103REST_PLUGIN = libgnunet_plugin_rest_namestore.la
105endif 104endif
106endif
107 105
108lib_LTLIBRARIES = \ 106lib_LTLIBRARIES = \
109 libgnunetnamestore.la 107 libgnunetnamestore.la
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index fa0f835d1..34641d22e 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -36,6 +36,7 @@
36#include "gnunet_identity_service.h" 36#include "gnunet_identity_service.h"
37#include "gnunet_gnsrecord_lib.h" 37#include "gnunet_gnsrecord_lib.h"
38#include "gnunet_namestore_service.h" 38#include "gnunet_namestore_service.h"
39#include "gnunet_mhd_compat.h"
39 40
40/** 41/**
41 * Invalid method page. 42 * Invalid method page.
@@ -507,10 +508,10 @@ fill_s_reply (const char *info,
507 * specified offset 508 * specified offset
508 * @param off offset of data in the overall value 509 * @param off offset of data in the overall value
509 * @param size number of bytes in data available 510 * @param size number of bytes in data available
510 * @return MHD_YES to continue iterating, 511 * @return #MHD_YES to continue iterating,
511 * MHD_NO to abort the iteration 512 * #MHD_NO to abort the iteration
512 */ 513 */
513static int 514static MHD_RESULT
514post_iterator (void *cls, 515post_iterator (void *cls,
515 enum MHD_ValueKind kind, 516 enum MHD_ValueKind kind,
516 const char *key, 517 const char *key,
@@ -754,7 +755,7 @@ lookup_it_finished (void *cls)
754 * #MHD_NO if the socket must be closed due to a serious 755 * #MHD_NO if the socket must be closed due to a serious
755 * error while handling the request 756 * error while handling the request
756 */ 757 */
757static int 758static MHD_RESULT
758create_response (void *cls, 759create_response (void *cls,
759 struct MHD_Connection *connection, 760 struct MHD_Connection *connection,
760 const char *url, 761 const char *url,
@@ -767,7 +768,7 @@ create_response (void *cls,
767 struct MHD_Response *response; 768 struct MHD_Response *response;
768 struct Request *request; 769 struct Request *request;
769 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 770 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
770 int ret; 771 MHD_RESULT ret;
771 772
772 (void) cls; 773 (void) cls;
773 (void) version; 774 (void) version;
@@ -1209,7 +1210,7 @@ main (int argc,
1209 "GNU Name System First Come First Serve name registration service"), 1210 "GNU Name System First Come First Serve name registration service"),
1210 options, 1211 options,
1211 &run, NULL)) ? 0 : 1; 1212 &run, NULL)) ? 0 : 1;
1212 GNUNET_free ((void *) argv); 1213 GNUNET_free_nz ((void *) argv);
1213 GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey); 1214 GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey);
1214 return ret; 1215 return ret;
1215} 1216}
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 4c8fd5ce8..94fcb8952 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -1038,6 +1038,24 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg)
1038 GNUNET_free (rd); 1038 GNUNET_free (rd);
1039 return; 1039 return;
1040 } 1040 }
1041 if (NULL != nickstring)
1042 {
1043 if (0 == strlen (nickstring))
1044 {
1045 fprintf (stderr, _ ("Invalid nick `%s'\n"), nickstring);
1046 GNUNET_SCHEDULER_shutdown ();
1047 ret = 1;
1048 return;
1049 }
1050 add = 1;
1051 typestring = GNUNET_strdup (GNUNET_GNSRECORD_number_to_typename (GNUNET_GNSRECORD_TYPE_NICK));
1052 name = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT);
1053 value = GNUNET_strdup (nickstring);
1054 is_public = 0;
1055 expirationstring = GNUNET_strdup ("never");
1056 GNUNET_free (nickstring);
1057 nickstring = NULL;
1058 }
1041 1059
1042 if (add) 1060 if (add)
1043 { 1061 {
@@ -1193,6 +1211,23 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg)
1193 ret = 1; 1211 ret = 1;
1194 return; 1212 return;
1195 } 1213 }
1214 if (NULL == expirationstring)
1215 {
1216 fprintf (stderr,
1217 _ ("Missing option `%s' for operation `%s'\n"),
1218 "-e",
1219 _ ("add"));
1220 GNUNET_SCHEDULER_shutdown ();
1221 ret = 1;
1222 return;
1223 }
1224 if (GNUNET_OK != parse_expiration (expirationstring, &etime_is_rel, &etime))
1225 {
1226 fprintf (stderr, _ ("Invalid time format `%s'\n"), expirationstring);
1227 GNUNET_SCHEDULER_shutdown ();
1228 ret = 1;
1229 return;
1230 }
1196 memset (&rd, 0, sizeof(rd)); 1231 memset (&rd, 0, sizeof(rd));
1197 rd.data = &pkey; 1232 rd.data = &pkey;
1198 rd.data_size = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey); 1233 rd.data_size = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey);
@@ -1210,21 +1245,6 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg)
1210 &add_continuation, 1245 &add_continuation,
1211 &add_qe_uri); 1246 &add_qe_uri);
1212 } 1247 }
1213 if (NULL != nickstring)
1214 {
1215 if (0 == strlen (nickstring))
1216 {
1217 fprintf (stderr, _ ("Invalid nick `%s'\n"), nickstring);
1218 GNUNET_SCHEDULER_shutdown ();
1219 ret = 1;
1220 return;
1221 }
1222 add_qe_uri = GNUNET_NAMESTORE_set_nick (ns,
1223 &zone_pkey,
1224 nickstring,
1225 &add_continuation,
1226 &add_qe_uri);
1227 }
1228 if (monitor) 1248 if (monitor)
1229 { 1249 {
1230 zm = GNUNET_NAMESTORE_zone_monitor_start (cfg, 1250 zm = GNUNET_NAMESTORE_zone_monitor_start (cfg,
@@ -1248,7 +1268,7 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg)
1248 * @param ego an ego known to identity service, or NULL 1268 * @param ego an ego known to identity service, or NULL
1249 */ 1269 */
1250static void 1270static void
1251identity_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) 1271identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
1252{ 1272{
1253 const struct GNUNET_CONFIGURATION_Handle *cfg = cls; 1273 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
1254 1274
@@ -1671,11 +1691,11 @@ main (int argc, char *const *argv)
1671 &run, 1691 &run,
1672 NULL))) 1692 NULL)))
1673 { 1693 {
1674 GNUNET_free ((void *) argv); 1694 GNUNET_free_nz ((void *) argv);
1675 GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); 1695 GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
1676 return lret; 1696 return lret;
1677 } 1697 }
1678 GNUNET_free ((void *) argv); 1698 GNUNET_free_nz ((void *) argv);
1679 GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); 1699 GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
1680 return ret; 1700 return ret;
1681} 1701}
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 70e879ce9..c57f15f65 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -695,6 +695,8 @@ merge_with_nick_records (const struct GNUNET_GNSRECORD_Data *nick_rd,
695 } 695 }
696 /* append nick */ 696 /* append nick */
697 target[rd2_length] = *nick_rd; 697 target[rd2_length] = *nick_rd;
698 /* Mark as supplemental */
699 target[rd2_length].flags = nick_rd->flags | GNUNET_GNSRECORD_RF_SUPPLEMENTAL;
698 target[rd2_length].expiration_time = latest_expiration; 700 target[rd2_length].expiration_time = latest_expiration;
699 target[rd2_length].data = (void *) &data[data_offset]; 701 target[rd2_length].data = (void *) &data[data_offset];
700 GNUNET_memcpy (&data[data_offset], nick_rd->data, nick_rd->data_size); 702 GNUNET_memcpy (&data[data_offset], nick_rd->data, nick_rd->data_size);
@@ -913,7 +915,7 @@ refresh_block (struct NamestoreClient *nc,
913 nick = get_nick_record (zone_key); 915 nick = get_nick_record (zone_key);
914 res_count = rd_count; 916 res_count = rd_count;
915 res = (struct GNUNET_GNSRECORD_Data *) rd; /* fixme: a bit unclean... */ 917 res = (struct GNUNET_GNSRECORD_Data *) rd; /* fixme: a bit unclean... */
916 if (NULL != nick) 918 if (NULL != nick && (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT)))
917 { 919 {
918 nick->flags = 920 nick->flags =
919 (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; 921 (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE;
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index eca02bdc3..5b4e41475 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -1866,7 +1866,7 @@ main (int argc, char *const *argv)
1866 &run, 1866 &run,
1867 NULL))) 1867 NULL)))
1868 return ret; 1868 return ret;
1869 GNUNET_free ((void *) argv); 1869 GNUNET_free_nz ((void *) argv);
1870 fprintf (stderr, 1870 fprintf (stderr,
1871 "Rejected %u names, had %u cached, did %u lookups, stored %u record sets\n" 1871 "Rejected %u names, had %u cached, did %u lookups, stored %u record sets\n"
1872 "Found %u records, %u lookups failed, %u/%u pending on shutdown\n", 1872 "Found %u records, %u lookups failed, %u/%u pending on shutdown\n",
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index 156c115d2..2a085cf04 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -1064,43 +1064,6 @@ GNUNET_NAMESTORE_records_store (
1064 1064
1065 1065
1066/** 1066/**
1067 * Set the desired nick name for a zone
1068 *
1069 * @param h handle to the namestore
1070 * @param pkey private key of the zone
1071 * @param nick the nick name to set
1072 * @param cont continuation to call when done
1073 * @param cont_cls closure for @a cont
1074 * @return handle to abort the request
1075 */
1076struct GNUNET_NAMESTORE_QueueEntry *
1077GNUNET_NAMESTORE_set_nick (struct GNUNET_NAMESTORE_Handle *h,
1078 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
1079 const char *nick,
1080 GNUNET_NAMESTORE_ContinuationWithStatus cont,
1081 void *cont_cls)
1082{
1083 struct GNUNET_GNSRECORD_Data rd;
1084
1085 if (NULL == h->mq)
1086 return NULL;
1087 memset (&rd, 0, sizeof(rd));
1088 rd.data = nick;
1089 rd.data_size = strlen (nick) + 1;
1090 rd.record_type = GNUNET_GNSRECORD_TYPE_NICK;
1091 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
1092 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE;
1093 return GNUNET_NAMESTORE_records_store (h,
1094 pkey,
1095 GNUNET_GNS_EMPTY_LABEL_AT,
1096 1,
1097 &rd,
1098 cont,
1099 cont_cls);
1100}
1101
1102
1103/**
1104 * Lookup an item in the namestore. 1067 * Lookup an item in the namestore.
1105 * 1068 *
1106 * @param h handle to the namestore 1069 * @param h handle to the namestore
diff --git a/src/namestore/perf_namestore_api_zone_iteration.c b/src/namestore/perf_namestore_api_zone_iteration.c
index e8277ae65..c1012de62 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_CRYPTO_EcdsaPrivateKey privkey;
68 68
69static struct GNUNET_NAMESTORE_ZoneIterator *zi; 69static struct GNUNET_NAMESTORE_ZoneIterator *zi;
70 70
@@ -115,11 +115,6 @@ end (void *cls)
115 GNUNET_SCHEDULER_cancel (timeout_task); 115 GNUNET_SCHEDULER_cancel (timeout_task);
116 timeout_task = NULL; 116 timeout_task = NULL;
117 } 117 }
118 if (NULL != privkey)
119 {
120 GNUNET_free (privkey);
121 privkey = NULL;
122 }
123} 118}
124 119
125 120
@@ -243,7 +238,7 @@ zone_proc (void *cls,
243 } 238 }
244 GNUNET_free (wrd); 239 GNUNET_free (wrd);
245 if (0 != GNUNET_memcmp (zone, 240 if (0 != GNUNET_memcmp (zone,
246 privkey)) 241 &privkey))
247 { 242 {
248 res = 5; 243 res = 5;
249 GNUNET_break (0); 244 GNUNET_break (0);
@@ -324,7 +319,7 @@ publish_record (void *cls)
324 "l%u", 319 "l%u",
325 off); 320 off);
326 qe = GNUNET_NAMESTORE_records_store (nsh, 321 qe = GNUNET_NAMESTORE_records_store (nsh,
327 privkey, 322 &privkey,
328 label, 323 label,
329 1, rd, 324 1, rd,
330 &put_cont, 325 &put_cont,
@@ -346,8 +341,7 @@ run (void *cls,
346 NULL); 341 NULL);
347 nsh = GNUNET_NAMESTORE_connect (cfg); 342 nsh = GNUNET_NAMESTORE_connect (cfg);
348 GNUNET_assert (NULL != nsh); 343 GNUNET_assert (NULL != nsh);
349 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 344 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
350 GNUNET_assert (NULL != privkey);
351 start = GNUNET_TIME_absolute_get (); 345 start = GNUNET_TIME_absolute_get ();
352 t = GNUNET_SCHEDULER_add_now (&publish_record, 346 t = GNUNET_SCHEDULER_add_now (&publish_record,
353 NULL); 347 NULL);
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index d2a93a286..95b9b428f 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -123,6 +123,13 @@ struct EgoEntry
123 struct GNUNET_IDENTITY_Ego *ego; 123 struct GNUNET_IDENTITY_Ego *ego;
124}; 124};
125 125
126
127enum UpdateStrategy
128{
129 UPDATE_STRATEGY_REPLACE,
130 UPDATE_STRATEGY_APPEND
131};
132
126/** 133/**
127 * The request handle 134 * The request handle
128 */ 135 */
@@ -134,6 +141,16 @@ struct RequestHandle
134 char *record_name; 141 char *record_name;
135 142
136 /** 143 /**
144 * Record type filter
145 */
146 uint32_t record_type;
147
148 /**
149 * How to update the record set
150 */
151 enum UpdateStrategy update_strategy;
152
153 /**
137 * Records to store 154 * Records to store
138 */ 155 */
139 struct GNUNET_GNSRECORD_Data *rd; 156 struct GNUNET_GNSRECORD_Data *rd;
@@ -146,7 +163,7 @@ struct RequestHandle
146 /** 163 /**
147 * NAMESTORE Operation 164 * NAMESTORE Operation
148 */ 165 */
149 struct GNUNET_NAMESTORE_QueueEntry *add_qe; 166 struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
150 167
151 /** 168 /**
152 * Response object 169 * Response object
@@ -267,7 +284,7 @@ cleanup_handle (void *cls)
267 for (int i = 0; i < handle->rd_count; i++) 284 for (int i = 0; i < handle->rd_count; i++)
268 { 285 {
269 if (NULL != handle->rd[i].data) 286 if (NULL != handle->rd[i].data)
270 GNUNET_free ((void *) handle->rd[i].data); 287 GNUNET_free_nz ((void *) handle->rd[i].data);
271 } 288 }
272 GNUNET_free (handle->rd); 289 GNUNET_free (handle->rd);
273 } 290 }
@@ -275,8 +292,8 @@ cleanup_handle (void *cls)
275 GNUNET_SCHEDULER_cancel (handle->timeout_task); 292 GNUNET_SCHEDULER_cancel (handle->timeout_task);
276 if (NULL != handle->list_it) 293 if (NULL != handle->list_it)
277 GNUNET_NAMESTORE_zone_iteration_stop (handle->list_it); 294 GNUNET_NAMESTORE_zone_iteration_stop (handle->list_it);
278 if (NULL != handle->add_qe) 295 if (NULL != handle->ns_qe)
279 GNUNET_NAMESTORE_cancel (handle->add_qe); 296 GNUNET_NAMESTORE_cancel (handle->ns_qe);
280 if (NULL != handle->identity_handle) 297 if (NULL != handle->identity_handle)
281 GNUNET_IDENTITY_disconnect (handle->identity_handle); 298 GNUNET_IDENTITY_disconnect (handle->identity_handle);
282 if (NULL != handle->ns_handle) 299 if (NULL != handle->ns_handle)
@@ -324,6 +341,7 @@ do_error (void *cls)
324 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; 341 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
325 response = json_dumps (json_error, 0); 342 response = json_dumps (json_error, 0);
326 resp = GNUNET_REST_create_response (response); 343 resp = GNUNET_REST_create_response (response);
344 MHD_add_response_header (resp, "Content-Type", "application/json");
327 handle->proc (handle->proc_cls, resp, handle->response_code); 345 handle->proc (handle->proc_cls, resp, handle->response_code);
328 json_decref (json_error); 346 json_decref (json_error);
329 GNUNET_free (response); 347 GNUNET_free (response);
@@ -344,17 +362,21 @@ struct EgoEntry *
344get_egoentry_namestore (struct RequestHandle *handle, char *name) 362get_egoentry_namestore (struct RequestHandle *handle, char *name)
345{ 363{
346 struct EgoEntry *ego_entry; 364 struct EgoEntry *ego_entry;
347 365 char *copy = GNUNET_strdup (name);
348 if (NULL != name) 366 char *tmp;
367
368 if (NULL == name)
369 return NULL;
370 tmp = strtok (copy, "/");
371 for (ego_entry = handle->ego_head; NULL != ego_entry;
372 ego_entry = ego_entry->next)
349 { 373 {
350 for (ego_entry = handle->ego_head; NULL != ego_entry; 374 if (0 != strcasecmp (tmp, ego_entry->identifier))
351 ego_entry = ego_entry->next) 375 continue;
352 { 376 GNUNET_free (copy);
353 if (0 != strcasecmp (name, ego_entry->identifier)) 377 return ego_entry;
354 continue;
355 return ego_entry;
356 }
357 } 378 }
379 GNUNET_free (copy);
358 return NULL; 380 return NULL;
359} 381}
360 382
@@ -388,7 +410,7 @@ create_finished (void *cls, int32_t success, const char *emsg)
388 struct RequestHandle *handle = cls; 410 struct RequestHandle *handle = cls;
389 struct MHD_Response *resp; 411 struct MHD_Response *resp;
390 412
391 handle->add_qe = NULL; 413 handle->ns_qe = NULL;
392 if (GNUNET_YES != success) 414 if (GNUNET_YES != success)
393 { 415 {
394 if (NULL != emsg) 416 if (NULL != emsg)
@@ -419,7 +441,7 @@ del_finished (void *cls, int32_t success, const char *emsg)
419{ 441{
420 struct RequestHandle *handle = cls; 442 struct RequestHandle *handle = cls;
421 443
422 handle->add_qe = NULL; 444 handle->ns_qe = NULL;
423 if (GNUNET_NO == success) 445 if (GNUNET_NO == success)
424 { 446 {
425 handle->response_code = MHD_HTTP_NOT_FOUND; 447 handle->response_code = MHD_HTTP_NOT_FOUND;
@@ -467,6 +489,7 @@ namestore_list_finished (void *cls)
467 result_str = json_dumps (handle->resp_object, 0); 489 result_str = json_dumps (handle->resp_object, 0);
468 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 490 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
469 resp = GNUNET_REST_create_response (result_str); 491 resp = GNUNET_REST_create_response (result_str);
492 MHD_add_response_header (resp, "Content-Type", "application/json");
470 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 493 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
471 GNUNET_free_non_null (result_str); 494 GNUNET_free_non_null (result_str);
472 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); 495 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
@@ -486,17 +509,86 @@ namestore_list_iteration (void *cls,
486 const struct GNUNET_GNSRECORD_Data *rd) 509 const struct GNUNET_GNSRECORD_Data *rd)
487{ 510{
488 struct RequestHandle *handle = cls; 511 struct RequestHandle *handle = cls;
512 struct GNUNET_GNSRECORD_Data rd_filtered[rd_len];
489 json_t *record_obj; 513 json_t *record_obj;
514 int i = 0;
515 int j = 0;
490 516
491 if (NULL == handle->resp_object) 517 if (NULL == handle->resp_object)
492 handle->resp_object = json_array (); 518 handle->resp_object = json_array ();
493 record_obj = GNUNET_JSON_from_gnsrecord (rname, 519 for (i = 0; i < rd_len; i++)
494 rd, 520 {
495 rd_len); 521 if ((GNUNET_GNSRECORD_TYPE_ANY != handle->record_type) &&
496 json_array_append_new (handle->resp_object, record_obj); 522 (rd[i].record_type != handle->record_type))
523 continue; /* Apply filter */
524 rd_filtered[j] = rd[i];
525 rd_filtered[j].data = rd[i].data;
526 j++;
527 }
528 /** Only add if not empty **/
529 if (j > 0)
530 {
531 record_obj = GNUNET_JSON_from_gnsrecord (rname,
532 rd_filtered,
533 j);
534 json_array_append_new (handle->resp_object, record_obj);
535 }
497 GNUNET_NAMESTORE_zone_iterator_next (handle->list_it, 1); 536 GNUNET_NAMESTORE_zone_iterator_next (handle->list_it, 1);
498} 537}
499 538
539/**
540 * Handle lookup error
541 *
542 * @param cls the request handle
543 */
544static void
545ns_lookup_error_cb (void *cls)
546{
547 struct RequestHandle *handle = cls;
548
549 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED);
550 GNUNET_SCHEDULER_add_now (&do_error, handle);
551}
552
553
554static void
555ns_get_lookup_cb (void *cls,
556 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
557 const char *label,
558 unsigned int rd_len,
559 const struct GNUNET_GNSRECORD_Data *rd)
560{
561 struct RequestHandle *handle = cls;
562 struct GNUNET_GNSRECORD_Data rd_filtered[rd_len];
563 json_t *record_obj;
564 int i = 0;
565 int j = 0;
566
567 handle->ns_qe = NULL;
568 if (NULL == handle->resp_object)
569 handle->resp_object = json_array ();
570 for (i = 0; i < rd_len; i++)
571 {
572 if ((GNUNET_GNSRECORD_TYPE_ANY != handle->record_type) &&
573 (rd[i].record_type != handle->record_type))
574 continue; /* Apply filter */
575 rd_filtered[j] = rd[i];
576 rd_filtered[j].data = rd[i].data;
577 j++;
578 }
579 /** Only add if not empty **/
580 if (j > 0)
581 {
582 record_obj = GNUNET_JSON_from_gnsrecord (label,
583 rd_filtered,
584 j);
585 json_array_append_new (handle->resp_object, record_obj);
586 }
587 GNUNET_SCHEDULER_add_now (&namestore_list_finished, handle);
588}
589
590
591
500 592
501/** 593/**
502 * Handle namestore GET request 594 * Handle namestore GET request
@@ -512,38 +604,75 @@ namestore_get (struct GNUNET_REST_RequestHandle *con_handle,
512{ 604{
513 struct RequestHandle *handle = cls; 605 struct RequestHandle *handle = cls;
514 struct EgoEntry *ego_entry; 606 struct EgoEntry *ego_entry;
607 struct GNUNET_HashCode key;
515 char *egoname; 608 char *egoname;
609 char *labelname;
610 char *typename;
516 611
517 egoname = NULL; 612 egoname = NULL;
518 ego_entry = NULL; 613 ego_entry = NULL;
519 614
520 // set zone to name if given 615 // set zone to name if given
521 if (strlen (GNUNET_REST_API_NS_NAMESTORE) < strlen (handle->url)) 616 if (strlen (GNUNET_REST_API_NS_NAMESTORE) + 1 >= strlen (handle->url))
522 { 617 {
523 egoname = &handle->url[strlen (GNUNET_REST_API_NS_NAMESTORE) + 1]; 618 handle->response_code = MHD_HTTP_NOT_FOUND;
524 ego_entry = get_egoentry_namestore (handle, egoname); 619 handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
620 GNUNET_SCHEDULER_add_now (&do_error, handle);
621 return;
622 }
623 egoname = &handle->url[strlen (GNUNET_REST_API_NS_NAMESTORE) + 1];
624 ego_entry = get_egoentry_namestore (handle, egoname);
625 if (NULL == ego_entry)
626 {
627 handle->response_code = MHD_HTTP_NOT_FOUND;
628 handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
629 GNUNET_SCHEDULER_add_now (&do_error, handle);
630 return;
631 }
632 handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
525 633
526 if (NULL == ego_entry) 634 GNUNET_CRYPTO_hash ("record_type", strlen ("record_type"), &key);
635 if (GNUNET_NO ==
636 GNUNET_CONTAINER_multihashmap_contains (con_handle->url_param_map, &key))
637 {
638 handle->record_type = GNUNET_GNSRECORD_TYPE_ANY;
639 }
640 else
641 {
642 typename = GNUNET_CONTAINER_multihashmap_get (con_handle->url_param_map,
643 &key);
644 handle->record_type = GNUNET_GNSRECORD_typename_to_number (typename);
645 }
646 labelname = &egoname[strlen (ego_entry->identifier)];
647 // set zone to name if given
648 if (1 >= strlen (labelname))
649 {
650 handle->list_it =
651 GNUNET_NAMESTORE_zone_iteration_start (handle->ns_handle,
652 handle->zone_pkey,
653 &namestore_iteration_error,
654 handle,
655 &namestore_list_iteration,
656 handle,
657 &namestore_list_finished,
658 handle);
659 if (NULL == handle->list_it)
527 { 660 {
528 handle->response_code = MHD_HTTP_NOT_FOUND; 661 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED);
529 handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
530 GNUNET_SCHEDULER_add_now (&do_error, handle); 662 GNUNET_SCHEDULER_add_now (&do_error, handle);
531 return; 663 return;
532 } 664 }
665 return;
533 } 666 }
534 if (NULL != ego_entry) 667 handle->record_name = GNUNET_strdup (labelname + 1);
535 handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 668 handle->ns_qe = GNUNET_NAMESTORE_records_lookup (handle->ns_handle,
536 669 handle->zone_pkey,
537 handle->list_it = 670 handle->record_name,
538 GNUNET_NAMESTORE_zone_iteration_start (handle->ns_handle, 671 &ns_lookup_error_cb,
539 handle->zone_pkey, 672 handle,
540 &namestore_iteration_error, 673 &ns_get_lookup_cb,
541 handle, 674 handle);
542 &namestore_list_iteration, 675 if (NULL == handle->ns_qe)
543 handle,
544 &namestore_list_finished,
545 handle);
546 if (NULL == handle->list_it)
547 { 676 {
548 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); 677 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED);
549 GNUNET_SCHEDULER_add_now (&do_error, handle); 678 GNUNET_SCHEDULER_add_now (&do_error, handle);
@@ -552,15 +681,6 @@ namestore_get (struct GNUNET_REST_RequestHandle *con_handle,
552} 681}
553 682
554 683
555static void
556ns_lookup_error_cb (void *cls)
557{
558 struct RequestHandle *handle = cls;
559
560 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED);
561 GNUNET_SCHEDULER_add_now (&do_error, handle);
562}
563
564 684
565static void 685static void
566ns_lookup_cb (void *cls, 686ns_lookup_cb (void *cls,
@@ -571,19 +691,24 @@ ns_lookup_cb (void *cls,
571{ 691{
572 struct RequestHandle *handle = cls; 692 struct RequestHandle *handle = cls;
573 struct GNUNET_GNSRECORD_Data rd_new[rd_count + handle->rd_count]; 693 struct GNUNET_GNSRECORD_Data rd_new[rd_count + handle->rd_count];
694 int i = 0;
695 int j = 0;
574 696
575 for (int i = 0; i < rd_count; i++) 697 if (UPDATE_STRATEGY_APPEND == handle->update_strategy)
576 rd_new[i] = rd[i]; 698 {
577 for (int j = 0; j < handle->rd_count; j++) 699 for (i = 0; i < rd_count; i++)
578 rd_new[rd_count + j] = handle->rd[j]; 700 rd_new[i] = rd[i];
579 handle->add_qe = GNUNET_NAMESTORE_records_store (handle->ns_handle, 701 }
702 for (j = 0; j < handle->rd_count; j++)
703 rd_new[i + j] = handle->rd[j];
704 handle->ns_qe = GNUNET_NAMESTORE_records_store (handle->ns_handle,
580 handle->zone_pkey, 705 handle->zone_pkey,
581 handle->record_name, 706 handle->record_name,
582 rd_count + handle->rd_count, 707 i + j,
583 rd_new, 708 rd_new,
584 &create_finished, 709 &create_finished,
585 handle); 710 handle);
586 if (NULL == handle->add_qe) 711 if (NULL == handle->ns_qe)
587 { 712 {
588 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); 713 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED);
589 GNUNET_SCHEDULER_add_now (&do_error, handle); 714 GNUNET_SCHEDULER_add_now (&do_error, handle);
@@ -593,16 +718,16 @@ ns_lookup_cb (void *cls,
593 718
594 719
595/** 720/**
596 * Handle namestore POST request 721 * Handle namestore POST/PUT request
597 * 722 *
598 * @param con_handle the connection handle 723 * @param con_handle the connection handle
599 * @param url the url 724 * @param url the url
600 * @param cls the RequestHandle 725 * @param cls the RequestHandle
601 */ 726 */
602void 727void
603namestore_add (struct GNUNET_REST_RequestHandle *con_handle, 728namestore_add_or_update (struct GNUNET_REST_RequestHandle *con_handle,
604 const char *url, 729 const char *url,
605 void *cls) 730 void *cls)
606{ 731{
607 struct RequestHandle *handle = cls; 732 struct RequestHandle *handle = cls;
608 struct EgoEntry *ego_entry; 733 struct EgoEntry *ego_entry;
@@ -614,6 +739,7 @@ namestore_add (struct GNUNET_REST_RequestHandle *con_handle,
614 739
615 if (0 >= handle->rest_handle->data_size) 740 if (0 >= handle->rest_handle->data_size)
616 { 741 {
742 handle->response_code = MHD_HTTP_BAD_REQUEST;
617 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_NO_DATA); 743 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_NO_DATA);
618 GNUNET_SCHEDULER_add_now (&do_error, handle); 744 GNUNET_SCHEDULER_add_now (&do_error, handle);
619 return; 745 return;
@@ -637,6 +763,7 @@ namestore_add (struct GNUNET_REST_RequestHandle *con_handle,
637 GNUNET_JSON_parse_free (gnsspec); 763 GNUNET_JSON_parse_free (gnsspec);
638 if (0 >= strlen (handle->record_name)) 764 if (0 >= strlen (handle->record_name))
639 { 765 {
766 handle->response_code = MHD_HTTP_BAD_REQUEST;
640 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_INVALID_DATA); 767 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_INVALID_DATA);
641 GNUNET_SCHEDULER_add_now (&do_error, handle); 768 GNUNET_SCHEDULER_add_now (&do_error, handle);
642 json_decref (data_js); 769 json_decref (data_js);
@@ -648,29 +775,32 @@ namestore_add (struct GNUNET_REST_RequestHandle *con_handle,
648 ego_entry = NULL; 775 ego_entry = NULL;
649 776
650 // set zone to name if given 777 // set zone to name if given
651 if (strlen (GNUNET_REST_API_NS_NAMESTORE) < strlen (handle->url)) 778 if (strlen (GNUNET_REST_API_NS_NAMESTORE) + 1 >= strlen (handle->url))
652 { 779 {
653 egoname = &handle->url[strlen (GNUNET_REST_API_NS_NAMESTORE) + 1]; 780 handle->response_code = MHD_HTTP_NOT_FOUND;
654 ego_entry = get_egoentry_namestore (handle, egoname); 781 handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
782 GNUNET_SCHEDULER_add_now (&do_error, handle);
783 return;
784 }
785 egoname = &handle->url[strlen (GNUNET_REST_API_NS_NAMESTORE) + 1];
786 ego_entry = get_egoentry_namestore (handle, egoname);
655 787
656 if (NULL == ego_entry) 788 if (NULL == ego_entry)
657 { 789 {
658 handle->response_code = MHD_HTTP_NOT_FOUND; 790 handle->response_code = MHD_HTTP_NOT_FOUND;
659 handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND); 791 handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
660 GNUNET_SCHEDULER_add_now (&do_error, handle); 792 GNUNET_SCHEDULER_add_now (&do_error, handle);
661 return; 793 return;
662 }
663 } 794 }
664 if (NULL != ego_entry) 795 handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
665 handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 796 handle->ns_qe = GNUNET_NAMESTORE_records_lookup (handle->ns_handle,
666 handle->add_qe = GNUNET_NAMESTORE_records_lookup (handle->ns_handle,
667 handle->zone_pkey, 797 handle->zone_pkey,
668 handle->record_name, 798 handle->record_name,
669 &ns_lookup_error_cb, 799 &ns_lookup_error_cb,
670 handle, 800 handle,
671 &ns_lookup_cb, 801 &ns_lookup_cb,
672 handle); 802 handle);
673 if (NULL == handle->add_qe) 803 if (NULL == handle->ns_qe)
674 { 804 {
675 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); 805 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED);
676 GNUNET_SCHEDULER_add_now (&do_error, handle); 806 GNUNET_SCHEDULER_add_now (&do_error, handle);
@@ -680,6 +810,42 @@ namestore_add (struct GNUNET_REST_RequestHandle *con_handle,
680 810
681 811
682/** 812/**
813 * Handle namestore PUT request
814 *
815 * @param con_handle the connection handle
816 * @param url the url
817 * @param cls the RequestHandle
818 */
819void
820namestore_update (struct GNUNET_REST_RequestHandle *con_handle,
821 const char *url,
822 void *cls)
823{
824 struct RequestHandle *handle = cls;
825 handle->update_strategy = UPDATE_STRATEGY_REPLACE;
826 namestore_add_or_update (con_handle, url, cls);
827}
828
829
830/**
831 * Handle namestore POST request
832 *
833 * @param con_handle the connection handle
834 * @param url the url
835 * @param cls the RequestHandle
836 */
837void
838namestore_add (struct GNUNET_REST_RequestHandle *con_handle,
839 const char *url,
840 void *cls)
841{
842 struct RequestHandle *handle = cls;
843 handle->update_strategy = UPDATE_STRATEGY_APPEND;
844 namestore_add_or_update (con_handle, url, cls);
845}
846
847
848/**
683 * Handle namestore DELETE request 849 * Handle namestore DELETE request
684 * 850 *
685 * @param con_handle the connection handle 851 * @param con_handle the connection handle
@@ -692,49 +858,50 @@ namestore_delete (struct GNUNET_REST_RequestHandle *con_handle,
692 void *cls) 858 void *cls)
693{ 859{
694 struct RequestHandle *handle = cls; 860 struct RequestHandle *handle = cls;
695 struct GNUNET_HashCode key;
696 struct EgoEntry *ego_entry; 861 struct EgoEntry *ego_entry;
697 char *egoname; 862 char *egoname;
863 char *labelname;
698 864
699 egoname = NULL; 865 egoname = NULL;
700 ego_entry = NULL; 866 ego_entry = NULL;
701 867
702 // set zone to name if given 868 // set zone to name if given
703 if (strlen (GNUNET_REST_API_NS_NAMESTORE) < strlen (handle->url)) 869 if (strlen (GNUNET_REST_API_NS_NAMESTORE) + 1 >= strlen (handle->url))
704 { 870 {
705 egoname = &handle->url[strlen (GNUNET_REST_API_NS_NAMESTORE) + 1]; 871 handle->response_code = MHD_HTTP_NOT_FOUND;
706 ego_entry = get_egoentry_namestore (handle, egoname); 872 handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
707 873 GNUNET_SCHEDULER_add_now (&do_error, handle);
708 if (NULL == ego_entry) 874 return;
709 {
710 handle->response_code = MHD_HTTP_NOT_FOUND;
711 handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
712 GNUNET_SCHEDULER_add_now (&do_error, handle);
713 return;
714 }
715 } 875 }
716 if (NULL != ego_entry) 876 egoname = &handle->url[strlen (GNUNET_REST_API_NS_NAMESTORE) + 1];
717 handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 877 ego_entry = get_egoentry_namestore (handle, egoname);
718 878 if (NULL == ego_entry)
719 GNUNET_CRYPTO_hash ("record_name", strlen ("record_name"), &key);
720 if (GNUNET_NO ==
721 GNUNET_CONTAINER_multihashmap_contains (con_handle->url_param_map, &key))
722 { 879 {
723 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_INVALID_DATA); 880 handle->response_code = MHD_HTTP_NOT_FOUND;
881 handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
724 GNUNET_SCHEDULER_add_now (&do_error, handle); 882 GNUNET_SCHEDULER_add_now (&do_error, handle);
725 return; 883 return;
726 } 884 }
727 handle->record_name = GNUNET_strdup ( 885 handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
728 GNUNET_CONTAINER_multihashmap_get (con_handle->url_param_map, &key)); 886 labelname = &egoname[strlen (ego_entry->identifier)];
887 // set zone to name if given
888 if (1 >= strlen (labelname))
889 {
890 /* label is only "/" */
891 handle->response_code = MHD_HTTP_BAD_REQUEST;
892 handle->emsg = GNUNET_strdup ("Label missing");
893 GNUNET_SCHEDULER_add_now (&do_error, handle);
894 }
729 895
730 handle->add_qe = GNUNET_NAMESTORE_records_store (handle->ns_handle, 896 handle->record_name = GNUNET_strdup (labelname + 1);
731 handle->zone_pkey, 897 handle->ns_qe = GNUNET_NAMESTORE_records_store (handle->ns_handle,
732 handle->record_name, 898 handle->zone_pkey,
733 0, 899 handle->record_name,
900 0,
734 NULL, 901 NULL,
735 &del_finished, 902 &del_finished,
736 handle); 903 handle);
737 if (NULL == handle->add_qe) 904 if (NULL == handle->ns_qe)
738 { 905 {
739 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); 906 handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED);
740 GNUNET_SCHEDULER_add_now (&do_error, handle); 907 GNUNET_SCHEDULER_add_now (&do_error, handle);
@@ -779,6 +946,7 @@ init_cont (struct RequestHandle *handle)
779 static const struct GNUNET_REST_RequestHandler handlers[] = 946 static const struct GNUNET_REST_RequestHandler handlers[] =
780 { { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_NAMESTORE, &namestore_get }, 947 { { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_NAMESTORE, &namestore_get },
781 { MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_NAMESTORE, &namestore_add }, 948 { MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_NAMESTORE, &namestore_add },
949 { MHD_HTTP_METHOD_PUT, GNUNET_REST_API_NS_NAMESTORE, &namestore_update },
782 { MHD_HTTP_METHOD_DELETE, GNUNET_REST_API_NS_NAMESTORE, &namestore_delete }, 950 { MHD_HTTP_METHOD_DELETE, GNUNET_REST_API_NS_NAMESTORE, &namestore_delete },
783 { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_NAMESTORE, &options_cont }, 951 { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_NAMESTORE, &options_cont },
784 GNUNET_REST_HANDLER_END }; 952 GNUNET_REST_HANDLER_END };
diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c
index b3946de34..628e76254 100644
--- a/src/namestore/test_namestore_api_lookup_nick.c
+++ b/src/namestore/test_namestore_api_lookup_nick.c
@@ -23,6 +23,7 @@
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_namestore_service.h" 25#include "gnunet_namestore_service.h"
26#include "gnunet_gns_service.h"
26#include "gnunet_testing_lib.h" 27#include "gnunet_testing_lib.h"
27#include "gnunet_dnsparser_lib.h" 28#include "gnunet_dnsparser_lib.h"
28 29
@@ -40,7 +41,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
40 41
41static struct GNUNET_SCHEDULER_Task *endbadly_task; 42static struct GNUNET_SCHEDULER_Task *endbadly_task;
42 43
43static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 44static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey;
44 45
45static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 46static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
46 47
@@ -63,11 +64,6 @@ cleanup ()
63 GNUNET_NAMESTORE_disconnect (nsh); 64 GNUNET_NAMESTORE_disconnect (nsh);
64 nsh = NULL; 65 nsh = NULL;
65 } 66 }
66 if (NULL != privkey)
67 {
68 GNUNET_free (privkey);
69 privkey = NULL;
70 }
71 GNUNET_SCHEDULER_shutdown (); 67 GNUNET_SCHEDULER_shutdown ();
72} 68}
73 69
@@ -111,7 +107,7 @@ lookup_it (void *cls,
111 int found_record = GNUNET_NO; 107 int found_record = GNUNET_NO;
112 int found_nick = GNUNET_NO; 108 int found_nick = GNUNET_NO;
113 109
114 if (0 != GNUNET_memcmp (privkey, zone)) 110 if (0 != GNUNET_memcmp (&privkey, zone))
115 { 111 {
116 GNUNET_break (0); 112 GNUNET_break (0);
117 GNUNET_SCHEDULER_cancel (endbadly_task); 113 GNUNET_SCHEDULER_cancel (endbadly_task);
@@ -247,7 +243,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
247 } 243 }
248 /* Lookup */ 244 /* Lookup */
249 nsqe = GNUNET_NAMESTORE_records_lookup (nsh, 245 nsqe = GNUNET_NAMESTORE_records_lookup (nsh,
250 privkey, 246 &privkey,
251 name, 247 name,
252 &fail_cb, 248 &fail_cb,
253 NULL, 249 NULL,
@@ -272,8 +268,11 @@ nick_cont (void *cls, int32_t success, const char *emsg)
272 rd_orig.flags = 0; 268 rd_orig.flags = 0;
273 memset ((char *) rd_orig.data, 'a', TEST_RECORD_DATALEN); 269 memset ((char *) rd_orig.data, 'a', TEST_RECORD_DATALEN);
274 270
275 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 271 nsqe = GNUNET_NAMESTORE_records_store (nsh, &privkey,
276 1, &rd_orig, &put_cont, (void *) name); 272 name,
273 1,
274 &rd_orig,
275 &put_cont, (void *) name);
277} 276}
278 277
279 278
@@ -282,22 +281,32 @@ run (void *cls,
282 const struct GNUNET_CONFIGURATION_Handle *cfg, 281 const struct GNUNET_CONFIGURATION_Handle *cfg,
283 struct GNUNET_TESTING_Peer *peer) 282 struct GNUNET_TESTING_Peer *peer)
284{ 283{
284 struct GNUNET_GNSRECORD_Data rd;
285
285 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 286 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
286 &endbadly, 287 &endbadly,
287 NULL); 288 NULL);
288 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 289 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
289 GNUNET_assert (privkey != NULL); 290 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
290 GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
291 &pubkey); 291 &pubkey);
292 292
293 nsh = GNUNET_NAMESTORE_connect (cfg); 293 nsh = GNUNET_NAMESTORE_connect (cfg);
294 GNUNET_break (NULL != nsh); 294 GNUNET_break (NULL != nsh);
295 295
296 nsqe = GNUNET_NAMESTORE_set_nick (nsh, 296 memset (&rd, 0, sizeof(rd));
297 privkey, 297 rd.data = TEST_NICK;
298 TEST_NICK, 298 rd.data_size = strlen (TEST_NICK) + 1;
299 &nick_cont, 299 rd.record_type = GNUNET_GNSRECORD_TYPE_NICK;
300 (void *) name); 300 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
301 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE;
302 nsqe = GNUNET_NAMESTORE_records_store (nsh,
303 &privkey,
304 GNUNET_GNS_EMPTY_LABEL_AT,
305 1,
306 &rd,
307 &nick_cont,
308 (void *) name);
309
301 if (NULL == nsqe) 310 if (NULL == nsqe)
302 { 311 {
303 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 312 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c
index e2600855c..d0ad726cc 100644
--- a/src/namestore/test_namestore_api_lookup_private.c
+++ b/src/namestore/test_namestore_api_lookup_private.c
@@ -38,7 +38,7 @@ 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_CRYPTO_EcdsaPrivateKey privkey;
42 42
43static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 43static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
44 44
@@ -58,11 +58,6 @@ cleanup ()
58 GNUNET_NAMESTORE_disconnect (nsh); 58 GNUNET_NAMESTORE_disconnect (nsh);
59 nsh = NULL; 59 nsh = NULL;
60 } 60 }
61 if (NULL != privkey)
62 {
63 GNUNET_free (privkey);
64 privkey = NULL;
65 }
66 GNUNET_SCHEDULER_shutdown (); 61 GNUNET_SCHEDULER_shutdown ();
67} 62}
68 63
@@ -103,7 +98,7 @@ lookup_it (void *cls,
103{ 98{
104 nsqe = NULL; 99 nsqe = NULL;
105 100
106 if (0 != GNUNET_memcmp (privkey, 101 if (0 != GNUNET_memcmp (&privkey,
107 zone)) 102 zone))
108 { 103 {
109 GNUNET_break (0); 104 GNUNET_break (0);
@@ -173,7 +168,7 @@ put_cont (void *cls,
173 } 168 }
174 /* Lookup */ 169 /* Lookup */
175 nsqe = GNUNET_NAMESTORE_records_lookup (nsh, 170 nsqe = GNUNET_NAMESTORE_records_lookup (nsh,
176 privkey, 171 &privkey,
177 name, 172 name,
178 &fail_cb, 173 &fail_cb,
179 NULL, 174 NULL,
@@ -192,9 +187,8 @@ run (void *cls,
192 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 187 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
193 &endbadly, 188 &endbadly,
194 NULL); 189 NULL);
195 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 190 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
196 GNUNET_assert (privkey != NULL); 191 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey);
197 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey);
198 192
199 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; 193 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us;
200 rd.record_type = TEST_RECORD_TYPE; 194 rd.record_type = TEST_RECORD_TYPE;
@@ -206,7 +200,7 @@ run (void *cls,
206 nsh = GNUNET_NAMESTORE_connect (cfg); 200 nsh = GNUNET_NAMESTORE_connect (cfg);
207 GNUNET_break (NULL != nsh); 201 GNUNET_break (NULL != nsh);
208 nsqe = GNUNET_NAMESTORE_records_store (nsh, 202 nsqe = GNUNET_NAMESTORE_records_store (nsh,
209 privkey, 203 &privkey,
210 name, 204 name,
211 1, 205 1,
212 &rd, 206 &rd,
@@ -218,7 +212,7 @@ run (void *cls,
218 _ ("Namestore cannot store no block\n")); 212 _ ("Namestore cannot store no block\n"));
219 } 213 }
220 214
221 GNUNET_free ((void *) rd.data); 215 GNUNET_free_nz ((void *) rd.data);
222} 216}
223 217
224 218
diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c
index 6640f47ed..039c7cbf6 100644
--- a/src/namestore/test_namestore_api_lookup_public.c
+++ b/src/namestore/test_namestore_api_lookup_public.c
@@ -42,7 +42,7 @@ 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_CRYPTO_EcdsaPrivateKey privkey;
46 46
47static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 47static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
48 48
@@ -66,11 +66,6 @@ cleanup ()
66 GNUNET_NAMECACHE_disconnect (nch); 66 GNUNET_NAMECACHE_disconnect (nch);
67 nch = NULL; 67 nch = NULL;
68 } 68 }
69 if (NULL != privkey)
70 {
71 GNUNET_free (privkey);
72 privkey = NULL;
73 }
74 GNUNET_SCHEDULER_shutdown (); 69 GNUNET_SCHEDULER_shutdown ();
75} 70}
76 71
@@ -178,7 +173,8 @@ put_cont (void *cls, int32_t success, const char *emsg)
178 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 173 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
179 174
180 /* Create derived hash */ 175 /* Create derived hash */
181 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); 176 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
177 &pubkey);
182 GNUNET_GNSRECORD_query_from_public_key (&pubkey, name, &derived_hash); 178 GNUNET_GNSRECORD_query_from_public_key (&pubkey, name, &derived_hash);
183 179
184 ncqe = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash, 180 ncqe = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash,
@@ -197,9 +193,8 @@ run (void *cls,
197 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 193 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
198 &endbadly, 194 &endbadly,
199 NULL); 195 NULL);
200 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 196 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
201 GNUNET_assert (privkey != NULL); 197 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
202 GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
203 &pubkey); 198 &pubkey);
204 199
205 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; 200 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000;
@@ -213,15 +208,20 @@ run (void *cls,
213 nch = GNUNET_NAMECACHE_connect (cfg); 208 nch = GNUNET_NAMECACHE_connect (cfg);
214 GNUNET_break (NULL != nsh); 209 GNUNET_break (NULL != nsh);
215 GNUNET_break (NULL != nch); 210 GNUNET_break (NULL != nch);
216 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 211 nsqe = GNUNET_NAMESTORE_records_store (nsh,
217 1, &rd, &put_cont, (void *) name); 212 &privkey,
213 name,
214 1,
215 &rd,
216 &put_cont,
217 (void *) name);
218 if (NULL == nsqe) 218 if (NULL == nsqe)
219 { 219 {
220 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 220 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
221 _ ("Namestore cannot store no block\n")); 221 _ ("Namestore cannot store no block\n"));
222 } 222 }
223 223
224 GNUNET_free ((void *) rd.data); 224 GNUNET_free_nz ((void *) rd.data);
225} 225}
226 226
227 227
diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c
index 7daa6987c..d399d903a 100644
--- a/src/namestore/test_namestore_api_lookup_shadow.c
+++ b/src/namestore/test_namestore_api_lookup_shadow.c
@@ -44,7 +44,7 @@ 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_CRYPTO_EcdsaPrivateKey privkey;
48 48
49static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 49static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
50 50
@@ -68,11 +68,6 @@ cleanup ()
68 GNUNET_NAMECACHE_disconnect (nch); 68 GNUNET_NAMECACHE_disconnect (nch);
69 nch = NULL; 69 nch = NULL;
70 } 70 }
71 if (NULL != privkey)
72 {
73 GNUNET_free (privkey);
74 privkey = NULL;
75 }
76 GNUNET_SCHEDULER_shutdown (); 71 GNUNET_SCHEDULER_shutdown ();
77} 72}
78 73
@@ -210,10 +205,14 @@ put_cont (void *cls, int32_t success, const char *emsg)
210 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 205 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
211 206
212 /* Create derived hash */ 207 /* Create derived hash */
213 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); 208 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
214 GNUNET_GNSRECORD_query_from_public_key (&pubkey, name, &derived_hash); 209 &pubkey);
210 GNUNET_GNSRECORD_query_from_public_key (&pubkey,
211 name,
212 &derived_hash);
215 213
216 ncqe = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash, 214 ncqe = GNUNET_NAMECACHE_lookup_block (nch,
215 &derived_hash,
217 &name_lookup_proc, (void *) name); 216 &name_lookup_proc, (void *) name);
218} 217}
219 218
@@ -229,9 +228,8 @@ run (void *cls,
229 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 228 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
230 &endbadly, 229 &endbadly,
231 NULL); 230 NULL);
232 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 231 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
233 GNUNET_assert (privkey != NULL); 232 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
234 GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
235 &pubkey); 233 &pubkey);
236 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; 234 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000;
237 rd.record_type = TEST_RECORD_TYPE; 235 rd.record_type = TEST_RECORD_TYPE;
@@ -245,7 +243,7 @@ run (void *cls,
245 GNUNET_break (NULL != nsh); 243 GNUNET_break (NULL != nsh);
246 GNUNET_break (NULL != nch); 244 GNUNET_break (NULL != nch);
247 nsqe = GNUNET_NAMESTORE_records_store (nsh, 245 nsqe = GNUNET_NAMESTORE_records_store (nsh,
248 privkey, 246 &privkey,
249 name, 247 name,
250 1, 248 1,
251 &rd, 249 &rd,
@@ -256,7 +254,7 @@ run (void *cls,
256 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 254 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
257 _ ("Namestore cannot store no block\n")); 255 _ ("Namestore cannot store no block\n"));
258 } 256 }
259 GNUNET_free ((void *) rd.data); 257 GNUNET_free_nz ((void *) rd.data);
260} 258}
261 259
262 260
diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c
index 694c189e1..40dbeb90f 100644
--- a/src/namestore/test_namestore_api_lookup_shadow_filter.c
+++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c
@@ -48,7 +48,7 @@ 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_CRYPTO_EcdsaPrivateKey privkey;
52 52
53static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 53static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
54 54
@@ -82,11 +82,6 @@ cleanup ()
82 GNUNET_NAMECACHE_disconnect (nch); 82 GNUNET_NAMECACHE_disconnect (nch);
83 nch = NULL; 83 nch = NULL;
84 } 84 }
85 if (NULL != privkey)
86 {
87 GNUNET_free (privkey);
88 privkey = NULL;
89 }
90 GNUNET_SCHEDULER_shutdown (); 85 GNUNET_SCHEDULER_shutdown ();
91} 86}
92 87
@@ -272,7 +267,8 @@ put_cont (void *cls, int32_t success, const char *emsg)
272 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 267 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
273 268
274 /* Create derived hash */ 269 /* Create derived hash */
275 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); 270 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
271 &pubkey);
276 GNUNET_GNSRECORD_query_from_public_key (&pubkey, TEST_NAME, &derived_hash); 272 GNUNET_GNSRECORD_query_from_public_key (&pubkey, TEST_NAME, &derived_hash);
277 273
278 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)
@@ -301,9 +297,8 @@ run (void *cls,
301 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 297 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
302 &endbadly, 298 &endbadly,
303 NULL); 299 NULL);
304 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 300 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
305 GNUNET_assert (privkey != NULL); 301 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
306 GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
307 &pubkey); 302 &pubkey);
308 303
309 record_expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), 304 record_expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
@@ -328,16 +323,21 @@ run (void *cls,
328 nch = GNUNET_NAMECACHE_connect (cfg); 323 nch = GNUNET_NAMECACHE_connect (cfg);
329 GNUNET_break (NULL != nsh); 324 GNUNET_break (NULL != nsh);
330 GNUNET_break (NULL != nch); 325 GNUNET_break (NULL != nch);
331 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, TEST_NAME, 326 nsqe = GNUNET_NAMESTORE_records_store (nsh,
332 2, records, &put_cont, NULL); 327 &privkey,
328 TEST_NAME,
329 2,
330 records,
331 &put_cont,
332 NULL);
333 if (NULL == nsqe) 333 if (NULL == nsqe)
334 { 334 {
335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
336 _ ("Namestore cannot store no block\n")); 336 _ ("Namestore cannot store no block\n"));
337 } 337 }
338 338
339 GNUNET_free ((void *) records[0].data); 339 GNUNET_free_nz ((void *) records[0].data);
340 GNUNET_free ((void *) records[1].data); 340 GNUNET_free_nz ((void *) records[1].data);
341} 341}
342 342
343 343
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c
index a23424d30..cc00adf44 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_CRYPTO_EcdsaPrivateKey privkey;
41 41
42static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey2; 42static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2;
43 43
44static struct GNUNET_NAMESTORE_ZoneMonitor *zm; 44static struct GNUNET_NAMESTORE_ZoneMonitor *zm;
45 45
@@ -94,30 +94,19 @@ do_shutdown ()
94 94
95 if (s_rd_1 != NULL) 95 if (s_rd_1 != NULL)
96 { 96 {
97 GNUNET_free ((void *) s_rd_1->data); 97 GNUNET_free_nz ((void *) s_rd_1->data);
98 GNUNET_free (s_rd_1); 98 GNUNET_free (s_rd_1);
99 } 99 }
100 if (s_rd_2 != NULL) 100 if (s_rd_2 != NULL)
101 { 101 {
102 GNUNET_free ((void *) s_rd_2->data); 102 GNUNET_free_nz ((void *) s_rd_2->data);
103 GNUNET_free (s_rd_2); 103 GNUNET_free (s_rd_2);
104 } 104 }
105 if (s_rd_3 != NULL) 105 if (s_rd_3 != NULL)
106 { 106 {
107 GNUNET_free ((void *) s_rd_3->data); 107 GNUNET_free_nz ((void *) s_rd_3->data);
108 GNUNET_free (s_rd_3); 108 GNUNET_free (s_rd_3);
109 } 109 }
110
111 if (NULL != privkey)
112 {
113 GNUNET_free (privkey);
114 privkey = NULL;
115 }
116 if (NULL != privkey2)
117 {
118 GNUNET_free (privkey2);
119 privkey2 = NULL;
120 }
121} 110}
122 111
123 112
@@ -156,7 +145,7 @@ zone_proc (void *cls,
156 "Comparing results name %s\n", 145 "Comparing results name %s\n",
157 name); 146 name);
158 if (0 != GNUNET_memcmp (zone_key, 147 if (0 != GNUNET_memcmp (zone_key,
159 privkey)) 148 &privkey))
160 { 149 {
161 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 150 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
162 "Monitoring returned wrong zone key\n"); 151 "Monitoring returned wrong zone key\n");
@@ -284,12 +273,10 @@ run (void *cls,
284 struct GNUNET_TESTING_Peer *peer) 273 struct GNUNET_TESTING_Peer *peer)
285{ 274{
286 res = 1; 275 res = 1;
287 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 276 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
288 GNUNET_assert (privkey != NULL);
289
290 /* Start monitoring */ 277 /* Start monitoring */
291 zm = GNUNET_NAMESTORE_zone_monitor_start (cfg, 278 zm = GNUNET_NAMESTORE_zone_monitor_start (cfg,
292 privkey, 279 &privkey,
293 GNUNET_YES, 280 GNUNET_YES,
294 &fail_cb, 281 &fail_cb,
295 NULL, 282 NULL,
@@ -317,9 +304,7 @@ run (void *cls,
317 return; 304 return;
318 } 305 }
319 306
320 privkey2 = GNUNET_CRYPTO_ecdsa_key_create (); 307 GNUNET_CRYPTO_ecdsa_key_create (&privkey2);
321 GNUNET_assert (privkey2 != NULL);
322
323 308
324 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 309 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
325 "Created record 3\n"); 310 "Created record 3\n");
@@ -328,7 +313,7 @@ run (void *cls,
328 s_rd_3 = create_record (1); 313 s_rd_3 = create_record (1);
329 GNUNET_assert (NULL != (ns_ops[2] = 314 GNUNET_assert (NULL != (ns_ops[2] =
330 GNUNET_NAMESTORE_records_store (nsh, 315 GNUNET_NAMESTORE_records_store (nsh,
331 privkey2, 316 &privkey2,
332 s_name_3, 317 s_name_3,
333 1, 318 1,
334 s_rd_3, 319 s_rd_3,
@@ -340,7 +325,7 @@ run (void *cls,
340 s_rd_1 = create_record (1); 325 s_rd_1 = create_record (1);
341 GNUNET_assert (NULL != (ns_ops[0] = 326 GNUNET_assert (NULL != (ns_ops[0] =
342 GNUNET_NAMESTORE_records_store (nsh, 327 GNUNET_NAMESTORE_records_store (nsh,
343 privkey, 328 &privkey,
344 s_name_1, 329 s_name_1,
345 1, 330 1,
346 s_rd_1, 331 s_rd_1,
@@ -353,7 +338,7 @@ run (void *cls,
353 s_rd_2 = create_record (1); 338 s_rd_2 = create_record (1);
354 GNUNET_assert (NULL != (ns_ops[1] = 339 GNUNET_assert (NULL != (ns_ops[1] =
355 GNUNET_NAMESTORE_records_store (nsh, 340 GNUNET_NAMESTORE_records_store (nsh,
356 privkey, 341 &privkey,
357 s_name_2, 342 s_name_2,
358 1, 343 1,
359 s_rd_2, 344 s_rd_2,
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c
index a0951b943..728fcc25e 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_CRYPTO_EcdsaPrivateKey privkey;
42 42
43static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey2; 43static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2;
44 44
45static struct GNUNET_NAMESTORE_ZoneMonitor *zm; 45static struct GNUNET_NAMESTORE_ZoneMonitor *zm;
46 46
@@ -111,29 +111,19 @@ end (void *cls)
111 } 111 }
112 if (NULL != s_rd_1) 112 if (NULL != s_rd_1)
113 { 113 {
114 GNUNET_free ((void *) s_rd_1->data); 114 GNUNET_free_nz ((void *) s_rd_1->data);
115 GNUNET_free (s_rd_1); 115 GNUNET_free (s_rd_1);
116 } 116 }
117 if (NULL != s_rd_2) 117 if (NULL != s_rd_2)
118 { 118 {
119 GNUNET_free ((void *) s_rd_2->data); 119 GNUNET_free_nz ((void *) s_rd_2->data);
120 GNUNET_free (s_rd_2); 120 GNUNET_free (s_rd_2);
121 } 121 }
122 if (NULL != s_rd_3) 122 if (NULL != s_rd_3)
123 { 123 {
124 GNUNET_free ((void *) s_rd_3->data); 124 GNUNET_free_nz ((void *) s_rd_3->data);
125 GNUNET_free (s_rd_3); 125 GNUNET_free (s_rd_3);
126 } 126 }
127 if (NULL != privkey)
128 {
129 GNUNET_free (privkey);
130 privkey = NULL;
131 }
132 if (NULL != privkey2)
133 {
134 GNUNET_free (privkey2);
135 privkey2 = NULL;
136 }
137} 127}
138 128
139 129
@@ -151,7 +141,7 @@ zone_proc (void *cls,
151 "Comparing results name %s\n", 141 "Comparing results name %s\n",
152 name); 142 name);
153 if (0 != GNUNET_memcmp (zone_key, 143 if (0 != GNUNET_memcmp (zone_key,
154 privkey)) 144 &privkey))
155 { 145 {
156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 146 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
157 "Monitoring returned wrong zone key\n"); 147 "Monitoring returned wrong zone key\n");
@@ -262,7 +252,7 @@ put_cont (void *cls,
262 { 252 {
263 /* Start monitoring */ 253 /* Start monitoring */
264 zm = GNUNET_NAMESTORE_zone_monitor_start (cfg, 254 zm = GNUNET_NAMESTORE_zone_monitor_start (cfg,
265 privkey, 255 &privkey,
266 GNUNET_YES, 256 GNUNET_YES,
267 &fail_cb, 257 &fail_cb,
268 NULL, 258 NULL,
@@ -312,10 +302,8 @@ run (void *cls,
312 struct GNUNET_TESTING_Peer *peer) 302 struct GNUNET_TESTING_Peer *peer)
313{ 303{
314 res = 1; 304 res = 1;
315 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 305 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
316 GNUNET_assert (NULL != privkey); 306 GNUNET_CRYPTO_ecdsa_key_create (&privkey2);
317 privkey2 = GNUNET_CRYPTO_ecdsa_key_create ();
318 GNUNET_assert (NULL != privkey2);
319 307
320 cfg = mycfg; 308 cfg = mycfg;
321 GNUNET_SCHEDULER_add_shutdown (&end, 309 GNUNET_SCHEDULER_add_shutdown (&end,
@@ -342,7 +330,7 @@ run (void *cls,
342 s_rd_3 = create_record (1); 330 s_rd_3 = create_record (1);
343 GNUNET_assert (NULL != (ns_ops[2] = 331 GNUNET_assert (NULL != (ns_ops[2] =
344 GNUNET_NAMESTORE_records_store (nsh, 332 GNUNET_NAMESTORE_records_store (nsh,
345 privkey2, 333 &privkey2,
346 s_name_3, 334 s_name_3,
347 1, 335 1,
348 s_rd_3, 336 s_rd_3,
@@ -355,7 +343,7 @@ run (void *cls,
355 s_rd_1 = create_record (1); 343 s_rd_1 = create_record (1);
356 GNUNET_assert (NULL != (ns_ops[0] = 344 GNUNET_assert (NULL != (ns_ops[0] =
357 GNUNET_NAMESTORE_records_store (nsh, 345 GNUNET_NAMESTORE_records_store (nsh,
358 privkey, 346 &privkey,
359 s_name_1, 347 s_name_1,
360 1, 348 1,
361 s_rd_1, 349 s_rd_1,
@@ -367,7 +355,7 @@ run (void *cls,
367 s_rd_2 = create_record (1); 355 s_rd_2 = create_record (1);
368 GNUNET_assert (NULL != (ns_ops[1] = 356 GNUNET_assert (NULL != (ns_ops[1] =
369 GNUNET_NAMESTORE_records_store (nsh, 357 GNUNET_NAMESTORE_records_store (nsh,
370 privkey, 358 &privkey,
371 s_name_2, 359 s_name_2,
372 1, 360 1,
373 s_rd_2, 361 s_rd_2,
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
index ff826804e..e575821e8 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -39,7 +39,7 @@ 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_CRYPTO_EcdsaPrivateKey privkey;
43 43
44static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 44static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
45 45
@@ -58,11 +58,6 @@ cleanup ()
58 GNUNET_NAMESTORE_disconnect (nsh); 58 GNUNET_NAMESTORE_disconnect (nsh);
59 nsh = NULL; 59 nsh = NULL;
60 } 60 }
61 if (NULL != privkey)
62 {
63 GNUNET_free (privkey);
64 privkey = NULL;
65 }
66 GNUNET_SCHEDULER_shutdown (); 61 GNUNET_SCHEDULER_shutdown ();
67} 62}
68 63
@@ -145,7 +140,7 @@ put_cont (void *cls,
145 name, 140 name,
146 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 141 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
147 nsqe = GNUNET_NAMESTORE_records_store (nsh, 142 nsqe = GNUNET_NAMESTORE_records_store (nsh,
148 privkey, 143 &privkey,
149 name, 144 name,
150 0, NULL, 145 0, NULL,
151 &remove_cont, (void *) name); 146 &remove_cont, (void *) name);
@@ -163,9 +158,8 @@ run (void *cls,
163 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 158 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
164 &endbadly, 159 &endbadly,
165 NULL); 160 NULL);
166 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 161 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
167 GNUNET_assert (privkey != NULL); 162 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
168 GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
169 &pubkey); 163 &pubkey);
170 164
171 removed = GNUNET_NO; 165 removed = GNUNET_NO;
@@ -182,7 +176,7 @@ run (void *cls,
182 nsh = GNUNET_NAMESTORE_connect (cfg); 176 nsh = GNUNET_NAMESTORE_connect (cfg);
183 GNUNET_break (NULL != nsh); 177 GNUNET_break (NULL != nsh);
184 nsqe = GNUNET_NAMESTORE_records_store (nsh, 178 nsqe = GNUNET_NAMESTORE_records_store (nsh,
185 privkey, 179 &privkey,
186 name, 180 name,
187 1, 181 1,
188 &rd, 182 &rd,
@@ -193,7 +187,7 @@ run (void *cls,
193 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 187 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
194 _ ("Namestore cannot store no block\n")); 188 _ ("Namestore cannot store no block\n"));
195 } 189 }
196 GNUNET_free ((void *) rd.data); 190 GNUNET_free_nz ((void *) rd.data);
197} 191}
198 192
199 193
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 217f8a51a..75e1cc3ed 100644
--- a/src/namestore/test_namestore_api_remove_not_existing_record.c
+++ b/src/namestore/test_namestore_api_remove_not_existing_record.c
@@ -38,7 +38,7 @@ 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_CRYPTO_EcdsaPrivateKey privkey;
42 42
43static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 43static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
44 44
@@ -48,18 +48,13 @@ static struct GNUNET_NAMESTORE_QueueEntry *nsqe;
48 48
49 49
50static void 50static void
51cleanup () 51cleanup (void)
52{ 52{
53 if (NULL != nsh) 53 if (NULL != nsh)
54 { 54 {
55 GNUNET_NAMESTORE_disconnect (nsh); 55 GNUNET_NAMESTORE_disconnect (nsh);
56 nsh = NULL; 56 nsh = NULL;
57 } 57 }
58 if (NULL != privkey)
59 {
60 GNUNET_free (privkey);
61 privkey = NULL;
62 }
63 GNUNET_SCHEDULER_shutdown (); 58 GNUNET_SCHEDULER_shutdown ();
64} 59}
65 60
@@ -137,13 +132,14 @@ run (void *cls,
137 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 132 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
138 &endbadly, 133 &endbadly,
139 NULL); 134 NULL);
140 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 135 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
141 GNUNET_assert (privkey != NULL); 136 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey);
142 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey);
143 137
144 nsh = GNUNET_NAMESTORE_connect (cfg); 138 nsh = GNUNET_NAMESTORE_connect (cfg);
145 GNUNET_break (NULL != nsh); 139 GNUNET_break (NULL != nsh);
146 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 140 nsqe = GNUNET_NAMESTORE_records_store (nsh,
141 &privkey,
142 name,
147 0, NULL, 143 0, NULL,
148 &put_cont, (void *) name); 144 &put_cont, (void *) name);
149 if (NULL == nsqe) 145 if (NULL == nsqe)
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c
index 5bd0c3472..9223b56a3 100644
--- a/src/namestore/test_namestore_api_store.c
+++ b/src/namestore/test_namestore_api_store.c
@@ -39,7 +39,7 @@ 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_CRYPTO_EcdsaPrivateKey privkey;
43 43
44static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 44static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
45 45
@@ -56,11 +56,6 @@ cleanup ()
56 GNUNET_NAMESTORE_disconnect (nsh); 56 GNUNET_NAMESTORE_disconnect (nsh);
57 nsh = NULL; 57 nsh = NULL;
58 } 58 }
59 if (NULL != privkey)
60 {
61 GNUNET_free (privkey);
62 privkey = NULL;
63 }
64 GNUNET_SCHEDULER_shutdown (); 59 GNUNET_SCHEDULER_shutdown ();
65} 60}
66 61
@@ -118,9 +113,8 @@ run (void *cls,
118 113
119 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 114 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
120 &endbadly, NULL); 115 &endbadly, NULL);
121 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 116 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
122 GNUNET_assert (privkey != NULL); 117 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey);
123 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey);
124 118
125 119
126 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; 120 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us;
@@ -133,7 +127,7 @@ run (void *cls,
133 nsh = GNUNET_NAMESTORE_connect (cfg); 127 nsh = GNUNET_NAMESTORE_connect (cfg);
134 GNUNET_break (NULL != nsh); 128 GNUNET_break (NULL != nsh);
135 nsqe = GNUNET_NAMESTORE_records_store (nsh, 129 nsqe = GNUNET_NAMESTORE_records_store (nsh,
136 privkey, 130 &privkey,
137 name, 131 name,
138 1, 132 1,
139 &rd, 133 &rd,
@@ -144,7 +138,7 @@ run (void *cls,
144 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 138 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
145 _ ("Namestore cannot store no block\n")); 139 _ ("Namestore cannot store no block\n"));
146 } 140 }
147 GNUNET_free ((void *) rd.data); 141 GNUNET_free_nz ((void *) rd.data);
148} 142}
149 143
150 144
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c
index b0244453a..7a5a69a6c 100644
--- a/src/namestore/test_namestore_api_store_update.c
+++ b/src/namestore/test_namestore_api_store_update.c
@@ -48,7 +48,7 @@ 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_CRYPTO_EcdsaPrivateKey privkey;
52 52
53static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 53static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
54 54
@@ -106,11 +106,6 @@ end (void *cls)
106 GNUNET_NAMECACHE_disconnect (nch); 106 GNUNET_NAMECACHE_disconnect (nch);
107 nch = NULL; 107 nch = NULL;
108 } 108 }
109 if (NULL != privkey)
110 {
111 GNUNET_free (privkey);
112 privkey = NULL;
113 }
114} 109}
115 110
116 111
@@ -157,7 +152,7 @@ rd_decrypt_cb (void *cls,
157 TEST_RECORD_DATALEN2); 152 TEST_RECORD_DATALEN2);
158 153
159 nsqe = GNUNET_NAMESTORE_records_store (nsh, 154 nsqe = GNUNET_NAMESTORE_records_store (nsh,
160 privkey, 155 &privkey,
161 name, 156 name,
162 1, 157 1,
163 &rd_new, 158 &rd_new,
@@ -226,7 +221,7 @@ put_cont (void *cls,
226 name, 221 name,
227 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 222 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
228 /* Create derived hash */ 223 /* Create derived hash */
229 GNUNET_GNSRECORD_query_from_private_key (privkey, 224 GNUNET_GNSRECORD_query_from_private_key (&privkey,
230 name, 225 name,
231 &derived_hash); 226 &derived_hash);
232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 227 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -251,9 +246,8 @@ run (void *cls,
251 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 246 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
252 &endbadly, 247 &endbadly,
253 NULL); 248 NULL);
254 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 249 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
255 GNUNET_assert (privkey != NULL); 250 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
256 GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
257 &pubkey); 251 &pubkey);
258 rd.flags = GNUNET_GNSRECORD_RF_NONE; 252 rd.flags = GNUNET_GNSRECORD_RF_NONE;
259 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; 253 rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000;
@@ -269,7 +263,7 @@ run (void *cls,
269 nch = GNUNET_NAMECACHE_connect (cfg); 263 nch = GNUNET_NAMECACHE_connect (cfg);
270 GNUNET_break (NULL != nch); 264 GNUNET_break (NULL != nch);
271 nsqe = GNUNET_NAMESTORE_records_store (nsh, 265 nsqe = GNUNET_NAMESTORE_records_store (nsh,
272 privkey, 266 &privkey,
273 name, 267 name,
274 1, 268 1,
275 &rd, 269 &rd,
@@ -280,7 +274,7 @@ run (void *cls,
280 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 274 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
281 _ ("Namestore cannot store no block\n")); 275 _ ("Namestore cannot store no block\n"));
282 } 276 }
283 GNUNET_free ((void *) rd.data); 277 GNUNET_free_nz ((void *) rd.data);
284} 278}
285 279
286 280
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index d69b7cc62..a363ee28d 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_CRYPTO_EcdsaPrivateKey privkey;
41 41
42static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey2; 42static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2;
43 43
44static struct GNUNET_NAMESTORE_ZoneIterator *zi; 44static struct GNUNET_NAMESTORE_ZoneIterator *zi;
45 45
@@ -88,32 +88,22 @@ end (void *cls)
88 GNUNET_SCHEDULER_cancel (endbadly_task); 88 GNUNET_SCHEDULER_cancel (endbadly_task);
89 endbadly_task = NULL; 89 endbadly_task = NULL;
90 } 90 }
91 if (NULL != privkey)
92 {
93 GNUNET_free (privkey);
94 privkey = NULL;
95 }
96 if (NULL != privkey2)
97 {
98 GNUNET_free (privkey2);
99 privkey2 = NULL;
100 }
101 GNUNET_free_non_null (s_name_1); 91 GNUNET_free_non_null (s_name_1);
102 GNUNET_free_non_null (s_name_2); 92 GNUNET_free_non_null (s_name_2);
103 GNUNET_free_non_null (s_name_3); 93 GNUNET_free_non_null (s_name_3);
104 if (NULL != s_rd_1) 94 if (NULL != s_rd_1)
105 { 95 {
106 GNUNET_free ((void *) s_rd_1->data); 96 GNUNET_free_nz ((void *) s_rd_1->data);
107 GNUNET_free (s_rd_1); 97 GNUNET_free (s_rd_1);
108 } 98 }
109 if (NULL != s_rd_2) 99 if (NULL != s_rd_2)
110 { 100 {
111 GNUNET_free ((void *) s_rd_2->data); 101 GNUNET_free_nz ((void *) s_rd_2->data);
112 GNUNET_free (s_rd_2); 102 GNUNET_free (s_rd_2);
113 } 103 }
114 if (NULL != s_rd_3) 104 if (NULL != s_rd_3)
115 { 105 {
116 GNUNET_free ((void *) s_rd_3->data); 106 GNUNET_free_nz ((void *) s_rd_3->data);
117 GNUNET_free (s_rd_3); 107 GNUNET_free (s_rd_3);
118 } 108 }
119 if (NULL != nsh) 109 if (NULL != nsh)
@@ -161,7 +151,7 @@ zone_proc (void *cls,
161 151
162 GNUNET_assert (NULL != zone); 152 GNUNET_assert (NULL != zone);
163 if (0 == GNUNET_memcmp (zone, 153 if (0 == GNUNET_memcmp (zone,
164 privkey)) 154 &privkey))
165 { 155 {
166 if (0 == strcmp (label, s_name_1)) 156 if (0 == strcmp (label, s_name_1))
167 { 157 {
@@ -207,7 +197,7 @@ zone_proc (void *cls,
207 } 197 }
208 } 198 }
209 else if (0 == GNUNET_memcmp (zone, 199 else if (0 == GNUNET_memcmp (zone,
210 privkey2)) 200 &privkey2))
211 { 201 {
212 if (0 == strcmp (label, s_name_3)) 202 if (0 == strcmp (label, s_name_3))
213 { 203 {
@@ -382,9 +372,11 @@ empty_zone_end (void *cls)
382 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 372 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
383 "Using zonekey file `%s' \n", 373 "Using zonekey file `%s' \n",
384 hostkey_file); 374 hostkey_file);
385 privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); 375 GNUNET_assert (GNUNET_SYSERR !=
376 GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file,
377 GNUNET_YES,
378 &privkey));
386 GNUNET_free (hostkey_file); 379 GNUNET_free (hostkey_file);
387 GNUNET_assert (privkey != NULL);
388 380
389 GNUNET_asprintf (&hostkey_file, 381 GNUNET_asprintf (&hostkey_file,
390 "zonefiles%s%s", 382 "zonefiles%s%s",
@@ -393,16 +385,18 @@ empty_zone_end (void *cls)
393 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 385 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
394 "Using zonekey file `%s' \n", 386 "Using zonekey file `%s' \n",
395 hostkey_file); 387 hostkey_file);
396 privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); 388 GNUNET_assert (GNUNET_SYSERR !=
389 GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file,
390 GNUNET_YES,
391 &privkey2));
397 GNUNET_free (hostkey_file); 392 GNUNET_free (hostkey_file);
398 GNUNET_assert (privkey2 != NULL);
399 393
400 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); 394 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n");
401 395
402 GNUNET_asprintf (&s_name_1, "dummy1"); 396 GNUNET_asprintf (&s_name_1, "dummy1");
403 s_rd_1 = create_record (1); 397 s_rd_1 = create_record (1);
404 GNUNET_NAMESTORE_records_store (nsh, 398 GNUNET_NAMESTORE_records_store (nsh,
405 privkey, 399 &privkey,
406 s_name_1, 400 s_name_1,
407 1, s_rd_1, 401 1, s_rd_1,
408 &put_cont, 402 &put_cont,
@@ -412,7 +406,7 @@ empty_zone_end (void *cls)
412 GNUNET_asprintf (&s_name_2, "dummy2"); 406 GNUNET_asprintf (&s_name_2, "dummy2");
413 s_rd_2 = create_record (1); 407 s_rd_2 = create_record (1);
414 GNUNET_NAMESTORE_records_store (nsh, 408 GNUNET_NAMESTORE_records_store (nsh,
415 privkey, 409 &privkey,
416 s_name_2, 410 s_name_2,
417 1, s_rd_2, 411 1, s_rd_2,
418 &put_cont, 412 &put_cont,
@@ -423,7 +417,7 @@ empty_zone_end (void *cls)
423 GNUNET_asprintf (&s_name_3, "dummy3"); 417 GNUNET_asprintf (&s_name_3, "dummy3");
424 s_rd_3 = create_record (1); 418 s_rd_3 = create_record (1);
425 GNUNET_NAMESTORE_records_store (nsh, 419 GNUNET_NAMESTORE_records_store (nsh,
426 privkey2, 420 &privkey2,
427 s_name_3, 421 s_name_3,
428 1, 422 1,
429 s_rd_3, 423 s_rd_3,
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c
index 35eab2735..1ebdfd073 100644
--- a/src/namestore/test_namestore_api_zone_iteration_nick.c
+++ b/src/namestore/test_namestore_api_zone_iteration_nick.c
@@ -23,6 +23,7 @@
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_namestore_service.h" 25#include "gnunet_namestore_service.h"
26#include "gnunet_gns_service.h"
26#include "gnunet_testing_lib.h" 27#include "gnunet_testing_lib.h"
27#include "namestore.h" 28#include "namestore.h"
28#include "gnunet_dnsparser_lib.h" 29#include "gnunet_dnsparser_lib.h"
@@ -37,9 +38,9 @@
37 38
38static struct GNUNET_NAMESTORE_Handle *nsh; 39static struct GNUNET_NAMESTORE_Handle *nsh;
39 40
40static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 41static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey;
41 42
42static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey2; 43static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2;
43 44
44static struct GNUNET_NAMESTORE_ZoneIterator *zi; 45static struct GNUNET_NAMESTORE_ZoneIterator *zi;
45 46
@@ -87,30 +88,19 @@ end (void *cls)
87 88
88 if (s_rd_1 != NULL) 89 if (s_rd_1 != NULL)
89 { 90 {
90 GNUNET_free ((void *) s_rd_1->data); 91 GNUNET_free_nz ((void *) s_rd_1->data);
91 GNUNET_free (s_rd_1); 92 GNUNET_free (s_rd_1);
92 } 93 }
93 if (s_rd_2 != NULL) 94 if (s_rd_2 != NULL)
94 { 95 {
95 GNUNET_free ((void *) s_rd_2->data); 96 GNUNET_free_nz ((void *) s_rd_2->data);
96 GNUNET_free (s_rd_2); 97 GNUNET_free (s_rd_2);
97 } 98 }
98 if (s_rd_3 != NULL) 99 if (s_rd_3 != NULL)
99 { 100 {
100 GNUNET_free ((void *) s_rd_3->data); 101 GNUNET_free_nz ((void *) s_rd_3->data);
101 GNUNET_free (s_rd_3); 102 GNUNET_free (s_rd_3);
102 } 103 }
103
104 if (privkey != NULL)
105 {
106 GNUNET_free (privkey);
107 privkey = NULL;
108 }
109 if (privkey2 != NULL)
110 {
111 GNUNET_free (privkey2);
112 privkey2 = NULL;
113 }
114} 104}
115 105
116 106
@@ -171,13 +161,13 @@ zone_proc (void *cls,
171 int failed = GNUNET_NO; 161 int failed = GNUNET_NO;
172 162
173 GNUNET_assert (NULL != zone); 163 GNUNET_assert (NULL != zone);
174 if (0 == GNUNET_memcmp (zone, privkey)) 164 if (0 == GNUNET_memcmp (zone, &privkey))
175 { 165 {
176 failed = check_zone_1 (label, rd_count, rd); 166 failed = check_zone_1 (label, rd_count, rd);
177 if (GNUNET_YES == failed) 167 if (GNUNET_YES == failed)
178 GNUNET_break (0); 168 GNUNET_break (0);
179 } 169 }
180 else if (0 == GNUNET_memcmp (zone, privkey2)) 170 else if (0 == GNUNET_memcmp (zone, &privkey2))
181 { 171 {
182 failed = check_zone_2 (label, rd_count, rd); 172 failed = check_zone_2 (label, rd_count, rd);
183 if (GNUNET_YES == failed) 173 if (GNUNET_YES == failed)
@@ -295,7 +285,7 @@ nick_2_cont (void *cls,
295 285
296 GNUNET_asprintf (&s_name_1, "dummy1"); 286 GNUNET_asprintf (&s_name_1, "dummy1");
297 s_rd_1 = create_record (1); 287 s_rd_1 = create_record (1);
298 GNUNET_NAMESTORE_records_store (nsh, privkey, s_name_1, 288 GNUNET_NAMESTORE_records_store (nsh, &privkey, s_name_1,
299 1, s_rd_1, 289 1, s_rd_1,
300 &put_cont, NULL); 290 &put_cont, NULL);
301 291
@@ -303,7 +293,7 @@ nick_2_cont (void *cls,
303 "Created record 2 \n"); 293 "Created record 2 \n");
304 GNUNET_asprintf (&s_name_2, "dummy2"); 294 GNUNET_asprintf (&s_name_2, "dummy2");
305 s_rd_2 = create_record (1); 295 s_rd_2 = create_record (1);
306 GNUNET_NAMESTORE_records_store (nsh, privkey, s_name_2, 296 GNUNET_NAMESTORE_records_store (nsh, &privkey, s_name_2,
307 1, s_rd_2, &put_cont, NULL); 297 1, s_rd_2, &put_cont, NULL);
308 298
309 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 299 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -312,7 +302,7 @@ nick_2_cont (void *cls,
312 /* name in different zone */ 302 /* name in different zone */
313 GNUNET_asprintf (&s_name_3, "dummy3"); 303 GNUNET_asprintf (&s_name_3, "dummy3");
314 s_rd_3 = create_record (1); 304 s_rd_3 = create_record (1);
315 GNUNET_NAMESTORE_records_store (nsh, privkey2, s_name_3, 305 GNUNET_NAMESTORE_records_store (nsh, &privkey2, s_name_3,
316 1, s_rd_3, 306 1, s_rd_3,
317 &put_cont, NULL); 307 &put_cont, NULL);
318} 308}
@@ -324,9 +314,22 @@ nick_1_cont (void *cls, int32_t success, const char *emsg)
324 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 314 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
325 "Nick 1 added : %s\n", 315 "Nick 1 added : %s\n",
326 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 316 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
317 struct GNUNET_GNSRECORD_Data rd;
318
319 memset (&rd, 0, sizeof(rd));
320 rd.data = ZONE_NICK_2;
321 rd.data_size = strlen (ZONE_NICK_2) + 1;
322 rd.record_type = GNUNET_GNSRECORD_TYPE_NICK;
323 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
324 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE;
325 nsqe = GNUNET_NAMESTORE_records_store (nsh,
326 &privkey2,
327 GNUNET_GNS_EMPTY_LABEL_AT,
328 1,
329 &rd,
330 &nick_2_cont,
331 &privkey2);
327 332
328 nsqe = GNUNET_NAMESTORE_set_nick (nsh, privkey2, ZONE_NICK_2, &nick_2_cont,
329 &privkey2);
330 if (NULL == nsqe) 333 if (NULL == nsqe)
331 { 334 {
332 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -373,17 +376,25 @@ static void
373empty_zone_end (void *cls) 376empty_zone_end (void *cls)
374{ 377{
375 GNUNET_assert (nsh == cls); 378 GNUNET_assert (nsh == cls);
379 struct GNUNET_GNSRECORD_Data rd;
380
376 zi = NULL; 381 zi = NULL;
377 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 382 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
378 GNUNET_assert (privkey != NULL); 383 GNUNET_CRYPTO_ecdsa_key_create (&privkey2);
379 privkey2 = GNUNET_CRYPTO_ecdsa_key_create (); 384
380 GNUNET_assert (privkey2 != NULL); 385 memset (&rd, 0, sizeof(rd));
381 386 rd.data = ZONE_NICK_1;
382 nsqe = GNUNET_NAMESTORE_set_nick (nsh, 387 rd.data_size = strlen (ZONE_NICK_1) + 1;
383 privkey, 388 rd.record_type = GNUNET_GNSRECORD_TYPE_NICK;
384 ZONE_NICK_1, 389 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
385 &nick_1_cont, 390 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE;
386 &privkey); 391 nsqe = GNUNET_NAMESTORE_records_store (nsh,
392 &privkey,
393 GNUNET_GNS_EMPTY_LABEL_AT,
394 1,
395 &rd,
396 &nick_1_cont,
397 NULL);
387 if (NULL == nsqe) 398 if (NULL == nsqe)
388 { 399 {
389 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 400 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
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 d37fb8cd3..0534da001 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_CRYPTO_EcdsaPrivateKey privkey;
42 42
43static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey2; 43static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2;
44 44
45static struct GNUNET_NAMESTORE_ZoneIterator *zi; 45static struct GNUNET_NAMESTORE_ZoneIterator *zi;
46 46
@@ -88,32 +88,22 @@ end (void *cls)
88 GNUNET_SCHEDULER_cancel (endbadly_task); 88 GNUNET_SCHEDULER_cancel (endbadly_task);
89 endbadly_task = NULL; 89 endbadly_task = NULL;
90 } 90 }
91 if (NULL != privkey)
92 {
93 GNUNET_free (privkey);
94 privkey = NULL;
95 }
96 if (NULL != privkey2)
97 {
98 GNUNET_free (privkey2);
99 privkey2 = NULL;
100 }
101 GNUNET_free_non_null (s_name_1); 91 GNUNET_free_non_null (s_name_1);
102 GNUNET_free_non_null (s_name_2); 92 GNUNET_free_non_null (s_name_2);
103 GNUNET_free_non_null (s_name_3); 93 GNUNET_free_non_null (s_name_3);
104 if (s_rd_1 != NULL) 94 if (s_rd_1 != NULL)
105 { 95 {
106 GNUNET_free ((void *) s_rd_1->data); 96 GNUNET_free_nz ((void *) s_rd_1->data);
107 GNUNET_free (s_rd_1); 97 GNUNET_free (s_rd_1);
108 } 98 }
109 if (s_rd_2 != NULL) 99 if (s_rd_2 != NULL)
110 { 100 {
111 GNUNET_free ((void *) s_rd_2->data); 101 GNUNET_free_nz ((void *) s_rd_2->data);
112 GNUNET_free (s_rd_2); 102 GNUNET_free (s_rd_2);
113 } 103 }
114 if (s_rd_3 != NULL) 104 if (s_rd_3 != NULL)
115 { 105 {
116 GNUNET_free ((void *) s_rd_3->data); 106 GNUNET_free_nz ((void *) s_rd_3->data);
117 GNUNET_free (s_rd_3); 107 GNUNET_free (s_rd_3);
118 } 108 }
119 if (nsh != NULL) 109 if (nsh != NULL)
@@ -143,7 +133,7 @@ zone_proc (void *cls,
143 133
144 GNUNET_assert (NULL != zone); 134 GNUNET_assert (NULL != zone);
145 if (0 == GNUNET_memcmp (zone, 135 if (0 == GNUNET_memcmp (zone,
146 privkey)) 136 &privkey))
147 { 137 {
148 if (0 == strcmp (label, s_name_1)) 138 if (0 == strcmp (label, s_name_1))
149 { 139 {
@@ -188,7 +178,7 @@ zone_proc (void *cls,
188 GNUNET_break (0); 178 GNUNET_break (0);
189 } 179 }
190 } 180 }
191 else if (0 == GNUNET_memcmp (zone, privkey2)) 181 else if (0 == GNUNET_memcmp (zone, &privkey2))
192 { 182 {
193 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 183 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
194 "Received data for not requested zone\n"); 184 "Received data for not requested zone\n");
@@ -271,7 +261,7 @@ put_cont (void *cls,
271 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 261 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
272 "All records created, starting iteration over all zones \n"); 262 "All records created, starting iteration over all zones \n");
273 zi = GNUNET_NAMESTORE_zone_iteration_start (nsh, 263 zi = GNUNET_NAMESTORE_zone_iteration_start (nsh,
274 privkey, 264 &privkey,
275 &fail_cb, 265 &fail_cb,
276 NULL, 266 NULL,
277 &zone_proc, 267 &zone_proc,
@@ -351,18 +341,15 @@ static void
351empty_zone_proc_end (void *cls) 341empty_zone_proc_end (void *cls)
352{ 342{
353 zi = NULL; 343 zi = NULL;
354 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 344 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
355 GNUNET_assert (privkey != NULL); 345 GNUNET_CRYPTO_ecdsa_key_create (&privkey2);
356 privkey2 = GNUNET_CRYPTO_ecdsa_key_create ();
357 GNUNET_assert (privkey2 != NULL);
358
359 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 346 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
360 "Created record 1\n"); 347 "Created record 1\n");
361 GNUNET_asprintf (&s_name_1, 348 GNUNET_asprintf (&s_name_1,
362 "dummy1"); 349 "dummy1");
363 s_rd_1 = create_record (1); 350 s_rd_1 = create_record (1);
364 GNUNET_NAMESTORE_records_store (nsh, 351 GNUNET_NAMESTORE_records_store (nsh,
365 privkey, 352 &privkey,
366 s_name_1, 353 s_name_1,
367 1, 354 1,
368 s_rd_1, 355 s_rd_1,
@@ -375,7 +362,7 @@ empty_zone_proc_end (void *cls)
375 "dummy2"); 362 "dummy2");
376 s_rd_2 = create_record (1); 363 s_rd_2 = create_record (1);
377 GNUNET_NAMESTORE_records_store (nsh, 364 GNUNET_NAMESTORE_records_store (nsh,
378 privkey, 365 &privkey,
379 s_name_2, 366 s_name_2,
380 1, 367 1,
381 s_rd_2, 368 s_rd_2,
@@ -390,7 +377,7 @@ empty_zone_proc_end (void *cls)
390 "dummy3"); 377 "dummy3");
391 s_rd_3 = create_record (1); 378 s_rd_3 = create_record (1);
392 GNUNET_NAMESTORE_records_store (nsh, 379 GNUNET_NAMESTORE_records_store (nsh,
393 privkey2, 380 &privkey2,
394 s_name_3, 381 s_name_3,
395 1, s_rd_3, 382 1, s_rd_3,
396 &put_cont, 383 &put_cont,
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index 81fb4de7e..b71a8789c 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_CRYPTO_EcdsaPrivateKey privkey;
38 38
39static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey2; 39static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2;
40 40
41static struct GNUNET_NAMESTORE_ZoneIterator *zi; 41static struct GNUNET_NAMESTORE_ZoneIterator *zi;
42 42
@@ -80,29 +80,19 @@ end (void *cls)
80 GNUNET_free_non_null (s_name_3); 80 GNUNET_free_non_null (s_name_3);
81 if (s_rd_1 != NULL) 81 if (s_rd_1 != NULL)
82 { 82 {
83 GNUNET_free ((void *) s_rd_1->data); 83 GNUNET_free_nz ((void *) s_rd_1->data);
84 GNUNET_free (s_rd_1); 84 GNUNET_free (s_rd_1);
85 } 85 }
86 if (s_rd_2 != NULL) 86 if (s_rd_2 != NULL)
87 { 87 {
88 GNUNET_free ((void *) s_rd_2->data); 88 GNUNET_free_nz ((void *) s_rd_2->data);
89 GNUNET_free (s_rd_2); 89 GNUNET_free (s_rd_2);
90 } 90 }
91 if (s_rd_3 != NULL) 91 if (s_rd_3 != NULL)
92 { 92 {
93 GNUNET_free ((void *) s_rd_3->data); 93 GNUNET_free_nz ((void *) s_rd_3->data);
94 GNUNET_free (s_rd_3); 94 GNUNET_free (s_rd_3);
95 } 95 }
96 if (privkey != NULL)
97 {
98 GNUNET_free (privkey);
99 privkey = NULL;
100 }
101 if (privkey2 != NULL)
102 {
103 GNUNET_free (privkey2);
104 privkey2 = NULL;
105 }
106} 96}
107 97
108 98
@@ -130,7 +120,7 @@ zone_proc (void *cls,
130 int failed = GNUNET_NO; 120 int failed = GNUNET_NO;
131 121
132 GNUNET_assert (NULL != zone); 122 GNUNET_assert (NULL != zone);
133 if (0 == GNUNET_memcmp (zone, privkey)) 123 if (0 == GNUNET_memcmp (zone, &privkey))
134 { 124 {
135 if (0 == strcmp (label, s_name_1)) 125 if (0 == strcmp (label, s_name_1))
136 { 126 {
@@ -175,7 +165,7 @@ zone_proc (void *cls,
175 GNUNET_break (0); 165 GNUNET_break (0);
176 } 166 }
177 } 167 }
178 else if (0 == GNUNET_memcmp (zone, privkey2)) 168 else if (0 == GNUNET_memcmp (zone, &privkey2))
179 { 169 {
180 if (0 == strcmp (label, s_name_3)) 170 if (0 == strcmp (label, s_name_3))
181 { 171 {
@@ -368,10 +358,11 @@ empty_zone_proc_end (void *cls)
368 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 358 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
369 "Using zonekey file `%s' \n", 359 "Using zonekey file `%s' \n",
370 hostkey_file); 360 hostkey_file);
371 privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); 361 GNUNET_assert (GNUNET_SYSERR
362 != GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file,
363 GNUNET_YES,
364 &privkey));
372 GNUNET_free (hostkey_file); 365 GNUNET_free (hostkey_file);
373 GNUNET_assert (privkey != NULL);
374
375 GNUNET_asprintf (&hostkey_file, 366 GNUNET_asprintf (&hostkey_file,
376 "zonefiles%s%s", 367 "zonefiles%s%s",
377 DIR_SEPARATOR_STR, 368 DIR_SEPARATOR_STR,
@@ -379,17 +370,19 @@ empty_zone_proc_end (void *cls)
379 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 370 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
380 "Using zonekey file `%s'\n", 371 "Using zonekey file `%s'\n",
381 hostkey_file); 372 hostkey_file);
382 privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); 373 GNUNET_assert (GNUNET_SYSERR !=
374 GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file,
375 GNUNET_YES,
376 &privkey2));
383 GNUNET_free (hostkey_file); 377 GNUNET_free (hostkey_file);
384 GNUNET_assert (privkey2 != NULL);
385
386 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 378 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
387 "Created record 1\n"); 379 "Created record 1\n");
388 380
389 GNUNET_asprintf (&s_name_1, 381 GNUNET_asprintf (&s_name_1,
390 "dummy1"); 382 "dummy1");
391 s_rd_1 = create_record (1); 383 s_rd_1 = create_record (1);
392 GNUNET_NAMESTORE_records_store (nsh, privkey, s_name_1, 384 GNUNET_NAMESTORE_records_store (nsh,
385 &privkey, s_name_1,
393 1, s_rd_1, &put_cont, NULL); 386 1, s_rd_1, &put_cont, NULL);
394 387
395 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 388 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -398,7 +391,7 @@ empty_zone_proc_end (void *cls)
398 "dummy2"); 391 "dummy2");
399 s_rd_2 = create_record (1); 392 s_rd_2 = create_record (1);
400 GNUNET_NAMESTORE_records_store (nsh, 393 GNUNET_NAMESTORE_records_store (nsh,
401 privkey, 394 &privkey,
402 s_name_2, 395 s_name_2,
403 1, 396 1,
404 s_rd_2, 397 s_rd_2,
@@ -411,7 +404,7 @@ empty_zone_proc_end (void *cls)
411 GNUNET_asprintf (&s_name_3, "dummy3"); 404 GNUNET_asprintf (&s_name_3, "dummy3");
412 s_rd_3 = create_record (1); 405 s_rd_3 = create_record (1);
413 GNUNET_NAMESTORE_records_store (nsh, 406 GNUNET_NAMESTORE_records_store (nsh,
414 privkey2, 407 &privkey2,
415 s_name_3, 408 s_name_3,
416 1, 409 1,
417 s_rd_3, 410 s_rd_3,
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c
index 65366e267..94cc5c285 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -42,7 +42,7 @@ 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_CRYPTO_EcdsaPrivateKey privkey;
46 46
47static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 47static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
48 48
@@ -82,11 +82,6 @@ end (void *cls)
82 GNUNET_SCHEDULER_cancel (endbadly_task); 82 GNUNET_SCHEDULER_cancel (endbadly_task);
83 endbadly_task = NULL; 83 endbadly_task = NULL;
84 } 84 }
85 if (NULL != privkey)
86 {
87 GNUNET_free (privkey);
88 privkey = NULL;
89 }
90 if (NULL != nsh) 85 if (NULL != nsh)
91 { 86 {
92 GNUNET_NAMESTORE_disconnect (nsh); 87 GNUNET_NAMESTORE_disconnect (nsh);
@@ -133,7 +128,7 @@ zone_to_name_proc (void *cls,
133 } 128 }
134 if ((NULL == zone_key) || 129 if ((NULL == zone_key) ||
135 (0 != GNUNET_memcmp (zone_key, 130 (0 != GNUNET_memcmp (zone_key,
136 privkey))) 131 &privkey)))
137 { 132 {
138 fail = GNUNET_YES; 133 fail = GNUNET_YES;
139 GNUNET_break (0); 134 GNUNET_break (0);
@@ -176,7 +171,7 @@ put_cont (void *cls,
176 res = 0; 171 res = 0;
177 172
178 qe = GNUNET_NAMESTORE_zone_to_name (nsh, 173 qe = GNUNET_NAMESTORE_zone_to_name (nsh,
179 privkey, 174 &privkey,
180 &s_zone_value, 175 &s_zone_value,
181 &error_cb, 176 &error_cb,
182 NULL, 177 NULL,
@@ -208,10 +203,9 @@ run (void *cls,
208 GNUNET_SCHEDULER_add_shutdown (&end, 203 GNUNET_SCHEDULER_add_shutdown (&end,
209 NULL); 204 NULL);
210 GNUNET_asprintf (&s_name, "dummy"); 205 GNUNET_asprintf (&s_name, "dummy");
211 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 206 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
212 GNUNET_assert (NULL != privkey);
213 /* get public key */ 207 /* get public key */
214 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, 208 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
215 &pubkey); 209 &pubkey);
216 210
217 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, 211 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
@@ -229,7 +223,7 @@ run (void *cls,
229 nsh = GNUNET_NAMESTORE_connect (cfg); 223 nsh = GNUNET_NAMESTORE_connect (cfg);
230 GNUNET_break (NULL != nsh); 224 GNUNET_break (NULL != nsh);
231 GNUNET_NAMESTORE_records_store (nsh, 225 GNUNET_NAMESTORE_records_store (nsh,
232 privkey, 226 &privkey,
233 s_name, 227 s_name,
234 1, 228 1,
235 &rd, 229 &rd,
diff --git a/src/nat-auto/gnunet-nat-auto.c b/src/nat-auto/gnunet-nat-auto.c
index d40f4ef32..95a7ced9e 100644
--- a/src/nat-auto/gnunet-nat-auto.c
+++ b/src/nat-auto/gnunet-nat-auto.c
@@ -359,7 +359,7 @@ main (int argc, char *const argv[])
359 { 359 {
360 global_ret = 1; 360 global_ret = 1;
361 } 361 }
362 GNUNET_free ((void *) argv); 362 GNUNET_free_nz ((void *) argv);
363 return global_ret; 363 return global_ret;
364} 364}
365 365
diff --git a/src/nat/gnunet-nat.c b/src/nat/gnunet-nat.c
index 857ce5093..5012d6455 100644
--- a/src/nat/gnunet-nat.c
+++ b/src/nat/gnunet-nat.c
@@ -468,7 +468,7 @@ main (int argc, char *const argv[])
468 { 468 {
469 global_ret = 1; 469 global_ret = 1;
470 } 470 }
471 GNUNET_free ((void *) argv); 471 GNUNET_free_nz ((void *) argv);
472 return global_ret; 472 return global_ret;
473} 473}
474 474
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index f4d4e3e2f..793f60694 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -668,9 +668,10 @@ setup_flood_message (unsigned int slot, struct GNUNET_TIME_Absolute ts)
668 fm->origin = my_identity; 668 fm->origin = my_identity;
669 fm->proof_of_work = my_proof; 669 fm->proof_of_work = my_proof;
670 if (nse_work_required > 0) 670 if (nse_work_required > 0)
671 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (my_private_key, 671 GNUNET_assert (GNUNET_OK ==
672 &fm->purpose, 672 GNUNET_CRYPTO_eddsa_sign_ (my_private_key,
673 &fm->signature)); 673 &fm->purpose,
674 &fm->signature));
674 else 675 else
675 memset (&fm->signature, 0, sizeof(fm->signature)); 676 memset (&fm->signature, 0, sizeof(fm->signature));
676} 677}
@@ -922,10 +923,10 @@ verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood)
922 } 923 }
923 if ((nse_work_required > 0) && 924 if ((nse_work_required > 0) &&
924 (GNUNET_OK != 925 (GNUNET_OK !=
925 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND, 926 GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_NSE_SEND,
926 &incoming_flood->purpose, 927 &incoming_flood->purpose,
927 &incoming_flood->signature, 928 &incoming_flood->signature,
928 &incoming_flood->origin.public_key))) 929 &incoming_flood->origin.public_key)))
929 { 930 {
930 GNUNET_break_op (0); 931 GNUNET_break_op (0);
931 return GNUNET_NO; 932 return GNUNET_NO;
diff --git a/src/peerinfo-tool/Makefile.am b/src/peerinfo-tool/Makefile.am
index 05173d551..93252570c 100644
--- a/src/peerinfo-tool/Makefile.am
+++ b/src/peerinfo-tool/Makefile.am
@@ -6,11 +6,9 @@ if USE_COVERAGE
6 XLIB = -lgcov 6 XLIB = -lgcov
7endif 7endif
8 8
9if HAVE_MHD 9if HAVE_REST
10if HAVE_JSON
11REST_PLUGIN = libgnunet_plugin_rest_peerinfo.la 10REST_PLUGIN = libgnunet_plugin_rest_peerinfo.la
12endif 11endif
13endif
14 12
15plugindir = $(libdir)/gnunet 13plugindir = $(libdir)/gnunet
16 14
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index 4d4c4de33..df6c169b5 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -855,7 +855,7 @@ main (int argc, char *const *argv)
855 NULL)) 855 NULL))
856 ? 0 856 ? 0
857 : 1; 857 : 1;
858 GNUNET_free ((void *) argv); 858 GNUNET_free_nz ((void *) argv);
859 return ret; 859 return ret;
860} 860}
861 861
diff --git a/src/peerinfo-tool/plugin_rest_peerinfo.c b/src/peerinfo-tool/plugin_rest_peerinfo.c
index 14559a8cf..514b14313 100644
--- a/src/peerinfo-tool/plugin_rest_peerinfo.c
+++ b/src/peerinfo-tool/plugin_rest_peerinfo.c
@@ -272,7 +272,7 @@ cleanup_handle (void *cls)
272 if (NULL != handle->emsg) 272 if (NULL != handle->emsg)
273 GNUNET_free (handle->emsg); 273 GNUNET_free (handle->emsg);
274 if (NULL != handle->address) 274 if (NULL != handle->address)
275 GNUNET_free ((char *) handle->address); 275 GNUNET_free_nz ((char *) handle->address);
276 if (NULL != handle->expiration_str) 276 if (NULL != handle->expiration_str)
277 GNUNET_free (handle->expiration_str); 277 GNUNET_free (handle->expiration_str);
278 if (NULL != handle->pubkey) 278 if (NULL != handle->pubkey)
@@ -326,6 +326,7 @@ do_error (void *cls)
326 handle->response_code = MHD_HTTP_OK; 326 handle->response_code = MHD_HTTP_OK;
327 response = json_dumps (json_error, 0); 327 response = json_dumps (json_error, 0);
328 resp = GNUNET_REST_create_response (response); 328 resp = GNUNET_REST_create_response (response);
329 MHD_add_response_header (resp, "Content-Type", "application/json");
329 handle->proc (handle->proc_cls, resp, handle->response_code); 330 handle->proc (handle->proc_cls, resp, handle->response_code);
330 json_decref (json_error); 331 json_decref (json_error);
331 GNUNET_free (response); 332 GNUNET_free (response);
@@ -356,6 +357,7 @@ peerinfo_list_finished (void *cls)
356 result_str = json_dumps (handle->response, 0); 357 result_str = json_dumps (handle->response, 0);
357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 358 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
358 resp = GNUNET_REST_create_response (result_str); 359 resp = GNUNET_REST_create_response (result_str);
360 MHD_add_response_header (resp, "Content-Type", "application/json");
359 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 361 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
360 GNUNET_free_non_null (result_str); 362 GNUNET_free_non_null (result_str);
361 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); 363 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
diff --git a/src/peerstore/plugin_peerstore_flat.c b/src/peerstore/plugin_peerstore_flat.c
index 06e6c0b77..5efe9dddc 100644
--- a/src/peerstore/plugin_peerstore_flat.c
+++ b/src/peerstore/plugin_peerstore_flat.c
@@ -345,7 +345,7 @@ database_setup (struct Plugin *plugin)
345 struct GNUNET_DISK_FileHandle *fh; 345 struct GNUNET_DISK_FileHandle *fh;
346 struct GNUNET_PEERSTORE_Record *entry; 346 struct GNUNET_PEERSTORE_Record *entry;
347 struct GNUNET_HashCode hkey; 347 struct GNUNET_HashCode hkey;
348 size_t size; 348 uint64_t size;
349 char *buffer; 349 char *buffer;
350 char *line; 350 char *line;
351 351
diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c
index cc064f48d..8da273b2b 100644
--- a/src/pq/pq_connect.c
+++ b/src/pq/pq_connect.c
@@ -135,6 +135,71 @@ GNUNET_PQ_connect (const char *config_str,
135 135
136 136
137/** 137/**
138 * Apply patch number @a from path @a load_path.
139 *
140 * @param db database context to use
141 * @param load_path where to find the SQL code to run
142 * @param i patch number to append to the @a load_path
143 * @return #GNUNET_OK on success, #GNUNET_NO if patch @a i does not exist, #GNUNET_SYSERR on error
144 */
145static int
146apply_patch (struct GNUNET_PQ_Context *db,
147 const char *load_path,
148 unsigned int i)
149{
150 struct GNUNET_OS_Process *psql;
151 enum GNUNET_OS_ProcessStatusType type;
152 unsigned long code;
153 size_t slen = strlen (load_path) + 10;
154 char buf[slen];
155
156 GNUNET_snprintf (buf,
157 sizeof (buf),
158 "%s%04u.sql",
159 load_path,
160 i);
161 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
162 "Applying SQL file `%s' on database %s\n",
163 buf,
164 db->config_str);
165 psql = GNUNET_OS_start_process (GNUNET_NO,
166 GNUNET_OS_INHERIT_STD_NONE,
167 NULL,
168 NULL,
169 NULL,
170 "psql",
171 "psql",
172 db->config_str,
173 "-f",
174 buf,
175 "-q",
176 NULL);
177 if (NULL == psql)
178 {
179 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
180 "exec",
181 "psql");
182 return GNUNET_SYSERR;
183 }
184 GNUNET_assert (GNUNET_OK ==
185 GNUNET_OS_process_wait_status (psql,
186 &type,
187 &code));
188 GNUNET_OS_process_destroy (psql);
189 if ( (GNUNET_OS_PROCESS_EXITED != type) ||
190 (0 != code) )
191 {
192 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
193 "Could not run PSQL on file %s: %d\n",
194 buf,
195 (int) code);
196 return GNUNET_SYSERR;
197 }
198 return GNUNET_OK;
199}
200
201
202/**
138 * Within the @a db context, run all the SQL files 203 * Within the @a db context, run all the SQL files
139 * from the @a load_path from 0000-9999.sql (as long 204 * from the @a load_path from 0000-9999.sql (as long
140 * as the files exist contiguously). 205 * as the files exist contiguously).
@@ -147,55 +212,88 @@ int
147GNUNET_PQ_run_sql (struct GNUNET_PQ_Context *db, 212GNUNET_PQ_run_sql (struct GNUNET_PQ_Context *db,
148 const char *load_path) 213 const char *load_path)
149{ 214{
215 const char *load_path_suffix;
150 size_t slen = strlen (load_path) + 10; 216 size_t slen = strlen (load_path) + 10;
151 217
152 for (unsigned int i = 0; i<10000; i++) 218 load_path_suffix = strrchr (load_path, '/');
219 if (NULL == load_path_suffix)
220 {
221 GNUNET_break (0);
222 return GNUNET_SYSERR;
223 }
224 load_path_suffix++; /* skip '/' */
225 for (unsigned int i = 1; i<10000; i++)
153 { 226 {
154 char buf[slen]; 227 enum GNUNET_DB_QueryStatus qs;
155 struct GNUNET_OS_Process *psql;
156 enum GNUNET_OS_ProcessStatusType type;
157 unsigned long code;
158
159 GNUNET_snprintf (buf,
160 sizeof (buf),
161 "%s%04u.sql",
162 load_path,
163 i);
164 if (GNUNET_YES !=
165 GNUNET_DISK_file_test (buf))
166 break; /* We are done */
167 psql = GNUNET_OS_start_process (GNUNET_NO,
168 GNUNET_OS_INHERIT_STD_NONE,
169 NULL,
170 NULL,
171 NULL,
172 "psql",
173 "psql",
174 db->config_str,
175 "-f",
176 buf,
177 "-q",
178 NULL);
179 if (NULL == psql)
180 { 228 {
181 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, 229 char buf[slen];
182 "exec", 230
183 "psql"); 231 /* First, check patch actually exists */
184 return GNUNET_SYSERR; 232 GNUNET_snprintf (buf,
233 sizeof (buf),
234 "%s%04u.sql",
235 load_path,
236 i);
237 if (GNUNET_YES !=
238 GNUNET_DISK_file_test (buf))
239 return GNUNET_OK; /* We are done */
185 } 240 }
186 GNUNET_assert (GNUNET_OK == 241
187 GNUNET_OS_process_wait_status (psql, 242 /* Second, check with DB versioning schema if this patch was already applied,
188 &type, 243 if so, skip it. */
189 &code));
190 GNUNET_OS_process_destroy (psql);
191 if ( (GNUNET_OS_PROCESS_EXITED != type) ||
192 (0 != code) )
193 { 244 {
194 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 245 char patch_name[slen];
195 "Could not run PSQL on file %s: %d", 246
196 buf, 247 GNUNET_snprintf (patch_name,
197 (int) code); 248 sizeof (patch_name),
198 return GNUNET_SYSERR; 249 "%s%04u",
250 load_path_suffix,
251 i);
252 {
253 char *applied_by;
254 struct GNUNET_PQ_QueryParam params[] = {
255 GNUNET_PQ_query_param_string (patch_name),
256 GNUNET_PQ_query_param_end
257 };
258 struct GNUNET_PQ_ResultSpec rs[] = {
259 GNUNET_PQ_result_spec_string ("applied_by",
260 &applied_by),
261 GNUNET_PQ_result_spec_end
262 };
263
264 qs = GNUNET_PQ_eval_prepared_singleton_select (db,
265 "gnunet_pq_check_patch",
266 params,
267 rs);
268 if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
269 {
270 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
271 "Database version %s already applied by %s, skipping\n",
272 patch_name,
273 applied_by);
274 GNUNET_PQ_cleanup_result (rs);
275 }
276 if (GNUNET_DB_STATUS_HARD_ERROR == qs)
277 {
278 GNUNET_break (0);
279 return GNUNET_SYSERR;
280 }
281 }
282 }
283 if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
284 continue; /* patch already applied, skip it */
285
286 /* patch not yet applied, run it! */
287 {
288 int ret;
289
290 ret = apply_patch (db,
291 load_path,
292 i);
293 if (GNUNET_NO == ret)
294 break;
295 if (GNUNET_SYSERR == ret)
296 return GNUNET_SYSERR;
199 } 297 }
200 } 298 }
201 return GNUNET_OK; 299 return GNUNET_OK;
@@ -227,8 +325,8 @@ GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db)
227 if (NULL != db->conn) 325 if (NULL != db->conn)
228 PQfinish (db->conn); 326 PQfinish (db->conn);
229 db->conn = PQconnectdb (db->config_str); 327 db->conn = PQconnectdb (db->config_str);
230 if ((NULL == db->conn) || 328 if ( (NULL == db->conn) ||
231 (CONNECTION_OK != PQstatus (db->conn))) 329 (CONNECTION_OK != PQstatus (db->conn)) )
232 { 330 {
233 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 331 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
234 "pq", 332 "pq",
@@ -250,14 +348,80 @@ GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db)
250 PQsetNoticeProcessor (db->conn, 348 PQsetNoticeProcessor (db->conn,
251 &pq_notice_processor_cb, 349 &pq_notice_processor_cb,
252 db); 350 db);
253 if ( (NULL != db->load_path) && 351 if (NULL != db->load_path)
254 (GNUNET_OK !=
255 GNUNET_PQ_run_sql (db,
256 db->load_path)) )
257 { 352 {
258 PQfinish (db->conn); 353 PGresult *res;
259 db->conn = NULL; 354
260 return; 355 res = PQprepare (db->conn,
356 "gnunet_pq_check_patch",
357 "SELECT"
358 " applied_by"
359 " FROM _v.patches"
360 " WHERE patch_name = $1"
361 " LIMIT 1",
362 1,
363 NULL);
364 if (PGRES_COMMAND_OK != PQresultStatus (res))
365 {
366 int ret;
367
368 PQclear (res);
369 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
370 "Failed to prepare statement to check patch level. Likely versioning schema does not exist yet, loading patch level 0000!\n");
371 ret = apply_patch (db,
372 db->load_path,
373 0);
374 if (GNUNET_NO == ret)
375 {
376 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
377 "Failed to find SQL file to load database versioning logic\n");
378 PQfinish (db->conn);
379 db->conn = NULL;
380 return;
381 }
382 if (GNUNET_SYSERR == ret)
383 {
384 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
385 "Failed to run SQL logic to setup database versioning logic\n");
386 PQfinish (db->conn);
387 db->conn = NULL;
388 return;
389 }
390 /* try again to prepare our statement! */
391 res = PQprepare (db->conn,
392 "gnunet_pq_check_patch",
393 "SELECT"
394 " applied_by"
395 " FROM _v.patches"
396 " WHERE patch_name = $1"
397 " LIMIT 1",
398 1,
399 NULL);
400 if (PGRES_COMMAND_OK != PQresultStatus (res))
401 {
402 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
403 "Failed to run SQL logic to setup database versioning logic: %s/%s\n",
404 PQresultErrorMessage (res),
405 PQerrorMessage (db->conn));
406 PQclear (res);
407 PQfinish (db->conn);
408 db->conn = NULL;
409 return;
410 }
411 }
412 PQclear (res);
413
414 if (GNUNET_SYSERR ==
415 GNUNET_PQ_run_sql (db,
416 db->load_path))
417 {
418 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
419 "Failed to load SQL statements from `%s'\n",
420 db->load_path);
421 PQfinish (db->conn);
422 db->conn = NULL;
423 return;
424 }
261 } 425 }
262 if ( (NULL != db->es) && 426 if ( (NULL != db->es) &&
263 (GNUNET_OK != 427 (GNUNET_OK !=
@@ -317,11 +481,12 @@ GNUNET_PQ_connect_with_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
317 conninfo = NULL; 481 conninfo = NULL;
318 load_path = NULL; 482 load_path = NULL;
319 sp = NULL; 483 sp = NULL;
320 if (GNUNET_OK == 484 if ( (NULL != load_path_suffix) &&
321 GNUNET_CONFIGURATION_get_value_filename (cfg, 485 (GNUNET_OK ==
322 section, 486 GNUNET_CONFIGURATION_get_value_filename (cfg,
323 "SQL_DIR", 487 section,
324 &sp)) 488 "SQL_DIR",
489 &sp)) )
325 GNUNET_asprintf (&load_path, 490 GNUNET_asprintf (&load_path,
326 "%s%s", 491 "%s%s",
327 sp, 492 sp,
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index 8bdf8144a..a36848f3a 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -294,7 +294,7 @@ qconv_rsa_public_key (void *cls,
294 unsigned int scratch_length) 294 unsigned int scratch_length)
295{ 295{
296 const struct GNUNET_CRYPTO_RsaPublicKey *rsa = data; 296 const struct GNUNET_CRYPTO_RsaPublicKey *rsa = data;
297 char *buf; 297 void *buf;
298 size_t buf_size; 298 size_t buf_size;
299 299
300 GNUNET_break (NULL == cls); 300 GNUNET_break (NULL == cls);
@@ -354,7 +354,7 @@ qconv_rsa_signature (void *cls,
354 unsigned int scratch_length) 354 unsigned int scratch_length)
355{ 355{
356 const struct GNUNET_CRYPTO_RsaSignature *sig = data; 356 const struct GNUNET_CRYPTO_RsaSignature *sig = data;
357 char *buf; 357 void *buf;
358 size_t buf_size; 358 size_t buf_size;
359 359
360 GNUNET_break (NULL == cls); 360 GNUNET_break (NULL == cls);
@@ -402,6 +402,68 @@ GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x)
402 * @return -1 on error, number of offsets used in @a scratch otherwise 402 * @return -1 on error, number of offsets used in @a scratch otherwise
403 */ 403 */
404static int 404static int
405qconv_rel_time (void *cls,
406 const void *data,
407 size_t data_len,
408 void *param_values[],
409 int param_lengths[],
410 int param_formats[],
411 unsigned int param_length,
412 void *scratch[],
413 unsigned int scratch_length)
414{
415 const struct GNUNET_TIME_Relative *u = data;
416 struct GNUNET_TIME_Relative rel;
417 uint64_t *u_nbo;
418
419 GNUNET_break (NULL == cls);
420 if (1 != param_length)
421 return -1;
422 rel = *u;
423 if (rel.rel_value_us > INT64_MAX)
424 rel.rel_value_us = INT64_MAX;
425 u_nbo = GNUNET_new (uint64_t);
426 scratch[0] = u_nbo;
427 *u_nbo = GNUNET_htonll (rel.rel_value_us);
428 param_values[0] = (void *) u_nbo;
429 param_lengths[0] = sizeof(uint64_t);
430 param_formats[0] = 1;
431 return 1;
432}
433
434
435/**
436 * Generate query parameter for a relative time value.
437 * The database must store a 64-bit integer.
438 *
439 * @param x pointer to the query parameter to pass
440 * @return array entry for the query parameters to use
441 */
442struct GNUNET_PQ_QueryParam
443GNUNET_PQ_query_param_relative_time (const struct GNUNET_TIME_Relative *x)
444{
445 struct GNUNET_PQ_QueryParam res =
446 { &qconv_rel_time, NULL, x, sizeof(*x), 1 };
447
448 return res;
449}
450
451
452/**
453 * Function called to convert input argument into SQL parameters.
454 *
455 * @param cls closure
456 * @param data pointer to input argument
457 * @param data_len number of bytes in @a data (if applicable)
458 * @param[out] param_values SQL data to set
459 * @param[out] param_lengths SQL length data to set
460 * @param[out] param_formats SQL format data to set
461 * @param param_length number of entries available in the @a param_values, @a param_lengths and @a param_formats arrays
462 * @param[out] scratch buffer for dynamic allocations (to be done via #GNUNET_malloc()
463 * @param scratch_length number of entries left in @a scratch
464 * @return -1 on error, number of offsets used in @a scratch otherwise
465 */
466static int
405qconv_abs_time (void *cls, 467qconv_abs_time (void *cls,
406 const void *data, 468 const void *data,
407 size_t data_len, 469 size_t data_len,
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index 1fb1e71c0..f764593b0 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -345,7 +345,7 @@ extract_rsa_signature (void *cls,
345{ 345{
346 struct GNUNET_CRYPTO_RsaSignature **sig = dst; 346 struct GNUNET_CRYPTO_RsaSignature **sig = dst;
347 size_t len; 347 size_t len;
348 const char *res; 348 const void *res;
349 int fnum; 349 int fnum;
350 350
351 (void) cls; 351 (void) cls;
@@ -544,6 +544,96 @@ GNUNET_PQ_result_spec_string (const char *name,
544 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 544 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
545 */ 545 */
546static int 546static int
547extract_rel_time (void *cls,
548 PGresult *result,
549 int row,
550 const char *fname,
551 size_t *dst_size,
552 void *dst)
553{
554 struct GNUNET_TIME_Relative *udst = dst;
555 const int64_t *res;
556 int fnum;
557
558 (void) cls;
559 fnum = PQfnumber (result,
560 fname);
561 if (fnum < 0)
562 {
563 GNUNET_break (0);
564 return GNUNET_SYSERR;
565 }
566 if (PQgetisnull (result,
567 row,
568 fnum))
569 {
570 GNUNET_break (0);
571 return GNUNET_SYSERR;
572 }
573 GNUNET_assert (NULL != dst);
574 if (sizeof(struct GNUNET_TIME_Relative) != *dst_size)
575 {
576 GNUNET_break (0);
577 return GNUNET_SYSERR;
578 }
579 if (sizeof(int64_t) !=
580 PQgetlength (result,
581 row,
582 fnum))
583 {
584 GNUNET_break (0);
585 return GNUNET_SYSERR;
586 }
587 res = (int64_t *) PQgetvalue (result,
588 row,
589 fnum);
590 if (INT64_MAX == GNUNET_ntohll ((uint64_t) *res))
591 *udst = GNUNET_TIME_UNIT_FOREVER_REL;
592 else
593 udst->rel_value_us = GNUNET_ntohll ((uint64_t) *res);
594 return GNUNET_OK;
595}
596
597
598/**
599 * Relative time expected.
600 *
601 * @param name name of the field in the table
602 * @param[out] at where to store the result
603 * @return array entry for the result specification to use
604 */
605struct GNUNET_PQ_ResultSpec
606GNUNET_PQ_result_spec_relative_time (const char *name,
607 struct GNUNET_TIME_Relative *rt)
608{
609 struct GNUNET_PQ_ResultSpec res = {
610 &extract_rel_time,
611 NULL,
612 NULL,
613 (void *) rt,
614 sizeof(*rt),
615 name,
616 NULL
617 };
618
619 return res;
620}
621
622
623/**
624 * Extract data from a Postgres database @a result at row @a row.
625 *
626 * @param cls closure
627 * @param result where to extract data from
628 * @param int row to extract data from
629 * @param fname name (or prefix) of the fields to extract from
630 * @param[in,out] dst_size where to store size of result, may be NULL
631 * @param[out] dst where to store the result
632 * @return
633 * #GNUNET_YES if all results could be extracted
634 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
635 */
636static int
547extract_abs_time (void *cls, 637extract_abs_time (void *cls,
548 PGresult *result, 638 PGresult *result,
549 int row, 639 int row,
diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c
index 7bcb10980..b09354af8 100644
--- a/src/pq/test_pq.c
+++ b/src/pq/test_pq.c
@@ -238,6 +238,12 @@ main (int argc,
238 NULL, 238 NULL,
239 es, 239 es,
240 NULL); 240 NULL);
241 if (NULL == db)
242 {
243 fprintf (stderr,
244 "Cannot run test, database connection failed\n");
245 return 77;
246 }
241 if (CONNECTION_OK != PQstatus (db->conn)) 247 if (CONNECTION_OK != PQstatus (db->conn))
242 { 248 {
243 fprintf (stderr, 249 fprintf (stderr,
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c
index f8765818b..bcc913bd2 100644
--- a/src/pt/gnunet-daemon-pt.c
+++ b/src/pt/gnunet-daemon-pt.c
@@ -1317,7 +1317,7 @@ main (int argc,
1317 NULL)) 1317 NULL))
1318 ? 0 1318 ? 0
1319 : 1; 1319 : 1;
1320 GNUNET_free ((void *) argv); 1320 GNUNET_free_nz ((void *) argv);
1321 return ret; 1321 return ret;
1322} 1322}
1323 1323
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c
index 9bf497b16..69afca789 100644
--- a/src/pt/test_gns_vpn.c
+++ b/src/pt/test_gns_vpn.c
@@ -45,6 +45,7 @@
45#include "gnunet_gnsrecord_lib.h" 45#include "gnunet_gnsrecord_lib.h"
46#include "gnunet_gns_service.h" 46#include "gnunet_gns_service.h"
47#include "gnunet_testing_lib.h" 47#include "gnunet_testing_lib.h"
48#include "gnunet_mhd_compat.h"
48 49
49#define PORT 8080 50#define PORT 8080
50#define TEST_DOMAIN "www.gnu" 51#define TEST_DOMAIN "www.gnu"
@@ -121,7 +122,7 @@ copy_buffer (void *ptr,
121} 122}
122 123
123 124
124static int 125static MHD_RESULT
125mhd_ahc (void *cls, 126mhd_ahc (void *cls,
126 struct MHD_Connection *connection, 127 struct MHD_Connection *connection,
127 const char *url, 128 const char *url,
@@ -611,7 +612,7 @@ identity_cb (void *cls,
611 1, &rd, 612 1, &rd,
612 &commence_testing, 613 &commence_testing,
613 NULL); 614 NULL);
614 GNUNET_free ((void **) rd.data); 615 GNUNET_free_nz ((void **) rd.data);
615 GNUNET_free (rd_string); 616 GNUNET_free (rd_string);
616} 617}
617 618
diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c
index 42fd52c38..cb9bb61fe 100644
--- a/src/pt/test_gnunet_vpn.c
+++ b/src/pt/test_gnunet_vpn.c
@@ -29,6 +29,7 @@
29#include <microhttpd.h> 29#include <microhttpd.h>
30#include "gnunet_vpn_service.h" 30#include "gnunet_vpn_service.h"
31#include "gnunet_testing_lib.h" 31#include "gnunet_testing_lib.h"
32#include "gnunet_mhd_compat.h"
32 33
33#define PORT 48080 34#define PORT 48080
34 35
@@ -96,7 +97,7 @@ copy_buffer (void *ptr, size_t size, size_t nmemb, void *ctx)
96} 97}
97 98
98 99
99static int 100static MHD_RESULT
100mhd_ahc (void *cls, 101mhd_ahc (void *cls,
101 struct MHD_Connection *connection, 102 struct MHD_Connection *connection,
102 const char *url, 103 const char *url,
diff --git a/src/reclaim-attribute/Makefile.am b/src/reclaim-attribute/Makefile.am
deleted file mode 100644
index 490e77398..000000000
--- a/src/reclaim-attribute/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
1# This Makefile.am is in the public domain
2AM_CPPFLAGS = -I$(top_srcdir)/src/include
3
4plugindir = $(libdir)/gnunet
5
6pkgcfgdir= $(pkgdatadir)/config.d/
7
8libexecdir= $(pkglibdir)/libexec/
9
10if USE_COVERAGE
11 AM_CFLAGS = --coverage -O0
12 XLIBS = -lgcov
13endif
14
15lib_LTLIBRARIES = \
16 libgnunetreclaimattribute.la
17
18libgnunetreclaimattribute_la_SOURCES = \
19 reclaim_attribute.h \
20 reclaim_attribute.c
21libgnunetreclaimattribute_la_LIBADD = \
22 $(top_builddir)/src/util/libgnunetutil.la \
23 $(GN_LIBINTL)
24libgnunetreclaimattribute_la_LDFLAGS = \
25 $(GN_LIB_LDFLAGS) \
26 -version-info 0:0:0
27
28
29plugin_LTLIBRARIES = \
30 libgnunet_plugin_reclaim_attribute_gnuid.la
31
32
33libgnunet_plugin_reclaim_attribute_gnuid_la_SOURCES = \
34 plugin_reclaim_attribute_gnuid.c
35libgnunet_plugin_reclaim_attribute_gnuid_la_LIBADD = \
36 $(top_builddir)/src/util/libgnunetutil.la \
37 $(LTLIBINTL)
38libgnunet_plugin_reclaim_attribute_gnuid_la_LDFLAGS = \
39 $(GN_PLUGIN_LDFLAGS)
40
41
diff --git a/src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c b/src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c
deleted file mode 100644
index ade2a27bb..000000000
--- a/src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c
+++ /dev/null
@@ -1,290 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 2016 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 * @file reclaim-attribute/plugin_reclaim_attribute_gnuid.c
23 * @brief reclaim-attribute-plugin-gnuid attribute plugin to provide the API for
24 * fundamental
25 * attribute types.
26 *
27 * @author Martin Schanzenbach
28 */
29#include "platform.h"
30#include "gnunet_util_lib.h"
31#include "gnunet_reclaim_attribute_plugin.h"
32#include <inttypes.h>
33
34
35/**
36 * Convert the 'value' of an attribute to a string.
37 *
38 * @param cls closure, unused
39 * @param type type of the attribute
40 * @param data value in binary encoding
41 * @param data_size number of bytes in @a data
42 * @return NULL on error, otherwise human-readable representation of the value
43 */
44static char *
45gnuid_value_to_string (void *cls,
46 uint32_t type,
47 const void *data,
48 size_t data_size)
49{
50 switch (type)
51 {
52 case GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING:
53 return GNUNET_strndup (data, data_size);
54
55 default:
56 return NULL;
57 }
58}
59
60
61/**
62 * Convert human-readable version of a 'value' of an attribute to the binary
63 * representation.
64 *
65 * @param cls closure, unused
66 * @param type type of the attribute
67 * @param s human-readable string
68 * @param data set to value in binary encoding (will be allocated)
69 * @param data_size set to number of bytes in @a data
70 * @return #GNUNET_OK on success
71 */
72static int
73gnuid_string_to_value (void *cls,
74 uint32_t type,
75 const char *s,
76 void **data,
77 size_t *data_size)
78{
79 if (NULL == s)
80 return GNUNET_SYSERR;
81 switch (type)
82 {
83 case GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING:
84 *data = GNUNET_strdup (s);
85 *data_size = strlen (s);
86 return GNUNET_OK;
87
88 default:
89 return GNUNET_SYSERR;
90 }
91}
92
93/**
94 * Convert the 'value' of an attestation to a string.
95 *
96 * @param cls closure, unused
97 * @param type type of the attestation
98 * @param data value in binary encoding
99 * @param data_size number of bytes in @a data
100 * @return NULL on error, otherwise human-readable representation of the value
101 */
102static char *
103gnuid_value_to_string_attest (void *cls,
104 uint32_t type,
105 const void *data,
106 size_t data_size)
107{
108 switch (type)
109 {
110 case GNUNET_RECLAIM_ATTESTATION_TYPE_JWT:
111 return GNUNET_strndup (data, data_size);
112
113 default:
114 return NULL;
115 }
116}
117
118
119/**
120 * Convert human-readable version of a 'value' of an attestation to the binary
121 * representation.
122 *
123 * @param cls closure, unused
124 * @param type type of the attestation
125 * @param s human-readable string
126 * @param data set to value in binary encoding (will be allocated)
127 * @param data_size set to number of bytes in @a data
128 * @return #GNUNET_OK on success
129 */
130static int
131gnuid_string_to_value_attest (void *cls,
132 uint32_t type,
133 const char *s,
134 void **data,
135 size_t *data_size)
136{
137 if (NULL == s)
138 return GNUNET_SYSERR;
139 switch (type)
140 {
141 case GNUNET_RECLAIM_ATTESTATION_TYPE_JWT:
142 *data = GNUNET_strdup (s);
143 *data_size = strlen (s);
144 return GNUNET_OK;
145
146 default:
147 return GNUNET_SYSERR;
148 }
149}
150
151/**
152 * Mapping of attribute type numbers to human-readable
153 * attribute type names.
154 */
155static struct
156{
157 const char *name;
158 uint32_t number;
159} gnuid_name_map[] = { { "STRING", GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING },
160 { NULL, UINT32_MAX } };
161
162/**
163 * Mapping of attestation type numbers to human-readable
164 * attestation type names.
165 */
166static struct
167{
168 const char *name;
169 uint32_t number;
170} gnuid_attest_name_map[] = { { "JWT", GNUNET_RECLAIM_ATTESTATION_TYPE_JWT },
171 { NULL, UINT32_MAX } };
172
173/**
174 * Convert a type name to the corresponding number.
175 *
176 * @param cls closure, unused
177 * @param gnuid_typename name to convert
178 * @return corresponding number, UINT32_MAX on error
179 */
180static uint32_t
181gnuid_typename_to_number (void *cls, const char *gnuid_typename)
182{
183 unsigned int i;
184
185 i = 0;
186 while ((NULL != gnuid_name_map[i].name) &&
187 (0 != strcasecmp (gnuid_typename, gnuid_name_map[i].name)))
188 i++;
189 return gnuid_name_map[i].number;
190}
191
192
193/**
194 * Convert a type number (i.e. 1) to the corresponding type string
195 *
196 * @param cls closure, unused
197 * @param type number of a type to convert
198 * @return corresponding typestring, NULL on error
199 */
200static const char *
201gnuid_number_to_typename (void *cls, uint32_t type)
202{
203 unsigned int i;
204
205 i = 0;
206 while ((NULL != gnuid_name_map[i].name) && (type != gnuid_name_map[i].number))
207 i++;
208 return gnuid_name_map[i].name;
209}
210
211/**
212 * Convert a type name to the corresponding number.
213 *
214 * @param cls closure, unused
215 * @param gnuid_typename name to convert
216 * @return corresponding number, UINT32_MAX on error
217 */
218static uint32_t
219gnuid_typename_to_number_attest (void *cls, const char *gnuid_typename)
220{
221 unsigned int i;
222
223 i = 0;
224 while ((NULL != gnuid_attest_name_map[i].name) &&
225 (0 != strcasecmp (gnuid_typename, gnuid_attest_name_map[i].name)))
226 i++;
227 return gnuid_attest_name_map[i].number;
228}
229
230/**
231 * Convert a type number (i.e. 1) to the corresponding type string
232 *
233 * @param cls closure, unused
234 * @param type number of a type to convert
235 * @return corresponding typestring, NULL on error
236 */
237static const char *
238gnuid_number_to_typename_attest (void *cls, uint32_t type)
239{
240 unsigned int i;
241
242 i = 0;
243 while ((NULL != gnuid_attest_name_map[i].name) && (type !=
244 gnuid_attest_name_map[i].
245 number))
246 i++;
247 return gnuid_attest_name_map[i].name;
248}
249
250/**
251 * Entry point for the plugin.
252 *
253 * @param cls NULL
254 * @return the exported block API
255 */
256void *
257libgnunet_plugin_reclaim_attribute_gnuid_init (void *cls)
258{
259 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api;
260
261 api = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions);
262 api->value_to_string = &gnuid_value_to_string;
263 api->string_to_value = &gnuid_string_to_value;
264 api->typename_to_number = &gnuid_typename_to_number;
265 api->number_to_typename = &gnuid_number_to_typename;
266 api->value_to_string_attest = &gnuid_value_to_string_attest;
267 api->string_to_value_attest = &gnuid_string_to_value_attest;
268 api->typename_to_number_attest = &gnuid_typename_to_number_attest;
269 api->number_to_typename_attest = &gnuid_number_to_typename_attest;
270 return api;
271}
272
273
274/**
275 * Exit point from the plugin.
276 *
277 * @param cls the return value from #libgnunet_plugin_block_test_init()
278 * @return NULL
279 */
280void *
281libgnunet_plugin_reclaim_attribute_gnuid_done (void *cls)
282{
283 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api = cls;
284
285 GNUNET_free (api);
286 return NULL;
287}
288
289
290/* end of plugin_reclaim_attribute_type_gnuid.c */
diff --git a/src/reclaim-attribute/reclaim_attribute.c b/src/reclaim-attribute/reclaim_attribute.c
deleted file mode 100644
index 43199c108..000000000
--- a/src/reclaim-attribute/reclaim_attribute.c
+++ /dev/null
@@ -1,1055 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2010-2015 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 * @file reclaim-attribute/reclaim_attribute.c
23 * @brief helper library to manage identity attributes
24 * @author Martin Schanzenbach
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_reclaim_attribute_plugin.h"
29#include "reclaim_attribute.h"
30
31
32/**
33 * Handle for a plugin
34 */
35struct Plugin
36{
37 /**
38 * Name of the plugin
39 */
40 char *library_name;
41
42 /**
43 * Plugin API
44 */
45 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api;
46};
47
48
49/**
50 * Plugins
51 */
52static struct Plugin **attr_plugins;
53
54
55/**
56 * Number of plugins
57 */
58static unsigned int num_plugins;
59
60
61/**
62 * Init canary
63 */
64static int initialized;
65
66
67/**
68 * Add a plugin
69 *
70 * @param cls closure
71 * @param library_name name of the API library
72 * @param lib_ret the plugin API pointer
73 */
74static void
75add_plugin (void *cls, const char *library_name, void *lib_ret)
76{
77 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api = lib_ret;
78 struct Plugin *plugin;
79
80 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
81 "Loading attribute plugin `%s'\n",
82 library_name);
83 plugin = GNUNET_new (struct Plugin);
84 plugin->api = api;
85 plugin->library_name = GNUNET_strdup (library_name);
86 GNUNET_array_append (attr_plugins, num_plugins, plugin);
87}
88
89
90/**
91 * Load plugins
92 */
93static void
94init ()
95{
96 if (GNUNET_YES == initialized)
97 return;
98 initialized = GNUNET_YES;
99 GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_attribute_",
100 NULL,
101 &add_plugin,
102 NULL);
103}
104
105
106/**
107 * Convert a type name to the corresponding number
108 *
109 * @param typename name to convert
110 * @return corresponding number, UINT32_MAX on error
111 */
112uint32_t
113GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename)
114{
115 unsigned int i;
116 struct Plugin *plugin;
117 uint32_t ret;
118
119 init ();
120 for (i = 0; i < num_plugins; i++)
121 {
122 plugin = attr_plugins[i];
123 if (UINT32_MAX !=
124 (ret = plugin->api->typename_to_number (plugin->api->cls, typename)))
125 return ret;
126 }
127 return UINT32_MAX;
128}
129
130
131/**
132 * Convert a type number to the corresponding type string
133 *
134 * @param type number of a type
135 * @return corresponding typestring, NULL on error
136 */
137const char *
138GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type)
139{
140 unsigned int i;
141 struct Plugin *plugin;
142 const char *ret;
143
144 init ();
145 for (i = 0; i < num_plugins; i++)
146 {
147 plugin = attr_plugins[i];
148 if (NULL !=
149 (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
150 return ret;
151 }
152 return NULL;
153}
154
155
156/**
157 * Convert human-readable version of a 'claim' of an attribute to the binary
158 * representation
159 *
160 * @param type type of the claim
161 * @param s human-readable string
162 * @param data set to value in binary encoding (will be allocated)
163 * @param data_size set to number of bytes in @a data
164 * @return #GNUNET_OK on success
165 */
166int
167GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
168 const char *s,
169 void **data,
170 size_t *data_size)
171{
172 unsigned int i;
173 struct Plugin *plugin;
174
175 init ();
176 for (i = 0; i < num_plugins; i++)
177 {
178 plugin = attr_plugins[i];
179 if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
180 type,
181 s,
182 data,
183 data_size))
184 return GNUNET_OK;
185 }
186 return GNUNET_SYSERR;
187}
188
189
190/**
191 * Convert the 'claim' of an attribute to a string
192 *
193 * @param type the type of attribute
194 * @param data claim in binary encoding
195 * @param data_size number of bytes in @a data
196 * @return NULL on error, otherwise human-readable representation of the claim
197 */
198char *
199GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
200 const void *data,
201 size_t data_size)
202{
203 unsigned int i;
204 struct Plugin *plugin;
205 char *ret;
206
207 init ();
208 for (i = 0; i < num_plugins; i++)
209 {
210 plugin = attr_plugins[i];
211 if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
212 type,
213 data,
214 data_size)))
215 return ret;
216 }
217 return NULL;
218}
219
220/**
221 * Convert an attestation type name to the corresponding number
222 *
223 * @param typename name to convert
224 * @return corresponding number, UINT32_MAX on error
225 */
226uint32_t
227GNUNET_RECLAIM_ATTESTATION_typename_to_number (const char *typename)
228{
229 unsigned int i;
230 struct Plugin *plugin;
231 uint32_t ret;
232 init ();
233 for (i = 0; i < num_plugins; i++)
234 {
235 plugin = attr_plugins[i];
236 if (UINT32_MAX !=
237 (ret = plugin->api->typename_to_number_attest (plugin->api->cls,
238 typename)))
239 return ret;
240 }
241 return UINT32_MAX;
242}
243
244/**
245 * Convert an attestation type number to the corresponding attestation type string
246 *
247 * @param type number of a type
248 * @return corresponding typestring, NULL on error
249 */
250const char *
251GNUNET_RECLAIM_ATTESTATION_number_to_typename (uint32_t type)
252{
253 unsigned int i;
254 struct Plugin *plugin;
255 const char *ret;
256
257 init ();
258 for (i = 0; i < num_plugins; i++)
259 {
260 plugin = attr_plugins[i];
261 if (NULL !=
262 (ret = plugin->api->number_to_typename_attest (plugin->api->cls, type)))
263 return ret;
264 }
265 return NULL;
266}
267/**
268 * Convert human-readable version of a 'claim' of an attestation to the binary
269 * representation
270 *
271 * @param type type of the claim
272 * @param s human-readable string
273 * @param data set to value in binary encoding (will be allocated)
274 * @param data_size set to number of bytes in @a data
275 * @return #GNUNET_OK on success
276 */
277int
278GNUNET_RECLAIM_ATTESTATION_string_to_value (uint32_t type,
279 const char *s,
280 void **data,
281 size_t *data_size)
282{
283 unsigned int i;
284 struct Plugin *plugin;
285
286 init ();
287 for (i = 0; i < num_plugins; i++)
288 {
289 plugin = attr_plugins[i];
290 if (GNUNET_OK == plugin->api->string_to_value_attest (plugin->api->cls,
291 type,
292 s,
293 data,
294 data_size))
295 return GNUNET_OK;
296 }
297 return GNUNET_SYSERR;
298}
299
300
301/**
302 * Convert the 'claim' of an attestation to a string
303 *
304 * @param type the type of attestation
305 * @param data claim in binary encoding
306 * @param data_size number of bytes in @a data
307 * @return NULL on error, otherwise human-readable representation of the claim
308 */
309char *
310GNUNET_RECLAIM_ATTESTATION_value_to_string (uint32_t type,
311 const void *data,
312 size_t data_size)
313{
314 unsigned int i;
315 struct Plugin *plugin;
316 char *ret;
317
318 init ();
319 for (i = 0; i < num_plugins; i++)
320 {
321 plugin = attr_plugins[i];
322 if (NULL != (ret = plugin->api->value_to_string_attest (plugin->api->cls,
323 type,
324 data,
325 data_size)))
326 return ret;
327 }
328 return NULL;
329}
330
331/**
332 * Create a new attribute.
333 *
334 * @param attr_name the attribute name
335 * @param type the attribute type
336 * @param data the attribute value
337 * @param data_size the attribute value size
338 * @return the new attribute
339 */
340struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
341GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char *attr_name,
342 uint32_t type,
343 const void *data,
344 size_t data_size)
345{
346 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
347 char *write_ptr;
348 char *attr_name_tmp = GNUNET_strdup (attr_name);
349
350 GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
351
352 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)
353 + strlen (attr_name_tmp) + 1 + data_size);
354 attr->type = type;
355 attr->data_size = data_size;
356 attr->flag = 0;
357 write_ptr = (char *) &attr[1];
358 GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
359 attr->name = write_ptr;
360 write_ptr += strlen (attr->name) + 1;
361 GNUNET_memcpy (write_ptr, data, data_size);
362 attr->data = write_ptr;
363 GNUNET_free (attr_name_tmp);
364 return attr;
365}
366
367/**
368 * Create a new attestation.
369 *
370 * @param attr_name the attestation name
371 * @param type the attestation type
372 * @param data the attestation value
373 * @param data_size the attestation value size
374 * @return the new attestation
375 */
376struct GNUNET_RECLAIM_ATTESTATION_Claim *
377GNUNET_RECLAIM_ATTESTATION_claim_new (const char *attr_name,
378 uint32_t type,
379 const void *data,
380 size_t data_size)
381{
382 struct GNUNET_RECLAIM_ATTESTATION_Claim *attr;
383 char *write_ptr;
384 char *attr_name_tmp = GNUNET_strdup (attr_name);
385
386 GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
387
388 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim)
389 + strlen (attr_name_tmp) + 1 + data_size);
390 attr->type = type;
391 attr->data_size = data_size;
392 attr->version = 0;
393 write_ptr = (char *) &attr[1];
394 GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
395 attr->name = write_ptr;
396 write_ptr += strlen (attr->name) + 1;
397 GNUNET_memcpy (write_ptr, data, data_size);
398 attr->data = write_ptr;
399 GNUNET_free (attr_name_tmp);
400 return attr;
401}
402
403/**
404 * Create a new attestation reference.
405 *
406 * @param attr_name the referenced claim name
407 * @param ref_value the claim name in the attestation
408 * @return the new reference
409 */
410struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *
411GNUNET_RECLAIM_ATTESTATION_reference_new (const char *attr_name,
412 const char *ref_value)
413{
414 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
415 char *write_ptr;
416 char *attr_name_tmp = GNUNET_strdup (attr_name);
417 char *ref_value_tmp = GNUNET_strdup (ref_value);
418
419 GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
420 GNUNET_STRINGS_utf8_tolower (ref_value, ref_value_tmp);
421
422 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTESTATION_REFERENCE)
423 + strlen (attr_name_tmp) + strlen (ref_value_tmp) + 2);
424
425 write_ptr = (char *) &attr[1];
426 GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
427 attr->name = write_ptr;
428
429 write_ptr += strlen (attr_name) + 1;
430 GNUNET_memcpy (write_ptr, ref_value_tmp, strlen (ref_value_tmp) + 1);
431 attr->reference_value = write_ptr;
432
433 GNUNET_free (attr_name_tmp);
434 GNUNET_free (ref_value_tmp);
435 return attr;
436}
437
438/**
439 * Add a new attribute to a claim list
440 *
441 * @param attr_name the name of the new attribute claim
442 * @param type the type of the claim
443 * @param data claim payload
444 * @param data_size claim payload size
445 */
446void
447GNUNET_RECLAIM_ATTRIBUTE_list_add (
448 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *claim_list,
449 const char *attr_name,
450 uint32_t type,
451 const void *data,
452 size_t data_size)
453{
454 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
455
456 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
457 le->claim =
458 GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name, type, data, data_size);
459 GNUNET_CONTAINER_DLL_insert (claim_list->list_head,
460 claim_list->list_tail,
461 le);
462}
463
464
465/**
466 * Get required size for serialization buffer
467 *
468 * @param attrs the attribute list to serialize
469 * @return the required buffer size
470 */
471size_t
472GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (
473 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
474{
475 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
476 size_t len = 0;
477
478 for (le = attrs->list_head; NULL != le; le = le->next)
479 {
480 if (NULL != le->claim)
481 {
482 len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
483 len += GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (le->claim);
484 }
485 else if (NULL != le->attest )
486 {
487 len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
488 len += GNUNET_RECLAIM_ATTESTATION_serialize_get_size (le->attest);
489 }
490 else if (NULL != le->reference)
491 {
492 len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
493 len += GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (le->reference);
494 }
495 else
496 {
497 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
498 "Unserialized Claim List Entry Type for size not known.\n");
499 break;
500 }
501 len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
502 }
503 return len;
504}
505
506
507/**
508 * Serialize an attribute list
509 *
510 * @param attrs the attribute list to serialize
511 * @param result the serialized attribute
512 * @return length of serialized data
513 */
514size_t
515GNUNET_RECLAIM_ATTRIBUTE_list_serialize (
516 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
517 char *result)
518{
519 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
520 size_t len;
521 size_t total_len;
522 char *write_ptr;
523 write_ptr = result;
524 total_len = 0;
525 for (le = attrs->list_head; NULL != le; le = le->next)
526 {
527 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *list_type;
528 if (NULL != le->claim)
529 {
530 list_type = (struct
531 GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *) write_ptr;
532 list_type->type = htons (1);
533 total_len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
534 write_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
535 len = GNUNET_RECLAIM_ATTRIBUTE_serialize (le->claim, write_ptr);
536 total_len += len;
537 write_ptr += len;
538 }
539 else if (NULL != le->attest )
540 {
541 list_type = (struct
542 GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *) write_ptr;
543 list_type->type = htons (2);
544 total_len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
545 write_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
546 len = GNUNET_RECLAIM_ATTESTATION_serialize (le->attest, write_ptr);
547 total_len += len;
548 write_ptr += len;
549 }
550 else if (NULL != le->reference)
551 {
552 list_type = (struct
553 GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *) write_ptr;
554 list_type->type = htons (3);
555 total_len += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
556 write_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
557 len = GNUNET_RECLAIM_ATTESTATION_REF_serialize (le->reference, write_ptr);
558 total_len += len;
559 write_ptr += len;
560 }
561 else
562 {
563 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
564 "Unserialized Claim List Entry Type not known.\n");
565 continue;
566 }
567 }
568 return total_len;
569}
570
571
572/**
573 * Deserialize an attribute list
574 *
575 * @param data the serialized attribute list
576 * @param data_size the length of the serialized data
577 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
578 */
579struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
580GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char *data, size_t data_size)
581{
582 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
583 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
584 size_t attr_len;
585 const char *read_ptr;
586
587 if ((data_size < sizeof(struct Attribute) + sizeof(struct
588 GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry))
589 && (data_size < sizeof(struct
590 Attestation)
591 + sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry)) &&
592 (data_size < sizeof(struct Attestation_Reference) + sizeof(struct
593 GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry)) )
594 return NULL;
595
596 attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
597 read_ptr = data;
598 while (((data + data_size) - read_ptr) >= sizeof(struct Attribute))
599 {
600 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *list_type;
601 list_type = (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType *) read_ptr;
602 if (1 == ntohs (list_type->type))
603 {
604 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
605 read_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
606 if (((data + data_size) - read_ptr) < sizeof(struct Attribute))
607 break;
608 le->attest = NULL;
609 le->reference = NULL;
610 le->claim =
611 GNUNET_RECLAIM_ATTRIBUTE_deserialize (read_ptr,
612 data_size - (read_ptr - data));
613 GNUNET_CONTAINER_DLL_insert (attrs->list_head, attrs->list_tail, le);
614 attr_len = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (le->claim);
615 read_ptr += attr_len;
616 }
617 else if (2 == ntohs (list_type->type))
618 {
619 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
620 read_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
621 if (((data + data_size) - read_ptr) < sizeof(struct Attestation))
622 break;
623 le->claim = NULL;
624 le->reference = NULL;
625 le->attest =
626 GNUNET_RECLAIM_ATTESTATION_deserialize (read_ptr,
627 data_size - (read_ptr - data));
628 GNUNET_CONTAINER_DLL_insert (attrs->list_head, attrs->list_tail, le);
629 attr_len = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (le->attest);
630 read_ptr += attr_len;
631 }
632 else if (3 == ntohs (list_type->type))
633 {
634 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
635 read_ptr += sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType);
636 if (((data + data_size) - read_ptr) < sizeof(struct
637 Attestation_Reference))
638 break;
639 le->claim = NULL;
640 le->attest = NULL;
641 le->reference =
642 GNUNET_RECLAIM_ATTESTATION_REF_deserialize (read_ptr,
643 data_size - (read_ptr
644 - data));
645 GNUNET_CONTAINER_DLL_insert (attrs->list_head, attrs->list_tail, le);
646 attr_len = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (
647 le->reference);
648 read_ptr += attr_len;
649 }
650 else
651 {
652 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
653 "Serialized Claim List Entry Type not known.\n");
654 break;
655 }
656 }
657 return attrs;
658}
659
660
661/**
662 * Make a (deep) copy of a claim list
663 * @param attrs claim list to copy
664 * @return copied claim list
665 */
666struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
667GNUNET_RECLAIM_ATTRIBUTE_list_dup (
668 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
669{
670 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
671 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *result_le;
672 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *result;
673
674 result = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
675 if (NULL == attrs->list_head)
676 {
677 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Duplicating empty List\n");
678 }
679 for (le = attrs->list_head; NULL != le; le = le->next)
680 {
681 result_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
682 result_le->claim = NULL;
683 result_le->attest = NULL;
684 result_le->reference = NULL;
685 if (NULL != le->claim)
686 {
687 result_le->claim =
688 GNUNET_RECLAIM_ATTRIBUTE_claim_new (le->claim->name,
689 le->claim->type,
690 le->claim->data,
691 le->claim->data_size);
692
693 result_le->claim->id = le->claim->id;
694 result_le->claim->flag = le->claim->flag;
695 }
696 if ( NULL != le->attest)
697 {
698 result_le->attest = GNUNET_RECLAIM_ATTESTATION_claim_new (
699 le->attest->name,
700 le->attest->type,
701 le->attest->data,
702 le->attest->
703 data_size);
704 result_le->attest->id = le->attest->id;
705 }
706 if (NULL !=le->reference)
707 {
708 result_le->reference = GNUNET_RECLAIM_ATTESTATION_reference_new (
709 le->reference->name,
710 le->reference->reference_value);
711 result_le->reference->id = le->reference->id;
712 result_le->reference->id_attest = le->reference->id_attest;
713 }
714 GNUNET_CONTAINER_DLL_insert (result->list_head,
715 result->list_tail,
716 result_le);
717 }
718 return result;
719}
720
721
722/**
723 * Destroy claim list
724 *
725 * @param attrs list to destroy
726 */
727void
728GNUNET_RECLAIM_ATTRIBUTE_list_destroy (
729 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
730{
731 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
732 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *tmp_le;
733
734 for (le = attrs->list_head; NULL != le; le = le->next)
735 {
736 if (NULL != le->claim)
737 GNUNET_free (le->claim);
738 if (NULL != le->attest)
739 GNUNET_free (le->attest);
740 if (NULL != le->reference)
741 GNUNET_free (le->reference);
742 tmp_le = le;
743 le = le->next;
744 GNUNET_free (tmp_le);
745 }
746 GNUNET_free (attrs);
747}
748
749/**
750 * Count attestations in claim list
751 *
752 * @param attrs list
753 */
754int
755GNUNET_RECLAIM_ATTRIBUTE_list_count_attest (
756 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
757{
758 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
759 int i = 0;
760 for (le = attrs->list_head; NULL != le; le = le->next)
761 {
762 if (NULL != le->attest)
763 i++;
764 }
765 return i;
766}
767/**
768 * Get required size for serialization buffer
769 *
770 * @param attr the attribute to serialize
771 * @return the required buffer size
772 */
773size_t
774GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (
775 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
776{
777 return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
778}
779
780
781/**
782 * Serialize an attribute
783 *
784 * @param attr the attribute to serialize
785 * @param result the serialized attribute
786 * @return length of serialized data
787 */
788size_t
789GNUNET_RECLAIM_ATTRIBUTE_serialize (
790 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
791 char *result)
792{
793 size_t data_len_ser;
794 size_t name_len;
795 struct Attribute *attr_ser;
796 char *write_ptr;
797
798 attr_ser = (struct Attribute *) result;
799 attr_ser->attribute_type = htons (attr->type);
800 attr_ser->attribute_version = htonl (attr->flag);
801 attr_ser->attribute_id = GNUNET_htonll (attr->id);
802 name_len = strlen (attr->name);
803 attr_ser->name_len = htons (name_len);
804 write_ptr = (char *) &attr_ser[1];
805 GNUNET_memcpy (write_ptr, attr->name, name_len);
806 write_ptr += name_len;
807 // TODO plugin-ize
808 // data_len_ser = plugin->serialize_attribute_value (attr,
809 // &attr_ser[1]);
810 data_len_ser = attr->data_size;
811 GNUNET_memcpy (write_ptr, attr->data, attr->data_size);
812 attr_ser->data_size = htons (data_len_ser);
813
814 return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
815}
816
817
818/**
819 * Deserialize an attribute
820 *
821 * @param data the serialized attribute
822 * @param data_size the length of the serialized data
823 *
824 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
825 */
826struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
827GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char *data, size_t data_size)
828{
829 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
830 struct Attribute *attr_ser;
831 size_t data_len;
832 size_t name_len;
833 char *write_ptr;
834
835 if (data_size < sizeof(struct Attribute))
836 return NULL;
837
838 attr_ser = (struct Attribute *) data;
839 data_len = ntohs (attr_ser->data_size);
840 name_len = ntohs (attr_ser->name_len);
841 if (data_size < sizeof(struct Attribute) + data_len + name_len)
842 {
843 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
844 "Buffer too small to deserialize\n");
845 return NULL;
846 }
847 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)
848 + data_len + name_len + 1);
849 attr->type = ntohs (attr_ser->attribute_type);
850 attr->flag = ntohl (attr_ser->attribute_version);
851 attr->id = GNUNET_ntohll (attr_ser->attribute_id);
852 attr->data_size = data_len;
853
854 write_ptr = (char *) &attr[1];
855 GNUNET_memcpy (write_ptr, &attr_ser[1], name_len);
856 write_ptr[name_len] = '\0';
857 attr->name = write_ptr;
858
859 write_ptr += name_len + 1;
860 GNUNET_memcpy (write_ptr, (char *) &attr_ser[1] + name_len, attr->data_size);
861 attr->data = write_ptr;
862 return attr;
863}
864
865
866/**
867 * Get required size for serialization buffer
868 *
869 * @param attr the attestation to serialize
870 * @return the required buffer size
871 */
872size_t
873GNUNET_RECLAIM_ATTESTATION_serialize_get_size (
874 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr)
875{
876 return sizeof(struct Attestation) + strlen (attr->name) + attr->data_size;
877}
878
879/**
880 * Serialize an attestation
881 *
882 * @param attr the attestation to serialize
883 * @param result the serialized attestation
884 * @return length of serialized data
885 */
886size_t
887GNUNET_RECLAIM_ATTESTATION_serialize (
888 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr,
889 char *result)
890{
891 size_t data_len_ser;
892 size_t name_len;
893 struct Attestation *attr_ser;
894 char *write_ptr;
895
896 attr_ser = (struct Attestation *) result;
897 attr_ser->attestation_type = htons (attr->type);
898 attr_ser->attestation_version = htonl (attr->version);
899 attr_ser->attestation_id = GNUNET_htonll (attr->id);
900 name_len = strlen (attr->name);
901 attr_ser->name_len = htons (name_len);
902 write_ptr = (char *) &attr_ser[1];
903 GNUNET_memcpy (write_ptr, attr->name, name_len);
904 write_ptr += name_len;
905 // TODO plugin-ize
906 // data_len_ser = plugin->serialize_attribute_value (attr,
907 // &attr_ser[1]);
908 data_len_ser = attr->data_size;
909 GNUNET_memcpy (write_ptr, attr->data, attr->data_size);
910 attr_ser->data_size = htons (data_len_ser);
911
912 return sizeof(struct Attestation) + strlen (attr->name) + attr->data_size;
913}
914
915/**
916 * Deserialize an attestation
917 *
918 * @param data the serialized attestation
919 * @param data_size the length of the serialized data
920 *
921 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
922 */
923struct GNUNET_RECLAIM_ATTESTATION_Claim *
924GNUNET_RECLAIM_ATTESTATION_deserialize (const char *data, size_t data_size)
925{
926 struct GNUNET_RECLAIM_ATTESTATION_Claim *attr;
927 struct Attestation *attr_ser;
928 size_t data_len;
929 size_t name_len;
930 char *write_ptr;
931
932 if (data_size < sizeof(struct Attestation))
933 return NULL;
934
935 attr_ser = (struct Attestation *) data;
936 data_len = ntohs (attr_ser->data_size);
937 name_len = ntohs (attr_ser->name_len);
938 if (data_size < sizeof(struct Attestation) + data_len + name_len)
939 {
940 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
941 "Buffer too small to deserialize\n");
942 return NULL;
943 }
944 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim)
945 + data_len + name_len + 1);
946 attr->type = ntohs (attr_ser->attestation_type);
947 attr->version = ntohl (attr_ser->attestation_version);
948 attr->id = GNUNET_ntohll (attr_ser->attestation_id);
949 attr->data_size = data_len;
950
951 write_ptr = (char *) &attr[1];
952 GNUNET_memcpy (write_ptr, &attr_ser[1], name_len);
953 write_ptr[name_len] = '\0';
954 attr->name = write_ptr;
955
956 write_ptr += name_len + 1;
957 GNUNET_memcpy (write_ptr, (char *) &attr_ser[1] + name_len, attr->data_size);
958 attr->data = write_ptr;
959 return attr;
960}
961
962/**
963 * Get required size for serialization buffer
964 *
965 * @param attr the reference to serialize
966 * @return the required buffer size
967 */
968size_t
969GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (
970 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr)
971{
972 return sizeof(struct Attestation_Reference) + strlen (attr->name) + strlen (
973 attr->reference_value);
974}
975
976
977/**
978 * Serialize a reference
979 *
980 * @param attr the reference to serialize
981 * @param result the serialized reference
982 * @return length of serialized data
983 */
984size_t
985GNUNET_RECLAIM_ATTESTATION_REF_serialize (
986 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
987 char *result)
988{
989 size_t name_len;
990 size_t refval_len;
991 struct Attestation_Reference *attr_ser;
992 char *write_ptr;
993 attr_ser = (struct Attestation_Reference *) result;
994 attr_ser->reference_id = GNUNET_htonll (attr->id);
995 attr_ser->attestation_id = GNUNET_htonll (attr->id_attest);
996 name_len = strlen (attr->name);
997 refval_len = strlen (attr->reference_value);
998 attr_ser->name_len = htons (name_len);
999 attr_ser->ref_value_len = htons (refval_len);
1000 write_ptr = (char *) &attr_ser[1];
1001 GNUNET_memcpy (write_ptr, attr->name, name_len);
1002 write_ptr += name_len;
1003 GNUNET_memcpy (write_ptr, attr->reference_value, refval_len);
1004
1005 return sizeof(struct Attestation_Reference) + strlen (attr->name) + strlen (
1006 attr->reference_value);
1007}
1008
1009
1010/**
1011 * Deserialize a reference
1012 *
1013 * @param data the serialized reference
1014 * @param data_size the length of the serialized data
1015 *
1016 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
1017 */
1018struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *
1019GNUNET_RECLAIM_ATTESTATION_REF_deserialize (const char *data, size_t data_size)
1020{
1021 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
1022 struct Attestation_Reference *attr_ser;
1023 size_t name_len;
1024 size_t refval_len;
1025 char *write_ptr;
1026
1027 if (data_size < sizeof(struct Attestation_Reference))
1028 return NULL;
1029 attr_ser = (struct Attestation_Reference *) data;
1030 name_len = ntohs (attr_ser->name_len);
1031 refval_len = ntohs (attr_ser->ref_value_len);
1032 if (data_size < sizeof(struct Attestation_Reference) + refval_len + name_len)
1033 {
1034 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1035 "Buffer too small to deserialize\n");
1036 return NULL;
1037 }
1038 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTESTATION_REFERENCE)
1039 + refval_len + name_len + 2);
1040
1041 attr->id = GNUNET_ntohll (attr_ser->reference_id);
1042 attr->id_attest = GNUNET_ntohll (attr_ser->attestation_id);
1043
1044 write_ptr = (char *) &attr[1];
1045 GNUNET_memcpy (write_ptr, &attr_ser[1], name_len);
1046 write_ptr[name_len] = '\0';
1047 attr->name = write_ptr;
1048
1049 write_ptr += name_len + 1;
1050 GNUNET_memcpy (write_ptr, (char *) &attr_ser[1] + name_len, refval_len);
1051 write_ptr[refval_len] = '\0';
1052 attr->reference_value = write_ptr;
1053 return attr;
1054}
1055/* end of reclaim_attribute.c */
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am
index 51b9b9c5b..6d448cc3c 100644
--- a/src/reclaim/Makefile.am
+++ b/src/reclaim/Makefile.am
@@ -9,12 +9,15 @@ if USE_COVERAGE
9endif 9endif
10 10
11 11
12if HAVE_MHD 12if HAVE_REST
13if HAVE_JSON
14REST_PLUGIN = \ 13REST_PLUGIN = \
15 libgnunet_plugin_rest_openid_connect.la \ 14 libgnunet_plugin_rest_openid_connect.la \
16 libgnunet_plugin_rest_reclaim.la 15 libgnunet_plugin_rest_reclaim.la
17endif 16endif
17
18if HAVE_JSON
19ATTESTATION_PLUGIN = \
20 libgnunet_plugin_reclaim_attestation_jwt.la
18endif 21endif
19 22
20EXTRA_DIST = \ 23EXTRA_DIST = \
@@ -34,6 +37,8 @@ lib_LTLIBRARIES = \
34 libgnunetreclaim.la 37 libgnunetreclaim.la
35plugin_LTLIBRARIES = \ 38plugin_LTLIBRARIES = \
36 libgnunet_plugin_gnsrecord_reclaim.la \ 39 libgnunet_plugin_gnsrecord_reclaim.la \
40 libgnunet_plugin_reclaim_attribute_basic.la \
41 $(ATTESTATION_PLUGIN) \
37 $(REST_PLUGIN) 42 $(REST_PLUGIN)
38 43
39bin_PROGRAMS = \ 44bin_PROGRAMS = \
@@ -51,7 +56,6 @@ libgnunet_plugin_rest_reclaim_la_LIBADD = \
51 libgnunetreclaim.la \ 56 libgnunetreclaim.la \
52 $(top_builddir)/src/json/libgnunetjson.la \ 57 $(top_builddir)/src/json/libgnunetjson.la \
53 $(top_builddir)/src/rest/libgnunetrest.la \ 58 $(top_builddir)/src/rest/libgnunetrest.la \
54 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
55 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 59 $(top_builddir)/src/namestore/libgnunetnamestore.la \
56 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ 60 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
57 $(LTLIBINTL) -ljansson $(MHD_LIBS) 61 $(LTLIBINTL) -ljansson $(MHD_LIBS)
@@ -68,7 +72,6 @@ libgnunet_plugin_rest_openid_connect_la_LIBADD = \
68 $(top_builddir)/src/identity/libgnunetidentity.la \ 72 $(top_builddir)/src/identity/libgnunetidentity.la \
69 libgnunetreclaim.la \ 73 libgnunetreclaim.la \
70 $(top_builddir)/src/rest/libgnunetrest.la \ 74 $(top_builddir)/src/rest/libgnunetrest.la \
71 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
72 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 75 $(top_builddir)/src/namestore/libgnunetnamestore.la \
73 $(top_builddir)/src/gns/libgnunetgns.la \ 76 $(top_builddir)/src/gns/libgnunetgns.la \
74 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 77 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
@@ -98,22 +101,43 @@ gnunet_service_reclaim_LDADD = \
98 $(top_builddir)/src/util/libgnunetutil.la \ 101 $(top_builddir)/src/util/libgnunetutil.la \
99 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 102 $(top_builddir)/src/namestore/libgnunetnamestore.la \
100 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 103 $(top_builddir)/src/statistics/libgnunetstatistics.la \
101 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
102 libgnunetreclaim.la \ 104 libgnunetreclaim.la \
103 $(top_builddir)/src/gns/libgnunetgns.la \ 105 $(top_builddir)/src/gns/libgnunetgns.la \
104 $(GN_LIBINTL) 106 $(GN_LIBINTL)
105 107
106libgnunetreclaim_la_SOURCES = \ 108libgnunetreclaim_la_SOURCES = \
107 reclaim_api.c \ 109 reclaim_api.c \
108 reclaim.h 110 reclaim.h \
111 reclaim_attribute.c \
112 reclaim_attribute.h \
113 reclaim_attestation.c \
114 reclaim_attestation.h
109libgnunetreclaim_la_LIBADD = \ 115libgnunetreclaim_la_LIBADD = \
110 $(top_builddir)/src/util/libgnunetutil.la \ 116 $(top_builddir)/src/util/libgnunetutil.la \
111 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
112 $(GN_LIBINTL) $(XLIB) 117 $(GN_LIBINTL) $(XLIB)
113libgnunetreclaim_la_LDFLAGS = \ 118libgnunetreclaim_la_LDFLAGS = \
114 $(GN_LIB_LDFLAGS) \ 119 $(GN_LIB_LDFLAGS) \
115 -version-info 0:0:0 120 -version-info 0:0:0
116 121
122
123libgnunet_plugin_reclaim_attribute_basic_la_SOURCES = \
124 plugin_reclaim_attribute_basic.c
125libgnunet_plugin_reclaim_attribute_basic_la_LIBADD = \
126 $(top_builddir)/src/util/libgnunetutil.la \
127 $(LTLIBINTL)
128libgnunet_plugin_reclaim_attribute_basic_la_LDFLAGS = \
129 $(GN_PLUGIN_LDFLAGS)
130
131libgnunet_plugin_reclaim_attestation_jwt_la_SOURCES = \
132 plugin_reclaim_attestation_jwt.c
133libgnunet_plugin_reclaim_attestation_jwt_la_LIBADD = \
134 $(top_builddir)/src/util/libgnunetutil.la \
135 libgnunetreclaim.la \
136 -ljansson\
137 $(LTLIBINTL)
138libgnunet_plugin_reclaim_attestation_jwt_la_LDFLAGS = \
139 $(GN_PLUGIN_LDFLAGS)
140
117gnunet_reclaim_SOURCES = \ 141gnunet_reclaim_SOURCES = \
118 gnunet-reclaim.c 142 gnunet-reclaim.c
119gnunet_reclaim_LDADD = \ 143gnunet_reclaim_LDADD = \
@@ -121,7 +145,6 @@ gnunet_reclaim_LDADD = \
121 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 145 $(top_builddir)/src/namestore/libgnunetnamestore.la \
122 libgnunetreclaim.la \ 146 libgnunetreclaim.la \
123 $(top_builddir)/src/identity/libgnunetidentity.la \ 147 $(top_builddir)/src/identity/libgnunetidentity.la \
124 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
125 $(GN_LIBINTL) 148 $(GN_LIBINTL)
126 149
127check_SCRIPTS = \ 150check_SCRIPTS = \
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
index 5f9170f05..e7ee814b6 100644
--- a/src/reclaim/gnunet-reclaim.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -43,6 +43,31 @@ static int ret;
43static int list; 43static int list;
44 44
45/** 45/**
46 * List attestations flag
47 */
48static int list_attestations;
49
50/**
51 * Attestation ID string
52 */
53static char *attestation_id;
54
55/**
56 * Attestation ID
57 */
58static struct GNUNET_RECLAIM_Identifier attestation;
59
60/**
61 * Attestation name
62 */
63static char *attestation_name;
64
65/**
66 * Attestation exists
67 */
68static int attestation_exists;
69
70/**
46 * Relying party 71 * Relying party
47 */ 72 */
48static char *rp; 73static char *rp;
@@ -108,6 +133,12 @@ static struct GNUNET_RECLAIM_Operation *reclaim_op;
108static struct GNUNET_RECLAIM_AttributeIterator *attr_iterator; 133static struct GNUNET_RECLAIM_AttributeIterator *attr_iterator;
109 134
110/** 135/**
136 * Attestation iterator
137 */
138static struct GNUNET_RECLAIM_AttestationIterator *attest_iterator;
139
140
141/**
111 * Ticket iterator 142 * Ticket iterator
112 */ 143 */
113static struct GNUNET_RECLAIM_TicketIterator *ticket_iterator; 144static struct GNUNET_RECLAIM_TicketIterator *ticket_iterator;
@@ -135,7 +166,7 @@ static struct GNUNET_RECLAIM_Ticket ticket;
135/** 166/**
136 * Attribute list 167 * Attribute list
137 */ 168 */
138static struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list; 169static struct GNUNET_RECLAIM_AttributeList *attr_list;
139 170
140/** 171/**
141 * Attribute expiration interval 172 * Attribute expiration interval
@@ -155,7 +186,7 @@ static struct GNUNET_SCHEDULER_Task *cleanup_task;
155/** 186/**
156 * Claim to store 187 * Claim to store
157 */ 188 */
158struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim; 189struct GNUNET_RECLAIM_Attribute *claim;
159 190
160/** 191/**
161 * Claim to delete 192 * Claim to delete
@@ -165,7 +196,7 @@ static char *attr_delete;
165/** 196/**
166 * Claim object to delete 197 * Claim object to delete
167 */ 198 */
168static struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr_to_delete; 199static struct GNUNET_RECLAIM_Attribute *attr_to_delete;
169 200
170static void 201static void
171do_cleanup (void *cls) 202do_cleanup (void *cls)
@@ -177,6 +208,8 @@ do_cleanup (void *cls)
177 GNUNET_RECLAIM_cancel (reclaim_op); 208 GNUNET_RECLAIM_cancel (reclaim_op);
178 if (NULL != attr_iterator) 209 if (NULL != attr_iterator)
179 GNUNET_RECLAIM_get_attributes_stop (attr_iterator); 210 GNUNET_RECLAIM_get_attributes_stop (attr_iterator);
211 if (NULL != attest_iterator)
212 GNUNET_RECLAIM_get_attestations_stop (attest_iterator);
180 if (NULL != ticket_iterator) 213 if (NULL != ticket_iterator)
181 GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator); 214 GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator);
182 if (NULL != reclaim_handle) 215 if (NULL != reclaim_handle)
@@ -212,7 +245,7 @@ ticket_issue_cb (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
212 245
213 246
214static void 247static void
215store_attr_cont (void *cls, int32_t success, const char *emsg) 248store_cont (void *cls, int32_t success, const char *emsg)
216{ 249{
217 reclaim_op = NULL; 250 reclaim_op = NULL;
218 if (GNUNET_SYSERR == success) 251 if (GNUNET_SYSERR == success)
@@ -226,9 +259,8 @@ store_attr_cont (void *cls, int32_t success, const char *emsg)
226static void 259static void
227process_attrs (void *cls, 260process_attrs (void *cls,
228 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 261 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
229 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 262 const struct GNUNET_RECLAIM_Attribute *attr,
230 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 263 const struct GNUNET_RECLAIM_Attestation *attest)
231 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
232{ 264{
233 char *value_str; 265 char *value_str;
234 char *id; 266 char *id;
@@ -245,18 +277,43 @@ process_attrs (void *cls,
245 ret = 1; 277 ret = 1;
246 return; 278 return;
247 } 279 }
248 value_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type, 280 attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
249 attr->data, 281 id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
250 attr->data_size); 282 value_str = NULL;
251 attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); 283 if (NULL == attest)
252 id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t)); 284 {
285 value_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
286 attr->data,
287 attr->data_size);
288 }
289 else
290 {
291 struct GNUNET_RECLAIM_AttributeListEntry *ale;
292 struct GNUNET_RECLAIM_AttributeList *al
293 = GNUNET_RECLAIM_attestation_get_attributes (attest);
294
295 for (ale = al->list_head; NULL != ale; ale = ale->next)
296 {
297 if (0 != strncmp (attr->data, ale->attribute->name, attr->data_size))
298 continue;
299 value_str
300 = GNUNET_RECLAIM_attribute_value_to_string (ale->attribute->type,
301 ale->attribute->
302 data,
303 ale->attribute->
304 data_size);
305 break;
306 }
307 }
253 fprintf (stdout, 308 fprintf (stdout,
254 "Name: %s; Value: %s (%s); Version %u; ID: %s\n", 309 "Name: %s; Value: %s (%s); Flag %u; ID: %s %s\n",
255 attr->name, 310 attr->name,
256 value_str, 311 (NULL != value_str) ? value_str : "???",
257 attr_type, 312 attr_type,
258 attr->flag, 313 attr->flag,
259 id); 314 id,
315 (NULL == attest) ? "" : "(ATTESTED)");
316 GNUNET_free_non_null (value_str);
260 GNUNET_free (id); 317 GNUNET_free (id);
261} 318}
262 319
@@ -289,7 +346,7 @@ ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
289 GNUNET_STRINGS_data_to_string_alloc (&ticket->audience, 346 GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
290 sizeof(struct 347 sizeof(struct
291 GNUNET_CRYPTO_EcdsaPublicKey)); 348 GNUNET_CRYPTO_EcdsaPublicKey));
292 ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t)); 349 ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
293 tkt = 350 tkt =
294 GNUNET_STRINGS_data_to_string_alloc (ticket, 351 GNUNET_STRINGS_data_to_string_alloc (ticket,
295 sizeof(struct GNUNET_RECLAIM_Ticket)); 352 sizeof(struct GNUNET_RECLAIM_Ticket));
@@ -305,7 +362,9 @@ static void
305iter_error (void *cls) 362iter_error (void *cls)
306{ 363{
307 attr_iterator = NULL; 364 attr_iterator = NULL;
308 fprintf (stderr, "Failed to iterate over attributes\n"); 365 attest_iterator = NULL;
366 fprintf (stderr, "Failed\n");
367
309 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 368 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
310} 369}
311 370
@@ -412,10 +471,10 @@ iter_finished (void *cls)
412 if (NULL == type_str) 471 if (NULL == type_str)
413 type = GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING; 472 type = GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING;
414 else 473 else
415 type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str); 474 type = GNUNET_RECLAIM_attribute_typename_to_number (type_str);
416 475
417 GNUNET_assert (GNUNET_SYSERR != 476 GNUNET_assert (GNUNET_SYSERR !=
418 GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type, 477 GNUNET_RECLAIM_attribute_string_to_value (type,
419 attr_value, 478 attr_value,
420 (void **) &data, 479 (void **) &data,
421 &data_size)); 480 &data_size));
@@ -428,13 +487,17 @@ iter_finished (void *cls)
428 else 487 else
429 { 488 {
430 claim = 489 claim =
431 GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name, type, data, data_size); 490 GNUNET_RECLAIM_attribute_new (attr_name, NULL, type, data, data_size);
491 }
492 if (NULL != attestation_id)
493 {
494 claim->attestation = attestation;
432 } 495 }
433 reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle, 496 reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle,
434 pkey, 497 pkey,
435 claim, 498 claim,
436 &exp_interval, 499 &exp_interval,
437 &store_attr_cont, 500 &store_cont,
438 NULL); 501 NULL);
439 GNUNET_free (data); 502 GNUNET_free (data);
440 GNUNET_free (claim); 503 GNUNET_free (claim);
@@ -447,11 +510,9 @@ iter_finished (void *cls)
447static void 510static void
448iter_cb (void *cls, 511iter_cb (void *cls,
449 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 512 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
450 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 513 const struct GNUNET_RECLAIM_Attribute *attr)
451 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
452 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
453{ 514{
454 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 515 struct GNUNET_RECLAIM_AttributeListEntry *le;
455 char *attrs_tmp; 516 char *attrs_tmp;
456 char *attr_str; 517 char *attr_str;
457 char *label; 518 char *label;
@@ -462,10 +523,11 @@ iter_cb (void *cls,
462 { 523 {
463 if (0 == strcasecmp (attr_name, attr->name)) 524 if (0 == strcasecmp (attr_name, attr->name))
464 { 525 {
465 claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name, 526 claim = GNUNET_RECLAIM_attribute_new (attr->name,
466 attr->type, 527 &attr->attestation,
467 attr->data, 528 attr->type,
468 attr->data_size); 529 attr->data,
530 attr->data_size);
469 } 531 }
470 } 532 }
471 else if (issue_attrs) 533 else if (issue_attrs)
@@ -479,13 +541,14 @@ iter_cb (void *cls,
479 attr_str = strtok (NULL, ","); 541 attr_str = strtok (NULL, ",");
480 continue; 542 continue;
481 } 543 }
482 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); 544 le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
483 le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name, 545 le->attribute = GNUNET_RECLAIM_attribute_new (attr->name,
484 attr->type, 546 &attr->attestation,
485 attr->data, 547 attr->type,
486 attr->data_size); 548 attr->data,
487 le->claim->flag = attr->flag; 549 attr->data_size);
488 le->claim->id = attr->id; 550 le->attribute->flag = attr->flag;
551 le->attribute->id = attr->id;
489 GNUNET_CONTAINER_DLL_insert (attr_list->list_head, 552 GNUNET_CONTAINER_DLL_insert (attr_list->list_head,
490 attr_list->list_tail, 553 attr_list->list_tail,
491 le); 554 le);
@@ -495,34 +558,146 @@ iter_cb (void *cls,
495 } 558 }
496 else if (attr_delete && (NULL == attr_to_delete)) 559 else if (attr_delete && (NULL == attr_to_delete))
497 { 560 {
498 label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t)); 561 label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
499 if (0 == strcasecmp (attr_delete, label)) 562 if (0 == strcasecmp (attr_delete, label))
500 { 563 {
501 attr_to_delete = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name, 564 attr_to_delete = GNUNET_RECLAIM_attribute_new (attr->name,
502 attr->type, 565 &attr->attestation,
503 attr->data, 566 attr->type,
504 attr->data_size); 567 attr->data,
568 attr->data_size);
505 attr_to_delete->id = attr->id; 569 attr_to_delete->id = attr->id;
506 } 570 }
507 GNUNET_free (label); 571 GNUNET_free (label);
508 } 572 }
509 else if (list) 573 else if (list)
510 { 574 {
511 attr_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type, 575 attr_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
512 attr->data, 576 attr->data,
513 attr->data_size); 577 attr->data_size);
514 attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); 578 attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
515 id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t)); 579 id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
580 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attr->attestation))
581 {
582 fprintf (stdout,
583 "%s: ``%s'' (%s); ID: %s\n",
584 attr->name,
585 attr_str,
586 attr_type,
587 id);
588 }
589 else
590 {
591 char *attest_id =
592 GNUNET_STRINGS_data_to_string_alloc (&attr->attestation,
593 sizeof(attr->attestation));
594 fprintf (stdout,
595 "%s: <``%s'' in attestation %s> (%s); ID: %s\n",
596 attr->name,
597 attr_str,
598 attest_id,
599 attr_type,
600 id);
601 GNUNET_free (attest_id);
602
603 }
604 GNUNET_free (id);
605 }
606 GNUNET_RECLAIM_get_attributes_next (attr_iterator);
607}
608
609
610static void
611attest_iter_finished (void *cls)
612{
613 attest_iterator = NULL;
614
615 // Add new attestation
616 if ((NULL != attestation_name) &&
617 (NULL != attr_value))
618 {
619 struct GNUNET_RECLAIM_Attestation *attestation =
620 GNUNET_RECLAIM_attestation_new (attestation_name,
621 GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, // FIXME hardcoded
622 attr_value,
623 strlen (attr_value));
624 reclaim_op = GNUNET_RECLAIM_attestation_store (reclaim_handle,
625 pkey,
626 attestation,
627 &exp_interval,
628 store_cont,
629 NULL);
630 return;
631
632 }
633 if (list_attestations)
634 {
635 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
636 return;
637 }
638 attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
639 pkey,
640 &iter_error,
641 NULL,
642 &iter_cb,
643 NULL,
644 &iter_finished,
645 NULL);
646
647}
648
649
650static void
651attest_iter_cb (void *cls,
652 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
653 const struct GNUNET_RECLAIM_Attestation *attest)
654{
655 char *attest_str;
656 char *attr_str;
657 char *id;
658 const char *attest_type;
659 struct GNUNET_RECLAIM_AttributeListEntry *ale;
660
661 if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&attestation,
662 &attest->id))
663 attestation_exists = GNUNET_YES;
664 if (list_attestations)
665 {
666 attest_str = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
667 attest->data,
668 attest->data_size);
669 attest_type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type);
670 id = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id));
516 fprintf (stdout, 671 fprintf (stdout,
517 "Name: %s; Value: %s (%s); Version %u; ID: %s\n", 672 "%s: ``%s'' (%s); ID: %s\n",
518 attr->name, 673 attest->name,
519 attr_str, 674 attest_str,
520 attr_type, 675 attest_type,
521 attr->flag,
522 id); 676 id);
677 struct GNUNET_RECLAIM_AttributeList *attrs =
678 GNUNET_RECLAIM_attestation_get_attributes (attest);
679 if (NULL != attrs)
680 {
681 fprintf (stdout,
682 "\t Attributes:\n");
683 for (ale = attrs->list_head; NULL != ale; ale = ale->next)
684 {
685 attr_str = GNUNET_RECLAIM_attribute_value_to_string (
686 ale->attribute->type,
687 ale->attribute->
688 data,
689 ale->attribute->
690 data_size);
691
692 fprintf (stdout,
693 "\t %s: %s\n", ale->attribute->name, attr_str);
694 GNUNET_free (attr_str);
695 }
696 GNUNET_RECLAIM_attribute_list_destroy (attrs);
697 }
523 GNUNET_free (id); 698 GNUNET_free (id);
524 } 699 }
525 GNUNET_RECLAIM_get_attributes_next (attr_iterator); 700 GNUNET_RECLAIM_get_attestations_next (attest_iterator);
526} 701}
527 702
528 703
@@ -535,7 +710,12 @@ start_process ()
535 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 710 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
536 return; 711 return;
537 } 712 }
538 713 attestation = GNUNET_RECLAIM_ID_ZERO;
714 if (NULL != attestation_id)
715 GNUNET_STRINGS_string_to_data (attestation_id,
716 strlen (attestation_id),
717 &attestation, sizeof(attestation));
718 attestation_exists = GNUNET_NO;
539 if (list_tickets) 719 if (list_tickets)
540 { 720 {
541 ticket_iterator = GNUNET_RECLAIM_ticket_iteration_start (reclaim_handle, 721 ticket_iterator = GNUNET_RECLAIM_ticket_iteration_start (reclaim_handle,
@@ -568,16 +748,18 @@ start_process ()
568 &ticket, 748 &ticket,
569 sizeof(struct GNUNET_RECLAIM_Ticket)); 749 sizeof(struct GNUNET_RECLAIM_Ticket));
570 750
571 attr_list = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList); 751 attr_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
572 claim = NULL; 752 claim = NULL;
573 attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle, 753 attest_iterator = GNUNET_RECLAIM_get_attestations_start (reclaim_handle,
574 pkey, 754 pkey,
575 &iter_error, 755 &iter_error,
576 NULL, 756 NULL,
577 &iter_cb, 757 &attest_iter_cb,
578 NULL, 758 NULL,
579 &iter_finished, 759 &
580 NULL); 760 attest_iter_finished,
761 NULL);
762
581} 763}
582 764
583 765
@@ -673,13 +855,27 @@ main (int argc, char *const argv[])
673 "dump", 855 "dump",
674 gettext_noop ("List attributes for EGO"), 856 gettext_noop ("List attributes for EGO"),
675 &list), 857 &list),
676 GNUNET_GETOPT_option_string ( 858 GNUNET_GETOPT_option_flag ('A',
677 'i', 859 "attestations",
678 "issue", 860 gettext_noop ("List attestations for EGO"),
679 "A1,A2,...", 861 &list_attestations),
680 gettext_noop ( 862 GNUNET_GETOPT_option_string ('I',
681 "Issue a ticket for a set of attributes separated by comma"), 863 "Attestation ID",
682 &issue_attrs), 864 "ATTESTATION_ID",
865 gettext_noop (
866 "Attestation to use for attribute"),
867 &attestation_id),
868 GNUNET_GETOPT_option_string ('N',
869 "attestation-name",
870 "NAME",
871 gettext_noop ("Attestation name"),
872 &attestation_name),
873 GNUNET_GETOPT_option_string ('i',
874 "issue",
875 "A1,A2,...",
876 gettext_noop (
877 "Issue a ticket for a set of attributes separated by comma"),
878 &issue_attrs),
683 GNUNET_GETOPT_option_string ('C', 879 GNUNET_GETOPT_option_string ('C',
684 "consume", 880 "consume",
685 "TICKET", 881 "TICKET",
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index 556006af0..d4d44c3fc 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -29,7 +29,7 @@
29#include "gnunet_constants.h" 29#include "gnunet_constants.h"
30#include "gnunet_gnsrecord_lib.h" 30#include "gnunet_gnsrecord_lib.h"
31#include "gnunet_protocols.h" 31#include "gnunet_protocols.h"
32#include "gnunet_reclaim_attribute_lib.h" 32#include "gnunet_reclaim_lib.h"
33#include "gnunet_reclaim_service.h" 33#include "gnunet_reclaim_service.h"
34#include "gnunet_signatures.h" 34#include "gnunet_signatures.h"
35#include "reclaim.h" 35#include "reclaim.h"
@@ -90,17 +90,17 @@ struct TicketIteration
90/** 90/**
91 * An attribute iteration operation. 91 * An attribute iteration operation.
92 */ 92 */
93struct AttributeIterator 93struct Iterator
94{ 94{
95 /** 95 /**
96 * Next element in the DLL 96 * Next element in the DLL
97 */ 97 */
98 struct AttributeIterator *next; 98 struct Iterator *next;
99 99
100 /** 100 /**
101 * Previous element in the DLL 101 * Previous element in the DLL
102 */ 102 */
103 struct AttributeIterator *prev; 103 struct Iterator *prev;
104 104
105 /** 105 /**
106 * IDP client which intiated this zone iteration 106 * IDP client which intiated this zone iteration
@@ -121,6 +121,11 @@ struct AttributeIterator
121 * The operation id fot the zone iteration in the response for the client 121 * The operation id fot the zone iteration in the response for the client
122 */ 122 */
123 uint32_t request_id; 123 uint32_t request_id;
124
125 /**
126 * Context
127 */
128 void *ctx;
124}; 129};
125 130
126 131
@@ -154,14 +159,28 @@ struct IdpClient
154 * Attribute iteration operations in 159 * Attribute iteration operations in
155 * progress initiated by this client 160 * progress initiated by this client
156 */ 161 */
157 struct AttributeIterator *attr_iter_head; 162 struct Iterator *attr_iter_head;
163
164 /**
165 * Tail of the DLL of
166 * Attribute iteration operations
167 * in progress initiated by this client
168 */
169 struct Iterator *attr_iter_tail;
170
171 /**
172 * Head of the DLL of
173 * Attribute iteration operations in
174 * progress initiated by this client
175 */
176 struct Iterator *attest_iter_head;
158 177
159 /** 178 /**
160 * Tail of the DLL of 179 * Tail of the DLL of
161 * Attribute iteration operations 180 * Attribute iteration operations
162 * in progress initiated by this client 181 * in progress initiated by this client
163 */ 182 */
164 struct AttributeIterator *attr_iter_tail; 183 struct Iterator *attest_iter_tail;
165 184
166 /** 185 /**
167 * Head of DLL of ticket iteration ops 186 * Head of DLL of ticket iteration ops
@@ -263,18 +282,14 @@ struct AttributeDeleteHandle
263 /** 282 /**
264 * The attribute to delete 283 * The attribute to delete
265 */ 284 */
266 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim; 285 struct GNUNET_RECLAIM_Attribute *claim;
267 286
268 /** 287 /**
269 * The attestation to delete 288 * The attestation to delete
270 */ 289 */
271 struct GNUNET_RECLAIM_ATTESTATION_Claim *attest; 290 struct GNUNET_RECLAIM_Attestation *attest;
272 291
273 /** 292 /**
274 * The reference to delete
275 */
276 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference;
277 /**
278 * Tickets to update 293 * Tickets to update
279 */ 294 */
280 struct TicketRecordsEntry *tickets_to_update_head; 295 struct TicketRecordsEntry *tickets_to_update_head;
@@ -334,17 +349,12 @@ struct AttributeStoreHandle
334 /** 349 /**
335 * The attribute to store 350 * The attribute to store
336 */ 351 */
337 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim; 352 struct GNUNET_RECLAIM_Attribute *claim;
338 353
339 /** 354 /**
340 * The attestation to store 355 * The attestation to store
341 */ 356 */
342 struct GNUNET_RECLAIM_ATTESTATION_Claim *attest; 357 struct GNUNET_RECLAIM_Attestation *attest;
343
344 /**
345 * The reference to store
346 */
347 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference;
348 358
349 /** 359 /**
350 * The attribute expiration interval 360 * The attribute expiration interval
@@ -480,8 +490,6 @@ cleanup_adh (struct AttributeDeleteHandle *adh)
480 GNUNET_free (adh->claim); 490 GNUNET_free (adh->claim);
481 if (NULL != adh->attest) 491 if (NULL != adh->attest)
482 GNUNET_free (adh->attest); 492 GNUNET_free (adh->attest);
483 if (NULL != adh->reference)
484 GNUNET_free (adh->reference);
485 while (NULL != (le = adh->tickets_to_update_head)) 493 while (NULL != (le = adh->tickets_to_update_head))
486 { 494 {
487 GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head, 495 GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head,
@@ -511,8 +519,6 @@ cleanup_as_handle (struct AttributeStoreHandle *ash)
511 GNUNET_free (ash->claim); 519 GNUNET_free (ash->claim);
512 if (NULL != ash->attest) 520 if (NULL != ash->attest)
513 GNUNET_free (ash->attest); 521 GNUNET_free (ash->attest);
514 if (NULL != ash->reference)
515 GNUNET_free (ash->reference);
516 GNUNET_free (ash); 522 GNUNET_free (ash);
517} 523}
518 524
@@ -525,7 +531,7 @@ cleanup_as_handle (struct AttributeStoreHandle *ash)
525static void 531static void
526cleanup_client (struct IdpClient *idp) 532cleanup_client (struct IdpClient *idp)
527{ 533{
528 struct AttributeIterator *ai; 534 struct Iterator *ai;
529 struct TicketIteration *ti; 535 struct TicketIteration *ti;
530 struct TicketRevocationOperation *rop; 536 struct TicketRevocationOperation *rop;
531 struct TicketIssueOperation *iss; 537 struct TicketIssueOperation *iss;
@@ -563,6 +569,13 @@ cleanup_client (struct IdpClient *idp)
563 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai); 569 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
564 GNUNET_free (ai); 570 GNUNET_free (ai);
565 } 571 }
572 while (NULL != (ai = idp->attest_iter_head))
573 {
574 GNUNET_CONTAINER_DLL_remove (idp->attest_iter_head, idp->attest_iter_tail,
575 ai);
576 GNUNET_free (ai);
577 }
578
566 while (NULL != (rop = idp->revoke_op_head)) 579 while (NULL != (rop = idp->revoke_op_head))
567 { 580 {
568 GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head, idp->revoke_op_tail, rop); 581 GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head, idp->revoke_op_tail, rop);
@@ -718,13 +731,13 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
718{ 731{
719 struct TicketIssueOperation *tio; 732 struct TicketIssueOperation *tio;
720 struct IdpClient *idp = cls; 733 struct IdpClient *idp = cls;
721 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; 734 struct GNUNET_RECLAIM_AttributeList *attrs;
722 size_t attrs_len; 735 size_t attrs_len;
723 736
724 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n"); 737 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n");
725 tio = GNUNET_new (struct TicketIssueOperation); 738 tio = GNUNET_new (struct TicketIssueOperation);
726 attrs_len = ntohs (im->attr_len); 739 attrs_len = ntohs (im->attr_len);
727 attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *) &im[1], 740 attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1],
728 attrs_len); 741 attrs_len);
729 tio->r_id = ntohl (im->id); 742 tio->r_id = ntohl (im->id);
730 tio->client = idp; 743 tio->client = idp;
@@ -735,7 +748,7 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
735 &issue_ticket_result_cb, 748 &issue_ticket_result_cb,
736 tio); 749 tio);
737 GNUNET_SERVICE_client_continue (idp->client); 750 GNUNET_SERVICE_client_continue (idp->client);
738 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs); 751 GNUNET_RECLAIM_attribute_list_destroy (attrs);
739} 752}
740 753
741 754
@@ -828,7 +841,8 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
828static void 841static void
829consume_result_cb (void *cls, 842consume_result_cb (void *cls,
830 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 843 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
831 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 844 const struct GNUNET_RECLAIM_AttributeList *attrs,
845 const struct GNUNET_RECLAIM_AttestationList *attests,
832 int32_t success, 846 int32_t success,
833 const char *emsg) 847 const char *emsg)
834{ 848{
@@ -837,23 +851,28 @@ consume_result_cb (void *cls,
837 struct GNUNET_MQ_Envelope *env; 851 struct GNUNET_MQ_Envelope *env;
838 char *data_tmp; 852 char *data_tmp;
839 size_t attrs_len; 853 size_t attrs_len;
854 size_t attests_len;
840 855
841 if (GNUNET_OK != success) 856 if (GNUNET_OK != success)
842 { 857 {
843 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg); 858 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
844 } 859 }
845 attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs); 860 attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs);
861 attests_len = GNUNET_RECLAIM_attestation_list_serialize_get_size (attests);
846 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 862 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
847 "Sending CONSUME_TICKET_RESULT message\n"); 863 "Sending CONSUME_TICKET_RESULT message\n");
848 env = GNUNET_MQ_msg_extra (crm, 864 env = GNUNET_MQ_msg_extra (crm,
849 attrs_len, 865 attrs_len + attests_len,
850 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); 866 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT);
851 crm->id = htonl (cop->r_id); 867 crm->id = htonl (cop->r_id);
852 crm->attrs_len = htons (attrs_len); 868 crm->attrs_len = htons (attrs_len);
869 crm->attestations_len = htons (attests_len);
853 crm->identity = *identity; 870 crm->identity = *identity;
854 crm->result = htonl (success); 871 crm->result = htonl (success);
855 data_tmp = (char *) &crm[1]; 872 data_tmp = (char *) &crm[1];
856 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, data_tmp); 873 GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp);
874 data_tmp += attrs_len;
875 GNUNET_RECLAIM_attestation_list_serialize (attests, data_tmp);
857 GNUNET_MQ_send (cop->client->mq, env); 876 GNUNET_MQ_send (cop->client->mq, env);
858 GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head, 877 GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head,
859 cop->client->consume_op_tail, 878 cop->client->consume_op_tail,
@@ -965,20 +984,20 @@ attr_store_task (void *cls)
965 size_t buf_size; 984 size_t buf_size;
966 985
967 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n"); 986 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
968 buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (ash->claim); 987 buf_size = GNUNET_RECLAIM_attribute_serialize_get_size (ash->claim);
969 buf = GNUNET_malloc (buf_size); 988 buf = GNUNET_malloc (buf_size);
970 // Give the ash a new id if unset 989 // Give the ash a new id if unset
971 if (0 == ash->claim->id) 990 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->claim->id))
972 ash->claim->id 991 GNUNET_RECLAIM_id_generate (&ash->claim->id);
973 = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); 992 GNUNET_RECLAIM_attribute_serialize (ash->claim, buf);
974 GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim, buf);
975 label 993 label
976 = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id, sizeof(uint64_t)); 994 = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id,
995 sizeof (ash->claim->id));
977 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label); 996 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
978 997
979 rd[0].data_size = buf_size; 998 rd[0].data_size = buf_size;
980 rd[0].data = buf; 999 rd[0].data = buf;
981 rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR; 1000 rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE;
982 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 1001 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
983 rd[0].expiration_time = ash->exp.rel_value_us; 1002 rd[0].expiration_time = ash->exp.rel_value_us;
984 ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh, 1003 ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
@@ -1034,7 +1053,7 @@ handle_attribute_store_message (void *cls,
1034 data_len = ntohs (sam->attr_len); 1053 data_len = ntohs (sam->attr_len);
1035 1054
1036 ash = GNUNET_new (struct AttributeStoreHandle); 1055 ash = GNUNET_new (struct AttributeStoreHandle);
1037 ash->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char *) &sam[1], 1056 ash->claim = GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1],
1038 data_len); 1057 data_len);
1039 1058
1040 ash->r_id = ntohl (sam->id); 1059 ash->r_id = ntohl (sam->id);
@@ -1086,30 +1105,6 @@ attest_store_cont (void *cls, int32_t success, const char *emsg)
1086 cleanup_as_handle (ash); 1105 cleanup_as_handle (ash);
1087} 1106}
1088 1107
1089/**
1090 * Send a reference error response
1091 *
1092 * @param ash our attribute store handle
1093 * @param success the success status
1094 */
1095static void
1096send_ref_error (struct AttributeStoreHandle *ash)
1097{
1098 struct GNUNET_MQ_Envelope *env;
1099 struct SuccessResultMessage *acr_msg;
1100
1101 ash->ns_qe = NULL;
1102 GNUNET_CONTAINER_DLL_remove (ash->client->store_op_head,
1103 ash->client->store_op_tail,
1104 ash);
1105
1106 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1107 env = GNUNET_MQ_msg (acr_msg, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE);
1108 acr_msg->id = htonl (ash->r_id);
1109 acr_msg->op_result = htonl (GNUNET_SYSERR);
1110 GNUNET_MQ_send (ash->client->mq, env);
1111 cleanup_as_handle (ash);
1112}
1113 1108
1114/** 1109/**
1115 * Error looking up potential attestation. Abort. 1110 * Error looking up potential attestation. Abort.
@@ -1127,8 +1122,9 @@ attest_error (void *cls)
1127 return; 1122 return;
1128} 1123}
1129 1124
1125
1130/** 1126/**
1131* Check for existing record before storing reference 1127* Check for existing record before storing attestation
1132* 1128*
1133* @param cls our attribute store handle 1129* @param cls our attribute store handle
1134* @param zone zone we are iterating 1130* @param zone zone we are iterating
@@ -1146,58 +1142,30 @@ attest_add_cb (void *cls,
1146 struct AttributeStoreHandle *ash = cls; 1142 struct AttributeStoreHandle *ash = cls;
1147 char *buf; 1143 char *buf;
1148 size_t buf_size; 1144 size_t buf_size;
1149 buf_size = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (ash->attest); 1145 buf_size = GNUNET_RECLAIM_attestation_serialize_get_size (ash->attest);
1150 buf = GNUNET_malloc (buf_size); 1146 buf = GNUNET_malloc (buf_size);
1151 GNUNET_RECLAIM_ATTESTATION_serialize (ash->attest, buf); 1147 GNUNET_RECLAIM_attestation_serialize (ash->attest, buf);
1152 if (0 == rd_count ) 1148 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1153 { 1149 "Storing new Attestation\n");
1154 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1150 struct GNUNET_GNSRECORD_Data rd_new[1];
1155 "Storing new Attestation\n");
1156 struct GNUNET_GNSRECORD_Data rd_new[1];
1157 rd_new[0].data_size = buf_size;
1158 rd_new[0].data = buf;
1159 rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR;
1160 rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1161 rd_new[0].expiration_time = ash->exp.rel_value_us;
1162 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
1163 ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1164 &ash->identity,
1165 label,
1166 1,
1167 rd_new,
1168 &attest_store_cont,
1169 ash);
1170 GNUNET_free (buf);
1171 return;
1172 }
1173 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[0].record_type)
1174 {
1175 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1176 "Existing Attestation location is not an Attestation\n");
1177 send_ref_error (ash);
1178 return;
1179 }
1180 struct GNUNET_GNSRECORD_Data rd_new[rd_count];
1181 for (int i = 0; i<rd_count; i++)
1182 {
1183 rd_new[i] = rd[i];
1184 }
1185 rd_new[0].data_size = buf_size; 1151 rd_new[0].data_size = buf_size;
1186 rd_new[0].data = buf; 1152 rd_new[0].data = buf;
1187 rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR; 1153 rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION;
1188 rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 1154 rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1189 rd_new[0].expiration_time = ash->exp.rel_value_us; 1155 rd_new[0].expiration_time = ash->exp.rel_value_us;
1190 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label); 1156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
1191 ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh, 1157 ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1192 &ash->identity, 1158 &ash->identity,
1193 label, 1159 label,
1194 rd_count, 1160 1,
1195 rd_new, 1161 rd_new,
1196 &attest_store_cont, 1162 &attest_store_cont,
1197 ash); 1163 ash);
1198 GNUNET_free (buf); 1164 GNUNET_free (buf);
1165 return;
1199} 1166}
1200 1167
1168
1201/** 1169/**
1202 * Add a new attestation 1170 * Add a new attestation
1203 * 1171 *
@@ -1210,11 +1178,10 @@ attest_store_task (void *cls)
1210 char *label; 1178 char *label;
1211 1179
1212 // Give the ash a new id if unset 1180 // Give the ash a new id if unset
1213 if (0 == ash->attest->id) 1181 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->attest->id))
1214 ash->attest->id 1182 GNUNET_RECLAIM_id_generate (&ash->attest->id);
1215 = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
1216 label = GNUNET_STRINGS_data_to_string_alloc (&ash->attest->id, 1183 label = GNUNET_STRINGS_data_to_string_alloc (&ash->attest->id,
1217 sizeof(uint64_t)); 1184 sizeof (ash->attest->id));
1218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1185 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1219 "Looking up existing data under label %s\n", label); 1186 "Looking up existing data under label %s\n", label);
1220// Test for the content of the existing ID 1187// Test for the content of the existing ID
@@ -1228,6 +1195,7 @@ attest_store_task (void *cls)
1228 GNUNET_free (label); 1195 GNUNET_free (label);
1229} 1196}
1230 1197
1198
1231/** 1199/**
1232 * Check an attestation store message 1200 * Check an attestation store message
1233 * 1201 *
@@ -1249,6 +1217,7 @@ check_attestation_store_message (void *cls,
1249 return GNUNET_OK; 1217 return GNUNET_OK;
1250} 1218}
1251 1219
1220
1252/** 1221/**
1253* Handle an attestation store message 1222* Handle an attestation store message
1254* 1223*
@@ -1268,7 +1237,7 @@ handle_attestation_store_message (void *cls,
1268 data_len = ntohs (sam->attr_len); 1237 data_len = ntohs (sam->attr_len);
1269 1238
1270 ash = GNUNET_new (struct AttributeStoreHandle); 1239 ash = GNUNET_new (struct AttributeStoreHandle);
1271 ash->attest = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &sam[1], 1240 ash->attest = GNUNET_RECLAIM_attestation_deserialize ((char *) &sam[1],
1272 data_len); 1241 data_len);
1273 1242
1274 ash->r_id = ntohl (sam->id); 1243 ash->r_id = ntohl (sam->id);
@@ -1282,246 +1251,8 @@ handle_attestation_store_message (void *cls,
1282 GNUNET_SCHEDULER_add_now (&attest_store_task, ash); 1251 GNUNET_SCHEDULER_add_now (&attest_store_task, ash);
1283} 1252}
1284 1253
1285/**
1286 * Error looking up potential reference value. Abort.
1287 *
1288 * @param cls our attribute store handle
1289 */
1290static void
1291ref_error (void *cls)
1292{
1293 struct AttributeStoreHandle *ash = cls;
1294 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1295 "Failed to find Attestation entry for Attestation reference\n");
1296 cleanup_as_handle (ash);
1297 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1298 return;
1299}
1300
1301/**
1302 * Error looking up potential reference value. Abort.
1303 *
1304 * @param cls our attribute delete handle
1305 */
1306static void
1307ref_del_error (void *cls)
1308{
1309 struct AttributeDeleteHandle *adh = cls;
1310 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1311 "Failed to find Attestation entry for Attestation reference\n");
1312 cleanup_adh (adh);
1313 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1314 return;
1315}
1316/**
1317* Reference store result handler
1318*
1319* @param cls our attribute store handle
1320* @param success GNUNET_OK if successful
1321* @param emsg error message (NULL if success=GNUNET_OK)
1322*/
1323static void
1324reference_store_cont (void *cls, int32_t success, const char *emsg)
1325{
1326 struct AttributeStoreHandle *ash = cls;
1327 struct GNUNET_MQ_Envelope *env;
1328 struct SuccessResultMessage *acr_msg;
1329
1330 ash->ns_qe = NULL;
1331 GNUNET_CONTAINER_DLL_remove (ash->client->store_op_head,
1332 ash->client->store_op_tail,
1333 ash);
1334
1335 if (GNUNET_SYSERR == success)
1336 {
1337 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1338 "Failed to store reference %s\n",
1339 emsg);
1340 cleanup_as_handle (ash);
1341 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1342 return;
1343 }
1344
1345 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1346 env = GNUNET_MQ_msg (acr_msg, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE);
1347 acr_msg->id = htonl (ash->r_id);
1348 acr_msg->op_result = htonl (GNUNET_OK);
1349 GNUNET_MQ_send (ash->client->mq, env);
1350 cleanup_as_handle (ash);
1351}
1352
1353 1254
1354/** 1255/**
1355* Check for existing record before storing reference
1356*
1357* @param cls our attribute store handle
1358* @param zone zone we are iterating
1359* @param label label of the records
1360* @param rd_count record count
1361* @param rd records
1362*/
1363static void
1364ref_add_cb (void *cls,
1365 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1366 const char *label,
1367 unsigned int rd_count,
1368 const struct GNUNET_GNSRECORD_Data *rd)
1369{
1370 struct AttributeStoreHandle *ash = cls;
1371 char *buf;
1372 size_t buf_size;
1373 buf_size = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (ash->reference);
1374 buf = GNUNET_malloc (buf_size);
1375 GNUNET_RECLAIM_ATTESTATION_REF_serialize (ash->reference, buf);
1376 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref;
1377 char *data_tmp;
1378 if (0 == rd_count )
1379 {
1380 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1381 "Failed to find Attestation entry for Attestation reference\n");
1382 send_ref_error (ash);
1383 return;
1384 }
1385 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[0].record_type)
1386 {
1387 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1388 "Intended Reference storage location is not an attestation\n");
1389 send_ref_error (ash);
1390 return;
1391 }
1392 struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
1393 int i;
1394 for (i = 0; i<rd_count; i++)
1395 {
1396 data_tmp = GNUNET_malloc (rd[i].data_size);
1397 GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
1398 ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize (data_tmp, htons (
1399 rd[i].data_size));
1400 rd_new[i] = rd[i];
1401 if ((strcmp (ash->reference->name,ref->name) == 0)&&
1402 (strcmp (ash->reference->reference_value,ref->reference_value)==0) )
1403 {
1404 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1405 "Reference already stored\n");
1406 reference_store_cont (ash,GNUNET_OK, NULL);
1407 return;
1408 }
1409 }
1410 rd_new[rd_count].data_size = buf_size;
1411 rd_new[rd_count].data = buf;
1412 rd_new[rd_count].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE;
1413 rd_new[rd_count].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1414 rd_new[rd_count].expiration_time = ash->exp.rel_value_us;
1415 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
1416 ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1417 &ash->identity,
1418 label,
1419 rd_count + 1,
1420 rd_new,
1421 &reference_store_cont,
1422 ash);
1423 GNUNET_free (buf);
1424}
1425
1426/**
1427 * Add a new reference
1428 *
1429 * @param cls the AttributeStoreHandle
1430 */
1431static void
1432reference_store_task (void *cls)
1433{
1434 struct AttributeStoreHandle *ash = cls;
1435 char *label;
1436
1437 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing reference\n");
1438
1439 // Give the ash a new id if unset
1440 if (0 == ash->reference->id)
1441 {
1442 if (0 == ash->reference->id_attest)
1443 {
1444 ash->reference->id = GNUNET_CRYPTO_random_u64 (
1445 GNUNET_CRYPTO_QUALITY_STRONG,
1446 UINT64_MAX);
1447 }
1448 else
1449 {
1450 ash->reference->id = ash->reference->id_attest;
1451 }
1452 }
1453
1454 label = GNUNET_STRINGS_data_to_string_alloc (&ash->reference->id,
1455 sizeof(uint64_t));
1456 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1457 "Looking up existing data under label %s\n", label);
1458// Test for the content of the existing ID
1459
1460 ash->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
1461 &ash->identity,
1462 label,
1463 &ref_error,
1464 ash,
1465 &ref_add_cb,
1466 ash);
1467 GNUNET_free (label);
1468}
1469
1470/**
1471 * Check an attestation reference store message
1472 *
1473 * @param cls unused
1474 * @param sam the message to check
1475 */
1476static int
1477check_reference_store_message (void *cls,
1478 const struct
1479 AttributeStoreMessage *sam)
1480{
1481 uint16_t size;
1482
1483 size = ntohs (sam->header.size);
1484 if (size <= sizeof(struct AttributeStoreMessage))
1485 {
1486 GNUNET_break (0);
1487 return GNUNET_SYSERR;
1488 }
1489 return GNUNET_OK;
1490}
1491
1492
1493/**
1494 * Handle an attestation reference store message
1495 *
1496 * @param cls our client
1497 * @param sam the message to handle
1498 */
1499static void
1500handle_reference_store_message (void *cls,
1501 const struct AttributeStoreMessage *sam)
1502{
1503 struct AttributeStoreHandle *ash;
1504 struct IdpClient *idp = cls;
1505 size_t data_len;
1506
1507 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REFERENCE_STORE message\n");
1508
1509 data_len = ntohs (sam->attr_len);
1510 ash = GNUNET_new (struct AttributeStoreHandle);
1511 ash->reference = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &sam[1],
1512 data_len);
1513 ash->r_id = ntohl (sam->id);
1514 ash->identity = sam->identity;
1515 ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1516 GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity, &ash->identity_pkey);
1517
1518
1519 GNUNET_SERVICE_client_continue (idp->client);
1520 ash->client = idp;
1521 GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash);
1522 GNUNET_SCHEDULER_add_now (&reference_store_task, ash);
1523}
1524/**
1525 * Send a deletion success response 1256 * Send a deletion success response
1526 * 1257 *
1527 * @param adh our attribute deletion handle 1258 * @param adh our attribute deletion handle
@@ -1567,19 +1298,18 @@ ticket_iter (void *cls,
1567 int has_changed = GNUNET_NO; 1298 int has_changed = GNUNET_NO;
1568 for (int i = 0; i < rd_count; i++) 1299 for (int i = 0; i < rd_count; i++)
1569 { 1300 {
1570 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) 1301 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
1571 continue; 1302 continue;
1572 if (adh->claim != NULL) 1303 if (adh->claim != NULL)
1573 if (0 != memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t))) 1304 if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data,
1305 &adh->claim->id))
1574 continue; 1306 continue;
1575 if (adh->attest != NULL) 1307 if (adh->attest != NULL)
1576 if (0 != memcmp (rd[i].data, &adh->attest->id, sizeof(uint64_t))) 1308 if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data,
1577 continue; 1309 &adh->attest->id))
1578 if (adh->reference != NULL)
1579 if (0 != memcmp (rd[i].data, &adh->reference->id, sizeof(uint64_t)))
1580 continue; 1310 continue;
1581 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1311 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1582 "Attribute or Attestation/Reference to delete found (%s)\n", 1312 "Attribute or Attestation to delete found (%s)\n",
1583 adh->label); 1313 adh->label);
1584 has_changed = GNUNET_YES; 1314 has_changed = GNUNET_YES;
1585 break; 1315 break;
@@ -1670,16 +1400,14 @@ update_tickets (void *cls)
1670 for (int i = 0; i < le->rd_count; i++) 1400 for (int i = 0; i < le->rd_count; i++)
1671 { 1401 {
1672 if (adh->claim != NULL) 1402 if (adh->claim != NULL)
1673 if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) 1403 if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
1674 && (0 == memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t)))) 1404 && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
1405 &adh->claim->id)))
1675 continue; 1406 continue;
1676 if (adh->attest != NULL) 1407 if (adh->attest != NULL)
1677 if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) 1408 if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
1678 && (0 == memcmp (rd[i].data, &adh->attest->id, sizeof(uint64_t)))) 1409 && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
1679 continue; 1410 &adh->attest->id)))
1680 if (adh->reference != NULL)
1681 if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type)
1682 && (0 == memcmp (rd[i].data, &adh->reference->id, sizeof(uint64_t))))
1683 continue; 1411 continue;
1684 rd_new[j] = rd[i]; 1412 rd_new[j] = rd[i];
1685 j++; 1413 j++;
@@ -1820,15 +1548,15 @@ handle_attribute_delete_message (void *cls,
1820 data_len = ntohs (dam->attr_len); 1548 data_len = ntohs (dam->attr_len);
1821 1549
1822 adh = GNUNET_new (struct AttributeDeleteHandle); 1550 adh = GNUNET_new (struct AttributeDeleteHandle);
1823 adh->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char *) &dam[1], 1551 adh->claim = GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1],
1824 data_len); 1552 data_len);
1825 adh->reference = NULL;
1826 adh->attest = NULL; 1553 adh->attest = NULL;
1827 1554
1828 adh->r_id = ntohl (dam->id); 1555 adh->r_id = ntohl (dam->id);
1829 adh->identity = dam->identity; 1556 adh->identity = dam->identity;
1830 adh->label 1557 adh->label
1831 = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id, sizeof(uint64_t)); 1558 = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id,
1559 sizeof(adh->claim->id));
1832 GNUNET_SERVICE_client_continue (idp->client); 1560 GNUNET_SERVICE_client_continue (idp->client);
1833 adh->client = idp; 1561 adh->client = idp;
1834 GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); 1562 GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh);
@@ -1841,6 +1569,7 @@ handle_attribute_delete_message (void *cls,
1841 adh); 1569 adh);
1842} 1570}
1843 1571
1572
1844/** 1573/**
1845 * Attestation deleted callback 1574 * Attestation deleted callback
1846 * 1575 *
@@ -1867,6 +1596,7 @@ attest_delete_cont (void *cls, int32_t success, const char *emsg)
1867 GNUNET_SCHEDULER_add_now (&start_ticket_update, adh); 1596 GNUNET_SCHEDULER_add_now (&start_ticket_update, adh);
1868} 1597}
1869 1598
1599
1870/** 1600/**
1871 * Check attestation delete message format 1601 * Check attestation delete message format
1872 * 1602 *
@@ -1908,15 +1638,15 @@ handle_attestation_delete_message (void *cls,
1908 data_len = ntohs (dam->attr_len); 1638 data_len = ntohs (dam->attr_len);
1909 1639
1910 adh = GNUNET_new (struct AttributeDeleteHandle); 1640 adh = GNUNET_new (struct AttributeDeleteHandle);
1911 adh->attest = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &dam[1], 1641 adh->attest = GNUNET_RECLAIM_attestation_deserialize ((char *) &dam[1],
1912 data_len); 1642 data_len);
1913 adh->reference = NULL;
1914 adh->claim = NULL; 1643 adh->claim = NULL;
1915 1644
1916 adh->r_id = ntohl (dam->id); 1645 adh->r_id = ntohl (dam->id);
1917 adh->identity = dam->identity; 1646 adh->identity = dam->identity;
1918 adh->label 1647 adh->label
1919 = GNUNET_STRINGS_data_to_string_alloc (&adh->attest->id, sizeof(uint64_t)); 1648 = GNUNET_STRINGS_data_to_string_alloc (&adh->attest->id,
1649 sizeof(adh->attest->id));
1920 GNUNET_SERVICE_client_continue (idp->client); 1650 GNUNET_SERVICE_client_continue (idp->client);
1921 adh->client = idp; 1651 adh->client = idp;
1922 GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); 1652 GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh);
@@ -1930,214 +1660,236 @@ handle_attestation_delete_message (void *cls,
1930} 1660}
1931 1661
1932 1662
1663/*************************************************
1664* Attrubute iteration
1665*************************************************/
1666
1933 1667
1934/** 1668/**
1935* Reference deleted callback 1669 * Done iterating over attributes
1936* 1670 *
1937* @param cls our handle 1671 * @param cls our iterator handle
1938* @param success success status 1672 */
1939* @param emsg error message (NULL if success=GNUNET_OK)
1940*/
1941static void 1673static void
1942reference_delete_cont (void *cls, int32_t success, const char *emsg) 1674attr_iter_finished (void *cls)
1943{ 1675{
1944 struct AttributeDeleteHandle *adh = cls; 1676 struct Iterator *ai = cls;
1677 struct GNUNET_MQ_Envelope *env;
1678 struct AttributeResultMessage *arm;
1945 1679
1946 adh->ns_qe = NULL; 1680 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
1947 if (GNUNET_SYSERR == success) 1681 env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
1948 { 1682 arm->id = htonl (ai->request_id);
1949 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1683 arm->attr_len = htons (0);
1950 "Error deleting reference %s\n", 1684 GNUNET_MQ_send (ai->client->mq, env);
1951 adh->label); 1685 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
1952 send_delete_response (adh, GNUNET_SYSERR); 1686 ai->client->attr_iter_tail,
1953 cleanup_adh (adh); 1687 ai);
1954 return; 1688 GNUNET_free (ai);
1955 }
1956 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1957 //GNUNET_SCHEDULER_add_now (&start_ticket_update, adh);
1958 send_delete_response (adh, GNUNET_OK);
1959 cleanup_adh (adh);
1960 return;
1961} 1689}
1962 1690
1691
1692/**
1693 * Error iterating over attributes. Abort.
1694 *
1695 * @param cls our attribute iteration handle
1696 */
1963static void 1697static void
1964ref_del_cb (void *cls, 1698attr_iter_error (void *cls)
1965 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1966 const char *label,
1967 unsigned int rd_count,
1968 const struct GNUNET_GNSRECORD_Data *rd)
1969{ 1699{
1700 struct Iterator *ai = cls;
1970 1701
1971 struct AttributeDeleteHandle *adh = cls; 1702 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1703 attr_iter_finished (ai);
1704}
1705
1706
1707/**
1708 * Got record. Return if it is an attribute or attestation.
1709 *
1710 * @param cls our attribute iterator
1711 * @param zone zone we are iterating
1712 * @param label label of the records
1713 * @param rd_count record count
1714 * @param rd records
1715 */
1716static void
1717attr_iter_cb (void *cls,
1718 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1719 const char *label,
1720 unsigned int rd_count,
1721 const struct GNUNET_GNSRECORD_Data *rd)
1722{
1723 struct Iterator *ai = cls;
1724 struct GNUNET_MQ_Envelope *env;
1972 char *data_tmp; 1725 char *data_tmp;
1973 struct GNUNET_GNSRECORD_Data rd_new[rd_count - 1];
1974 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref;
1975 size_t attr_len;
1976 1726
1977 if (0 == rd_count ) 1727 if ((rd_count != 1) ||
1978 { 1728 (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd->record_type))
1979 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1980 "Failed to find Attestation entry for Attestation reference\n");
1981 cleanup_adh (adh);
1982 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1983 return;
1984 }
1985 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[0].record_type)
1986 { 1729 {
1987 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1730 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
1988 "Intended Reference location is not an attestation\n");
1989 cleanup_adh (adh);
1990 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1991 return; 1731 return;
1992 } 1732 }
1993 rd_new[0] = rd[0]; 1733 struct AttributeResultMessage *arm;
1994 int i; 1734 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
1995 int j = 1; 1735 label);
1996 for (i = 1; i<rd_count; i++) 1736 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1997 { 1737 "Sending ATTRIBUTE_RESULT message\n");
1998 data_tmp = GNUNET_malloc (rd[i].data_size); 1738 env = GNUNET_MQ_msg_extra (arm,
1999 GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size); 1739 rd->data_size,
2000 attr_len = htons (rd[i].data_size); 1740 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
2001 ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize (data_tmp, attr_len); 1741 arm->id = htonl (ai->request_id);
2002 if (NULL == ref ) 1742 arm->attr_len = htons (rd->data_size);
2003 { 1743 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
2004 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1744 data_tmp = (char *) &arm[1];
2005 "Unable to parse attestation reference from %s\n", 1745 GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
2006 data_tmp); 1746 GNUNET_MQ_send (ai->client->mq, env);
2007 rd_new[j] = rd[i];
2008 j += 1;
2009 continue;
2010 }
2011 if ((strcmp (adh->reference->name,ref->name) == 0)&&
2012 (strcmp (adh->reference->reference_value,ref->reference_value)==0) )
2013 {
2014 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2015 "Found reference to delete.\n");
2016 }
2017 else
2018 {
2019 rd_new[j] = rd[i];
2020 j += 1;
2021 }
2022 GNUNET_free (data_tmp);
2023 }
2024 adh->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
2025 &adh->identity,
2026 label,
2027 j,
2028 rd_new,
2029 &reference_delete_cont,
2030 adh);
2031} 1747}
2032 1748
1749
2033/** 1750/**
2034 * Check an attestation reference delete message 1751 * Iterate over zone to get attributes
2035 * 1752 *
2036 * @param cls unused 1753 * @param cls our client
2037 * @param sam the message to check 1754 * @param ais_msg the iteration message to start
2038 */ 1755 */
2039static int 1756static void
2040check_reference_delete_message (void *cls, 1757handle_iteration_start (void *cls,
2041 const struct AttributeDeleteMessage *dam) 1758 const struct AttributeIterationStartMessage *ais_msg)
2042{ 1759{
2043 uint16_t size; 1760 struct IdpClient *idp = cls;
1761 struct Iterator *ai;
2044 1762
2045 size = ntohs (dam->header.size); 1763 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2046 if (size <= sizeof(struct AttributeDeleteMessage)) 1764 "Received ATTRIBUTE_ITERATION_START message\n");
1765 ai = GNUNET_new (struct Iterator);
1766 ai->request_id = ntohl (ais_msg->id);
1767 ai->client = idp;
1768 ai->identity = ais_msg->identity;
1769
1770 GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, idp->attr_iter_tail, ai);
1771 ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh,
1772 &ai->identity,
1773 &attr_iter_error,
1774 ai,
1775 &attr_iter_cb,
1776 ai,
1777 &attr_iter_finished,
1778 ai);
1779 GNUNET_SERVICE_client_continue (idp->client);
1780}
1781
1782
1783/**
1784 * Handle iteration stop message from client
1785 *
1786 * @param cls the client
1787 * @param ais_msg the stop message
1788 */
1789static void
1790handle_iteration_stop (void *cls,
1791 const struct AttributeIterationStopMessage *ais_msg)
1792{
1793 struct IdpClient *idp = cls;
1794 struct Iterator *ai;
1795 uint32_t rid;
1796
1797 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1798 "Received `%s' message\n",
1799 "ATTRIBUTE_ITERATION_STOP");
1800 rid = ntohl (ais_msg->id);
1801 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1802 if (ai->request_id == rid)
1803 break;
1804 if (NULL == ai)
2047 { 1805 {
2048 GNUNET_break (0); 1806 GNUNET_break (0);
2049 return GNUNET_SYSERR; 1807 GNUNET_SERVICE_client_drop (idp->client);
1808 return;
2050 } 1809 }
2051 return GNUNET_OK; 1810 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
1811 GNUNET_free (ai);
1812 GNUNET_SERVICE_client_continue (idp->client);
2052} 1813}
2053 1814
1815
2054/** 1816/**
2055 * Handle reference deletion 1817 * Client requests next attribute from iterator
2056 * 1818 *
2057 * @param cls our client 1819 * @param cls the client
2058 * @param dam deletion message 1820 * @param ais_msg the message
2059 */ 1821 */
2060static void 1822static void
2061handle_reference_delete_message (void *cls, 1823handle_iteration_next (void *cls,
2062 const struct AttributeDeleteMessage *dam) 1824 const struct AttributeIterationNextMessage *ais_msg)
2063{ 1825{
2064 struct AttributeDeleteHandle *adh;
2065 struct IdpClient *idp = cls; 1826 struct IdpClient *idp = cls;
2066 size_t data_len; 1827 struct Iterator *ai;
2067 1828 uint32_t rid;
2068 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REFERENCE_DELETE message\n");
2069 data_len = ntohs (dam->attr_len);
2070 adh = GNUNET_new (struct AttributeDeleteHandle);
2071 adh->reference = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &dam[1],
2072 data_len);
2073 adh->attest = NULL;
2074 adh->claim = NULL;
2075 1829
2076 adh->r_id = ntohl (dam->id); 1830 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2077 adh->identity = dam->identity; 1831 "Received ATTRIBUTE_ITERATION_NEXT message\n");
2078 adh->label 1832 rid = ntohl (ais_msg->id);
2079 = GNUNET_STRINGS_data_to_string_alloc (&adh->reference->id, 1833 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
2080 sizeof(uint64_t)); 1834 if (ai->request_id == rid)
1835 break;
1836 if (NULL == ai)
1837 {
1838 GNUNET_break (0);
1839 GNUNET_SERVICE_client_drop (idp->client);
1840 return;
1841 }
1842 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
2081 GNUNET_SERVICE_client_continue (idp->client); 1843 GNUNET_SERVICE_client_continue (idp->client);
2082 adh->client = idp;
2083 GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh);
2084 adh->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
2085 &adh->identity,
2086 adh->label,
2087 &ref_del_error,
2088 adh,
2089 &ref_del_cb,
2090 adh);
2091} 1844}
2092 1845
2093 1846
2094
2095/************************************************* 1847/*************************************************
2096* Attrubute iteration 1848* Attestation iteration
2097*************************************************/ 1849*************************************************/
2098 1850
2099 1851
2100/** 1852/**
2101 * Done iterating over attributes 1853 * Done iterating over attestations
2102 * 1854 *
2103 * @param cls our iterator handle 1855 * @param cls our iterator handle
2104 */ 1856 */
2105static void 1857static void
2106attr_iter_finished (void *cls) 1858attest_iter_finished (void *cls)
2107{ 1859{
2108 struct AttributeIterator *ai = cls; 1860 struct Iterator *ai = cls;
2109 struct GNUNET_MQ_Envelope *env; 1861 struct GNUNET_MQ_Envelope *env;
2110 struct AttributeResultMessage *arm; 1862 struct AttestationResultMessage *arm;
2111 1863
2112 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n"); 1864 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTESTATION_RESULT message\n");
2113 env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); 1865 env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
2114 arm->id = htonl (ai->request_id); 1866 arm->id = htonl (ai->request_id);
2115 arm->attr_len = htons (0); 1867 arm->attestation_len = htons (0);
2116 GNUNET_MQ_send (ai->client->mq, env); 1868 GNUNET_MQ_send (ai->client->mq, env);
2117 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, 1869 GNUNET_CONTAINER_DLL_remove (ai->client->attest_iter_head,
2118 ai->client->attr_iter_tail, 1870 ai->client->attest_iter_tail,
2119 ai); 1871 ai);
2120 GNUNET_free (ai); 1872 GNUNET_free (ai);
2121} 1873}
2122 1874
2123 1875
2124/** 1876/**
2125 * Error iterating over attributes. Abort. 1877 * Error iterating over attestations. Abort.
2126 * 1878 *
2127 * @param cls our attribute iteration handle 1879 * @param cls our attribute iteration handle
2128 */ 1880 */
2129static void 1881static void
2130attr_iter_error (void *cls) 1882attest_iter_error (void *cls)
2131{ 1883{
2132 struct AttributeIterator *ai = cls; 1884 struct Iterator *ai = cls;
2133 1885
2134 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n"); 1886 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attestations\n");
2135 attr_iter_finished (ai); 1887 attest_iter_finished (ai);
2136} 1888}
2137 1889
2138 1890
2139/** 1891/**
2140 * Got record. Return if it is an attribute or attestation/reference. 1892 * Got record. Return attestation.
2141 * 1893 *
2142 * @param cls our attribute iterator 1894 * @param cls our attribute iterator
2143 * @param zone zone we are iterating 1895 * @param zone zone we are iterating
@@ -2146,110 +1898,40 @@ attr_iter_error (void *cls)
2146 * @param rd records 1898 * @param rd records
2147 */ 1899 */
2148static void 1900static void
2149attr_iter_cb (void *cls, 1901attest_iter_cb (void *cls,
2150 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1902 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
2151 const char *label, 1903 const char *label,
2152 unsigned int rd_count, 1904 unsigned int rd_count,
2153 const struct GNUNET_GNSRECORD_Data *rd) 1905 const struct GNUNET_GNSRECORD_Data *rd)
2154{ 1906{
2155 struct AttributeIterator *ai = cls; 1907 struct Iterator *ai = cls;
2156 struct GNUNET_MQ_Envelope *env; 1908 struct GNUNET_MQ_Envelope *env;
1909 struct AttestationResultMessage *arm;
2157 char *data_tmp; 1910 char *data_tmp;
2158 1911
2159 if (rd_count == 0) 1912 if ((rd_count != 1) ||
1913 (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION != rd->record_type))
2160 { 1914 {
2161 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); 1915 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
2162 return; 1916 return;
2163 } 1917 }
2164 if (rd_count > 1) 1918 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
2165 { 1919 label);
2166 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[0].record_type) 1920 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2167 { 1921 "Sending ATTESTATION_RESULT message\n");
2168 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1922 env = GNUNET_MQ_msg_extra (arm,
2169 "Found Ticket. Ignoring.\n"); 1923 rd->data_size,
2170 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); 1924 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
2171 return; 1925 arm->id = htonl (ai->request_id);
2172 } 1926 arm->attestation_len = htons (rd->data_size);
2173 else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[0].record_type) 1927 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
2174 { 1928 data_tmp = (char *) &arm[1];
2175 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1929 GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
2176 "Non-Attestation record with multiple entries found: %u\n",
2177 rd[0].record_type);
2178 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
2179 return;
2180 }
2181 }
2182 1930
2183 for (int i = 0; i<rd_count; i++) 1931 GNUNET_MQ_send (ai->client->mq, env);
2184 {
2185 if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd[i].record_type) &&
2186 (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[i].record_type) &&
2187 (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE != rd[i].record_type))
2188 {
2189 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
2190 return;
2191 }
2192
2193 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type )
2194 {
2195 struct AttributeResultMessage *arm;
2196 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
2197 label);
2198 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2199 "Sending ATTRIBUTE_RESULT message\n");
2200 env = GNUNET_MQ_msg_extra (arm,
2201 rd[i].data_size,
2202 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
2203 arm->id = htonl (ai->request_id);
2204 arm->attr_len = htons (rd[i].data_size);
2205 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
2206 data_tmp = (char *) &arm[1];
2207 GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
2208 GNUNET_MQ_send (ai->client->mq, env);
2209 }
2210 else
2211 {
2212 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type )
2213 {
2214 struct AttributeResultMessage *arm;
2215 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
2216 label);
2217 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2218 "Sending ATTESTATION_RESULT message\n");
2219 env = GNUNET_MQ_msg_extra (arm,
2220 rd[i].data_size,
2221 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
2222 arm->id = htonl (ai->request_id);
2223 arm->attr_len = htons (rd[i].data_size);
2224 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
2225 data_tmp = (char *) &arm[1];
2226 GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
2227 GNUNET_MQ_send (ai->client->mq, env);
2228 }
2229 else
2230 {
2231 struct ReferenceResultMessage *rrm;
2232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found reference under: %s\n",
2233 label);
2234 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2235 "Sending REFERENCE_RESULT message\n");
2236 env = GNUNET_MQ_msg_extra (rrm,
2237 rd[i].data_size + rd[0].data_size,
2238 GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT);
2239 rrm->id = htonl (ai->request_id);
2240 rrm->attest_len = htons (rd[0].data_size);
2241 rrm->ref_len = htons (rd[i].data_size);
2242 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &rrm->identity);
2243 data_tmp = (char *) &rrm[1];
2244 GNUNET_memcpy (data_tmp, rd[0].data, rd[0].data_size);
2245 data_tmp += rd[0].data_size;
2246 GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
2247 GNUNET_MQ_send (ai->client->mq, env);
2248 }
2249 }
2250 }
2251} 1932}
2252 1933
1934
2253/** 1935/**
2254 * Iterate over zone to get attributes 1936 * Iterate over zone to get attributes
2255 * 1937 *
@@ -2257,27 +1939,29 @@ attr_iter_cb (void *cls,
2257 * @param ais_msg the iteration message to start 1939 * @param ais_msg the iteration message to start
2258 */ 1940 */
2259static void 1941static void
2260handle_iteration_start (void *cls, 1942handle_attestation_iteration_start (void *cls,
2261 const struct AttributeIterationStartMessage *ais_msg) 1943 const struct
1944 AttestationIterationStartMessage *ais_msg)
2262{ 1945{
2263 struct IdpClient *idp = cls; 1946 struct IdpClient *idp = cls;
2264 struct AttributeIterator *ai; 1947 struct Iterator *ai;
2265 1948
2266 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1949 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2267 "Received ATTRIBUTE_ITERATION_START message\n"); 1950 "Received ATTESTATION_ITERATION_START message\n");
2268 ai = GNUNET_new (struct AttributeIterator); 1951 ai = GNUNET_new (struct Iterator);
2269 ai->request_id = ntohl (ais_msg->id); 1952 ai->request_id = ntohl (ais_msg->id);
2270 ai->client = idp; 1953 ai->client = idp;
2271 ai->identity = ais_msg->identity; 1954 ai->identity = ais_msg->identity;
2272 1955
2273 GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, idp->attr_iter_tail, ai); 1956 GNUNET_CONTAINER_DLL_insert (idp->attest_iter_head, idp->attest_iter_tail,
1957 ai);
2274 ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh, 1958 ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh,
2275 &ai->identity, 1959 &ai->identity,
2276 &attr_iter_error, 1960 &attest_iter_error,
2277 ai, 1961 ai,
2278 &attr_iter_cb, 1962 &attest_iter_cb,
2279 ai, 1963 ai,
2280 &attr_iter_finished, 1964 &attest_iter_finished,
2281 ai); 1965 ai);
2282 GNUNET_SERVICE_client_continue (idp->client); 1966 GNUNET_SERVICE_client_continue (idp->client);
2283} 1967}
@@ -2290,18 +1974,19 @@ handle_iteration_start (void *cls,
2290 * @param ais_msg the stop message 1974 * @param ais_msg the stop message
2291 */ 1975 */
2292static void 1976static void
2293handle_iteration_stop (void *cls, 1977handle_attestation_iteration_stop (void *cls,
2294 const struct AttributeIterationStopMessage *ais_msg) 1978 const struct
1979 AttestationIterationStopMessage *ais_msg)
2295{ 1980{
2296 struct IdpClient *idp = cls; 1981 struct IdpClient *idp = cls;
2297 struct AttributeIterator *ai; 1982 struct Iterator *ai;
2298 uint32_t rid; 1983 uint32_t rid;
2299 1984
2300 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1985 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2301 "Received `%s' message\n", 1986 "Received `%s' message\n",
2302 "ATTRIBUTE_ITERATION_STOP"); 1987 "ATTESTATION_ITERATION_STOP");
2303 rid = ntohl (ais_msg->id); 1988 rid = ntohl (ais_msg->id);
2304 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next) 1989 for (ai = idp->attest_iter_head; NULL != ai; ai = ai->next)
2305 if (ai->request_id == rid) 1990 if (ai->request_id == rid)
2306 break; 1991 break;
2307 if (NULL == ai) 1992 if (NULL == ai)
@@ -2310,30 +1995,32 @@ handle_iteration_stop (void *cls,
2310 GNUNET_SERVICE_client_drop (idp->client); 1995 GNUNET_SERVICE_client_drop (idp->client);
2311 return; 1996 return;
2312 } 1997 }
2313 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai); 1998 GNUNET_CONTAINER_DLL_remove (idp->attest_iter_head, idp->attest_iter_tail,
1999 ai);
2314 GNUNET_free (ai); 2000 GNUNET_free (ai);
2315 GNUNET_SERVICE_client_continue (idp->client); 2001 GNUNET_SERVICE_client_continue (idp->client);
2316} 2002}
2317 2003
2318 2004
2319/** 2005/**
2320 * Client requests next attribute from iterator 2006 * Client requests next attestation from iterator
2321 * 2007 *
2322 * @param cls the client 2008 * @param cls the client
2323 * @param ais_msg the message 2009 * @param ais_msg the message
2324 */ 2010 */
2325static void 2011static void
2326handle_iteration_next (void *cls, 2012handle_attestation_iteration_next (void *cls,
2327 const struct AttributeIterationNextMessage *ais_msg) 2013 const struct
2014 AttestationIterationNextMessage *ais_msg)
2328{ 2015{
2329 struct IdpClient *idp = cls; 2016 struct IdpClient *idp = cls;
2330 struct AttributeIterator *ai; 2017 struct Iterator *ai;
2331 uint32_t rid; 2018 uint32_t rid;
2332 2019
2333 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2020 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2334 "Received ATTRIBUTE_ITERATION_NEXT message\n"); 2021 "Received ATTESTATION_ITERATION_NEXT message\n");
2335 rid = ntohl (ais_msg->id); 2022 rid = ntohl (ais_msg->id);
2336 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next) 2023 for (ai = idp->attest_iter_head; NULL != ai; ai = ai->next)
2337 if (ai->request_id == rid) 2024 if (ai->request_id == rid)
2338 break; 2025 break;
2339 if (NULL == ai) 2026 if (NULL == ai)
@@ -2587,19 +2274,10 @@ GNUNET_SERVICE_MAIN (
2587 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE, 2274 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE,
2588 struct AttributeDeleteMessage, 2275 struct AttributeDeleteMessage,
2589 NULL), 2276 NULL),
2590 GNUNET_MQ_hd_var_size (reference_store_message, 2277 GNUNET_MQ_hd_fixed_size (iteration_start,
2591 GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_STORE, 2278 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
2592 struct AttributeStoreMessage, 2279 struct AttributeIterationStartMessage,
2593 NULL), 2280 NULL),
2594 GNUNET_MQ_hd_var_size (reference_delete_message,
2595 GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_DELETE,
2596 struct AttributeDeleteMessage,
2597 NULL),
2598 GNUNET_MQ_hd_fixed_size (
2599 iteration_start,
2600 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
2601 struct AttributeIterationStartMessage,
2602 NULL),
2603 GNUNET_MQ_hd_fixed_size (iteration_next, 2281 GNUNET_MQ_hd_fixed_size (iteration_next,
2604 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, 2282 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT,
2605 struct AttributeIterationNextMessage, 2283 struct AttributeIterationNextMessage,
@@ -2608,6 +2286,19 @@ GNUNET_SERVICE_MAIN (
2608 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, 2286 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
2609 struct AttributeIterationStopMessage, 2287 struct AttributeIterationStopMessage,
2610 NULL), 2288 NULL),
2289 GNUNET_MQ_hd_fixed_size (attestation_iteration_start,
2290 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START,
2291 struct AttestationIterationStartMessage,
2292 NULL),
2293 GNUNET_MQ_hd_fixed_size (attestation_iteration_next,
2294 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT,
2295 struct AttestationIterationNextMessage,
2296 NULL),
2297 GNUNET_MQ_hd_fixed_size (attestation_iteration_stop,
2298 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP,
2299 struct AttestationIterationStopMessage,
2300 NULL),
2301
2611 GNUNET_MQ_hd_var_size (issue_ticket_message, 2302 GNUNET_MQ_hd_var_size (issue_ticket_message,
2612 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, 2303 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
2613 struct IssueTicketMessage, 2304 struct IssueTicketMessage,
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c
index b022225b8..205886c78 100644
--- a/src/reclaim/gnunet-service-reclaim_tickets.c
+++ b/src/reclaim/gnunet-service-reclaim_tickets.c
@@ -59,7 +59,7 @@ struct TicketReference
59 /** 59 /**
60 * Attributes 60 * Attributes
61 */ 61 */
62 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; 62 struct GNUNET_RECLAIM_AttributeList *attrs;
63 63
64 /** 64 /**
65 * Tickets 65 * Tickets
@@ -111,7 +111,12 @@ struct RECLAIM_TICKETS_ConsumeHandle
111 /** 111 /**
112 * Attributes 112 * Attributes
113 */ 113 */
114 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; 114 struct GNUNET_RECLAIM_AttributeList *attrs;
115
116 /**
117 * Attestations
118 */
119 struct GNUNET_RECLAIM_AttestationList *attests;
115 120
116 /** 121 /**
117 * Lookup time 122 * Lookup time
@@ -165,7 +170,7 @@ struct TicketIssueHandle
165 /** 170 /**
166 * Attributes to issue 171 * Attributes to issue
167 */ 172 */
168 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; 173 struct GNUNET_RECLAIM_AttributeList *attrs;
169 174
170 /** 175 /**
171 * Issuer Key 176 * Issuer Key
@@ -236,12 +241,12 @@ struct RevokedAttributeEntry
236 /** 241 /**
237 * Old ID of the attribute 242 * Old ID of the attribute
238 */ 243 */
239 uint64_t old_id; 244 struct GNUNET_RECLAIM_Identifier old_id;
240 245
241 /** 246 /**
242 * New ID of the attribute 247 * New ID of the attribute
243 */ 248 */
244 uint64_t new_id; 249 struct GNUNET_RECLAIM_Identifier new_id;
245}; 250};
246 251
247 252
@@ -431,11 +436,11 @@ process_tickets (void *cls)
431 } 436 }
432 for (int i = 0; i < le->rd_count; i++) 437 for (int i = 0; i < le->rd_count; i++)
433 { 438 {
434 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) 439 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
435 continue; 440 continue;
436 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next) 441 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
437 { 442 {
438 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(uint64_t))) 443 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
439 continue; 444 continue;
440 rd[i].data = &ae->new_id; 445 rd[i].data = &ae->new_id;
441 } 446 }
@@ -493,11 +498,11 @@ rvk_ticket_update (void *cls,
493 /** Let everything point to the old record **/ 498 /** Let everything point to the old record **/
494 for (int i = 0; i < rd_count; i++) 499 for (int i = 0; i < rd_count; i++)
495 { 500 {
496 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) 501 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
497 continue; 502 continue;
498 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next) 503 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
499 { 504 {
500 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(uint64_t))) 505 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
501 continue; 506 continue;
502 has_changed = GNUNET_YES; 507 has_changed = GNUNET_YES;
503 break; 508 break;
@@ -532,9 +537,6 @@ rvk_ns_iter_err (void *cls)
532 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; 537 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
533 538
534 rvk->ns_it = NULL; 539 rvk->ns_it = NULL;
535 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
536 "Namestore error on revocation (id=%" PRIu64 "\n",
537 rvk->move_attr->old_id);
538 rvk->cb (rvk->cb_cls, GNUNET_SYSERR); 540 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
539 cleanup_rvk (rvk); 541 cleanup_rvk (rvk);
540} 542}
@@ -551,9 +553,6 @@ rvk_ns_err (void *cls)
551 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; 553 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
552 554
553 rvk->ns_qe = NULL; 555 rvk->ns_qe = NULL;
554 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
555 "Namestore error on revocation (id=%" PRIu64 "\n",
556 rvk->move_attr->old_id);
557 rvk->cb (rvk->cb_cls, GNUNET_SYSERR); 556 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
558 cleanup_rvk (rvk); 557 cleanup_rvk (rvk);
559} 558}
@@ -636,7 +635,7 @@ move_attr_finished (void *cls, int32_t success, const char *emsg)
636 return; 635 return;
637 } 636 }
638 label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id, 637 label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
639 sizeof(uint64_t)); 638 sizeof(rvk->move_attr->old_id));
640 GNUNET_assert (NULL != label); 639 GNUNET_assert (NULL != label);
641 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label); 640 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label);
642 rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, 641 rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
@@ -685,81 +684,69 @@ rvk_move_attr_cb (void *cls,
685 GNUNET_SCHEDULER_add_now (&move_attrs_cont, rvk); 684 GNUNET_SCHEDULER_add_now (&move_attrs_cont, rvk);
686 return; 685 return;
687 } 686 }
688 rvk->move_attr->new_id =GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); 687 GNUNET_RECLAIM_id_generate (&rvk->move_attr->new_id);
689 new_label=NULL; 688 new_label = NULL;
690 attr_data=NULL; 689 attr_data = NULL;
691 //new_rd = *rd; 690 // new_rd = *rd;
692 for (int i = 0; i < rd_count; i++) 691 for (int i = 0; i < rd_count; i++)
693 { 692 {
694 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type) 693 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE == rd[i].record_type)
695 { 694 {
696 /** find a new place for this attribute **/ 695 /** find a new place for this attribute **/
697 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim; 696 struct GNUNET_RECLAIM_Attribute *claim;
698 claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd[i].data, rd[i].data_size); 697 claim = GNUNET_RECLAIM_attribute_deserialize (rd[i].data,
698 rd[i].data_size);
699 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 699 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
700 "Attribute to update: Name=%s, ID=%" PRIu64 "\n", 700 "Attribute to update: Name=%s\n",
701 claim->name, 701 claim->name);
702 claim->id);
703 claim->id = rvk->move_attr->new_id; 702 claim->id = rvk->move_attr->new_id;
704 new_rd[i].data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (claim); 703 new_rd[i].data_size = GNUNET_RECLAIM_attribute_serialize_get_size (claim);
705 attr_data = GNUNET_malloc (rd[i].data_size); 704 attr_data = GNUNET_malloc (rd[i].data_size);
706 new_rd[i].data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize (claim, attr_data); 705 new_rd[i].data_size = GNUNET_RECLAIM_attribute_serialize (claim,
706 attr_data);
707 new_rd[i].data = attr_data; 707 new_rd[i].data = attr_data;
708 new_rd[i].record_type = rd[i].record_type; 708 new_rd[i].record_type = rd[i].record_type;
709 new_rd[i].flags = rd[i].flags; 709 new_rd[i].flags = rd[i].flags;
710 new_rd[i].expiration_time = rd[i].expiration_time; 710 new_rd[i].expiration_time = rd[i].expiration_time;
711 new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, 711 new_label =
712 sizeof(uint64_t)); 712 GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id,
713 sizeof (rvk->move_attr->new_id));
713 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label); 714 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
714 GNUNET_free (claim); 715 GNUNET_free (claim);
715 } else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type) 716 }
717 else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION == rd[i].record_type)
716 { 718 {
717 struct GNUNET_RECLAIM_ATTESTATION_Claim *attest; 719 struct GNUNET_RECLAIM_Attestation *attest;
718 attest=GNUNET_RECLAIM_ATTESTATION_deserialize(rd[i].data, rd[i].data_size); 720 attest = GNUNET_RECLAIM_attestation_deserialize (rd[i].data,
721 rd[i].data_size);
719 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 722 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
720 "Attestation to update: Name=%s, ID=%" PRIu64 "\n", 723 "Attestation to update: Name=%s\n",
721 attest->name, 724 attest->name);
722 attest->id);
723 attest->id = rvk->move_attr->new_id; 725 attest->id = rvk->move_attr->new_id;
724 new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (attest); 726 new_rd[i].data_size =
727 GNUNET_RECLAIM_attestation_serialize_get_size (attest);
725 attr_data = GNUNET_malloc (rd[i].data_size); 728 attr_data = GNUNET_malloc (rd[i].data_size);
726 new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_serialize (attest, attr_data); 729 new_rd[i].data_size = GNUNET_RECLAIM_attestation_serialize (attest,
730 attr_data);
727 new_rd[i].data = attr_data; 731 new_rd[i].data = attr_data;
728 new_rd[i].record_type = rd[i].record_type; 732 new_rd[i].record_type = rd[i].record_type;
729 new_rd[i].flags = rd[i].flags; 733 new_rd[i].flags = rd[i].flags;
730 new_rd[i].expiration_time = rd[i].expiration_time; 734 new_rd[i].expiration_time = rd[i].expiration_time;
731 new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, sizeof(uint64_t)); 735 new_label =
732 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation %s\n", new_label); 736 GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id,
737 sizeof (rvk->move_attr->new_id));
738 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation %s\n",
739 new_label);
733 GNUNET_free (attest); 740 GNUNET_free (attest);
734 } else if (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE == rd[i].record_type)
735 {
736 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference;
737 reference=GNUNET_RECLAIM_ATTESTATION_REF_deserialize(rd[i].data, rd[i].data_size);
738 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
739 "Reference to update: Name=%s, ID=%" PRIu64 "\n",
740 reference->name,
741 reference->id);
742 reference->id = rvk->move_attr->new_id;
743 reference->id_attest = rvk->move_attr->new_id;
744 new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (reference);
745 attr_data = GNUNET_malloc (rd[i].data_size);
746 new_rd[i].data_size = GNUNET_RECLAIM_ATTESTATION_REF_serialize (reference, attr_data);
747 new_rd[i].data = attr_data;
748 new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, sizeof(uint64_t));
749 new_rd[i].record_type = rd[i].record_type;
750 new_rd[i].flags = rd[i].flags;
751 new_rd[i].expiration_time = rd[i].expiration_time;
752 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference %s\n", new_label);
753 GNUNET_free (reference);
754 } 741 }
755 } 742 }
756 rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, 743 rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
757 &rvk->identity, 744 &rvk->identity,
758 new_label, 745 new_label,
759 rd_count, 746 rd_count,
760 new_rd, 747 new_rd,
761 &move_attr_finished, 748 &move_attr_finished,
762 rvk); 749 rvk);
763 GNUNET_free (new_label); 750 GNUNET_free (new_label);
764 GNUNET_free (attr_data); 751 GNUNET_free (attr_data);
765} 752}
@@ -793,7 +780,7 @@ move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rvk)
793 return; 780 return;
794 } 781 }
795 label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id, 782 label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
796 sizeof(uint64_t)); 783 sizeof (rvk->move_attr->old_id));
797 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving claim %s\n", label); 784 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving claim %s\n", label);
798 785
799 rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, 786 rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
@@ -873,10 +860,10 @@ revoke_attrs_cb (void *cls,
873 */ 860 */
874 for (int i = 0; i < rd_count; i++) 861 for (int i = 0; i < rd_count; i++)
875 { 862 {
876 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) 863 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
877 continue; 864 continue;
878 le = GNUNET_new (struct RevokedAttributeEntry); 865 le = GNUNET_new (struct RevokedAttributeEntry);
879 le->old_id = *((uint64_t *) rd[i].data); 866 le->old_id = *((struct GNUNET_RECLAIM_Identifier *) rd[i].data);
880 GNUNET_CONTAINER_DLL_insert (rvk->attrs_head, rvk->attrs_tail, le); 867 GNUNET_CONTAINER_DLL_insert (rvk->attrs_head, rvk->attrs_tail, le);
881 rvk->ticket_attrs++; 868 rvk->ticket_attrs++;
882 } 869 }
@@ -934,7 +921,8 @@ RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket,
934 rvk->ticket = *ticket; 921 rvk->ticket = *ticket;
935 GNUNET_CRYPTO_ecdsa_key_get_public (&rvk->identity, &rvk->ticket.identity); 922 GNUNET_CRYPTO_ecdsa_key_get_public (&rvk->identity, &rvk->ticket.identity);
936 /** Get shared attributes **/ 923 /** Get shared attributes **/
937 label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t)); 924 label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
925 sizeof(ticket->rnd));
938 GNUNET_assert (NULL != label); 926 GNUNET_assert (NULL != label);
939 rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, 927 rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
940 identity, 928 identity,
@@ -991,7 +979,9 @@ cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth)
991 } 979 }
992 980
993 if (NULL != cth->attrs) 981 if (NULL != cth->attrs)
994 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (cth->attrs); 982 GNUNET_RECLAIM_attribute_list_destroy (cth->attrs);
983 if (NULL != cth->attests)
984 GNUNET_RECLAIM_attestation_list_destroy (cth->attests);
995 GNUNET_free (cth); 985 GNUNET_free (cth);
996} 986}
997 987
@@ -1010,7 +1000,7 @@ process_parallel_lookup_result (void *cls,
1010{ 1000{
1011 struct ParallelLookup *parallel_lookup = cls; 1001 struct ParallelLookup *parallel_lookup = cls;
1012 struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle; 1002 struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle;
1013 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le; 1003 struct GNUNET_RECLAIM_AttributeListEntry *attr_le;
1014 1004
1015 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1005 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1016 "Parallel lookup finished (count=%u)\n", 1006 "Parallel lookup finished (count=%u)\n",
@@ -1036,67 +1026,40 @@ process_parallel_lookup_result (void *cls,
1036 // REMARK: It is possible now to find rd_count > 1 1026 // REMARK: It is possible now to find rd_count > 1
1037 for (int i = 0; i < rd_count; i++) 1027 for (int i = 0; i < rd_count; i++)
1038 { 1028 {
1039 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type) 1029 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE == rd[i].record_type)
1040 { 1030 {
1041 attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); 1031 attr_le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
1042 attr_le->claim = 1032 attr_le->attribute =
1043 GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd[i].data, rd[i].data_size); 1033 GNUNET_RECLAIM_attribute_deserialize (rd[i].data, rd[i].data_size);
1044 GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head, 1034 GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head,
1045 cth->attrs->list_tail, 1035 cth->attrs->list_tail,
1046 attr_le); 1036 attr_le);
1047 attr_le->reference = NULL;
1048 attr_le->attest = NULL;
1049 } 1037 }
1050 else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type) 1038 else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION == rd[i].record_type)
1051 { 1039 {
1052 /**Ignore all plain attestations 1040 struct GNUNET_RECLAIM_AttestationListEntry *ale;
1053 *attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); 1041 ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry);
1054 *attr_le->attest = 1042 ale->attestation =
1055 * GNUNET_RECLAIM_ATTESTATION_deserialize (rd[i].data, rd[i].data_size); 1043 GNUNET_RECLAIM_attestation_deserialize (rd[i].data,
1056 *GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head, 1044 rd[i].data_size);
1057 * cth->attrs->list_tail, 1045 GNUNET_CONTAINER_DLL_insert (cth->attests->list_head,
1058 * attr_le); 1046 cth->attests->list_tail,
1059 */ 1047 ale);
1060 continue;
1061 } 1048 }
1062 else if (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE == rd[i].record_type) 1049 else
1063 { 1050 {
1064 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le2; 1051 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1065 attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); 1052 "Parallel Lookup of Reference without Attestation");
1066 attr_le2 = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); 1053 continue;
1067 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[0].record_type) 1054 }
1068 {
1069 attr_le->attest = GNUNET_RECLAIM_ATTESTATION_deserialize (rd[0].data,
1070 rd[0].
1071 data_size);
1072 attr_le2->reference =
1073 GNUNET_RECLAIM_ATTESTATION_REF_deserialize (rd[i].data,
1074 rd[i].data_size);
1075 attr_le->claim = NULL;
1076 attr_le->reference = NULL;
1077 attr_le2->claim = NULL;
1078 attr_le2->attest = NULL;
1079 GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head,
1080 cth->attrs->list_tail,
1081 attr_le);
1082 GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head,
1083 cth->attrs->list_tail,
1084 attr_le2);
1085 }
1086 else
1087 {
1088 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1089 "Parallel Lookup of Reference without Attestation");
1090 continue;
1091 }
1092 1055
1093 1056
1094 }
1095 } 1057 }
1096 if (NULL != cth->parallel_lookups_head) 1058 if (NULL != cth->parallel_lookups_head)
1097 return; // Wait for more 1059 return; // Wait for more
1098 /* Else we are done */ 1060 /* Else we are done */
1099 cth->cb (cth->cb_cls, &cth->ticket.identity, cth->attrs, GNUNET_OK, NULL); 1061 cth->cb (cth->cb_cls, &cth->ticket.identity,
1062 cth->attrs, cth->attests, GNUNET_OK, NULL);
1100 cleanup_cth (cth); 1063 cleanup_cth (cth);
1101} 1064}
1102 1065
@@ -1125,7 +1088,7 @@ abort_parallel_lookups (void *cls)
1125 GNUNET_free (lu); 1088 GNUNET_free (lu);
1126 lu = tmp; 1089 lu = tmp;
1127 } 1090 }
1128 cth->cb (cth->cb_cls, NULL, NULL, GNUNET_SYSERR, "Aborted"); 1091 cth->cb (cth->cb_cls, NULL, NULL, NULL, GNUNET_SYSERR, "Aborted");
1129} 1092}
1130 1093
1131 1094
@@ -1162,10 +1125,11 @@ lookup_authz_cb (void *cls,
1162 1125
1163 for (int i = 0; i < rd_count; i++) 1126 for (int i = 0; i < rd_count; i++)
1164 { 1127 {
1165 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) 1128 if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type) &&
1129 (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF != rd[i].record_type))
1166 continue; 1130 continue;
1167 lbl = GNUNET_STRINGS_data_to_string_alloc (rd[i].data, rd[i].data_size); 1131 lbl = GNUNET_STRINGS_data_to_string_alloc (rd[i].data, rd[i].data_size);
1168 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute ref found %s\n", lbl); 1132 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ticket reference found %s\n", lbl);
1169 parallel_lookup = GNUNET_new (struct ParallelLookup); 1133 parallel_lookup = GNUNET_new (struct ParallelLookup);
1170 parallel_lookup->handle = cth; 1134 parallel_lookup->handle = cth;
1171 parallel_lookup->label = lbl; 1135 parallel_lookup->label = lbl;
@@ -1197,7 +1161,8 @@ lookup_authz_cb (void *cls,
1197 /** 1161 /**
1198 * No references found, return empty attribute list 1162 * No references found, return empty attribute list
1199 */ 1163 */
1200 cth->cb (cth->cb_cls, &cth->ticket.identity, cth->attrs, GNUNET_OK, NULL); 1164 cth->cb (cth->cb_cls, &cth->ticket.identity,
1165 cth->attrs, cth->attests, GNUNET_OK, NULL);
1201 cleanup_cth (cth); 1166 cleanup_cth (cth);
1202} 1167}
1203 1168
@@ -1226,12 +1191,14 @@ RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id,
1226 1191
1227 cth->identity = *id; 1192 cth->identity = *id;
1228 GNUNET_CRYPTO_ecdsa_key_get_public (&cth->identity, &cth->identity_pub); 1193 GNUNET_CRYPTO_ecdsa_key_get_public (&cth->identity, &cth->identity_pub);
1229 cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList); 1194 cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
1195 cth->attests = GNUNET_new (struct GNUNET_RECLAIM_AttestationList);
1230 cth->ticket = *ticket; 1196 cth->ticket = *ticket;
1231 cth->cb = cb; 1197 cth->cb = cb;
1232 cth->cb_cls = cb_cls; 1198 cth->cb_cls = cb_cls;
1233 label = 1199 label =
1234 GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, sizeof(uint64_t)); 1200 GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd,
1201 sizeof(cth->ticket.rnd));
1235 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1236 "Looking for AuthZ info under %s\n", 1203 "Looking for AuthZ info under %s\n",
1237 label); 1204 label);
@@ -1240,7 +1207,7 @@ RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id,
1240 GNUNET_GNS_lookup (gns, 1207 GNUNET_GNS_lookup (gns,
1241 label, 1208 label,
1242 &cth->ticket.identity, 1209 &cth->ticket.identity,
1243 GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF, 1210 GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF,
1244 GNUNET_GNS_LO_DEFAULT, 1211 GNUNET_GNS_LO_DEFAULT,
1245 &lookup_authz_cb, 1212 &lookup_authz_cb,
1246 cth); 1213 cth);
@@ -1316,74 +1283,50 @@ store_ticket_issue_cont (void *cls, int32_t success, const char *emsg)
1316static void 1283static void
1317issue_ticket (struct TicketIssueHandle *ih) 1284issue_ticket (struct TicketIssueHandle *ih)
1318{ 1285{
1319 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 1286 struct GNUNET_RECLAIM_AttributeListEntry *le;
1320 struct GNUNET_GNSRECORD_Data *attrs_record; 1287 struct GNUNET_GNSRECORD_Data *attrs_record;
1321 char *label; 1288 char *label;
1322 size_t list_len = 1;
1323 int i; 1289 int i;
1324 char *attest_string; 1290 int attrs_count = 0;
1325 1291
1326 for (le = ih->attrs->list_head; NULL != le; le = le->next) 1292 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1327 list_len++; 1293 attrs_count++;
1328 1294
1295 //Worst case we have one attestation per attribute
1329 attrs_record = 1296 attrs_record =
1330 GNUNET_malloc (list_len * sizeof(struct GNUNET_GNSRECORD_Data)); 1297 GNUNET_malloc (2 * attrs_count * sizeof(struct GNUNET_GNSRECORD_Data));
1331 i = 0; 1298 i = 0;
1332 for (le = ih->attrs->list_head; NULL != le; le = le->next) 1299 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1333 { 1300 {
1334 if (NULL != le->claim) 1301 attrs_record[i].data = &le->attribute->id;
1335 { 1302 attrs_record[i].data_size = sizeof(le->attribute->id);
1336 attrs_record[i].data = &le->claim->id; 1303 attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
1337 attrs_record[i].data_size = sizeof(le->claim->id); 1304 attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF;
1338 } 1305 attrs_record[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1339 else if (NULL != le->attest) 1306 i++;
1340 { 1307 if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation))
1341 // REMARK: Since we only store IDs, the references are irrelevant
1342 int j = 0;
1343 GNUNET_asprintf (&attest_string,"%d",le->attest->id);
1344 while (j<i)
1345 {
1346 if (0 == strcmp (attest_string,GNUNET_STRINGS_data_to_string_alloc (
1347 attrs_record[j].data, attrs_record[j].data_size)))
1348 break;
1349 j++;
1350 }
1351 if (j < i)
1352 {
1353 list_len--;
1354 continue;
1355 }
1356 attrs_record[i].data = &le->attest->id;
1357 attrs_record[i].data_size = sizeof(le->attest->id);
1358 }
1359 else if (NULL != le->reference)
1360 { 1308 {
1361 list_len--; 1309 int j;
1362 continue; 1310 for (j = 0; j < i; j++)
1363 /*
1364 int j = 0;
1365 GNUNET_asprintf (&attest_string,"%d",le->attest->id);
1366 while (j<i)
1367 { 1311 {
1368 if (strcmp(attest_string, GNUNET_STRINGS_data_to_string_alloc ( 1312 if (attrs_record[j].record_type
1369 attrs_record[j].data, attrs_record[j].data_size))) 1313 != GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF)
1314 continue;
1315 if (0 == memcmp (attrs_record[j].data,
1316 &le->attribute->attestation,
1317 sizeof (le->attribute->attestation)))
1370 break; 1318 break;
1371 j++;
1372 } 1319 }
1373 if (j < i) 1320 if (j < i)
1374 continue; 1321 continue; // Skip as we have already added this attestation.
1375 attrs_record[i].data = &le->reference->id; 1322 attrs_record[i].data = &le->attribute->attestation;
1376 attrs_record[i].data_size = sizeof(le->reference->id); 1323 attrs_record[i].data_size = sizeof(le->attribute->attestation);
1377 */ 1324 attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
1325 attrs_record[i].record_type =
1326 GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF;
1327 attrs_record[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1328 i++;
1378 } 1329 }
1379 /**
1380 * FIXME: Should this be the attribute expiration time or ticket
1381 * refresh interval? Probably min(attrs.expiration)
1382 */
1383 attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
1384 attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF;
1385 attrs_record[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1386 i++;
1387 } 1330 }
1388 attrs_record[i].data = &ih->ticket; 1331 attrs_record[i].data = &ih->ticket;
1389 attrs_record[i].data_size = sizeof(struct GNUNET_RECLAIM_Ticket); 1332 attrs_record[i].data_size = sizeof(struct GNUNET_RECLAIM_Ticket);
@@ -1391,14 +1334,16 @@ issue_ticket (struct TicketIssueHandle *ih)
1391 attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET; 1334 attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET;
1392 attrs_record[i].flags = 1335 attrs_record[i].flags =
1393 GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE; 1336 GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
1337 i++;
1394 1338
1395 label = 1339 label =
1396 GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof(uint64_t)); 1340 GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd,
1341 sizeof(ih->ticket.rnd));
1397 // Publish record 1342 // Publish record
1398 ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh, 1343 ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1399 &ih->identity, 1344 &ih->identity,
1400 label, 1345 label,
1401 list_len, 1346 i,
1402 attrs_record, 1347 attrs_record,
1403 &store_ticket_issue_cont, 1348 &store_ticket_issue_cont,
1404 ih); 1349 ih);
@@ -1454,14 +1399,20 @@ filter_tickets_cb (void *cls,
1454 struct GNUNET_RECLAIM_Ticket *ticket = NULL; 1399 struct GNUNET_RECLAIM_Ticket *ticket = NULL;
1455 1400
1456 // figure out the number of requested attributes 1401 // figure out the number of requested attributes
1457 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 1402 struct GNUNET_RECLAIM_AttributeListEntry *le;
1458 unsigned int attr_cnt = 0; 1403 unsigned int attr_cnt = 0;
1404 unsigned int attest_cnt = 0;
1459 1405
1460 for (le = tih->attrs->list_head; NULL != le; le = le->next) 1406 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1407 {
1461 attr_cnt++; 1408 attr_cnt++;
1409 if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation))
1410 attest_cnt++;
1411 }
1462 1412
1463 // ticket search 1413 // ticket search
1464 unsigned int found_attrs_cnt = 0; 1414 unsigned int found_attrs_cnt = 0;
1415 unsigned int found_attests_cnt = 0;
1465 1416
1466 for (int i = 0; i < rd_count; i++) 1417 for (int i = 0; i < rd_count; i++)
1467 { 1418 {
@@ -1481,39 +1432,20 @@ filter_tickets_cb (void *cls,
1481 } 1432 }
1482 1433
1483 // cmp requested attributes with ticket attributes 1434 // cmp requested attributes with ticket attributes
1484 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) 1435 if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type) &&
1436 (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF != rd[i].record_type))
1485 continue; 1437 continue;
1486 for (le = tih->attrs->list_head; NULL != le; le = le->next) 1438 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1487 { 1439 {
1488 // cmp attr_ref id with requested attr id 1440 if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
1489 if (NULL !=le->claim) 1441 &le->attribute->id))
1490 { 1442 found_attrs_cnt++;
1491 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1443 }
1492 " %" PRIu64 "\n %" PRIu64 "\n", 1444 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1493 *((uint64_t *) rd[i].data), 1445 {
1494 le->claim->id); 1446 if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
1495 if (0 == memcmp (rd[i].data, &le->claim->id, sizeof(uint64_t))) 1447 &le->attribute->attestation))
1496 found_attrs_cnt++; 1448 found_attests_cnt++;
1497 }
1498 else if (NULL !=le->attest)
1499 {
1500 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1501 " %" PRIu64 "\n %" PRIu64 "\n",
1502 *((uint64_t *) rd[i].data),
1503 le->attest->id);
1504 if (0 == memcmp (rd[i].data, &le->attest->id, sizeof(uint64_t)))
1505 found_attrs_cnt++;
1506 }
1507 else if (NULL != le->reference)
1508 {
1509 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1510 " %" PRIu64 "\n %" PRIu64 "\n",
1511 *((uint64_t *) rd[i].data),
1512 le->reference->id);
1513 if (0 == memcmp (rd[i].data, &le->reference->id, sizeof(uint64_t)))
1514 found_attrs_cnt++;
1515 }
1516
1517 } 1449 }
1518 } 1450 }
1519 1451
@@ -1521,7 +1453,9 @@ filter_tickets_cb (void *cls,
1521 * If we found a matching ticket, return that to the caller and 1453 * If we found a matching ticket, return that to the caller and
1522 * we are done. 1454 * we are done.
1523 */ 1455 */
1524 if ((attr_cnt == found_attrs_cnt) && (NULL != ticket)) 1456 if ((attr_cnt == found_attrs_cnt) &&
1457 (attest_cnt == found_attests_cnt) &&
1458 (NULL != ticket))
1525 { 1459 {
1526 GNUNET_NAMESTORE_zone_iteration_stop (tih->ns_it); 1460 GNUNET_NAMESTORE_zone_iteration_stop (tih->ns_it);
1527 tih->cb (tih->cb_cls, &tih->ticket, GNUNET_OK, NULL); 1461 tih->cb (tih->cb_cls, &tih->ticket, GNUNET_OK, NULL);
@@ -1547,8 +1481,7 @@ filter_tickets_finished_cb (void *cls)
1547 struct TicketIssueHandle *tih = cls; 1481 struct TicketIssueHandle *tih = cls;
1548 1482
1549 GNUNET_CRYPTO_ecdsa_key_get_public (&tih->identity, &tih->ticket.identity); 1483 GNUNET_CRYPTO_ecdsa_key_get_public (&tih->identity, &tih->ticket.identity);
1550 tih->ticket.rnd = 1484 GNUNET_RECLAIM_id_generate (&tih->ticket.rnd);
1551 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
1552 issue_ticket (tih); 1485 issue_ticket (tih);
1553} 1486}
1554 1487
@@ -1566,7 +1499,7 @@ filter_tickets_finished_cb (void *cls)
1566 */ 1499 */
1567void 1500void
1568RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1501RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
1569 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 1502 const struct GNUNET_RECLAIM_AttributeList *attrs,
1570 const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, 1503 const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
1571 RECLAIM_TICKETS_TicketResult cb, 1504 RECLAIM_TICKETS_TicketResult cb,
1572 void *cb_cls) 1505 void *cb_cls)
@@ -1576,7 +1509,7 @@ RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
1576 tih = GNUNET_new (struct TicketIssueHandle); 1509 tih = GNUNET_new (struct TicketIssueHandle);
1577 tih->cb = cb; 1510 tih->cb = cb;
1578 tih->cb_cls = cb_cls; 1511 tih->cb_cls = cb_cls;
1579 tih->attrs = GNUNET_RECLAIM_ATTRIBUTE_list_dup (attrs); 1512 tih->attrs = GNUNET_RECLAIM_attribute_list_dup (attrs);
1580 tih->identity = *identity; 1513 tih->identity = *identity;
1581 tih->ticket.audience = *audience; 1514 tih->ticket.audience = *audience;
1582 1515
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.h b/src/reclaim/gnunet-service-reclaim_tickets.h
index c75cefc03..1c7214d42 100644
--- a/src/reclaim/gnunet-service-reclaim_tickets.h
+++ b/src/reclaim/gnunet-service-reclaim_tickets.h
@@ -36,7 +36,7 @@
36#include "gnunet_gns_service.h" 36#include "gnunet_gns_service.h"
37#include "gnunet_gnsrecord_lib.h" 37#include "gnunet_gnsrecord_lib.h"
38#include "gnunet_protocols.h" 38#include "gnunet_protocols.h"
39#include "gnunet_reclaim_attribute_lib.h" 39#include "gnunet_reclaim_lib.h"
40#include "gnunet_reclaim_service.h" 40#include "gnunet_reclaim_service.h"
41#include "gnunet_signatures.h" 41#include "gnunet_signatures.h"
42#include "gnunet_statistics_service.h" 42#include "gnunet_statistics_service.h"
@@ -136,7 +136,8 @@ typedef void (*RECLAIM_TICKETS_TicketResult) (
136typedef void (*RECLAIM_TICKETS_ConsumeCallback) ( 136typedef void (*RECLAIM_TICKETS_ConsumeCallback) (
137 void *cls, 137 void *cls,
138 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 138 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
139 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *l, 139 const struct GNUNET_RECLAIM_AttributeList *attributes,
140 const struct GNUNET_RECLAIM_AttestationList *attestations,
140 int32_t success, 141 int32_t success,
141 const char *emsg); 142 const char *emsg);
142 143
@@ -217,7 +218,7 @@ RECLAIM_TICKETS_consume_cancel (struct RECLAIM_TICKETS_ConsumeHandle *cth);
217 */ 218 */
218void 219void
219RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 220RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
220 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 221 const struct GNUNET_RECLAIM_AttributeList *attrs,
221 const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, 222 const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
222 RECLAIM_TICKETS_TicketResult cb, 223 RECLAIM_TICKETS_TicketResult cb,
223 void *cb_cls); 224 void *cb_cls);
diff --git a/src/reclaim/json_reclaim.c b/src/reclaim/json_reclaim.c
index a464a9088..d52d15ed4 100644
--- a/src/reclaim/json_reclaim.c
+++ b/src/reclaim/json_reclaim.c
@@ -24,11 +24,9 @@
24 * @author Martin Schanzenbach 24 * @author Martin Schanzenbach
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27
28#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
29
30#include "gnunet_json_lib.h" 28#include "gnunet_json_lib.h"
31#include "gnunet_reclaim_attribute_lib.h" 29#include "gnunet_reclaim_lib.h"
32#include "gnunet_reclaim_service.h" 30#include "gnunet_reclaim_service.h"
33 31
34 32
@@ -43,11 +41,12 @@
43static int 41static int
44parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) 42parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
45{ 43{
46 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr; 44 struct GNUNET_RECLAIM_Attribute *attr;
47 const char *name_str = NULL; 45 const char *name_str = NULL;
48 const char *val_str = NULL; 46 const char *val_str = NULL;
49 const char *type_str = NULL; 47 const char *type_str = NULL;
50 const char *id_str = NULL; 48 const char *id_str = NULL;
49 const char *attest_str = NULL;
51 const char *flag_str = NULL; 50 const char *flag_str = NULL;
52 char *data; 51 char *data;
53 int unpack_state; 52 int unpack_state;
@@ -64,11 +63,13 @@ parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
64 } 63 }
65 // interpret single attribute 64 // interpret single attribute
66 unpack_state = json_unpack (root, 65 unpack_state = json_unpack (root,
67 "{s:s, s?s, s:s, s:s, s?s!}", 66 "{s:s, s?s, s?s, s:s, s:s, s?s!}",
68 "name", 67 "name",
69 &name_str, 68 &name_str,
70 "id", 69 "id",
71 &id_str, 70 &id_str,
71 "attestation",
72 &attest_str,
72 "type", 73 "type",
73 &type_str, 74 &type_str,
74 "value", 75 "value",
@@ -82,9 +83,9 @@ parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
82 "Error json object has a wrong format!\n"); 83 "Error json object has a wrong format!\n");
83 return GNUNET_SYSERR; 84 return GNUNET_SYSERR;
84 } 85 }
85 type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str); 86 type = GNUNET_RECLAIM_attribute_typename_to_number (type_str);
86 if (GNUNET_SYSERR == 87 if (GNUNET_SYSERR ==
87 (GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type, 88 (GNUNET_RECLAIM_attribute_string_to_value (type,
88 val_str, 89 val_str,
89 (void **) &data, 90 (void **) &data,
90 &data_size))) 91 &data_size)))
@@ -92,16 +93,24 @@ parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
92 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute value invalid!\n"); 93 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute value invalid!\n");
93 return GNUNET_SYSERR; 94 return GNUNET_SYSERR;
94 } 95 }
95 attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (name_str, type, data, data_size); 96 attr = GNUNET_RECLAIM_attribute_new (name_str, NULL,
97 type, data, data_size);
98 if ((NULL != attest_str) && (0 != strlen (attest_str)))
99 {
100 GNUNET_STRINGS_string_to_data (attest_str,
101 strlen (attest_str),
102 &attr->attestation,
103 sizeof(attr->attestation));
104 }
96 if ((NULL == id_str) || (0 == strlen (id_str))) 105 if ((NULL == id_str) || (0 == strlen (id_str)))
97 attr->id = 0; 106 memset (&attr->id, 0, sizeof (attr->id));
98 else 107 else
99 GNUNET_STRINGS_string_to_data (id_str, 108 GNUNET_STRINGS_string_to_data (id_str,
100 strlen (id_str), 109 strlen (id_str),
101 &attr->id, 110 &attr->id,
102 sizeof(uint64_t)); 111 sizeof(attr->id));
103 112
104 *(struct GNUNET_RECLAIM_ATTRIBUTE_Claim **) spec->ptr = attr; 113 *(struct GNUNET_RECLAIM_Attribute **) spec->ptr = attr;
105 return GNUNET_OK; 114 return GNUNET_OK;
106} 115}
107 116
@@ -115,9 +124,9 @@ parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
115static void 124static void
116clean_attr (void *cls, struct GNUNET_JSON_Specification *spec) 125clean_attr (void *cls, struct GNUNET_JSON_Specification *spec)
117{ 126{
118 struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr; 127 struct GNUNET_RECLAIM_Attribute **attr;
119 128
120 attr = (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **) spec->ptr; 129 attr = (struct GNUNET_RECLAIM_Attribute **) spec->ptr;
121 if (NULL != *attr) 130 if (NULL != *attr)
122 { 131 {
123 GNUNET_free (*attr); 132 GNUNET_free (*attr);
@@ -129,11 +138,11 @@ clean_attr (void *cls, struct GNUNET_JSON_Specification *spec)
129/** 138/**
130 * JSON Specification for Reclaim claims. 139 * JSON Specification for Reclaim claims.
131 * 140 *
132 * @param ticket struct of GNUNET_RECLAIM_ATTRIBUTE_Claim to fill 141 * @param ticket struct of GNUNET_RECLAIM_Attribute to fill
133 * @return JSON Specification 142 * @return JSON Specification
134 */ 143 */
135struct GNUNET_JSON_Specification 144struct GNUNET_JSON_Specification
136GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr) 145GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_Attribute **attr)
137{ 146{
138 struct GNUNET_JSON_Specification ret = { .parser = &parse_attr, 147 struct GNUNET_JSON_Specification ret = { .parser = &parse_attr,
139 .cleaner = &clean_attr, 148 .cleaner = &clean_attr,
@@ -192,7 +201,7 @@ parse_ticket (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
192 if (GNUNET_OK != GNUNET_STRINGS_string_to_data (rnd_str, 201 if (GNUNET_OK != GNUNET_STRINGS_string_to_data (rnd_str,
193 strlen (rnd_str), 202 strlen (rnd_str),
194 &ticket->rnd, 203 &ticket->rnd,
195 sizeof(uint64_t))) 204 sizeof(ticket->rnd)))
196 { 205 {
197 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Rnd invalid\n"); 206 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Rnd invalid\n");
198 GNUNET_free (ticket); 207 GNUNET_free (ticket);
@@ -268,6 +277,7 @@ GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket)
268 return ret; 277 return ret;
269} 278}
270 279
280
271/** 281/**
272 * Parse given JSON object to an attestation claim 282 * Parse given JSON object to an attestation claim
273 * 283 *
@@ -279,7 +289,7 @@ GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket)
279static int 289static int
280parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) 290parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
281{ 291{
282 struct GNUNET_RECLAIM_ATTESTATION_Claim *attr; 292 struct GNUNET_RECLAIM_Attestation *attr;
283 const char *name_str = NULL; 293 const char *name_str = NULL;
284 const char *val_str = NULL; 294 const char *val_str = NULL;
285 const char *type_str = NULL; 295 const char *type_str = NULL;
@@ -315,9 +325,9 @@ parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
315 "Error json object has a wrong format!\n"); 325 "Error json object has a wrong format!\n");
316 return GNUNET_SYSERR; 326 return GNUNET_SYSERR;
317 } 327 }
318 type = GNUNET_RECLAIM_ATTESTATION_typename_to_number (type_str); 328 type = GNUNET_RECLAIM_attestation_typename_to_number (type_str);
319 if (GNUNET_SYSERR == 329 if (GNUNET_SYSERR ==
320 (GNUNET_RECLAIM_ATTESTATION_string_to_value (type, 330 (GNUNET_RECLAIM_attestation_string_to_value (type,
321 val_str, 331 val_str,
322 (void **) &data, 332 (void **) &data,
323 &data_size))) 333 &data_size)))
@@ -325,19 +335,20 @@ parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
325 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attestation value invalid!\n"); 335 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attestation value invalid!\n");
326 return GNUNET_SYSERR; 336 return GNUNET_SYSERR;
327 } 337 }
328 attr = GNUNET_RECLAIM_ATTESTATION_claim_new (name_str, type, data, data_size); 338 attr = GNUNET_RECLAIM_attestation_new (name_str, type, data, data_size);
329 if ((NULL == id_str) || (0 == strlen (id_str))) 339 if ((NULL == id_str) || (0 == strlen (id_str)))
330 attr->id = 0; 340 memset (&attr->id, 0, sizeof (attr->id));
331 else 341 else
332 GNUNET_STRINGS_string_to_data (id_str, 342 GNUNET_STRINGS_string_to_data (id_str,
333 strlen (id_str), 343 strlen (id_str),
334 &attr->id, 344 &attr->id,
335 sizeof(uint64_t)); 345 sizeof(attr->id));
336 346
337 *(struct GNUNET_RECLAIM_ATTESTATION_Claim **) spec->ptr = attr; 347 *(struct GNUNET_RECLAIM_Attestation **) spec->ptr = attr;
338 return GNUNET_OK; 348 return GNUNET_OK;
339} 349}
340 350
351
341/** 352/**
342 * Cleanup data left from parsing RSA public key. 353 * Cleanup data left from parsing RSA public key.
343 * 354 *
@@ -347,15 +358,17 @@ parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
347static void 358static void
348clean_attest (void *cls, struct GNUNET_JSON_Specification *spec) 359clean_attest (void *cls, struct GNUNET_JSON_Specification *spec)
349{ 360{
350 struct GNUNET_RECLAIM_ATTESTATION_Claim **attr; 361 struct GNUNET_RECLAIM_Attestation **attr;
351 362
352 attr = (struct GNUNET_RECLAIM_ATTESTATION_Claim **) spec->ptr; 363 attr = (struct GNUNET_RECLAIM_Attestation **) spec->ptr;
353 if (NULL != *attr) 364 if (NULL != *attr)
354 { 365 {
355 GNUNET_free (*attr); 366 GNUNET_free (*attr);
356 *attr = NULL; 367 *attr = NULL;
357 } 368 }
358} 369}
370
371
359/** 372/**
360 * JSON Specification for Reclaim attestation claims. 373 * JSON Specification for Reclaim attestation claims.
361 * 374 *
@@ -364,7 +377,7 @@ clean_attest (void *cls, struct GNUNET_JSON_Specification *spec)
364 */ 377 */
365struct GNUNET_JSON_Specification 378struct GNUNET_JSON_Specification
366GNUNET_RECLAIM_JSON_spec_claim_attest (struct 379GNUNET_RECLAIM_JSON_spec_claim_attest (struct
367 GNUNET_RECLAIM_ATTESTATION_Claim **attr) 380 GNUNET_RECLAIM_Attestation **attr)
368{ 381{
369 struct GNUNET_JSON_Specification ret = { .parser = &parse_attest, 382 struct GNUNET_JSON_Specification ret = { .parser = &parse_attest,
370 .cleaner = &clean_attest, 383 .cleaner = &clean_attest,
@@ -377,107 +390,3 @@ GNUNET_RECLAIM_JSON_spec_claim_attest (struct
377 *attr = NULL; 390 *attr = NULL;
378 return ret; 391 return ret;
379} 392}
380
381/**
382 * Parse given JSON object to an attestation claim
383 *
384 * @param cls closure, NULL
385 * @param root the json object representing data
386 * @param spec where to write the data
387 * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
388 */
389static int
390parse_attest_ref (void *cls, json_t *root, struct
391 GNUNET_JSON_Specification *spec)
392{
393 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
394 const char *name_str = NULL;
395 const char *ref_val_str = NULL;
396 const char *ref_id_str = NULL;
397 const char *id_str = NULL;
398 int unpack_state;
399
400 GNUNET_assert (NULL != root);
401
402 if (! json_is_object (root))
403 {
404 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
405 "Error json is not array nor object!\n");
406 return GNUNET_SYSERR;
407 }
408 // interpret single reference
409 unpack_state = json_unpack (root,
410 "{s:s, s?s, s:s, s:s!}",
411 "name",
412 &name_str,
413 "id",
414 &id_str,
415 "ref_id",
416 &ref_id_str,
417 "ref_value",
418 &ref_val_str);
419 if ((0 != unpack_state) || (NULL == name_str) || (NULL == ref_val_str) ||
420 (NULL == ref_id_str))
421 {
422 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
423 "Error json object has a wrong format!\n");
424 return GNUNET_SYSERR;
425 }
426
427 attr = GNUNET_RECLAIM_ATTESTATION_reference_new (name_str, ref_val_str);
428
429 attr->id = 0;
430
431 if ((NULL == ref_id_str) || (0 == strlen (ref_id_str)))
432 attr->id_attest = 0;
433 else
434 GNUNET_STRINGS_string_to_data (ref_id_str,
435 strlen (ref_id_str),
436 &attr->id_attest,
437 sizeof(uint64_t));
438
439 *(struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **) spec->ptr = attr;
440 return GNUNET_OK;
441}
442
443/**
444 * Cleanup data left from parsing RSA public key.
445 *
446 * @param cls closure, NULL
447 * @param[out] spec where to free the data
448 */
449static void
450clean_attest_ref (void *cls, struct GNUNET_JSON_Specification *spec)
451{
452 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **attr;
453
454 attr = (struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **) spec->ptr;
455 if (NULL != *attr)
456 {
457 GNUNET_free (*attr);
458 *attr = NULL;
459 }
460}
461
462/**
463 * JSON Specification for Reclaim attestation references.
464 *
465 * @param ticket struct of GNUNET_RECLAIM_ATTESTATION_REFERENCE to fill
466 * @return JSON Specification
467 */
468struct GNUNET_JSON_Specification
469GNUNET_RECLAIM_JSON_spec_claim_attest_ref (struct
470 GNUNET_RECLAIM_ATTESTATION_REFERENCE
471 **attr)
472{
473 struct GNUNET_JSON_Specification ret = { .parser = &parse_attest_ref,
474 .cleaner = &clean_attest_ref,
475 .cls = NULL,
476 .field = NULL,
477 .ptr = attr,
478 .ptr_size = 0,
479 .size_ptr = NULL };
480
481 *attr = NULL;
482 return ret;
483} \ No newline at end of file
diff --git a/src/reclaim/json_reclaim.h b/src/reclaim/json_reclaim.h
index 9e6479e5e..61ddb4378 100644
--- a/src/reclaim/json_reclaim.h
+++ b/src/reclaim/json_reclaim.h
@@ -27,7 +27,7 @@
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_reclaim_service.h" 29#include "gnunet_reclaim_service.h"
30#include "gnunet_reclaim_attribute_lib.h" 30#include "gnunet_reclaim_lib.h"
31 31
32/** 32/**
33 * JSON Specification for Reclaim claims. 33 * JSON Specification for Reclaim claims.
@@ -36,7 +36,7 @@
36 * @return JSON Specification 36 * @return JSON Specification
37 */ 37 */
38struct GNUNET_JSON_Specification 38struct GNUNET_JSON_Specification
39GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr); 39GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_Attribute **attr);
40 40
41/** 41/**
42 * JSON Specification for Reclaim tickets. 42 * JSON Specification for Reclaim tickets.
@@ -50,18 +50,10 @@ GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket);
50/** 50/**
51 * JSON Specification for Reclaim attestation claims. 51 * JSON Specification for Reclaim attestation claims.
52 * 52 *
53 * @param ticket struct of GNUNET_RECLAIM_ATTESTATION_Claim to fill 53 * @param ticket struct of GNUNET_RECLAIM_Attestation to fill
54 * @return JSON Specification 54 * @return JSON Specification
55 */ 55 */
56struct GNUNET_JSON_Specification 56struct GNUNET_JSON_Specification
57GNUNET_RECLAIM_JSON_spec_claim_attest (struct 57GNUNET_RECLAIM_JSON_spec_claim_attest (struct
58 GNUNET_RECLAIM_ATTESTATION_Claim **attr); 58 GNUNET_RECLAIM_Attestation **attr);
59 59
60 /**
61 * JSON Specification for Reclaim attestation references.
62 *
63 * @param ticket struct of GNUNET_RECLAIM_ATTESTATION_REFERENCE to fill
64 * @return JSON Specification
65 */
66 struct GNUNET_JSON_Specification
67 GNUNET_RECLAIM_JSON_spec_claim_attest_ref(struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **attr);
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c
index 2ce462854..e309ed01d 100644
--- a/src/reclaim/oidc_helper.c
+++ b/src/reclaim/oidc_helper.c
@@ -27,7 +27,7 @@
27#include <inttypes.h> 27#include <inttypes.h>
28#include <jansson.h> 28#include <jansson.h>
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_reclaim_attribute_lib.h" 30#include "gnunet_reclaim_lib.h"
31#include "gnunet_reclaim_service.h" 31#include "gnunet_reclaim_service.h"
32#include "gnunet_signatures.h" 32#include "gnunet_signatures.h"
33#include "oidc_helper.h" 33#include "oidc_helper.h"
@@ -60,6 +60,11 @@ struct OIDC_Parameters
60 * The length of the attributes list 60 * The length of the attributes list
61 */ 61 */
62 uint32_t attr_list_len GNUNET_PACKED; 62 uint32_t attr_list_len GNUNET_PACKED;
63
64 /**
65 * The length of the attestation list
66 */
67 uint32_t attest_list_len GNUNET_PACKED;
63}; 68};
64 69
65GNUNET_NETWORK_STRUCT_END 70GNUNET_NETWORK_STRUCT_END
@@ -118,12 +123,14 @@ fix_base64 (char *str)
118char * 123char *
119OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, 124OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
120 const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, 125 const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key,
121 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 126 struct GNUNET_RECLAIM_AttributeList *attrs,
127 struct GNUNET_RECLAIM_AttestationList *attests,
122 const struct GNUNET_TIME_Relative *expiration_time, 128 const struct GNUNET_TIME_Relative *expiration_time,
123 const char *nonce, 129 const char *nonce,
124 const char *secret_key) 130 const char *secret_key)
125{ 131{
126 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 132 struct GNUNET_RECLAIM_AttributeListEntry *le;
133 struct GNUNET_RECLAIM_AttestationListEntry *ale;
127 struct GNUNET_HashCode signature; 134 struct GNUNET_HashCode signature;
128 struct GNUNET_TIME_Absolute exp_time; 135 struct GNUNET_TIME_Absolute exp_time;
129 struct GNUNET_TIME_Absolute time_now; 136 struct GNUNET_TIME_Absolute time_now;
@@ -133,7 +140,6 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
133 char *body_str; 140 char *body_str;
134 char *aggr_names_str; 141 char *aggr_names_str;
135 char *aggr_sources_str; 142 char *aggr_sources_str;
136 char *aggr_sources_jwt_str;
137 char *source_name; 143 char *source_name;
138 char *result; 144 char *result;
139 char *header_base64; 145 char *header_base64;
@@ -146,7 +152,12 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
146 json_t *aggr_names; 152 json_t *aggr_names;
147 json_t *aggr_sources; 153 json_t *aggr_sources;
148 json_t *aggr_sources_jwt; 154 json_t *aggr_sources_jwt;
149 uint64_t attest_arr[GNUNET_RECLAIM_ATTRIBUTE_list_count_attest (attrs)]; 155 int num_attestations = 0;
156 for (le = attrs->list_head; NULL != le; le = le->next)
157 {
158 if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation))
159 num_attestations++;
160 }
150 161
151 // iat REQUIRED time now 162 // iat REQUIRED time now
152 time_now = GNUNET_TIME_absolute_get (); 163 time_now = GNUNET_TIME_absolute_get ();
@@ -191,95 +202,70 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
191 // nonce 202 // nonce
192 if (NULL != nonce) 203 if (NULL != nonce)
193 json_object_set_new (body, "nonce", json_string (nonce)); 204 json_object_set_new (body, "nonce", json_string (nonce));
194 int i = 0;
195 attest_val_str = NULL; 205 attest_val_str = NULL;
196 aggr_names_str = NULL; 206 aggr_names_str = NULL;
197 aggr_sources_str = NULL; 207 aggr_sources_str = NULL;
198 aggr_sources_jwt_str = NULL;
199 source_name = NULL; 208 source_name = NULL;
209 int i = 0;
210 for (ale = attests->list_head; NULL != ale; ale = ale->next)
211 {
212 // New Attestation
213 GNUNET_asprintf (&source_name,
214 "src%d",
215 i);
216 aggr_sources_jwt = json_object ();
217 attest_val_str =
218 GNUNET_RECLAIM_attestation_value_to_string (ale->attestation->type,
219 ale->attestation->data,
220 ale->attestation->data_size);
221 json_object_set_new (aggr_sources_jwt, "JWT",
222 json_string (attest_val_str) );
223 json_object_set_new (aggr_sources, source_name, aggr_sources_jwt);
224 GNUNET_free (source_name);
225 source_name = NULL;
226 i++;
227 }
228
200 for (le = attrs->list_head; NULL != le; le = le->next) 229 for (le = attrs->list_head; NULL != le; le = le->next)
201 { 230 {
202 231
203 if (le->claim != NULL) 232 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation))
204 { 233 {
205 234
206 attr_val_str = 235 attr_val_str =
207 GNUNET_RECLAIM_ATTRIBUTE_value_to_string (le->claim->type, 236 GNUNET_RECLAIM_attribute_value_to_string (le->attribute->type,
208 le->claim->data, 237 le->attribute->data,
209 le->claim->data_size); 238 le->attribute->data_size);
210 json_object_set_new (body, le->claim->name, json_string (attr_val_str)); 239 json_object_set_new (body, le->attribute->name,
240 json_string (attr_val_str));
211 GNUNET_free (attr_val_str); 241 GNUNET_free (attr_val_str);
212 } 242 }
213 else if (NULL != le->reference) 243 else
214 { 244 {
215 // Check if attest is there 245 // Check if attest is there
216 int j = 0; 246 int j = 0;
217 while (j<i) 247 for (ale = attests->list_head; NULL != ale; ale = ale->next)
218 { 248 {
219 if (attest_arr[j] == le->reference->id_attest) 249 if (GNUNET_YES ==
250 GNUNET_RECLAIM_id_is_equal (&ale->attestation->id,
251 &le->attribute->attestation))
220 break; 252 break;
221 j++; 253 j++;
222 } 254 }
223 if (j==i) 255 GNUNET_assert (NULL != ale);
224 { 256 // Attestation is existing, hence take the respective source str
225 // Attest not yet existent. Append to the end of the list 257 GNUNET_asprintf (&source_name,
226 GNUNET_CONTAINER_DLL_remove (attrs->list_head, attrs->list_tail, le); 258 "src%d",
227 GNUNET_CONTAINER_DLL_insert_tail (attrs->list_head, attrs->list_tail, 259 j);
228 le); 260 json_object_set_new (aggr_names, le->attribute->data,
229 continue; 261 json_string (source_name));
230 } 262 GNUNET_free (source_name);
231 else
232 {
233 // Attestation is existing, hence take the respective source str
234 GNUNET_asprintf (&source_name,
235 "src%d",
236 j);
237 json_object_set_new (aggr_names, le->reference->name, json_string (
238 source_name));
239 }
240
241 }
242 else if (NULL != le->attest)
243 {
244 // We assume that at max 99 different attestations
245 int j = 0;
246 while (j<i)
247 {
248 if (attest_arr[j] == le->attest->id)
249 break;
250 j++;
251 }
252 if (j==i)
253 {
254 // New Attestation
255 attest_arr[i] = le->attest->id;
256 GNUNET_asprintf (&source_name,
257 "src%d",
258 i);
259 aggr_sources_jwt = json_object ();
260 attest_val_str = GNUNET_RECLAIM_ATTESTATION_value_to_string (
261 le->attest->type, le->attest->data, le->attest->data_size);
262 json_object_set_new (aggr_sources_jwt, "JWT",json_string (
263 attest_val_str) );
264 aggr_sources_jwt_str = json_dumps (aggr_sources_jwt, JSON_INDENT (0)
265 | JSON_COMPACT);
266 json_object_set_new (aggr_sources, source_name,json_string (
267 aggr_sources_jwt_str));
268 i++;
269 }
270 else
271 {
272 // Attestation already existent. Ignore
273 continue;
274 }
275
276 } 263 }
277 } 264 }
265
278 if (NULL != attest_val_str) 266 if (NULL != attest_val_str)
279 GNUNET_free (attest_val_str); 267 GNUNET_free (attest_val_str);
280 if (NULL != source_name) 268 if (0 != i)
281 GNUNET_free (source_name);
282 if (0!=i)
283 { 269 {
284 aggr_names_str = json_dumps (aggr_names, JSON_INDENT (0) | JSON_COMPACT); 270 aggr_names_str = json_dumps (aggr_names, JSON_INDENT (0) | JSON_COMPACT);
285 aggr_sources_str = json_dumps (aggr_sources, JSON_INDENT (0) 271 aggr_sources_str = json_dumps (aggr_sources, JSON_INDENT (0)
@@ -291,16 +277,15 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
291 277
292 json_decref (aggr_names); 278 json_decref (aggr_names);
293 json_decref (aggr_sources); 279 json_decref (aggr_sources);
294 json_decref (aggr_sources_jwt);
295 280
296 body_str = json_dumps (body, JSON_INDENT (0) | JSON_COMPACT); 281 body_str = json_dumps (body, JSON_INDENT (0) | JSON_COMPACT);
297 json_decref (body); 282 json_decref (body);
298 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"ID-Token: %s\n", body_str); 283 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"ID-Token: %s\n", body_str);
299 284
300 GNUNET_STRINGS_base64_encode (header, strlen (header), &header_base64); 285 GNUNET_STRINGS_base64url_encode (header, strlen (header), &header_base64);
301 fix_base64 (header_base64); 286 fix_base64 (header_base64);
302 287
303 GNUNET_STRINGS_base64_encode (body_str, strlen (body_str), &body_base64); 288 GNUNET_STRINGS_base64url_encode (body_str, strlen (body_str), &body_base64);
304 fix_base64 (body_base64); 289 fix_base64 (body_base64);
305 290
306 GNUNET_free (subject); 291 GNUNET_free (subject);
@@ -316,9 +301,9 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
316 signature_target, 301 signature_target,
317 strlen (signature_target), 302 strlen (signature_target),
318 &signature); 303 &signature);
319 GNUNET_STRINGS_base64_encode ((const char *) &signature, 304 GNUNET_STRINGS_base64url_encode ((const char *) &signature,
320 sizeof(struct GNUNET_HashCode), 305 sizeof(struct GNUNET_HashCode),
321 &signature_base64); 306 &signature_base64);
322 fix_base64 (signature_base64); 307 fix_base64 (signature_base64);
323 308
324 GNUNET_asprintf (&result, 309 GNUNET_asprintf (&result,
@@ -334,8 +319,6 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
334 GNUNET_free (aggr_sources_str); 319 GNUNET_free (aggr_sources_str);
335 if (NULL != aggr_names_str) 320 if (NULL != aggr_names_str)
336 GNUNET_free (aggr_names_str); 321 GNUNET_free (aggr_names_str);
337 if (NULL != aggr_sources_jwt_str)
338 GNUNET_free (aggr_sources_jwt_str);
339 GNUNET_free (signature_base64); 322 GNUNET_free (signature_base64);
340 GNUNET_free (body_base64); 323 GNUNET_free (body_base64);
341 GNUNET_free (header_base64); 324 GNUNET_free (header_base64);
@@ -343,138 +326,6 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
343} 326}
344 327
345 328
346/* Converts a hex character to its integer value */
347static char
348from_hex (char ch)
349{
350 return isdigit (ch) ? ch - '0' : tolower (ch) - 'a' + 10;
351}
352
353
354/* Converts an integer value to its hex character*/
355static char
356to_hex (char code)
357{
358 static char hex[] = "0123456789abcdef";
359
360 return hex[code & 15];
361}
362
363
364/* Returns a url-encoded version of str */
365/* IMPORTANT: be sure to free() the returned string after use */
366static char *
367url_encode (const char *str)
368{
369 char *pstr = (char *) str;
370 char *buf = GNUNET_malloc (strlen (str) * 3 + 1);
371 char *pbuf = buf;
372
373 while (*pstr)
374 {
375 if (isalnum (*pstr) || (*pstr == '-') || (*pstr == '_') || (*pstr == '.') ||
376 (*pstr == '~') )
377 *pbuf++ = *pstr;
378 else if (*pstr == ' ')
379 *pbuf++ = '+';
380 else
381 {
382 *pbuf++ = '%';
383 *pbuf++ = to_hex (*pstr >> 4);
384 *pbuf++ = to_hex (*pstr & 15);
385 }
386 pstr++;
387 }
388 *pbuf = '\0';
389 return buf;
390}
391
392
393/* Returns a url-decoded version of str */
394/* IMPORTANT: be sure to free() the returned string after use */
395static char *
396url_decode (const char *str)
397{
398 char *pstr = (char *) str;
399 char *buf = GNUNET_malloc (strlen (str) + 1);
400 char *pbuf = buf;
401
402 while (*pstr)
403 {
404 if (*pstr == '%')
405 {
406 if (pstr[1] && pstr[2])
407 {
408 *pbuf++ = from_hex (pstr[1]) << 4 | from_hex (pstr[2]);
409 pstr += 2;
410 }
411 }
412 else if (*pstr == '+')
413 {
414 *pbuf++ = ' ';
415 }
416 else
417 {
418 *pbuf++ = *pstr;
419 }
420 pstr++;
421 }
422 *pbuf = '\0';
423 return buf;
424}
425
426
427/**
428 * Returns base64 encoded string urlencoded
429 *
430 * @param string the string to encode
431 * @return base64 encoded string
432 */
433static char *
434base64_and_urlencode (const char *data, size_t data_size)
435{
436 char *enc;
437 char *urlenc;
438
439 GNUNET_STRINGS_base64_encode (data, data_size, &enc);
440 urlenc = url_encode (enc);
441 GNUNET_free (enc);
442 return urlenc;
443}
444
445
446/**
447 * Returns base64 encoded string urlencoded
448 *
449 * @param string the string to encode
450 * @return base64 encoded string
451 */
452static char *
453base64url_encode (const char *data, size_t data_size)
454{
455 char *enc;
456 size_t pos;
457
458 GNUNET_STRINGS_base64_encode (data, data_size, &enc);
459 // Replace with correct characters for base64url
460 pos = 0;
461 while ('\0' != enc[pos])
462 {
463 if ('+' == enc[pos])
464 enc[pos] = '-';
465 if ('/' == enc[pos])
466 enc[pos] = '_';
467 if ('=' == enc[pos])
468 {
469 enc[pos] = '\0';
470 break;
471 }
472 pos++;
473 }
474 return enc;
475}
476
477
478static void 329static void
479derive_aes_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key, 330derive_aes_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key,
480 struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, 331 struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
@@ -572,7 +423,8 @@ encrypt_payload (const struct GNUNET_CRYPTO_EcdsaPublicKey *ecdsa_pub,
572char * 423char *
573OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, 424OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
574 const struct GNUNET_RECLAIM_Ticket *ticket, 425 const struct GNUNET_RECLAIM_Ticket *ticket,
575 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 426 struct GNUNET_RECLAIM_AttributeList *attrs,
427 struct GNUNET_RECLAIM_AttestationList *attests,
576 const char *nonce_str, 428 const char *nonce_str,
577 const char *code_challenge) 429 const char *code_challenge)
578{ 430{
@@ -585,11 +437,12 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
585 size_t payload_len; 437 size_t payload_len;
586 size_t code_payload_len; 438 size_t code_payload_len;
587 size_t attr_list_len = 0; 439 size_t attr_list_len = 0;
440 size_t attests_list_len = 0;
588 size_t code_challenge_len = 0; 441 size_t code_challenge_len = 0;
589 uint32_t nonce; 442 uint32_t nonce;
590 uint32_t nonce_tmp; 443 uint32_t nonce_tmp;
591 struct GNUNET_CRYPTO_EccSignaturePurpose *purpose; 444 struct GNUNET_CRYPTO_EccSignaturePurpose *purpose;
592 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdh_priv; 445 struct GNUNET_CRYPTO_EcdhePrivateKey ecdh_priv;
593 struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pub; 446 struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pub;
594 447
595 /** PLAINTEXT **/ 448 /** PLAINTEXT **/
@@ -623,7 +476,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
623 if (NULL != attrs) 476 if (NULL != attrs)
624 { 477 {
625 // Get length 478 // Get length
626 attr_list_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs); 479 attr_list_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs);
627 params.attr_list_len = htonl (attr_list_len); 480 params.attr_list_len = htonl (attr_list_len);
628 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 481 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
629 "Length of serialized attributes: %lu\n", 482 "Length of serialized attributes: %lu\n",
@@ -631,6 +484,19 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
631 // Get serialized attributes 484 // Get serialized attributes
632 payload_len += attr_list_len; 485 payload_len += attr_list_len;
633 } 486 }
487 if (NULL != attests)
488 {
489 // Get length
490 attests_list_len =
491 GNUNET_RECLAIM_attestation_list_serialize_get_size (attests);
492 params.attest_list_len = htonl (attests_list_len);
493 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
494 "Length of serialized attestations: %lu\n",
495 attests_list_len);
496 // Get serialized attributes
497 payload_len += attests_list_len;
498 }
499
634 // Get plaintext length 500 // Get plaintext length
635 payload = GNUNET_malloc (payload_len); 501 payload = GNUNET_malloc (payload_len);
636 memcpy (payload, &params, sizeof(params)); 502 memcpy (payload, &params, sizeof(params));
@@ -641,7 +507,10 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
641 tmp += code_challenge_len; 507 tmp += code_challenge_len;
642 } 508 }
643 if (0 < attr_list_len) 509 if (0 < attr_list_len)
644 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, tmp); 510 GNUNET_RECLAIM_attribute_list_serialize (attrs, tmp);
511 if (0 < attests_list_len)
512 GNUNET_RECLAIM_attestation_list_serialize (attests, tmp);
513
645 /** END **/ 514 /** END **/
646 515
647 /** ENCRYPT **/ 516 /** ENCRYPT **/
@@ -655,8 +524,8 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
655 code_payload_len); 524 code_payload_len);
656 525
657 // Generate ECDH key 526 // Generate ECDH key
658 ecdh_priv = GNUNET_CRYPTO_ecdhe_key_create (); 527 GNUNET_CRYPTO_ecdhe_key_create (&ecdh_priv);
659 GNUNET_CRYPTO_ecdhe_key_get_public (ecdh_priv, &ecdh_pub); 528 GNUNET_CRYPTO_ecdhe_key_get_public (&ecdh_priv, &ecdh_pub);
660 // Initialize code payload 529 // Initialize code payload
661 code_payload = GNUNET_malloc (code_payload_len); 530 code_payload = GNUNET_malloc (code_payload_len);
662 GNUNET_assert (NULL != code_payload); 531 GNUNET_assert (NULL != code_payload);
@@ -669,23 +538,26 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
669 memcpy (buf_ptr, &ecdh_pub, sizeof(ecdh_pub)); 538 memcpy (buf_ptr, &ecdh_pub, sizeof(ecdh_pub));
670 buf_ptr += sizeof(ecdh_pub); 539 buf_ptr += sizeof(ecdh_pub);
671 // Encrypt plaintext and store 540 // Encrypt plaintext and store
672 encrypt_payload (&ticket->audience, ecdh_priv, payload, payload_len, buf_ptr); 541 encrypt_payload (&ticket->audience,
673 GNUNET_free (ecdh_priv); 542 &ecdh_priv,
543 payload,
544 payload_len,
545 buf_ptr);
674 GNUNET_free (payload); 546 GNUNET_free (payload);
675 buf_ptr += payload_len; 547 buf_ptr += payload_len;
676 // Sign and store signature 548 // Sign and store signature
677 if (GNUNET_SYSERR == 549 if (GNUNET_SYSERR ==
678 GNUNET_CRYPTO_ecdsa_sign (issuer, 550 GNUNET_CRYPTO_ecdsa_sign_ (issuer,
679 purpose, 551 purpose,
680 (struct GNUNET_CRYPTO_EcdsaSignature *) 552 (struct GNUNET_CRYPTO_EcdsaSignature *)
681 buf_ptr)) 553 buf_ptr))
682 { 554 {
683 GNUNET_break (0); 555 GNUNET_break (0);
684 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to sign code\n"); 556 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to sign code\n");
685 GNUNET_free (code_payload); 557 GNUNET_free (code_payload);
686 return NULL; 558 return NULL;
687 } 559 }
688 code_str = base64_and_urlencode (code_payload, code_payload_len); 560 GNUNET_STRINGS_base64url_encode (code_payload, code_payload_len, &code_str);
689 GNUNET_free (code_payload); 561 GNUNET_free (code_payload);
690 return code_str; 562 return code_str;
691} 563}
@@ -709,13 +581,15 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
709 const char *code, 581 const char *code,
710 const char *code_verifier, 582 const char *code_verifier,
711 struct GNUNET_RECLAIM_Ticket *ticket, 583 struct GNUNET_RECLAIM_Ticket *ticket,
712 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList **attrs, 584 struct GNUNET_RECLAIM_AttributeList **attrs,
585 struct GNUNET_RECLAIM_AttestationList **attests,
713 char **nonce_str) 586 char **nonce_str)
714{ 587{
715 char *code_payload; 588 char *code_payload;
716 char *ptr; 589 char *ptr;
717 char *plaintext; 590 char *plaintext;
718 char *attrs_ser; 591 char *attrs_ser;
592 char *attests_ser;
719 char *expected_code_challenge; 593 char *expected_code_challenge;
720 char *code_challenge; 594 char *code_challenge;
721 char *code_verifier_hash; 595 char *code_verifier_hash;
@@ -725,6 +599,7 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
725 struct GNUNET_CRYPTO_EcdhePublicKey *ecdh_pub; 599 struct GNUNET_CRYPTO_EcdhePublicKey *ecdh_pub;
726 uint32_t code_challenge_len; 600 uint32_t code_challenge_len;
727 uint32_t attrs_ser_len; 601 uint32_t attrs_ser_len;
602 uint32_t attests_ser_len;
728 size_t plaintext_len; 603 size_t plaintext_len;
729 size_t code_payload_len; 604 size_t code_payload_len;
730 uint32_t nonce = 0; 605 uint32_t nonce = 0;
@@ -733,7 +608,8 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
733 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to decode `%s'\n", code); 608 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to decode `%s'\n", code);
734 code_payload = NULL; 609 code_payload = NULL;
735 code_payload_len = 610 code_payload_len =
736 GNUNET_STRINGS_base64_decode (code, strlen (code), (void **) &code_payload); 611 GNUNET_STRINGS_base64url_decode (code, strlen (code),
612 (void **) &code_payload);
737 if (code_payload_len < sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) 613 if (code_payload_len < sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
738 + sizeof(struct GNUNET_CRYPTO_EcdhePublicKey) 614 + sizeof(struct GNUNET_CRYPTO_EcdhePublicKey)
739 + sizeof(struct OIDC_Parameters) 615 + sizeof(struct OIDC_Parameters)
@@ -780,7 +656,8 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
780 code_verifier, 656 code_verifier,
781 strlen (code_verifier)); 657 strlen (code_verifier));
782 // encode code verifier 658 // encode code verifier
783 expected_code_challenge = base64url_encode (code_verifier_hash, 256 / 8); 659 GNUNET_STRINGS_base64url_encode (code_verifier_hash, 256 / 8,
660 &expected_code_challenge);
784 code_challenge = (char *) &params[1]; 661 code_challenge = (char *) &params[1];
785 GNUNET_free (code_verifier_hash); 662 GNUNET_free (code_verifier_hash);
786 if ((strlen (expected_code_challenge) != code_challenge_len) || 663 if ((strlen (expected_code_challenge) != code_challenge_len) ||
@@ -814,10 +691,10 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
814 return GNUNET_SYSERR; 691 return GNUNET_SYSERR;
815 } 692 }
816 if (GNUNET_OK != 693 if (GNUNET_OK !=
817 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN, 694 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN,
818 purpose, 695 purpose,
819 signature, 696 signature,
820 &ticket->identity)) 697 &ticket->identity))
821 { 698 {
822 GNUNET_free (code_payload); 699 GNUNET_free (code_payload);
823 GNUNET_free (plaintext); 700 GNUNET_free (plaintext);
@@ -827,7 +704,11 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
827 // Attributes 704 // Attributes
828 attrs_ser = ((char *) &params[1]) + code_challenge_len; 705 attrs_ser = ((char *) &params[1]) + code_challenge_len;
829 attrs_ser_len = ntohl (params->attr_list_len); 706 attrs_ser_len = ntohl (params->attr_list_len);
830 *attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (attrs_ser, attrs_ser_len); 707 *attrs = GNUNET_RECLAIM_attribute_list_deserialize (attrs_ser, attrs_ser_len);
708 attests_ser = ((char*) attrs_ser) + attrs_ser_len;
709 attests_ser_len = ntohl (params->attest_list_len);
710 *attests = GNUNET_RECLAIM_attestation_list_deserialize (attests_ser,
711 attests_ser_len);
831 712
832 *nonce_str = NULL; 713 *nonce_str = NULL;
833 if (nonce != 0) 714 if (nonce != 0)
diff --git a/src/reclaim/oidc_helper.h b/src/reclaim/oidc_helper.h
index a7072755b..2c533357e 100644
--- a/src/reclaim/oidc_helper.h
+++ b/src/reclaim/oidc_helper.h
@@ -51,7 +51,8 @@
51char* 51char*
52OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, 52OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
53 const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, 53 const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key,
54 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 54 struct GNUNET_RECLAIM_AttributeList *attrs,
55 struct GNUNET_RECLAIM_AttestationList *attests,
55 const struct GNUNET_TIME_Relative *expiration_time, 56 const struct GNUNET_TIME_Relative *expiration_time,
56 const char *nonce, 57 const char *nonce,
57 const char *secret_key); 58 const char *secret_key);
@@ -70,7 +71,8 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
70char* 71char*
71OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, 72OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
72 const struct GNUNET_RECLAIM_Ticket *ticket, 73 const struct GNUNET_RECLAIM_Ticket *ticket,
73 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 74 struct GNUNET_RECLAIM_AttributeList *attrs,
75 struct GNUNET_RECLAIM_AttestationList *attests,
74 const char *nonce, 76 const char *nonce,
75 const char *code_challenge); 77 const char *code_challenge);
76 78
@@ -92,7 +94,8 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv,
92 const char *code, 94 const char *code,
93 const char *code_verifier, 95 const char *code_verifier,
94 struct GNUNET_RECLAIM_Ticket *ticket, 96 struct GNUNET_RECLAIM_Ticket *ticket,
95 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList **attrs, 97 struct GNUNET_RECLAIM_AttributeList **attrs,
98 struct GNUNET_RECLAIM_AttestationList **attests,
96 char **nonce); 99 char **nonce);
97 100
98/** 101/**
diff --git a/src/reclaim/plugin_gnsrecord_reclaim.c b/src/reclaim/plugin_gnsrecord_reclaim.c
index f7145a272..b91e123a3 100644
--- a/src/reclaim/plugin_gnsrecord_reclaim.c
+++ b/src/reclaim/plugin_gnsrecord_reclaim.c
@@ -44,18 +44,15 @@ value_to_string (void *cls, uint32_t type, const void *data, size_t data_size)
44{ 44{
45 switch (type) 45 switch (type)
46 { 46 {
47 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR:
48 return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
49
50 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT: 47 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
51 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT: 48 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
52 return GNUNET_strndup (data, data_size); 49 return GNUNET_strndup (data, data_size);
53 50 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE:
54 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF: 51 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF:
55 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: 52 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
56 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER: 53 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
57 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR: 54 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION:
58 case GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE: 55 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF:
59 return GNUNET_STRINGS_data_to_string_alloc (data, data_size); 56 return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
60 57
61 default: 58 default:
@@ -83,20 +80,17 @@ string_to_value (void *cls, uint32_t type, const char *s, void **data,
83 return GNUNET_SYSERR; 80 return GNUNET_SYSERR;
84 switch (type) 81 switch (type)
85 { 82 {
86 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR:
87 return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size);
88
89 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT: 83 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
90 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT: 84 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
91 *data = GNUNET_strdup (s); 85 *data = GNUNET_strdup (s);
92 *data_size = strlen (s); 86 *data_size = strlen (s);
93 return GNUNET_OK; 87 return GNUNET_OK;
94 88 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE:
95 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF: 89 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF:
96 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER: 90 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
97 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: 91 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
98 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR: 92 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION:
99 case GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE: 93 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF:
100 return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size); 94 return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size);
101 95
102 default: 96 default:
@@ -114,14 +108,14 @@ static struct
114 const char *name; 108 const char *name;
115 uint32_t number; 109 uint32_t number;
116} name_map[] = { 110} name_map[] = {
117 { "RECLAIM_ATTR", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR }, 111 { "RECLAIM_ATTRIBUTE", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE },
118 { "RECLAIM_ATTR_REF", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF }, 112 { "RECLAIM_ATTRIBUTE_REF", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF },
119 { "RECLAIM_ATTEST", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR }, 113 { "RECLAIM_ATTESTATION", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION },
114 { "RECLAIM_ATTESTATION_REF", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF },
120 { "RECLAIM_MASTER", GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER }, 115 { "RECLAIM_MASTER", GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER },
121 { "RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT }, 116 { "RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT },
122 { "RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT }, 117 { "RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT },
123 { "RECLAIM_TICKET", GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET }, 118 { "RECLAIM_TICKET", GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET },
124 { "RECLAIM_REFERENCE", GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE },
125 { NULL, UINT32_MAX } 119 { NULL, UINT32_MAX }
126}; 120};
127 121
diff --git a/src/reclaim/plugin_reclaim_attestation_jwt.c b/src/reclaim/plugin_reclaim_attestation_jwt.c
new file mode 100644
index 000000000..c87d3e61a
--- /dev/null
+++ b/src/reclaim/plugin_reclaim_attestation_jwt.c
@@ -0,0 +1,321 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 2016 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 * @file reclaim-attribute/plugin_reclaim_attestation_gnuid.c
23 * @brief reclaim-attribute-plugin-gnuid attribute plugin to provide the API for
24 * fundamental
25 * attribute types.
26 *
27 * @author Martin Schanzenbach
28 */
29#include "platform.h"
30#include "gnunet_util_lib.h"
31#include "gnunet_reclaim_plugin.h"
32#include <inttypes.h>
33#include <jansson.h>
34
35/**
36 * Convert the 'value' of an attestation to a string.
37 *
38 * @param cls closure, unused
39 * @param type type of the attestation
40 * @param data value in binary encoding
41 * @param data_size number of bytes in @a data
42 * @return NULL on error, otherwise human-readable representation of the value
43 */
44static char *
45jwt_value_to_string (void *cls,
46 uint32_t type,
47 const void *data,
48 size_t data_size)
49{
50 switch (type)
51 {
52 case GNUNET_RECLAIM_ATTESTATION_TYPE_JWT:
53 return GNUNET_strndup (data, data_size);
54
55 default:
56 return NULL;
57 }
58}
59
60
61/**
62 * Convert human-readable version of a 'value' of an attestation to the binary
63 * representation.
64 *
65 * @param cls closure, unused
66 * @param type type of the attestation
67 * @param s human-readable string
68 * @param data set to value in binary encoding (will be allocated)
69 * @param data_size set to number of bytes in @a data
70 * @return #GNUNET_OK on success
71 */
72static int
73jwt_string_to_value (void *cls,
74 uint32_t type,
75 const char *s,
76 void **data,
77 size_t *data_size)
78{
79 if (NULL == s)
80 return GNUNET_SYSERR;
81 switch (type)
82 {
83 case GNUNET_RECLAIM_ATTESTATION_TYPE_JWT:
84 *data = GNUNET_strdup (s);
85 *data_size = strlen (s);
86 return GNUNET_OK;
87
88 default:
89 return GNUNET_SYSERR;
90 }
91}
92
93
94/**
95 * Mapping of attestation type numbers to human-readable
96 * attestation type names.
97 */
98static struct
99{
100 const char *name;
101 uint32_t number;
102} jwt_attest_name_map[] = { { "JWT", GNUNET_RECLAIM_ATTESTATION_TYPE_JWT },
103 { NULL, UINT32_MAX } };
104
105/**
106 * Convert a type name to the corresponding number.
107 *
108 * @param cls closure, unused
109 * @param jwt_typename name to convert
110 * @return corresponding number, UINT32_MAX on error
111 */
112static uint32_t
113jwt_typename_to_number (void *cls, const char *jwt_typename)
114{
115 unsigned int i;
116
117 i = 0;
118 while ((NULL != jwt_attest_name_map[i].name) &&
119 (0 != strcasecmp (jwt_typename, jwt_attest_name_map[i].name)))
120 i++;
121 return jwt_attest_name_map[i].number;
122}
123
124
125/**
126 * Convert a type number (i.e. 1) to the corresponding type string
127 *
128 * @param cls closure, unused
129 * @param type number of a type to convert
130 * @return corresponding typestring, NULL on error
131 */
132static const char *
133jwt_number_to_typename (void *cls, uint32_t type)
134{
135 unsigned int i;
136
137 i = 0;
138 while ((NULL != jwt_attest_name_map[i].name) && (type !=
139 jwt_attest_name_map[i].
140 number))
141 i++;
142 return jwt_attest_name_map[i].name;
143}
144
145
146/**
147 * Parse a JWT and return the respective claim value as Attribute
148 *
149 * @param cls the plugin
150 * @param attest the jwt attestation
151 * @return a GNUNET_RECLAIM_Attribute, containing the new value
152 */
153struct GNUNET_RECLAIM_AttributeList *
154jwt_parse_attributes (void *cls,
155 const struct GNUNET_RECLAIM_Attestation *attest)
156{
157 char *jwt_string;
158 struct GNUNET_RECLAIM_AttributeList *attrs;
159 char delim[] = ".";
160 char *val_str = NULL;
161 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
162 char *decoded_jwt;
163 json_t *json_val;
164 json_error_t *json_err = NULL;
165
166 /* GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "%s\n", attest->data); (not OK: 'data' is not defined as 0-terminated text, but binary) */
167 if (GNUNET_RECLAIM_ATTESTATION_TYPE_JWT != attest->type)
168 return NULL;
169 attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
170
171 jwt_string = GNUNET_strdup (attest->data);
172 const char *jwt_body = strtok (jwt_string, delim);
173 jwt_body = strtok (NULL, delim);
174 GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body),
175 (void **) &decoded_jwt);
176 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", decoded_jwt);
177 GNUNET_assert (NULL != decoded_jwt);
178 json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
179 const char *key;
180 json_t *value;
181 json_object_foreach (json_val, key, value) {
182 if (0 == strcmp ("iss", key))
183 continue;
184 if (0 == strcmp ("exp", key))
185 continue;
186 if (0 == strcmp ("iat", key))
187 continue;
188 if (0 == strcmp ("nbf", key))
189 continue;
190 if (0 == strcmp ("aud", key))
191 continue;
192 val_str = json_dumps (value, JSON_ENCODE_ANY);
193 GNUNET_RECLAIM_attribute_list_add (attrs,
194 key,
195 NULL,
196 GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING,// FIXME
197 val_str,
198 strlen (val_str));
199 GNUNET_free (val_str);
200 }
201 GNUNET_free (jwt_string);
202 return attrs;
203}
204
205
206/**
207 * Parse a JWT and return the issuer
208 *
209 * @param cls the plugin
210 * @param attest the jwt attestation
211 * @return a string, containing the isser
212 */
213char *
214jwt_get_issuer (void *cls,
215 const struct GNUNET_RECLAIM_Attestation *attest)
216{
217 const char *jwt_body;
218 char *jwt_string;
219 char delim[] = ".";
220 char *issuer = NULL;
221 char *decoded_jwt;
222 json_t *issuer_json;
223 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
224 json_t *json_val;
225 json_error_t *json_err = NULL;
226
227 if (GNUNET_RECLAIM_ATTESTATION_TYPE_JWT != attest->type)
228 return NULL;
229 jwt_string = GNUNET_strdup (attest->data);
230 jwt_body = strtok (jwt_string, delim);
231 jwt_body = strtok (NULL, delim);
232 GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body),
233 (void **) &decoded_jwt);
234 json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
235 issuer_json = json_object_get (json_val, "iss");
236 if ((NULL == issuer_json) || (! json_is_string (issuer_json)))
237 return NULL;
238 issuer = GNUNET_strdup (json_string_value (issuer_json));
239 GNUNET_free (jwt_string);
240 return issuer;
241}
242
243
244/**
245 * Parse a JWT and return the expiration
246 *
247 * @param cls the plugin
248 * @param attest the jwt attestation
249 * @return a string, containing the isser
250 */
251int
252jwt_get_expiration (void *cls,
253 const struct GNUNET_RECLAIM_Attestation *attest,
254 struct GNUNET_TIME_Absolute *exp)
255{
256 const char *jwt_body;
257 char *jwt_string;
258 char delim[] = ".";
259 char *decoded_jwt;
260 json_t *exp_json;
261 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
262 json_t *json_val;
263 json_error_t *json_err = NULL;
264
265 if (GNUNET_RECLAIM_ATTESTATION_TYPE_JWT != attest->type)
266 return GNUNET_NO;
267 jwt_string = GNUNET_strdup (attest->data);
268 jwt_body = strtok (jwt_string, delim);
269 jwt_body = strtok (NULL, delim);
270 GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body),
271 (void **) &decoded_jwt);
272 json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
273 exp_json = json_object_get (json_val, "exp");
274 if ((NULL == exp_json) || (! json_is_integer (exp_json)))
275 return GNUNET_SYSERR;
276 exp->abs_value_us = json_integer_value (exp_json) * 1000 * 1000;
277 GNUNET_free (jwt_string);
278 return GNUNET_OK;
279}
280
281
282/**
283 * Entry point for the plugin.
284 *
285 * @param cls NULL
286 * @return the exported block API
287 */
288void *
289libgnunet_plugin_reclaim_attestation_jwt_init (void *cls)
290{
291 struct GNUNET_RECLAIM_AttestationPluginFunctions *api;
292
293 api = GNUNET_new (struct GNUNET_RECLAIM_AttestationPluginFunctions);
294 api->value_to_string = &jwt_value_to_string;
295 api->string_to_value = &jwt_string_to_value;
296 api->typename_to_number = &jwt_typename_to_number;
297 api->number_to_typename = &jwt_number_to_typename;
298 api->get_attributes = &jwt_parse_attributes;
299 api->get_issuer = &jwt_get_issuer;
300 api->get_expiration = &jwt_get_expiration;
301 return api;
302}
303
304
305/**
306 * Exit point from the plugin.
307 *
308 * @param cls the return value from #libgnunet_plugin_block_test_init()
309 * @return NULL
310 */
311void *
312libgnunet_plugin_reclaim_attestation_jwt_done (void *cls)
313{
314 struct GNUNET_RECLAIM_AttestationPluginFunctions *api = cls;
315
316 GNUNET_free (api);
317 return NULL;
318}
319
320
321/* end of plugin_reclaim_attestation_type_gnuid.c */
diff --git a/src/reclaim/plugin_reclaim_attribute_basic.c b/src/reclaim/plugin_reclaim_attribute_basic.c
new file mode 100644
index 000000000..47fdd5f11
--- /dev/null
+++ b/src/reclaim/plugin_reclaim_attribute_basic.c
@@ -0,0 +1,180 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 2016 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 * @file reclaim-attribute/plugin_reclaim_attribute_gnuid.c
23 * @brief reclaim-attribute-plugin-gnuid attribute plugin to provide the API for
24 * fundamental
25 * attribute types.
26 *
27 * @author Martin Schanzenbach
28 */
29#include "platform.h"
30#include "gnunet_util_lib.h"
31#include "gnunet_reclaim_plugin.h"
32#include <inttypes.h>
33
34
35/**
36 * Convert the 'value' of an attribute to a string.
37 *
38 * @param cls closure, unused
39 * @param type type of the attribute
40 * @param data value in binary encoding
41 * @param data_size number of bytes in @a data
42 * @return NULL on error, otherwise human-readable representation of the value
43 */
44static char *
45basic_value_to_string (void *cls,
46 uint32_t type,
47 const void *data,
48 size_t data_size)
49{
50 switch (type)
51 {
52 case GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING:
53 return GNUNET_strndup (data, data_size);
54
55 default:
56 return NULL;
57 }
58}
59
60
61/**
62 * Convert human-readable version of a 'value' of an attribute to the binary
63 * representation.
64 *
65 * @param cls closure, unused
66 * @param type type of the attribute
67 * @param s human-readable string
68 * @param data set to value in binary encoding (will be allocated)
69 * @param data_size set to number of bytes in @a data
70 * @return #GNUNET_OK on success
71 */
72static int
73basic_string_to_value (void *cls,
74 uint32_t type,
75 const char *s,
76 void **data,
77 size_t *data_size)
78{
79 if (NULL == s)
80 return GNUNET_SYSERR;
81 switch (type)
82 {
83 case GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING:
84 *data = GNUNET_strdup (s);
85 *data_size = strlen (s);
86 return GNUNET_OK;
87
88 default:
89 return GNUNET_SYSERR;
90 }
91}
92
93/**
94 * Mapping of attribute type numbers to human-readable
95 * attribute type names.
96 */
97static struct
98{
99 const char *name;
100 uint32_t number;
101} basic_name_map[] = { { "STRING", GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING },
102 { NULL, UINT32_MAX } };
103
104
105/**
106 * Convert a type name to the corresponding number.
107 *
108 * @param cls closure, unused
109 * @param basic_typename name to convert
110 * @return corresponding number, UINT32_MAX on error
111 */
112static uint32_t
113basic_typename_to_number (void *cls, const char *basic_typename)
114{
115 unsigned int i;
116
117 i = 0;
118 while ((NULL != basic_name_map[i].name) &&
119 (0 != strcasecmp (basic_typename, basic_name_map[i].name)))
120 i++;
121 return basic_name_map[i].number;
122}
123
124
125/**
126 * Convert a type number (i.e. 1) to the corresponding type string
127 *
128 * @param cls closure, unused
129 * @param type number of a type to convert
130 * @return corresponding typestring, NULL on error
131 */
132static const char *
133basic_number_to_typename (void *cls, uint32_t type)
134{
135 unsigned int i;
136
137 i = 0;
138 while ((NULL != basic_name_map[i].name) && (type != basic_name_map[i].number))
139 i++;
140 return basic_name_map[i].name;
141}
142
143
144/**
145 * Entry point for the plugin.
146 *
147 * @param cls NULL
148 * @return the exported block API
149 */
150void *
151libgnunet_plugin_reclaim_attribute_basic_init (void *cls)
152{
153 struct GNUNET_RECLAIM_AttributePluginFunctions *api;
154
155 api = GNUNET_new (struct GNUNET_RECLAIM_AttributePluginFunctions);
156 api->value_to_string = &basic_value_to_string;
157 api->string_to_value = &basic_string_to_value;
158 api->typename_to_number = &basic_typename_to_number;
159 api->number_to_typename = &basic_number_to_typename;
160 return api;
161}
162
163
164/**
165 * Exit point from the plugin.
166 *
167 * @param cls the return value from #libgnunet_plugin_block_test_init()
168 * @return NULL
169 */
170void *
171libgnunet_plugin_reclaim_attribute_basic_done (void *cls)
172{
173 struct GNUNET_RECLAIM_AttributePluginFunctions *api = cls;
174
175 GNUNET_free (api);
176 return NULL;
177}
178
179
180/* end of plugin_reclaim_attribute_type_gnuid.c */
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c
index 741094f21..563bdd749 100644
--- a/src/reclaim/plugin_rest_openid_connect.c
+++ b/src/reclaim/plugin_rest_openid_connect.c
@@ -32,7 +32,7 @@
32#include "gnunet_gnsrecord_lib.h" 32#include "gnunet_gnsrecord_lib.h"
33#include "gnunet_identity_service.h" 33#include "gnunet_identity_service.h"
34#include "gnunet_namestore_service.h" 34#include "gnunet_namestore_service.h"
35#include "gnunet_reclaim_attribute_lib.h" 35#include "gnunet_reclaim_lib.h"
36#include "gnunet_reclaim_service.h" 36#include "gnunet_reclaim_service.h"
37#include "gnunet_rest_lib.h" 37#include "gnunet_rest_lib.h"
38#include "gnunet_rest_plugin.h" 38#include "gnunet_rest_plugin.h"
@@ -426,9 +426,20 @@ struct RequestHandle
426 struct GNUNET_NAMESTORE_ZoneIterator *namestore_handle_it; 426 struct GNUNET_NAMESTORE_ZoneIterator *namestore_handle_it;
427 427
428 /** 428 /**
429 * Attribute claim list 429 * Attribute claim list for id_token
430 */ 430 */
431 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list; 431 struct GNUNET_RECLAIM_AttributeList *attr_idtoken_list;
432
433 /**
434 * Attribute claim list for userinfo
435 */
436 struct GNUNET_RECLAIM_AttributeList *attr_userinfo_list;
437
438 /**
439 * Attestation list
440 */
441 struct GNUNET_RECLAIM_AttestationList *attests_list;
442
432 443
433 /** 444 /**
434 * IDENTITY Operation 445 * IDENTITY Operation
@@ -451,6 +462,12 @@ struct RequestHandle
451 struct GNUNET_RECLAIM_AttributeIterator *attr_it; 462 struct GNUNET_RECLAIM_AttributeIterator *attr_it;
452 463
453 /** 464 /**
465 * Attestation iterator
466 */
467 struct GNUNET_RECLAIM_AttestationIterator *attest_it;
468
469
470 /**
454 * Ticket iterator 471 * Ticket iterator
455 */ 472 */
456 struct GNUNET_RECLAIM_TicketIterator *ticket_it; 473 struct GNUNET_RECLAIM_TicketIterator *ticket_it;
@@ -523,10 +540,7 @@ struct RequestHandle
523static void 540static void
524cleanup_handle (struct RequestHandle *handle) 541cleanup_handle (struct RequestHandle *handle)
525{ 542{
526 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_entry;
527 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_tmp;
528 struct EgoEntry *ego_entry; 543 struct EgoEntry *ego_entry;
529 struct EgoEntry *ego_tmp;
530 544
531 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n"); 545 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
532 if (NULL != handle->timeout_task) 546 if (NULL != handle->timeout_task)
@@ -535,8 +549,12 @@ cleanup_handle (struct RequestHandle *handle)
535 GNUNET_IDENTITY_disconnect (handle->identity_handle); 549 GNUNET_IDENTITY_disconnect (handle->identity_handle);
536 if (NULL != handle->attr_it) 550 if (NULL != handle->attr_it)
537 GNUNET_RECLAIM_get_attributes_stop (handle->attr_it); 551 GNUNET_RECLAIM_get_attributes_stop (handle->attr_it);
552 if (NULL != handle->attest_it)
553 GNUNET_RECLAIM_get_attestations_stop (handle->attest_it);
538 if (NULL != handle->ticket_it) 554 if (NULL != handle->ticket_it)
539 GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it); 555 GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it);
556 if (NULL != handle->idp_op)
557 GNUNET_RECLAIM_cancel (handle->idp_op);
540 if (NULL != handle->idp) 558 if (NULL != handle->idp)
541 GNUNET_RECLAIM_disconnect (handle->idp); 559 GNUNET_RECLAIM_disconnect (handle->idp);
542 GNUNET_free_non_null (handle->url); 560 GNUNET_free_non_null (handle->url);
@@ -564,29 +582,21 @@ cleanup_handle (struct RequestHandle *handle)
564 json_decref (handle->oidc->response); 582 json_decref (handle->oidc->response);
565 GNUNET_free (handle->oidc); 583 GNUNET_free (handle->oidc);
566 } 584 }
567 if (NULL != handle->attr_list) 585 if (NULL!=handle->attr_idtoken_list)
568 { 586 GNUNET_RECLAIM_attribute_list_destroy (handle->attr_idtoken_list);
569 for (claim_entry = handle->attr_list->list_head; NULL != claim_entry;) 587 if (NULL!=handle->attr_userinfo_list)
570 { 588 GNUNET_RECLAIM_attribute_list_destroy (handle->attr_userinfo_list);
571 claim_tmp = claim_entry; 589 if (NULL!=handle->attests_list)
572 claim_entry = claim_entry->next; 590 GNUNET_RECLAIM_attestation_list_destroy (handle->attests_list);
573 if (NULL != claim_tmp->claim) 591
574 GNUNET_free (claim_tmp->claim); 592 while (NULL != (ego_entry = handle->ego_head))
575 if (NULL != claim_tmp->attest)
576 GNUNET_free (claim_tmp->attest);
577 if (NULL != claim_tmp->reference)
578 GNUNET_free (claim_tmp->reference);
579 GNUNET_free (claim_tmp);
580 }
581 GNUNET_free (handle->attr_list);
582 }
583 for (ego_entry = handle->ego_head; NULL != ego_entry;)
584 { 593 {
585 ego_tmp = ego_entry; 594 GNUNET_CONTAINER_DLL_remove (handle->ego_head,
586 ego_entry = ego_entry->next; 595 handle->ego_tail,
587 GNUNET_free (ego_tmp->identifier); 596 ego_entry);
588 GNUNET_free (ego_tmp->keystring); 597 GNUNET_free_non_null (ego_entry->identifier);
589 GNUNET_free (ego_tmp); 598 GNUNET_free_non_null (ego_entry->keystring);
599 GNUNET_free (ego_entry);
590 } 600 }
591 GNUNET_free (handle); 601 GNUNET_free (handle);
592} 602}
@@ -930,10 +940,10 @@ oidc_ticket_issue_cb (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
930 ticket_str = 940 ticket_str =
931 GNUNET_STRINGS_data_to_string_alloc (&handle->ticket, 941 GNUNET_STRINGS_data_to_string_alloc (&handle->ticket,
932 sizeof(struct GNUNET_RECLAIM_Ticket)); 942 sizeof(struct GNUNET_RECLAIM_Ticket));
933 // TODO change if more attributes are needed (see max_age)
934 code_string = OIDC_build_authz_code (&handle->priv_key, 943 code_string = OIDC_build_authz_code (&handle->priv_key,
935 &handle->ticket, 944 &handle->ticket,
936 handle->attr_list, 945 handle->attr_idtoken_list,
946 handle->attests_list,
937 handle->oidc->nonce, 947 handle->oidc->nonce,
938 handle->oidc->code_challenge); 948 handle->oidc->code_challenge);
939 if ((NULL != handle->redirect_prefix) && (NULL != handle->redirect_suffix) && 949 if ((NULL != handle->redirect_prefix) && (NULL != handle->redirect_suffix) &&
@@ -967,131 +977,256 @@ oidc_ticket_issue_cb (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
967} 977}
968 978
969 979
980static struct GNUNET_RECLAIM_AttributeList*
981attribute_list_merge (struct GNUNET_RECLAIM_AttributeList *list_a,
982 struct GNUNET_RECLAIM_AttributeList *list_b)
983{
984 struct GNUNET_RECLAIM_AttributeList *merged_list;
985 struct GNUNET_RECLAIM_AttributeListEntry *le_a;
986 struct GNUNET_RECLAIM_AttributeListEntry *le_b;
987 struct GNUNET_RECLAIM_AttributeListEntry *le_m;
988
989 merged_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
990 for (le_a = list_a->list_head; NULL != le_a; le_a = le_a->next)
991 {
992 le_m = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
993 le_m->attribute = GNUNET_RECLAIM_attribute_new (le_a->attribute->name,
994 &le_a->attribute->
995 attestation,
996 le_a->attribute->type,
997 le_a->attribute->data,
998 le_a->attribute->data_size);
999 le_m->attribute->id = le_a->attribute->id;
1000 le_m->attribute->flag = le_a->attribute->flag;
1001 le_m->attribute->attestation = le_a->attribute->attestation;
1002 GNUNET_CONTAINER_DLL_insert (merged_list->list_head,
1003 merged_list->list_tail,
1004 le_m);
1005 }
1006 le_m = NULL;
1007 for (le_b = list_b->list_head; NULL != le_b; le_b = le_b->next)
1008 {
1009 for (le_m = merged_list->list_head; NULL != le_m; le_m = le_m->next)
1010 {
1011 if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&le_m->attribute->id,
1012 &le_b->attribute->id))
1013 break; /** Attribute already in list **/
1014 }
1015 if (NULL != le_m)
1016 continue; /** Attribute already in list **/
1017 le_m = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
1018 le_m->attribute = GNUNET_RECLAIM_attribute_new (le_b->attribute->name,
1019 &le_b->attribute->
1020 attestation,
1021 le_b->attribute->type,
1022 le_b->attribute->data,
1023 le_b->attribute->data_size);
1024 le_m->attribute->id = le_b->attribute->id;
1025 le_m->attribute->flag = le_b->attribute->flag;
1026 le_m->attribute->attestation = le_b->attribute->attestation;
1027 GNUNET_CONTAINER_DLL_insert (merged_list->list_head,
1028 merged_list->list_tail,
1029 le_m);
1030 }
1031 return merged_list;
1032}
1033
1034
970static void 1035static void
971oidc_collect_finished_cb (void *cls) 1036oidc_attest_collect_finished_cb (void *cls)
972{ 1037{
973 struct RequestHandle *handle = cls; 1038 struct RequestHandle *handle = cls;
1039 struct GNUNET_RECLAIM_AttributeList *merged_list;
974 1040
975 handle->attr_it = NULL; 1041 handle->attest_it = NULL;
976 handle->ticket_it = NULL; 1042 merged_list = attribute_list_merge (handle->attr_idtoken_list,
977 if (NULL == handle->attr_list->list_head) 1043 handle->attr_userinfo_list);
978 {
979 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_SCOPE);
980 handle->edesc = GNUNET_strdup ("The requested scope is not available.");
981 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle);
982 return;
983 }
984 handle->idp_op = GNUNET_RECLAIM_ticket_issue (handle->idp, 1044 handle->idp_op = GNUNET_RECLAIM_ticket_issue (handle->idp,
985 &handle->priv_key, 1045 &handle->priv_key,
986 &handle->oidc->client_pkey, 1046 &handle->oidc->client_pkey,
987 handle->attr_list, 1047 merged_list,
988 &oidc_ticket_issue_cb, 1048 &oidc_ticket_issue_cb,
989 handle); 1049 handle);
1050 GNUNET_RECLAIM_attribute_list_destroy (merged_list);
990} 1051}
991 1052
992 1053
993/** 1054/**
994 * Collects all attributes/references for an ego if in scope parameter 1055 * Collects all attributes for an ego if in scope parameter
995 */ 1056 */
996static void 1057static void
997oidc_attr_collect (void *cls, 1058oidc_attest_collect (void *cls,
998 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1059 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
999 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 1060 const struct GNUNET_RECLAIM_Attestation *attest)
1000 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
1001 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
1002{ 1061{
1003 struct RequestHandle *handle = cls; 1062 struct RequestHandle *handle = cls;
1004 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 1063 struct GNUNET_RECLAIM_AttributeListEntry *le;
1005 char *scope_variables; 1064 struct GNUNET_RECLAIM_AttestationListEntry *ale;
1006 char *scope_variable;
1007 char delimiter[] = " ";
1008 1065
1009 if ((NULL == attr) && (NULL == reference)) 1066 for (ale = handle->attests_list->list_head; NULL != ale; ale = ale->next)
1010 { 1067 {
1011 GNUNET_RECLAIM_get_attributes_next (handle->attr_it); 1068 if (GNUNET_NO == GNUNET_RECLAIM_id_is_equal (&ale->attestation->id,
1069 &attest->id))
1070 continue;
1071 /** Attestation already in list **/
1072 GNUNET_RECLAIM_get_attestations_next (handle->attest_it);
1012 return; 1073 return;
1013 } 1074 }
1014 if (NULL != reference) 1075
1076 for (le = handle->attr_idtoken_list->list_head; NULL != le; le = le->next)
1015 { 1077 {
1016 if ((NULL == reference->name) || (NULL == reference->reference_value)) 1078 if (GNUNET_NO == GNUNET_RECLAIM_id_is_equal (&le->attribute->attestation,
1017 { 1079 &attest->id))
1018 return; 1080 continue;
1019 } 1081 /** Attestation matches for attribute, add **/
1020 scope_variables = GNUNET_strdup (handle->oidc->scope); 1082 ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry);
1021 scope_variable = strtok (scope_variables, delimiter); 1083 ale->attestation = GNUNET_RECLAIM_attestation_new (attest->name,
1022 while (NULL != scope_variable)
1023 {
1024 if (0 == strcmp (reference->name, scope_variable))
1025 break;
1026 scope_variable = strtok (NULL, delimiter);
1027 }
1028 if (NULL == scope_variable)
1029 {
1030 GNUNET_free (scope_variables);
1031 return;
1032 }
1033 GNUNET_free (scope_variables);
1034 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le2;
1035 le2 = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
1036 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
1037 le->claim = NULL;
1038 le->reference = NULL;
1039 le->attest = GNUNET_RECLAIM_ATTESTATION_claim_new (attest->name,
1040 attest->type, 1084 attest->type,
1041 attest->data, 1085 attest->data,
1042 attest->data_size); 1086 attest->data_size);
1043 le->attest->id = attest->id; 1087 GNUNET_CONTAINER_DLL_insert (handle->attests_list->list_head,
1044 le2->attest = NULL; 1088 handle->attests_list->list_tail,
1045 le2->claim = NULL; 1089 ale);
1046 le2->reference = GNUNET_RECLAIM_ATTESTATION_reference_new (reference->name,
1047 reference->
1048 reference_value);
1049 le2->reference->id = reference->id;
1050 le2->reference->id_attest = reference->id_attest;
1051 GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head,
1052 handle->attr_list->list_tail,
1053 le);
1054 GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head,
1055 handle->attr_list->list_tail,
1056 le2);
1057 } 1090 }
1058 else if (NULL != attr) 1091 GNUNET_RECLAIM_get_attestations_next (handle->attest_it);
1092}
1093
1094
1095static void
1096oidc_attr_collect_finished_cb (void *cls)
1097{
1098 struct RequestHandle *handle = cls;
1099
1100 handle->attr_it = NULL;
1101 handle->ticket_it = NULL;
1102 if (NULL == handle->attr_idtoken_list->list_head)
1059 { 1103 {
1060 if ((NULL == attr->name) || (NULL == attr->data)) 1104 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_SCOPE);
1061 { 1105 handle->edesc = GNUNET_strdup ("The requested scope is not available.");
1062 GNUNET_RECLAIM_get_attributes_next (handle->attr_it); 1106 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle);
1063 return; 1107 return;
1064 } 1108 }
1065 scope_variables = GNUNET_strdup (handle->oidc->scope); 1109 handle->attests_list = GNUNET_new (struct GNUNET_RECLAIM_AttestationList);
1066 scope_variable = strtok (scope_variables, delimiter); 1110 handle->attest_it =
1067 while (NULL != scope_variable) 1111 GNUNET_RECLAIM_get_attestations_start (handle->idp,
1112 &handle->priv_key,
1113 &oidc_iteration_error,
1114 handle,
1115 &oidc_attest_collect,
1116 handle,
1117 &oidc_attest_collect_finished_cb,
1118 handle);
1119
1120}
1121
1122
1123static int
1124attr_in_claims_request (struct RequestHandle *handle,
1125 const char *attr_name,
1126 const char *claims_parameter)
1127{
1128 char *scope_variables;
1129 char *scope_variable;
1130 char delimiter[] = " ";
1131 int ret = GNUNET_NO;
1132 json_t *root;
1133 json_error_t error;
1134 json_t *claims_j;
1135 const char *key;
1136 json_t *value;
1137
1138 scope_variables = GNUNET_strdup (handle->oidc->scope);
1139 scope_variable = strtok (scope_variables, delimiter);
1140 while (NULL != scope_variable)
1141 {
1142 if (0 == strcmp (attr_name, scope_variable))
1143 break;
1144 scope_variable = strtok (NULL, delimiter);
1145 }
1146 if (NULL != scope_variable)
1147 ret = GNUNET_YES;
1148 GNUNET_free (scope_variables);
1149
1150 /** Try claims parameter if no in scope */
1151 if ((NULL != handle->oidc->claims) &&
1152 (GNUNET_YES != ret))
1153 {
1154 root = json_loads (handle->oidc->claims, JSON_DECODE_ANY, &error);
1155 claims_j = json_object_get (root, claims_parameter);
1156 /* obj is a JSON object */
1157 if (NULL != claims_j)
1068 { 1158 {
1069 if (0 == strcmp (attr->name, scope_variable)) 1159 json_object_foreach (claims_j, key, value) {
1160 if (0 != strcmp (attr_name, key))
1161 continue;
1162 ret = GNUNET_YES;
1070 break; 1163 break;
1071 scope_variable = strtok (NULL, delimiter); 1164 }
1072 }
1073 if (NULL == scope_variable)
1074 {
1075 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
1076 GNUNET_free (scope_variables);
1077 return;
1078 } 1165 }
1079 GNUNET_free (scope_variables); 1166 json_decref (root);
1080 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); 1167 }
1081 le->reference = NULL; 1168 return ret;
1082 le->attest = NULL; 1169}
1083 le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name, 1170
1084 attr->type, 1171
1085 attr->data, 1172static int
1086 attr->data_size); 1173attr_in_idtoken_request (struct RequestHandle *handle,
1087 le->claim->id = attr->id; 1174 const char *attr_name)
1088 le->claim->flag = attr->flag; 1175{
1089 1176 return attr_in_claims_request (handle, attr_name, "id_token");
1090 GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head, 1177}
1091 handle->attr_list->list_tail, 1178
1179
1180static int
1181attr_in_userinfo_request (struct RequestHandle *handle,
1182 const char *attr_name)
1183{
1184 return attr_in_claims_request (handle, attr_name, "userinfo");
1185}
1186
1187
1188/**
1189 * Collects all attributes for an ego if in scope parameter
1190 */
1191static void
1192oidc_attr_collect (void *cls,
1193 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
1194 const struct GNUNET_RECLAIM_Attribute *attr)
1195{
1196 struct RequestHandle *handle = cls;
1197 struct GNUNET_RECLAIM_AttributeListEntry *le;
1198 if (GNUNET_YES == attr_in_idtoken_request (handle, attr->name))
1199 {
1200 le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
1201 le->attribute = GNUNET_RECLAIM_attribute_new (attr->name,
1202 &attr->attestation,
1203 attr->type,
1204 attr->data,
1205 attr->data_size);
1206 le->attribute->id = attr->id;
1207 le->attribute->flag = attr->flag;
1208 le->attribute->attestation = attr->attestation;
1209 GNUNET_CONTAINER_DLL_insert (handle->attr_idtoken_list->list_head,
1210 handle->attr_idtoken_list->list_tail,
1092 le); 1211 le);
1093 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
1094 } 1212 }
1213 if (GNUNET_YES == attr_in_userinfo_request (handle, attr->name))
1214 {
1215 le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
1216 le->attribute = GNUNET_RECLAIM_attribute_new (attr->name,
1217 &attr->attestation,
1218 attr->type,
1219 attr->data,
1220 attr->data_size);
1221 le->attribute->id = attr->id;
1222 le->attribute->flag = attr->flag;
1223 le->attribute->attestation = attr->attestation;
1224 GNUNET_CONTAINER_DLL_insert (handle->attr_userinfo_list->list_head,
1225 handle->attr_userinfo_list->list_tail,
1226 le);
1227 }
1228
1229 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
1095} 1230}
1096 1231
1097 1232
@@ -1148,8 +1283,10 @@ code_redirect (void *cls)
1148 handle->priv_key = 1283 handle->priv_key =
1149 *GNUNET_IDENTITY_ego_get_private_key (handle->ego_entry->ego); 1284 *GNUNET_IDENTITY_ego_get_private_key (handle->ego_entry->ego);
1150 handle->idp = GNUNET_RECLAIM_connect (cfg); 1285 handle->idp = GNUNET_RECLAIM_connect (cfg);
1151 handle->attr_list = 1286 handle->attr_idtoken_list =
1152 GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList); 1287 GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
1288 handle->attr_userinfo_list =
1289 GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
1153 handle->attr_it = 1290 handle->attr_it =
1154 GNUNET_RECLAIM_get_attributes_start (handle->idp, 1291 GNUNET_RECLAIM_get_attributes_start (handle->idp,
1155 &handle->priv_key, 1292 &handle->priv_key,
@@ -1157,7 +1294,7 @@ code_redirect (void *cls)
1157 handle, 1294 handle,
1158 &oidc_attr_collect, 1295 &oidc_attr_collect,
1159 handle, 1296 handle,
1160 &oidc_collect_finished_cb, 1297 &oidc_attr_collect_finished_cb,
1161 handle); 1298 handle);
1162 return; 1299 return;
1163 } 1300 }
@@ -1531,8 +1668,7 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1531 } 1668 }
1532 } 1669 }
1533 handle->oidc->scope = get_url_parameter_copy (handle, OIDC_SCOPE_KEY); 1670 handle->oidc->scope = get_url_parameter_copy (handle, OIDC_SCOPE_KEY);
1534 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Scope: %s\n",GNUNET_strdup ( 1671 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Scope: %s\n", handle->oidc->scope);
1535 handle->oidc->scope));
1536 if (NULL == handle->tld) 1672 if (NULL == handle->tld)
1537 GNUNET_CONFIGURATION_iterate_section_values (cfg, "gns", tld_iter, handle); 1673 GNUNET_CONFIGURATION_iterate_section_values (cfg, "gns", tld_iter, handle);
1538 if (NULL == handle->tld) 1674 if (NULL == handle->tld)
@@ -1784,7 +1920,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1784 struct RequestHandle *handle = cls; 1920 struct RequestHandle *handle = cls;
1785 const struct EgoEntry *ego_entry; 1921 const struct EgoEntry *ego_entry;
1786 struct GNUNET_TIME_Relative expiration_time; 1922 struct GNUNET_TIME_Relative expiration_time;
1787 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *cl; 1923 struct GNUNET_RECLAIM_AttributeList *cl = NULL;
1924 struct GNUNET_RECLAIM_AttestationList *al = NULL;
1788 struct GNUNET_RECLAIM_Ticket ticket; 1925 struct GNUNET_RECLAIM_Ticket ticket;
1789 struct GNUNET_CRYPTO_EcdsaPublicKey cid; 1926 struct GNUNET_CRYPTO_EcdsaPublicKey cid;
1790 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 1927 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
@@ -1872,7 +2009,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1872 2009
1873 // decode code 2010 // decode code
1874 if (GNUNET_OK != OIDC_parse_authz_code (privkey, code, code_verifier, &ticket, 2011 if (GNUNET_OK != OIDC_parse_authz_code (privkey, code, code_verifier, &ticket,
1875 &cl, &nonce)) 2012 &cl, &al, &nonce))
1876 { 2013 {
1877 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST); 2014 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST);
1878 handle->edesc = GNUNET_strdup ("invalid code"); 2015 handle->edesc = GNUNET_strdup ("invalid code");
@@ -1912,6 +2049,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1912 id_token = OIDC_id_token_new (&ticket.audience, 2049 id_token = OIDC_id_token_new (&ticket.audience,
1913 &ticket.identity, 2050 &ticket.identity,
1914 cl, 2051 cl,
2052 al,
1915 &expiration_time, 2053 &expiration_time,
1916 (NULL != nonce) ? nonce : NULL, 2054 (NULL != nonce) ? nonce : NULL,
1917 jwt_secret); 2055 jwt_secret);
@@ -1927,7 +2065,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1927 MHD_add_response_header (resp, "Pragma", "no-cache"); 2065 MHD_add_response_header (resp, "Pragma", "no-cache");
1928 MHD_add_response_header (resp, "Content-Type", "application/json"); 2066 MHD_add_response_header (resp, "Content-Type", "application/json");
1929 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 2067 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
1930 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (cl); 2068 GNUNET_RECLAIM_attribute_list_destroy (cl);
2069 GNUNET_RECLAIM_attestation_list_destroy (al);
1931 GNUNET_free (access_token); 2070 GNUNET_free (access_token);
1932 GNUNET_free (json_response); 2071 GNUNET_free (json_response);
1933 GNUNET_free (id_token); 2072 GNUNET_free (id_token);
@@ -1936,97 +2075,92 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1936 2075
1937 2076
1938/** 2077/**
1939 * Collects claims and stores them in handle 2078 * Collects claims and stores them in handle
1940 */ 2079 */
1941static void 2080static void
1942consume_ticket (void *cls, 2081consume_ticket (void *cls,
1943 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 2082 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
1944 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 2083 const struct GNUNET_RECLAIM_Attribute *attr,
1945 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 2084 const struct GNUNET_RECLAIM_Attestation *attest)
1946 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
1947{ 2085{
1948 struct RequestHandle *handle = cls; 2086 struct RequestHandle *handle = cls;
2087 handle->idp_op = NULL;
2088
1949 if (NULL == identity) 2089 if (NULL == identity)
1950 { 2090 {
1951 GNUNET_SCHEDULER_add_now (&return_userinfo_response, handle); 2091 GNUNET_SCHEDULER_add_now (&return_userinfo_response, handle);
1952 return; 2092 return;
1953 } 2093 }
1954 if (NULL != attr) 2094 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attr->attestation))
1955 { 2095 {
1956 char *tmp_value; 2096 char *tmp_value;
1957 json_t *value; 2097 json_t *value;
1958 tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type, 2098 tmp_value = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
1959 attr->data, 2099 attr->data,
1960 attr->data_size); 2100 attr->data_size);
1961 value = json_string (tmp_value); 2101 value = json_string (tmp_value);
1962 json_object_set_new (handle->oidc->response, attr->name, value); 2102 json_object_set_new (handle->oidc->response, attr->name, value);
1963 GNUNET_free (tmp_value); 2103 GNUNET_free (tmp_value);
2104 return;
1964 } 2105 }
1965 else if ((NULL != attest) && (NULL != reference)) 2106 json_t *claim_sources;
1966 { 2107 json_t *claim_sources_jwt;
1967 json_t *claim_sources; 2108 json_t *claim_names;
1968 json_t *claim_sources_jwt; 2109 char *attest_val_str;
1969 json_t *claim_names; 2110 claim_sources = json_object_get (handle->oidc->response,"_claim_sources");
1970 char *attest_val_str; 2111 claim_names = json_object_get (handle->oidc->response,"_claim_names");
1971 claim_sources=json_object_get(handle->oidc->response,"_claim_sources"); 2112 attest_val_str =
1972 claim_names=json_object_get(handle->oidc->response,"_claim_names"); 2113 GNUNET_RECLAIM_attestation_value_to_string (attest->type,
1973 attest_val_str = GNUNET_RECLAIM_ATTESTATION_value_to_string (attest->type, 2114 attest->data,
1974 attest->data, 2115 attest->data_size);
1975 attest-> 2116 if ((NULL == claim_sources) && (NULL == claim_names) )
1976 data_size); 2117 {
1977 if ((NULL == claim_sources) && (NULL == claim_names) ) 2118 claim_sources = json_object ();
1978 { 2119 claim_names = json_object ();
1979 claim_sources = json_object (); 2120 }
1980 claim_names = json_object (); 2121 char *source_name;
1981 } 2122 int i = 0;
1982 char *source_name; 2123 GNUNET_asprintf (&source_name, "src%d", i);
1983 int i = 0; 2124 while (NULL != (claim_sources_jwt = json_object_get (claim_sources,
1984 GNUNET_asprintf (&source_name,"src%d",i); 2125 source_name)))
1985 while (NULL != (claim_sources_jwt = json_object_get (claim_sources, 2126 {
1986 source_name))) 2127 if (0 == strcmp (json_string_value (json_object_get (claim_sources_jwt,
1987 { 2128 "JWT")),
1988 if (0 == strcmp (json_string_value (json_object_get (claim_sources_jwt, 2129 attest_val_str))
1989 "JWT")),
1990 attest_val_str))
1991 {
1992 // Adapt only the claim names
1993 json_object_set_new (claim_names, reference->name, json_string (
1994 source_name));
1995 json_object_set (handle->oidc->response, "_claim_names",claim_names);
1996 handle->oidc->response = json_deep_copy(handle->oidc->response);
1997 break;
1998 }
1999 i++;
2000 GNUNET_asprintf (&source_name,"src%d",i);
2001 }
2002
2003 // Create new one
2004 if (NULL == claim_sources_jwt)
2005 { 2130 {
2006 claim_sources_jwt = json_object (); 2131 // Adapt only the claim names
2007 // Set the JWT for names 2132 json_object_set_new (claim_names, attr->data,
2008 json_object_set_new (claim_names, reference->name, json_string ( 2133 json_string (source_name));
2009 source_name)); 2134 json_object_set (handle->oidc->response,
2010 // Set the JWT for the inner source 2135 "_claim_names", claim_names);
2011 json_object_set_new (claim_sources_jwt, "JWT", json_string ( 2136 break;
2012 attest_val_str));
2013 // Set the JWT for the source
2014 json_object_set_new (claim_sources, source_name,claim_sources_jwt);
2015 // Set as claims
2016 json_object_set (handle->oidc->response, "_claim_names", claim_names);
2017 json_object_set (handle->oidc->response, "_claim_sources",claim_sources);
2018 handle->oidc->response = json_deep_copy(handle->oidc->response);
2019 } 2137 }
2020 2138 i++;
2021 json_decref (claim_sources); 2139 GNUNET_free (source_name);
2022 json_decref (claim_names); 2140 GNUNET_asprintf (&source_name, "src%d", i);
2023 json_decref (claim_sources_jwt); 2141 }
2024 GNUNET_free (attest_val_str); 2142
2025 } 2143 // Create new one
2026 else 2144 if (NULL == claim_sources_jwt)
2027 { 2145 {
2028 // REMARK: We should not find any claim, one of attest/ref is NULL 2146 claim_sources_jwt = json_object ();
2029 } 2147 // Set the JWT for names
2148 json_object_set_new (claim_names, attr->data,
2149 json_string (source_name));
2150 // Set the JWT for the inner source
2151 json_object_set_new (claim_sources_jwt, "JWT",
2152 json_string (attest_val_str));
2153 // Set the JWT for the source
2154 json_object_set_new (claim_sources, source_name, claim_sources_jwt);
2155 // Set as claims
2156 json_object_set (handle->oidc->response, "_claim_names", claim_names);
2157 json_object_set (handle->oidc->response, "_claim_sources",claim_sources);
2158 }
2159
2160 json_decref (claim_sources);
2161 json_decref (claim_names);
2162 json_decref (claim_sources_jwt);
2163 GNUNET_free (attest_val_str);
2030} 2164}
2031 2165
2032 2166
@@ -2266,10 +2400,16 @@ list_ego (void *cls,
2266 if (ego_entry->ego == ego) 2400 if (ego_entry->ego == ego)
2267 break; 2401 break;
2268 } 2402 }
2269 if (NULL != ego_entry) 2403 if (NULL == ego_entry)
2270 GNUNET_CONTAINER_DLL_remove (handle->ego_head, 2404 return; /* Not found */
2271 handle->ego_tail, 2405
2272 ego_entry); 2406 GNUNET_CONTAINER_DLL_remove (handle->ego_head,
2407 handle->ego_tail,
2408 ego_entry);
2409 GNUNET_free (ego_entry->identifier);
2410 GNUNET_free (ego_entry->keystring);
2411 GNUNET_free (ego_entry);
2412 return;
2273 } 2413 }
2274} 2414}
2275 2415
@@ -2283,7 +2423,8 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
2283 2423
2284 handle->oidc = GNUNET_new (struct OIDC_Variables); 2424 handle->oidc = GNUNET_new (struct OIDC_Variables);
2285 if (NULL == OIDC_cookie_jar_map) 2425 if (NULL == OIDC_cookie_jar_map)
2286 OIDC_cookie_jar_map = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); 2426 OIDC_cookie_jar_map = GNUNET_CONTAINER_multihashmap_create (10,
2427 GNUNET_NO);
2287 if (NULL == OIDC_access_token_map) 2428 if (NULL == OIDC_access_token_map)
2288 OIDC_access_token_map = 2429 OIDC_access_token_map =
2289 GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); 2430 GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
@@ -2308,11 +2449,11 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
2308 2449
2309 2450
2310/** 2451/**
2311 * Entry point for the plugin. 2452 * Entry point for the plugin.
2312 * 2453 *
2313 * @param cls Config info 2454 * @param cls Config info
2314 * @return NULL on error, otherwise the plugin context 2455 * @return NULL on error, otherwise the plugin context
2315 */ 2456 */
2316void * 2457void *
2317libgnunet_plugin_rest_openid_connect_init (void *cls) 2458libgnunet_plugin_rest_openid_connect_init (void *cls)
2318{ 2459{
@@ -2321,7 +2462,7 @@ libgnunet_plugin_rest_openid_connect_init (void *cls)
2321 2462
2322 cfg = cls; 2463 cfg = cls;
2323 if (NULL != plugin.cfg) 2464 if (NULL != plugin.cfg)
2324 return NULL; /* can only initialize once! */ 2465 return NULL; /* can only initialize once! */
2325 memset (&plugin, 0, sizeof(struct Plugin)); 2466 memset (&plugin, 0, sizeof(struct Plugin));
2326 plugin.cfg = cfg; 2467 plugin.cfg = cfg;
2327 api = GNUNET_new (struct GNUNET_REST_Plugin); 2468 api = GNUNET_new (struct GNUNET_REST_Plugin);
@@ -2343,11 +2484,11 @@ libgnunet_plugin_rest_openid_connect_init (void *cls)
2343 2484
2344 2485
2345/** 2486/**
2346 * Exit point from the plugin. 2487 * Exit point from the plugin.
2347 * 2488 *
2348 * @param cls the plugin context (as returned by "init") 2489 * @param cls the plugin context (as returned by "init")
2349 * @return always NULL 2490 * @return always NULL
2350 */ 2491 */
2351void * 2492void *
2352libgnunet_plugin_rest_openid_connect_done (void *cls) 2493libgnunet_plugin_rest_openid_connect_done (void *cls)
2353{ 2494{
@@ -2361,7 +2502,8 @@ libgnunet_plugin_rest_openid_connect_done (void *cls)
2361 hashmap_it = 2502 hashmap_it =
2362 GNUNET_CONTAINER_multihashmap_iterator_create (OIDC_cookie_jar_map); 2503 GNUNET_CONTAINER_multihashmap_iterator_create (OIDC_cookie_jar_map);
2363 while (GNUNET_YES == 2504 while (GNUNET_YES ==
2364 GNUNET_CONTAINER_multihashmap_iterator_next (hashmap_it, NULL, value)) 2505 GNUNET_CONTAINER_multihashmap_iterator_next (hashmap_it, NULL,
2506 value))
2365 GNUNET_free_non_null (value); 2507 GNUNET_free_non_null (value);
2366 GNUNET_CONTAINER_multihashmap_iterator_destroy (hashmap_it); 2508 GNUNET_CONTAINER_multihashmap_iterator_destroy (hashmap_it);
2367 GNUNET_CONTAINER_multihashmap_destroy (OIDC_cookie_jar_map); 2509 GNUNET_CONTAINER_multihashmap_destroy (OIDC_cookie_jar_map);
@@ -2369,7 +2511,8 @@ libgnunet_plugin_rest_openid_connect_done (void *cls)
2369 hashmap_it = 2511 hashmap_it =
2370 GNUNET_CONTAINER_multihashmap_iterator_create (OIDC_access_token_map); 2512 GNUNET_CONTAINER_multihashmap_iterator_create (OIDC_access_token_map);
2371 while (GNUNET_YES == 2513 while (GNUNET_YES ==
2372 GNUNET_CONTAINER_multihashmap_iterator_next (hashmap_it, NULL, value)) 2514 GNUNET_CONTAINER_multihashmap_iterator_next (hashmap_it, NULL,
2515 value))
2373 GNUNET_free_non_null (value); 2516 GNUNET_free_non_null (value);
2374 GNUNET_CONTAINER_multihashmap_destroy (OIDC_access_token_map); 2517 GNUNET_CONTAINER_multihashmap_destroy (OIDC_access_token_map);
2375 GNUNET_CONTAINER_multihashmap_iterator_destroy (hashmap_it); 2518 GNUNET_CONTAINER_multihashmap_iterator_destroy (hashmap_it);
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c
index dcda75b65..0800e5b20 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -31,7 +31,7 @@
31#include "gnunet_gns_service.h" 31#include "gnunet_gns_service.h"
32#include "gnunet_gnsrecord_lib.h" 32#include "gnunet_gnsrecord_lib.h"
33#include "gnunet_identity_service.h" 33#include "gnunet_identity_service.h"
34#include "gnunet_reclaim_attribute_lib.h" 34#include "gnunet_reclaim_lib.h"
35#include "gnunet_reclaim_service.h" 35#include "gnunet_reclaim_service.h"
36#include "gnunet_rest_lib.h" 36#include "gnunet_rest_lib.h"
37#include "gnunet_rest_plugin.h" 37#include "gnunet_rest_plugin.h"
@@ -48,9 +48,9 @@
48#define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes" 48#define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes"
49 49
50/** 50/**
51 * Attestation namespace 51 * Attestation namespace
52 */ 52 */
53#define GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE "/reclaim/attestation" 53#define GNUNET_REST_API_NS_RECLAIM_ATTESTATION "/reclaim/attestation"
54 54
55/** 55/**
56 * Ticket namespace 56 * Ticket namespace
@@ -167,7 +167,7 @@ struct RequestHandle
167 /** 167 /**
168 * Attribute claim list 168 * Attribute claim list
169 */ 169 */
170 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list; 170 struct GNUNET_RECLAIM_AttributeList *attr_list;
171 171
172 /** 172 /**
173 * IDENTITY Operation 173 * IDENTITY Operation
@@ -190,6 +190,12 @@ struct RequestHandle
190 struct GNUNET_RECLAIM_AttributeIterator *attr_it; 190 struct GNUNET_RECLAIM_AttributeIterator *attr_it;
191 191
192 /** 192 /**
193 * Attribute iterator
194 */
195 struct GNUNET_RECLAIM_AttestationIterator *attest_it;
196
197
198 /**
193 * Ticket iterator 199 * Ticket iterator
194 */ 200 */
195 struct GNUNET_RECLAIM_TicketIterator *ticket_it; 201 struct GNUNET_RECLAIM_TicketIterator *ticket_it;
@@ -247,8 +253,6 @@ struct RequestHandle
247static void 253static void
248cleanup_handle (struct RequestHandle *handle) 254cleanup_handle (struct RequestHandle *handle)
249{ 255{
250 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_entry;
251 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_tmp;
252 struct EgoEntry *ego_entry; 256 struct EgoEntry *ego_entry;
253 struct EgoEntry *ego_tmp; 257 struct EgoEntry *ego_tmp;
254 258
@@ -261,6 +265,8 @@ cleanup_handle (struct RequestHandle *handle)
261 GNUNET_IDENTITY_disconnect (handle->identity_handle); 265 GNUNET_IDENTITY_disconnect (handle->identity_handle);
262 if (NULL != handle->attr_it) 266 if (NULL != handle->attr_it)
263 GNUNET_RECLAIM_get_attributes_stop (handle->attr_it); 267 GNUNET_RECLAIM_get_attributes_stop (handle->attr_it);
268 if (NULL != handle->attest_it)
269 GNUNET_RECLAIM_get_attestations_stop (handle->attest_it);
264 if (NULL != handle->ticket_it) 270 if (NULL != handle->ticket_it)
265 GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it); 271 GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it);
266 if (NULL != handle->idp) 272 if (NULL != handle->idp)
@@ -270,18 +276,7 @@ cleanup_handle (struct RequestHandle *handle)
270 if (NULL != handle->emsg) 276 if (NULL != handle->emsg)
271 GNUNET_free (handle->emsg); 277 GNUNET_free (handle->emsg);
272 if (NULL != handle->attr_list) 278 if (NULL != handle->attr_list)
273 { 279 GNUNET_RECLAIM_attribute_list_destroy (handle->attr_list);
274 for (claim_entry = handle->attr_list->list_head; NULL != claim_entry;)
275 {
276 claim_tmp = claim_entry;
277 claim_entry = claim_entry->next;
278 GNUNET_free (claim_tmp->claim);
279 GNUNET_free (claim_tmp->attest);
280 GNUNET_free (claim_tmp->reference);
281 GNUNET_free (claim_tmp);
282 }
283 GNUNET_free (handle->attr_list);
284 }
285 for (ego_entry = handle->ego_head; NULL != ego_entry;) 280 for (ego_entry = handle->ego_head; NULL != ego_entry;)
286 { 281 {
287 ego_tmp = ego_entry; 282 ego_tmp = ego_entry;
@@ -357,6 +352,7 @@ finished_cont (void *cls, int32_t success, const char *emsg)
357 struct MHD_Response *resp; 352 struct MHD_Response *resp;
358 353
359 resp = GNUNET_REST_create_response (emsg); 354 resp = GNUNET_REST_create_response (emsg);
355 MHD_add_response_header (resp, "Content-Type", "application/json");
360 if (GNUNET_OK != success) 356 if (GNUNET_OK != success)
361 { 357 {
362 GNUNET_SCHEDULER_add_now (&do_error, handle); 358 GNUNET_SCHEDULER_add_now (&do_error, handle);
@@ -366,6 +362,7 @@ finished_cont (void *cls, int32_t success, const char *emsg)
366 GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); 362 GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
367} 363}
368 364
365
369static void 366static void
370delete_finished_cb (void *cls, int32_t success, const char *emsg) 367delete_finished_cb (void *cls, int32_t success, const char *emsg)
371{ 368{
@@ -382,6 +379,7 @@ delete_finished_cb (void *cls, int32_t success, const char *emsg)
382 GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); 379 GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
383} 380}
384 381
382
385/** 383/**
386 * Return attributes for identity 384 * Return attributes for identity
387 * 385 *
@@ -410,6 +408,7 @@ collect_finished_cb (void *cls)
410 408
411 // Done 409 // Done
412 handle->attr_it = NULL; 410 handle->attr_it = NULL;
411 handle->attest_it = NULL;
413 handle->ticket_it = NULL; 412 handle->ticket_it = NULL;
414 GNUNET_SCHEDULER_add_now (&return_response, handle); 413 GNUNET_SCHEDULER_add_now (&return_response, handle);
415} 414}
@@ -428,7 +427,7 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
428 char *tmp; 427 char *tmp;
429 428
430 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n"); 429 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n");
431 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t)); 430 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
432 json_resource = json_object (); 431 json_resource = json_object ();
433 GNUNET_free (tmp); 432 GNUNET_free (tmp);
434 json_array_append (handle->resp_object, json_resource); 433 json_array_append (handle->resp_object, json_resource);
@@ -447,7 +446,7 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
447 value = json_string (tmp); 446 value = json_string (tmp);
448 json_object_set_new (json_resource, "audience", value); 447 json_object_set_new (json_resource, "audience", value);
449 GNUNET_free (tmp); 448 GNUNET_free (tmp);
450 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t)); 449 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
451 value = json_string (tmp); 450 value = json_string (tmp);
452 json_object_set_new (json_resource, "rnd", value); 451 json_object_set_new (json_resource, "rnd", value);
453 GNUNET_free (tmp); 452 GNUNET_free (tmp);
@@ -456,184 +455,15 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
456 455
457 456
458static void 457static void
459add_attestation_ref_cont (struct GNUNET_REST_RequestHandle *con_handle,
460 const char *url,
461 void *cls)
462{
463 struct RequestHandle *handle = cls;
464 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv;
465 const char *identity;
466 struct EgoEntry *ego_entry;
467 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attribute;
468 struct GNUNET_TIME_Relative exp;
469 char term_data[handle->rest_handle->data_size + 1];
470 json_t *data_json;
471 json_error_t err;
472 struct GNUNET_JSON_Specification attrspec[] =
473 { GNUNET_RECLAIM_JSON_spec_claim_attest_ref (&attribute),
474 GNUNET_JSON_spec_end () };
475 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
476 "Adding an attestation reference for %s.\n",
477 handle->url);
478 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen (
479 "reference/") + 1 >= strlen (
480 handle->url))
481 {
482 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
483 GNUNET_SCHEDULER_add_now (&do_error, handle);
484 return;
485 }
486 identity = handle->url + strlen (
487 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen ("reference/")
488 + 1;
489 for (ego_entry = handle->ego_head; NULL != ego_entry;
490 ego_entry = ego_entry->next)
491 if (0 == strcmp (identity, ego_entry->identifier))
492 break;
493 if (NULL == ego_entry)
494 {
495 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Identity unknown (%s)\n", identity);
496 return;
497 }
498 identity_priv = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
499 if (0 >= handle->rest_handle->data_size)
500 {
501 GNUNET_SCHEDULER_add_now (&do_error, handle);
502 return;
503 }
504
505 term_data[handle->rest_handle->data_size] = '\0';
506 GNUNET_memcpy (term_data,
507 handle->rest_handle->data,
508 handle->rest_handle->data_size);
509 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
510 GNUNET_assert (GNUNET_OK ==
511 GNUNET_JSON_parse (data_json, attrspec, NULL, NULL));
512 json_decref (data_json);
513 if (NULL == attribute)
514 {
515 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
516 "Unable to parse attestation reference from %s\n",
517 term_data);
518 GNUNET_SCHEDULER_add_now (&do_error, handle);
519 return;
520 }
521 /**
522 * New ID for attribute
523 */
524 if (0 == attribute->id)
525 attribute->id = attribute->id_attest;
526 handle->idp = GNUNET_RECLAIM_connect (cfg);
527 exp = GNUNET_TIME_UNIT_HOURS;
528 handle->idp_op = GNUNET_RECLAIM_attestation_reference_store (handle->idp,
529 identity_priv,
530 attribute,
531 &exp,
532 &finished_cont,
533 handle);
534 GNUNET_JSON_parse_free (attrspec);
535}
536
537static void
538parse_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
539 const char *url,
540 void *cls)
541{
542 struct RequestHandle *handle = cls;
543
544 char term_data[handle->rest_handle->data_size + 1];
545 json_t *data_json;
546 json_error_t err;
547 int unpack_state;
548 struct MHD_Response *resp;
549 char *val_str = NULL;
550 const char *type_str = NULL;
551 term_data[handle->rest_handle->data_size] = '\0';
552 GNUNET_memcpy (term_data,
553 handle->rest_handle->data,
554 handle->rest_handle->data_size);
555 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
556 GNUNET_assert (NULL != data_json);
557 if (! json_is_object (data_json))
558 {
559 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
560 "Error json is not array nor object!\n");
561 GNUNET_SCHEDULER_add_now (&do_error, handle);
562 return;
563 }
564 unpack_state = json_unpack (data_json,
565 "{s:s, s:s!}",
566 "value",
567 &val_str,
568 "type",
569 &type_str);
570 if ((0 != unpack_state) || (NULL == val_str) || (NULL == type_str))
571 {
572 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
573 "Error json object has a wrong format!\n");
574 GNUNET_SCHEDULER_add_now (&do_error, handle);
575 return;
576 }
577 if (0 == strcmp (type_str, "JWT"))
578 {
579 // The value is a JWT
580 char *decoded_jwt;
581 char delim[] = ".";
582 char *jwt_body = strtok (val_str, delim);
583 jwt_body = strtok (NULL, delim);
584 GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body),
585 (void **) &decoded_jwt);
586 resp = GNUNET_REST_create_response (decoded_jwt);
587 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
588 GNUNET_free (decoded_jwt);
589 }
590 else
591 {
592 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
593 "Error requested parsing type not supported!\n");
594 GNUNET_SCHEDULER_add_now (&do_error, handle);
595 return;
596 }
597 cleanup_handle (handle);
598 json_decref (data_json);
599}
600
601static void
602add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, 458add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
603 const char *url, 459 const char *url,
604 void *cls) 460 void *cls)
605{ 461{
606 struct RequestHandle *handle = cls; 462 struct RequestHandle *handle = cls;
607 /* Check for substring "reference" */
608 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
609 handle->url))
610 {
611 if ( strncmp ("reference/", (handle->url + strlen (
612 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
613 + 1), strlen (
614 "reference/")) == 0)
615 {
616 add_attestation_ref_cont (con_handle,url,cls);
617 return;
618 }
619 }
620 /* Check for substring "parse" */
621 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
622 handle->url))
623 {
624 if ( strncmp ("parse", (handle->url + strlen (
625 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
626 + 1), strlen (
627 "parse")) == 0)
628 {
629 parse_attestation_cont (con_handle,url,cls);
630 return;
631 }
632 }
633 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv; 463 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv;
634 const char *identity; 464 const char *identity;
635 struct EgoEntry *ego_entry; 465 struct EgoEntry *ego_entry;
636 struct GNUNET_RECLAIM_ATTESTATION_Claim *attribute; 466 struct GNUNET_RECLAIM_Attestation *attribute;
637 struct GNUNET_TIME_Relative exp; 467 struct GNUNET_TIME_Relative exp;
638 char term_data[handle->rest_handle->data_size + 1]; 468 char term_data[handle->rest_handle->data_size + 1];
639 json_t *data_json; 469 json_t *data_json;
@@ -645,7 +475,7 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
645 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 475 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
646 "Adding an attestation for %s.\n", 476 "Adding an attestation for %s.\n",
647 handle->url); 477 handle->url);
648 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) >= strlen ( 478 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen (
649 handle->url)) 479 handle->url))
650 { 480 {
651 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); 481 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
@@ -653,7 +483,7 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
653 return; 483 return;
654 } 484 }
655 identity = handle->url + strlen ( 485 identity = handle->url + strlen (
656 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + 1; 486 GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1;
657 487
658 for (ego_entry = handle->ego_head; NULL != ego_entry; 488 for (ego_entry = handle->ego_head; NULL != ego_entry;
659 ego_entry = ego_entry->next) 489 ego_entry = ego_entry->next)
@@ -692,9 +522,8 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
692 /** 522 /**
693 * New ID for attribute 523 * New ID for attribute
694 */ 524 */
695 if (0 == attribute->id) 525 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id))
696 attribute->id = 526 GNUNET_RECLAIM_id_generate (&attribute->id);
697 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
698 handle->idp = GNUNET_RECLAIM_connect (cfg); 527 handle->idp = GNUNET_RECLAIM_connect (cfg);
699 exp = GNUNET_TIME_UNIT_HOURS; 528 exp = GNUNET_TIME_UNIT_HOURS;
700 handle->idp_op = GNUNET_RECLAIM_attestation_store (handle->idp, 529 handle->idp_op = GNUNET_RECLAIM_attestation_store (handle->idp,
@@ -706,104 +535,6 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
706 GNUNET_JSON_parse_free (attrspec); 535 GNUNET_JSON_parse_free (attrspec);
707} 536}
708 537
709/**
710 * Collect all references for an ego
711 *
712 */
713static void
714ref_collect (void *cls,
715 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
716 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
717 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
718 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
719{
720 struct RequestHandle *handle = cls;
721 json_t *attr_obj;
722 char *id_str;
723 char *id_attest_str;
724
725 if (NULL == reference)
726 {
727 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
728 return;
729 }
730
731 if ((NULL == reference->name) || (NULL == reference->reference_value))
732 {
733 return;
734 }
735
736 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference: %s\n",
737 reference->name);
738 attr_obj = json_object ();
739 json_object_set_new (attr_obj, "name", json_string (reference->name));
740 json_object_set_new (attr_obj, "ref_value", json_string (
741 reference->reference_value));
742 id_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id,
743 sizeof(uint64_t));
744 id_attest_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id_attest,
745 sizeof(uint64_t));
746 json_object_set_new (attr_obj, "id", json_string (id_str));
747 json_object_set_new (attr_obj, "ref_id", json_string (id_attest_str));
748 json_array_append (handle->resp_object, attr_obj);
749 json_decref (attr_obj);
750}
751
752/**
753 * Lists references for identity request
754 *
755 * @param con_handle the connection handle
756 * @param url the url
757 * @param cls the RequestHandle
758 */
759static void
760list_reference_cont (struct GNUNET_REST_RequestHandle *con_handle,
761 const char *url,
762 void *cls)
763{
764 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
765 struct RequestHandle *handle = cls;
766 struct EgoEntry *ego_entry;
767 char *identity;
768
769 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
770 "Getting references for %s.\n",
771 handle->url);
772 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen (
773 "reference/") + 1 >= strlen (
774 handle->url))
775 {
776 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
777 GNUNET_SCHEDULER_add_now (&do_error, handle);
778 return;
779 }
780 identity = handle->url + strlen (
781 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen ("reference/")
782 + 1;
783 for (ego_entry = handle->ego_head; NULL != ego_entry;
784 ego_entry = ego_entry->next)
785 if (0 == strcmp (identity, ego_entry->identifier))
786 break;
787 handle->resp_object = json_array ();
788
789 if (NULL == ego_entry)
790 {
791 // Done
792 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ego %s not found.\n", identity);
793 GNUNET_SCHEDULER_add_now (&return_response, handle);
794 return;
795 }
796 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
797 handle->idp = GNUNET_RECLAIM_connect (cfg);
798 handle->attr_it = GNUNET_RECLAIM_get_attributes_start (handle->idp,
799 priv_key,
800 &collect_error_cb,
801 handle,
802 &ref_collect,
803 handle,
804 &collect_finished_cb,
805 handle);
806}
807 538
808/** 539/**
809 * Collect all attestations for an ego 540 * Collect all attestations for an ego
@@ -812,56 +543,74 @@ list_reference_cont (struct GNUNET_REST_RequestHandle *con_handle,
812static void 543static void
813attest_collect (void *cls, 544attest_collect (void *cls,
814 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 545 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
815 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 546 const struct GNUNET_RECLAIM_Attestation *attest)
816 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
817 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
818{ 547{
819 struct RequestHandle *handle = cls; 548 struct RequestHandle *handle = cls;
549 struct GNUNET_RECLAIM_AttributeList *attrs;
550 struct GNUNET_RECLAIM_AttributeListEntry *ale;
551 struct GNUNET_TIME_Absolute exp;
820 json_t *attr_obj; 552 json_t *attr_obj;
553 json_t *attest_obj;
821 const char *type; 554 const char *type;
822 char *tmp_value; 555 char *tmp_value;
823 char *id_str; 556 char *id_str;
557 char *issuer;
824 558
825 559
826 if (NULL != reference) 560 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation: %s\n",
561 attest->name);
562 attrs = GNUNET_RECLAIM_attestation_get_attributes (attest);
563 issuer = GNUNET_RECLAIM_attestation_get_issuer (attest);
564 tmp_value = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
565 attest->data,
566 attest->data_size);
567 attest_obj = json_object ();
568 json_object_set_new (attest_obj, "value", json_string (tmp_value));
569 json_object_set_new (attest_obj, "name", json_string (attest->name));
570 type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type);
571 json_object_set_new (attest_obj, "type", json_string (type));
572 if (NULL != issuer)
827 { 573 {
828 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 574 json_object_set_new (attest_obj, "issuer", json_string (issuer));
829 "Attestation Collection with Reference\n"); 575 GNUNET_free (issuer);
830 return;
831 } 576 }
832 if (NULL == attest) 577 if (GNUNET_OK == GNUNET_RECLAIM_attestation_get_expiration (attest,
578 &exp))
833 { 579 {
834 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 580 json_object_set_new (attest_obj, "expiration", json_integer (exp.abs_value_us));
835 "Attestation Collection with empty Attestation\n");
836 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
837 return;
838 } 581 }
839 582 id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id,
840 if ((NULL == attest->name) || (NULL == attest->data)) 583 sizeof(attest->id));
584 json_object_set_new (attest_obj, "id", json_string (id_str));
585 GNUNET_free (tmp_value);
586 GNUNET_free (id_str);
587 if (NULL != attrs)
841 { 588 {
842 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 589 json_t *attr_arr = json_array ();
843 "Attestation Collection with empty Name/Value\n"); 590 for (ale = attrs->list_head; NULL != ale; ale = ale->next)
844 GNUNET_RECLAIM_get_attributes_next (handle->attr_it); 591 {
845 return; 592 tmp_value =
593 GNUNET_RECLAIM_attribute_value_to_string (ale->attribute->type,
594 ale->attribute->data,
595 ale->attribute->data_size);
596 attr_obj = json_object ();
597 json_object_set_new (attr_obj, "value", json_string (tmp_value));
598 json_object_set_new (attr_obj, "name", json_string (
599 ale->attribute->name));
600
601 json_object_set_new (attr_obj, "flag", json_string ("1")); //FIXME
602 type = GNUNET_RECLAIM_attribute_number_to_typename (ale->attribute->type);
603 json_object_set_new (attr_obj, "type", json_string (type));
604 json_object_set_new (attr_obj, "id", json_string (""));
605 json_object_set_new (attr_obj, "attestation", json_string (""));
606 json_array_append_new (attr_arr, attr_obj);
607 GNUNET_free (tmp_value);
608 }
609 json_object_set_new (attest_obj, "attributes", attr_arr);
846 } 610 }
847 611 json_array_append_new (handle->resp_object, attest_obj);
848 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation: %s\n", 612 GNUNET_RECLAIM_attribute_list_destroy (attrs);
849 attest->name); 613 GNUNET_RECLAIM_get_attestations_next (handle->attest_it);
850
851 tmp_value = GNUNET_RECLAIM_ATTESTATION_value_to_string (attest->type,
852 attest->data,
853 attest->data_size);
854 attr_obj = json_object ();
855 json_object_set_new (attr_obj, "value", json_string (tmp_value));
856 json_object_set_new (attr_obj, "name", json_string (attest->name));
857 type = GNUNET_RECLAIM_ATTESTATION_number_to_typename (attest->type);
858 json_object_set_new (attr_obj, "type", json_string (type));
859 id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(uint64_t));
860 json_object_set_new (attr_obj, "id", json_string (id_str));
861 json_array_append (handle->resp_object, attr_obj);
862 json_decref (attr_obj);
863 GNUNET_free (tmp_value);
864 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
865} 614}
866 615
867 616
@@ -878,19 +627,6 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
878 void *cls) 627 void *cls)
879{ 628{
880 struct RequestHandle *handle = cls; 629 struct RequestHandle *handle = cls;
881 /* Check for substring "reference" */
882 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
883 handle->url))
884 {
885 if ( strncmp ("reference/", (handle->url + strlen (
886 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
887 + 1), strlen (
888 "reference/")) == 0)
889 {
890 list_reference_cont (con_handle,url,cls);
891 return;
892 }
893 }
894 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 630 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
895 struct EgoEntry *ego_entry; 631 struct EgoEntry *ego_entry;
896 char *identity; 632 char *identity;
@@ -898,7 +634,7 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
898 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 634 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
899 "Getting attestations for %s.\n", 635 "Getting attestations for %s.\n",
900 handle->url); 636 handle->url);
901 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) >= strlen ( 637 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen (
902 handle->url)) 638 handle->url))
903 { 639 {
904 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); 640 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
@@ -906,7 +642,7 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
906 return; 642 return;
907 } 643 }
908 identity = handle->url + strlen ( 644 identity = handle->url + strlen (
909 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + 1; 645 GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1;
910 646
911 for (ego_entry = handle->ego_head; NULL != ego_entry; 647 for (ego_entry = handle->ego_head; NULL != ego_entry;
912 ego_entry = ego_entry->next) 648 ego_entry = ego_entry->next)
@@ -924,109 +660,15 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
924 } 660 }
925 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 661 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
926 handle->idp = GNUNET_RECLAIM_connect (cfg); 662 handle->idp = GNUNET_RECLAIM_connect (cfg);
927 handle->attr_it = GNUNET_RECLAIM_get_attributes_start (handle->idp, 663 handle->attest_it = GNUNET_RECLAIM_get_attestations_start (handle->idp,
928 priv_key, 664 priv_key,
929 &collect_error_cb, 665 &collect_error_cb,
930 handle, 666 handle,
931 &attest_collect, 667 &attest_collect,
932 handle, 668 handle,
933 &collect_finished_cb, 669 &
934 handle); 670 collect_finished_cb,
935} 671 handle);
936
937/**
938 * Deletes reference from an identity
939 *
940 * @param con_handle the connection handle
941 * @param url the url
942 * @param cls the RequestHandle
943 */
944static void
945delete_attestation_ref_cont (struct GNUNET_REST_RequestHandle *con_handle,
946 const char *url,
947 void *cls)
948{
949 struct RequestHandle *handle = cls;
950 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
951 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
952 struct EgoEntry *ego_entry;
953 char *identity;
954 char *identity_id_str;
955 char *id;
956 char term_data[handle->rest_handle->data_size + 1];
957 json_t *data_json;
958 json_error_t err;
959
960 struct GNUNET_JSON_Specification attrspec[] =
961 { GNUNET_RECLAIM_JSON_spec_claim_attest_ref (&attr),
962 GNUNET_JSON_spec_end () };
963 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
964 "Deleting attestation reference.\n");
965 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + strlen (
966 "reference/") + 1 >= strlen (
967 handle->url))
968 {
969 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
970 GNUNET_SCHEDULER_add_now (&do_error, handle);
971 return;
972 }
973 identity_id_str = strdup (handle->url + strlen (
974 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
975 + strlen ("reference/")
976 + 1);
977 identity = strtok (identity_id_str, "/");
978 id = strtok (NULL, "/");
979
980 if ((NULL == identity) || (NULL == id))
981 {
982 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed request.\n");
983 GNUNET_SCHEDULER_add_now (&do_error, handle);
984 return;
985 }
986 for (ego_entry = handle->ego_head; NULL != ego_entry;
987 ego_entry = ego_entry->next)
988 if (0 == strcmp (identity, ego_entry->identifier))
989 break;
990 handle->resp_object = json_array ();
991 if (NULL == ego_entry)
992 {
993 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ego %s not found.\n", identity);
994 GNUNET_SCHEDULER_add_now (&return_response, handle);
995 return;
996 }
997 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
998 if (0 >= handle->rest_handle->data_size)
999 {
1000 GNUNET_SCHEDULER_add_now (&do_error, handle);
1001 return;
1002 }
1003
1004 term_data[handle->rest_handle->data_size] = '\0';
1005 GNUNET_memcpy (term_data,
1006 handle->rest_handle->data,
1007 handle->rest_handle->data_size);
1008 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
1009 GNUNET_assert (GNUNET_OK ==
1010 GNUNET_JSON_parse (data_json, attrspec, NULL, NULL));
1011 json_decref (data_json);
1012 if (NULL == attr)
1013 {
1014 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1015 "Unable to parse attestation reference from %s\n",
1016 term_data);
1017 GNUNET_SCHEDULER_add_now (&do_error, handle);
1018 return;
1019 }
1020 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr->id, sizeof(uint64_t));
1021
1022 handle->idp = GNUNET_RECLAIM_connect (cfg);
1023 handle->idp_op = GNUNET_RECLAIM_attestation_reference_delete (handle->idp,
1024 priv_key,
1025 attr,
1026 &
1027 delete_finished_cb,
1028 handle);
1029 GNUNET_JSON_parse_free (attrspec);
1030} 672}
1031 673
1032 674
@@ -1043,28 +685,15 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
1043 void *cls) 685 void *cls)
1044{ 686{
1045 struct RequestHandle *handle = cls; 687 struct RequestHandle *handle = cls;
1046 /* Check for substring "reference" */
1047 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) < strlen (
1048 handle->url))
1049 {
1050 if ( strncmp ("reference", (handle->url + strlen (
1051 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE)
1052 + 1), strlen (
1053 "reference")) == 0)
1054 {
1055 delete_attestation_ref_cont (con_handle,url,cls);
1056 return;
1057 }
1058 }
1059 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 688 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
1060 struct GNUNET_RECLAIM_ATTESTATION_Claim attr; 689 struct GNUNET_RECLAIM_Attestation attr;
1061 struct EgoEntry *ego_entry; 690 struct EgoEntry *ego_entry;
1062 char *identity_id_str; 691 char *identity_id_str;
1063 char *identity; 692 char *identity;
1064 char *id; 693 char *id;
1065 694
1066 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting attestation.\n"); 695 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting attestation.\n");
1067 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) >= strlen ( 696 if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen (
1068 handle->url)) 697 handle->url))
1069 { 698 {
1070 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); 699 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
@@ -1073,7 +702,7 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
1073 } 702 }
1074 identity_id_str = 703 identity_id_str =
1075 strdup (handle->url + strlen ( 704 strdup (handle->url + strlen (
1076 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE) + 1); 705 GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1);
1077 identity = strtok (identity_id_str, "/"); 706 identity = strtok (identity_id_str, "/");
1078 id = strtok (NULL, "/"); 707 id = strtok (NULL, "/");
1079 if ((NULL == identity) || (NULL == id)) 708 if ((NULL == identity) || (NULL == id))
@@ -1099,8 +728,8 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
1099 } 728 }
1100 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 729 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
1101 handle->idp = GNUNET_RECLAIM_connect (cfg); 730 handle->idp = GNUNET_RECLAIM_connect (cfg);
1102 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim)); 731 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_Attestation));
1103 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(uint64_t)); 732 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id));
1104 attr.name = ""; 733 attr.name = "";
1105 handle->idp_op = GNUNET_RECLAIM_attestation_delete (handle->idp, 734 handle->idp_op = GNUNET_RECLAIM_attestation_delete (handle->idp,
1106 priv_key, 735 priv_key,
@@ -1110,6 +739,7 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
1110 GNUNET_free (identity_id_str); 739 GNUNET_free (identity_id_str);
1111} 740}
1112 741
742
1113/** 743/**
1114 * List tickets for identity request 744 * List tickets for identity request
1115 * 745 *
@@ -1174,7 +804,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1174 const char *identity; 804 const char *identity;
1175 struct RequestHandle *handle = cls; 805 struct RequestHandle *handle = cls;
1176 struct EgoEntry *ego_entry; 806 struct EgoEntry *ego_entry;
1177 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attribute; 807 struct GNUNET_RECLAIM_Attribute *attribute;
1178 struct GNUNET_TIME_Relative exp; 808 struct GNUNET_TIME_Relative exp;
1179 char term_data[handle->rest_handle->data_size + 1]; 809 char term_data[handle->rest_handle->data_size + 1];
1180 json_t *data_json; 810 json_t *data_json;
@@ -1230,9 +860,8 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1230 /** 860 /**
1231 * New ID for attribute 861 * New ID for attribute
1232 */ 862 */
1233 if (0 == attribute->id) 863 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id))
1234 attribute->id = 864 GNUNET_RECLAIM_id_generate (&attribute->id);
1235 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
1236 handle->idp = GNUNET_RECLAIM_connect (cfg); 865 handle->idp = GNUNET_RECLAIM_connect (cfg);
1237 exp = GNUNET_TIME_UNIT_HOURS; 866 exp = GNUNET_TIME_UNIT_HOURS;
1238 handle->idp_op = GNUNET_RECLAIM_attribute_store (handle->idp, 867 handle->idp_op = GNUNET_RECLAIM_attribute_store (handle->idp,
@@ -1244,20 +873,21 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1244 GNUNET_JSON_parse_free (attrspec); 873 GNUNET_JSON_parse_free (attrspec);
1245} 874}
1246 875
876
1247/** 877/**
1248 * Parse a JWT and return the respective claim value as Attribute 878 * Parse a JWT and return the respective claim value as Attribute
1249 * 879 *
1250 * @param attest the jwt attestation 880 * @param attest the jwt attestation
1251 * @param claim the name of the claim in the JWT 881 * @param claim the name of the claim in the JWT
1252 * 882 *
1253 * @return a GNUNET_RECLAIM_ATTRIBUTE_Claim, containing the new value 883 * @return a GNUNET_RECLAIM_Attribute, containing the new value
1254 */ 884 */
1255struct GNUNET_RECLAIM_ATTRIBUTE_Claim * 885struct GNUNET_RECLAIM_Attribute *
1256parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 886parse_jwt (const struct GNUNET_RECLAIM_Attestation *attest,
1257 const char *claim) 887 const char *claim)
1258{ 888{
1259 char *jwt_string; 889 char *jwt_string;
1260 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr; 890 struct GNUNET_RECLAIM_Attribute *attr;
1261 char delim[] = "."; 891 char delim[] = ".";
1262 const char *type_str = NULL; 892 const char *type_str = NULL;
1263 const char *val_str = NULL; 893 const char *val_str = NULL;
@@ -1269,7 +899,7 @@ parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
1269 json_t *json_val; 899 json_t *json_val;
1270 json_error_t *json_err = NULL; 900 json_error_t *json_err = NULL;
1271 901
1272 jwt_string = GNUNET_RECLAIM_ATTESTATION_value_to_string (attest->type, 902 jwt_string = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
1273 attest->data, 903 attest->data,
1274 attest->data_size); 904 attest->data_size);
1275 char *jwt_body = strtok (jwt_string, delim); 905 char *jwt_body = strtok (jwt_string, delim);
@@ -1286,24 +916,26 @@ parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
1286 } 916 }
1287 } 917 }
1288 type_str = "String"; 918 type_str = "String";
1289 type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str); 919 type = GNUNET_RECLAIM_attribute_typename_to_number (type_str);
1290 if (GNUNET_SYSERR ==(GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type,val_str, 920 if (GNUNET_SYSERR == GNUNET_RECLAIM_attribute_string_to_value (type,val_str,
1291 (void **) &data, 921 (void **) &data,
1292 &data_size))) 922 &data_size))
1293 { 923 {
1294 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 924 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1295 "Attribute value from JWT Parser invalid!\n"); 925 "Attribute value from JWT Parser invalid!\n");
1296 GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type, 926 GNUNET_RECLAIM_attribute_string_to_value (type,
1297 "Error: Referenced Claim Name not Found", 927 "Error: Referenced Claim Name not Found",
1298 (void **) &data, 928 (void **) &data,
1299 &data_size); 929 &data_size);
1300 attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (claim, type, data, data_size); 930 attr = GNUNET_RECLAIM_attribute_new (claim, &attest->id,
931 type, data, data_size);
1301 attr->id = attest->id; 932 attr->id = attest->id;
1302 attr->flag = 1; 933 attr->flag = 1;
1303 } 934 }
1304 else 935 else
1305 { 936 {
1306 attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (claim, type, data, data_size); 937 attr = GNUNET_RECLAIM_attribute_new (claim, &attest->id,
938 type, data, data_size);
1307 attr->id = attest->id; 939 attr->id = attest->id;
1308 attr->flag = 1; 940 attr->flag = 1;
1309 } 941 }
@@ -1318,93 +950,40 @@ parse_jwt (const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
1318static void 950static void
1319attr_collect (void *cls, 951attr_collect (void *cls,
1320 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 952 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
1321 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 953 const struct GNUNET_RECLAIM_Attribute *attr)
1322 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
1323 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
1324{ 954{
1325 struct RequestHandle *handle = cls; 955 struct RequestHandle *handle = cls;
1326 json_t *attr_obj; 956 json_t *attr_obj;
1327 const char *type; 957 const char *type;
1328 char *id_str; 958 char *id_str;
1329 959
1330 if ((NULL == attr) && (NULL == reference)) 960 char *tmp_value;
1331 { 961 tmp_value = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
1332 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 962 attr->data,
1333 "Attribute Collection with empty Attribute/Reference\n"); 963 attr->data_size);
1334 GNUNET_RECLAIM_get_attributes_next (handle->attr_it); 964 attr_obj = json_object ();
1335 return; 965 json_object_set_new (attr_obj, "value", json_string (tmp_value));
1336 } 966 json_object_set_new (attr_obj, "name", json_string (attr->name));
1337
1338 if (NULL == attr)
1339 {
1340 967
1341 if ((NULL == reference->name) || (NULL == reference->reference_value)) 968 if (GNUNET_RECLAIM_id_is_zero (&attr->attestation))
1342 { 969 json_object_set_new (attr_obj, "flag", json_string ("0"));
1343 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1344 "Attribute Collection with empty Reference Name/Value\n");
1345 return;
1346 }
1347 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr2;
1348 attr2 = parse_jwt (attest, reference->reference_value);
1349 if (NULL == attr2)
1350 {
1351 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1352 "Attribute Collection with unparsed Attestation\n");
1353 return;
1354 }
1355 attr2->name = reference->name;
1356 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference as attribute: %s\n",
1357 reference->name);
1358 char *tmp_value;
1359 tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr2->type,
1360 attr2->data,
1361 attr2->data_size);
1362 attr_obj = json_object ();
1363
1364 json_object_set_new (attr_obj, "value", json_string (tmp_value));
1365 json_object_set_new (attr_obj, "name", json_string (attr2->name));
1366 json_object_set_new (attr_obj, "flag", json_string ("1"));
1367 type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr2->type);
1368 json_object_set_new (attr_obj, "type", json_string (type));
1369 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr2->id, sizeof(uint64_t));
1370 json_object_set_new (attr_obj, "id", json_string (id_str));
1371 json_array_append (handle->resp_object, attr_obj);
1372 json_decref (attr_obj);
1373 GNUNET_free (tmp_value);
1374 }
1375 else 970 else
1376 { 971 json_object_set_new (attr_obj, "flag", json_string ("1"));
1377 if ((NULL == attr->name) || (NULL == attr->data)) 972 type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
1378 { 973 json_object_set_new (attr_obj, "type", json_string (type));
1379 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 974 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id,
1380 "Attribute Collection with empty Attribute Name/Value\n"); 975 sizeof(attr->id));
1381 GNUNET_RECLAIM_get_attributes_next (handle->attr_it); 976 json_object_set_new (attr_obj, "id", json_string (id_str));
1382 return; 977 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->attestation,
1383 } 978 sizeof(attr->attestation));
1384 char *tmp_value; 979 json_object_set_new (attr_obj, "attestation", json_string (id_str));
1385 char *flag_str; 980 json_array_append (handle->resp_object, attr_obj);
1386 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name); 981 json_decref (attr_obj);
1387 982 GNUNET_free (tmp_value);
1388 tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type, 983 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
1389 attr->data,
1390 attr->data_size);
1391
1392 attr_obj = json_object ();
1393 json_object_set_new (attr_obj, "value", json_string (tmp_value));
1394 json_object_set_new (attr_obj, "name", json_string (attr->name));
1395 GNUNET_asprintf (&flag_str,"%d",attr->flag);
1396 json_object_set_new (attr_obj, "flag", json_string (flag_str));
1397 type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
1398 json_object_set_new (attr_obj, "type", json_string (type));
1399 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t));
1400 json_object_set_new (attr_obj, "id", json_string (id_str));
1401 json_array_append (handle->resp_object, attr_obj);
1402 json_decref (attr_obj);
1403 GNUNET_free (tmp_value);
1404 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
1405 }
1406} 984}
1407 985
986
1408/** 987/**
1409 * List attributes for identity request 988 * List attributes for identity request
1410 * 989 *
@@ -1474,7 +1053,7 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1474{ 1053{
1475 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 1054 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
1476 struct RequestHandle *handle = cls; 1055 struct RequestHandle *handle = cls;
1477 struct GNUNET_RECLAIM_ATTRIBUTE_Claim attr; 1056 struct GNUNET_RECLAIM_Attribute attr;
1478 struct EgoEntry *ego_entry; 1057 struct EgoEntry *ego_entry;
1479 char *identity_id_str; 1058 char *identity_id_str;
1480 char *identity; 1059 char *identity;
@@ -1514,8 +1093,8 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1514 } 1093 }
1515 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 1094 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
1516 handle->idp = GNUNET_RECLAIM_connect (cfg); 1095 handle->idp = GNUNET_RECLAIM_connect (cfg);
1517 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)); 1096 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_Attribute));
1518 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(uint64_t)); 1097 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id));
1519 attr.name = ""; 1098 attr.name = "";
1520 handle->idp_op = GNUNET_RECLAIM_attribute_delete (handle->idp, 1099 handle->idp_op = GNUNET_RECLAIM_attribute_delete (handle->idp,
1521 priv_key, 1100 priv_key,
@@ -1603,9 +1182,8 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1603static void 1182static void
1604consume_cont (void *cls, 1183consume_cont (void *cls,
1605 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1184 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
1606 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 1185 const struct GNUNET_RECLAIM_Attribute *attr,
1607 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 1186 const struct GNUNET_RECLAIM_Attestation *attest)
1608 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
1609{ 1187{
1610 struct RequestHandle *handle = cls; 1188 struct RequestHandle *handle = cls;
1611 char *val_str; 1189 char *val_str;
@@ -1618,7 +1196,7 @@ consume_cont (void *cls,
1618 } 1196 }
1619 1197
1620 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name); 1198 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name);
1621 val_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type, 1199 val_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
1622 attr->data, 1200 attr->data,
1623 attr->data_size); 1201 attr->data_size);
1624 if (NULL == val_str) 1202 if (NULL == val_str)
@@ -1749,13 +1327,13 @@ init_cont (struct RequestHandle *handle)
1749 GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, 1327 GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
1750 &delete_attribute_cont }, 1328 &delete_attribute_cont },
1751 { MHD_HTTP_METHOD_GET, 1329 { MHD_HTTP_METHOD_GET,
1752 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE, 1330 GNUNET_REST_API_NS_RECLAIM_ATTESTATION,
1753 &list_attestation_cont }, 1331 &list_attestation_cont },
1754 { MHD_HTTP_METHOD_POST, 1332 { MHD_HTTP_METHOD_POST,
1755 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE, 1333 GNUNET_REST_API_NS_RECLAIM_ATTESTATION,
1756 &add_attestation_cont }, 1334 &add_attestation_cont },
1757 { MHD_HTTP_METHOD_DELETE, 1335 { MHD_HTTP_METHOD_DELETE,
1758 GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE, 1336 GNUNET_REST_API_NS_RECLAIM_ATTESTATION,
1759 &delete_attestation_cont }, 1337 &delete_attestation_cont },
1760 { MHD_HTTP_METHOD_GET, 1338 { MHD_HTTP_METHOD_GET,
1761 GNUNET_REST_API_NS_IDENTITY_TICKETS, 1339 GNUNET_REST_API_NS_IDENTITY_TICKETS,
diff --git a/src/reclaim/reclaim.h b/src/reclaim/reclaim.h
index ff953a096..7b5d7ab19 100644
--- a/src/reclaim/reclaim.h
+++ b/src/reclaim/reclaim.h
@@ -139,6 +139,11 @@ struct AttributeResultMessage
139 uint16_t attr_len GNUNET_PACKED; 139 uint16_t attr_len GNUNET_PACKED;
140 140
141 /** 141 /**
142 * Length of serialized attestation data
143 */
144 uint16_t attestation_len GNUNET_PACKED;
145
146 /**
142 * always zero (for alignment) 147 * always zero (for alignment)
143 */ 148 */
144 uint16_t reserved GNUNET_PACKED; 149 uint16_t reserved GNUNET_PACKED;
@@ -154,9 +159,9 @@ struct AttributeResultMessage
154}; 159};
155 160
156/** 161/**
157 * Reference plus Attestation is returned from the idp. 162 * Attestation is returned from the idp.
158 */ 163 */
159struct ReferenceResultMessage 164struct AttestationResultMessage
160{ 165{
161 /** 166 /**
162 * Message header 167 * Message header
@@ -169,14 +174,9 @@ struct ReferenceResultMessage
169 uint32_t id GNUNET_PACKED; 174 uint32_t id GNUNET_PACKED;
170 175
171 /** 176 /**
172 * Length of serialized attestation data 177 * Length of serialized attribute data
173 */
174 uint16_t attest_len GNUNET_PACKED;
175
176 /**
177 * Length of serialized reference data
178 */ 178 */
179 uint16_t ref_len GNUNET_PACKED; 179 uint16_t attestation_len GNUNET_PACKED;
180 180
181 /** 181 /**
182 * always zero (for alignment) 182 * always zero (for alignment)
@@ -189,10 +189,11 @@ struct ReferenceResultMessage
189 struct GNUNET_CRYPTO_EcdsaPublicKey identity; 189 struct GNUNET_CRYPTO_EcdsaPublicKey identity;
190 190
191 /* followed by: 191 /* followed by:
192 * serialized reference data + attestation data 192 * serialized attestation data
193 */ 193 */
194}; 194};
195 195
196
196/** 197/**
197 * Start a attribute iteration for the given identity 198 * Start a attribute iteration for the given identity
198 */ 199 */
@@ -233,6 +234,62 @@ struct AttributeIterationNextMessage
233 234
234 235
235/** 236/**
237 * Start a attestation iteration for the given identity
238 */
239struct AttestationIterationStartMessage
240{
241 /**
242 * Message
243 */
244 struct GNUNET_MessageHeader header;
245
246 /**
247 * Unique identifier for this request (for key collisions).
248 */
249 uint32_t id GNUNET_PACKED;
250
251 /**
252 * Identity.
253 */
254 struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
255};
256
257
258/**
259 * Ask for next result of attestation iteration for the given operation
260 */
261struct AttestationIterationNextMessage
262{
263 /**
264 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT
265 */
266 struct GNUNET_MessageHeader header;
267
268 /**
269 * Unique identifier for this request (for key collisions).
270 */
271 uint32_t id GNUNET_PACKED;
272};
273
274
275/**
276 * Stop attestation iteration for the given operation
277 */
278struct AttestationIterationStopMessage
279{
280 /**
281 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP
282 */
283 struct GNUNET_MessageHeader header;
284
285 /**
286 * Unique identifier for this request (for key collisions).
287 */
288 uint32_t id GNUNET_PACKED;
289};
290
291
292/**
236 * Stop attribute iteration for the given operation 293 * Stop attribute iteration for the given operation
237 */ 294 */
238struct AttributeIterationStopMessage 295struct AttributeIterationStopMessage
@@ -463,6 +520,11 @@ struct ConsumeTicketResultMessage
463 uint16_t attrs_len GNUNET_PACKED; 520 uint16_t attrs_len GNUNET_PACKED;
464 521
465 /** 522 /**
523 * Length of attestation data
524 */
525 uint16_t attestations_len;
526
527 /**
466 * always zero (for alignment) 528 * always zero (for alignment)
467 */ 529 */
468 uint16_t reserved GNUNET_PACKED; 530 uint16_t reserved GNUNET_PACKED;
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index 847abb58a..cfe137949 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -28,7 +28,7 @@
28#include "gnunet_constants.h" 28#include "gnunet_constants.h"
29#include "gnunet_mq_lib.h" 29#include "gnunet_mq_lib.h"
30#include "gnunet_protocols.h" 30#include "gnunet_protocols.h"
31#include "gnunet_reclaim_attribute_lib.h" 31#include "gnunet_reclaim_lib.h"
32#include "gnunet_reclaim_service.h" 32#include "gnunet_reclaim_service.h"
33#include "reclaim.h" 33#include "reclaim.h"
34 34
@@ -72,6 +72,16 @@ struct GNUNET_RECLAIM_Operation
72 GNUNET_RECLAIM_AttributeResult ar_cb; 72 GNUNET_RECLAIM_AttributeResult ar_cb;
73 73
74 /** 74 /**
75 * Attribute result callback
76 */
77 GNUNET_RECLAIM_AttributeTicketResult atr_cb;
78
79 /**
80 * Attestation result callback
81 */
82 GNUNET_RECLAIM_AttestationResult at_cb;
83
84 /**
75 * Revocation result callback 85 * Revocation result callback
76 */ 86 */
77 GNUNET_RECLAIM_ContinuationWithStatus rvk_cb; 87 GNUNET_RECLAIM_ContinuationWithStatus rvk_cb;
@@ -228,6 +238,73 @@ struct GNUNET_RECLAIM_AttributeIterator
228 uint32_t r_id; 238 uint32_t r_id;
229}; 239};
230 240
241/**
242 * Handle for a attestation iterator operation
243 */
244struct GNUNET_RECLAIM_AttestationIterator
245{
246 /**
247 * Kept in a DLL.
248 */
249 struct GNUNET_RECLAIM_AttestationIterator *next;
250
251 /**
252 * Kept in a DLL.
253 */
254 struct GNUNET_RECLAIM_AttestationIterator *prev;
255
256 /**
257 * Main handle to access the service.
258 */
259 struct GNUNET_RECLAIM_Handle *h;
260
261 /**
262 * Function to call on completion.
263 */
264 GNUNET_SCHEDULER_TaskCallback finish_cb;
265
266 /**
267 * Closure for @e finish_cb.
268 */
269 void *finish_cb_cls;
270
271 /**
272 * The continuation to call with the results
273 */
274 GNUNET_RECLAIM_AttestationResult proc;
275
276 /**
277 * Closure for @e proc.
278 */
279 void *proc_cls;
280
281 /**
282 * Function to call on errors.
283 */
284 GNUNET_SCHEDULER_TaskCallback error_cb;
285
286 /**
287 * Closure for @e error_cb.
288 */
289 void *error_cb_cls;
290
291 /**
292 * Envelope of the message to send to the service, if not yet
293 * sent.
294 */
295 struct GNUNET_MQ_Envelope *env;
296
297 /**
298 * Private key of the zone.
299 */
300 struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
301
302 /**
303 * The operation id this zone iteration operation has
304 */
305 uint32_t r_id;
306};
307
231 308
232/** 309/**
233 * Handle to the service. 310 * Handle to the service.
@@ -272,6 +349,16 @@ struct GNUNET_RECLAIM_Handle
272 /** 349 /**
273 * Head of active iterations 350 * Head of active iterations
274 */ 351 */
352 struct GNUNET_RECLAIM_AttestationIterator *ait_head;
353
354 /**
355 * Tail of active iterations
356 */
357 struct GNUNET_RECLAIM_AttestationIterator *ait_tail;
358
359 /**
360 * Head of active iterations
361 */
275 struct GNUNET_RECLAIM_TicketIterator *ticket_it_head; 362 struct GNUNET_RECLAIM_TicketIterator *ticket_it_head;
276 363
277 /** 364 /**
@@ -372,6 +459,23 @@ free_it (struct GNUNET_RECLAIM_AttributeIterator *it)
372 459
373 460
374/** 461/**
462 * Free @a it.
463 *
464 * @param ait entry to free
465 */
466static void
467free_ait (struct GNUNET_RECLAIM_AttestationIterator *ait)
468{
469 struct GNUNET_RECLAIM_Handle *h = ait->h;
470
471 GNUNET_CONTAINER_DLL_remove (h->ait_head, h->ait_tail, ait);
472 if (NULL != ait->env)
473 GNUNET_MQ_discard (ait->env);
474 GNUNET_free (ait);
475}
476
477
478/**
375 * Free @a op 479 * Free @a op
376 * 480 *
377 * @param op the operation to free 481 * @param op the operation to free
@@ -457,10 +561,13 @@ check_consume_ticket_result (void *cls,
457{ 561{
458 size_t msg_len; 562 size_t msg_len;
459 size_t attrs_len; 563 size_t attrs_len;
564 size_t attests_len;
460 565
461 msg_len = ntohs (msg->header.size); 566 msg_len = ntohs (msg->header.size);
462 attrs_len = ntohs (msg->attrs_len); 567 attrs_len = ntohs (msg->attrs_len);
463 if (msg_len != sizeof(struct ConsumeTicketResultMessage) + attrs_len) 568 attests_len = ntohs (msg->attestations_len);
569 if (msg_len !=
570 sizeof(struct ConsumeTicketResultMessage) + attrs_len + attests_len)
464 { 571 {
465 GNUNET_break (0); 572 GNUNET_break (0);
466 return GNUNET_SYSERR; 573 return GNUNET_SYSERR;
@@ -483,9 +590,12 @@ handle_consume_ticket_result (void *cls,
483 struct GNUNET_RECLAIM_Handle *h = cls; 590 struct GNUNET_RECLAIM_Handle *h = cls;
484 struct GNUNET_RECLAIM_Operation *op; 591 struct GNUNET_RECLAIM_Operation *op;
485 size_t attrs_len; 592 size_t attrs_len;
593 size_t attests_len;
486 uint32_t r_id = ntohl (msg->id); 594 uint32_t r_id = ntohl (msg->id);
595 char *read_ptr;
487 596
488 attrs_len = ntohs (msg->attrs_len); 597 attrs_len = ntohs (msg->attrs_len);
598 attests_len = ntohs (msg->attestations_len);
489 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n"); 599 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n");
490 600
491 601
@@ -496,38 +606,55 @@ handle_consume_ticket_result (void *cls,
496 return; 606 return;
497 607
498 { 608 {
499 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; 609 struct GNUNET_RECLAIM_AttributeList *attrs;
500 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 610 struct GNUNET_RECLAIM_AttributeListEntry *le;
501 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le2; 611 struct GNUNET_RECLAIM_AttestationList *attests;
612 struct GNUNET_RECLAIM_AttestationListEntry *ale;
502 attrs = 613 attrs =
503 GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *) &msg[1], attrs_len); 614 GNUNET_RECLAIM_attribute_list_deserialize ((char *) &msg[1], attrs_len);
504 if (NULL != op->ar_cb) 615 read_ptr = ((char *) &msg[1]) + attrs_len;
616 attests =
617 GNUNET_RECLAIM_attestation_list_deserialize (read_ptr, attests_len);
618 if (NULL != op->atr_cb)
505 { 619 {
506 if (NULL == attrs) 620 if (NULL == attrs)
507 { 621 {
508 op->ar_cb (op->cls, &msg->identity, NULL, NULL, NULL); 622 op->atr_cb (op->cls, &msg->identity, NULL, NULL);
509 } 623 }
510 else 624 else
511 { 625 {
512 for (le = attrs->list_head; NULL != le; le = le->next) 626 for (le = attrs->list_head; NULL != le; le = le->next)
513 { 627 {
514 if (le->reference != NULL && le->attest == NULL) 628 if (GNUNET_NO ==
629 GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation))
515 { 630 {
516 for (le2 = attrs->list_head; NULL != le2; le2 = le2->next) 631 for (ale = attests->list_head; NULL != ale; ale = ale->next)
517 { 632 {
518 if (le2->attest != NULL && le2->attest->id == le->reference->id_attest) 633 if (GNUNET_YES ==
634 GNUNET_RECLAIM_id_is_equal (&le->attribute->attestation,
635 &ale->attestation->id))
519 { 636 {
520 op->ar_cb (op->cls, &msg->identity, le->claim, le2->attest, le->reference); 637 op->atr_cb (op->cls, &msg->identity,
638 le->attribute, ale->attestation);
521 break; 639 break;
522 } 640 }
523 641
524 } 642 }
525 } 643 }
644 else // No attestations
645 {
646 op->atr_cb (op->cls, &msg->identity,
647 le->attribute, NULL);
648 }
526 } 649 }
527 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs); 650 if (NULL != attrs)
651 GNUNET_RECLAIM_attribute_list_destroy (attrs);
652 if (NULL != attests)
653 GNUNET_RECLAIM_attestation_list_destroy (attests);
528 attrs = NULL; 654 attrs = NULL;
655 attests = NULL;
529 } 656 }
530 op->ar_cb (op->cls, NULL, NULL, NULL, NULL); 657 op->atr_cb (op->cls, NULL, NULL, NULL);
531 } 658 }
532 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); 659 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
533 free_op (op); 660 free_op (op);
@@ -611,7 +738,7 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg)
611 if (NULL != op) 738 if (NULL != op)
612 { 739 {
613 if (NULL != op->ar_cb) 740 if (NULL != op->ar_cb)
614 op->ar_cb (op->cls, NULL, NULL, NULL, NULL); 741 op->ar_cb (op->cls, NULL, NULL);
615 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); 742 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
616 free_op (op); 743 free_op (op);
617 } 744 }
@@ -619,17 +746,17 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg)
619 } 746 }
620 747
621 { 748 {
622 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr; 749 struct GNUNET_RECLAIM_Attribute *attr;
623 attr = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char *) &msg[1], attr_len); 750 attr = GNUNET_RECLAIM_attribute_deserialize ((char *) &msg[1], attr_len);
624 if (NULL != it) 751 if (NULL != it)
625 { 752 {
626 if (NULL != it->proc) 753 if (NULL != it->proc)
627 it->proc (it->proc_cls, &msg->identity, attr, NULL, NULL); 754 it->proc (it->proc_cls, &msg->identity, attr);
628 } 755 }
629 else if (NULL != op) 756 else if (NULL != op)
630 { 757 {
631 if (NULL != op->ar_cb) 758 if (NULL != op->ar_cb)
632 op->ar_cb (op->cls, &msg->identity, attr, NULL, NULL); 759 op->ar_cb (op->cls, &msg->identity, attr);
633 } 760 }
634 GNUNET_free (attr); 761 GNUNET_free (attr);
635 return; 762 return;
@@ -637,23 +764,24 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg)
637 GNUNET_assert (0); 764 GNUNET_assert (0);
638} 765}
639 766
767
640/** 768/**
641 * Handle an incoming message of type 769 * Handle an incoming message of type
642 * #GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 770 * #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT
643 * 771 *
644 * @param cls 772 * @param cls
645 * @param msg the message we received 773 * @param msg the message we received
646 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 774 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
647 */ 775 */
648static int 776static int
649check_attestation_result (void *cls, const struct AttributeResultMessage *msg) 777check_attestation_result (void *cls, const struct AttestationResultMessage *msg)
650{ 778{
651 size_t msg_len; 779 size_t msg_len;
652 size_t attr_len; 780 size_t attest_len;
653 781
654 msg_len = ntohs (msg->header.size); 782 msg_len = ntohs (msg->header.size);
655 attr_len = ntohs (msg->attr_len); 783 attest_len = ntohs (msg->attestation_len);
656 if (msg_len != sizeof(struct AttributeResultMessage) + attr_len) 784 if (msg_len != sizeof(struct AttestationResultMessage) + attest_len)
657 { 785 {
658 GNUNET_break (0); 786 GNUNET_break (0);
659 return GNUNET_SYSERR; 787 return GNUNET_SYSERR;
@@ -664,26 +792,27 @@ check_attestation_result (void *cls, const struct AttributeResultMessage *msg)
664 792
665/** 793/**
666 * Handle an incoming message of type 794 * Handle an incoming message of type
667 * #GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 795 * #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT
668 * 796 *
669 * @param cls 797 * @param cls
670 * @param msg the message we received 798 * @param msg the message we received
671 */ 799 */
672static void 800static void
673handle_attestation_result (void *cls, const struct AttributeResultMessage *msg) 801handle_attestation_result (void *cls, const struct
802 AttestationResultMessage *msg)
674{ 803{
675 static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; 804 static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy;
676 struct GNUNET_RECLAIM_Handle *h = cls; 805 struct GNUNET_RECLAIM_Handle *h = cls;
677 struct GNUNET_RECLAIM_AttributeIterator *it; 806 struct GNUNET_RECLAIM_AttestationIterator *it;
678 struct GNUNET_RECLAIM_Operation *op; 807 struct GNUNET_RECLAIM_Operation *op;
679 size_t attr_len; 808 size_t att_len;
680 uint32_t r_id = ntohl (msg->id); 809 uint32_t r_id = ntohl (msg->id);
681 810
682 attr_len = ntohs (msg->attr_len); 811 att_len = ntohs (msg->attestation_len);
683 LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attestation result.\n"); 812 LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attestation result.\n");
684 813
685 814
686 for (it = h->it_head; NULL != it; it = it->next) 815 for (it = h->ait_head; NULL != it; it = it->next)
687 if (it->r_id == r_id) 816 if (it->r_id == r_id)
688 break; 817 break;
689 for (op = h->op_head; NULL != op; op = op->next) 818 for (op = h->op_head; NULL != op; op = op->next)
@@ -705,12 +834,12 @@ handle_attestation_result (void *cls, const struct AttributeResultMessage *msg)
705 { 834 {
706 if (NULL != it->finish_cb) 835 if (NULL != it->finish_cb)
707 it->finish_cb (it->finish_cb_cls); 836 it->finish_cb (it->finish_cb_cls);
708 free_it (it); 837 free_ait (it);
709 } 838 }
710 if (NULL != op) 839 if (NULL != op)
711 { 840 {
712 if (NULL != op->ar_cb) 841 if (NULL != op->at_cb)
713 op->ar_cb (op->cls, NULL, NULL, NULL, NULL); 842 op->at_cb (op->cls, NULL, NULL);
714 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); 843 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
715 free_op (op); 844 free_op (op);
716 } 845 }
@@ -718,129 +847,26 @@ handle_attestation_result (void *cls, const struct AttributeResultMessage *msg)
718 } 847 }
719 848
720 { 849 {
721 struct GNUNET_RECLAIM_ATTESTATION_Claim *attr; 850 struct GNUNET_RECLAIM_Attestation *att;
722 attr = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &msg[1], attr_len); 851 att = GNUNET_RECLAIM_attestation_deserialize ((char *) &msg[1], att_len);
723 if (NULL != it)
724 {
725 if (NULL != it->proc)
726 it->proc (it->proc_cls, &msg->identity, NULL, attr, NULL);
727 }
728 else if (NULL != op)
729 {
730 if (NULL != op->ar_cb)
731 op->ar_cb (op->cls, &msg->identity, NULL, attr, NULL);
732 }
733 GNUNET_free (attr);
734 return;
735 }
736 GNUNET_assert (0);
737}
738
739/**
740 * Handle an incoming message of type
741 * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT
742 *
743 * @param cls
744 * @param msg the message we received
745 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
746 */
747static int
748check_reference_result (void *cls, const struct ReferenceResultMessage *msg)
749{
750 size_t msg_len;
751 size_t attr_len;
752 size_t ref_len;
753
754 msg_len = ntohs (msg->header.size);
755 attr_len = ntohs (msg->attest_len);
756 ref_len = ntohs (msg->ref_len);
757 if (msg_len != sizeof(struct ReferenceResultMessage) + attr_len + ref_len)
758 {
759 GNUNET_break (0);
760 return GNUNET_SYSERR;
761 }
762 return GNUNET_OK;
763}
764 852
765/**
766* Handle an incoming message of type
767* #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT
768*
769* @param cls
770* @param msg the message we received
771*/
772static void
773handle_reference_result (void *cls, const struct ReferenceResultMessage *msg)
774{
775 static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy;
776 struct GNUNET_RECLAIM_Handle *h = cls;
777 struct GNUNET_RECLAIM_AttributeIterator *it;
778 struct GNUNET_RECLAIM_Operation *op;
779 size_t attest_len;
780 size_t ref_len;
781 uint32_t r_id = ntohl (msg->id);
782 attest_len = ntohs (msg->attest_len);
783 ref_len = ntohs (msg->ref_len);
784 LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing reference result.\n");
785 for (it = h->it_head; NULL != it; it = it->next)
786 if (it->r_id == r_id)
787 break;
788 for (op = h->op_head; NULL != op; op = op->next)
789 if (op->r_id == r_id)
790 break;
791 if ((NULL == it) && (NULL == op))
792 return;
793
794 if ((0 ==
795 (memcmp (&msg->identity, &identity_dummy, sizeof(identity_dummy)))))
796 {
797 if ((NULL == it) && (NULL == op))
798 {
799 GNUNET_break (0);
800 force_reconnect (h);
801 return;
802 }
803 if (NULL != it)
804 {
805 if (NULL != it->finish_cb)
806 it->finish_cb (it->finish_cb_cls);
807 free_it (it);
808 }
809 if (NULL != op)
810 {
811 if (NULL != op->ar_cb)
812 op->ar_cb (op->cls, NULL, NULL, NULL, NULL);
813 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
814 free_op (op);
815 }
816 return;
817 }
818
819 {
820 struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref;
821 struct GNUNET_RECLAIM_ATTESTATION_Claim *attest;
822 attest = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &msg[1],
823 attest_len);
824 ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &msg[1]
825 + attest_len,
826 ref_len);
827 if (NULL != it) 853 if (NULL != it)
828 { 854 {
829 if (NULL != it->proc) 855 if (NULL != it->proc)
830 it->proc (it->proc_cls, &msg->identity, NULL, attest, ref); 856 it->proc (it->proc_cls, &msg->identity, att);
831 } 857 }
832 else if (NULL != op) 858 else if (NULL != op)
833 { 859 {
834 if (NULL != op->ar_cb) 860 if (NULL != op->at_cb)
835 op->ar_cb (op->cls, &msg->identity, NULL, attest, ref); 861 op->at_cb (op->cls, &msg->identity, att);
836 } 862 }
837 GNUNET_free (ref); 863 GNUNET_free (att);
838 GNUNET_free (attest);
839 return; 864 return;
840 } 865 }
841 GNUNET_assert (0); 866 GNUNET_assert (0);
842} 867}
843 868
869
844/** 870/**
845 * Handle an incoming message of type 871 * Handle an incoming message of type
846 * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT 872 * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
@@ -961,11 +987,7 @@ reconnect (struct GNUNET_RECLAIM_Handle *h)
961 h), 987 h),
962 GNUNET_MQ_hd_var_size (attestation_result, 988 GNUNET_MQ_hd_var_size (attestation_result,
963 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT, 989 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT,
964 struct AttributeResultMessage, 990 struct AttestationResultMessage,
965 h),
966 GNUNET_MQ_hd_var_size (reference_result,
967 GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT,
968 struct ReferenceResultMessage,
969 h), 991 h),
970 GNUNET_MQ_hd_fixed_size (ticket_result, 992 GNUNET_MQ_hd_fixed_size (ticket_result,
971 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, 993 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT,
@@ -1075,7 +1097,7 @@ struct GNUNET_RECLAIM_Operation *
1075GNUNET_RECLAIM_attribute_store ( 1097GNUNET_RECLAIM_attribute_store (
1076 struct GNUNET_RECLAIM_Handle *h, 1098 struct GNUNET_RECLAIM_Handle *h,
1077 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 1099 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
1078 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 1100 const struct GNUNET_RECLAIM_Attribute *attr,
1079 const struct GNUNET_TIME_Relative *exp_interval, 1101 const struct GNUNET_TIME_Relative *exp_interval,
1080 GNUNET_RECLAIM_ContinuationWithStatus cont, 1102 GNUNET_RECLAIM_ContinuationWithStatus cont,
1081 void *cont_cls) 1103 void *cont_cls)
@@ -1090,7 +1112,7 @@ GNUNET_RECLAIM_attribute_store (
1090 op->cls = cont_cls; 1112 op->cls = cont_cls;
1091 op->r_id = h->r_id_gen++; 1113 op->r_id = h->r_id_gen++;
1092 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 1114 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1093 attr_len = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (attr); 1115 attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (attr);
1094 op->env = GNUNET_MQ_msg_extra (sam, 1116 op->env = GNUNET_MQ_msg_extra (sam,
1095 attr_len, 1117 attr_len,
1096 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE); 1118 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE);
@@ -1098,7 +1120,7 @@ GNUNET_RECLAIM_attribute_store (
1098 sam->id = htonl (op->r_id); 1120 sam->id = htonl (op->r_id);
1099 sam->exp = GNUNET_htonll (exp_interval->rel_value_us); 1121 sam->exp = GNUNET_htonll (exp_interval->rel_value_us);
1100 1122
1101 GNUNET_RECLAIM_ATTRIBUTE_serialize (attr, (char *) &sam[1]); 1123 GNUNET_RECLAIM_attribute_serialize (attr, (char *) &sam[1]);
1102 1124
1103 sam->attr_len = htons (attr_len); 1125 sam->attr_len = htons (attr_len);
1104 if (NULL != h->mq) 1126 if (NULL != h->mq)
@@ -1122,7 +1144,7 @@ struct GNUNET_RECLAIM_Operation *
1122GNUNET_RECLAIM_attribute_delete ( 1144GNUNET_RECLAIM_attribute_delete (
1123 struct GNUNET_RECLAIM_Handle *h, 1145 struct GNUNET_RECLAIM_Handle *h,
1124 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 1146 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
1125 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 1147 const struct GNUNET_RECLAIM_Attribute *attr,
1126 GNUNET_RECLAIM_ContinuationWithStatus cont, 1148 GNUNET_RECLAIM_ContinuationWithStatus cont,
1127 void *cont_cls) 1149 void *cont_cls)
1128{ 1150{
@@ -1136,13 +1158,13 @@ GNUNET_RECLAIM_attribute_delete (
1136 op->cls = cont_cls; 1158 op->cls = cont_cls;
1137 op->r_id = h->r_id_gen++; 1159 op->r_id = h->r_id_gen++;
1138 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 1160 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1139 attr_len = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (attr); 1161 attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (attr);
1140 op->env = GNUNET_MQ_msg_extra (dam, 1162 op->env = GNUNET_MQ_msg_extra (dam,
1141 attr_len, 1163 attr_len,
1142 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE); 1164 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE);
1143 dam->identity = *pkey; 1165 dam->identity = *pkey;
1144 dam->id = htonl (op->r_id); 1166 dam->id = htonl (op->r_id);
1145 GNUNET_RECLAIM_ATTRIBUTE_serialize (attr, (char *) &dam[1]); 1167 GNUNET_RECLAIM_attribute_serialize (attr, (char *) &dam[1]);
1146 1168
1147 dam->attr_len = htons (attr_len); 1169 dam->attr_len = htons (attr_len);
1148 if (NULL != h->mq) 1170 if (NULL != h->mq)
@@ -1150,6 +1172,7 @@ GNUNET_RECLAIM_attribute_delete (
1150 return op; 1172 return op;
1151} 1173}
1152 1174
1175
1153/** 1176/**
1154 * Store an attestation. If the attestation is already present, 1177 * Store an attestation. If the attestation is already present,
1155 * it is replaced with the new attestation. 1178 * it is replaced with the new attestation.
@@ -1166,7 +1189,7 @@ struct GNUNET_RECLAIM_Operation *
1166GNUNET_RECLAIM_attestation_store ( 1189GNUNET_RECLAIM_attestation_store (
1167 struct GNUNET_RECLAIM_Handle *h, 1190 struct GNUNET_RECLAIM_Handle *h,
1168 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 1191 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
1169 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, 1192 const struct GNUNET_RECLAIM_Attestation *attr,
1170 const struct GNUNET_TIME_Relative *exp_interval, 1193 const struct GNUNET_TIME_Relative *exp_interval,
1171 GNUNET_RECLAIM_ContinuationWithStatus cont, 1194 GNUNET_RECLAIM_ContinuationWithStatus cont,
1172 void *cont_cls) 1195 void *cont_cls)
@@ -1181,7 +1204,7 @@ GNUNET_RECLAIM_attestation_store (
1181 op->cls = cont_cls; 1204 op->cls = cont_cls;
1182 op->r_id = h->r_id_gen++; 1205 op->r_id = h->r_id_gen++;
1183 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 1206 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1184 attr_len = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (attr); 1207 attr_len = GNUNET_RECLAIM_attestation_serialize_get_size (attr);
1185 op->env = GNUNET_MQ_msg_extra (sam, 1208 op->env = GNUNET_MQ_msg_extra (sam,
1186 attr_len, 1209 attr_len,
1187 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE); 1210 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE);
@@ -1189,7 +1212,7 @@ GNUNET_RECLAIM_attestation_store (
1189 sam->id = htonl (op->r_id); 1212 sam->id = htonl (op->r_id);
1190 sam->exp = GNUNET_htonll (exp_interval->rel_value_us); 1213 sam->exp = GNUNET_htonll (exp_interval->rel_value_us);
1191 1214
1192 GNUNET_RECLAIM_ATTESTATION_serialize (attr, (char *) &sam[1]); 1215 GNUNET_RECLAIM_attestation_serialize (attr, (char *) &sam[1]);
1193 1216
1194 sam->attr_len = htons (attr_len); 1217 sam->attr_len = htons (attr_len);
1195 if (NULL != h->mq) 1218 if (NULL != h->mq)
@@ -1197,6 +1220,7 @@ GNUNET_RECLAIM_attestation_store (
1197 return op; 1220 return op;
1198} 1221}
1199 1222
1223
1200/** 1224/**
1201 * Delete an attestation. Tickets used to share this attestation are updated 1225 * Delete an attestation. Tickets used to share this attestation are updated
1202 * accordingly. 1226 * accordingly.
@@ -1212,7 +1236,7 @@ struct GNUNET_RECLAIM_Operation *
1212GNUNET_RECLAIM_attestation_delete ( 1236GNUNET_RECLAIM_attestation_delete (
1213 struct GNUNET_RECLAIM_Handle *h, 1237 struct GNUNET_RECLAIM_Handle *h,
1214 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 1238 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
1215 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, 1239 const struct GNUNET_RECLAIM_Attestation *attr,
1216 GNUNET_RECLAIM_ContinuationWithStatus cont, 1240 GNUNET_RECLAIM_ContinuationWithStatus cont,
1217 void *cont_cls) 1241 void *cont_cls)
1218{ 1242{
@@ -1226,13 +1250,13 @@ GNUNET_RECLAIM_attestation_delete (
1226 op->cls = cont_cls; 1250 op->cls = cont_cls;
1227 op->r_id = h->r_id_gen++; 1251 op->r_id = h->r_id_gen++;
1228 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 1252 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1229 attr_len = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (attr); 1253 attr_len = GNUNET_RECLAIM_attestation_serialize_get_size (attr);
1230 op->env = GNUNET_MQ_msg_extra (dam, 1254 op->env = GNUNET_MQ_msg_extra (dam,
1231 attr_len, 1255 attr_len,
1232 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE); 1256 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE);
1233 dam->identity = *pkey; 1257 dam->identity = *pkey;
1234 dam->id = htonl (op->r_id); 1258 dam->id = htonl (op->r_id);
1235 GNUNET_RECLAIM_ATTESTATION_serialize (attr, (char *) &dam[1]); 1259 GNUNET_RECLAIM_attestation_serialize (attr, (char *) &dam[1]);
1236 1260
1237 dam->attr_len = htons (attr_len); 1261 dam->attr_len = htons (attr_len);
1238 if (NULL != h->mq) 1262 if (NULL != h->mq)
@@ -1240,95 +1264,6 @@ GNUNET_RECLAIM_attestation_delete (
1240 return op; 1264 return op;
1241} 1265}
1242 1266
1243/**
1244 * Store an attestation reference. If the reference is already present,
1245 * it is replaced with the new reference.
1246 *
1247 * @param h handle to the re:claimID service
1248 * @param pkey private key of the identity
1249 * @param attr the reference value
1250 * @param exp_interval the relative expiration interval for the reference
1251 * @param cont continuation to call when done
1252 * @param cont_cls closure for @a cont
1253 * @return handle to abort the request
1254 */
1255struct GNUNET_RECLAIM_Operation *
1256GNUNET_RECLAIM_attestation_reference_store (
1257 struct GNUNET_RECLAIM_Handle *h,
1258 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
1259 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
1260 const struct GNUNET_TIME_Relative *exp_interval,
1261 GNUNET_RECLAIM_ContinuationWithStatus cont,
1262 void *cont_cls)
1263{
1264 struct GNUNET_RECLAIM_Operation *op;
1265 struct AttributeStoreMessage *sam;
1266 size_t attr_len;
1267 op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
1268 op->h = h;
1269 op->as_cb = cont;
1270 op->cls = cont_cls;
1271 op->r_id = h->r_id_gen++;
1272 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1273 attr_len = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (attr);
1274 op->env = GNUNET_MQ_msg_extra (sam,
1275 attr_len,
1276 GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_STORE);
1277 sam->identity = *pkey;
1278 sam->id = htonl (op->r_id);
1279 sam->exp = GNUNET_htonll (exp_interval->rel_value_us);
1280
1281 GNUNET_RECLAIM_ATTESTATION_REF_serialize (attr, (char *) &sam[1]);
1282
1283 sam->attr_len = htons (attr_len);
1284 if (NULL != h->mq)
1285 GNUNET_MQ_send_copy (h->mq, op->env);
1286 return op;
1287}
1288
1289/**
1290 * Delete an attestation reference. Tickets used to share this reference are updated
1291 * accordingly.
1292 *
1293 * @param h handle to the re:claimID service
1294 * @param pkey Private key of the identity to delete the reference from
1295 * @param attr The reference
1296 * @param cont Continuation to call when done
1297 * @param cont_cls Closure for @a cont
1298 * @return handle Used to to abort the request
1299 */
1300struct GNUNET_RECLAIM_Operation *
1301GNUNET_RECLAIM_attestation_reference_delete (
1302 struct GNUNET_RECLAIM_Handle *h,
1303 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
1304 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
1305 GNUNET_RECLAIM_ContinuationWithStatus cont,
1306 void *cont_cls)
1307{
1308
1309 struct GNUNET_RECLAIM_Operation *op;
1310 struct AttributeDeleteMessage *dam;
1311 size_t attr_len;
1312
1313 op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
1314 op->h = h;
1315 op->as_cb = cont;
1316 op->cls = cont_cls;
1317 op->r_id = h->r_id_gen++;
1318 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1319 attr_len = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (attr);
1320 op->env = GNUNET_MQ_msg_extra (dam,
1321 attr_len,
1322 GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_DELETE);
1323 dam->identity = *pkey;
1324 dam->id = htonl (op->r_id);
1325 GNUNET_RECLAIM_ATTESTATION_REF_serialize (attr, (char *) &dam[1]);
1326
1327 dam->attr_len = htons (attr_len);
1328 if (NULL != h->mq)
1329 GNUNET_MQ_send_copy (h->mq, op->env);
1330 return op;
1331}
1332 1267
1333/** 1268/**
1334 * List all attributes for a local identity. 1269 * List all attributes for a local identity.
@@ -1440,6 +1375,119 @@ GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it)
1440 1375
1441 1376
1442/** 1377/**
1378 * List all attestations for a local identity.
1379 * This MUST lock the `struct GNUNET_RECLAIM_Handle`
1380 * for any other calls than #GNUNET_RECLAIM_get_attestations_next() and
1381 * #GNUNET_RECLAIM_get_attestations_stop. @a proc will be called once
1382 * immediately, and then again after
1383 * #GNUNET_RECLAIM_get_attestations_next() is invoked.
1384 *
1385 * On error (disconnect), @a error_cb will be invoked.
1386 * On normal completion, @a finish_cb proc will be
1387 * invoked.
1388 *
1389 * @param h Handle to the re:claimID service
1390 * @param identity Identity to iterate over
1391 * @param error_cb Function to call on error (i.e. disconnect),
1392 * the handle is afterwards invalid
1393 * @param error_cb_cls Closure for @a error_cb
1394 * @param proc Function to call on each attestation
1395 * @param proc_cls Closure for @a proc
1396 * @param finish_cb Function to call on completion
1397 * the handle is afterwards invalid
1398 * @param finish_cb_cls Closure for @a finish_cb
1399 * @return an iterator Handle to use for iteration
1400 */
1401struct GNUNET_RECLAIM_AttestationIterator *
1402GNUNET_RECLAIM_get_attestations_start (
1403 struct GNUNET_RECLAIM_Handle *h,
1404 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
1405 GNUNET_SCHEDULER_TaskCallback error_cb,
1406 void *error_cb_cls,
1407 GNUNET_RECLAIM_AttestationResult proc,
1408 void *proc_cls,
1409 GNUNET_SCHEDULER_TaskCallback finish_cb,
1410 void *finish_cb_cls)
1411{
1412 struct GNUNET_RECLAIM_AttestationIterator *ait;
1413 struct GNUNET_MQ_Envelope *env;
1414 struct AttestationIterationStartMessage *msg;
1415 uint32_t rid;
1416
1417 rid = h->r_id_gen++;
1418 ait = GNUNET_new (struct GNUNET_RECLAIM_AttestationIterator);
1419 ait->h = h;
1420 ait->error_cb = error_cb;
1421 ait->error_cb_cls = error_cb_cls;
1422 ait->finish_cb = finish_cb;
1423 ait->finish_cb_cls = finish_cb_cls;
1424 ait->proc = proc;
1425 ait->proc_cls = proc_cls;
1426 ait->r_id = rid;
1427 ait->identity = *identity;
1428 GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait);
1429 env =
1430 GNUNET_MQ_msg (msg,
1431 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START);
1432 msg->id = htonl (rid);
1433 msg->identity = *identity;
1434 if (NULL == h->mq)
1435 ait->env = env;
1436 else
1437 GNUNET_MQ_send (h->mq, env);
1438 return ait;
1439}
1440
1441
1442/**
1443 * Calls the record processor specified in #GNUNET_RECLAIM_get_attestation_start
1444 * for the next record.
1445 *
1446 * @param it the iterator
1447 */
1448void
1449GNUNET_RECLAIM_get_attestations_next (struct
1450 GNUNET_RECLAIM_AttestationIterator *ait)
1451{
1452 struct GNUNET_RECLAIM_Handle *h = ait->h;
1453 struct AttestationIterationNextMessage *msg;
1454 struct GNUNET_MQ_Envelope *env;
1455
1456 env =
1457 GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT);
1458 msg->id = htonl (ait->r_id);
1459 GNUNET_MQ_send (h->mq, env);
1460}
1461
1462
1463/**
1464 * Stops iteration and releases the handle for further calls. Must
1465 * be called on any iteration that has not yet completed prior to calling
1466 * #GNUNET_RECLAIM_disconnect.
1467 *
1468 * @param it the iterator
1469 */
1470void
1471GNUNET_RECLAIM_get_attestations_stop (struct
1472 GNUNET_RECLAIM_AttestationIterator *ait)
1473{
1474 struct GNUNET_RECLAIM_Handle *h = ait->h;
1475 struct GNUNET_MQ_Envelope *env;
1476 struct AttestationIterationStopMessage *msg;
1477
1478 if (NULL != h->mq)
1479 {
1480 env =
1481 GNUNET_MQ_msg (msg,
1482 GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP);
1483 msg->id = htonl (ait->r_id);
1484 GNUNET_MQ_send (h->mq, env);
1485 }
1486 free_ait (ait);
1487}
1488
1489
1490/**
1443 * Issues a ticket to another relying party. The identity may use 1491 * Issues a ticket to another relying party. The identity may use
1444 * @GNUNET_RECLAIM_ticket_consume to consume the ticket 1492 * @GNUNET_RECLAIM_ticket_consume to consume the ticket
1445 * and retrieve the attributes specified in the attribute list. 1493 * and retrieve the attributes specified in the attribute list.
@@ -1457,7 +1505,7 @@ GNUNET_RECLAIM_ticket_issue (
1457 struct GNUNET_RECLAIM_Handle *h, 1505 struct GNUNET_RECLAIM_Handle *h,
1458 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, 1506 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss,
1459 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, 1507 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp,
1460 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 1508 const struct GNUNET_RECLAIM_AttributeList *attrs,
1461 GNUNET_RECLAIM_TicketCallback cb, 1509 GNUNET_RECLAIM_TicketCallback cb,
1462 void *cb_cls) 1510 void *cb_cls)
1463{ 1511{
@@ -1472,7 +1520,7 @@ GNUNET_RECLAIM_ticket_issue (
1472 op->cls = cb_cls; 1520 op->cls = cb_cls;
1473 op->r_id = h->r_id_gen++; 1521 op->r_id = h->r_id_gen++;
1474 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 1522 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1475 attr_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs); 1523 attr_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs);
1476 op->env = GNUNET_MQ_msg_extra (tim, 1524 op->env = GNUNET_MQ_msg_extra (tim,
1477 attr_len, 1525 attr_len,
1478 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET); 1526 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET);
@@ -1480,7 +1528,7 @@ GNUNET_RECLAIM_ticket_issue (
1480 tim->rp = *rp; 1528 tim->rp = *rp;
1481 tim->id = htonl (op->r_id); 1529 tim->id = htonl (op->r_id);
1482 1530
1483 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, (char *) &tim[1]); 1531 GNUNET_RECLAIM_attribute_list_serialize (attrs, (char *) &tim[1]);
1484 1532
1485 tim->attr_len = htons (attr_len); 1533 tim->attr_len = htons (attr_len);
1486 if (NULL != h->mq) 1534 if (NULL != h->mq)
@@ -1506,7 +1554,7 @@ GNUNET_RECLAIM_ticket_consume (
1506 struct GNUNET_RECLAIM_Handle *h, 1554 struct GNUNET_RECLAIM_Handle *h,
1507 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1555 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
1508 const struct GNUNET_RECLAIM_Ticket *ticket, 1556 const struct GNUNET_RECLAIM_Ticket *ticket,
1509 GNUNET_RECLAIM_AttributeResult cb, 1557 GNUNET_RECLAIM_AttributeTicketResult cb,
1510 void *cb_cls) 1558 void *cb_cls)
1511{ 1559{
1512 struct GNUNET_RECLAIM_Operation *op; 1560 struct GNUNET_RECLAIM_Operation *op;
@@ -1514,7 +1562,7 @@ GNUNET_RECLAIM_ticket_consume (
1514 1562
1515 op = GNUNET_new (struct GNUNET_RECLAIM_Operation); 1563 op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
1516 op->h = h; 1564 op->h = h;
1517 op->ar_cb = cb; 1565 op->atr_cb = cb;
1518 op->cls = cb_cls; 1566 op->cls = cb_cls;
1519 op->r_id = h->r_id_gen++; 1567 op->r_id = h->r_id_gen++;
1520 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 1568 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
diff --git a/src/reclaim/reclaim_attestation.c b/src/reclaim/reclaim_attestation.c
new file mode 100644
index 000000000..bdf80a709
--- /dev/null
+++ b/src/reclaim/reclaim_attestation.c
@@ -0,0 +1,570 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2010-2015 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 * @file reclaim-attribute/reclaim_attestation.c
23 * @brief helper library to manage identity attribute attestations
24 * @author Martin Schanzenbach
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_reclaim_plugin.h"
29#include "reclaim_attestation.h"
30
31
32/**
33 * Handle for a plugin
34 */
35struct Plugin
36{
37 /**
38 * Name of the plugin
39 */
40 char *library_name;
41
42 /**
43 * Plugin API
44 */
45 struct GNUNET_RECLAIM_AttestationPluginFunctions *api;
46};
47
48
49/**
50 * Plugins
51 */
52static struct Plugin **attest_plugins;
53
54
55/**
56 * Number of plugins
57 */
58static unsigned int num_plugins;
59
60
61/**
62 * Init canary
63 */
64static int initialized;
65
66
67/**
68 * Add a plugin
69 *
70 * @param cls closure
71 * @param library_name name of the API library
72 * @param lib_ret the plugin API pointer
73 */
74static void
75add_plugin (void *cls, const char *library_name, void *lib_ret)
76{
77 struct GNUNET_RECLAIM_AttestationPluginFunctions *api = lib_ret;
78 struct Plugin *plugin;
79
80 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
81 "Loading attestation plugin `%s'\n",
82 library_name);
83 plugin = GNUNET_new (struct Plugin);
84 plugin->api = api;
85 plugin->library_name = GNUNET_strdup (library_name);
86 GNUNET_array_append (attest_plugins, num_plugins, plugin);
87}
88
89
90/**
91 * Load plugins
92 */
93static void
94init ()
95{
96 if (GNUNET_YES == initialized)
97 return;
98 initialized = GNUNET_YES;
99 GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_attestation_",
100 NULL,
101 &add_plugin,
102 NULL);
103}
104
105
106/**
107 * Convert an attestation type name to the corresponding number
108 *
109 * @param typename name to convert
110 * @return corresponding number, UINT32_MAX on error
111 */
112uint32_t
113GNUNET_RECLAIM_attestation_typename_to_number (const char *typename)
114{
115 unsigned int i;
116 struct Plugin *plugin;
117 uint32_t ret;
118 init ();
119 for (i = 0; i < num_plugins; i++)
120 {
121 plugin = attest_plugins[i];
122 if (UINT32_MAX !=
123 (ret = plugin->api->typename_to_number (plugin->api->cls,
124 typename)))
125 return ret;
126 }
127 return UINT32_MAX;
128}
129
130
131/**
132 * Convert an attestation type number to the corresponding attestation type string
133 *
134 * @param type number of a type
135 * @return corresponding typestring, NULL on error
136 */
137const char *
138GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type)
139{
140 unsigned int i;
141 struct Plugin *plugin;
142 const char *ret;
143
144 init ();
145 for (i = 0; i < num_plugins; i++)
146 {
147 plugin = attest_plugins[i];
148 if (NULL !=
149 (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
150 return ret;
151 }
152 return NULL;
153}
154
155
156/**
157 * Convert human-readable version of a 'claim' of an attestation to the binary
158 * representation
159 *
160 * @param type type of the claim
161 * @param s human-readable string
162 * @param data set to value in binary encoding (will be allocated)
163 * @param data_size set to number of bytes in @a data
164 * @return #GNUNET_OK on success
165 */
166int
167GNUNET_RECLAIM_attestation_string_to_value (uint32_t type,
168 const char *s,
169 void **data,
170 size_t *data_size)
171{
172 unsigned int i;
173 struct Plugin *plugin;
174
175 init ();
176 for (i = 0; i < num_plugins; i++)
177 {
178 plugin = attest_plugins[i];
179 if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
180 type,
181 s,
182 data,
183 data_size))
184 return GNUNET_OK;
185 }
186 return GNUNET_SYSERR;
187}
188
189
190/**
191 * Convert the 'claim' of an attestation to a string
192 *
193 * @param type the type of attestation
194 * @param data claim in binary encoding
195 * @param data_size number of bytes in @a data
196 * @return NULL on error, otherwise human-readable representation of the claim
197 */
198char *
199GNUNET_RECLAIM_attestation_value_to_string (uint32_t type,
200 const void *data,
201 size_t data_size)
202{
203 unsigned int i;
204 struct Plugin *plugin;
205 char *ret;
206
207 init ();
208 for (i = 0; i < num_plugins; i++)
209 {
210 plugin = attest_plugins[i];
211 if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
212 type,
213 data,
214 data_size)))
215 return ret;
216 }
217 return NULL;
218}
219
220
221/**
222 * Create a new attestation.
223 *
224 * @param attr_name the attestation name
225 * @param type the attestation type
226 * @param data the attestation value
227 * @param data_size the attestation value size
228 * @return the new attestation
229 */
230struct GNUNET_RECLAIM_Attestation *
231GNUNET_RECLAIM_attestation_new (const char *attr_name,
232 uint32_t type,
233 const void *data,
234 size_t data_size)
235{
236 struct GNUNET_RECLAIM_Attestation *attr;
237 char *write_ptr;
238 char *attr_name_tmp = GNUNET_strdup (attr_name);
239
240 GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
241
242 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attestation)
243 + strlen (attr_name_tmp) + 1 + data_size);
244 attr->type = type;
245 attr->data_size = data_size;
246 attr->flag = 0;
247 write_ptr = (char *) &attr[1];
248 GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
249 attr->name = write_ptr;
250 write_ptr += strlen (attr->name) + 1;
251 GNUNET_memcpy (write_ptr, data, data_size);
252 attr->data = write_ptr;
253 GNUNET_free (attr_name_tmp);
254 return attr;
255}
256
257
258/**
259 * Get required size for serialization buffer
260 *
261 * @param attrs the attribute list to serialize
262 * @return the required buffer size
263 */
264size_t
265GNUNET_RECLAIM_attestation_list_serialize_get_size (
266 const struct GNUNET_RECLAIM_AttestationList *attestations)
267{
268 struct GNUNET_RECLAIM_AttestationListEntry *le;
269 size_t len = 0;
270
271 for (le = attestations->list_head; NULL != le; le = le->next)
272 {
273 GNUNET_assert (NULL != le->attestation);
274 len += GNUNET_RECLAIM_attestation_serialize_get_size (le->attestation);
275 len += sizeof(struct GNUNET_RECLAIM_AttestationListEntry);
276 }
277 return len;
278}
279
280
281/**
282 * Serialize an attribute list
283 *
284 * @param attrs the attribute list to serialize
285 * @param result the serialized attribute
286 * @return length of serialized data
287 */
288size_t
289GNUNET_RECLAIM_attestation_list_serialize (
290 const struct GNUNET_RECLAIM_AttestationList *attestations,
291 char *result)
292{
293 struct GNUNET_RECLAIM_AttestationListEntry *le;
294 size_t len;
295 size_t total_len;
296 char *write_ptr;
297 write_ptr = result;
298 total_len = 0;
299 for (le = attestations->list_head; NULL != le; le = le->next)
300 {
301 GNUNET_assert (NULL != le->attestation);
302 len = GNUNET_RECLAIM_attestation_serialize (le->attestation, write_ptr);
303 total_len += len;
304 write_ptr += len;
305 }
306 return total_len;
307}
308
309
310/**
311 * Deserialize an attestation list
312 *
313 * @param data the serialized attribute list
314 * @param data_size the length of the serialized data
315 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
316 */
317struct GNUNET_RECLAIM_AttestationList *
318GNUNET_RECLAIM_attestation_list_deserialize (const char *data, size_t data_size)
319{
320 struct GNUNET_RECLAIM_AttestationList *al;
321 struct GNUNET_RECLAIM_AttestationListEntry *ale;
322 size_t att_len;
323 const char *read_ptr;
324
325 al = GNUNET_new (struct GNUNET_RECLAIM_AttestationList);
326
327 if ((data_size < sizeof(struct
328 Attestation)
329 + sizeof(struct GNUNET_RECLAIM_AttestationListEntry)))
330 return al;
331
332 read_ptr = data;
333 while (((data + data_size) - read_ptr) >= sizeof(struct Attestation))
334 {
335 ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry);
336 ale->attestation =
337 GNUNET_RECLAIM_attestation_deserialize (read_ptr,
338 data_size - (read_ptr - data));
339 if (NULL == ale->attestation)
340 {
341 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
342 "Failed to deserialize malformed attestation.\n");
343 GNUNET_free (ale);
344 return al;
345 }
346 GNUNET_CONTAINER_DLL_insert (al->list_head, al->list_tail, ale);
347 att_len = GNUNET_RECLAIM_attestation_serialize_get_size (ale->attestation);
348 read_ptr += att_len;
349 }
350 return al;
351}
352
353
354/**
355 * Make a (deep) copy of the attestation list
356 * @param attrs claim list to copy
357 * @return copied claim list
358 */
359struct GNUNET_RECLAIM_AttestationList *
360GNUNET_RECLAIM_attestation_list_dup (
361 const struct GNUNET_RECLAIM_AttestationList *al)
362{
363 struct GNUNET_RECLAIM_AttestationListEntry *ale;
364 struct GNUNET_RECLAIM_AttestationListEntry *result_ale;
365 struct GNUNET_RECLAIM_AttestationList *result;
366
367 result = GNUNET_new (struct GNUNET_RECLAIM_AttestationList);
368 for (ale = al->list_head; NULL != ale; ale = ale->next)
369 {
370 result_ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry);
371 GNUNET_assert (NULL != ale->attestation);
372 result_ale->attestation =
373 GNUNET_RECLAIM_attestation_new (ale->attestation->name,
374 ale->attestation->type,
375 ale->attestation->data,
376 ale->attestation->data_size);
377 result_ale->attestation->id = ale->attestation->id;
378 GNUNET_CONTAINER_DLL_insert (result->list_head,
379 result->list_tail,
380 result_ale);
381 }
382 return result;
383}
384
385
386/**
387 * Destroy attestation list
388 *
389 * @param attrs list to destroy
390 */
391void
392GNUNET_RECLAIM_attestation_list_destroy (
393 struct GNUNET_RECLAIM_AttestationList *al)
394{
395 struct GNUNET_RECLAIM_AttestationListEntry *ale;
396 struct GNUNET_RECLAIM_AttestationListEntry *tmp_ale;
397
398 for (ale = al->list_head; NULL != ale;)
399 {
400 if (NULL != ale->attestation)
401 GNUNET_free (ale->attestation);
402 tmp_ale = ale;
403 ale = ale->next;
404 GNUNET_free (tmp_ale);
405 }
406 GNUNET_free (al);
407}
408
409
410/**
411 * Get required size for serialization buffer
412 *
413 * @param attr the attestation to serialize
414 * @return the required buffer size
415 */
416size_t
417GNUNET_RECLAIM_attestation_serialize_get_size (
418 const struct GNUNET_RECLAIM_Attestation *attestation)
419{
420 return sizeof(struct Attestation) + strlen (attestation->name)
421 + attestation->data_size;
422}
423
424
425/**
426 * Serialize an attestation
427 *
428 * @param attr the attestation to serialize
429 * @param result the serialized attestation
430 * @return length of serialized data
431 */
432size_t
433GNUNET_RECLAIM_attestation_serialize (
434 const struct GNUNET_RECLAIM_Attestation *attestation,
435 char *result)
436{
437 size_t data_len_ser;
438 size_t name_len;
439 struct Attestation *atts;
440 char *write_ptr;
441
442 atts = (struct Attestation *) result;
443 atts->attestation_type = htons (attestation->type);
444 atts->attestation_flag = htonl (attestation->flag);
445 atts->attestation_id = attestation->id;
446 name_len = strlen (attestation->name);
447 atts->name_len = htons (name_len);
448 write_ptr = (char *) &atts[1];
449 GNUNET_memcpy (write_ptr, attestation->name, name_len);
450 write_ptr += name_len;
451 // TODO plugin-ize
452 // data_len_ser = plugin->serialize_attribute_value (attr,
453 // &attr_ser[1]);
454 data_len_ser = attestation->data_size;
455 GNUNET_memcpy (write_ptr, attestation->data, attestation->data_size);
456 atts->data_size = htons (data_len_ser);
457
458 return sizeof(struct Attestation) + strlen (attestation->name)
459 + attestation->data_size;
460}
461
462
463/**
464 * Deserialize an attestation
465 *
466 * @param data the serialized attestation
467 * @param data_size the length of the serialized data
468 *
469 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
470 */
471struct GNUNET_RECLAIM_Attestation *
472GNUNET_RECLAIM_attestation_deserialize (const char *data, size_t data_size)
473{
474 struct GNUNET_RECLAIM_Attestation *attestation;
475 struct Attestation *atts;
476 size_t data_len;
477 size_t name_len;
478 char *write_ptr;
479
480 if (data_size < sizeof(struct Attestation))
481 return NULL;
482
483 atts = (struct Attestation *) data;
484 data_len = ntohs (atts->data_size);
485 name_len = ntohs (atts->name_len);
486 if (data_size < sizeof(struct Attestation) + data_len + name_len)
487 {
488 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
489 "Buffer too small to deserialize\n");
490 return NULL;
491 }
492 attestation = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attestation)
493 + data_len + name_len + 1);
494 attestation->type = ntohs (atts->attestation_type);
495 attestation->flag = ntohl (atts->attestation_flag);
496 attestation->id = atts->attestation_id;
497 attestation->data_size = data_len;
498
499 write_ptr = (char *) &attestation[1];
500 GNUNET_memcpy (write_ptr, &atts[1], name_len);
501 write_ptr[name_len] = '\0';
502 attestation->name = write_ptr;
503
504 write_ptr += name_len + 1;
505 GNUNET_memcpy (write_ptr, (char *) &atts[1] + name_len,
506 attestation->data_size);
507 attestation->data = write_ptr;
508 return attestation;
509}
510
511
512struct GNUNET_RECLAIM_AttributeList*
513GNUNET_RECLAIM_attestation_get_attributes (const struct
514 GNUNET_RECLAIM_Attestation *attest)
515{
516 unsigned int i;
517 struct Plugin *plugin;
518 struct GNUNET_RECLAIM_AttributeList *ret;
519 init ();
520 for (i = 0; i < num_plugins; i++)
521 {
522 plugin = attest_plugins[i];
523 if (NULL !=
524 (ret = plugin->api->get_attributes (plugin->api->cls,
525 attest)))
526 return ret;
527 }
528 return NULL;
529}
530
531
532char*
533GNUNET_RECLAIM_attestation_get_issuer (const struct
534 GNUNET_RECLAIM_Attestation *attest)
535{
536 unsigned int i;
537 struct Plugin *plugin;
538 char *ret;
539 init ();
540 for (i = 0; i < num_plugins; i++)
541 {
542 plugin = attest_plugins[i];
543 if (NULL !=
544 (ret = plugin->api->get_issuer (plugin->api->cls,
545 attest)))
546 return ret;
547 }
548 return NULL;
549}
550
551
552int
553GNUNET_RECLAIM_attestation_get_expiration (const struct
554 GNUNET_RECLAIM_Attestation *attest,
555 struct GNUNET_TIME_Absolute* exp)
556{
557 unsigned int i;
558 struct Plugin *plugin;
559 init ();
560 for (i = 0; i < num_plugins; i++)
561 {
562 plugin = attest_plugins[i];
563 if (GNUNET_OK != plugin->api->get_expiration (plugin->api->cls,
564 attest,
565 exp))
566 continue;
567 return GNUNET_OK;
568 }
569 return GNUNET_SYSERR;
570}
diff --git a/src/reclaim/reclaim_attestation.h b/src/reclaim/reclaim_attestation.h
new file mode 100644
index 000000000..5747d8896
--- /dev/null
+++ b/src/reclaim/reclaim_attestation.h
@@ -0,0 +1,64 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2012-2015 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 * @author Martin Schanzenbach
22 * @file reclaim-attribute/reclaim_attestation.h
23 * @brief GNUnet reclaim identity attribute attestations
24 *
25 */
26#ifndef RECLAIM_ATTESTATION_H
27#define RECLAIM_ATTESTATION_H
28
29#include "gnunet_reclaim_service.h"
30
31/**
32 * Serialized attestation claim
33 */
34struct Attestation
35{
36 /**
37 * Attestation type
38 */
39 uint32_t attestation_type;
40
41 /**
42 * Attestation flag
43 */
44 uint32_t attestation_flag;
45
46 /**
47 * Attestation ID
48 */
49 struct GNUNET_RECLAIM_Identifier attestation_id;
50
51 /**
52 * Name length
53 */
54 uint32_t name_len;
55
56 /**
57 * Data size
58 */
59 uint32_t data_size;
60
61 // followed by data_size Attestation value data
62};
63
64#endif
diff --git a/src/reclaim/reclaim_attribute.c b/src/reclaim/reclaim_attribute.c
new file mode 100644
index 000000000..69c5351d3
--- /dev/null
+++ b/src/reclaim/reclaim_attribute.c
@@ -0,0 +1,546 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2010-2015 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 * @file reclaim-attribute/reclaim_attribute.c
23 * @brief helper library to manage identity attributes
24 * @author Martin Schanzenbach
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_reclaim_plugin.h"
29#include "reclaim_attribute.h"
30
31
32/**
33 * Handle for a plugin
34 */
35struct Plugin
36{
37 /**
38 * Name of the plugin
39 */
40 char *library_name;
41
42 /**
43 * Plugin API
44 */
45 struct GNUNET_RECLAIM_AttributePluginFunctions *api;
46};
47
48
49/**
50 * Plugins
51 */
52static struct Plugin **attr_plugins;
53
54
55/**
56 * Number of plugins
57 */
58static unsigned int num_plugins;
59
60
61/**
62 * Init canary
63 */
64static int initialized;
65
66
67/**
68 * Add a plugin
69 *
70 * @param cls closure
71 * @param library_name name of the API library
72 * @param lib_ret the plugin API pointer
73 */
74static void
75add_plugin (void *cls, const char *library_name, void *lib_ret)
76{
77 struct GNUNET_RECLAIM_AttributePluginFunctions *api = lib_ret;
78 struct Plugin *plugin;
79
80 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
81 "Loading attribute plugin `%s'\n",
82 library_name);
83 plugin = GNUNET_new (struct Plugin);
84 plugin->api = api;
85 plugin->library_name = GNUNET_strdup (library_name);
86 GNUNET_array_append (attr_plugins, num_plugins, plugin);
87}
88
89
90/**
91 * Load plugins
92 */
93static void
94init ()
95{
96 if (GNUNET_YES == initialized)
97 return;
98 initialized = GNUNET_YES;
99 GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_attribute_",
100 NULL,
101 &add_plugin,
102 NULL);
103}
104
105
106/**
107 * Convert a type name to the corresponding number
108 *
109 * @param typename name to convert
110 * @return corresponding number, UINT32_MAX on error
111 */
112uint32_t
113GNUNET_RECLAIM_attribute_typename_to_number (const char *typename)
114{
115 unsigned int i;
116 struct Plugin *plugin;
117 uint32_t ret;
118
119 init ();
120 for (i = 0; i < num_plugins; i++)
121 {
122 plugin = attr_plugins[i];
123 if (UINT32_MAX !=
124 (ret = plugin->api->typename_to_number (plugin->api->cls, typename)))
125 return ret;
126 }
127 return UINT32_MAX;
128}
129
130
131/**
132 * Convert a type number to the corresponding type string
133 *
134 * @param type number of a type
135 * @return corresponding typestring, NULL on error
136 */
137const char *
138GNUNET_RECLAIM_attribute_number_to_typename (uint32_t type)
139{
140 unsigned int i;
141 struct Plugin *plugin;
142 const char *ret;
143
144 init ();
145 for (i = 0; i < num_plugins; i++)
146 {
147 plugin = attr_plugins[i];
148 if (NULL !=
149 (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
150 return ret;
151 }
152 return NULL;
153}
154
155
156/**
157 * Convert human-readable version of a 'claim' of an attribute to the binary
158 * representation
159 *
160 * @param type type of the claim
161 * @param s human-readable string
162 * @param data set to value in binary encoding (will be allocated)
163 * @param data_size set to number of bytes in @a data
164 * @return #GNUNET_OK on success
165 */
166int
167GNUNET_RECLAIM_attribute_string_to_value (uint32_t type,
168 const char *s,
169 void **data,
170 size_t *data_size)
171{
172 unsigned int i;
173 struct Plugin *plugin;
174
175 init ();
176 for (i = 0; i < num_plugins; i++)
177 {
178 plugin = attr_plugins[i];
179 if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
180 type,
181 s,
182 data,
183 data_size))
184 return GNUNET_OK;
185 }
186 return GNUNET_SYSERR;
187}
188
189
190/**
191 * Convert the 'claim' of an attribute to a string
192 *
193 * @param type the type of attribute
194 * @param data claim in binary encoding
195 * @param data_size number of bytes in @a data
196 * @return NULL on error, otherwise human-readable representation of the claim
197 */
198char *
199GNUNET_RECLAIM_attribute_value_to_string (uint32_t type,
200 const void *data,
201 size_t data_size)
202{
203 unsigned int i;
204 struct Plugin *plugin;
205 char *ret;
206
207 init ();
208 for (i = 0; i < num_plugins; i++)
209 {
210 plugin = attr_plugins[i];
211 if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
212 type,
213 data,
214 data_size)))
215 return ret;
216 }
217 return NULL;
218}
219
220
221/**
222 * Create a new attribute.
223 *
224 * @param attr_name the attribute name
225 * @param attestation attestation ID of the attribute (maybe NULL)
226 * @param type the attribute type
227 * @param data the attribute value
228 * @param data_size the attribute value size
229 * @return the new attribute
230 */
231struct GNUNET_RECLAIM_Attribute *
232GNUNET_RECLAIM_attribute_new (const char *attr_name,
233 const struct GNUNET_RECLAIM_Identifier *attestation,
234 uint32_t type,
235 const void *data,
236 size_t data_size)
237{
238 struct GNUNET_RECLAIM_Attribute *attr;
239 char *write_ptr;
240 char *attr_name_tmp = GNUNET_strdup (attr_name);
241
242 GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
243
244 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attribute)
245 + strlen (attr_name_tmp) + 1 + data_size);
246 if (NULL != attestation)
247 attr->attestation = *attestation;
248 attr->type = type;
249 attr->data_size = data_size;
250 attr->flag = 0;
251 write_ptr = (char *) &attr[1];
252 GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
253 attr->name = write_ptr;
254 write_ptr += strlen (attr->name) + 1;
255 GNUNET_memcpy (write_ptr, data, data_size);
256 attr->data = write_ptr;
257 GNUNET_free (attr_name_tmp);
258 return attr;
259}
260
261
262/**
263 * Add a new attribute to a claim list
264 *
265 * @param attr_name the name of the new attribute claim
266 * @param type the type of the claim
267 * @param data claim payload
268 * @param data_size claim payload size
269 */
270void
271GNUNET_RECLAIM_attribute_list_add (
272 struct GNUNET_RECLAIM_AttributeList *al,
273 const char *attr_name,
274 const struct GNUNET_RECLAIM_Identifier *attestation,
275 uint32_t type,
276 const void *data,
277 size_t data_size)
278{
279 struct GNUNET_RECLAIM_AttributeListEntry *ale;
280
281 ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
282 ale->attribute =
283 GNUNET_RECLAIM_attribute_new (attr_name, attestation,
284 type, data, data_size);
285 GNUNET_CONTAINER_DLL_insert (al->list_head,
286 al->list_tail,
287 ale);
288}
289
290
291/**
292 * Get required size for serialization buffer
293 *
294 * @param attrs the attribute list to serialize
295 * @return the required buffer size
296 */
297size_t
298GNUNET_RECLAIM_attribute_list_serialize_get_size (
299 const struct GNUNET_RECLAIM_AttributeList *al)
300{
301 struct GNUNET_RECLAIM_AttributeListEntry *ale;
302 size_t len = 0;
303
304 for (ale = al->list_head; NULL != ale; ale = ale->next)
305 {
306 GNUNET_assert (NULL != ale->attribute);
307 len += GNUNET_RECLAIM_attribute_serialize_get_size (ale->attribute);
308 len += sizeof(struct GNUNET_RECLAIM_AttributeListEntry);
309 }
310 return len;
311}
312
313
314/**
315 * Serialize an attribute list
316 *
317 * @param attrs the attribute list to serialize
318 * @param result the serialized attribute
319 * @return length of serialized data
320 */
321size_t
322GNUNET_RECLAIM_attribute_list_serialize (
323 const struct GNUNET_RECLAIM_AttributeList *al,
324 char *result)
325{
326 struct GNUNET_RECLAIM_AttributeListEntry *ale;
327 size_t len;
328 size_t total_len;
329 char *write_ptr;
330 write_ptr = result;
331 total_len = 0;
332 for (ale = al->list_head; NULL != ale; ale = ale->next)
333 {
334 GNUNET_assert (NULL != ale->attribute);
335 len = GNUNET_RECLAIM_attribute_serialize (ale->attribute, write_ptr);
336 total_len += len;
337 write_ptr += len;
338 }
339 return total_len;
340}
341
342
343/**
344 * Deserialize an attribute list
345 *
346 * @param data the serialized attribute list
347 * @param data_size the length of the serialized data
348 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
349 */
350struct GNUNET_RECLAIM_AttributeList *
351GNUNET_RECLAIM_attribute_list_deserialize (const char *data, size_t data_size)
352{
353 struct GNUNET_RECLAIM_AttributeList *al;
354 struct GNUNET_RECLAIM_AttributeListEntry *ale;
355 size_t attr_len;
356 const char *read_ptr;
357
358 al = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
359 if (data_size < sizeof(struct Attribute) + sizeof(struct
360 GNUNET_RECLAIM_AttributeListEntry))
361 return al;
362 read_ptr = data;
363 while (((data + data_size) - read_ptr) >= sizeof(struct Attribute))
364 {
365 ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
366 ale->attribute =
367 GNUNET_RECLAIM_attribute_deserialize (read_ptr,
368 data_size - (read_ptr - data));
369 if (NULL == ale->attribute)
370 {
371 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
372 "Failed to deserialize malformed attribute.\n");
373 GNUNET_free (ale);
374 return al;
375 }
376 GNUNET_CONTAINER_DLL_insert (al->list_head, al->list_tail, ale);
377 attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (ale->attribute);
378 read_ptr += attr_len;
379 }
380 return al;
381}
382
383
384/**
385 * Make a (deep) copy of a claim list
386 * @param attrs claim list to copy
387 * @return copied claim list
388 */
389struct GNUNET_RECLAIM_AttributeList *
390GNUNET_RECLAIM_attribute_list_dup (
391 const struct GNUNET_RECLAIM_AttributeList *al)
392{
393 struct GNUNET_RECLAIM_AttributeListEntry *ale;
394 struct GNUNET_RECLAIM_AttributeListEntry *result_ale;
395 struct GNUNET_RECLAIM_AttributeList *result;
396
397 result = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
398 for (ale = al->list_head; NULL != ale; ale = ale->next)
399 {
400 result_ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
401 GNUNET_assert (NULL != ale->attribute);
402 {
403 result_ale->attribute =
404 GNUNET_RECLAIM_attribute_new (ale->attribute->name,
405 &ale->attribute->attestation,
406 ale->attribute->type,
407 ale->attribute->data,
408 ale->attribute->data_size);
409
410 result_ale->attribute->id = ale->attribute->id;
411 result_ale->attribute->flag = ale->attribute->flag;
412 }
413 GNUNET_CONTAINER_DLL_insert (result->list_head,
414 result->list_tail,
415 result_ale);
416 }
417 return result;
418}
419
420
421/**
422 * Destroy claim list
423 *
424 * @param attrs list to destroy
425 */
426void
427GNUNET_RECLAIM_attribute_list_destroy (
428 struct GNUNET_RECLAIM_AttributeList *al)
429{
430 struct GNUNET_RECLAIM_AttributeListEntry *ale;
431 struct GNUNET_RECLAIM_AttributeListEntry *tmp_ale;
432
433 for (ale = al->list_head; NULL != ale;)
434 {
435 if (NULL != ale->attribute)
436 GNUNET_free (ale->attribute);
437 tmp_ale = ale;
438 ale = ale->next;
439 GNUNET_free (tmp_ale);
440 }
441 GNUNET_free (al);
442}
443
444
445/**
446 * Get required size for serialization buffer
447 *
448 * @param attr the attribute to serialize
449 * @return the required buffer size
450 */
451size_t
452GNUNET_RECLAIM_attribute_serialize_get_size (
453 const struct GNUNET_RECLAIM_Attribute *attr)
454{
455 return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
456}
457
458
459/**
460 * Serialize an attribute
461 *
462 * @param attr the attribute to serialize
463 * @param result the serialized attribute
464 * @return length of serialized data
465 */
466size_t
467GNUNET_RECLAIM_attribute_serialize (
468 const struct GNUNET_RECLAIM_Attribute *attr,
469 char *result)
470{
471 size_t data_len_ser;
472 size_t name_len;
473 struct Attribute *attr_ser;
474 char *write_ptr;
475
476 attr_ser = (struct Attribute *) result;
477 attr_ser->attribute_type = htons (attr->type);
478 attr_ser->attribute_flag = htonl (attr->flag);
479 attr_ser->attribute_id = attr->id;
480 attr_ser->attestation_id = attr->attestation;
481 name_len = strlen (attr->name);
482 attr_ser->name_len = htons (name_len);
483 write_ptr = (char *) &attr_ser[1];
484 GNUNET_memcpy (write_ptr, attr->name, name_len);
485 write_ptr += name_len;
486 // TODO plugin-ize
487 // data_len_ser = plugin->serialize_attribute_value (attr,
488 // &attr_ser[1]);
489 data_len_ser = attr->data_size;
490 GNUNET_memcpy (write_ptr, attr->data, attr->data_size);
491 attr_ser->data_size = htons (data_len_ser);
492
493 return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
494}
495
496
497/**
498 * Deserialize an attribute
499 *
500 * @param data the serialized attribute
501 * @param data_size the length of the serialized data
502 *
503 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
504 */
505struct GNUNET_RECLAIM_Attribute *
506GNUNET_RECLAIM_attribute_deserialize (const char *data, size_t data_size)
507{
508 struct GNUNET_RECLAIM_Attribute *attr;
509 struct Attribute *attr_ser;
510 size_t data_len;
511 size_t name_len;
512 char *write_ptr;
513
514 if (data_size < sizeof(struct Attribute))
515 return NULL;
516
517 attr_ser = (struct Attribute *) data;
518 data_len = ntohs (attr_ser->data_size);
519 name_len = ntohs (attr_ser->name_len);
520 if (data_size < sizeof(struct Attribute) + data_len + name_len)
521 {
522 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
523 "Buffer too small to deserialize\n");
524 return NULL;
525 }
526 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attribute)
527 + data_len + name_len + 1);
528 attr->type = ntohs (attr_ser->attribute_type);
529 attr->flag = ntohl (attr_ser->attribute_flag);
530 attr->id = attr_ser->attribute_id;
531 attr->attestation = attr_ser->attestation_id;
532 attr->data_size = data_len;
533
534 write_ptr = (char *) &attr[1];
535 GNUNET_memcpy (write_ptr, &attr_ser[1], name_len);
536 write_ptr[name_len] = '\0';
537 attr->name = write_ptr;
538
539 write_ptr += name_len + 1;
540 GNUNET_memcpy (write_ptr, (char *) &attr_ser[1] + name_len, attr->data_size);
541 attr->data = write_ptr;
542 return attr;
543}
544
545
546/* end of reclaim_attribute.c */
diff --git a/src/reclaim-attribute/reclaim_attribute.h b/src/reclaim/reclaim_attribute.h
index 80f1e5aac..e54b210b9 100644
--- a/src/reclaim-attribute/reclaim_attribute.h
+++ b/src/reclaim/reclaim_attribute.h
@@ -39,14 +39,19 @@ struct Attribute
39 uint32_t attribute_type; 39 uint32_t attribute_type;
40 40
41 /** 41 /**
42 * Attribute version 42 * Attribute flag
43 */ 43 */
44 uint32_t attribute_version; 44 uint32_t attribute_flag;
45 45
46 /** 46 /**
47 * Attribute ID 47 * Attribute ID
48 */ 48 */
49 uint64_t attribute_id; 49 struct GNUNET_RECLAIM_Identifier attribute_id;
50
51 /**
52 * Attestation ID
53 */
54 struct GNUNET_RECLAIM_Identifier attestation_id;
50 55
51 /** 56 /**
52 * Name length 57 * Name length
@@ -72,14 +77,14 @@ struct Attestation
72 uint32_t attestation_type; 77 uint32_t attestation_type;
73 78
74 /** 79 /**
75 * Attestation version 80 * Attestation flag
76 */ 81 */
77 uint32_t attestation_version; 82 uint32_t attestation_flag;
78 83
79 /** 84 /**
80 * Attestation ID 85 * Attestation ID
81 */ 86 */
82 uint64_t attestation_id; 87 struct GNUNET_RECLAIM_Identifier attestation_id;
83 88
84 /** 89 /**
85 * Name length 90 * Name length
@@ -94,33 +99,4 @@ struct Attestation
94 // followed by data_size Attestation value data 99 // followed by data_size Attestation value data
95}; 100};
96 101
97/**
98 * Serialized attestation reference
99 */
100struct Attestation_Reference
101{
102 /**
103 * Reference ID
104 */
105 uint64_t reference_id;
106
107 /**
108 * The ID of the referenced attestation
109 */
110 uint64_t attestation_id;
111
112 /**
113 * Claim Name length
114 */
115 uint32_t name_len;
116
117 /**
118 * Length of the referenced value
119 */
120 uint32_t ref_value_len;
121
122
123 // followed by the name and referenced value
124};
125
126#endif 102#endif
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c
index eda58fdd2..d94b5ae46 100644
--- a/src/regex/gnunet-daemon-regexprofiler.c
+++ b/src/regex/gnunet-daemon-regexprofiler.c
@@ -118,7 +118,7 @@ shutdown_task (void *cls)
118 } 118 }
119 if (NULL != reannounce_task) 119 if (NULL != reannounce_task)
120 { 120 {
121 GNUNET_free (GNUNET_SCHEDULER_cancel (reannounce_task)); 121 GNUNET_free_nz (GNUNET_SCHEDULER_cancel (reannounce_task));
122 reannounce_task = NULL; 122 reannounce_task = NULL;
123 } 123 }
124 if (NULL != dht_handle) 124 if (NULL != dht_handle)
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index 9c7aa9119..c087abae9 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -247,10 +247,10 @@ evaluate_block_regex_accept (void *cls,
247 return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; 247 return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE;
248 } 248 }
249 if (GNUNET_OK != 249 if (GNUNET_OK !=
250 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT, 250 GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT,
251 &rba->purpose, 251 &rba->purpose,
252 &rba->signature, 252 &rba->signature,
253 &rba->peer.public_key)) 253 &rba->peer.public_key))
254 { 254 {
255 GNUNET_break_op (0); 255 GNUNET_break_op (0);
256 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 256 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c
index 3cf48f3c2..d2c69f131 100644
--- a/src/regex/regex_internal_dht.c
+++ b/src/regex/regex_internal_dht.c
@@ -136,9 +136,9 @@ regex_iterator (void *cls,
136 GNUNET_CRYPTO_eddsa_key_get_public (h->priv, 136 GNUNET_CRYPTO_eddsa_key_get_public (h->priv,
137 &ab.peer.public_key); 137 &ab.peer.public_key);
138 GNUNET_assert (GNUNET_OK == 138 GNUNET_assert (GNUNET_OK ==
139 GNUNET_CRYPTO_eddsa_sign (h->priv, 139 GNUNET_CRYPTO_eddsa_sign_ (h->priv,
140 &ab.purpose, 140 &ab.purpose,
141 &ab.signature)); 141 &ab.signature));
142 142
143 GNUNET_STATISTICS_update (h->stats, "# regex accepting blocks stored", 143 GNUNET_STATISTICS_update (h->stats, "# regex accepting blocks stored",
144 1, GNUNET_NO); 144 1, GNUNET_NO);
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c
index 02a2c6daf..30eade623 100644
--- a/src/rest/gnunet-rest-server.c
+++ b/src/rest/gnunet-rest-server.c
@@ -27,7 +27,7 @@
27#include <microhttpd.h> 27#include <microhttpd.h>
28#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
29#include "gnunet_rest_plugin.h" 29#include "gnunet_rest_plugin.h"
30 30#include "gnunet_mhd_compat.h"
31 31
32/** 32/**
33 * Default Socks5 listen port. 33 * Default Socks5 listen port.
@@ -302,7 +302,7 @@ url_iterator (void *cls,
302} 302}
303 303
304 304
305static int 305static MHD_RESULT
306post_data_iter (void *cls, 306post_data_iter (void *cls,
307 enum MHD_ValueKind kind, 307 enum MHD_ValueKind kind,
308 const char *key, 308 const char *key,
@@ -359,11 +359,11 @@ post_data_iter (void *cls,
359 * @a upload_data provided; the method must update this 359 * @a upload_data provided; the method must update this
360 * value to the number of bytes NOT processed; 360 * value to the number of bytes NOT processed;
361 * @param con_cls pointer to location where we store the 'struct Request' 361 * @param con_cls pointer to location where we store the 'struct Request'
362 * @return MHD_YES if the connection was handled successfully, 362 * @return #MHD_YES if the connection was handled successfully,
363 * MHD_NO if the socket must be closed due to a serious 363 * #MHD_NO if the socket must be closed due to a serious
364 * error while handling the request 364 * error while handling the request
365 */ 365 */
366static int 366static MHD_RESULT
367create_response (void *cls, 367create_response (void *cls,
368 struct MHD_Connection *con, 368 struct MHD_Connection *con,
369 const char *url, 369 const char *url,
@@ -430,7 +430,7 @@ create_response (void *cls,
430 rest_conndata_handle); 430 rest_conndata_handle);
431 con_handle->pp = MHD_create_post_processor (con, 431 con_handle->pp = MHD_create_post_processor (con,
432 65536, 432 65536,
433 post_data_iter, 433 &post_data_iter,
434 rest_conndata_handle); 434 rest_conndata_handle);
435 if (*upload_data_size) 435 if (*upload_data_size)
436 { 436 {
@@ -509,9 +509,13 @@ create_response (void *cls,
509 allow_headers); 509 allow_headers);
510 } 510 }
511 run_mhd_now (); 511 run_mhd_now ();
512 int ret = MHD_queue_response (con, con_handle->status, con_handle->response); 512 {
513 cleanup_handle (con_handle); 513 MHD_RESULT ret = MHD_queue_response (con,
514 return ret; 514 con_handle->status,
515 con_handle->response);
516 cleanup_handle (con_handle);
517 return ret;
518 }
515} 519}
516 520
517 521
diff --git a/src/rest/plugin_rest_config.c b/src/rest/plugin_rest_config.c
index d89c858ee..43dea1b9f 100644
--- a/src/rest/plugin_rest_config.c
+++ b/src/rest/plugin_rest_config.c
@@ -175,6 +175,7 @@ get_cont (struct GNUNET_REST_RequestHandle *con_handle,
175 } 175 }
176 response = json_dumps (result, 0); 176 response = json_dumps (result, 0);
177 resp = GNUNET_REST_create_response (response); 177 resp = GNUNET_REST_create_response (response);
178 MHD_add_response_header (resp, "Content-Type", "application/json");
178 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 179 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
179 cleanup_handle (handle); 180 cleanup_handle (handle);
180 GNUNET_free (response); 181 GNUNET_free (response);
diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am
index b3b2877ca..6efd461c1 100644
--- a/src/revocation/Makefile.am
+++ b/src/revocation/Makefile.am
@@ -16,7 +16,8 @@ pkgcfg_DATA = \
16 revocation.conf 16 revocation.conf
17 17
18bin_PROGRAMS = \ 18bin_PROGRAMS = \
19 gnunet-revocation 19 gnunet-revocation \
20 gnunet-revocation-tvg
20 21
21 22
22plugin_LTLIBRARIES = \ 23plugin_LTLIBRARIES = \
@@ -41,6 +42,15 @@ gnunet_revocation_LDADD = \
41 $(top_builddir)/src/util/libgnunetutil.la \ 42 $(top_builddir)/src/util/libgnunetutil.la \
42 $(GN_LIBINTL) 43 $(GN_LIBINTL)
43 44
45gnunet_revocation_tvg_SOURCES = \
46 gnunet-revocation-tvg.c
47gnunet_revocation_tvg_LDADD = \
48 libgnunetrevocation.la \
49 $(top_builddir)/src/identity/libgnunetidentity.la \
50 $(top_builddir)/src/util/libgnunetutil.la \
51 $(GN_LIBINTL)
52
53
44lib_LTLIBRARIES = libgnunetrevocation.la 54lib_LTLIBRARIES = libgnunetrevocation.la
45 55
46libgnunetrevocation_la_SOURCES = \ 56libgnunetrevocation_la_SOURCES = \
diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c
new file mode 100644
index 000000000..23a4bf020
--- /dev/null
+++ b/src/revocation/gnunet-revocation-tvg.c
@@ -0,0 +1,123 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020 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 * @file util/gnunet-revocation-tvg.c
23 * @brief Generate test vectors for revocation.
24 * @author Martin Schanzenbach
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_signatures.h"
29#include "gnunet_revocation_service.h"
30#include "gnunet_dnsparser_lib.h"
31#include "gnunet_testing_lib.h"
32#include <inttypes.h>
33
34#define TEST_EPOCHS 2
35#define TEST_DIFFICULTY 5
36
37/**
38 * Main function that will be run.
39 *
40 * @param cls closure
41 * @param args remaining command-line arguments
42 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
43 * @param cfg configuration
44 */
45static void
46run (void *cls,
47 char *const *args,
48 const char *cfgfile,
49 const struct GNUNET_CONFIGURATION_Handle *cfg)
50{
51 struct GNUNET_CRYPTO_EcdsaPrivateKey id_priv;
52 struct GNUNET_CRYPTO_EcdsaPublicKey id_pub;
53 struct GNUNET_REVOCATION_PowP pow;
54 struct GNUNET_REVOCATION_PowCalculationHandle *ph;
55 char* data_enc;
56
57 GNUNET_CRYPTO_ecdsa_key_create (&id_priv);
58 GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv,
59 &id_pub);
60 GNUNET_STRINGS_base64_encode (&id_priv,
61 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey),
62 &data_enc);
63 fprintf(stdout, "Zone private key (d):\n%s\n\n", data_enc);
64 GNUNET_free (data_enc);
65 GNUNET_STRINGS_base64_encode (&id_pub,
66 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey),
67 &data_enc);
68 fprintf(stdout, "Zone public key (zk):\n%s\n\n", data_enc);
69 GNUNET_free (data_enc);
70
71 GNUNET_REVOCATION_pow_init (&id_priv,
72 &pow);
73 ph = GNUNET_REVOCATION_pow_start (&pow,
74 TEST_EPOCHS,
75 TEST_DIFFICULTY);
76 fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n",
77 TEST_DIFFICULTY,
78 TEST_EPOCHS,
79 TEST_DIFFICULTY + TEST_EPOCHS);
80 uint64_t pow_passes = 0;
81 while (GNUNET_YES != GNUNET_REVOCATION_pow_round (ph))
82 {
83 pow_passes++;
84 }
85 GNUNET_STRINGS_base64_encode (&pow,
86 sizeof (struct GNUNET_REVOCATION_PowP),
87 &data_enc);
88 fprintf(stdout, "Proof:\n%s\n", data_enc);
89 GNUNET_free (data_enc);
90}
91
92
93/**
94 * The main function of the test vector generation tool.
95 *
96 * @param argc number of arguments from the command line
97 * @param argv command line arguments
98 * @return 0 ok, 1 on error
99 */
100int
101main (int argc,
102 char *const *argv)
103{
104 const struct GNUNET_GETOPT_CommandLineOption options[] = {
105 GNUNET_GETOPT_OPTION_END
106 };
107
108 GNUNET_assert (GNUNET_OK ==
109 GNUNET_log_setup ("gnunet-revocation-tvg",
110 "INFO",
111 NULL));
112 if (GNUNET_OK !=
113 GNUNET_PROGRAM_run (argc, argv,
114 "gnunet-revocation-tvg",
115 "Generate test vectors for revocation",
116 options,
117 &run, NULL))
118 return 1;
119 return 0;
120}
121
122
123/* end of gnunet-revocation-tvg.c */
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c
index f5aa2d17e..0e1e482ab 100644
--- a/src/revocation/gnunet-revocation.c
+++ b/src/revocation/gnunet-revocation.c
@@ -28,6 +28,10 @@
28#include "gnunet_revocation_service.h" 28#include "gnunet_revocation_service.h"
29#include "gnunet_identity_service.h" 29#include "gnunet_identity_service.h"
30 30
31/**
32 * Pow passes
33 */
34static unsigned int pow_passes = 1;
31 35
32/** 36/**
33 * Final status code. 37 * Final status code.
@@ -55,6 +59,11 @@ static char *revoke_ego;
55static char *test_ego; 59static char *test_ego;
56 60
57/** 61/**
62 * -e option.
63 */
64static unsigned int epochs = 1;
65
66/**
58 * Handle for revocation query. 67 * Handle for revocation query.
59 */ 68 */
60static struct GNUNET_REVOCATION_Query *q; 69static struct GNUNET_REVOCATION_Query *q;
@@ -80,10 +89,19 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
80static unsigned long long matching_bits; 89static unsigned long long matching_bits;
81 90
82/** 91/**
92 * Epoch length
93 */
94static struct GNUNET_TIME_Relative epoch_duration;
95
96/**
83 * Task used for proof-of-work calculation. 97 * Task used for proof-of-work calculation.
84 */ 98 */
85static struct GNUNET_SCHEDULER_Task *pow_task; 99static struct GNUNET_SCHEDULER_Task *pow_task;
86 100
101/**
102 * Proof-of-work object
103 */
104static struct GNUNET_REVOCATION_PowP proof_of_work;
87 105
88/** 106/**
89 * Function run if the user aborts with CTRL-C. 107 * Function run if the user aborts with CTRL-C.
@@ -93,6 +111,7 @@ static struct GNUNET_SCHEDULER_Task *pow_task;
93static void 111static void
94do_shutdown (void *cls) 112do_shutdown (void *cls)
95{ 113{
114 fprintf (stderr, "%s", _ ("Shutting down...\n"));
96 if (NULL != el) 115 if (NULL != el)
97 { 116 {
98 GNUNET_IDENTITY_ego_lookup_cancel (el); 117 GNUNET_IDENTITY_ego_lookup_cancel (el);
@@ -188,37 +207,13 @@ print_revocation_result (void *cls, int is_valid)
188 207
189 208
190/** 209/**
191 * Data needed to perform a revocation.
192 */
193struct RevocationData
194{
195 /**
196 * Public key.
197 */
198 struct GNUNET_CRYPTO_EcdsaPublicKey key;
199
200 /**
201 * Revocation signature data.
202 */
203 struct GNUNET_CRYPTO_EcdsaSignature sig;
204
205 /**
206 * Proof of work (in NBO).
207 */
208 uint64_t pow GNUNET_PACKED;
209};
210
211
212/**
213 * Perform the revocation. 210 * Perform the revocation.
214 */ 211 */
215static void 212static void
216perform_revocation (const struct RevocationData *rd) 213perform_revocation ()
217{ 214{
218 h = GNUNET_REVOCATION_revoke (cfg, 215 h = GNUNET_REVOCATION_revoke (cfg,
219 &rd->key, 216 &proof_of_work,
220 &rd->sig,
221 rd->pow,
222 &print_revocation_result, 217 &print_revocation_result,
223 NULL); 218 NULL);
224} 219}
@@ -231,13 +226,13 @@ perform_revocation (const struct RevocationData *rd)
231 * @param rd data to sync 226 * @param rd data to sync
232 */ 227 */
233static void 228static void
234sync_rd (const struct RevocationData *rd) 229sync_pow ()
235{ 230{
236 if ((NULL != filename) && 231 if ((NULL != filename) &&
237 (sizeof(struct RevocationData) == 232 (sizeof(struct GNUNET_REVOCATION_PowP) !=
238 GNUNET_DISK_fn_write (filename, 233 GNUNET_DISK_fn_write (filename,
239 &rd, 234 &proof_of_work,
240 sizeof(rd), 235 sizeof(struct GNUNET_REVOCATION_PowP),
241 GNUNET_DISK_PERM_USER_READ 236 GNUNET_DISK_PERM_USER_READ
242 | GNUNET_DISK_PERM_USER_WRITE))) 237 | GNUNET_DISK_PERM_USER_WRITE)))
243 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename); 238 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename);
@@ -252,15 +247,16 @@ sync_rd (const struct RevocationData *rd)
252static void 247static void
253calculate_pow_shutdown (void *cls) 248calculate_pow_shutdown (void *cls)
254{ 249{
255 struct RevocationData *rd = cls; 250 struct GNUNET_REVOCATION_PowCalculationHandle *ph = cls;
256 251 fprintf (stderr, "%s", _ ("Cancelling calculation.\n"));
252 sync_pow ();
257 if (NULL != pow_task) 253 if (NULL != pow_task)
258 { 254 {
259 GNUNET_SCHEDULER_cancel (pow_task); 255 GNUNET_SCHEDULER_cancel (pow_task);
260 pow_task = NULL; 256 pow_task = NULL;
261 } 257 }
262 sync_rd (rd); 258 if (NULL != ph)
263 GNUNET_free (rd); 259 GNUNET_REVOCATION_pow_stop (ph);
264} 260}
265 261
266 262
@@ -272,38 +268,26 @@ calculate_pow_shutdown (void *cls)
272static void 268static void
273calculate_pow (void *cls) 269calculate_pow (void *cls)
274{ 270{
275 struct RevocationData *rd = cls; 271 struct GNUNET_REVOCATION_PowCalculationHandle *ph = cls;
276 272
277 /* store temporary results */ 273 /* store temporary results */
278 pow_task = NULL; 274 pow_task = NULL;
279 if (0 == (rd->pow % 128)) 275 if (0 == (pow_passes % 128))
280 sync_rd (rd); 276 sync_pow ();
281 /* display progress estimate */
282 if ((0 == ((1 << matching_bits) / 100 / 50)) ||
283 (0 == (rd->pow % ((1 << matching_bits) / 100 / 50))))
284 fprintf (stderr, "%s", ".");
285 if ((0 != rd->pow) && ((0 == ((1 << matching_bits) / 100)) ||
286 (0 == (rd->pow % ((1 << matching_bits) / 100)))))
287 fprintf (stderr,
288 " - @ %3u%% (estimate)\n",
289 (unsigned int) (rd->pow * 100) / (1 << matching_bits));
290 /* actually do POW calculation */ 277 /* actually do POW calculation */
291 rd->pow++; 278 if (GNUNET_OK == GNUNET_REVOCATION_pow_round (ph))
292 if (GNUNET_OK == GNUNET_REVOCATION_check_pow (&rd->key,
293 rd->pow,
294 (unsigned int) matching_bits))
295 { 279 {
296 if ((NULL != filename) && 280 if ((NULL != filename) &&
297 (sizeof(struct RevocationData) != 281 (sizeof(struct GNUNET_REVOCATION_PowP) !=
298 GNUNET_DISK_fn_write (filename, 282 GNUNET_DISK_fn_write (filename,
299 rd, 283 &proof_of_work,
300 sizeof(struct RevocationData), 284 sizeof(struct GNUNET_REVOCATION_PowP),
301 GNUNET_DISK_PERM_USER_READ 285 GNUNET_DISK_PERM_USER_READ
302 | GNUNET_DISK_PERM_USER_WRITE))) 286 | GNUNET_DISK_PERM_USER_WRITE)))
303 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename); 287 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename);
304 if (perform) 288 if (perform)
305 { 289 {
306 perform_revocation (rd); 290 perform_revocation ();
307 } 291 }
308 else 292 else
309 { 293 {
@@ -316,7 +300,19 @@ calculate_pow (void *cls)
316 } 300 }
317 return; 301 return;
318 } 302 }
319 pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, rd); 303 pow_passes++;
304 /**
305 * Otherwise CTRL-C does not work
306 */
307 if (0 == pow_passes % 128)
308 pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
309 &calculate_pow,
310 ph);
311 else
312 pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
313 &calculate_pow,
314 ph);
315
320} 316}
321 317
322 318
@@ -327,10 +323,11 @@ calculate_pow (void *cls)
327 * @param ego the ego, NULL if not found 323 * @param ego the ego, NULL if not found
328 */ 324 */
329static void 325static void
330ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego) 326ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego)
331{ 327{
332 struct RevocationData *rd;
333 struct GNUNET_CRYPTO_EcdsaPublicKey key; 328 struct GNUNET_CRYPTO_EcdsaPublicKey key;
329 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
330 struct GNUNET_REVOCATION_PowCalculationHandle *ph = NULL;
334 331
335 el = NULL; 332 el = NULL;
336 if (NULL == ego) 333 if (NULL == ego)
@@ -340,44 +337,55 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
340 return; 337 return;
341 } 338 }
342 GNUNET_IDENTITY_ego_get_public_key (ego, &key); 339 GNUNET_IDENTITY_ego_get_public_key (ego, &key);
343 rd = GNUNET_new (struct RevocationData); 340 privkey = GNUNET_IDENTITY_ego_get_private_key (ego);
341 memset (&proof_of_work, 0, sizeof (proof_of_work));
344 if ((NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) && 342 if ((NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) &&
345 (sizeof(struct RevocationData) == 343 (sizeof(proof_of_work) ==
346 GNUNET_DISK_fn_read (filename, rd, sizeof(struct RevocationData)))) 344 GNUNET_DISK_fn_read (filename, &proof_of_work, sizeof(proof_of_work))))
347 { 345 {
348 if (0 != GNUNET_memcmp (&rd->key, &key)) 346 if (0 != GNUNET_memcmp (&proof_of_work.key, &key))
349 { 347 {
350 fprintf (stderr, 348 fprintf (stderr,
351 _ ("Error: revocation certificate in `%s' is not for `%s'\n"), 349 _ ("Error: revocation certificate in `%s' is not for `%s'\n"),
352 filename, 350 filename,
353 revoke_ego); 351 revoke_ego);
354 GNUNET_free (rd);
355 return; 352 return;
356 } 353 }
357 } 354 if (GNUNET_YES ==
358 else 355 GNUNET_REVOCATION_check_pow (&proof_of_work,
359 { 356 (unsigned int) matching_bits,
360 GNUNET_REVOCATION_sign_revocation (GNUNET_IDENTITY_ego_get_private_key ( 357 epoch_duration))
361 ego), 358 {
362 &rd->sig); 359 fprintf (stderr, "%s", _ ("Revocation certificate ready\n"));
363 rd->key = key; 360 if (perform)
364 } 361 perform_revocation ();
365 if (GNUNET_YES == 362 else
366 GNUNET_REVOCATION_check_pow (&key, rd->pow, (unsigned int) matching_bits)) 363 GNUNET_SCHEDULER_shutdown ();
367 { 364 return;
368 fprintf (stderr, "%s", _ ("Revocation certificate ready\n")); 365 }
369 if (perform) 366 /**
370 perform_revocation (rd); 367 * Certificate not yet ready
371 else 368 */
372 GNUNET_SCHEDULER_shutdown (); 369 fprintf (stderr,
373 GNUNET_free (rd); 370 "%s",
374 return; 371 _ ("Continuing calculation where left off...\n"));
372 ph = GNUNET_REVOCATION_pow_start (&proof_of_work,
373 epochs,
374 matching_bits);
375 } 375 }
376 fprintf (stderr, 376 fprintf (stderr,
377 "%s", 377 "%s",
378 _ ("Revocation certificate not ready, calculating proof of work\n")); 378 _ ("Revocation certificate not ready, calculating proof of work\n"));
379 pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, rd); 379 if (NULL == ph)
380 GNUNET_SCHEDULER_add_shutdown (&calculate_pow_shutdown, rd); 380 {
381 GNUNET_REVOCATION_pow_init (privkey,
382 &proof_of_work);
383 ph = GNUNET_REVOCATION_pow_start (&proof_of_work,
384 epochs, /* Epochs */
385 matching_bits);
386 }
387 pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph);
388 GNUNET_SCHEDULER_add_shutdown (&calculate_pow_shutdown, ph);
381} 389}
382 390
383 391
@@ -396,7 +404,6 @@ run (void *cls,
396 const struct GNUNET_CONFIGURATION_Handle *c) 404 const struct GNUNET_CONFIGURATION_Handle *c)
397{ 405{
398 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 406 struct GNUNET_CRYPTO_EcdsaPublicKey pk;
399 struct RevocationData rd;
400 407
401 cfg = c; 408 cfg = c;
402 if (NULL != test_ego) 409 if (NULL != test_ego)
@@ -429,6 +436,17 @@ run (void *cls,
429 "WORKBITS"); 436 "WORKBITS");
430 return; 437 return;
431 } 438 }
439 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg,
440 "REVOCATION",
441 "EPOCH_DURATION",
442 &epoch_duration))
443 {
444 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
445 "REVOCATION",
446 "EPOCH_DURATION");
447 return;
448 }
449
432 if (NULL != revoke_ego) 450 if (NULL != revoke_ego)
433 { 451 {
434 if (! perform && (NULL == filename)) 452 if (! perform && (NULL == filename))
@@ -445,7 +463,9 @@ run (void *cls,
445 } 463 }
446 if ((NULL != filename) && (perform)) 464 if ((NULL != filename) && (perform))
447 { 465 {
448 if (sizeof(rd) != GNUNET_DISK_fn_read (filename, &rd, sizeof(rd))) 466 if (sizeof(proof_of_work) != GNUNET_DISK_fn_read (filename,
467 &proof_of_work,
468 sizeof(proof_of_work)))
449 { 469 {
450 fprintf (stderr, 470 fprintf (stderr,
451 _ ("Failed to read revocation certificate from `%s'\n"), 471 _ ("Failed to read revocation certificate from `%s'\n"),
@@ -454,18 +474,20 @@ run (void *cls,
454 } 474 }
455 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); 475 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
456 if (GNUNET_YES != 476 if (GNUNET_YES !=
457 GNUNET_REVOCATION_check_pow (&rd.key, 477 GNUNET_REVOCATION_check_pow (&proof_of_work,
458 rd.pow, 478 (unsigned int) matching_bits,
459 (unsigned int) matching_bits)) 479 epoch_duration))
460 { 480 {
461 struct RevocationData *cp = GNUNET_new (struct RevocationData); 481 struct GNUNET_REVOCATION_PowCalculationHandle *ph;
482 ph = GNUNET_REVOCATION_pow_start (&proof_of_work,
483 epochs, /* Epochs */
484 matching_bits);
462 485
463 *cp = rd; 486 pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph);
464 pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, cp); 487 GNUNET_SCHEDULER_add_shutdown (&calculate_pow_shutdown, ph);
465 GNUNET_SCHEDULER_add_shutdown (&calculate_pow_shutdown, cp);
466 return; 488 return;
467 } 489 }
468 perform_revocation (&rd); 490 perform_revocation ();
469 return; 491 return;
470 } 492 }
471 fprintf (stderr, "%s", _ ("No action specified. Nothing to do.\n")); 493 fprintf (stderr, "%s", _ ("No action specified. Nothing to do.\n"));
@@ -511,6 +533,12 @@ main (int argc, char *const *argv)
511 gettext_noop ( 533 gettext_noop (
512 "test if the public key KEY has been revoked"), 534 "test if the public key KEY has been revoked"),
513 &test_ego), 535 &test_ego),
536 GNUNET_GETOPT_option_uint ('e',
537 "epochs",
538 "EPOCHS",
539 gettext_noop (
540 "number of epochs to calculate for"),
541 &epochs),
514 542
515 GNUNET_GETOPT_OPTION_END 543 GNUNET_GETOPT_OPTION_END
516 }; 544 };
@@ -527,7 +555,7 @@ main (int argc, char *const *argv)
527 NULL)) 555 NULL))
528 ? ret 556 ? ret
529 : 1; 557 : 1;
530 GNUNET_free ((void *) argv); 558 GNUNET_free_nz ((void *) argv);
531 return ret; 559 return ret;
532} 560}
533 561
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index 51286f49b..81a30748c 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -129,6 +129,11 @@ static struct GNUNET_SET_ListenHandle *revocation_union_listen_handle;
129static unsigned long long revocation_work_required; 129static unsigned long long revocation_work_required;
130 130
131/** 131/**
132 * Length of an expiration expoch
133 */
134static struct GNUNET_TIME_Relative epoch_duration;
135
136/**
132 * Our application ID for set union operations. Must be the 137 * Our application ID for set union operations. Must be the
133 * same for all (compatible) peers. 138 * same for all (compatible) peers.
134 */ 139 */
@@ -167,25 +172,16 @@ new_peer_entry (const struct GNUNET_PeerIdentity *peer)
167static int 172static int
168verify_revoke_message (const struct RevokeMessage *rm) 173verify_revoke_message (const struct RevokeMessage *rm)
169{ 174{
170 if (GNUNET_YES != 175 if (GNUNET_YES != GNUNET_REVOCATION_check_pow (&rm->proof_of_work,
171 GNUNET_REVOCATION_check_pow (&rm->public_key, 176 (unsigned
172 rm->proof_of_work, 177 int) revocation_work_required,
173 (unsigned int) revocation_work_required)) 178 epoch_duration))
174 { 179 {
175 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 180 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
176 "Proof of work invalid!\n"); 181 "Proof of work invalid!\n");
177 GNUNET_break_op (0); 182 GNUNET_break_op (0);
178 return GNUNET_NO; 183 return GNUNET_NO;
179 } 184 }
180 if (GNUNET_OK !=
181 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_REVOCATION,
182 &rm->purpose,
183 &rm->signature,
184 &rm->public_key))
185 {
186 GNUNET_break_op (0);
187 return GNUNET_NO;
188 }
189 return GNUNET_YES; 185 return GNUNET_YES;
190} 186}
191 187
@@ -308,7 +304,7 @@ publicize_rm (const struct RevokeMessage *rm)
308 struct GNUNET_HashCode hc; 304 struct GNUNET_HashCode hc;
309 struct GNUNET_SET_Element e; 305 struct GNUNET_SET_Element e;
310 306
311 GNUNET_CRYPTO_hash (&rm->public_key, 307 GNUNET_CRYPTO_hash (&rm->proof_of_work.key,
312 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 308 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
313 &hc); 309 &hc);
314 if (GNUNET_YES == 310 if (GNUNET_YES ==
@@ -848,6 +844,20 @@ run (void *cls,
848 GNUNET_free (fn); 844 GNUNET_free (fn);
849 return; 845 return;
850 } 846 }
847 if (GNUNET_OK !=
848 GNUNET_CONFIGURATION_get_value_time (cfg,
849 "REVOCATION",
850 "EPOCH_DURATION",
851 &epoch_duration))
852 {
853 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
854 "REVOCATION",
855 "EPOCH_DURATION");
856 GNUNET_SCHEDULER_shutdown ();
857 GNUNET_free (fn);
858 return;
859 }
860
851 revocation_set = GNUNET_SET_create (cfg, 861 revocation_set = GNUNET_SET_create (cfg,
852 GNUNET_SET_OPERATION_UNION); 862 GNUNET_SET_OPERATION_UNION);
853 revocation_union_listen_handle 863 revocation_union_listen_handle
@@ -893,7 +903,7 @@ run (void *cls,
893 return; 903 return;
894 } 904 }
895 GNUNET_break (0 == ntohl (rm->reserved)); 905 GNUNET_break (0 == ntohl (rm->reserved));
896 GNUNET_CRYPTO_hash (&rm->public_key, 906 GNUNET_CRYPTO_hash (&rm->proof_of_work.key,
897 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 907 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
898 &hc); 908 &hc);
899 GNUNET_break (GNUNET_OK == 909 GNUNET_break (GNUNET_OK ==
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c
index 3d0b55a0d..291c56f70 100644
--- a/src/revocation/plugin_block_revocation.c
+++ b/src/revocation/plugin_block_revocation.c
@@ -52,6 +52,7 @@
52struct InternalContext 52struct InternalContext
53{ 53{
54 unsigned int matching_bits; 54 unsigned int matching_bits;
55 struct GNUNET_TIME_Relative epoch_duration;
55}; 56};
56 57
57 58
@@ -142,24 +143,15 @@ block_plugin_revocation_evaluate (void *cls,
142 GNUNET_break_op (0); 143 GNUNET_break_op (0);
143 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 144 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
144 } 145 }
145 if (GNUNET_YES != 146 if (0 >=
146 GNUNET_REVOCATION_check_pow (&rm->public_key, 147 GNUNET_REVOCATION_check_pow (&rm->proof_of_work,
147 rm->proof_of_work, 148 ic->matching_bits,
148 ic->matching_bits)) 149 ic->epoch_duration))
149 { 150 {
150 GNUNET_break_op (0); 151 GNUNET_break_op (0);
151 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 152 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
152 } 153 }
153 if (GNUNET_OK != 154 GNUNET_CRYPTO_hash (&rm->proof_of_work.key,
154 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_REVOCATION,
155 &rm->purpose,
156 &rm->signature,
157 &rm->public_key))
158 {
159 GNUNET_break_op (0);
160 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
161 }
162 GNUNET_CRYPTO_hash (&rm->public_key,
163 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 155 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
164 &chash); 156 &chash);
165 if (GNUNET_YES == 157 if (GNUNET_YES ==
@@ -195,7 +187,7 @@ block_plugin_revocation_get_key (void *cls,
195 GNUNET_break_op (0); 187 GNUNET_break_op (0);
196 return GNUNET_SYSERR; 188 return GNUNET_SYSERR;
197 } 189 }
198 GNUNET_CRYPTO_hash (&rm->public_key, 190 GNUNET_CRYPTO_hash (&rm->proof_of_work.key,
199 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 191 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
200 key); 192 key);
201 return GNUNET_OK; 193 return GNUNET_OK;
@@ -218,6 +210,7 @@ libgnunet_plugin_block_revocation_init (void *cls)
218 struct GNUNET_BLOCK_PluginFunctions *api; 210 struct GNUNET_BLOCK_PluginFunctions *api;
219 struct InternalContext *ic; 211 struct InternalContext *ic;
220 unsigned long long matching_bits; 212 unsigned long long matching_bits;
213 struct GNUNET_TIME_Relative epoch_duration;
221 214
222 if (GNUNET_OK != 215 if (GNUNET_OK !=
223 GNUNET_CONFIGURATION_get_value_number (cfg, 216 GNUNET_CONFIGURATION_get_value_number (cfg,
@@ -225,6 +218,12 @@ libgnunet_plugin_block_revocation_init (void *cls)
225 "WORKBITS", 218 "WORKBITS",
226 &matching_bits)) 219 &matching_bits))
227 return NULL; 220 return NULL;
221 if (GNUNET_OK !=
222 GNUNET_CONFIGURATION_get_value_time (cfg,
223 "REVOCATION",
224 "EPOCH_DURATION",
225 &epoch_duration))
226 return NULL;
228 227
229 api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions); 228 api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions);
230 api->evaluate = &block_plugin_revocation_evaluate; 229 api->evaluate = &block_plugin_revocation_evaluate;
@@ -233,6 +232,7 @@ libgnunet_plugin_block_revocation_init (void *cls)
233 api->types = types; 232 api->types = types;
234 ic = GNUNET_new (struct InternalContext); 233 ic = GNUNET_new (struct InternalContext);
235 ic->matching_bits = (unsigned int) matching_bits; 234 ic->matching_bits = (unsigned int) matching_bits;
235 ic->epoch_duration = epoch_duration;
236 api->cls = ic; 236 api->cls = ic;
237 return api; 237 return api;
238} 238}
diff --git a/src/revocation/revocation.conf.in b/src/revocation/revocation.conf.in
index 5ad41cd49..346168785 100644
--- a/src/revocation/revocation.conf.in
+++ b/src/revocation/revocation.conf.in
@@ -14,5 +14,6 @@ UNIX_MATCH_GID = YES
14# (using only a single-core) with SCRYPT. 14# (using only a single-core) with SCRYPT.
15# DO NOT CHANGE THIS VALUE, doing so will break the protocol! 15# DO NOT CHANGE THIS VALUE, doing so will break the protocol!
16WORKBITS = 25 16WORKBITS = 25
17EPOCH_DURATION = 356 d
17 18
18DATABASE = $GNUNET_DATA_HOME/revocation.dat 19DATABASE = $GNUNET_DATA_HOME/revocation.dat
diff --git a/src/revocation/revocation.h b/src/revocation/revocation.h
index b6e7a07ec..635c56cfc 100644
--- a/src/revocation/revocation.h
+++ b/src/revocation/revocation.h
@@ -27,6 +27,7 @@
27#define REVOCATION_H 27#define REVOCATION_H
28 28
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_revocation_service.h"
30 31
31GNUNET_NETWORK_STRUCT_BEGIN 32GNUNET_NETWORK_STRUCT_BEGIN
32 33
@@ -91,23 +92,7 @@ struct RevokeMessage
91 /** 92 /**
92 * Number that causes a hash collision with the @e public_key. 93 * Number that causes a hash collision with the @e public_key.
93 */ 94 */
94 uint64_t proof_of_work GNUNET_PACKED; 95 struct GNUNET_REVOCATION_PowP proof_of_work;
95
96 /**
97 * Signature confirming revocation.
98 */
99 struct GNUNET_CRYPTO_EcdsaSignature signature;
100
101 /**
102 * Must have purpose #GNUNET_SIGNATURE_PURPOSE_REVOCATION,
103 * size expands over the public key. (@deprecated)
104 */
105 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
106
107 /**
108 * Key to revoke.
109 */
110 struct GNUNET_CRYPTO_EcdsaPublicKey public_key;
111}; 96};
112 97
113 98
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index ea8db835f..12cb63c57 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -27,8 +27,7 @@
27#include "gnunet_signatures.h" 27#include "gnunet_signatures.h"
28#include "gnunet_protocols.h" 28#include "gnunet_protocols.h"
29#include "revocation.h" 29#include "revocation.h"
30#include <gcrypt.h> 30#include <inttypes.h>
31
32 31
33/** 32/**
34 * Handle for the key revocation query. 33 * Handle for the key revocation query.
@@ -53,6 +52,58 @@ struct GNUNET_REVOCATION_Query
53 52
54 53
55/** 54/**
55 * Helper struct that holds a found pow nonce
56 * and the corresponding number of leading zeroes.
57 */
58struct BestPow
59{
60 /**
61 * PoW nonce
62 */
63 uint64_t pow;
64
65 /**
66 * Corresponding zero bits in hash
67 */
68 unsigned int bits;
69};
70
71
72/**
73 * The handle to a PoW calculation.
74 * Used in iterative PoW rounds.
75 */
76struct GNUNET_REVOCATION_PowCalculationHandle
77{
78 /**
79 * Current set of found PoWs
80 */
81 struct BestPow best[POW_COUNT];
82
83 /**
84 * The final PoW result data structure.
85 */
86 struct GNUNET_REVOCATION_PowP *pow;
87
88 /**
89 * The current nonce to try
90 */
91 uint64_t current_pow;
92
93 /**
94 * Epochs how long the PoW should be valid.
95 * This is added on top of the difficulty in the PoW.
96 */
97 unsigned int epochs;
98
99 /**
100 * The difficulty (leading zeros) to achieve.
101 */
102 unsigned int difficulty;
103
104};
105
106/**
56 * Generic error handler, called with the appropriate 107 * Generic error handler, called with the appropriate
57 * error code and the same closure specified at the creation of 108 * error code and the same closure specified at the creation of
58 * the message queue. 109 * the message queue.
@@ -235,6 +286,7 @@ handle_revocation_response (void *cls,
235 * @param key public key of the key to revoke 286 * @param key public key of the key to revoke
236 * @param sig signature to use on the revocation (should have been 287 * @param sig signature to use on the revocation (should have been
237 * created using #GNUNET_REVOCATION_sign_revocation). 288 * created using #GNUNET_REVOCATION_sign_revocation).
289 * @param ts revocation timestamp
238 * @param pow proof of work to use (should have been created by 290 * @param pow proof of work to use (should have been created by
239 * iteratively calling #GNUNET_REVOCATION_check_pow) 291 * iteratively calling #GNUNET_REVOCATION_check_pow)
240 * @param func funtion to call with the result of the check 292 * @param func funtion to call with the result of the check
@@ -245,9 +297,7 @@ handle_revocation_response (void *cls,
245 */ 297 */
246struct GNUNET_REVOCATION_Handle * 298struct GNUNET_REVOCATION_Handle *
247GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, 299GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
248 const struct GNUNET_CRYPTO_EcdsaPublicKey *key, 300 const struct GNUNET_REVOCATION_PowP *pow,
249 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
250 uint64_t pow,
251 GNUNET_REVOCATION_Callback func, 301 GNUNET_REVOCATION_Callback func,
252 void *func_cls) 302 void *func_cls)
253{ 303{
@@ -261,24 +311,40 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
261 GNUNET_MQ_handler_end () 311 GNUNET_MQ_handler_end ()
262 }; 312 };
263 unsigned long long matching_bits; 313 unsigned long long matching_bits;
314 struct GNUNET_TIME_Relative epoch_duration;
264 struct RevokeMessage *rm; 315 struct RevokeMessage *rm;
265 struct GNUNET_MQ_Envelope *env; 316 struct GNUNET_MQ_Envelope *env;
266 317
267 if ((GNUNET_OK == 318 if ((GNUNET_OK !=
268 GNUNET_CONFIGURATION_get_value_number (cfg, 319 GNUNET_CONFIGURATION_get_value_number (cfg,
269 "REVOCATION", 320 "REVOCATION",
270 "WORKBITS", 321 "WORKBITS",
271 &matching_bits)) && 322 &matching_bits)))
272 (GNUNET_YES != 323 {
273 GNUNET_REVOCATION_check_pow (key, 324 GNUNET_break (0);
274 pow, 325 GNUNET_free (h);
275 (unsigned int) matching_bits))) 326 return NULL;
327 }
328 if ((GNUNET_OK !=
329 GNUNET_CONFIGURATION_get_value_time (cfg,
330 "REVOCATION",
331 "EPOCH_DURATION",
332 &epoch_duration)))
333 {
334 GNUNET_break (0);
335 GNUNET_free (h);
336 return NULL;
337 }
338 if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow,
339 (unsigned int) matching_bits,
340 epoch_duration))
276 { 341 {
277 GNUNET_break (0); 342 GNUNET_break (0);
278 GNUNET_free (h); 343 GNUNET_free (h);
279 return NULL; 344 return NULL;
280 } 345 }
281 346
347
282 h->mq = GNUNET_CLIENT_connect (cfg, 348 h->mq = GNUNET_CLIENT_connect (cfg,
283 "revocation", 349 "revocation",
284 handlers, 350 handlers,
@@ -294,12 +360,7 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
294 env = GNUNET_MQ_msg (rm, 360 env = GNUNET_MQ_msg (rm,
295 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); 361 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE);
296 rm->reserved = htonl (0); 362 rm->reserved = htonl (0);
297 rm->proof_of_work = pow; 363 rm->proof_of_work = *pow;
298 rm->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
299 rm->purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
300 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey));
301 rm->public_key = *key;
302 rm->signature = *sig;
303 GNUNET_MQ_send (h->mq, 364 GNUNET_MQ_send (h->mq,
304 env); 365 env);
305 return h; 366 return h;
@@ -342,56 +403,263 @@ count_leading_zeroes (const struct GNUNET_HashCode *hash)
342 403
343 404
344/** 405/**
345 * Check if the given proof-of-work value 406 * Calculate the average zeros in the pows.
346 * would be acceptable for revoking the given key.
347 * 407 *
348 * @param key key to check for 408 * @param ph the PowHandle
349 * @param pow proof of work value 409 * @return the average number of zeroes.
410 */
411static unsigned int
412calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph)
413{
414 double sum = 0.0;
415 for (unsigned int j = 0; j<POW_COUNT; j++)
416 sum += ph->best[j].bits;
417 double avg = sum / POW_COUNT;
418 return avg;
419}
420
421
422/**
423 * Check if the given proof-of-work is valid.
424 *
425 * @param pow proof of work
350 * @param matching_bits how many bits must match (configuration) 426 * @param matching_bits how many bits must match (configuration)
427 * @param epoch_duration length of single epoch in configuration
428 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
429 */
430enum GNUNET_GenericReturnValue
431GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
432 unsigned int difficulty,
433 struct GNUNET_TIME_Relative epoch_duration)
434{
435 char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
436 + sizeof (struct GNUNET_TIME_AbsoluteNBO)
437 + sizeof (uint64_t)] GNUNET_ALIGN;
438 struct GNUNET_REVOCATION_SignaturePurposePS spurp;
439 struct GNUNET_HashCode result;
440 struct GNUNET_TIME_Absolute ts;
441 struct GNUNET_TIME_Absolute exp;
442 struct GNUNET_TIME_Relative ttl;
443 struct GNUNET_TIME_Relative buffer;
444 unsigned int score = 0;
445 unsigned int tmp_score = 0;
446 unsigned int epochs;
447 uint64_t pow_val;
448
449 /**
450 * Check if signature valid
451 */
452 spurp.key = pow->key;
453 spurp.timestamp = pow->timestamp;
454 spurp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
455 spurp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
456 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
457 + sizeof (struct GNUNET_TIME_AbsoluteNBO));
458 if (GNUNET_OK !=
459 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION,
460 &spurp.purpose,
461 &pow->signature,
462 &pow->key))
463 {
464 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
465 "Proof of work signature invalid!\n");
466 return GNUNET_NO;
467 }
468
469 /**
470 * First, check if any duplicates are in the PoW set
471 */
472 for (unsigned int i = 0; i < POW_COUNT; i++)
473 {
474 for (unsigned int j = i + 1; j < POW_COUNT; j++)
475 {
476 if (pow->pow[i] == pow->pow[j])
477 return GNUNET_NO;
478 }
479 }
480 GNUNET_memcpy (&buf[sizeof(uint64_t)],
481 &pow->timestamp,
482 sizeof (uint64_t));
483 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
484 &pow->key,
485 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey));
486 for (unsigned int i = 0; i < POW_COUNT; i++)
487 {
488 pow_val = GNUNET_ntohll (pow->pow[i]);
489 GNUNET_memcpy (buf, &pow_val, sizeof(uint64_t));
490 GNUNET_CRYPTO_pow_hash ("gnunet-revocation-proof-of-work",
491 buf,
492 sizeof(buf),
493 &result);
494 tmp_score = count_leading_zeroes (&result);
495 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
496 "Score %u with %" PRIu64 " (#%u)\n",
497 tmp_score, pow_val, i);
498 score += tmp_score;
499
500 }
501 score = score / POW_COUNT;
502 if (score < difficulty)
503 return GNUNET_NO;
504 epochs = score - difficulty;
505
506 /**
507 * Check expiration
508 */
509 ts = GNUNET_TIME_absolute_ntoh (pow->timestamp);
510 ttl = GNUNET_TIME_relative_multiply (epoch_duration,
511 epochs);
512 /**
513 * Extend by 10% for unsynchronized clocks
514 */
515 buffer = GNUNET_TIME_relative_divide (epoch_duration,
516 10);
517 exp = GNUNET_TIME_absolute_add (ts, ttl);
518 exp = GNUNET_TIME_absolute_add (exp,
519 buffer);
520
521 if (0 != GNUNET_TIME_absolute_get_remaining (ts).rel_value_us)
522 return GNUNET_NO; /* Not yet valid. */
523 /* Revert to actual start time */
524 ts = GNUNET_TIME_absolute_add (ts,
525 buffer);
526
527 if (0 == GNUNET_TIME_absolute_get_remaining (exp).rel_value_us)
528 return GNUNET_NO; /* expired */
529 return GNUNET_YES;
530}
531
532
533/**
534 * Initializes a fresh PoW computation.
535 *
536 * @param key the key to calculate the PoW for.
537 * @param[out] pow starting point for PoW calculation (not yet valid)
538 */
539void
540GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
541 struct GNUNET_REVOCATION_PowP *pow)
542{
543 struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get ();
544 struct GNUNET_REVOCATION_SignaturePurposePS rp;
545
546 /**
547 * Predate the validity period to prevent rejections due to
548 * unsynchronized clocks
549 */
550 ts = GNUNET_TIME_absolute_subtract (ts,
551 GNUNET_TIME_UNIT_WEEKS);
552
553 pow->timestamp = GNUNET_TIME_absolute_hton (ts);
554 rp.timestamp = pow->timestamp;
555 rp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
556 rp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
557 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
558 + sizeof (struct GNUNET_TIME_AbsoluteNBO));
559 GNUNET_CRYPTO_ecdsa_key_get_public (key, &pow->key);
560 rp.key = pow->key;
561 GNUNET_assert (GNUNET_OK ==
562 GNUNET_CRYPTO_ecdsa_sign_ (key,
563 &rp.purpose,
564 &pow->signature));
565}
566
567
568/**
569 * Starts a proof-of-work calculation given the pow object as well as
570 * target epochs and difficulty.
571 *
572 * @param pow the PoW to based calculations on.
573 * @param epochs the number of epochs for which the PoW must be valid.
574 * @param difficulty the base difficulty of the PoW.
575 * @return a handle for use in PoW rounds
576 */
577struct GNUNET_REVOCATION_PowCalculationHandle*
578GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow,
579 int epochs,
580 unsigned int difficulty)
581{
582 struct GNUNET_REVOCATION_PowCalculationHandle *pc;
583
584 pc = GNUNET_new (struct GNUNET_REVOCATION_PowCalculationHandle);
585 pc->pow = pow;
586 pc->current_pow = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
587 UINT64_MAX);
588 pc->difficulty = difficulty;
589 pc->epochs = epochs;
590 return pc;
591}
592
593
594/**
595 * Calculate a key revocation valid for broadcasting for a number
596 * of epochs.
597 *
598 * @param pc handle to the PoW, initially called with NULL.
599 * @param epochs number of epochs for which the revocation must be valid.
600 * @param pow current pow value to try
601 * @param difficulty current base difficulty to achieve
351 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not 602 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
352 */ 603 */
353int 604enum GNUNET_GenericReturnValue
354GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key, 605GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
355 uint64_t pow,
356 unsigned int matching_bits)
357{ 606{
358 char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) 607 char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
359 + sizeof(pow)] GNUNET_ALIGN; 608 + sizeof (uint64_t)
609 + sizeof (uint64_t)] GNUNET_ALIGN;
360 struct GNUNET_HashCode result; 610 struct GNUNET_HashCode result;
611 unsigned int zeros;
612
613 pc->current_pow++;
361 614
362 GNUNET_memcpy (buf, &pow, sizeof(pow)); 615 /**
363 GNUNET_memcpy (&buf[sizeof(pow)], key, 616 * Do not try duplicates
617 */
618 for (unsigned int i = 0; i < POW_COUNT; i++)
619 if (pc->current_pow == pc->best[i].pow)
620 return GNUNET_NO;
621
622 GNUNET_memcpy (buf, &pc->current_pow, sizeof(uint64_t));
623 GNUNET_memcpy (&buf[sizeof(uint64_t)],
624 &pc->pow->timestamp,
625 sizeof (uint64_t));
626 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
627 &pc->pow->key,
364 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 628 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey));
365 GNUNET_CRYPTO_pow_hash ("gnunet-revocation-proof-of-work", 629 GNUNET_CRYPTO_pow_hash ("gnunet-revocation-proof-of-work",
366 buf, 630 buf,
367 sizeof(buf), 631 sizeof(buf),
368 &result); 632 &result);
369 return (count_leading_zeroes (&result) >= 633 zeros = count_leading_zeroes (&result);
370 matching_bits) ? GNUNET_YES : GNUNET_NO; 634 for (unsigned int i = 0; i < POW_COUNT; i++)
635 {
636 if (pc->best[i].bits < zeros)
637 {
638 pc->best[i].bits = zeros;
639 pc->best[i].pow = pc->current_pow;
640 pc->pow->pow[i] = GNUNET_htonll (pc->current_pow);
641 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
642 "New best score %u with %" PRIu64 " (#%u)\n",
643 zeros, pc->current_pow, i);
644 break;
645 }
646 }
647 return calculate_score (pc) >= pc->difficulty + pc->epochs ? GNUNET_YES :
648 GNUNET_NO;
371} 649}
372 650
373 651
374/** 652/**
375 * Create a revocation signature. 653 * Stop a PoW calculation
376 * 654 *
377 * @param key private key of the key to revoke 655 * @param pc the calculation to clean up
378 * @param sig where to write the revocation signature 656 * @return #GNUNET_YES if pow valid, #GNUNET_NO if pow was set but is not
657 * valid
379 */ 658 */
380void 659void
381GNUNET_REVOCATION_sign_revocation (const struct 660GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
382 GNUNET_CRYPTO_EcdsaPrivateKey *key,
383 struct GNUNET_CRYPTO_EcdsaSignature *sig)
384{ 661{
385 struct RevokeMessage rm; 662 GNUNET_free (pc);
386
387 rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
388 rm.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
389 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey));
390 GNUNET_CRYPTO_ecdsa_key_get_public (key, &rm.public_key);
391 GNUNET_assert (GNUNET_OK ==
392 GNUNET_CRYPTO_ecdsa_sign (key,
393 &rm.purpose,
394 sig));
395} 663}
396 664
397 665
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c
index 012bac09e..f193d5f6c 100644
--- a/src/revocation/test_revocation.c
+++ b/src/revocation/test_revocation.c
@@ -45,7 +45,7 @@ struct TestPeer
45 struct GNUNET_IDENTITY_EgoLookup *ego_lookup; 45 struct GNUNET_IDENTITY_EgoLookup *ego_lookup;
46 struct GNUNET_REVOCATION_Handle *revok_handle; 46 struct GNUNET_REVOCATION_Handle *revok_handle;
47 struct GNUNET_CORE_Handle *ch; 47 struct GNUNET_CORE_Handle *ch;
48 uint64_t pow; 48 struct GNUNET_REVOCATION_PowCalculationHandle *pow;
49}; 49};
50 50
51static struct TestPeer testpeers[2]; 51static struct TestPeer testpeers[2];
@@ -131,7 +131,7 @@ check_revocation (void *cls)
131 131
132 132
133static void 133static void
134revocation_cb (void *cls, int is_valid) 134revocation_cb (void *cls, enum GNUNET_GenericReturnValue is_valid)
135{ 135{
136 testpeers[1].revok_handle = NULL; 136 testpeers[1].revok_handle = NULL;
137 if (GNUNET_NO == is_valid) 137 if (GNUNET_NO == is_valid)
@@ -141,11 +141,14 @@ revocation_cb (void *cls, int is_valid)
141 } 141 }
142} 142}
143 143
144struct GNUNET_REVOCATION_Pow proof_of_work;
145
144 146
145static void 147static void
146ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) 148ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
147{ 149{
148 static int completed = 0; 150 static int completed = 0;
151 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
149 152
150 if ((NULL != ego) && (cls == &testpeers[0])) 153 if ((NULL != ego) && (cls == &testpeers[0]))
151 { 154 {
@@ -159,17 +162,20 @@ ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
159 testpeers[1].ego_lookup = NULL; 162 testpeers[1].ego_lookup = NULL;
160 testpeers[1].privkey = GNUNET_IDENTITY_ego_get_private_key (ego); 163 testpeers[1].privkey = GNUNET_IDENTITY_ego_get_private_key (ego);
161 GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[1].pubkey); 164 GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[1].pubkey);
162 GNUNET_REVOCATION_sign_revocation (testpeers[1].privkey, &testpeers[1].sig);
163
164 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Calculating proof of work...\n"); 165 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Calculating proof of work...\n");
165 testpeers[1].pow = 0; 166 privkey = GNUNET_IDENTITY_ego_get_private_key (ego);
167 memset (&proof_of_work, 0, sizeof (proof_of_work));
168 GNUNET_REVOCATION_pow_init (privkey,
169 &proof_of_work);
170 testpeers[1].pow = GNUNET_REVOCATION_pow_start (&proof_of_work,
171 1,
172 5);
166 int res = 173 int res =
167 GNUNET_REVOCATION_check_pow (&testpeers[1].pubkey, testpeers[1].pow, 5); 174 GNUNET_REVOCATION_pow_round (testpeers[1].pow);
168 while (GNUNET_OK != res) 175 while (GNUNET_OK != res)
169 { 176 {
170 testpeers[1].pow++;
171 res = 177 res =
172 GNUNET_REVOCATION_check_pow (&testpeers[1].pubkey, testpeers[1].pow, 5); 178 GNUNET_REVOCATION_pow_round (testpeers[1].pow);
173 } 179 }
174 fprintf (stderr, "Done calculating proof of work\n"); 180 fprintf (stderr, "Done calculating proof of work\n");
175 completed++; 181 completed++;
@@ -178,11 +184,10 @@ ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
178 { 184 {
179 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Egos retrieved\n"); 185 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Egos retrieved\n");
180 testpeers[1].revok_handle = GNUNET_REVOCATION_revoke (testpeers[1].cfg, 186 testpeers[1].revok_handle = GNUNET_REVOCATION_revoke (testpeers[1].cfg,
181 &testpeers[1].pubkey, 187 &proof_of_work,
182 &testpeers[1].sig,
183 testpeers[1].pow,
184 &revocation_cb, 188 &revocation_cb,
185 NULL); 189 NULL);
190 GNUNET_REVOCATION_pow_stop (testpeers[1].pow);
186 } 191 }
187} 192}
188 193
diff --git a/src/revocation/test_revocation.conf b/src/revocation/test_revocation.conf
index 3b04150c1..66e2cdcc9 100644
--- a/src/revocation/test_revocation.conf
+++ b/src/revocation/test_revocation.conf
@@ -7,6 +7,7 @@ SERVICEHOME=$GNUNET_TMP/test-revocation-service
7[revocation] 7[revocation]
8WORKBITS = 3 8WORKBITS = 3
9IMMEDIATE_START = YES 9IMMEDIATE_START = YES
10EPOCH_DURATION = 365 d
10 11
11[identity] 12[identity]
12# Directory where we store information about our egos 13# Directory where we store information about our egos
diff --git a/src/secretsharing/gnunet-service-secretsharing.c b/src/secretsharing/gnunet-service-secretsharing.c
index d2e47da8b..2177134f6 100644
--- a/src/secretsharing/gnunet-service-secretsharing.c
+++ b/src/secretsharing/gnunet-service-secretsharing.c
@@ -679,7 +679,7 @@ generate_presecret_polynomial (struct KeygenSession *ks)
679 for (i = 0; i < ks->threshold; i++) 679 for (i = 0; i < ks->threshold; i++)
680 { 680 {
681 v = ks->presecret_polynomial[i] = gcry_mpi_new ( 681 v = ks->presecret_polynomial[i] = gcry_mpi_new (
682 GNUNET_SECRETSHARING_ELGAMAL_BITS); 682 GNUNET_SECRETSHARING_ELGAMAL_BITS);
683 GNUNET_assert (NULL != v); 683 GNUNET_assert (NULL != v);
684 // Randomize v such that 0 < v < elgamal_q. 684 // Randomize v such that 0 < v < elgamal_q.
685 // The '- 1' is necessary as bitlength(q) = bitlength(p) - 1. 685 // The '- 1' is necessary as bitlength(q) = bitlength(p) - 1.
@@ -750,7 +750,7 @@ keygen_round1_new_element (void *cls,
750 return; 750 return;
751 } 751 }
752 752
753 if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify ( 753 if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify_ (
754 GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG1, 754 GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG1,
755 &d->purpose, &d->signature, 755 &d->purpose, &d->signature,
756 &d->peer.public_key)) 756 &d->peer.public_key))
@@ -1341,9 +1341,9 @@ insert_round2_element (struct KeygenSession *ks)
1341 purpose)); 1341 purpose));
1342 d->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG2); 1342 d->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG2);
1343 GNUNET_assert (GNUNET_OK == 1343 GNUNET_assert (GNUNET_OK ==
1344 GNUNET_CRYPTO_eddsa_sign (my_peer_private_key, 1344 GNUNET_CRYPTO_eddsa_sign_ (my_peer_private_key,
1345 &d->purpose, 1345 &d->purpose,
1346 &d->signature)); 1346 &d->signature));
1347 1347
1348 GNUNET_CONSENSUS_insert (ks->consensus, element, NULL, NULL); 1348 GNUNET_CONSENSUS_insert (ks->consensus, element, NULL, NULL);
1349 GNUNET_free (element); /* FIXME: maybe stack-allocate instead? */ 1349 GNUNET_free (element); /* FIXME: maybe stack-allocate instead? */
@@ -1485,7 +1485,7 @@ keygen_round2_new_element (void *cls,
1485 return; 1485 return;
1486 } 1486 }
1487 1487
1488 if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify ( 1488 if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify_ (
1489 GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG2, 1489 GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG2,
1490 &d->purpose, &d->signature, 1490 &d->purpose, &d->signature,
1491 &d->peer.public_key)) 1491 &d->peer.public_key))
@@ -1687,9 +1687,9 @@ insert_round1_element (struct KeygenSession *ks)
1687 purpose)); 1687 purpose));
1688 d->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG1); 1688 d->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG1);
1689 GNUNET_assert (GNUNET_OK == 1689 GNUNET_assert (GNUNET_OK ==
1690 GNUNET_CRYPTO_eddsa_sign (my_peer_private_key, 1690 GNUNET_CRYPTO_eddsa_sign_ (my_peer_private_key,
1691 &d->purpose, 1691 &d->purpose,
1692 &d->signature)); 1692 &d->signature));
1693 1693
1694 GNUNET_CONSENSUS_insert (ks->consensus, element, NULL, NULL); 1694 GNUNET_CONSENSUS_insert (ks->consensus, element, NULL, NULL);
1695 1695
@@ -2189,9 +2189,9 @@ insert_decrypt_element (struct DecryptSession *ds)
2189 d.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DECRYPTION); 2189 d.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DECRYPTION);
2190 2190
2191 GNUNET_assert (GNUNET_OK == 2191 GNUNET_assert (GNUNET_OK ==
2192 GNUNET_CRYPTO_eddsa_sign (my_peer_private_key, 2192 GNUNET_CRYPTO_eddsa_sign_ (my_peer_private_key,
2193 &d.purpose, 2193 &d.purpose,
2194 &d.signature)); 2194 &d.signature));
2195 2195
2196 GNUNET_CONSENSUS_insert (ds->consensus, &element, NULL, NULL); 2196 GNUNET_CONSENSUS_insert (ds->consensus, &element, NULL, NULL);
2197 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2197 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/sq/sq_query_helper.c b/src/sq/sq_query_helper.c
index c9e4bf031..1f7662b95 100644
--- a/src/sq/sq_query_helper.c
+++ b/src/sq/sq_query_helper.c
@@ -151,7 +151,7 @@ bind_rsa_pub (void *cls,
151 unsigned int off) 151 unsigned int off)
152{ 152{
153 const struct GNUNET_CRYPTO_RsaPublicKey *rsa = data; 153 const struct GNUNET_CRYPTO_RsaPublicKey *rsa = data;
154 char *buf; 154 void *buf;
155 size_t buf_size; 155 size_t buf_size;
156 156
157 GNUNET_break (NULL == cls); 157 GNUNET_break (NULL == cls);
@@ -211,7 +211,7 @@ bind_rsa_sig (void *cls,
211 unsigned int off) 211 unsigned int off)
212{ 212{
213 const struct GNUNET_CRYPTO_RsaSignature *sig = data; 213 const struct GNUNET_CRYPTO_RsaSignature *sig = data;
214 char *buf; 214 void *buf;
215 size_t buf_size; 215 size_t buf_size;
216 216
217 GNUNET_break (NULL == cls); 217 GNUNET_break (NULL == cls);
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c
index e004a0f1c..63afde877 100644
--- a/src/statistics/gnunet-statistics.c
+++ b/src/statistics/gnunet-statistics.c
@@ -151,6 +151,7 @@ struct ValueSet
151 int is_persistent; 151 int is_persistent;
152}; 152};
153 153
154
154/** 155/**
155 * @brief Collection of all values (represented with #ValueSet). 156 * @brief Collection of all values (represented with #ValueSet).
156 */ 157 */
@@ -166,6 +167,7 @@ static int num_nodes_ready;
166 */ 167 */
167static int num_nodes_ready_shutdown; 168static int num_nodes_ready_shutdown;
168 169
170
169/** 171/**
170 * @brief Create a new #ValueSet 172 * @brief Create a new #ValueSet
171 * 173 *
@@ -173,7 +175,6 @@ static int num_nodes_ready_shutdown;
173 * @param name Name of the valueset. 175 * @param name Name of the valueset.
174 * @param num_values Number of values in valueset - number of peers. 176 * @param num_values Number of values in valueset - number of peers.
175 * @param is_persistent Persistence status of values. 177 * @param is_persistent Persistence status of values.
176 *
177 * @return Newly allocated #ValueSet. 178 * @return Newly allocated #ValueSet.
178 */ 179 */
179static struct ValueSet * 180static struct ValueSet *
@@ -187,7 +188,8 @@ new_value_set (const char *subsystem,
187 value_set = GNUNET_new (struct ValueSet); 188 value_set = GNUNET_new (struct ValueSet);
188 value_set->subsystem = GNUNET_strdup (subsystem); 189 value_set->subsystem = GNUNET_strdup (subsystem);
189 value_set->name = GNUNET_strdup (name); 190 value_set->name = GNUNET_strdup (name);
190 value_set->values = GNUNET_new_array (num_values, uint64_t); 191 value_set->values = GNUNET_new_array (num_values,
192 uint64_t);
191 value_set->is_persistent = persistent; 193 value_set->is_persistent = persistent;
192 return value_set; 194 return value_set;
193} 195}
@@ -202,11 +204,12 @@ new_value_set (const char *subsystem,
202 * @param key #GNUNET_HashCode key of #GNUNET_CONTAINER_MultiHashMap iterator - 204 * @param key #GNUNET_HashCode key of #GNUNET_CONTAINER_MultiHashMap iterator -
203 * unused 205 * unused
204 * @param value Values represented as #ValueSet. 206 * @param value Values represented as #ValueSet.
205 * 207 * @return #GNUNET_YES - continue iteration.
206 * @return GNUNET_YES - continue iteration.
207 */ 208 */
208static int 209static int
209printer (void *cls, const struct GNUNET_HashCode *key, void *value) 210printer (void *cls,
211 const struct GNUNET_HashCode *key,
212 void *value)
210{ 213{
211 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); 214 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
212 const char *now_str; 215 const char *now_str;
@@ -368,11 +371,6 @@ clean_node (void *cls)
368 } 371 }
369 372
370 num_nodes_ready_shutdown++; 373 num_nodes_ready_shutdown++;
371 if (num_nodes == num_nodes_ready_shutdown)
372 {
373 GNUNET_array_grow (nodes, num_nodes, 0);
374 GNUNET_CONTAINER_multihashmap_destroy (values);
375 }
376} 374}
377 375
378 376
@@ -384,7 +382,10 @@ clean_node (void *cls)
384static void 382static void
385print_finish (void *cls) 383print_finish (void *cls)
386{ 384{
387 GNUNET_CONTAINER_multihashmap_iterate (values, printer, NULL); 385 GNUNET_CONTAINER_multihashmap_iterate (values,
386 &printer,
387 NULL);
388 GNUNET_CONTAINER_multihashmap_destroy (values);
388 GNUNET_SCHEDULER_shutdown (); 389 GNUNET_SCHEDULER_shutdown ();
389} 390}
390 391
@@ -398,7 +399,8 @@ print_finish (void *cls)
398 * @param succes Whether statistics were obtained successfully. 399 * @param succes Whether statistics were obtained successfully.
399 */ 400 */
400static void 401static void
401continuation_print (void *cls, int success) 402continuation_print (void *cls,
403 int success)
402{ 404{
403 const unsigned index_node = *(unsigned *) cls; 405 const unsigned index_node = *(unsigned *) cls;
404 406
@@ -406,7 +408,9 @@ continuation_print (void *cls, int success)
406 if (GNUNET_OK != success) 408 if (GNUNET_OK != success)
407 { 409 {
408 if (NULL == remote_host) 410 if (NULL == remote_host)
409 fprintf (stderr, "%s", _ ("Failed to obtain statistics.\n")); 411 fprintf (stderr,
412 "%s",
413 _ ("Failed to obtain statistics.\n"));
410 else 414 else
411 fprintf (stderr, 415 fprintf (stderr,
412 _ ("Failed to obtain statistics from host `%s:%llu'\n"), 416 _ ("Failed to obtain statistics from host `%s:%llu'\n"),
@@ -419,11 +423,13 @@ continuation_print (void *cls, int success)
419 GNUNET_SCHEDULER_cancel (nodes[index_node].shutdown_task); 423 GNUNET_SCHEDULER_cancel (nodes[index_node].shutdown_task);
420 nodes[index_node].shutdown_task = NULL; 424 nodes[index_node].shutdown_task = NULL;
421 } 425 }
422 GNUNET_SCHEDULER_add_now (clean_node, &nodes[index_node].index_node); 426 GNUNET_SCHEDULER_add_now (&clean_node,
427 &nodes[index_node].index_node);
423 num_nodes_ready++; 428 num_nodes_ready++;
424 if (num_nodes_ready == num_nodes) 429 if (num_nodes_ready == num_nodes)
425 { 430 {
426 GNUNET_SCHEDULER_add_now (print_finish, NULL); 431 GNUNET_SCHEDULER_add_now (&print_finish,
432 NULL);
427 } 433 }
428} 434}
429 435
@@ -436,7 +442,8 @@ continuation_print (void *cls, int success)
436 * successfully obtained, #GNUNET_SYSERR if not. 442 * successfully obtained, #GNUNET_SYSERR if not.
437 */ 443 */
438static void 444static void
439cleanup (void *cls, int success) 445cleanup (void *cls,
446 int success)
440{ 447{
441 for (unsigned i = 0; i < num_nodes; i++) 448 for (unsigned i = 0; i < num_nodes; i++)
442 { 449 {
@@ -466,8 +473,7 @@ cleanup (void *cls, int success)
466 * @param name Name of the value. 473 * @param name Name of the value.
467 * @param value Value itself. 474 * @param value Value itself.
468 * @param is_persistent Persistence. 475 * @param is_persistent Persistence.
469 * 476 * @return #GNUNET_OK - continue.
470 * @return GNUNET_OK - continue.
471 */ 477 */
472static int 478static int
473collector (void *cls, 479collector (void *cls,
@@ -603,7 +609,8 @@ main_task (void *cls)
603 * @return to continue iteration or not to 609 * @return to continue iteration or not to
604 */ 610 */
605static int 611static int
606iter_check_config (void *cls, const char *filename) 612iter_check_config (void *cls,
613 const char *filename)
607{ 614{
608 if (0 == strncmp (GNUNET_STRINGS_get_short_name (filename), "config", 6)) 615 if (0 == strncmp (GNUNET_STRINGS_get_short_name (filename), "config", 6))
609 { 616 {
@@ -637,18 +644,22 @@ iter_check_config (void *cls, const char *filename)
637 * 644 *
638 * @param cls counter of nodes 645 * @param cls counter of nodes
639 * @param filename full path of the file in testbed 646 * @param filename full path of the file in testbed
640 *
641 * @return status whether to continue iteration 647 * @return status whether to continue iteration
642 */ 648 */
643static int 649static int
644iter_testbed_path (void *cls, const char *filename) 650iter_testbed_path (void *cls,
651 const char *filename)
645{ 652{
646 unsigned index_node; 653 unsigned index_node;
647 654
648 GNUNET_assert (NULL != filename); 655 GNUNET_assert (NULL != filename);
649 if (1 == sscanf (GNUNET_STRINGS_get_short_name (filename), "%u", &index_node)) 656 if (1 == sscanf (GNUNET_STRINGS_get_short_name (filename),
657 "%u",
658 &index_node))
650 { 659 {
651 if (-1 == GNUNET_DISK_directory_scan (filename, iter_check_config, NULL)) 660 if (-1 == GNUNET_DISK_directory_scan (filename,
661 iter_check_config,
662 NULL))
652 { 663 {
653 /* This is probably no directory for a testbed node 664 /* This is probably no directory for a testbed node
654 * Go on with iteration */ 665 * Go on with iteration */
@@ -673,10 +684,14 @@ discover_testbed_nodes (const char *path_testbed)
673 int num_dir_entries; 684 int num_dir_entries;
674 685
675 num_dir_entries = 686 num_dir_entries =
676 GNUNET_DISK_directory_scan (path_testbed, iter_testbed_path, NULL); 687 GNUNET_DISK_directory_scan (path_testbed,
688 &iter_testbed_path,
689 NULL);
677 if (-1 == num_dir_entries) 690 if (-1 == num_dir_entries)
678 { 691 {
679 fprintf (stderr, "Failure during scanning directory `%s'\n", path_testbed); 692 fprintf (stderr,
693 "Failure during scanning directory `%s'\n",
694 path_testbed);
680 return -1; 695 return -1;
681 } 696 }
682 return 0; 697 return 0;
@@ -717,10 +732,11 @@ run (void *cls,
717 { 732 {
718 if (0 == remote_port) 733 if (0 == remote_port)
719 { 734 {
720 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, 735 if (GNUNET_SYSERR ==
721 "statistics", 736 GNUNET_CONFIGURATION_get_value_number (cfg,
722 "PORT", 737 "statistics",
723 &remote_port)) 738 "PORT",
739 &remote_port))
724 { 740 {
725 fprintf (stderr, 741 fprintf (stderr,
726 _ ("A port is required to connect to host `%s'\n"), 742 _ ("A port is required to connect to host `%s'\n"),
@@ -738,7 +754,10 @@ run (void *cls,
738 } 754 }
739 755
740 /* Manipulate configuration */ 756 /* Manipulate configuration */
741 GNUNET_CONFIGURATION_set_value_string (c, "statistics", "UNIXPATH", ""); 757 GNUNET_CONFIGURATION_set_value_string (c,
758 "statistics",
759 "UNIXPATH",
760 "");
742 GNUNET_CONFIGURATION_set_value_string (c, 761 GNUNET_CONFIGURATION_set_value_string (c,
743 "statistics", 762 "statistics",
744 "HOSTNAME", 763 "HOSTNAME",
@@ -789,68 +808,62 @@ run (void *cls,
789int 808int
790main (int argc, char *const *argv) 809main (int argc, char *const *argv)
791{ 810{
792 struct GNUNET_GETOPT_CommandLineOption options[] = 811 struct GNUNET_GETOPT_CommandLineOption options[] = {
793 { GNUNET_GETOPT_option_string ( 812 GNUNET_GETOPT_option_string ('n',
794 'n', 813 "name",
795 "name", 814 "NAME",
796 "NAME", 815 gettext_noop (
797 gettext_noop ("limit output to statistics for the given NAME"), 816 "limit output to statistics for the given NAME"),
798 &name), 817 &name),
799
800 GNUNET_GETOPT_option_flag ('p', 818 GNUNET_GETOPT_option_flag ('p',
801 "persistent", 819 "persistent",
802 gettext_noop ( 820 gettext_noop (
803 "make the value being set persistent"), 821 "make the value being set persistent"),
804 &persistent), 822 &persistent),
805
806 GNUNET_GETOPT_option_string ('s', 823 GNUNET_GETOPT_option_string ('s',
807 "subsystem", 824 "subsystem",
808 "SUBSYSTEM", 825 "SUBSYSTEM",
809 gettext_noop ( 826 gettext_noop (
810 "limit output to the given SUBSYSTEM"), 827 "limit output to the given SUBSYSTEM"),
811 &subsystem), 828 &subsystem),
812
813 GNUNET_GETOPT_option_string ('S', 829 GNUNET_GETOPT_option_string ('S',
814 "csv-separator", 830 "csv-separator",
815 "CSV_SEPARATOR", 831 "CSV_SEPARATOR",
816 gettext_noop ("use as csv separator"), 832 gettext_noop ("use as csv separator"),
817 &csv_separator), 833 &csv_separator),
818 834 GNUNET_GETOPT_option_filename ('t',
819 GNUNET_GETOPT_option_filename ( 835 "testbed",
820 't', 836 "TESTBED",
821 "testbed", 837 gettext_noop (
822 "TESTBED", 838 "path to the folder containing the testbed data"),
823 gettext_noop ("path to the folder containing the testbed data"), 839 &path_testbed),
824 &path_testbed),
825
826 GNUNET_GETOPT_option_flag ('q', 840 GNUNET_GETOPT_option_flag ('q',
827 "quiet", 841 "quiet",
828 gettext_noop ( 842 gettext_noop (
829 "just print the statistics value"), 843 "just print the statistics value"),
830 &quiet), 844 &quiet),
831
832 GNUNET_GETOPT_option_flag ('w', 845 GNUNET_GETOPT_option_flag ('w',
833 "watch", 846 "watch",
834 gettext_noop ("watch value continuously"), 847 gettext_noop ("watch value continuously"),
835 &watch), 848 &watch),
836
837 GNUNET_GETOPT_option_string ('r', 849 GNUNET_GETOPT_option_string ('r',
838 "remote", 850 "remote",
839 "REMOTE", 851 "REMOTE",
840 gettext_noop ("connect to remote host"), 852 gettext_noop ("connect to remote host"),
841 &remote_host), 853 &remote_host),
842
843 GNUNET_GETOPT_option_ulong ('o', 854 GNUNET_GETOPT_option_ulong ('o',
844 "port", 855 "port",
845 "PORT", 856 "PORT",
846 gettext_noop ("port for remote host"), 857 gettext_noop ("port for remote host"),
847 &remote_port), 858 &remote_port),
848 859 GNUNET_GETOPT_OPTION_END
849 GNUNET_GETOPT_OPTION_END }; 860 };
850 861
851 remote_port = 0; 862 remote_port = 0;
852 remote_host = NULL; 863 remote_host = NULL;
853 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 864 if (GNUNET_OK !=
865 GNUNET_STRINGS_get_utf8_args (argc, argv,
866 &argc, &argv))
854 return 2; 867 return 2;
855 868
856 ret = (GNUNET_OK == 869 ret = (GNUNET_OK ==
@@ -864,8 +877,11 @@ main (int argc, char *const *argv)
864 NULL)) 877 NULL))
865 ? ret 878 ? ret
866 : 1; 879 : 1;
880 GNUNET_array_grow (nodes,
881 num_nodes,
882 0);
867 GNUNET_free_non_null (remote_host); 883 GNUNET_free_non_null (remote_host);
868 GNUNET_free ((void *) argv); 884 GNUNET_free_nz ((void *) argv);
869 return ret; 885 return ret;
870} 886}
871 887
diff --git a/src/template/gnunet-template.c b/src/template/gnunet-template.c
index b33cbcc64..5e250bbdf 100644
--- a/src/template/gnunet-template.c
+++ b/src/template/gnunet-template.c
@@ -78,7 +78,7 @@ main (int argc, char *const *argv)
78 NULL)) 78 NULL))
79 ? ret 79 ? ret
80 : 1; 80 : 1;
81 GNUNET_free ((void *) argv); 81 GNUNET_free_nz ((void *) argv);
82 return ret; 82 return ret;
83} 83}
84 84
diff --git a/src/testbed/gnunet-daemon-latency-logger.c b/src/testbed/gnunet-daemon-latency-logger.c
index 0af718a63..c13750db7 100644
--- a/src/testbed/gnunet-daemon-latency-logger.c
+++ b/src/testbed/gnunet-daemon-latency-logger.c
@@ -317,6 +317,6 @@ main (int argc, char *const *argv)
317 _ ( 317 _ (
318 "Daemon to log latency values of connections to neighbours"), 318 "Daemon to log latency values of connections to neighbours"),
319 options, &run, NULL)) ? 0 : 1; 319 options, &run, NULL)) ? 0 : 1;
320 GNUNET_free ((void *) argv); 320 GNUNET_free_nz ((void *) argv);
321 return ret; 321 return ret;
322} 322}
diff --git a/src/testbed/gnunet-daemon-testbed-blacklist.c b/src/testbed/gnunet-daemon-testbed-blacklist.c
index 070583941..c82f8075f 100644
--- a/src/testbed/gnunet-daemon-testbed-blacklist.c
+++ b/src/testbed/gnunet-daemon-testbed-blacklist.c
@@ -249,6 +249,6 @@ main (int argc, char *const *argv)
249 _ ( 249 _ (
250 "Daemon to restrict incoming transport layer connections during testbed deployments"), 250 "Daemon to restrict incoming transport layer connections during testbed deployments"),
251 options, &run, NULL)) ? 0 : 1; 251 options, &run, NULL)) ? 0 : 1;
252 GNUNET_free ((void *) argv); 252 GNUNET_free_nz ((void *) argv);
253 return ret; 253 return ret;
254} 254}
diff --git a/src/testbed/gnunet-daemon-testbed-underlay.c b/src/testbed/gnunet-daemon-testbed-underlay.c
index 09dfee5a6..2bff7cdd4 100644
--- a/src/testbed/gnunet-daemon-testbed-underlay.c
+++ b/src/testbed/gnunet-daemon-testbed-underlay.c
@@ -476,6 +476,6 @@ main (int argc, char *const *argv)
476 ( 476 (
477 "Daemon to restrict underlay network in testbed deployments"), 477 "Daemon to restrict underlay network in testbed deployments"),
478 options, &run, NULL)) ? 0 : 1; 478 options, &run, NULL)) ? 0 : 1;
479 GNUNET_free ((void *) argv); 479 GNUNET_free_nz ((void *) argv);
480 return ret; 480 return ret;
481} 481}
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c
index cfc6367fe..90813c8e5 100644
--- a/src/testbed/gnunet-testbed-profiler.c
+++ b/src/testbed/gnunet-testbed-profiler.c
@@ -318,7 +318,7 @@ main (int argc, char *const *argv)
318 ret = 318 ret =
319 GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-profiler", binaryHelp, 319 GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-profiler", binaryHelp,
320 options, &run, NULL); 320 options, &run, NULL);
321 GNUNET_free ((void *) argv); 321 GNUNET_free_nz ((void *) argv);
322 if (GNUNET_OK != ret) 322 if (GNUNET_OK != ret)
323 return ret; 323 return ret;
324 if (GNUNET_OK != result) 324 if (GNUNET_OK != result)
diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c
index b850d6b13..a9e5042b2 100644
--- a/src/testing/gnunet-testing.c
+++ b/src/testing/gnunet-testing.c
@@ -436,7 +436,7 @@ main (int argc, char *const *argv)
436 GNUNET_YES)) 436 GNUNET_YES))
437 ? ret 437 ? ret
438 : 1; 438 : 1;
439 GNUNET_free ((void *) argv); 439 GNUNET_free_nz ((void *) argv);
440 return ret; 440 return ret;
441} 441}
442 442
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 3e447e1ff..23bc40d7e 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -1343,7 +1343,7 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
1343 return; 1343 return;
1344 } 1344 }
1345 peer->id = GNUNET_new (struct GNUNET_PeerIdentity); 1345 peer->id = GNUNET_new (struct GNUNET_PeerIdentity);
1346 GNUNET_free ( 1346 GNUNET_free_nz (
1347 GNUNET_TESTING_hostkey_get (peer->system, peer->key_number, peer->id)); 1347 GNUNET_TESTING_hostkey_get (peer->system, peer->key_number, peer->id));
1348 GNUNET_memcpy (id, peer->id, sizeof(struct GNUNET_PeerIdentity)); 1348 GNUNET_memcpy (id, peer->id, sizeof(struct GNUNET_PeerIdentity));
1349} 1349}
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index 261d825ea..c6f600df1 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -1130,7 +1130,7 @@ main (int argc, char *const *argv)
1130 NULL)) 1130 NULL))
1131 ? 0 1131 ? 0
1132 : 1; 1132 : 1;
1133 GNUNET_free ((void *) argv); 1133 GNUNET_free_nz ((void *) argv);
1134 return ret; 1134 return ret;
1135} 1135}
1136 1136
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 077c0409a..3028b29b4 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -673,7 +673,13 @@ TESTS += \
673 test_transport_api_timeout_udp \ 673 test_transport_api_timeout_udp \
674 test_transport_api_udp_nat \ 674 test_transport_api_udp_nat \
675 test_transport_api_reliability_udp \ 675 test_transport_api_reliability_udp \
676 test_quota_compliance_udp 676test_quota_compliance_udp \
677test_communicator_basic-unix \
678test_communicator_basic-tcp \
679test_communicator_basic-udp \
680test_communicator_rekey-tcp \
681test_communicator_rekey-udp \
682test_communicator_backchannel-udp
677endif 683endif
678endif 684endif
679 685
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index 045a57d0f..bbfacbffd 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -880,7 +880,7 @@ do_rekey (struct Queue *queue, const struct TCPRekey *rekey)
880 /* FIXME: check monotonic time is monotonic... */ 880 /* FIXME: check monotonic time is monotonic... */
881 if (GNUNET_OK != 881 if (GNUNET_OK !=
882 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY, 882 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY,
883 &thp.purpose, 883 &thp,
884 &rekey->sender_sig, 884 &rekey->sender_sig,
885 &queue->target.public_key)) 885 &queue->target.public_key))
886 { 886 {
@@ -1063,8 +1063,7 @@ queue_read (void *cls)
1063 However, we have to take into account that the plaintext buffer may have 1063 However, we have to take into account that the plaintext buffer may have
1064 already contained data and not jumpt too far ahead in the ciphertext. 1064 already contained data and not jumpt too far ahead in the ciphertext.
1065 If there is no rekey and the last message is incomplete (max > total), 1065 If there is no rekey and the last message is incomplete (max > total),
1066 it is safe to keep the decryption so we shift by 'max' */ 1066 it is safe to keep the decryption so we shift by 'max' */if (GNUNET_YES == queue->rekeyed)
1067 if (GNUNET_YES == queue->rekeyed)
1068 { 1067 {
1069 max = total - old_pread_off; 1068 max = total - old_pread_off;
1070 queue->rekeyed = GNUNET_NO; 1069 queue->rekeyed = GNUNET_NO;
@@ -1271,8 +1270,7 @@ inject_rekey (struct Queue *queue)
1271 1270
1272 GNUNET_assert (0 == queue->pwrite_off); 1271 GNUNET_assert (0 == queue->pwrite_off);
1273 memset (&rekey, 0, sizeof(rekey)); 1272 memset (&rekey, 0, sizeof(rekey));
1274 GNUNET_assert (GNUNET_OK == 1273 GNUNET_CRYPTO_ecdhe_key_create (&queue->ephemeral);
1275 GNUNET_CRYPTO_ecdhe_key_create2 (&queue->ephemeral));
1276 rekey.header.type = ntohs (GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_REKEY); 1274 rekey.header.type = ntohs (GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_REKEY);
1277 rekey.header.size = ntohs (sizeof(rekey)); 1275 rekey.header.size = ntohs (sizeof(rekey));
1278 GNUNET_CRYPTO_ecdhe_key_get_public (&queue->ephemeral, &rekey.ephemeral); 1276 GNUNET_CRYPTO_ecdhe_key_get_public (&queue->ephemeral, &rekey.ephemeral);
@@ -1284,9 +1282,9 @@ inject_rekey (struct Queue *queue)
1284 thp.receiver = queue->target; 1282 thp.receiver = queue->target;
1285 thp.ephemeral = rekey.ephemeral; 1283 thp.ephemeral = rekey.ephemeral;
1286 thp.monotonic_time = rekey.monotonic_time; 1284 thp.monotonic_time = rekey.monotonic_time;
1287 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (my_private_key, 1285 GNUNET_CRYPTO_eddsa_sign (my_private_key,
1288 &thp.purpose, 1286 &thp,
1289 &rekey.sender_sig)); 1287 &rekey.sender_sig);
1290 calculate_hmac (&queue->out_hmac, &rekey, sizeof(rekey), &rekey.hmac); 1288 calculate_hmac (&queue->out_hmac, &rekey, sizeof(rekey), &rekey.hmac);
1291 /* Encrypt rekey message with 'old' cipher */ 1289 /* Encrypt rekey message with 'old' cipher */
1292 GNUNET_assert (0 == 1290 GNUNET_assert (0 ==
@@ -1586,9 +1584,9 @@ transmit_kx (struct Queue *queue,
1586 ths.receiver = queue->target; 1584 ths.receiver = queue->target;
1587 ths.ephemeral = *epub; 1585 ths.ephemeral = *epub;
1588 ths.monotonic_time = tc.monotonic_time; 1586 ths.monotonic_time = tc.monotonic_time;
1589 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (my_private_key, 1587 GNUNET_CRYPTO_eddsa_sign (my_private_key,
1590 &ths.purpose, 1588 &ths,
1591 &tc.sender_sig)); 1589 &tc.sender_sig);
1592 GNUNET_assert (0 == 1590 GNUNET_assert (0 ==
1593 gcry_cipher_encrypt (queue->out_cipher, 1591 gcry_cipher_encrypt (queue->out_cipher,
1594 &queue->cwrite_buf[queue->cwrite_off], 1592 &queue->cwrite_buf[queue->cwrite_off],
@@ -1611,8 +1609,7 @@ start_initial_kx_out (struct Queue *queue)
1611{ 1609{
1612 struct GNUNET_CRYPTO_EcdhePublicKey epub; 1610 struct GNUNET_CRYPTO_EcdhePublicKey epub;
1613 1611
1614 GNUNET_assert (GNUNET_OK == 1612 GNUNET_CRYPTO_ecdhe_key_create (&queue->ephemeral);
1615 GNUNET_CRYPTO_ecdhe_key_create2 (&queue->ephemeral));
1616 GNUNET_CRYPTO_ecdhe_key_get_public (&queue->ephemeral, &epub); 1613 GNUNET_CRYPTO_ecdhe_key_get_public (&queue->ephemeral, &epub);
1617 setup_out_cipher (queue); 1614 setup_out_cipher (queue);
1618 transmit_kx (queue, &epub); 1615 transmit_kx (queue, &epub);
@@ -1654,7 +1651,7 @@ decrypt_and_check_tc (struct Queue *queue,
1654 from this sender! */ 1651 from this sender! */
1655 return GNUNET_CRYPTO_eddsa_verify ( 1652 return GNUNET_CRYPTO_eddsa_verify (
1656 GNUNET_SIGNATURE_COMMUNICATOR_TCP_HANDSHAKE, 1653 GNUNET_SIGNATURE_COMMUNICATOR_TCP_HANDSHAKE,
1657 &ths.purpose, 1654 &ths,
1658 &tc->sender_sig, 1655 &tc->sender_sig,
1659 &tc->sender.public_key); 1656 &tc->sender.public_key);
1660} 1657}
@@ -1953,7 +1950,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
1953 queue->address_len = in_len; 1950 queue->address_len = in_len;
1954 queue->sock = sock; 1951 queue->sock = sock;
1955 boot_queue (queue, GNUNET_TRANSPORT_CS_OUTBOUND); 1952 boot_queue (queue, GNUNET_TRANSPORT_CS_OUTBOUND);
1956 //queue->mq_awaits_continue = GNUNET_YES; 1953 // queue->mq_awaits_continue = GNUNET_YES;
1957 queue->read_task = 1954 queue->read_task =
1958 GNUNET_SCHEDULER_add_read_net (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 1955 GNUNET_SCHEDULER_add_read_net (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
1959 queue->sock, 1956 queue->sock,
@@ -2155,9 +2152,9 @@ run (void *cls,
2155 max_queue_length = DEFAULT_MAX_QUEUE_LENGTH; 2152 max_queue_length = DEFAULT_MAX_QUEUE_LENGTH;
2156 if (GNUNET_OK != 2153 if (GNUNET_OK !=
2157 GNUNET_CONFIGURATION_get_value_time (cfg, 2154 GNUNET_CONFIGURATION_get_value_time (cfg,
2158 COMMUNICATOR_CONFIG_SECTION, 2155 COMMUNICATOR_CONFIG_SECTION,
2159 "REKEY_INTERVAL", 2156 "REKEY_INTERVAL",
2160 &rekey_interval)) 2157 &rekey_interval))
2161 rekey_interval = DEFAULT_REKEY_INTERVAL; 2158 rekey_interval = DEFAULT_REKEY_INTERVAL;
2162 2159
2163 in = tcp_address_to_sockaddr (bindto, &in_len); 2160 in = tcp_address_to_sockaddr (bindto, &in_len);
@@ -2286,9 +2283,9 @@ main (int argc, char *const *argv)
2286 options, 2283 options,
2287 &run, 2284 &run,
2288 NULL)) 2285 NULL))
2289 ? 0 2286 ? 0
2290 : 1; 2287 : 1;
2291 GNUNET_free ((void *) argv); 2288 GNUNET_free_nz ((void *) argv);
2292 return ret; 2289 return ret;
2293} 2290}
2294 2291
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c
index e931bd2e7..72e84567a 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -1133,14 +1133,18 @@ setup_cipher (const struct GNUNET_HashCode *msec,
1133{ 1133{
1134 char key[AES_KEY_SIZE]; 1134 char key[AES_KEY_SIZE];
1135 char iv[AES_IV_SIZE]; 1135 char iv[AES_IV_SIZE];
1136 int rc;
1136 1137
1137 gcry_cipher_open (cipher, 1138 GNUNET_assert (0 ==
1138 GCRY_CIPHER_AES256 /* low level: go for speed */, 1139 gcry_cipher_open (cipher,
1139 GCRY_CIPHER_MODE_GCM, 1140 GCRY_CIPHER_AES256 /* low level: go for speed */,
1140 0 /* flags */); 1141 GCRY_CIPHER_MODE_GCM,
1142 0 /* flags */));
1141 get_iv_key (msec, serial, key, iv); 1143 get_iv_key (msec, serial, key, iv);
1142 gcry_cipher_setkey (*cipher, key, sizeof(key)); 1144 rc = gcry_cipher_setkey (*cipher, key, sizeof(key));
1143 gcry_cipher_setiv (*cipher, iv, sizeof(iv)); 1145 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
1146 rc = gcry_cipher_setiv (*cipher, iv, sizeof(iv));
1147 GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
1144} 1148}
1145 1149
1146 1150
@@ -1529,7 +1533,7 @@ verify_confirmation (const struct GNUNET_CRYPTO_EcdhePublicKey *ephemeral,
1529 uhs.monotonic_time = uc->monotonic_time; 1533 uhs.monotonic_time = uc->monotonic_time;
1530 return GNUNET_CRYPTO_eddsa_verify ( 1534 return GNUNET_CRYPTO_eddsa_verify (
1531 GNUNET_SIGNATURE_COMMUNICATOR_UDP_HANDSHAKE, 1535 GNUNET_SIGNATURE_COMMUNICATOR_UDP_HANDSHAKE,
1532 &uhs.purpose, 1536 &uhs,
1533 &uc->sender_sig, 1537 &uc->sender_sig,
1534 &uc->sender.public_key); 1538 &uc->sender.public_key);
1535} 1539}
@@ -1630,7 +1634,7 @@ sock_read (void *cls)
1630 GNUNET_CRYPTO_hash (&sa, salen, &uhs.h_address); 1634 GNUNET_CRYPTO_hash (&sa, salen, &uhs.h_address);
1631 if (GNUNET_OK == 1635 if (GNUNET_OK ==
1632 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_COMMUNICATOR_UDP_BROADCAST, 1636 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_COMMUNICATOR_UDP_BROADCAST,
1633 &uhs.purpose, 1637 &uhs,
1634 &ub->sender_sig, 1638 &ub->sender_sig,
1635 &ub->sender.public_key)) 1639 &ub->sender.public_key))
1636 { 1640 {
@@ -1914,7 +1918,7 @@ mq_send (struct GNUNET_MQ_Handle *mq,
1914 struct SharedSecret *ss; 1918 struct SharedSecret *ss;
1915 1919
1916 /* setup key material */ 1920 /* setup key material */
1917 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdhe_key_create2 (&epriv)); 1921 GNUNET_CRYPTO_ecdhe_key_create (&epriv);
1918 1922
1919 ss = setup_shared_secret_enc (&epriv, receiver); 1923 ss = setup_shared_secret_enc (&epriv, receiver);
1920 setup_cipher (&ss->master, 0, &out_cipher); 1924 setup_cipher (&ss->master, 0, &out_cipher);
@@ -1928,9 +1932,9 @@ mq_send (struct GNUNET_MQ_Handle *mq,
1928 uhs.receiver = receiver->target; 1932 uhs.receiver = receiver->target;
1929 GNUNET_CRYPTO_ecdhe_key_get_public (&epriv, &uhs.ephemeral); 1933 GNUNET_CRYPTO_ecdhe_key_get_public (&epriv, &uhs.ephemeral);
1930 uhs.monotonic_time = uc.monotonic_time; 1934 uhs.monotonic_time = uc.monotonic_time;
1931 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (my_private_key, 1935 GNUNET_CRYPTO_eddsa_sign (my_private_key,
1932 &uhs.purpose, 1936 &uhs,
1933 &uc.sender_sig)); 1937 &uc.sender_sig);
1934 /* Leave space for kx */ 1938 /* Leave space for kx */
1935 dpos = sizeof(kx); 1939 dpos = sizeof(kx);
1936 /* Append encrypted uc to dgram */ 1940 /* Append encrypted uc to dgram */
@@ -2530,9 +2534,9 @@ iface_proc (void *cls,
2530 ubs.purpose.size = htonl (sizeof(ubs)); 2534 ubs.purpose.size = htonl (sizeof(ubs));
2531 ubs.sender = my_identity; 2535 ubs.sender = my_identity;
2532 GNUNET_CRYPTO_hash (addr, addrlen, &ubs.h_address); 2536 GNUNET_CRYPTO_hash (addr, addrlen, &ubs.h_address);
2533 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (my_private_key, 2537 GNUNET_CRYPTO_eddsa_sign (my_private_key,
2534 &ubs.purpose, 2538 &ubs,
2535 &bi->bcm.sender_sig)); 2539 &bi->bcm.sender_sig);
2536 if (NULL != broadcast_addr) 2540 if (NULL != broadcast_addr)
2537 { 2541 {
2538 bi->broadcast_task = GNUNET_SCHEDULER_add_now (&ifc_broadcast, bi); 2542 bi->broadcast_task = GNUNET_SCHEDULER_add_now (&ifc_broadcast, bi);
@@ -2787,7 +2791,7 @@ main (int argc, char *const *argv)
2787 NULL)) 2791 NULL))
2788 ? 0 2792 ? 0
2789 : 1; 2793 : 1;
2790 GNUNET_free ((void *) argv); 2794 GNUNET_free_nz ((void *) argv);
2791 return ret; 2795 return ret;
2792} 2796}
2793 2797
diff --git a/src/transport/gnunet-communicator-unix.c b/src/transport/gnunet-communicator-unix.c
index 7d7f18a9c..31d2e4ed3 100644
--- a/src/transport/gnunet-communicator-unix.c
+++ b/src/transport/gnunet-communicator-unix.c
@@ -1135,7 +1135,7 @@ main (int argc, char *const *argv)
1135 NULL)) 1135 NULL))
1136 ? 0 1136 ? 0
1137 : 1; 1137 : 1;
1138 GNUNET_free ((void *) argv); 1138 GNUNET_free_nz ((void *) argv);
1139 return ret; 1139 return ret;
1140} 1140}
1141 1141
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 8d68d90a6..5f3178939 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -4130,16 +4130,15 @@ update_ephemeral (struct DistanceVector *dv)
4130 dv->monotime = GNUNET_TIME_absolute_get_monotonic (GST_cfg); 4130 dv->monotime = GNUNET_TIME_absolute_get_monotonic (GST_cfg);
4131 dv->ephemeral_validity = 4131 dv->ephemeral_validity =
4132 GNUNET_TIME_absolute_add (dv->monotime, EPHEMERAL_VALIDITY); 4132 GNUNET_TIME_absolute_add (dv->monotime, EPHEMERAL_VALIDITY);
4133 GNUNET_assert (GNUNET_OK == 4133 GNUNET_CRYPTO_ecdhe_key_create (&dv->private_key);
4134 GNUNET_CRYPTO_ecdhe_key_create2 (&dv->private_key));
4135 GNUNET_CRYPTO_ecdhe_key_get_public (&dv->private_key, &dv->ephemeral_key); 4134 GNUNET_CRYPTO_ecdhe_key_get_public (&dv->private_key, &dv->ephemeral_key);
4136 ec.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_EPHEMERAL); 4135 ec.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_EPHEMERAL);
4137 ec.purpose.size = htonl (sizeof(ec)); 4136 ec.purpose.size = htonl (sizeof(ec));
4138 ec.target = dv->target; 4137 ec.target = dv->target;
4139 ec.ephemeral_key = dv->ephemeral_key; 4138 ec.ephemeral_key = dv->ephemeral_key;
4140 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, 4139 GNUNET_CRYPTO_eddsa_sign (GST_my_private_key,
4141 &ec.purpose, 4140 &ec,
4142 &dv->sender_sig)); 4141 &dv->sender_sig);
4143} 4142}
4144 4143
4145 4144
@@ -6391,17 +6390,17 @@ forward_dv_learn (const struct GNUNET_PeerIdentity *next_hop,
6391 GNUNET_memcpy (dhops, hops, sizeof(struct DVPathEntryP) * nhops); 6390 GNUNET_memcpy (dhops, hops, sizeof(struct DVPathEntryP) * nhops);
6392 dhops[nhops].hop = GST_my_identity; 6391 dhops[nhops].hop = GST_my_identity;
6393 { 6392 {
6394 struct DvHopPS dhp = { .purpose.purpose = 6393 struct DvHopPS dhp = {
6395 htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_HOP), 6394 .purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_HOP),
6396 .purpose.size = htonl (sizeof(dhp)), 6395 .purpose.size = htonl (sizeof(dhp)),
6397 .pred = dhops[nhops - 1].hop, 6396 .pred = dhops[nhops - 1].hop,
6398 .succ = *next_hop, 6397 .succ = *next_hop,
6399 .challenge = msg->challenge }; 6398 .challenge = msg->challenge
6399 };
6400 6400
6401 GNUNET_assert (GNUNET_OK == 6401 GNUNET_CRYPTO_eddsa_sign (GST_my_private_key,
6402 GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, 6402 &dhp,
6403 &dhp.purpose, 6403 &dhops[nhops].hop_sig);
6404 &dhops[nhops].hop_sig));
6405 } 6404 }
6406 route_control_message_without_fc (next_hop, 6405 route_control_message_without_fc (next_hop,
6407 &fwd->header, 6406 &fwd->header,
@@ -6434,7 +6433,7 @@ validate_dv_initiator_signature (
6434 if ( 6433 if (
6435 GNUNET_OK != 6434 GNUNET_OK !=
6436 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_INITIATOR, 6435 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_INITIATOR,
6437 &ip.purpose, 6436 &ip,
6438 init_sig, 6437 init_sig,
6439 &init->public_key)) 6438 &init->public_key))
6440 { 6439 {
@@ -6770,7 +6769,7 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
6770 6769
6771 if (GNUNET_OK != 6770 if (GNUNET_OK !=
6772 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_HOP, 6771 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_HOP,
6773 &dhp.purpose, 6772 &dhp,
6774 &hops[i].hop_sig, 6773 &hops[i].hop_sig,
6775 &hops[i].hop.public_key)) 6774 &hops[i].hop.public_key))
6776 { 6775 {
@@ -7422,7 +7421,7 @@ handle_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
7422 GNUNET_OK != 7421 GNUNET_OK !=
7423 GNUNET_CRYPTO_eddsa_verify ( 7422 GNUNET_CRYPTO_eddsa_verify (
7424 GNUNET_SIGNATURE_PURPOSE_TRANSPORT_EPHEMERAL, 7423 GNUNET_SIGNATURE_PURPOSE_TRANSPORT_EPHEMERAL,
7425 &ec.purpose, 7424 &ec,
7426 &ppay.sender_sig, 7425 &ppay.sender_sig,
7427 &ppay.sender.public_key)) 7426 &ppay.sender.public_key))
7428 { 7427 {
@@ -7728,15 +7727,16 @@ handle_validation_challenge (
7728 tvr.validity_duration = validity_duration; 7727 tvr.validity_duration = validity_duration;
7729 { 7728 {
7730 /* create signature */ 7729 /* create signature */
7731 struct TransportValidationPS tvp = 7730 struct TransportValidationPS tvp = {
7732 { .purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_CHALLENGE), 7731 .purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_CHALLENGE),
7733 .purpose.size = htonl (sizeof(tvp)), 7732 .purpose.size = htonl (sizeof(tvp)),
7734 .validity_duration = validity_duration, 7733 .validity_duration = validity_duration,
7735 .challenge = tvc->challenge }; 7734 .challenge = tvc->challenge
7735 };
7736 7736
7737 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, 7737 GNUNET_CRYPTO_eddsa_sign (GST_my_private_key,
7738 &tvp.purpose, 7738 &tvp,
7739 &tvr.signature)); 7739 &tvr.signature);
7740 } 7740 }
7741 route_control_message_without_fc (&cmc->im.sender, 7741 route_control_message_without_fc (&cmc->im.sender,
7742 &tvr.header, 7742 &tvr.header,
@@ -7921,16 +7921,17 @@ handle_validation_response (
7921 7921
7922 { 7922 {
7923 /* check signature */ 7923 /* check signature */
7924 struct TransportValidationPS tvp = 7924 struct TransportValidationPS tvp = {
7925 { .purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_CHALLENGE), 7925 .purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_CHALLENGE),
7926 .purpose.size = htonl (sizeof(tvp)), 7926 .purpose.size = htonl (sizeof(tvp)),
7927 .validity_duration = tvr->validity_duration, 7927 .validity_duration = tvr->validity_duration,
7928 .challenge = tvr->challenge }; 7928 .challenge = tvr->challenge
7929 };
7929 7930
7930 if ( 7931 if (
7931 GNUNET_OK != 7932 GNUNET_OK !=
7932 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_CHALLENGE, 7933 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_CHALLENGE,
7933 &tvp.purpose, 7934 &tvp,
7934 &tvr->signature, 7935 &tvr->signature,
7935 &cmc->im.sender.public_key)) 7936 &cmc->im.sender.public_key))
7936 { 7937 {
@@ -9393,15 +9394,17 @@ start_dv_learn (void *cls)
9393 dvl.monotonic_time = 9394 dvl.monotonic_time =
9394 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_monotonic (GST_cfg)); 9395 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_monotonic (GST_cfg));
9395 { 9396 {
9396 struct DvInitPS dvip = { .purpose.purpose = htonl ( 9397 struct DvInitPS dvip = {
9397 GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_INITIATOR), 9398 .purpose.purpose = htonl (
9398 .purpose.size = htonl (sizeof(dvip)), 9399 GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_INITIATOR),
9399 .monotonic_time = dvl.monotonic_time, 9400 .purpose.size = htonl (sizeof(dvip)),
9400 .challenge = lle->challenge }; 9401 .monotonic_time = dvl.monotonic_time,
9401 9402 .challenge = lle->challenge
9402 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, 9403 };
9403 &dvip.purpose, 9404
9404 &dvl.init_sig)); 9405 GNUNET_CRYPTO_eddsa_sign (GST_my_private_key,
9406 &dvip,
9407 &dvl.init_sig);
9405 } 9408 }
9406 dvl.initiator = GST_my_identity; 9409 dvl.initiator = GST_my_identity;
9407 dvl.challenge = lle->challenge; 9410 dvl.challenge = lle->challenge;
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 7638839cc..93fa031f4 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -384,7 +384,7 @@ struct GNUNET_PEERINFO_Handle *GST_peerinfo;
384/** 384/**
385 * Our private key. 385 * Our private key.
386 */ 386 */
387struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key; 387struct GNUNET_CRYPTO_EddsaPrivateKey GST_my_private_key;
388 388
389/** 389/**
390 * ATS scheduling handle. 390 * ATS scheduling handle.
@@ -529,7 +529,10 @@ client_disconnect_cb (void *cls,
529 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 529 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
530 "Client %p disconnected, cleaning up.\n", 530 "Client %p disconnected, cleaning up.\n",
531 tc); 531 tc);
532 GNUNET_CONTAINER_multipeermap_iterate (active_stccs, &mark_match_down, tc); 532 if (NULL != active_stccs)
533 GNUNET_CONTAINER_multipeermap_iterate (active_stccs,
534 &mark_match_down,
535 tc);
533 for (struct AddressToStringContext *cur = a2s_head; NULL != cur; 536 for (struct AddressToStringContext *cur = a2s_head; NULL != cur;
534 cur = cur->next) 537 cur = cur->next)
535 { 538 {
@@ -2180,11 +2183,6 @@ shutdown_task (void *cls)
2180 GNUNET_STATISTICS_destroy (GST_stats, GNUNET_NO); 2183 GNUNET_STATISTICS_destroy (GST_stats, GNUNET_NO);
2181 GST_stats = NULL; 2184 GST_stats = NULL;
2182 } 2185 }
2183 if (NULL != GST_my_private_key)
2184 {
2185 GNUNET_free (GST_my_private_key);
2186 GST_my_private_key = NULL;
2187 }
2188} 2186}
2189 2187
2190 2188
@@ -2608,7 +2606,6 @@ run (void *cls,
2608 struct GNUNET_SERVICE_Handle *service) 2606 struct GNUNET_SERVICE_Handle *service)
2609{ 2607{
2610 char *keyfile; 2608 char *keyfile;
2611 struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
2612 long long unsigned int max_fd_cfg; 2609 long long unsigned int max_fd_cfg;
2613 int max_fd_rlimit; 2610 int max_fd_rlimit;
2614 int max_fd; 2611 int max_fd;
@@ -2635,17 +2632,22 @@ run (void *cls,
2635 { 2632 {
2636 hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION; 2633 hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION;
2637 } 2634 }
2638 pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); 2635 if (GNUNET_SYSERR ==
2636 GNUNET_CRYPTO_eddsa_key_from_file (keyfile,
2637 GNUNET_YES,
2638 &GST_my_private_key))
2639 {
2640 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2641 "Failed to setup peer's private key\n");
2642 GNUNET_SCHEDULER_shutdown ();
2643 GNUNET_free (keyfile);
2644 return;
2645 }
2639 GNUNET_free (keyfile); 2646 GNUNET_free (keyfile);
2640 GNUNET_assert (NULL != pk);
2641 GST_my_private_key = pk;
2642
2643 GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg); 2647 GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg);
2644 GST_peerinfo = GNUNET_PEERINFO_connect (GST_cfg); 2648 GST_peerinfo = GNUNET_PEERINFO_connect (GST_cfg);
2645 GNUNET_CRYPTO_eddsa_key_get_public (GST_my_private_key, 2649 GNUNET_CRYPTO_eddsa_key_get_public (&GST_my_private_key,
2646 &GST_my_identity.public_key); 2650 &GST_my_identity.public_key);
2647 GNUNET_assert (NULL != GST_my_private_key);
2648
2649 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 2651 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
2650 "My identity is `%s'\n", 2652 "My identity is `%s'\n",
2651 GNUNET_i2s_full (&GST_my_identity)); 2653 GNUNET_i2s_full (&GST_my_identity));
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h
index acb1de395..ea9e71e4b 100644
--- a/src/transport/gnunet-service-transport.h
+++ b/src/transport/gnunet-service-transport.h
@@ -56,7 +56,7 @@ extern struct GNUNET_PEERINFO_Handle *GST_peerinfo;
56/** 56/**
57 * Our private key. 57 * Our private key.
58 */ 58 */
59extern struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key; 59extern struct GNUNET_CRYPTO_EddsaPrivateKey GST_my_private_key;
60 60
61/** 61/**
62 * ATS handle. 62 * ATS handle.
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 9c6cebc24..ca1b4d1da 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1045,9 +1045,9 @@ send_disconnect (struct NeighbourMapEntry *n)
1045 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); 1045 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
1046 disconnect_msg.public_key = GST_my_identity.public_key; 1046 disconnect_msg.public_key = GST_my_identity.public_key;
1047 GNUNET_assert (GNUNET_OK == 1047 GNUNET_assert (GNUNET_OK ==
1048 GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, 1048 GNUNET_CRYPTO_eddsa_sign_ (&GST_my_private_key,
1049 &disconnect_msg.purpose, 1049 &disconnect_msg.purpose,
1050 &disconnect_msg.signature)); 1050 &disconnect_msg.signature));
1051 1051
1052 (void) send_with_session (n, 1052 (void) send_with_session (n,
1053 &disconnect_msg, 1053 &disconnect_msg,
@@ -3763,7 +3763,7 @@ GST_neighbours_handle_disconnect_message (const struct
3763 return; 3763 return;
3764 } 3764 }
3765 if (GNUNET_OK != 3765 if (GNUNET_OK !=
3766 GNUNET_CRYPTO_eddsa_verify ( 3766 GNUNET_CRYPTO_eddsa_verify_ (
3767 GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT, 3767 GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT,
3768 &sdm->purpose, 3768 &sdm->purpose,
3769 &sdm->signature, 3769 &sdm->signature,
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 631b0a8f8..e5d670889 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -1271,8 +1271,9 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
1271 *sig_cache_exp = GNUNET_TIME_relative_to_absolute (PONG_SIGNATURE_LIFETIME); 1271 *sig_cache_exp = GNUNET_TIME_relative_to_absolute (PONG_SIGNATURE_LIFETIME);
1272 pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp); 1272 pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp);
1273 if (GNUNET_OK != 1273 if (GNUNET_OK !=
1274 GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, &pong->purpose, 1274 GNUNET_CRYPTO_eddsa_sign_ (&GST_my_private_key,
1275 sig_cache)) 1275 &pong->purpose,
1276 sig_cache))
1276 { 1277 {
1277 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1278 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1278 _ ("Failed to create PONG signature for peer `%s'\n"), 1279 _ ("Failed to create PONG signature for peer `%s'\n"),
@@ -1559,7 +1560,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
1559 if (GNUNET_YES == do_verify) 1560 if (GNUNET_YES == do_verify)
1560 { 1561 {
1561 /* Do expensive verification */ 1562 /* Do expensive verification */
1562 sig_res = GNUNET_CRYPTO_eddsa_verify ( 1563 sig_res = GNUNET_CRYPTO_eddsa_verify_ (
1563 GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, 1564 GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN,
1564 &pong->purpose, 1565 &pong->purpose,
1565 &pong->signature, 1566 &pong->signature,
diff --git a/src/transport/gnunet-transport-profiler.c b/src/transport/gnunet-transport-profiler.c
index 6c13cf059..81678fa20 100644
--- a/src/transport/gnunet-transport-profiler.c
+++ b/src/transport/gnunet-transport-profiler.c
@@ -615,7 +615,7 @@ main (int argc, char *const *argv)
615 options, 615 options,
616 &run, 616 &run,
617 NULL); 617 NULL);
618 GNUNET_free ((void *) argv); 618 GNUNET_free_nz ((void *) argv);
619 if (GNUNET_OK == res) 619 if (GNUNET_OK == res)
620 return ret; 620 return ret;
621 return 1; 621 return 1;
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 5a437b660..35da5ec10 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -1427,7 +1427,7 @@ main (int argc, char *const *argv)
1427 options, 1427 options,
1428 &run, 1428 &run,
1429 NULL); 1429 NULL);
1430 GNUNET_free ((void *) argv); 1430 GNUNET_free_nz ((void *) argv);
1431 if (GNUNET_OK == res) 1431 if (GNUNET_OK == res)
1432 return ret; 1432 return ret;
1433 return 1; 1433 return 1;
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 20bdb6273..eef83b29d 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -33,7 +33,7 @@
33#include "plugin_transport_http_common.h" 33#include "plugin_transport_http_common.h"
34#include <microhttpd.h> 34#include <microhttpd.h>
35#include <regex.h> 35#include <regex.h>
36 36#include "gnunet_mhd_compat.h"
37 37
38#if BUILD_HTTPS 38#if BUILD_HTTPS
39#define PLUGIN_NAME "https_server" 39#define PLUGIN_NAME "https_server"
@@ -1741,9 +1741,9 @@ add_cors_headers (struct MHD_Response *response)
1741 * @param upload_data upload data 1741 * @param upload_data upload data
1742 * @param upload_data_size size of @a upload_data 1742 * @param upload_data_size size of @a upload_data
1743 * @param httpSessionCache the session cache to remember the connection 1743 * @param httpSessionCache the session cache to remember the connection
1744 * @return MHD_YES if connection is accepted, MHD_NO on reject 1744 * @return #MHD_YES if connection is accepted, #MHD_NO on reject
1745 */ 1745 */
1746static int 1746static MHD_RESULT
1747server_access_cb (void *cls, 1747server_access_cb (void *cls,
1748 struct MHD_Connection *mhd_connection, 1748 struct MHD_Connection *mhd_connection,
1749 const char *url, 1749 const char *url,
@@ -1757,7 +1757,7 @@ server_access_cb (void *cls,
1757 struct ServerRequest *sc = *httpSessionCache; 1757 struct ServerRequest *sc = *httpSessionCache;
1758 struct GNUNET_ATS_Session *s; 1758 struct GNUNET_ATS_Session *s;
1759 struct MHD_Response *response; 1759 struct MHD_Response *response;
1760 int res = MHD_YES; 1760 MHD_RESULT res = MHD_YES;
1761 1761
1762 LOG (GNUNET_ERROR_TYPE_DEBUG, 1762 LOG (GNUNET_ERROR_TYPE_DEBUG,
1763 _ ( 1763 _ (
@@ -2025,9 +2025,9 @@ server_connection_cb (void *cls,
2025 * @param cls plugin as closure 2025 * @param cls plugin as closure
2026 * @param addr address of incoming connection 2026 * @param addr address of incoming connection
2027 * @param addr_len number of bytes in @a addr 2027 * @param addr_len number of bytes in @a addr
2028 * @return MHD_YES if connection is accepted, MHD_NO if connection is rejected 2028 * @return #MHD_YES if connection is accepted, #MHD_NO if connection is rejected
2029 */ 2029 */
2030static int 2030static MHD_RESULT
2031server_accept_cb (void *cls, 2031server_accept_cb (void *cls,
2032 const struct sockaddr *addr, 2032 const struct sockaddr *addr,
2033 socklen_t addr_len) 2033 socklen_t addr_len)
diff --git a/src/transport/tcp_service_legacy.c b/src/transport/tcp_service_legacy.c
index f207863f9..fb4e9c3c9 100644
--- a/src/transport/tcp_service_legacy.c
+++ b/src/transport/tcp_service_legacy.c
@@ -1474,7 +1474,7 @@ shutdown:
1474 i = 0; 1474 i = 0;
1475 if (NULL != sctx.addrs) 1475 if (NULL != sctx.addrs)
1476 while (NULL != sctx.addrs[i]) 1476 while (NULL != sctx.addrs[i])
1477 GNUNET_free (sctx.addrs[i++]); 1477 GNUNET_free_nz (sctx.addrs[i++]);
1478 GNUNET_free_non_null (sctx.addrs); 1478 GNUNET_free_non_null (sctx.addrs);
1479 GNUNET_free_non_null (sctx.addrlens); 1479 GNUNET_free_non_null (sctx.addrlens);
1480 GNUNET_free_non_null (logfile); 1480 GNUNET_free_non_null (logfile);
@@ -1631,7 +1631,7 @@ LEGACY_SERVICE_stop (struct LEGACY_SERVICE_Context *sctx)
1631 { 1631 {
1632 i = 0; 1632 i = 0;
1633 while (NULL != sctx->addrs[i]) 1633 while (NULL != sctx->addrs[i])
1634 GNUNET_free (sctx->addrs[i++]); 1634 GNUNET_free_nz (sctx->addrs[i++]);
1635 GNUNET_free (sctx->addrs); 1635 GNUNET_free (sctx->addrs);
1636 } 1636 }
1637 GNUNET_free_non_null (sctx->addrlens); 1637 GNUNET_free_non_null (sctx->addrlens);
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c
index c469a55a1..e99db7cfb 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -43,8 +43,6 @@
43 43
44static struct GNUNET_SCHEDULER_Task *to_task; 44static struct GNUNET_SCHEDULER_Task *to_task;
45 45
46static struct GNUNET_SCHEDULER_Task *active_task;
47
48static int queue_est = GNUNET_NO; 46static int queue_est = GNUNET_NO;
49 47
50static struct GNUNET_PeerIdentity peer_id[NUM_PEERS]; 48static struct GNUNET_PeerIdentity peer_id[NUM_PEERS];
@@ -233,21 +231,21 @@ size_test (void *cls)
233{ 231{
234 char *payload; 232 char *payload;
235 233
236 active_task = NULL;
237 GNUNET_assert (TP_SIZE_CHECK == phase); 234 GNUNET_assert (TP_SIZE_CHECK == phase);
238 if (ack >= 64000) 235 if (ack >= 64000)
239 return; /* Leave some room for our protocol, so not 2^16 exactly */ 236 return; /* Leave some room for our protocol, so not 2^16 exactly */
240 payload = make_payload (ack); 237 payload = make_payload (ack);
238 ack += 5;
239 num_sent++;
241 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, 240 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
241 (ack < 64000)
242 ? &size_test
243 : NULL,
244 NULL,
242 payload, 245 payload,
243 ack); 246 ack);
244 GNUNET_free (payload); 247 GNUNET_free (payload);
245 ack += 5;
246 num_sent++;
247 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS); 248 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
248 if (ack < 64000)
249 active_task = GNUNET_SCHEDULER_add_now (&size_test,
250 NULL);
251} 249}
252 250
253 251
@@ -256,18 +254,18 @@ long_test (void *cls)
256{ 254{
257 char *payload; 255 char *payload;
258 256
259 active_task = NULL;
260 payload = make_payload (LONG_MESSAGE_SIZE); 257 payload = make_payload (LONG_MESSAGE_SIZE);
258 num_sent++;
261 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, 259 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
260 (BURST_PACKETS ==
261 num_sent)
262 ? NULL
263 : &long_test,
264 NULL,
262 payload, 265 payload,
263 LONG_MESSAGE_SIZE); 266 LONG_MESSAGE_SIZE);
264 num_sent++;
265 GNUNET_free (payload); 267 GNUNET_free (payload);
266 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS); 268 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
267 if (num_sent == BURST_PACKETS)
268 return;
269 active_task = GNUNET_SCHEDULER_add_now (&long_test,
270 NULL);
271} 269}
272 270
273 271
@@ -276,18 +274,18 @@ short_test (void *cls)
276{ 274{
277 char *payload; 275 char *payload;
278 276
279 active_task = NULL;
280 payload = make_payload (SHORT_MESSAGE_SIZE); 277 payload = make_payload (SHORT_MESSAGE_SIZE);
278 num_sent++;
281 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, 279 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
280 (BURST_PACKETS ==
281 num_sent)
282 ? NULL
283 : &short_test,
284 NULL,
282 payload, 285 payload,
283 SHORT_MESSAGE_SIZE); 286 SHORT_MESSAGE_SIZE);
284 num_sent++;
285 GNUNET_free (payload); 287 GNUNET_free (payload);
286 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS); 288 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
287 if (num_sent >= BURST_PACKETS)
288 return;
289 active_task = GNUNET_SCHEDULER_add_now (&short_test,
290 NULL);
291} 289}
292 290
293 291
@@ -320,9 +318,7 @@ add_queue_cb (void *cls,
320 to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 318 to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
321 &latency_timeout, 319 &latency_timeout,
322 NULL); 320 NULL);
323 GNUNET_assert (NULL == active_task); 321 short_test (NULL);
324 active_task = GNUNET_SCHEDULER_add_now (&short_test,
325 NULL);
326} 322}
327 323
328 324
@@ -398,8 +394,7 @@ incoming_message_cb (void *cls,
398 num_sent = 0; 394 num_sent = 0;
399 avg_latency = 0; 395 avg_latency = 0;
400 num_received = 0; 396 num_received = 0;
401 active_task = GNUNET_SCHEDULER_add_now (&long_test, 397 long_test (NULL);
402 NULL);
403 } 398 }
404 break; 399 break;
405 } 400 }
@@ -436,8 +431,7 @@ incoming_message_cb (void *cls,
436 num_received = 0; 431 num_received = 0;
437 num_sent = 0; 432 num_sent = 0;
438 avg_latency = 0; 433 avg_latency = 0;
439 active_task = GNUNET_SCHEDULER_add_now (&size_test, 434 size_test (NULL);
440 NULL);
441 } 435 }
442 break; 436 break;
443 } 437 }
@@ -462,8 +456,7 @@ incoming_message_cb (void *cls,
462 { 456 {
463 start_short = GNUNET_TIME_absolute_get (); 457 start_short = GNUNET_TIME_absolute_get ();
464 phase = TP_BURST_SHORT; 458 phase = TP_BURST_SHORT;
465 active_task = GNUNET_SCHEDULER_add_now (&short_test, 459 short_test (NULL);
466 NULL);
467 break; 460 break;
468 } 461 }
469 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 462 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -484,10 +477,9 @@ do_shutdown (void *cls)
484 GNUNET_SCHEDULER_cancel (to_task); 477 GNUNET_SCHEDULER_cancel (to_task);
485 to_task = NULL; 478 to_task = NULL;
486 } 479 }
487 if (NULL != active_task) 480 for (unsigned int i = 0; i < NUM_PEERS; i++)
488 { 481 {
489 GNUNET_SCHEDULER_cancel (active_task); 482 GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (tc_hs[i]);
490 active_task = NULL;
491 } 483 }
492} 484}
493 485
diff --git a/src/transport/test_communicator_udp_basic_peer1.conf b/src/transport/test_communicator_udp_basic_peer1.conf
index 1b35d8e8a..4cfb6f72f 100644
--- a/src/transport/test_communicator_udp_basic_peer1.conf
+++ b/src/transport/test_communicator_udp_basic_peer1.conf
@@ -13,20 +13,13 @@ PORT = 52400
13PORT = 52401 13PORT = 52401
14 14
15[transport] 15[transport]
16PORT = 60000 16#PORT = 60000
17UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport_test_1.sock 17UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport_test_1.sock
18 18
19[nat] 19[nat]
20UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/nat.sock 20UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/nat.sock
21ENABLE_IPSCAN = YES 21ENABLE_IPSCAN = YES
22 22
23[communicator-unix]
24UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_1.sock
25
26[communicator-tcp]
27BINDTO = 60002
28DISABLE_V6 = YES
29
30[communicator-udp] 23[communicator-udp]
31BINDTO = 60002 24BINDTO = 60002
32DISABLE_V6 = YES 25DISABLE_V6 = YES
diff --git a/src/transport/test_communicator_udp_basic_peer2.conf b/src/transport/test_communicator_udp_basic_peer2.conf
index 0472820aa..b9bed2756 100644
--- a/src/transport/test_communicator_udp_basic_peer2.conf
+++ b/src/transport/test_communicator_udp_basic_peer2.conf
@@ -11,22 +11,15 @@ PRIVATE_KEY = $GNUNET_TMP/test-communicator-unix-2/private.key
11PORT = 52400 11PORT = 52400
12 12
13[transport-udp] 13[transport-udp]
14PORT = 52401 14PORT = 52402
15 15
16[transport] 16[transport]
17PORT = 60001 17#PORT = 60001
18UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport_test_2.sock 18UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport_test_2.sock
19 19
20[nat] 20[nat]
21UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/nat.sock 21UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/nat.sock
22 22
23[communicator-unix]
24UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_2.sock
25
26[communicator-tcp]
27BINDTO = 60003
28DISABLE_V6 = YES
29
30[communicator-udp] 23[communicator-udp]
31BINDTO = 60003 24BINDTO = 60003
32DISABLE_V6 = YES 25DISABLE_V6 = YES
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c
index 10e07dae5..04687d845 100644
--- a/src/transport/test_plugin_transport.c
+++ b/src/transport/test_plugin_transport.c
@@ -49,7 +49,7 @@ static struct GNUNET_PeerIdentity my_identity;
49/** 49/**
50 * Our private key. 50 * Our private key.
51 */ 51 */
52static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; 52static struct GNUNET_CRYPTO_EddsaPrivateKey my_private_key;
53 53
54/** 54/**
55 * Our configuration. 55 * Our configuration.
@@ -647,16 +647,20 @@ run (void *cls,
647 } 647 }
648 648
649 max_connect_per_transport = (uint32_t) tneigh; 649 max_connect_per_transport = (uint32_t) tneigh;
650 my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); 650 if (GNUNET_SYSERR ==
651 GNUNET_free (keyfile); 651 GNUNET_CRYPTO_eddsa_key_from_file (keyfile,
652 if (NULL == my_private_key) 652 GNUNET_YES,
653 &my_private_key))
653 { 654 {
655 GNUNET_free (keyfile);
654 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 656 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
655 "Could not access hostkey. Exiting.\n"); 657 "Could not access hostkey. Exiting.\n");
656 end_badly_now (); 658 end_badly_now ();
657 return; 659 return;
658 } 660 }
659 GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_identity.public_key); 661 GNUNET_free (keyfile);
662 GNUNET_CRYPTO_eddsa_key_get_public (&my_private_key,
663 &my_identity.public_key);
660 664
661 hello = GNUNET_HELLO_create (&my_identity.public_key, NULL, NULL, GNUNET_NO); 665 hello = GNUNET_HELLO_create (&my_identity.public_key, NULL, NULL, GNUNET_NO);
662 666
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index 75864294b..fe2f28f54 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -37,6 +37,26 @@
37 37
38#define LOG(kind, ...) GNUNET_log_from (kind, "transport-testing2", __VA_ARGS__) 38#define LOG(kind, ...) GNUNET_log_from (kind, "transport-testing2", __VA_ARGS__)
39 39
40struct MyClient
41{
42 struct MyClient *prev;
43 struct MyClient *next;
44 /**
45 * @brief Handle to the client
46 */
47 struct GNUNET_SERVICE_Client *client;
48
49 /**
50 * @brief Handle to the client
51 */
52 struct GNUNET_MQ_Handle *c_mq;
53
54 /**
55 * The TCH
56 */
57 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc;
58
59};
40 60
41/** 61/**
42 * @brief Handle to a transport communicator 62 * @brief Handle to a transport communicator
@@ -44,8 +64,19 @@
44struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle 64struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle
45{ 65{
46 /** 66 /**
47 * @brief Handle to the configuration 67 * Clients
48 */ 68 */
69 struct MyClient *client_head;
70 struct MyClient *client_tail;
71
72 /**
73 * @brief Handle to the client
74 */
75 struct GNUNET_MQ_Handle *c_mq;
76
77 /**
78 * @brief Handle to the configuration
79 */
49 struct GNUNET_CONFIGURATION_Handle *cfg; 80 struct GNUNET_CONFIGURATION_Handle *cfg;
50 81
51 /** 82 /**
@@ -64,15 +95,6 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle
64 */ 95 */
65 struct GNUNET_SCHEDULER_Task *ts_shutdown_task; 96 struct GNUNET_SCHEDULER_Task *ts_shutdown_task;
66 97
67 /**
68 * @brief Handle to the client
69 */
70 struct GNUNET_SERVICE_Client *client;
71
72 /**
73 * @brief Handle to the client
74 */
75 struct GNUNET_MQ_Handle *c_mq;
76 98
77 /** 99 /**
78 * @brief Process of the communicator 100 * @brief Process of the communicator
@@ -269,12 +291,18 @@ handle_communicator_available (
269 void *cls, 291 void *cls,
270 const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *msg) 292 const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *msg)
271{ 293{
272 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 294 struct MyClient *client = cls;
295 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h =
296 client->tc;
273 uint16_t size; 297 uint16_t size;
298 tc_h->c_mq = client->c_mq;
274 299
275 size = ntohs (msg->header.size) - sizeof(*msg); 300 size = ntohs (msg->header.size) - sizeof(*msg);
276 if (0 == size) 301 if (0 == size)
302 {
303 GNUNET_SERVICE_client_continue (client->client);
277 return; /* receive-only communicator */ 304 return; /* receive-only communicator */
305 }
278 tc_h->c_characteristics = ntohl (msg->cc); 306 tc_h->c_characteristics = ntohl (msg->cc);
279 tc_h->c_addr_prefix = GNUNET_strdup ((const char *) &msg[1]); 307 tc_h->c_addr_prefix = GNUNET_strdup ((const char *) &msg[1]);
280 if (NULL != tc_h->communicator_available_cb) 308 if (NULL != tc_h->communicator_available_cb)
@@ -285,7 +313,9 @@ handle_communicator_available (
285 tc_h->c_characteristics, 313 tc_h->c_characteristics,
286 tc_h->c_addr_prefix); 314 tc_h->c_addr_prefix);
287 } 315 }
288 GNUNET_SERVICE_client_continue (tc_h->client); 316 GNUNET_SERVICE_client_continue (client->client);
317 LOG (GNUNET_ERROR_TYPE_DEBUG, "finished communicator_available_cb()\n");
318
289} 319}
290 320
291 321
@@ -327,7 +357,9 @@ handle_communicator_backchannel (void *cls,
327 GNUNET_TRANSPORT_CommunicatorBackchannel * 357 GNUNET_TRANSPORT_CommunicatorBackchannel *
328 bc_msg) 358 bc_msg)
329{ 359{
330 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 360 struct MyClient *client = cls;
361 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h =
362 client->tc;
331 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *other_tc_h; 363 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *other_tc_h;
332 struct GNUNET_MessageHeader *msg; 364 struct GNUNET_MessageHeader *msg;
333 msg = (struct GNUNET_MessageHeader *) &bc_msg[1]; 365 msg = (struct GNUNET_MessageHeader *) &bc_msg[1];
@@ -339,7 +371,7 @@ handle_communicator_backchannel (void *cls,
339 371
340 if (tc_h->bc_enabled != GNUNET_YES) 372 if (tc_h->bc_enabled != GNUNET_YES)
341 { 373 {
342 GNUNET_SERVICE_client_continue (tc_h->client); 374 GNUNET_SERVICE_client_continue (client->client);
343 return; 375 return;
344 } 376 }
345 /* Find client providing this communicator */ 377 /* Find client providing this communicator */
@@ -359,7 +391,7 @@ handle_communicator_backchannel (void *cls,
359 391
360 392
361 GNUNET_MQ_send (other_tc_h->c_mq, env); 393 GNUNET_MQ_send (other_tc_h->c_mq, env);
362 GNUNET_SERVICE_client_continue (tc_h->client); 394 GNUNET_SERVICE_client_continue (client->client);
363} 395}
364 396
365 397
@@ -396,7 +428,9 @@ static void
396handle_add_address (void *cls, 428handle_add_address (void *cls,
397 const struct GNUNET_TRANSPORT_AddAddressMessage *msg) 429 const struct GNUNET_TRANSPORT_AddAddressMessage *msg)
398{ 430{
399 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 431 struct MyClient *client = cls;
432 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h =
433 client->tc;
400 uint16_t size; 434 uint16_t size;
401 size = ntohs (msg->header.size) - sizeof(*msg); 435 size = ntohs (msg->header.size) - sizeof(*msg);
402 if (0 == size) 436 if (0 == size)
@@ -413,7 +447,7 @@ handle_add_address (void *cls,
413 msg->aid, 447 msg->aid,
414 ntohl (msg->nt)); 448 ntohl (msg->nt));
415 } 449 }
416 GNUNET_SERVICE_client_continue (tc_h->client); 450 GNUNET_SERVICE_client_continue (client->client);
417} 451}
418 452
419 453
@@ -452,7 +486,9 @@ static void
452handle_incoming_msg (void *cls, 486handle_incoming_msg (void *cls,
453 const struct GNUNET_TRANSPORT_IncomingMessage *inc_msg) 487 const struct GNUNET_TRANSPORT_IncomingMessage *inc_msg)
454{ 488{
455 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 489 struct MyClient *client = cls;
490 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h =
491 client->tc;
456 struct GNUNET_MessageHeader *msg; 492 struct GNUNET_MessageHeader *msg;
457 msg = (struct GNUNET_MessageHeader *) &inc_msg[1]; 493 msg = (struct GNUNET_MessageHeader *) &inc_msg[1];
458 size_t payload_len = ntohs (msg->size) - sizeof (struct 494 size_t payload_len = ntohs (msg->size) - sizeof (struct
@@ -485,7 +521,7 @@ handle_incoming_msg (void *cls,
485 GNUNET_MQ_send (tc_h->c_mq, env); 521 GNUNET_MQ_send (tc_h->c_mq, env);
486 } 522 }
487 523
488 GNUNET_SERVICE_client_continue (tc_h->client); 524 GNUNET_SERVICE_client_continue (client->client);
489} 525}
490 526
491 527
@@ -499,13 +535,15 @@ static void
499handle_queue_create_ok (void *cls, 535handle_queue_create_ok (void *cls,
500 const struct GNUNET_TRANSPORT_CreateQueueResponse *msg) 536 const struct GNUNET_TRANSPORT_CreateQueueResponse *msg)
501{ 537{
502 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 538 struct MyClient *client = cls;
539 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h =
540 client->tc;
503 541
504 if (NULL != tc_h->queue_create_reply_cb) 542 if (NULL != tc_h->queue_create_reply_cb)
505 { 543 {
506 tc_h->queue_create_reply_cb (tc_h->cb_cls, tc_h, GNUNET_YES); 544 tc_h->queue_create_reply_cb (tc_h->cb_cls, tc_h, GNUNET_YES);
507 } 545 }
508 GNUNET_SERVICE_client_continue (tc_h->client); 546 GNUNET_SERVICE_client_continue (client->client);
509} 547}
510 548
511 549
@@ -523,13 +561,15 @@ handle_queue_create_fail (
523 void *cls, 561 void *cls,
524 const struct GNUNET_TRANSPORT_CreateQueueResponse *msg) 562 const struct GNUNET_TRANSPORT_CreateQueueResponse *msg)
525{ 563{
526 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 564 struct MyClient *client = cls;
565 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h =
566 client->tc;
527 567
528 if (NULL != tc_h->queue_create_reply_cb) 568 if (NULL != tc_h->queue_create_reply_cb)
529 { 569 {
530 tc_h->queue_create_reply_cb (tc_h->cb_cls, tc_h, GNUNET_NO); 570 tc_h->queue_create_reply_cb (tc_h->cb_cls, tc_h, GNUNET_NO);
531 } 571 }
532 GNUNET_SERVICE_client_continue (tc_h->client); 572 GNUNET_SERVICE_client_continue (client->client);
533} 573}
534 574
535 575
@@ -560,7 +600,9 @@ static void
560handle_add_queue_message (void *cls, 600handle_add_queue_message (void *cls,
561 const struct GNUNET_TRANSPORT_AddQueueMessage *msg) 601 const struct GNUNET_TRANSPORT_AddQueueMessage *msg)
562{ 602{
563 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 603 struct MyClient *client = cls;
604 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h =
605 client->tc;
564 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue; 606 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue;
565 607
566 tc_queue = tc_h->queue_head; 608 tc_queue = tc_h->queue_head;
@@ -589,7 +631,7 @@ handle_add_queue_message (void *cls,
589 { 631 {
590 tc_h->add_queue_cb (tc_h->cb_cls, tc_h, tc_queue); 632 tc_h->add_queue_cb (tc_h->cb_cls, tc_h, tc_queue);
591 } 633 }
592 GNUNET_SERVICE_client_continue (tc_h->client); 634 GNUNET_SERVICE_client_continue (client->client);
593} 635}
594 636
595 637
@@ -622,13 +664,20 @@ connect_cb (void *cls,
622 struct GNUNET_MQ_Handle *mq) 664 struct GNUNET_MQ_Handle *mq)
623{ 665{
624 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 666 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
625 667 struct MyClient *new_c;
626 LOG (GNUNET_ERROR_TYPE_DEBUG, "Client connected.\n"); 668
627 tc_h->client = client; 669 LOG (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected to %p.\n",
628 tc_h->c_mq = mq; 670 client, tc_h);
671 new_c = GNUNET_new (struct MyClient);
672 new_c->client = client;
673 new_c->c_mq = mq;
674 new_c->tc = tc_h;
675 GNUNET_CONTAINER_DLL_insert (tc_h->client_head,
676 tc_h->client_tail,
677 new_c);
629 678
630 if (NULL == tc_h->queue_head) 679 if (NULL == tc_h->queue_head)
631 return tc_h; 680 return new_c;
632 /* Iterate over queues. They are yet to be opened. Request opening. */ 681 /* Iterate over queues. They are yet to be opened. Request opening. */
633 for (struct 682 for (struct
634 GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue_iter = 683 GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue_iter =
@@ -644,7 +693,7 @@ connect_cb (void *cls,
644 tc_queue_iter->open_queue_env); 693 tc_queue_iter->open_queue_env);
645 tc_queue_iter->open_queue_env = NULL; 694 tc_queue_iter->open_queue_env = NULL;
646 } 695 }
647 return tc_h; 696 return new_c;
648} 697}
649 698
650 699
@@ -660,10 +709,20 @@ disconnect_cb (void *cls,
660 struct GNUNET_SERVICE_Client *client, 709 struct GNUNET_SERVICE_Client *client,
661 void *internal_cls) 710 void *internal_cls)
662{ 711{
712 struct MyClient *cl = cls;
663 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 713 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
664 714
715 for (cl = tc_h->client_head; NULL != cl; cl = cl->next)
716 {
717 if (cl->client != client)
718 continue;
719 GNUNET_CONTAINER_DLL_remove (tc_h->client_head,
720 tc_h->client_tail,
721 cl);
722 GNUNET_free (cl);
723 break;
724 }
665 LOG (GNUNET_ERROR_TYPE_DEBUG, "Client disconnected.\n"); 725 LOG (GNUNET_ERROR_TYPE_DEBUG, "Client disconnected.\n");
666 tc_h->client = NULL;
667} 726}
668 727
669 728
@@ -677,8 +736,8 @@ static void
677handle_send_message_ack (void *cls, 736handle_send_message_ack (void *cls,
678 const struct GNUNET_TRANSPORT_SendMessageToAck *sma) 737 const struct GNUNET_TRANSPORT_SendMessageToAck *sma)
679{ 738{
680 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 739 struct MyClient *client = cls;
681 GNUNET_SERVICE_client_continue (tc_h->client); 740 GNUNET_SERVICE_client_continue (client->client);
682 // NOP 741 // NOP
683} 742}
684 743
@@ -858,16 +917,6 @@ nat_start (
858} 917}
859 918
860 919
861static void
862do_shutdown (void *cls)
863{
864 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
865 shutdown_communicator (tc_h->c_proc);
866 shutdown_service (tc_h->sh);
867 shutdown_nat (tc_h->nat_proc);
868}
869
870
871/** 920/**
872 * @brief Start communicator part of transport service and communicator 921 * @brief Start communicator part of transport service and communicator
873 * 922 *
@@ -896,6 +945,9 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
896{ 945{
897 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h; 946 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h;
898 947
948 LOG (GNUNET_ERROR_TYPE_DEBUG,
949 "Starting new transport/communicator combo with config %s\n",
950 cfg_filename);
899 tc_h = 951 tc_h =
900 GNUNET_new (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle); 952 GNUNET_new (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle);
901 tc_h->cfg_filename = GNUNET_strdup (cfg_filename); 953 tc_h->cfg_filename = GNUNET_strdup (cfg_filename);
@@ -928,11 +980,22 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
928 /* Schedule start communicator */ 980 /* Schedule start communicator */
929 communicator_start (tc_h, 981 communicator_start (tc_h,
930 binary_name); 982 binary_name);
931 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, tc_h);
932 return tc_h; 983 return tc_h;
933} 984}
934 985
935 986
987void
988GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (
989 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h)
990{
991 shutdown_communicator (tc_h->c_proc);
992 shutdown_service (tc_h->sh);
993 shutdown_nat (tc_h->nat_proc);
994 GNUNET_CONFIGURATION_destroy (tc_h->cfg);
995 GNUNET_free (tc_h);
996}
997
998
936/** 999/**
937 * @brief Instruct communicator to open a queue 1000 * @brief Instruct communicator to open a queue
938 * 1001 *
@@ -988,39 +1051,41 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue (
988 * @brief Instruct communicator to send data 1051 * @brief Instruct communicator to send data
989 * 1052 *
990 * @param tc_queue The queue to use for sending 1053 * @param tc_queue The queue to use for sending
1054 * @param cont function to call when done sending
1055 * @param cont_cls closure for @a cont
991 * @param payload Data to send 1056 * @param payload Data to send
992 * @param payload_size Size of the payload 1057 * @param payload_size Size of the @a payload
993 *
994 * @return Handle to the transmission
995 */ 1058 */
996struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission * 1059void
997GNUNET_TRANSPORT_TESTING_transport_communicator_send 1060GNUNET_TRANSPORT_TESTING_transport_communicator_send
998 (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue, 1061 (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue,
1062 GNUNET_SCHEDULER_TaskCallback cont,
1063 void *cont_cls,
999 const void *payload, 1064 const void *payload,
1000 size_t payload_size) 1065 size_t payload_size)
1001{ 1066{
1002 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission *tc_t;
1003 struct GNUNET_MessageHeader *mh; 1067 struct GNUNET_MessageHeader *mh;
1004 struct GNUNET_TRANSPORT_SendMessageTo *msg; 1068 struct GNUNET_TRANSPORT_SendMessageTo *msg;
1005 struct GNUNET_MQ_Envelope *env; 1069 struct GNUNET_MQ_Envelope *env;
1006 size_t inbox_size; 1070 size_t inbox_size;
1007 1071
1008 inbox_size = sizeof(struct GNUNET_MessageHeader) + payload_size; 1072 inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size;
1009 mh = GNUNET_malloc (inbox_size);
1010 mh->size = htons (inbox_size);
1011 mh->type = GNUNET_MESSAGE_TYPE_DUMMY;
1012 memcpy (&mh[1],
1013 payload,
1014 payload_size);
1015 env = GNUNET_MQ_msg_extra (msg, 1073 env = GNUNET_MQ_msg_extra (msg,
1016 inbox_size, 1074 inbox_size,
1017 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG); 1075 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG);
1018 msg->qid = htonl (tc_queue->qid); 1076 msg->qid = htonl (tc_queue->qid);
1019 msg->mid = tc_queue->mid++; 1077 msg->mid = tc_queue->mid++;
1020 msg->receiver = tc_queue->peer_id; 1078 msg->receiver = tc_queue->peer_id;
1021 memcpy (&msg[1], mh, inbox_size); 1079 mh = (struct GNUNET_MessageHeader *) &msg[1];
1022 GNUNET_free (mh); 1080 mh->size = htons (inbox_size);
1023 GNUNET_MQ_send (tc_queue->tc_h->c_mq, env); 1081 mh->type = GNUNET_MESSAGE_TYPE_DUMMY;
1024 // GNUNET_assert (0); // FIXME: not iplemented! 1082 memcpy (&mh[1],
1025 return tc_t; 1083 payload,
1084 payload_size);
1085 if (NULL != cont)
1086 GNUNET_MQ_notify_sent (env,
1087 cont,
1088 cont_cls);
1089 GNUNET_MQ_send (tc_queue->tc_h->c_mq,
1090 env);
1026} 1091}
diff --git a/src/transport/transport-testing2.h b/src/transport/transport-testing2.h
index e7602e3e2..96a08a193 100644
--- a/src/transport/transport-testing2.h
+++ b/src/transport/transport-testing2.h
@@ -181,6 +181,11 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
181 void *cb_cls); 181 void *cb_cls);
182 182
183 183
184void
185GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (
186 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h);
187
188
184/** 189/**
185 * @brief Instruct communicator to open a queue 190 * @brief Instruct communicator to open a queue
186 * 191 *
@@ -202,14 +207,17 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue (struct
202 * @brief Instruct communicator to send data 207 * @brief Instruct communicator to send data
203 * 208 *
204 * @param tc_queue The queue to use for sending 209 * @param tc_queue The queue to use for sending
210 * @param cont function to call when done sending
211 * @param cont_cls closure for @a cont
205 * @param payload Data to send 212 * @param payload Data to send
206 * @param payload_size Size of the payload 213 * @param payload_size Size of the @a payload
207 *
208 * @return Handle to the transmission
209 */ 214 */
210struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission * 215void
211GNUNET_TRANSPORT_TESTING_transport_communicator_send (struct 216GNUNET_TRANSPORT_TESTING_transport_communicator_send (struct
212 GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue 217 GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue
213 *tc_queue, 218 *tc_queue,
219 GNUNET_SCHEDULER_TaskCallback
220 cont,
221 void *cont_cls,
214 const void *payload, 222 const void *payload,
215 size_t payload_size); 223 size_t payload_size);
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index ffe95a24f..f3373fc38 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -46,6 +46,7 @@ libgnunetutil_la_SOURCES = \
46 common_logging.c \ 46 common_logging.c \
47 configuration.c \ 47 configuration.c \
48 configuration_loader.c \ 48 configuration_loader.c \
49 consttime_memcmp.c \
49 container_bloomfilter.c \ 50 container_bloomfilter.c \
50 container_heap.c \ 51 container_heap.c \
51 container_meta_data.c \ 52 container_meta_data.c \
@@ -95,8 +96,6 @@ libgnunetutil_la_SOURCES = \
95 strings.c \ 96 strings.c \
96 time.c \ 97 time.c \
97 tun.c \ 98 tun.c \
98 tweetnacl-gnunet.c \
99 tweetnacl-gnunet.h \
100 speedup.c speedup.h \ 99 speedup.c speedup.h \
101 proc_compat.c 100 proc_compat.c
102 101
@@ -132,6 +131,8 @@ libgnunetutil_la_LIBADD = \
132 $(LIBIDN) $(LIBIDN2) \ 131 $(LIBIDN) $(LIBIDN2) \
133 $(Z_LIBS) \ 132 $(Z_LIBS) \
134 -lunistring \ 133 -lunistring \
134 -largon2 \
135 -lsodium \
135 $(XLIB) \ 136 $(XLIB) \
136 $(PTHREAD) 137 $(PTHREAD)
137 138
diff --git a/src/util/buffer.c b/src/util/buffer.c
index d89565d68..dabf630c7 100644
--- a/src/util/buffer.c
+++ b/src/util/buffer.c
@@ -51,10 +51,13 @@ GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, size_t capacity)
51 * @param n number of bytes that should be available to write 51 * @param n number of bytes that should be available to write
52 */ 52 */
53void 53void
54GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, size_t n) 54GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf,
55 size_t n)
55{ 56{
56 size_t new_capacity = buf->position + n; 57 size_t new_capacity = buf->position + n;
57 58
59 /* guard against overflow */
60 GNUNET_assert (new_capacity >= buf->position);
58 if (new_capacity <= buf->capacity) 61 if (new_capacity <= buf->capacity)
59 return; 62 return;
60 /* warn if calculation of expected size was wrong */ 63 /* warn if calculation of expected size was wrong */
@@ -77,10 +80,11 @@ GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, size_t n)
77 * @param buf buffer to write to 80 * @param buf buffer to write to
78 * @param data data to read from 81 * @param data data to read from
79 * @param len number of bytes to copy from @a data to @a buf 82 * @param len number of bytes to copy from @a data to @a buf
80 *
81 */ 83 */
82void 84void
83GNUNET_buffer_write (struct GNUNET_Buffer *buf, const char *data, size_t len) 85GNUNET_buffer_write (struct GNUNET_Buffer *buf,
86 const char *data,
87 size_t len)
84{ 88{
85 GNUNET_buffer_ensure_remaining (buf, len); 89 GNUNET_buffer_ensure_remaining (buf, len);
86 memcpy (buf->mem + buf->position, data, len); 90 memcpy (buf->mem + buf->position, data, len);
@@ -95,7 +99,8 @@ GNUNET_buffer_write (struct GNUNET_Buffer *buf, const char *data, size_t len)
95 * @param str the string to write to @a buf 99 * @param str the string to write to @a buf
96 */ 100 */
97void 101void
98GNUNET_buffer_write_str (struct GNUNET_Buffer *buf, const char *str) 102GNUNET_buffer_write_str (struct GNUNET_Buffer *buf,
103 const char *str)
99{ 104{
100 size_t len = strlen (str); 105 size_t len = strlen (str);
101 106
@@ -203,8 +208,8 @@ GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, const char *fmt, ...)
203 */ 208 */
204void 209void
205GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf, 210GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf,
206 const char *fmt, 211 const char *fmt,
207 va_list args) 212 va_list args)
208{ 213{
209 int res; 214 int res;
210 va_list args2; 215 va_list args2;
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index 35c557000..fd91e23b2 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -533,4 +533,25 @@ GNUNET_copy_message (const struct GNUNET_MessageHeader *msg)
533} 533}
534 534
535 535
536/**
537 * Check that memory in @a a is all zeros. @a a must be a pointer.
538 *
539 * @param a pointer to @a n bytes which should be tested for the
540 * entire memory being zero'ed out.
541 * @param n number of bytes in @a to be tested
542 * @return 0 if a is zero, non-zero otherwise
543 */
544int
545GNUNET_is_zero_ (const void *a,
546 size_t n)
547{
548 const char *b = a;
549
550 for (size_t i = 0; i < n; i++)
551 if (b[i])
552 return 1;
553 return 0;
554}
555
556
536/* end of common_allocation.c */ 557/* end of common_allocation.c */
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 27ac88a05..3894cdda1 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -100,7 +100,7 @@ struct CustomLogger
100 * Asynchronous scope of the current thread, or NULL if we have not 100 * Asynchronous scope of the current thread, or NULL if we have not
101 * entered an async scope yet. 101 * entered an async scope yet.
102 */ 102 */
103static __thread struct GNUNET_AsyncScopeSave current_async_scope; 103static GNUNET_THREAD_LOCAL struct GNUNET_AsyncScopeSave current_async_scope;
104 104
105/** 105/**
106 * The last "bulk" error message that we have been logging. 106 * The last "bulk" error message that we have been logging.
@@ -287,7 +287,7 @@ GNUNET_abort_ ()
287 * Utility function - reallocates logdefs array to be twice as large. 287 * Utility function - reallocates logdefs array to be twice as large.
288 */ 288 */
289static void 289static void
290resize_logdefs () 290resize_logdefs (void)
291{ 291{
292 logdefs_size = (logdefs_size + 1) * 2; 292 logdefs_size = (logdefs_size + 1) * 2;
293 logdefs = GNUNET_realloc (logdefs, logdefs_size * sizeof(struct LogDef)); 293 logdefs = GNUNET_realloc (logdefs, logdefs_size * sizeof(struct LogDef));
@@ -705,7 +705,9 @@ parse_all_definitions ()
705 * @return #GNUNET_OK on success 705 * @return #GNUNET_OK on success
706 */ 706 */
707int 707int
708GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile) 708GNUNET_log_setup (const char *comp,
709 const char *loglevel,
710 const char *logfile)
709{ 711{
710 const char *env_logfile; 712 const char *env_logfile;
711 713
@@ -1146,7 +1148,7 @@ GNUNET_h2s (const struct GNUNET_HashCode *hc)
1146const char * 1148const char *
1147GNUNET_h2s2 (const struct GNUNET_HashCode *hc) 1149GNUNET_h2s2 (const struct GNUNET_HashCode *hc)
1148{ 1150{
1149 static struct GNUNET_CRYPTO_HashAsciiEncoded ret; 1151 static GNUNET_THREAD_LOCAL struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1150 1152
1151 GNUNET_CRYPTO_hash_to_enc (hc, &ret); 1153 GNUNET_CRYPTO_hash_to_enc (hc, &ret);
1152 ret.encoding[8] = '\0'; 1154 ret.encoding[8] = '\0';
@@ -1166,7 +1168,7 @@ GNUNET_h2s2 (const struct GNUNET_HashCode *hc)
1166const char * 1168const char *
1167GNUNET_p2s (const struct GNUNET_CRYPTO_EddsaPublicKey *p) 1169GNUNET_p2s (const struct GNUNET_CRYPTO_EddsaPublicKey *p)
1168{ 1170{
1169 static struct GNUNET_CRYPTO_HashAsciiEncoded ret; 1171 static GNUNET_THREAD_LOCAL struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1170 struct GNUNET_HashCode hc; 1172 struct GNUNET_HashCode hc;
1171 1173
1172 GNUNET_CRYPTO_hash (p, sizeof(*p), &hc); 1174 GNUNET_CRYPTO_hash (p, sizeof(*p), &hc);
@@ -1188,7 +1190,7 @@ GNUNET_p2s (const struct GNUNET_CRYPTO_EddsaPublicKey *p)
1188const char * 1190const char *
1189GNUNET_p2s2 (const struct GNUNET_CRYPTO_EddsaPublicKey *p) 1191GNUNET_p2s2 (const struct GNUNET_CRYPTO_EddsaPublicKey *p)
1190{ 1192{
1191 static struct GNUNET_CRYPTO_HashAsciiEncoded ret; 1193 static GNUNET_THREAD_LOCAL struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1192 struct GNUNET_HashCode hc; 1194 struct GNUNET_HashCode hc;
1193 1195
1194 GNUNET_CRYPTO_hash (p, sizeof(*p), &hc); 1196 GNUNET_CRYPTO_hash (p, sizeof(*p), &hc);
@@ -1210,7 +1212,7 @@ GNUNET_p2s2 (const struct GNUNET_CRYPTO_EddsaPublicKey *p)
1210const char * 1212const char *
1211GNUNET_e2s (const struct GNUNET_CRYPTO_EcdhePublicKey *p) 1213GNUNET_e2s (const struct GNUNET_CRYPTO_EcdhePublicKey *p)
1212{ 1214{
1213 static struct GNUNET_CRYPTO_HashAsciiEncoded ret; 1215 static GNUNET_THREAD_LOCAL struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1214 struct GNUNET_HashCode hc; 1216 struct GNUNET_HashCode hc;
1215 1217
1216 GNUNET_CRYPTO_hash (p, sizeof(*p), &hc); 1218 GNUNET_CRYPTO_hash (p, sizeof(*p), &hc);
@@ -1232,7 +1234,7 @@ GNUNET_e2s (const struct GNUNET_CRYPTO_EcdhePublicKey *p)
1232const char * 1234const char *
1233GNUNET_e2s2 (const struct GNUNET_CRYPTO_EcdhePublicKey *p) 1235GNUNET_e2s2 (const struct GNUNET_CRYPTO_EcdhePublicKey *p)
1234{ 1236{
1235 static struct GNUNET_CRYPTO_HashAsciiEncoded ret; 1237 static GNUNET_THREAD_LOCAL struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1236 struct GNUNET_HashCode hc; 1238 struct GNUNET_HashCode hc;
1237 1239
1238 GNUNET_CRYPTO_hash (p, sizeof(*p), &hc); 1240 GNUNET_CRYPTO_hash (p, sizeof(*p), &hc);
@@ -1254,7 +1256,7 @@ GNUNET_e2s2 (const struct GNUNET_CRYPTO_EcdhePublicKey *p)
1254const char * 1256const char *
1255GNUNET_sh2s (const struct GNUNET_ShortHashCode *shc) 1257GNUNET_sh2s (const struct GNUNET_ShortHashCode *shc)
1256{ 1258{
1257 static char buf[64]; 1259 static GNUNET_THREAD_LOCAL char buf[64];
1258 1260
1259 GNUNET_STRINGS_data_to_string (shc, sizeof(*shc), buf, sizeof(buf)); 1261 GNUNET_STRINGS_data_to_string (shc, sizeof(*shc), buf, sizeof(buf));
1260 buf[6] = '\0'; 1262 buf[6] = '\0';
@@ -1274,7 +1276,7 @@ GNUNET_sh2s (const struct GNUNET_ShortHashCode *shc)
1274const char * 1276const char *
1275GNUNET_uuid2s (const struct GNUNET_Uuid *uuid) 1277GNUNET_uuid2s (const struct GNUNET_Uuid *uuid)
1276{ 1278{
1277 static char buf[32]; 1279 static GNUNET_THREAD_LOCAL char buf[32];
1278 1280
1279 GNUNET_STRINGS_data_to_string (uuid, sizeof(*uuid), buf, sizeof(buf)); 1281 GNUNET_STRINGS_data_to_string (uuid, sizeof(*uuid), buf, sizeof(buf));
1280 buf[6] = '\0'; 1282 buf[6] = '\0';
@@ -1293,7 +1295,7 @@ GNUNET_uuid2s (const struct GNUNET_Uuid *uuid)
1293const char * 1295const char *
1294GNUNET_h2s_full (const struct GNUNET_HashCode *hc) 1296GNUNET_h2s_full (const struct GNUNET_HashCode *hc)
1295{ 1297{
1296 static struct GNUNET_CRYPTO_HashAsciiEncoded ret; 1298 static GNUNET_THREAD_LOCAL struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1297 1299
1298 GNUNET_CRYPTO_hash_to_enc (hc, &ret); 1300 GNUNET_CRYPTO_hash_to_enc (hc, &ret);
1299 ret.encoding[sizeof(ret) - 1] = '\0'; 1301 ret.encoding[sizeof(ret) - 1] = '\0';
@@ -1384,9 +1386,9 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen)
1384#define LEN \ 1386#define LEN \
1385 GNUNET_MAX ((INET6_ADDRSTRLEN + 8), \ 1387 GNUNET_MAX ((INET6_ADDRSTRLEN + 8), \
1386 (1 + sizeof(struct sockaddr_un) - sizeof(sa_family_t))) 1388 (1 + sizeof(struct sockaddr_un) - sizeof(sa_family_t)))
1387 static char buf[LEN]; 1389 static GNUNET_THREAD_LOCAL char buf[LEN];
1388#undef LEN 1390#undef LEN
1389 static char b2[6]; 1391 static GNUNET_THREAD_LOCAL char b2[6];
1390 const struct sockaddr_in *v4; 1392 const struct sockaddr_in *v4;
1391 const struct sockaddr_un *un; 1393 const struct sockaddr_un *un;
1392 const struct sockaddr_in6 *v6; 1394 const struct sockaddr_in6 *v6;
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 0480ebd5d..7ed87cc1e 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -1241,7 +1241,7 @@ GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
1241 * @param cfg configuration to use for path expansion 1241 * @param cfg configuration to use for path expansion
1242 * @param orig string to $-expand (will be freed!) 1242 * @param orig string to $-expand (will be freed!)
1243 * @param depth recursion depth, used to detect recursive expansions 1243 * @param depth recursion depth, used to detect recursive expansions
1244 * @return $-expanded string 1244 * @return $-expanded string, never NULL unless @a orig was NULL
1245 */ 1245 */
1246static char * 1246static char *
1247expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, 1247expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -1421,6 +1421,7 @@ GNUNET_CONFIGURATION_expand_dollar (
1421 continue; 1421 continue;
1422 dup = GNUNET_strdup (orig + i); 1422 dup = GNUNET_strdup (orig + i);
1423 dup = expand_dollar (cfg, dup, 0); 1423 dup = expand_dollar (cfg, dup, 0);
1424 GNUNET_assert (NULL != dup); /* make compiler happy */
1424 len = strlen (dup) + 1; 1425 len = strlen (dup) + 1;
1425 orig = GNUNET_realloc (orig, i + len); 1426 orig = GNUNET_realloc (orig, i + len);
1426 GNUNET_memcpy (orig + i, dup, len); 1427 GNUNET_memcpy (orig + i, dup, len);
diff --git a/src/util/consttime_memcmp.c b/src/util/consttime_memcmp.c
new file mode 100644
index 000000000..820ba9835
--- /dev/null
+++ b/src/util/consttime_memcmp.c
@@ -0,0 +1,279 @@
1/*
2The MIT License (MIT)
3
4Copyright (c) 2015 Christophe Meessen
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in all
14copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22SOFTWARE.
23*/
24
25/* Minimally modified for libgnunetutil: added license header
26 (from https://github.com/chmike/cst_time_memcmp, LICENSE file), and
27 renamed the exported symbol: */
28#define consttime_memcmp GNUNET_memcmp_ct_
29/* Rest of the file is 'original' */
30
31
32#include <stddef.h>
33#include <inttypes.h>
34
35/*
36 * "constant time" memcmp. Time taken depends on the buffer length, of
37 * course, but not on the content of the buffers.
38 *
39 * Just like the ordinary memcmp function, the return value is
40 * tri-state: <0, 0, or >0. However, applications that need a
41 * constant-time memory comparison function usually need only a
42 * two-state result, signalling only whether the inputs were identical
43 * or different, but not signalling which of the inputs was larger.
44 * This code could be made significantly faster and simpler if the
45 * requirement for a tri-state result were removed.
46 *
47 * In order to protect against adversaries who can observe timing,
48 * cache hits or misses, page faults, etc., and who can use such
49 * observations to learn something about the relationship between the
50 * contents of the two buffers, we have to perform exactly the same
51 * instructions and memory accesses regardless of the contents of the
52 * buffers. We can't stop as soon as we find a difference, we can't
53 * take different conditional branches depending on the data, and we
54 * can't use different pointers or array indexes depending on the data.
55 *
56 * Further reading:
57 *
58 * .Rs
59 * .%A Paul C. Kocher
60 * .%T Timing Attacks on Implementations of Diffie-Hellman, RSA, DSS, and Other Systems
61 * .%D 1996
62 * .%J CRYPTO 1996
63 * .%P 104-113
64 * .%U http://www.cryptography.com/timingattack/paper.html
65 * .%U http://www.webcitation.org/query?url=http%3A%2F%2Fwww.cryptography.com%2Ftimingattack%2Fpaper.html&date=2012-10-17
66 * .Re
67 *
68 * .Rs
69 * .%A D. Boneh
70 * .%A D. Brumley
71 * .%T Remote timing attacks are practical
72 * .%D August 2003
73 * .%J Proceedings of the 12th Usenix Security Symposium, 2003
74 * .%U https://crypto.stanford.edu/~dabo/abstracts/ssl-timing.html
75 * .%U http://www.webcitation.org/query?url=https%3A%2F%2Fcrypto.stanford.edu%2F%7Edabo%2Fabstracts%2Fssl-timing.html&date=2012-10-17
76 * .%U http://www.webcitation.org/query?url=http%3A%2F%2Fcrypto.stanford.edu%2F%7Edabo%2Fpubs%2Fpapers%2Fssl-timing.pdf&date=2012-10-17
77 * .Es
78 *
79 * .Rs
80 * .%A Coda Hale
81 * .%T A Lesson In Timing Attacks (or, Don't use MessageDigest.isEquals)
82 * .%D 13 Aug 2009
83 * .%U http://codahale.com/a-lesson-in-timing-attacks/
84 * .%U http://www.webcitation.org/query?url=http%3A%2F%2Fcodahale.com%2Fa-lesson-in-timing-attacks%2F&date=2012-10-17
85 * .Re
86 *
87 */
88
89/*
90 * A note on portability:
91 *
92 * We assume that char is exactly 8 bits, the same as uint8_t, and that
93 * integer types with exactly 16 bits and exactly 32 bits exist. (If
94 * there is ever a need to change this, then the actual requirement is
95 * that we need a type that is at least two bits wider than char, and
96 * another type that is at least two bits wider than that, or we need to
97 * fake it somehow.)
98 *
99 * We do not assume any particular size for the plain "int" type, except
100 * that it is at least 16 bits, as is guaranteed by the C language
101 * standard.
102 *
103 * We do not assume that signed integer overflow is harmless. We
104 * ensure that signed integer overflow does not occur, so that
105 * implementation-defined overflow behaviour is not invoked.
106 *
107 * We rely on the C standard's guarantees regarding the wraparound
108 * behaviour of unsigned integer arithmetic, and on the analagous
109 * guarantees regarding conversions from signed types to narrower
110 * unsigned types.
111 *
112 * We do not assume that the platform uses two's complement arithmetic.
113 */
114
115/*
116 * How hard do we have to try to prevent unwanted compiler optimisations?
117 *
118 * Try compiling with "#define USE_VOLATILE_TEMPORARY 0", and examine
119 * the compiler output. If the only conditional tests in the entire
120 * function are to test whether len is zero, then all is well, but try
121 * again with different optimisation flags to be sure. If the compiler
122 * emitted code with conditional tests that do anything other than
123 * testing whether len is zero, then that's a problem, so try again with
124 * "#define USE_VOLATILE_TEMPORARY 1". If it's still bad, then you are
125 * out of luck.
126 */
127#define USE_VOLATILE_TEMPORARY 0
128
129int
130consttime_memcmp (const void *b1, const void *b2, size_t len)
131{
132 const uint8_t *c1, *c2;
133 uint16_t d, r, m;
134
135#if USE_VOLATILE_TEMPORARY
136 volatile uint16_t v;
137#else
138 uint16_t v;
139#endif
140
141 c1 = b1;
142 c2 = b2;
143
144 r = 0;
145 while (len)
146 {
147 /*
148 * Take the low 8 bits of r (in the range 0x00 to 0xff,
149 * or 0 to 255);
150 * As explained elsewhere, the low 8 bits of r will be zero
151 * if and only if all bytes compared so far were identical;
152 * Zero-extend to a 16-bit type (in the range 0x0000 to
153 * 0x00ff);
154 * Add 255, yielding a result in the range 255 to 510;
155 * Save that in a volatile variable to prevent
156 * the compiler from trying any shortcuts (the
157 * use of a volatile variable depends on "#ifdef
158 * USE_VOLATILE_TEMPORARY", and most compilers won't
159 * need it);
160 * Divide by 256 yielding a result of 1 if the original
161 * value of r was non-zero, or 0 if r was zero;
162 * Subtract 1, yielding 0 if r was non-zero, or -1 if r
163 * was zero;
164 * Convert to uint16_t, yielding 0x0000 if r was
165 * non-zero, or 0xffff if r was zero;
166 * Save in m.
167 */v = ((uint16_t) (uint8_t) r) + 255;
168 m = v / 256 - 1;
169
170 /*
171 * Get the values from *c1 and *c2 as uint8_t (each will
172 * be in the range 0 to 255, or 0x00 to 0xff);
173 * Convert them to signed int values (still in the
174 * range 0 to 255);
175 * Subtract them using signed arithmetic, yielding a
176 * result in the range -255 to +255;
177 * Convert to uint16_t, yielding a result in the range
178 * 0xff01 to 0xffff (for what was previously -255 to
179 * -1), or 0, or in the range 0x0001 to 0x00ff (for what
180 * was previously +1 to +255).
181 */d = (uint16_t) ((int) *c1 - (int) *c2);
182
183 /*
184 * If the low 8 bits of r were previously 0, then m
185 * is now 0xffff, so (d & m) is the same as d, so we
186 * effectively copy d to r;
187 * Otherwise, if r was previously non-zero, then m is
188 * now 0, so (d & m) is zero, so leave r unchanged.
189 * Note that the low 8 bits of d will be zero if and
190 * only if d == 0, which happens when *c1 == *c2.
191 * The low 8 bits of r are thus zero if and only if the
192 * entirety of r is zero, which happens if and only if
193 * all bytes compared so far were equal. As soon as a
194 * non-zero value is stored in r, it remains unchanged
195 * for the remainder of the loop.
196 */r |= (d & m);
197
198 /*
199 * Increment pointers, decrement length, and loop.
200 */
201 ++c1;
202 ++c2;
203 --len;
204 }
205
206 /*
207 * At this point, r is an unsigned value, which will be 0 if the
208 * final result should be zero, or in the range 0x0001 to 0x00ff
209 * (1 to 255) if the final result should be positive, or in the
210 * range 0xff01 to 0xffff (65281 to 65535) if the final result
211 * should be negative.
212 *
213 * We want to convert the unsigned values in the range 0xff01
214 * to 0xffff to signed values in the range -255 to -1, while
215 * converting the other unsigned values to equivalent signed
216 * values (0, or +1 to +255).
217 *
218 * On a machine with two's complement arithmetic, simply copying
219 * the underlying bits (with sign extension if int is wider than
220 * 16 bits) would do the job, so something like this might work:
221 *
222 * return (int16_t)r;
223 *
224 * However, that invokes implementation-defined behaviour,
225 * because values larger than 32767 can't fit in a signed 16-bit
226 * integer without overflow.
227 *
228 * To avoid any implementation-defined behaviour, we go through
229 * these contortions:
230 *
231 * a. Calculate ((uint32_t)r + 0x8000). The cast to uint32_t
232 * it to prevent problems on platforms where int is narrower
233 * than 32 bits. If int is a larger than 32-bits, then the
234 * usual arithmetic conversions cause this addition to be
235 * done in unsigned int arithmetic. If int is 32 bits
236 * or narrower, then this addition is done in uint32_t
237 * arithmetic. In either case, no overflow or wraparound
238 * occurs, and the result from this step has a value that
239 * will be one of 0x00008000 (32768), or in the range
240 * 0x00008001 to 0x000080ff (32769 to 33023), or in the range
241 * 0x00017f01 to 0x00017fff (98049 to 98303).
242 *
243 * b. Cast the result from (a) to uint16_t. This effectively
244 * discards the high bits of the result, in a way that is
245 * well defined by the C language. The result from this step
246 * will be of type uint16_t, and its value will be one of
247 * 0x8000 (32768), or in the range 0x8001 to 0x80ff (32769 to
248 * 33023), or in the range 0x7f01 to 0x7fff (32513 to
249 * 32767).
250 *
251 * c. Cast the result from (b) to int32_t. We use int32_t
252 * instead of int because we need a type that's strictly
253 * larger than 16 bits, and the C standard allows
254 * implementations where int is only 16 bits. The result
255 * from this step will be of type int32_t, and its value wll
256 * be one of 0x00008000 (32768), or in the range 0x00008001
257 * to 0x000080ff (32769 to 33023), or in the range 0x00007f01
258 * to 0x00007fff (32513 to 32767).
259 *
260 * d. Take the result from (c) and subtract 0x8000 (32768) using
261 * signed int32_t arithmetic. The result from this step will
262 * be of type int32_t and the value will be one of
263 * 0x00000000 (0), or in the range 0x00000001 to 0x000000ff
264 * (+1 to +255), or in the range 0xffffff01 to 0xffffffff
265 * (-255 to -1).
266 *
267 * e. Cast the result from (d) to int. This does nothing
268 * interesting, except to make explicit what would have been
269 * implicit in the return statement. The final result is an
270 * int in the range -255 to +255.
271 *
272 * Unfortunately, compilers don't seem to be good at figuring
273 * out that most of this can be optimised away by careful choice
274 * of register width and sign extension.
275 *
276 */return (/*e*/ int) (/*d*/
277 (/*c*/ int32_t) (/*b*/ uint16_t) (/*a*/ (uint32_t) r + 0x8000)
278 - 0x8000);
279}
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c
index 237062eb7..96d546185 100644
--- a/src/util/crypto_ecc.c
+++ b/src/util/crypto_ecc.c
@@ -26,10 +26,10 @@
26 */ 26 */
27#include "platform.h" 27#include "platform.h"
28#include <gcrypt.h> 28#include <gcrypt.h>
29#include <sodium.h>
29#include "gnunet_crypto_lib.h" 30#include "gnunet_crypto_lib.h"
30#include "gnunet_strings_lib.h" 31#include "gnunet_strings_lib.h"
31#include "benchmark.h" 32#include "benchmark.h"
32#include "tweetnacl-gnunet.h"
33 33
34#define EXTRA_CHECKS 0 34#define EXTRA_CHECKS 0
35 35
@@ -139,13 +139,17 @@ decode_private_ecdsa_key (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv)
139{ 139{
140 gcry_sexp_t result; 140 gcry_sexp_t result;
141 int rc; 141 int rc;
142 uint8_t d[32];
143
144 for (size_t i=0; i<32; i++)
145 d[i] = priv->d[31 - i];
142 146
143 rc = gcry_sexp_build (&result, 147 rc = gcry_sexp_build (&result,
144 NULL, 148 NULL,
145 "(private-key(ecc(curve \"" CURVE "\")" 149 "(private-key(ecc(curve \"" CURVE "\")"
146 "(d %b)))", 150 "(d %b)))",
147 (int) sizeof(priv->d), 151 32,
148 priv->d); 152 d);
149 if (0 != rc) 153 if (0 != rc)
150 { 154 {
151 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); 155 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc);
@@ -174,7 +178,7 @@ GNUNET_CRYPTO_ecdsa_key_get_public (
174 struct GNUNET_CRYPTO_EcdsaPublicKey *pub) 178 struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
175{ 179{
176 BENCHMARK_START (ecdsa_key_get_public); 180 BENCHMARK_START (ecdsa_key_get_public);
177 GNUNET_TWEETNACL_scalarmult_gnunet_ecdsa (pub->q_y, priv->d); 181 crypto_scalarmult_ed25519_base_noclamp (pub->q_y, priv->d);
178 BENCHMARK_END (ecdsa_key_get_public); 182 BENCHMARK_END (ecdsa_key_get_public);
179} 183}
180 184
@@ -190,8 +194,13 @@ GNUNET_CRYPTO_eddsa_key_get_public (
190 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, 194 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
191 struct GNUNET_CRYPTO_EddsaPublicKey *pub) 195 struct GNUNET_CRYPTO_EddsaPublicKey *pub)
192{ 196{
197 unsigned char pk[crypto_sign_PUBLICKEYBYTES];
198 unsigned char sk[crypto_sign_SECRETKEYBYTES];
199
193 BENCHMARK_START (eddsa_key_get_public); 200 BENCHMARK_START (eddsa_key_get_public);
194 GNUNET_TWEETNACL_sign_pk_from_seed (pub->q_y, priv->d); 201 GNUNET_assert (0 == crypto_sign_seed_keypair (pk, sk, priv->d));
202 GNUNET_memcpy (pub->q_y, pk, crypto_sign_PUBLICKEYBYTES);
203 sodium_memzero (sk, crypto_sign_SECRETKEYBYTES);
195 BENCHMARK_END (eddsa_key_get_public); 204 BENCHMARK_END (eddsa_key_get_public);
196} 205}
197 206
@@ -208,7 +217,7 @@ GNUNET_CRYPTO_ecdhe_key_get_public (
208 struct GNUNET_CRYPTO_EcdhePublicKey *pub) 217 struct GNUNET_CRYPTO_EcdhePublicKey *pub)
209{ 218{
210 BENCHMARK_START (ecdhe_key_get_public); 219 BENCHMARK_START (ecdhe_key_get_public);
211 GNUNET_TWEETNACL_scalarmult_curve25519_base (pub->q_y, priv->d); 220 GNUNET_assert (0 == crypto_scalarmult_base (pub->q_y, priv->d));
212 BENCHMARK_END (ecdhe_key_get_public); 221 BENCHMARK_END (ecdhe_key_get_public);
213} 222}
214 223
@@ -491,118 +500,55 @@ GNUNET_CRYPTO_eddsa_key_clear (struct GNUNET_CRYPTO_EddsaPrivateKey *pk)
491 500
492 501
493/** 502/**
494 * Create a new private key. Caller must free return value. 503 * Create a new private key.
495 * 504 *
496 * @return fresh private key 505 * @param[out] pk fresh private key
497 */ 506 */
498struct GNUNET_CRYPTO_EcdhePrivateKey * 507void
499GNUNET_CRYPTO_ecdhe_key_create () 508GNUNET_CRYPTO_ecdhe_key_create (struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
500{
501 struct GNUNET_CRYPTO_EcdhePrivateKey *priv;
502
503 priv = GNUNET_new (struct GNUNET_CRYPTO_EcdhePrivateKey);
504 if (GNUNET_OK != GNUNET_CRYPTO_ecdhe_key_create2 (priv))
505 {
506 GNUNET_free (priv);
507 return NULL;
508 }
509 return priv;
510}
511
512
513/**
514 * @ingroup crypto
515 * Create a new private key. Clear with #GNUNET_CRYPTO_ecdhe_key_clear().
516 *
517 * @param[out] pk set to fresh private key;
518 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
519 */
520int
521GNUNET_CRYPTO_ecdhe_key_create2 (struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
522{ 509{
523 BENCHMARK_START (ecdhe_key_create); 510 BENCHMARK_START (ecdhe_key_create);
524 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, 511 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
525 pk, 512 pk,
526 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)); 513 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
527 BENCHMARK_END (ecdhe_key_create); 514 BENCHMARK_END (ecdhe_key_create);
528 return GNUNET_OK;
529} 515}
530 516
531 517
532/** 518/**
533 * Create a new private key. Caller must free return value. 519 * Create a new private key.
534 * 520 *
535 * @return fresh private key 521 * @param[out] pk private key to initialize
536 */ 522 */
537struct GNUNET_CRYPTO_EcdsaPrivateKey * 523void
538GNUNET_CRYPTO_ecdsa_key_create () 524GNUNET_CRYPTO_ecdsa_key_create (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk)
539{ 525{
540 struct GNUNET_CRYPTO_EcdsaPrivateKey *priv;
541 gcry_sexp_t priv_sexp;
542 gcry_sexp_t s_keyparam;
543 gcry_mpi_t d;
544 int rc;
545
546 BENCHMARK_START (ecdsa_key_create); 526 BENCHMARK_START (ecdsa_key_create);
547 527 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
548 if (0 != (rc = gcry_sexp_build (&s_keyparam, 528 pk,
549 NULL, 529 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
550 "(genkey(ecc(curve \"" CURVE "\")" 530 pk->d[0] &= 248;
551 "(flags)))"))) 531 pk->d[31] &= 127;
552 { 532 pk->d[31] |= 64;
553 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc);
554 return NULL;
555 }
556 if (0 != (rc = gcry_pk_genkey (&priv_sexp, s_keyparam)))
557 {
558 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_genkey", rc);
559 gcry_sexp_release (s_keyparam);
560 return NULL;
561 }
562 gcry_sexp_release (s_keyparam);
563#if EXTRA_CHECKS
564 if (0 != (rc = gcry_pk_testkey (priv_sexp)))
565 {
566 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_testkey", rc);
567 gcry_sexp_release (priv_sexp);
568 return NULL;
569 }
570#endif
571 if (0 != (rc = key_from_sexp (&d, priv_sexp, "private-key", "d")))
572 {
573 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "key_from_sexp", rc);
574 gcry_sexp_release (priv_sexp);
575 return NULL;
576 }
577 gcry_sexp_release (priv_sexp);
578 priv = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
579 GNUNET_CRYPTO_mpi_print_unsigned (priv->d, sizeof(priv->d), d);
580 gcry_mpi_release (d);
581 533
582 BENCHMARK_END (ecdsa_key_create); 534 BENCHMARK_END (ecdsa_key_create);
583
584 return priv;
585} 535}
586 536
587 537
588/** 538/**
589 * Create a new private key. Caller must free return value. 539 * Create a new private key.
590 * 540 *
591 * @return fresh private key 541 * @param[out] pk set to fresh private key
592 */ 542 */
593struct GNUNET_CRYPTO_EddsaPrivateKey * 543void
594GNUNET_CRYPTO_eddsa_key_create () 544GNUNET_CRYPTO_eddsa_key_create (struct GNUNET_CRYPTO_EddsaPrivateKey *pk)
595{ 545{
596 struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
597
598 BENCHMARK_START (eddsa_key_create); 546 BENCHMARK_START (eddsa_key_create);
599 priv = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey);
600 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, 547 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
601 priv, 548 pk,
602 sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey)); 549 sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey));
550 // FIXME: should we not do the clamping here? Or is this done elsewhere?
603 BENCHMARK_END (eddsa_key_create); 551 BENCHMARK_END (eddsa_key_create);
604
605 return priv;
606} 552}
607 553
608 554
@@ -676,7 +622,11 @@ data_to_ecdsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose)
676 622
677 623
678/** 624/**
679 * Sign a given block. 625 * Sign a given block. The @a purpose data is the
626 * beginning of the data of which the signature is to be
627 * created. The `size` field in @a purpose must correctly
628 * indicate the number of bytes of the data structure, including
629 * its header.
680 * 630 *
681 * @param priv private key to use for the signing 631 * @param priv private key to use for the signing
682 * @param purpose what to sign (size, purpose) 632 * @param purpose what to sign (size, purpose)
@@ -684,7 +634,7 @@ data_to_ecdsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose)
684 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 634 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
685 */ 635 */
686int 636int
687GNUNET_CRYPTO_ecdsa_sign ( 637GNUNET_CRYPTO_ecdsa_sign_ (
688 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, 638 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
689 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, 639 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
690 struct GNUNET_CRYPTO_EcdsaSignature *sig) 640 struct GNUNET_CRYPTO_EcdsaSignature *sig)
@@ -734,7 +684,11 @@ GNUNET_CRYPTO_ecdsa_sign (
734 684
735 685
736/** 686/**
737 * Sign a given block. 687 * Sign a given block. The @a purpose data is the
688 * beginning of the data of which the signature is to be
689 * created. The `size` field in @a purpose must correctly
690 * indicate the number of bytes of the data structure, including
691 * its header.
738 * 692 *
739 * @param priv private key to use for the signing 693 * @param priv private key to use for the signing
740 * @param purpose what to sign (size, purpose) 694 * @param purpose what to sign (size, purpose)
@@ -742,29 +696,36 @@ GNUNET_CRYPTO_ecdsa_sign (
742 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 696 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
743 */ 697 */
744int 698int
745GNUNET_CRYPTO_eddsa_sign ( 699GNUNET_CRYPTO_eddsa_sign_ (
746 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, 700 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
747 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, 701 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
748 struct GNUNET_CRYPTO_EddsaSignature *sig) 702 struct GNUNET_CRYPTO_EddsaSignature *sig)
749{ 703{
750 704
751 size_t mlen = ntohl (purpose->size); 705 size_t mlen = ntohl (purpose->size);
752 unsigned char sk[GNUNET_TWEETNACL_SIGN_SECRETKEYBYTES]; 706 unsigned char sk[crypto_sign_SECRETKEYBYTES];
707 unsigned char pk[crypto_sign_PUBLICKEYBYTES];
753 int res; 708 int res;
754 709
755 BENCHMARK_START (eddsa_sign); 710 BENCHMARK_START (eddsa_sign);
756 GNUNET_TWEETNACL_sign_sk_from_seed (sk, priv->d); 711 GNUNET_assert (0 == crypto_sign_seed_keypair (pk, sk, priv->d));
757 res = GNUNET_TWEETNACL_sign_detached ((uint8_t *) sig, 712 res = crypto_sign_detached ((uint8_t *) sig,
758 (uint8_t *) purpose, 713 NULL,
759 mlen, 714 (uint8_t *) purpose,
760 sk); 715 mlen,
716 sk);
761 BENCHMARK_END (eddsa_sign); 717 BENCHMARK_END (eddsa_sign);
762 return (res == 0) ? GNUNET_OK : GNUNET_SYSERR; 718 return (res == 0) ? GNUNET_OK : GNUNET_SYSERR;
763} 719}
764 720
765 721
766/** 722/**
767 * Verify signature. 723 * Verify signature. The @a validate data is the
724 * beginning of the data of which the signature is to be
725 * verified. The `size` field in @a validate must correctly
726 * indicate the number of bytes of the data structure, including
727 * its header. If @a purpose does not match the purpose given
728 * in @a validate (the latter
768 * 729 *
769 * @param purpose what is the purpose that the signature should have? 730 * @param purpose what is the purpose that the signature should have?
770 * @param validate block to validate (size, purpose, data) 731 * @param validate block to validate (size, purpose, data)
@@ -773,7 +734,7 @@ GNUNET_CRYPTO_eddsa_sign (
773 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid 734 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
774 */ 735 */
775int 736int
776GNUNET_CRYPTO_ecdsa_verify ( 737GNUNET_CRYPTO_ecdsa_verify_ (
777 uint32_t purpose, 738 uint32_t purpose,
778 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, 739 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
779 const struct GNUNET_CRYPTO_EcdsaSignature *sig, 740 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
@@ -832,7 +793,13 @@ GNUNET_CRYPTO_ecdsa_verify (
832 793
833 794
834/** 795/**
835 * Verify signature. 796 * Verify signature. The @a validate data is the
797 * beginning of the data of which the signature is to be
798 * verified. The `size` field in @a validate must correctly
799 * indicate the number of bytes of the data structure, including
800 * its header. If @a purpose does not match the purpose given
801 * in @a validate (the latter must be in big endian), signature
802 * verification fails.
836 * 803 *
837 * @param purpose what is the purpose that the signature should have? 804 * @param purpose what is the purpose that the signature should have?
838 * @param validate block to validate (size, purpose, data) 805 * @param validate block to validate (size, purpose, data)
@@ -841,15 +808,15 @@ GNUNET_CRYPTO_ecdsa_verify (
841 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid 808 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
842 */ 809 */
843int 810int
844GNUNET_CRYPTO_eddsa_verify ( 811GNUNET_CRYPTO_eddsa_verify_ (
845 uint32_t purpose, 812 uint32_t purpose,
846 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, 813 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
847 const struct GNUNET_CRYPTO_EddsaSignature *sig, 814 const struct GNUNET_CRYPTO_EddsaSignature *sig,
848 const struct GNUNET_CRYPTO_EddsaPublicKey *pub) 815 const struct GNUNET_CRYPTO_EddsaPublicKey *pub)
849{ 816{
850 unsigned char *m = (void *) validate; 817 const unsigned char *m = (const void *) validate;
851 size_t mlen = ntohl (validate->size); 818 size_t mlen = ntohl (validate->size);
852 unsigned char *s = (void *) sig; 819 const unsigned char *s = (const void *) sig;
853 820
854 int res; 821 int res;
855 822
@@ -857,7 +824,7 @@ GNUNET_CRYPTO_eddsa_verify (
857 return GNUNET_SYSERR; /* purpose mismatch */ 824 return GNUNET_SYSERR; /* purpose mismatch */
858 825
859 BENCHMARK_START (eddsa_verify); 826 BENCHMARK_START (eddsa_verify);
860 res = GNUNET_TWEETNACL_sign_detached_verify (s, m, mlen, pub->q_y); 827 res = crypto_sign_verify_detached (s, m, mlen, pub->q_y);
861 BENCHMARK_END (eddsa_verify); 828 BENCHMARK_END (eddsa_verify);
862 return (res == 0) ? GNUNET_OK : GNUNET_SYSERR; 829 return (res == 0) ? GNUNET_OK : GNUNET_SYSERR;
863} 830}
@@ -876,9 +843,10 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
876 const struct GNUNET_CRYPTO_EcdhePublicKey *pub, 843 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
877 struct GNUNET_HashCode *key_material) 844 struct GNUNET_HashCode *key_material)
878{ 845{
879 uint8_t p[GNUNET_TWEETNACL_SCALARMULT_BYTES]; 846 uint8_t p[crypto_scalarmult_BYTES];
880 GNUNET_TWEETNACL_scalarmult_curve25519 (p, priv->d, pub->q_y); 847 if (0 != crypto_scalarmult (p, priv->d, pub->q_y))
881 GNUNET_CRYPTO_hash (p, GNUNET_TWEETNACL_SCALARMULT_BYTES, key_material); 848 return GNUNET_SYSERR;
849 GNUNET_CRYPTO_hash (p, crypto_scalarmult_BYTES, key_material);
882 return GNUNET_OK; 850 return GNUNET_OK;
883} 851}
884 852
@@ -939,6 +907,7 @@ GNUNET_CRYPTO_ecdsa_private_key_derive (
939{ 907{
940 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 908 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
941 struct GNUNET_CRYPTO_EcdsaPrivateKey *ret; 909 struct GNUNET_CRYPTO_EcdsaPrivateKey *ret;
910 uint8_t dc[32];
942 gcry_mpi_t h; 911 gcry_mpi_t h;
943 gcry_mpi_t x; 912 gcry_mpi_t x;
944 gcry_mpi_t d; 913 gcry_mpi_t d;
@@ -951,7 +920,10 @@ GNUNET_CRYPTO_ecdsa_private_key_derive (
951 GNUNET_CRYPTO_ecdsa_key_get_public (priv, &pub); 920 GNUNET_CRYPTO_ecdsa_key_get_public (priv, &pub);
952 921
953 h = derive_h (&pub, label, context); 922 h = derive_h (&pub, label, context);
954 GNUNET_CRYPTO_mpi_scan_unsigned (&x, priv->d, sizeof(priv->d)); 923 /* Convert to big endian for libgcrypt */
924 for (size_t i=0; i < 32; i++)
925 dc[i] = priv->d[31 - i];
926 GNUNET_CRYPTO_mpi_scan_unsigned (&x, dc, sizeof(dc));
955 d = gcry_mpi_new (256); 927 d = gcry_mpi_new (256);
956 gcry_mpi_mulm (d, h, x, n); 928 gcry_mpi_mulm (d, h, x, n);
957 gcry_mpi_release (h); 929 gcry_mpi_release (h);
@@ -959,7 +931,11 @@ GNUNET_CRYPTO_ecdsa_private_key_derive (
959 gcry_mpi_release (n); 931 gcry_mpi_release (n);
960 gcry_ctx_release (ctx); 932 gcry_ctx_release (ctx);
961 ret = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); 933 ret = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
962 GNUNET_CRYPTO_mpi_print_unsigned (ret->d, sizeof(ret->d), d); 934 GNUNET_CRYPTO_mpi_print_unsigned (dc, sizeof(dc), d);
935 /* Convert to big endian for libgcrypt */
936 for (size_t i=0; i < 32; i++)
937 ret->d[i] = dc[31 - i];
938 sodium_memzero(dc, sizeof(dc));
963 gcry_mpi_release (d); 939 gcry_mpi_release (d);
964 return ret; 940 return ret;
965} 941}
@@ -1042,16 +1018,17 @@ GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1042 struct GNUNET_HashCode *key_material) 1018 struct GNUNET_HashCode *key_material)
1043{ 1019{
1044 struct GNUNET_HashCode hc; 1020 struct GNUNET_HashCode hc;
1045 uint8_t a[GNUNET_TWEETNACL_SCALARMULT_BYTES]; 1021 uint8_t a[crypto_scalarmult_SCALARBYTES];
1046 uint8_t p[GNUNET_TWEETNACL_SCALARMULT_BYTES]; 1022 uint8_t p[crypto_scalarmult_BYTES];
1047 1023
1048 GNUNET_CRYPTO_hash (priv, 1024 GNUNET_CRYPTO_hash (priv,
1049 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), 1025 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey),
1050 &hc); 1026 &hc);
1051 memcpy (a, &hc, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)); 1027 memcpy (a, &hc, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
1052 GNUNET_TWEETNACL_scalarmult_curve25519 (p, a, pub->q_y); 1028 if (0 != crypto_scalarmult (p, a, pub->q_y))
1029 return GNUNET_SYSERR;
1053 GNUNET_CRYPTO_hash (p, 1030 GNUNET_CRYPTO_hash (p,
1054 GNUNET_TWEETNACL_SCALARMULT_BYTES, 1031 crypto_scalarmult_BYTES,
1055 key_material); 1032 key_material);
1056 return GNUNET_OK; 1033 return GNUNET_OK;
1057} 1034}
@@ -1072,15 +1049,13 @@ GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1072 const struct GNUNET_CRYPTO_EcdhePublicKey *pub, 1049 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1073 struct GNUNET_HashCode *key_material) 1050 struct GNUNET_HashCode *key_material)
1074{ 1051{
1075 uint8_t p[GNUNET_TWEETNACL_SCALARMULT_BYTES]; 1052 uint8_t p[crypto_scalarmult_BYTES];
1076 uint8_t d_rev[GNUNET_TWEETNACL_SCALARMULT_BYTES];
1077 1053
1078 BENCHMARK_START (ecdsa_ecdh); 1054 BENCHMARK_START (ecdsa_ecdh);
1079 for (size_t i = 0; i < 32; i++) 1055 if (0 != crypto_scalarmult (p, priv->d, pub->q_y))
1080 d_rev[i] = priv->d[31 - i]; 1056 return GNUNET_SYSERR;
1081 GNUNET_TWEETNACL_scalarmult_curve25519 (p, d_rev, pub->q_y);
1082 GNUNET_CRYPTO_hash (p, 1057 GNUNET_CRYPTO_hash (p,
1083 GNUNET_TWEETNACL_SCALARMULT_BYTES, 1058 crypto_scalarmult_BYTES,
1084 key_material); 1059 key_material);
1085 BENCHMARK_END (ecdsa_ecdh); 1060 BENCHMARK_END (ecdsa_ecdh);
1086 return GNUNET_OK; 1061 return GNUNET_OK;
@@ -1102,12 +1077,14 @@ GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1102 const struct GNUNET_CRYPTO_EddsaPublicKey *pub, 1077 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
1103 struct GNUNET_HashCode *key_material) 1078 struct GNUNET_HashCode *key_material)
1104{ 1079{
1105 uint8_t p[GNUNET_TWEETNACL_SCALARMULT_BYTES]; 1080 uint8_t p[crypto_scalarmult_BYTES];
1106 uint8_t curve25510_pk[GNUNET_TWEETNACL_SIGN_PUBLICBYTES]; 1081 uint8_t curve25510_pk[crypto_scalarmult_BYTES];
1107 1082
1108 GNUNET_TWEETNACL_sign_ed25519_pk_to_curve25519 (curve25510_pk, pub->q_y); 1083 if (0 != crypto_sign_ed25519_pk_to_curve25519 (curve25510_pk, pub->q_y))
1109 GNUNET_TWEETNACL_scalarmult_curve25519 (p, priv->d, curve25510_pk); 1084 return GNUNET_SYSERR;
1110 GNUNET_CRYPTO_hash (p, GNUNET_TWEETNACL_SCALARMULT_BYTES, key_material); 1085 if (0 != crypto_scalarmult (p, priv->d, curve25510_pk))
1086 return GNUNET_SYSERR;
1087 GNUNET_CRYPTO_hash (p, crypto_scalarmult_BYTES, key_material);
1111 return GNUNET_OK; 1088 return GNUNET_OK;
1112} 1089}
1113 1090
@@ -1127,12 +1104,14 @@ GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1127 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, 1104 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
1128 struct GNUNET_HashCode *key_material) 1105 struct GNUNET_HashCode *key_material)
1129{ 1106{
1130 uint8_t p[GNUNET_TWEETNACL_SCALARMULT_BYTES]; 1107 uint8_t p[crypto_scalarmult_BYTES];
1131 uint8_t curve25510_pk[GNUNET_TWEETNACL_SIGN_PUBLICBYTES]; 1108 uint8_t curve25510_pk[crypto_scalarmult_BYTES];
1132 1109
1133 GNUNET_TWEETNACL_sign_ed25519_pk_to_curve25519 (curve25510_pk, pub->q_y); 1110 if (0 != crypto_sign_ed25519_pk_to_curve25519 (curve25510_pk, pub->q_y))
1134 GNUNET_TWEETNACL_scalarmult_curve25519 (p, priv->d, curve25510_pk); 1111 return GNUNET_SYSERR;
1135 GNUNET_CRYPTO_hash (p, GNUNET_TWEETNACL_SCALARMULT_BYTES, key_material); 1112 if (0 != crypto_scalarmult (p, priv->d, curve25510_pk))
1113 return GNUNET_SYSERR;
1114 GNUNET_CRYPTO_hash (p, crypto_scalarmult_BYTES, key_material);
1136 return GNUNET_OK; 1115 return GNUNET_OK;
1137} 1116}
1138 1117
diff --git a/src/util/crypto_ecc_setup.c b/src/util/crypto_ecc_setup.c
index b3d410b7a..6c71030b2 100644
--- a/src/util/crypto_ecc_setup.c
+++ b/src/util/crypto_ecc_setup.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012, 2013, 2015 GNUnet e.V. 3 Copyright (C) 2012, 2013, 2015, 2020 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 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 6 under the terms of the GNU Affero General Public License as published
@@ -53,375 +53,269 @@
53 53
54 54
55/** 55/**
56 * Wait for a short time (we're trying to lock a file or want 56 * Read file to @a buf. Fails if the file does not exist or
57 * to give another process a shot at finishing a disk write, etc.). 57 * does not have precisely @a buf_size bytes.
58 * Sleeps for 100ms (as that should be long enough for virtually all 58 *
59 * modern systems to context switch and allow another process to do 59 * @param filename file to read
60 * some 'real' work). 60 * @param[out] buf where to write the file contents
61 * @param buf_size number of bytes in @a buf
62 * @return #GNUNET_OK on success
61 */ 63 */
62static void 64static int
63short_wait () 65read_from_file (const char *filename,
66 void *buf,
67 size_t buf_size)
64{ 68{
65 struct GNUNET_TIME_Relative timeout; 69 int fd;
70 struct stat sb;
66 71
67 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 100); 72 fd = open (filename,
68 (void) GNUNET_NETWORK_socket_select (NULL, NULL, NULL, timeout); 73 O_RDONLY);
74 if (-1 == fd)
75 {
76 memset (buf,
77 0,
78 buf_size);
79 return GNUNET_SYSERR;
80 }
81 if (0 != fstat (fd,
82 &sb))
83 {
84 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
85 "stat",
86 filename);
87 GNUNET_assert (0 == close (fd));
88 memset (buf,
89 0,
90 buf_size);
91 return GNUNET_SYSERR;
92 }
93 if (sb.st_size != buf_size)
94 {
95 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
96 "File `%s' has wrong size (%llu), expected %llu bytes\n",
97 filename,
98 (unsigned long long) sb.st_size,
99 (unsigned long long) buf_size);
100 GNUNET_assert (0 == close (fd));
101 memset (buf,
102 0,
103 buf_size);
104 return GNUNET_SYSERR;
105 }
106 if (buf_size !=
107 read (fd,
108 buf,
109 buf_size))
110 {
111 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
112 "read",
113 filename);
114 GNUNET_assert (0 == close (fd));
115 memset (buf,
116 0,
117 buf_size);
118 return GNUNET_SYSERR;
119 }
120 GNUNET_assert (0 == close (fd));
121 return GNUNET_OK;
69} 122}
70 123
71 124
72/** 125/**
73 * Create a new private key by reading it from a file. If the 126 * Write contents of @a buf atomically to @a filename.
74 * files does not exist, create a new key and write it to the 127 * Fail if @a filename already exists or if not exactly
75 * file. Caller must free return value. Note that this function 128 * @a buf with @a buf_size bytes could be written to
76 * can not guarantee that another process might not be trying 129 * @a filename.
77 * the same operation on the same file at the same time.
78 * If the contents of the file
79 * are invalid the old file is deleted and a fresh key is
80 * created.
81 * 130 *
82 * @param filename name of file to use to store the key 131 * @param filename where to write
83 * @return new private key, NULL on error (for example, 132 * @param buf buffer to write
84 * permission denied) 133 * @param buf_size number of bytes in @a buf to write
134 * @return #GNUNET_OK on success,
135 * #GNUNET_NO if a file existed under @a filename
136 * #GNUNET_SYSERR on failure
85 */ 137 */
86struct GNUNET_CRYPTO_EddsaPrivateKey * 138static int
87GNUNET_CRYPTO_eddsa_key_create_from_file (const char *filename) 139atomic_write_to_file (const char *filename,
140 const void *buf,
141 size_t buf_size)
88{ 142{
89 struct GNUNET_CRYPTO_EddsaPrivateKey *priv; 143 char *tmpl;
90 struct GNUNET_DISK_FileHandle *fd; 144 int fd;
91 unsigned int cnt;
92 int ec;
93 uint64_t fs;
94 ssize_t sret;
95 145
96 if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename)) 146 if (GNUNET_OK !=
97 return NULL; 147 GNUNET_DISK_directory_create_for_file (filename))
98 while (GNUNET_YES != GNUNET_DISK_file_test (filename))
99 { 148 {
100 fd = 149 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
101 GNUNET_DISK_file_open (filename, 150 "mkstemp",
102 GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE 151 filename);
103 | GNUNET_DISK_OPEN_FAILIFEXISTS, 152 return GNUNET_SYSERR;
104 GNUNET_DISK_PERM_USER_READ
105 | GNUNET_DISK_PERM_USER_WRITE);
106 if (NULL == fd)
107 {
108 if (EEXIST == errno)
109 {
110 if (GNUNET_YES != GNUNET_DISK_file_test (filename))
111 {
112 /* must exist but not be accessible, fail for good! */
113 if (0 != access (filename, R_OK))
114 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "access", filename);
115 else
116 GNUNET_break (0); /* what is going on!? */
117 return NULL;
118 }
119 continue;
120 }
121 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "open", filename);
122 return NULL;
123 }
124 cnt = 0;
125 while (GNUNET_YES !=
126 GNUNET_DISK_file_lock (fd,
127 0,
128 sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey),
129 GNUNET_YES))
130 {
131 short_wait ();
132 if (0 == ++cnt % 10)
133 {
134 ec = errno;
135 LOG (GNUNET_ERROR_TYPE_ERROR,
136 _ ("Could not acquire lock on file `%s': %s...\n"),
137 filename,
138 strerror (ec));
139 }
140 }
141 LOG (GNUNET_ERROR_TYPE_INFO,
142 _ ("Creating a new private key. This may take a while.\n"));
143 priv = GNUNET_CRYPTO_eddsa_key_create ();
144 GNUNET_assert (NULL != priv);
145 GNUNET_assert (sizeof(*priv) ==
146 GNUNET_DISK_file_write (fd, priv, sizeof(*priv)));
147 GNUNET_DISK_file_sync (fd);
148 if (GNUNET_YES !=
149 GNUNET_DISK_file_unlock (fd,
150 0,
151 sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey)))
152 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename);
153 GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd));
154 return priv;
155 } 153 }
156 /* key file exists already, read it! */
157 fd = GNUNET_DISK_file_open (filename,
158 GNUNET_DISK_OPEN_READ,
159 GNUNET_DISK_PERM_NONE);
160 if (NULL == fd)
161 { 154 {
162 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "open", filename); 155 char *dname;
163 return NULL; 156
157 dname = GNUNET_strdup (filename);
158 GNUNET_asprintf (&tmpl,
159 "%s/XXXXXX",
160 dirname (dname));
161 GNUNET_free (dname);
164 } 162 }
165 cnt = 0; 163 fd = mkstemp (tmpl);
166 while (1) 164 if (-1 == fd)
167 { 165 {
168 if (GNUNET_YES != 166 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
169 GNUNET_DISK_file_lock (fd, 167 "mkstemp",
170 0, 168 tmpl);
171 sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey), 169 GNUNET_free (tmpl);
172 GNUNET_NO)) 170 return GNUNET_SYSERR;
173 {
174 if (0 == ++cnt % 60)
175 {
176 ec = errno;
177 LOG (GNUNET_ERROR_TYPE_ERROR,
178 _ ("Could not acquire lock on file `%s': %s...\n"),
179 filename,
180 strerror (ec));
181 LOG (
182 GNUNET_ERROR_TYPE_ERROR,
183 _ (
184 "This may be ok if someone is currently generating a private key.\n"));
185 }
186 short_wait ();
187 continue;
188 }
189 if (GNUNET_YES != GNUNET_DISK_file_test (filename))
190 {
191 /* eh, what!? File we opened is now gone!? */
192 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", filename);
193 if (GNUNET_YES !=
194 GNUNET_DISK_file_unlock (fd,
195 0,
196 sizeof(
197 struct GNUNET_CRYPTO_EddsaPrivateKey)))
198 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename);
199 GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd));
200
201 return NULL;
202 }
203 if (GNUNET_OK !=
204 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
205 fs = 0;
206 if (fs < sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey))
207 {
208 /* maybe we got the read lock before the key generating
209 * process had a chance to get the write lock; give it up! */
210 if (GNUNET_YES !=
211 GNUNET_DISK_file_unlock (fd,
212 0,
213 sizeof(
214 struct GNUNET_CRYPTO_EddsaPrivateKey)))
215 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename);
216 if (0 == ++cnt % 10)
217 {
218 LOG (GNUNET_ERROR_TYPE_ERROR,
219 _ (
220 "When trying to read key file `%s' I found %u bytes but I need at least %u.\n"),
221 filename,
222 (unsigned int) fs,
223 (unsigned int) sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey));
224 LOG (GNUNET_ERROR_TYPE_ERROR,
225 _ ("This may be ok if someone is currently generating a key.\n"));
226 }
227 short_wait (); /* wait a bit longer! */
228 continue;
229 }
230 break;
231 } 171 }
232 fs = sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey); 172 if (0 != fchmod (fd,
233 priv = GNUNET_malloc (fs); 173 S_IRUSR))
234 sret = GNUNET_DISK_file_read (fd, priv, fs);
235 GNUNET_assert ((sret >= 0) && (fs == (size_t) sret));
236 if (GNUNET_YES !=
237 GNUNET_DISK_file_unlock (fd,
238 0,
239 sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey)))
240 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename);
241 GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd));
242#if CRYPTO_BUG
243 if (GNUNET_OK != check_eddsa_key (priv))
244 { 174 {
245 GNUNET_break (0); 175 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
246 GNUNET_free (priv); 176 "chmod",
247 return NULL; 177 tmpl);
178 GNUNET_assert (0 == close (fd));
179 if (0 != unlink (tmpl))
180 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
181 "unlink",
182 tmpl);
183 GNUNET_free (tmpl);
184 return GNUNET_SYSERR;
248 } 185 }
249#endif 186 if (buf_size !=
250 return priv; 187 write (fd,
188 buf,
189 buf_size))
190 {
191 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
192 "write",
193 tmpl);
194 GNUNET_assert (0 == close (fd));
195 if (0 != unlink (tmpl))
196 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
197 "unlink",
198 tmpl);
199 GNUNET_free (tmpl);
200 return GNUNET_SYSERR;
201 }
202 GNUNET_assert (0 == close (fd));
203
204 if (0 != link (tmpl,
205 filename))
206 {
207 if (0 != unlink (tmpl))
208 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
209 "unlink",
210 tmpl);
211 GNUNET_free (tmpl);
212 return GNUNET_NO;
213 }
214 if (0 != unlink (tmpl))
215 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
216 "unlink",
217 tmpl);
218 GNUNET_free (tmpl);
219 return GNUNET_OK;
251} 220}
252 221
253 222
254/** 223/**
255 * Create a new private key by reading it from a file. If the 224 * @ingroup crypto
256 * files does not exist, create a new key and write it to the 225 * @brief Create a new private key by reading it from a file.
257 * file. Caller must free return value. Note that this function 226 *
258 * can not guarantee that another process might not be trying 227 * If the files does not exist and @a do_create is set, creates a new key and
259 * the same operation on the same file at the same time. 228 * write it to the file.
260 * If the contents of the file 229 *
261 * are invalid the old file is deleted and a fresh key is 230 * If the contents of the file are invalid, an error is returned.
262 * created.
263 * 231 *
264 * @param filename name of file to use to store the key 232 * @param filename name of file to use to store the key
265 * @return new private key, NULL on error (for example, 233 * @param do_create should a file be created?
266 * permission denied) 234 * @param[out] pkey set to the private key from @a filename on success
235 * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but
236 * we found an existing file, #GNUNET_SYSERR on failure
267 */ 237 */
268struct GNUNET_CRYPTO_EcdsaPrivateKey * 238int
269GNUNET_CRYPTO_ecdsa_key_create_from_file (const char *filename) 239GNUNET_CRYPTO_eddsa_key_from_file (const char *filename,
240 int do_create,
241 struct GNUNET_CRYPTO_EddsaPrivateKey *pkey)
270{ 242{
271 struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; 243 int ret;
272 struct GNUNET_DISK_FileHandle *fd; 244
273 unsigned int cnt; 245 if (GNUNET_OK ==
274 int ec; 246 read_from_file (filename,
275 uint64_t fs; 247 pkey,
276 ssize_t sret; 248 sizeof (*pkey)))
277
278 if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename))
279 return NULL;
280 while (GNUNET_YES != GNUNET_DISK_file_test (filename))
281 { 249 {
282 fd = 250 /* file existed, report that we didn't create it... */
283 GNUNET_DISK_file_open (filename, 251 return (do_create) ? GNUNET_NO : GNUNET_OK;
284 GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE
285 | GNUNET_DISK_OPEN_FAILIFEXISTS,
286 GNUNET_DISK_PERM_USER_READ
287 | GNUNET_DISK_PERM_USER_WRITE);
288 if (NULL == fd)
289 {
290 if (EEXIST == errno)
291 {
292 if (GNUNET_YES != GNUNET_DISK_file_test (filename))
293 {
294 /* must exist but not be accessible, fail for good! */
295 if (0 != access (filename, R_OK))
296 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "access", filename);
297 else
298 GNUNET_break (0); /* what is going on!? */
299 return NULL;
300 }
301 continue;
302 }
303 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "open", filename);
304 return NULL;
305 }
306 cnt = 0;
307 while (GNUNET_YES !=
308 GNUNET_DISK_file_lock (fd,
309 0,
310 sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey),
311 GNUNET_YES))
312 {
313 short_wait ();
314 if (0 == ++cnt % 10)
315 {
316 ec = errno;
317 LOG (GNUNET_ERROR_TYPE_ERROR,
318 _ ("Could not acquire lock on file `%s': %s...\n"),
319 filename,
320 strerror (ec));
321 }
322 }
323 LOG (GNUNET_ERROR_TYPE_INFO,
324 _ ("Creating a new private key. This may take a while.\n"));
325 priv = GNUNET_CRYPTO_ecdsa_key_create ();
326 GNUNET_assert (NULL != priv);
327 GNUNET_assert (sizeof(*priv) ==
328 GNUNET_DISK_file_write (fd, priv, sizeof(*priv)));
329 GNUNET_DISK_file_sync (fd);
330 if (GNUNET_YES !=
331 GNUNET_DISK_file_unlock (fd,
332 0,
333 sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey)))
334 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename);
335 GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd));
336 return priv;
337 } 252 }
338 /* key file exists already, read it! */ 253 GNUNET_CRYPTO_eddsa_key_create (pkey);
339 fd = GNUNET_DISK_file_open (filename, 254 ret = atomic_write_to_file (filename,
340 GNUNET_DISK_OPEN_READ, 255 pkey,
341 GNUNET_DISK_PERM_NONE); 256 sizeof (*pkey));
342 if (NULL == fd) 257 if ( (GNUNET_OK == ret) ||
258 (GNUNET_SYSERR == ret) )
259 return ret;
260 /* maybe another process succeeded in the meantime, try reading one more time */
261 if (GNUNET_OK ==
262 read_from_file (filename,
263 pkey,
264 sizeof (*pkey)))
343 { 265 {
344 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "open", filename); 266 /* file existed, report that *we* didn't create it... */
345 return NULL; 267 return (do_create) ? GNUNET_NO : GNUNET_OK;
346 } 268 }
347 cnt = 0; 269 /* give up */
348 while (1) 270 return GNUNET_SYSERR;
271}
272
273
274/**
275 * @ingroup crypto
276 * @brief Create a new private key by reading it from a file.
277 *
278 * If the files does not exist and @a do_create is set, creates a new key and
279 * write it to the file.
280 *
281 * If the contents of the file are invalid, an error is returned.
282 *
283 * @param filename name of file to use to store the key
284 * @param do_create should a file be created?
285 * @param[out] pkey set to the private key from @a filename on success
286 * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but
287 * we found an existing file, #GNUNET_SYSERR on failure
288 */
289int
290GNUNET_CRYPTO_ecdsa_key_from_file (const char *filename,
291 int do_create,
292 struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey)
293{
294 if (GNUNET_OK ==
295 read_from_file (filename,
296 pkey,
297 sizeof (*pkey)))
349 { 298 {
350 if (GNUNET_YES != 299 /* file existed, report that we didn't create it... */
351 GNUNET_DISK_file_lock (fd, 300 return (do_create) ? GNUNET_NO : GNUNET_OK;
352 0,
353 sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey),
354 GNUNET_NO))
355 {
356 if (0 == ++cnt % 60)
357 {
358 ec = errno;
359 LOG (GNUNET_ERROR_TYPE_ERROR,
360 _ ("Could not acquire lock on file `%s': %s...\n"),
361 filename,
362 strerror (ec));
363 LOG (
364 GNUNET_ERROR_TYPE_ERROR,
365 _ (
366 "This may be ok if someone is currently generating a private key.\n"));
367 }
368 short_wait ();
369 continue;
370 }
371 if (GNUNET_YES != GNUNET_DISK_file_test (filename))
372 {
373 /* eh, what!? File we opened is now gone!? */
374 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", filename);
375 if (GNUNET_YES !=
376 GNUNET_DISK_file_unlock (fd,
377 0,
378 sizeof(
379 struct GNUNET_CRYPTO_EcdsaPrivateKey)))
380 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename);
381 GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd));
382
383 return NULL;
384 }
385 if (GNUNET_OK !=
386 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
387 fs = 0;
388 if (fs < sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey))
389 {
390 /* maybe we got the read lock before the key generating
391 * process had a chance to get the write lock; give it up! */
392 if (GNUNET_YES !=
393 GNUNET_DISK_file_unlock (fd,
394 0,
395 sizeof(
396 struct GNUNET_CRYPTO_EcdsaPrivateKey)))
397 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename);
398 if (0 == ++cnt % 10)
399 {
400 LOG (GNUNET_ERROR_TYPE_ERROR,
401 _ (
402 "When trying to read key file `%s' I found %u bytes but I need at least %u.\n"),
403 filename,
404 (unsigned int) fs,
405 (unsigned int) sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey));
406 LOG (GNUNET_ERROR_TYPE_ERROR,
407 _ ("This may be ok if someone is currently generating a key.\n"));
408 }
409 short_wait (); /* wait a bit longer! */
410 continue;
411 }
412 break;
413 } 301 }
414 fs = sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey); 302 GNUNET_CRYPTO_ecdsa_key_create (pkey);
415 priv = GNUNET_malloc (fs); 303 if (GNUNET_OK ==
416 sret = GNUNET_DISK_file_read (fd, priv, fs); 304 atomic_write_to_file (filename,
417 GNUNET_assert ((sret >= 0) && (fs == (size_t) sret)); 305 pkey,
418 if (GNUNET_YES != 306 sizeof (*pkey)))
419 GNUNET_DISK_file_unlock (fd, 307 return GNUNET_OK;
420 0, 308 /* maybe another process succeeded in the meantime, try reading one more time */
421 sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey))) 309 if (GNUNET_OK ==
422 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); 310 read_from_file (filename,
423 GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); 311 pkey,
424 return priv; 312 sizeof (*pkey)))
313 {
314 /* file existed, report that *we* didn't create it... */
315 return (do_create) ? GNUNET_NO : GNUNET_OK;
316 }
317 /* give up */
318 return GNUNET_SYSERR;
425} 319}
426 320
427 321
@@ -441,9 +335,15 @@ GNUNET_CRYPTO_eddsa_key_create_from_configuration (
441 char *fn; 335 char *fn;
442 336
443 if (GNUNET_OK != 337 if (GNUNET_OK !=
444 GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER", "PRIVATE_KEY", &fn)) 338 GNUNET_CONFIGURATION_get_value_filename (cfg,
339 "PEER",
340 "PRIVATE_KEY",
341 &fn))
445 return NULL; 342 return NULL;
446 priv = GNUNET_CRYPTO_eddsa_key_create_from_file (fn); 343 priv = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey);
344 GNUNET_CRYPTO_eddsa_key_from_file (fn,
345 GNUNET_YES,
346 priv);
447 GNUNET_free (fn); 347 GNUNET_free (fn);
448 return priv; 348 return priv;
449} 349}
@@ -469,7 +369,8 @@ GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg,
469 _ ("Could not load peer's private key\n")); 369 _ ("Could not load peer's private key\n"));
470 return GNUNET_SYSERR; 370 return GNUNET_SYSERR;
471 } 371 }
472 GNUNET_CRYPTO_eddsa_key_get_public (priv, &dst->public_key); 372 GNUNET_CRYPTO_eddsa_key_get_public (priv,
373 &dst->public_key);
473 GNUNET_free (priv); 374 GNUNET_free (priv);
474 return GNUNET_OK; 375 return GNUNET_OK;
475} 376}
diff --git a/src/util/crypto_hkdf.c b/src/util/crypto_hkdf.c
index 99a50a449..86a814b12 100644
--- a/src/util/crypto_hkdf.c
+++ b/src/util/crypto_hkdf.c
@@ -175,10 +175,28 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
175 175
176 ctx_len = 0; 176 ctx_len = 0;
177 while (NULL != va_arg (args, void *)) 177 while (NULL != va_arg (args, void *))
178 ctx_len += va_arg (args, size_t); 178 {
179 size_t nxt = va_arg (args, size_t);
180 if (nxt + ctx_len < nxt)
181 {
182 /* integer overflow */
183 GNUNET_break (0);
184 va_end (args);
185 goto hkdf_error;
186 }
187 ctx_len += nxt;
188 }
179 189
180 va_end (args); 190 va_end (args);
181 191
192 if ( (k + ctx_len < ctx_len) ||
193 (k + ctx_len + 1 < ctx_len) )
194 {
195 /* integer overflow */
196 GNUNET_break (0);
197 goto hkdf_error;
198 }
199
182 memset (result, 0, out_len); 200 memset (result, 0, out_len);
183 if (getPRK (xtr, xts, xts_len, skm, skm_len, prk) != GNUNET_YES) 201 if (getPRK (xtr, xts, xts_len, skm, skm_len, prk) != GNUNET_YES)
184 goto hkdf_error; 202 goto hkdf_error;
@@ -192,10 +210,11 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
192 /* K(1) */ 210 /* K(1) */
193 { 211 {
194 size_t plain_len = k + ctx_len + 1; 212 size_t plain_len = k + ctx_len + 1;
195 char plain[plain_len]; 213 char *plain;
196 const void *ctx; 214 const void *ctx;
197 char *dst; 215 char *dst;
198 216
217 plain = GNUNET_malloc (plain_len);
199 dst = plain + k; 218 dst = plain + k;
200 va_copy (args, argp); 219 va_copy (args, argp);
201 while ((ctx = va_arg (args, void *))) 220 while ((ctx = va_arg (args, void *)))
@@ -210,13 +229,16 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
210 229
211 if (t > 0) 230 if (t > 0)
212 { 231 {
213 memset (plain + k + ctx_len, 1, 1); 232 plain[k + ctx_len] = (char) 1;
214#if DEBUG_HKDF 233#if DEBUG_HKDF
215 dump ("K(1)", plain, plain_len); 234 dump ("K(1)", plain, plain_len);
216#endif 235#endif
217 hc = doHMAC (prf, prk, xtr_len, &plain[k], ctx_len + 1); 236 hc = doHMAC (prf, prk, xtr_len, &plain[k], ctx_len + 1);
218 if (hc == NULL) 237 if (hc == NULL)
238 {
239 GNUNET_free (plain);
219 goto hkdf_error; 240 goto hkdf_error;
241 }
220 GNUNET_memcpy (result, hc, k); 242 GNUNET_memcpy (result, hc, k);
221 result += k; 243 result += k;
222 } 244 }
@@ -225,14 +247,17 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
225 for (i = 1; i < t; i++) 247 for (i = 1; i < t; i++)
226 { 248 {
227 GNUNET_memcpy (plain, result - k, k); 249 GNUNET_memcpy (plain, result - k, k);
228 memset (plain + k + ctx_len, i + 1, 1); 250 plain[k + ctx_len] = (char) (i + 1);
229 gcry_md_reset (prf); 251 gcry_md_reset (prf);
230#if DEBUG_HKDF 252#if DEBUG_HKDF
231 dump ("K(i+1)", plain, plain_len); 253 dump ("K(i+1)", plain, plain_len);
232#endif 254#endif
233 hc = doHMAC (prf, prk, xtr_len, plain, plain_len); 255 hc = doHMAC (prf, prk, xtr_len, plain, plain_len);
234 if (hc == NULL) 256 if (hc == NULL)
257 {
258 GNUNET_free (plain);
235 goto hkdf_error; 259 goto hkdf_error;
260 }
236 GNUNET_memcpy (result, hc, k); 261 GNUNET_memcpy (result, hc, k);
237 result += k; 262 result += k;
238 } 263 }
@@ -245,7 +270,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
245 GNUNET_memcpy (plain, result - k, k); 270 GNUNET_memcpy (plain, result - k, k);
246 i++; 271 i++;
247 } 272 }
248 memset (plain + k + ctx_len, i, 1); 273 plain[k + ctx_len] = (char) i;
249 gcry_md_reset (prf); 274 gcry_md_reset (prf);
250#if DEBUG_HKDF 275#if DEBUG_HKDF
251 dump ("K(t):d", plain, plain_len); 276 dump ("K(t):d", plain, plain_len);
@@ -255,7 +280,10 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
255 else 280 else
256 hc = doHMAC (prf, prk, xtr_len, plain + k, plain_len - k); 281 hc = doHMAC (prf, prk, xtr_len, plain + k, plain_len - k);
257 if (hc == NULL) 282 if (hc == NULL)
283 {
284 GNUNET_free (plain);
258 goto hkdf_error; 285 goto hkdf_error;
286 }
259 GNUNET_memcpy (result, hc, d); 287 GNUNET_memcpy (result, hc, d);
260 } 288 }
261#if DEBUG_HKDF 289#if DEBUG_HKDF
@@ -263,6 +291,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
263#endif 291#endif
264 292
265 ret = GNUNET_YES; 293 ret = GNUNET_YES;
294 GNUNET_free (plain);
266 goto hkdf_ok; 295 goto hkdf_ok;
267 } 296 }
268hkdf_error: 297hkdf_error:
diff --git a/src/util/crypto_mpi.c b/src/util/crypto_mpi.c
index 51a29ac7c..099921611 100644
--- a/src/util/crypto_mpi.c
+++ b/src/util/crypto_mpi.c
@@ -146,4 +146,32 @@ GNUNET_CRYPTO_mpi_scan_unsigned (gcry_mpi_t *result,
146} 146}
147 147
148 148
149/**
150 * Convert little endian data buffer into MPI value.
151 * The buffer is interpreted as network
152 * byte order, unsigned integer.
153 *
154 * @param result where to store MPI value (allocated)
155 * @param data raw data (GCRYMPI_FMT_USG)
156 * @param size number of bytes in @a data
157 */
158void
159GNUNET_CRYPTO_mpi_scan_unsigned_le (gcry_mpi_t *result,
160 const void *data,
161 size_t size)
162{
163 int rc;
164
165 if (0 != (rc = gcry_mpi_scan (result,
166 GCRYMPI_FMT_USG,
167 data, size, &size)))
168 {
169 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR,
170 "gcry_mpi_scan",
171 rc);
172 GNUNET_assert (0);
173 }
174}
175
176
149/* end of crypto_mpi.c */ 177/* end of crypto_mpi.c */
diff --git a/src/util/crypto_pow.c b/src/util/crypto_pow.c
index be575e537..35511a130 100644
--- a/src/util/crypto_pow.c
+++ b/src/util/crypto_pow.c
@@ -25,8 +25,7 @@
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_crypto_lib.h" 27#include "gnunet_crypto_lib.h"
28#include <gcrypt.h> 28#include <argon2.h>
29
30 29
31/** 30/**
32 * Calculate the 'proof-of-work' hash (an expensive hash). 31 * Calculate the 'proof-of-work' hash (an expensive hash).
@@ -44,40 +43,17 @@ GNUNET_CRYPTO_pow_hash (const char *salt,
44 size_t buf_len, 43 size_t buf_len,
45 struct GNUNET_HashCode *result) 44 struct GNUNET_HashCode *result)
46{ 45{
47 struct GNUNET_CRYPTO_SymmetricInitializationVector iv; 46 GNUNET_break (ARGON2_OK == argon2d_hash_raw (3, /* iterations */
48 struct GNUNET_CRYPTO_SymmetricSessionKey skey; 47 1024, /* memory (1 MiB) */
49 char rbuf[buf_len]; 48 1, /* threads */
49 buf,
50 buf_len,
51 salt,
52 strlen (salt),
53 result,
54 sizeof (struct
55 GNUNET_HashCode)));
50 56
51 GNUNET_break (0 == gcry_kdf_derive (buf,
52 buf_len,
53 GCRY_KDF_SCRYPT,
54 1 /* subalgo */,
55 salt,
56 strlen (salt),
57 2 /* iterations; keep cost of individual op small */,
58 sizeof(skey),
59 &skey));
60 GNUNET_CRYPTO_symmetric_derive_iv (&iv,
61 &skey,
62 "gnunet-proof-of-work-iv",
63 strlen ("gnunet-proof-of-work-iv"),
64 salt,
65 strlen (salt),
66 NULL, 0);
67 GNUNET_CRYPTO_symmetric_encrypt (buf,
68 buf_len,
69 &skey,
70 &iv,
71 &rbuf);
72 GNUNET_break (0 == gcry_kdf_derive (rbuf,
73 buf_len,
74 GCRY_KDF_SCRYPT,
75 1 /* subalgo */,
76 salt,
77 strlen (salt),
78 2 /* iterations; keep cost of individual op small */,
79 sizeof(struct GNUNET_HashCode),
80 result));
81} 57}
82 58
83 59
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c
index f0d564790..2957546a7 100644
--- a/src/util/crypto_rsa.c
+++ b/src/util/crypto_rsa.c
@@ -198,7 +198,7 @@ GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key)
198size_t 198size_t
199GNUNET_CRYPTO_rsa_private_key_encode (const struct 199GNUNET_CRYPTO_rsa_private_key_encode (const struct
200 GNUNET_CRYPTO_RsaPrivateKey *key, 200 GNUNET_CRYPTO_RsaPrivateKey *key,
201 char **buffer) 201 void **buffer)
202{ 202{
203 size_t n; 203 size_t n;
204 char *b; 204 char *b;
@@ -223,12 +223,12 @@ GNUNET_CRYPTO_rsa_private_key_encode (const struct
223 * to the "normal", internal format. 223 * to the "normal", internal format.
224 * 224 *
225 * @param buf the buffer where the private key data is stored 225 * @param buf the buffer where the private key data is stored
226 * @param len the length of the data in @a buf 226 * @param buf_size the size of the data in @a buf
227 * @return NULL on error 227 * @return NULL on error
228 */ 228 */
229struct GNUNET_CRYPTO_RsaPrivateKey * 229struct GNUNET_CRYPTO_RsaPrivateKey *
230GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, 230GNUNET_CRYPTO_rsa_private_key_decode (const void *buf,
231 size_t len) 231 size_t buf_size)
232{ 232{
233 struct GNUNET_CRYPTO_RsaPrivateKey *key; 233 struct GNUNET_CRYPTO_RsaPrivateKey *key;
234 234
@@ -236,7 +236,7 @@ GNUNET_CRYPTO_rsa_private_key_decode (const char *buf,
236 if (0 != 236 if (0 !=
237 gcry_sexp_new (&key->sexp, 237 gcry_sexp_new (&key->sexp,
238 buf, 238 buf,
239 len, 239 buf_size,
240 0)) 240 0))
241 { 241 {
242 LOG (GNUNET_ERROR_TYPE_WARNING, 242 LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -343,9 +343,9 @@ GNUNET_NETWORK_STRUCT_END
343 * @return size of memory allocated in @a buffer 343 * @return size of memory allocated in @a buffer
344 */ 344 */
345size_t 345size_t
346GNUNET_CRYPTO_rsa_public_key_encode (const struct 346GNUNET_CRYPTO_rsa_public_key_encode (
347 GNUNET_CRYPTO_RsaPublicKey *key, 347 const struct GNUNET_CRYPTO_RsaPublicKey *key,
348 char **buffer) 348 void **buffer)
349{ 349{
350 gcry_mpi_t ne[2]; 350 gcry_mpi_t ne[2];
351 size_t n_size; 351 size_t n_size;
@@ -419,7 +419,7 @@ void
419GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_RsaPublicKey *key, 419GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_RsaPublicKey *key,
420 struct GNUNET_HashCode *hc) 420 struct GNUNET_HashCode *hc)
421{ 421{
422 char *buf; 422 void *buf;
423 size_t buf_size; 423 size_t buf_size;
424 424
425 buf_size = GNUNET_CRYPTO_rsa_public_key_encode (key, 425 buf_size = GNUNET_CRYPTO_rsa_public_key_encode (key,
@@ -623,8 +623,8 @@ int
623GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_RsaSignature *s1, 623GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_RsaSignature *s1,
624 struct GNUNET_CRYPTO_RsaSignature *s2) 624 struct GNUNET_CRYPTO_RsaSignature *s2)
625{ 625{
626 char *b1; 626 void *b1;
627 char *b2; 627 void *b2;
628 size_t z1; 628 size_t z1;
629 size_t z2; 629 size_t z2;
630 int ret; 630 int ret;
@@ -656,8 +656,8 @@ int
656GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_RsaPublicKey *p1, 656GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_RsaPublicKey *p1,
657 struct GNUNET_CRYPTO_RsaPublicKey *p2) 657 struct GNUNET_CRYPTO_RsaPublicKey *p2)
658{ 658{
659 char *b1; 659 void *b1;
660 char *b2; 660 void *b2;
661 size_t z1; 661 size_t z1;
662 size_t z2; 662 size_t z2;
663 int ret; 663 int ret;
@@ -689,8 +689,8 @@ int
689GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_RsaPrivateKey *p1, 689GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_RsaPrivateKey *p1,
690 struct GNUNET_CRYPTO_RsaPrivateKey *p2) 690 struct GNUNET_CRYPTO_RsaPrivateKey *p2)
691{ 691{
692 char *b1; 692 void *b1;
693 char *b2; 693 void *b2;
694 size_t z1; 694 size_t z1;
695 size_t z2; 695 size_t z2;
696 int ret; 696 int ret;
@@ -796,7 +796,7 @@ rsa_full_domain_hash (const struct GNUNET_CRYPTO_RsaPublicKey *pkey,
796 const struct GNUNET_HashCode *hash) 796 const struct GNUNET_HashCode *hash)
797{ 797{
798 gcry_mpi_t r, n; 798 gcry_mpi_t r, n;
799 char *xts; 799 void *xts;
800 size_t xts_len; 800 size_t xts_len;
801 int ok; 801 int ok;
802 802
@@ -841,7 +841,8 @@ int
841GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, 841GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash,
842 const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, 842 const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
843 struct GNUNET_CRYPTO_RsaPublicKey *pkey, 843 struct GNUNET_CRYPTO_RsaPublicKey *pkey,
844 char **buf, size_t *buf_size) 844 void **buf,
845 size_t *buf_size)
845{ 846{
846 struct RsaBlindingKey *bkey; 847 struct RsaBlindingKey *bkey;
847 gcry_mpi_t data; 848 gcry_mpi_t data;
@@ -852,7 +853,8 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash,
852 853
853 BENCHMARK_START (rsa_blind); 854 BENCHMARK_START (rsa_blind);
854 855
855 GNUNET_assert (buf != NULL && buf_size != NULL); 856 GNUNET_assert (buf != NULL);
857 GNUNET_assert (buf_size != NULL);
856 ret = key_from_sexp (ne, pkey->sexp, "public-key", "ne"); 858 ret = key_from_sexp (ne, pkey->sexp, "public-key", "ne");
857 if (0 != ret) 859 if (0 != ret)
858 ret = key_from_sexp (ne, pkey->sexp, "rsa", "ne"); 860 ret = key_from_sexp (ne, pkey->sexp, "rsa", "ne");
@@ -891,7 +893,8 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash,
891 gcry_mpi_release (r_e); 893 gcry_mpi_release (r_e);
892 rsa_blinding_key_free (bkey); 894 rsa_blinding_key_free (bkey);
893 895
894 *buf_size = numeric_mpi_alloc_n_print (data_r_e, buf); 896 *buf_size = numeric_mpi_alloc_n_print (data_r_e,
897 (char **) buf);
895 gcry_mpi_release (data_r_e); 898 gcry_mpi_release (data_r_e);
896 899
897 BENCHMARK_END (rsa_blind); 900 BENCHMARK_END (rsa_blind);
@@ -1070,9 +1073,9 @@ GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_RsaSignature *sig)
1070 * @return size of memory allocated in @a buffer 1073 * @return size of memory allocated in @a buffer
1071 */ 1074 */
1072size_t 1075size_t
1073GNUNET_CRYPTO_rsa_signature_encode (const struct 1076GNUNET_CRYPTO_rsa_signature_encode (
1074 GNUNET_CRYPTO_RsaSignature *sig, 1077 const struct GNUNET_CRYPTO_RsaSignature *sig,
1075 char **buffer) 1078 void **buffer)
1076{ 1079{
1077 gcry_mpi_t s; 1080 gcry_mpi_t s;
1078 size_t buf_size; 1081 size_t buf_size;
@@ -1103,7 +1106,7 @@ GNUNET_CRYPTO_rsa_signature_encode (const struct
1103 &rsize, 1106 &rsize,
1104 s)); 1107 s));
1105 GNUNET_assert (rsize == buf_size); 1108 GNUNET_assert (rsize == buf_size);
1106 *buffer = (char *) buf; 1109 *buffer = (void *) buf;
1107 gcry_mpi_release (s); 1110 gcry_mpi_release (s);
1108 return buf_size; 1111 return buf_size;
1109} 1112}
@@ -1114,12 +1117,12 @@ GNUNET_CRYPTO_rsa_signature_encode (const struct
1114 * format. 1117 * format.
1115 * 1118 *
1116 * @param buf the buffer where the public key data is stored 1119 * @param buf the buffer where the public key data is stored
1117 * @param len the length of the data in @a buf 1120 * @param buf_size the size of the data in @a buf
1118 * @return NULL on error 1121 * @return NULL on error
1119 */ 1122 */
1120struct GNUNET_CRYPTO_RsaSignature * 1123struct GNUNET_CRYPTO_RsaSignature *
1121GNUNET_CRYPTO_rsa_signature_decode (const char *buf, 1124GNUNET_CRYPTO_rsa_signature_decode (const void *buf,
1122 size_t len) 1125 size_t buf_size)
1123{ 1126{
1124 struct GNUNET_CRYPTO_RsaSignature *sig; 1127 struct GNUNET_CRYPTO_RsaSignature *sig;
1125 gcry_mpi_t s; 1128 gcry_mpi_t s;
@@ -1129,7 +1132,7 @@ GNUNET_CRYPTO_rsa_signature_decode (const char *buf,
1129 gcry_mpi_scan (&s, 1132 gcry_mpi_scan (&s,
1130 GCRYMPI_FMT_USG, 1133 GCRYMPI_FMT_USG,
1131 buf, 1134 buf,
1132 len, 1135 buf_size,
1133 NULL)) 1136 NULL))
1134 { 1137 {
1135 GNUNET_break_op (0); 1138 GNUNET_break_op (0);
diff --git a/src/util/disk.c b/src/util/disk.c
index 2d5e353c8..9018aa955 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -827,7 +827,6 @@ GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h,
827 return GNUNET_SYSERR; 827 return GNUNET_SYSERR;
828 } 828 }
829 829
830
831 return write (h->fd, buffer, n); 830 return write (h->fd, buffer, n);
832} 831}
833 832
@@ -1189,70 +1188,6 @@ GNUNET_DISK_file_change_owner (const char *filename, const char *user)
1189 1188
1190 1189
1191/** 1190/**
1192 * Lock a part of a file
1193 *
1194 * @param fh file handle
1195 * @param lock_start absolute position from where to lock
1196 * @param lock_end absolute position until where to lock
1197 * @param excl #GNUNET_YES for an exclusive lock
1198 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
1199 */
1200int
1201GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh,
1202 off_t lock_start,
1203 off_t lock_end,
1204 int excl)
1205{
1206 if (fh == NULL)
1207 {
1208 errno = EINVAL;
1209 return GNUNET_SYSERR;
1210 }
1211
1212 struct flock fl;
1213
1214 memset (&fl, 0, sizeof(struct flock));
1215 fl.l_type = excl ? F_WRLCK : F_RDLCK;
1216 fl.l_whence = SEEK_SET;
1217 fl.l_start = lock_start;
1218 fl.l_len = lock_end;
1219
1220 return fcntl (fh->fd, F_SETLK, &fl) != 0 ? GNUNET_SYSERR : GNUNET_OK;
1221}
1222
1223
1224/**
1225 * Unlock a part of a file
1226 *
1227 * @param fh file handle
1228 * @param unlock_start absolute position from where to unlock
1229 * @param unlock_end absolute position until where to unlock
1230 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
1231 */
1232int
1233GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh,
1234 off_t unlock_start,
1235 off_t unlock_end)
1236{
1237 if (fh == NULL)
1238 {
1239 errno = EINVAL;
1240 return GNUNET_SYSERR;
1241 }
1242
1243 struct flock fl;
1244
1245 memset (&fl, 0, sizeof(struct flock));
1246 fl.l_type = F_UNLCK;
1247 fl.l_whence = SEEK_SET;
1248 fl.l_start = unlock_start;
1249 fl.l_len = unlock_end;
1250
1251 return fcntl (fh->fd, F_SETLK, &fl) != 0 ? GNUNET_SYSERR : GNUNET_OK;
1252}
1253
1254
1255/**
1256 * Open a file. Note that the access permissions will only be 1191 * Open a file. Note that the access permissions will only be
1257 * used if a new file is created and if the underlying operating 1192 * used if a new file is created and if the underlying operating
1258 * system supports the given permissions. 1193 * system supports the given permissions.
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c
index a2572ccab..a56ef2d96 100644
--- a/src/util/getopt_helpers.c
+++ b/src/util/getopt_helpers.c
@@ -623,18 +623,42 @@ set_timetravel_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
623 const char *value) 623 const char *value)
624{ 624{
625 long long delta; 625 long long delta;
626 long long minus;
627 struct GNUNET_TIME_Relative rt;
626 628
627 (void) scls; 629 (void) scls;
628 (void) ctx; 630 (void) ctx;
629 if (1 != sscanf (value, 631 while (isspace (value[0]))
630 "%lld", 632 value++;
631 &delta)) 633 minus = 1;
634 if (value[0] == '-')
635 {
636 minus = -1;
637 value++;
638 }
639 else if (value[0] == '+')
640 {
641 value++;
642 }
643 if (GNUNET_OK !=
644 GNUNET_STRINGS_fancy_time_to_relative (value,
645 &rt))
632 { 646 {
633 fprintf (stderr, 647 fprintf (stderr,
634 _ ("You must pass a number to the `%s' option.\n"), 648 _ (
649 "You must pass a relative time (optionally with sign) to the `%s' option.\n"),
650 option);
651 return GNUNET_SYSERR;
652 }
653 if (rt.rel_value_us > LLONG_MAX)
654 {
655 fprintf (stderr,
656 _ ("Value given for time travel `%s' option is too big.\n"),
635 option); 657 option);
636 return GNUNET_SYSERR; 658 return GNUNET_SYSERR;
637 } 659 }
660 delta = (long long) rt.rel_value_us;
661 delta *= minus;
638 GNUNET_TIME_set_offset (delta); 662 GNUNET_TIME_set_offset (delta);
639 return GNUNET_OK; 663 return GNUNET_OK;
640} 664}
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c
index f101e8b61..5883c1497 100644
--- a/src/util/gnunet-config.c
+++ b/src/util/gnunet-config.c
@@ -331,7 +331,7 @@ main (int argc, char *const *argv)
331 options, 331 options,
332 &run, 332 &run,
333 NULL); 333 NULL);
334 GNUNET_free ((void *) argv); 334 GNUNET_free_nz ((void *) argv);
335 if (GNUNET_OK == ret) 335 if (GNUNET_OK == ret)
336 return global_ret; 336 return global_ret;
337 return ret; 337 return ret;
diff --git a/src/util/gnunet-crypto-tvg.c b/src/util/gnunet-crypto-tvg.c
index 7d151c10b..c3fead62e 100644
--- a/src/util/gnunet-crypto-tvg.c
+++ b/src/util/gnunet-crypto-tvg.c
@@ -86,62 +86,84 @@ run (void *cls,
86 display_data (" output", &hc, sizeof (struct GNUNET_HashCode)); 86 display_data (" output", &hc, sizeof (struct GNUNET_HashCode));
87 } 87 }
88 { 88 {
89 struct GNUNET_CRYPTO_EcdhePrivateKey *priv1; 89 struct GNUNET_CRYPTO_EcdhePrivateKey priv1;
90 struct GNUNET_CRYPTO_EcdhePublicKey pub1; 90 struct GNUNET_CRYPTO_EcdhePublicKey pub1;
91 struct GNUNET_CRYPTO_EcdhePrivateKey *priv2; 91 struct GNUNET_CRYPTO_EcdhePrivateKey priv2;
92 struct GNUNET_HashCode skm; 92 struct GNUNET_HashCode skm;
93 priv1 = GNUNET_CRYPTO_ecdhe_key_create (); 93
94 priv2 = GNUNET_CRYPTO_ecdhe_key_create (); 94 GNUNET_CRYPTO_ecdhe_key_create (&priv1);
95 GNUNET_CRYPTO_ecdhe_key_get_public (priv1, &pub1); 95 GNUNET_CRYPTO_ecdhe_key_create (&priv2);
96 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecc_ecdh (priv2, &pub1, &skm)); 96 GNUNET_CRYPTO_ecdhe_key_get_public (&priv1,
97 &pub1);
98 GNUNET_assert (GNUNET_OK ==
99 GNUNET_CRYPTO_ecc_ecdh (&priv2,
100 &pub1,
101 &skm));
97 102
98 printf ("ecdhe key:\n"); 103 printf ("ecdhe key:\n");
99 display_data (" priv1", priv1, sizeof (struct 104 display_data (" priv1",
100 GNUNET_CRYPTO_EcdhePrivateKey)); 105 &priv1,
101 display_data (" pub1", &pub1, sizeof (struct 106 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
102 GNUNET_CRYPTO_EcdhePublicKey)); 107 display_data (" pub1",
103 display_data (" priv2", priv2, sizeof (struct 108 &pub1,
104 GNUNET_CRYPTO_EcdhePrivateKey)); 109 sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
105 display_data (" skm", &skm, sizeof (struct GNUNET_HashCode)); 110 display_data (" priv2",
106 GNUNET_free (priv1); 111 &priv2,
107 GNUNET_free (priv2); 112 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
113 display_data (" skm",
114 &skm,
115 sizeof (struct GNUNET_HashCode));
108 } 116 }
109 117
110 { 118 {
111 struct GNUNET_CRYPTO_EddsaPrivateKey *priv; 119 struct GNUNET_CRYPTO_EddsaPrivateKey priv;
112 struct GNUNET_CRYPTO_EddsaPublicKey pub; 120 struct GNUNET_CRYPTO_EddsaPublicKey pub;
113 priv = GNUNET_CRYPTO_eddsa_key_create (); 121
114 GNUNET_CRYPTO_eddsa_key_get_public (priv, &pub); 122 GNUNET_CRYPTO_eddsa_key_create (&priv);
123 GNUNET_CRYPTO_eddsa_key_get_public (&priv,
124 &pub);
115 125
116 printf ("eddsa key:\n"); 126 printf ("eddsa key:\n");
117 display_data (" priv", priv, sizeof (struct 127 display_data (" priv",
118 GNUNET_CRYPTO_EddsaPrivateKey)); 128 &priv,
119 display_data (" pub", &pub, sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); 129 sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey));
120 GNUNET_free (priv); 130 display_data (" pub",
131 &pub,
132 sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
121 } 133 }
122 { 134 {
123 struct GNUNET_CRYPTO_EddsaPrivateKey *priv; 135 struct GNUNET_CRYPTO_EddsaPrivateKey priv;
124 struct GNUNET_CRYPTO_EddsaPublicKey pub; 136 struct GNUNET_CRYPTO_EddsaPublicKey pub;
125 struct GNUNET_CRYPTO_EddsaSignature sig; 137 struct GNUNET_CRYPTO_EddsaSignature sig;
126 struct TestSignatureDataPS data = { 0 }; 138 struct TestSignatureDataPS data = { 0 };
127 priv = GNUNET_CRYPTO_eddsa_key_create (); 139
128 GNUNET_CRYPTO_eddsa_key_get_public (priv, &pub); 140 GNUNET_CRYPTO_eddsa_key_create (&priv);
129 data.purpose.size = htonl (sizeof (struct TestSignatureDataPS)); 141 GNUNET_CRYPTO_eddsa_key_get_public (&priv,
130 data.purpose.size = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); 142 &pub);
131 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (priv, &data.purpose, 143 data.purpose.size = htonl (sizeof (data));
132 &sig)); 144 data.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
133 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_verify (0, 145 GNUNET_CRYPTO_eddsa_sign (&priv,
134 &data.purpose, 146 &data,
135 &sig, 147 &sig);
136 &pub)); 148 GNUNET_assert (GNUNET_OK ==
149 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TEST,
150 &data,
151 &sig,
152 &pub));
137 153
138 printf ("eddsa sig:\n"); 154 printf ("eddsa sig:\n");
139 display_data (" priv", priv, sizeof (struct 155 display_data (" priv",
140 GNUNET_CRYPTO_EddsaPrivateKey)); 156 &priv,
141 display_data (" pub", &pub, sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); 157 sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey));
142 display_data (" data", &data, sizeof (struct TestSignatureDataPS)); 158 display_data (" pub",
143 display_data (" sig", &sig, sizeof (struct GNUNET_CRYPTO_EddsaSignature)); 159 &pub,
144 GNUNET_free (priv); 160 sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
161 display_data (" data",
162 &data,
163 sizeof (struct TestSignatureDataPS));
164 display_data (" sig",
165 &sig,
166 sizeof (struct GNUNET_CRYPTO_EddsaSignature));
145 } 167 }
146 168
147 { 169 {
@@ -151,15 +173,16 @@ run (void *cls,
151 char *salt = "I'm very salty"; 173 char *salt = "I'm very salty";
152 char *ctx = "I'm a context chunk, also known as 'info' in the RFC"; 174 char *ctx = "I'm a context chunk, also known as 'info' in the RFC";
153 175
154 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_kdf (&out, 176 GNUNET_assert (GNUNET_OK ==
155 out_len, 177 GNUNET_CRYPTO_kdf (&out,
156 salt, 178 out_len,
157 strlen (salt), 179 salt,
158 ikm, 180 strlen (salt),
159 strlen (ikm), 181 ikm,
160 ctx, 182 strlen (ikm),
161 strlen (ctx), 183 ctx,
162 NULL)); 184 strlen (ctx),
185 NULL));
163 186
164 printf ("kdf:\n"); 187 printf ("kdf:\n");
165 display_data (" salt", salt, strlen (salt)); 188 display_data (" salt", salt, strlen (salt));
@@ -169,28 +192,34 @@ run (void *cls,
169 display_data (" out", out, out_len); 192 display_data (" out", out, out_len);
170 } 193 }
171 { 194 {
172 struct GNUNET_CRYPTO_EcdhePrivateKey *priv_ecdhe; 195 struct GNUNET_CRYPTO_EcdhePrivateKey priv_ecdhe;
173 struct GNUNET_CRYPTO_EcdhePublicKey pub_ecdhe; 196 struct GNUNET_CRYPTO_EcdhePublicKey pub_ecdhe;
174 struct GNUNET_CRYPTO_EddsaPrivateKey *priv_eddsa; 197 struct GNUNET_CRYPTO_EddsaPrivateKey priv_eddsa;
175 struct GNUNET_CRYPTO_EddsaPublicKey pub_eddsa; 198 struct GNUNET_CRYPTO_EddsaPublicKey pub_eddsa;
176 struct GNUNET_HashCode key_material; 199 struct GNUNET_HashCode key_material;
177 priv_ecdhe = GNUNET_CRYPTO_ecdhe_key_create (); 200
178 GNUNET_CRYPTO_ecdhe_key_get_public (priv_ecdhe, &pub_ecdhe); 201 GNUNET_CRYPTO_ecdhe_key_create (&priv_ecdhe);
179 priv_eddsa = GNUNET_CRYPTO_eddsa_key_create (); 202 GNUNET_CRYPTO_ecdhe_key_get_public (&priv_ecdhe, &pub_ecdhe);
180 GNUNET_CRYPTO_eddsa_key_get_public (priv_eddsa, &pub_eddsa); 203 GNUNET_CRYPTO_eddsa_key_create (&priv_eddsa);
181 GNUNET_CRYPTO_ecdh_eddsa (priv_ecdhe, &pub_eddsa, &key_material); 204 GNUNET_CRYPTO_eddsa_key_get_public (&priv_eddsa, &pub_eddsa);
205 GNUNET_CRYPTO_ecdh_eddsa (&priv_ecdhe, &pub_eddsa, &key_material);
182 206
183 printf ("eddsa_ecdh:\n"); 207 printf ("eddsa_ecdh:\n");
184 display_data (" priv_ecdhe", priv_ecdhe, sizeof (struct 208 display_data (" priv_ecdhe",
185 GNUNET_CRYPTO_EcdhePrivateKey)); 209 &priv_ecdhe,
186 display_data (" pub_ecdhe", &pub_ecdhe, sizeof (struct 210 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
187 GNUNET_CRYPTO_EcdhePublicKey)); 211 display_data (" pub_ecdhe",
188 display_data (" priv_eddsa", priv_eddsa, sizeof (struct 212 &pub_ecdhe,
189 GNUNET_CRYPTO_EddsaPrivateKey)); 213 sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
190 display_data (" pub_eddsa", &pub_eddsa, sizeof (struct 214 display_data (" priv_eddsa",
191 GNUNET_CRYPTO_EddsaPublicKey)); 215 &priv_eddsa,
192 display_data (" key_material", &key_material, sizeof (struct 216 sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey));
193 GNUNET_HashCode)); 217 display_data (" pub_eddsa",
218 &pub_eddsa,
219 sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
220 display_data (" key_material",
221 &key_material,
222 sizeof (struct GNUNET_HashCode));
194 } 223 }
195 224
196 { 225 {
@@ -200,23 +229,29 @@ run (void *cls,
200 struct GNUNET_CRYPTO_RsaBlindingKeySecret bks; 229 struct GNUNET_CRYPTO_RsaBlindingKeySecret bks;
201 struct GNUNET_CRYPTO_RsaSignature *blinded_sig; 230 struct GNUNET_CRYPTO_RsaSignature *blinded_sig;
202 struct GNUNET_CRYPTO_RsaSignature *sig; 231 struct GNUNET_CRYPTO_RsaSignature *sig;
203 char *blinded_data; 232 void *blinded_data;
204 size_t blinded_len; 233 size_t blinded_len;
205 char *public_enc_data; 234 void *public_enc_data;
206 size_t public_enc_len; 235 size_t public_enc_len;
207 char *blinded_sig_enc_data; 236 void *blinded_sig_enc_data;
208 size_t blinded_sig_enc_length; 237 size_t blinded_sig_enc_length;
209 char *sig_enc_data; 238 void *sig_enc_data;
210 size_t sig_enc_length; 239 size_t sig_enc_length;
211 skey = GNUNET_CRYPTO_rsa_private_key_create (2048); 240 skey = GNUNET_CRYPTO_rsa_private_key_create (2048);
212 pkey = GNUNET_CRYPTO_rsa_private_key_get_public (skey); 241 pkey = GNUNET_CRYPTO_rsa_private_key_get_public (skey);
213 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &message_hash, 242 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
243 &message_hash,
214 sizeof (struct GNUNET_HashCode)); 244 sizeof (struct GNUNET_HashCode));
215 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &bks, sizeof (struct 245 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
216 GNUNET_CRYPTO_RsaBlindingKeySecret)); 246 &bks,
217 GNUNET_assert (GNUNET_YES == GNUNET_CRYPTO_rsa_blind (&message_hash, &bks, 247 sizeof (struct
218 pkey, &blinded_data, 248 GNUNET_CRYPTO_RsaBlindingKeySecret));
219 &blinded_len)); 249 GNUNET_assert (GNUNET_YES ==
250 GNUNET_CRYPTO_rsa_blind (&message_hash,
251 &bks,
252 pkey,
253 &blinded_data,
254 &blinded_len));
220 blinded_sig = GNUNET_CRYPTO_rsa_sign_blinded (skey, blinded_data, 255 blinded_sig = GNUNET_CRYPTO_rsa_sign_blinded (skey, blinded_data,
221 blinded_len); 256 blinded_len);
222 sig = GNUNET_CRYPTO_rsa_unblind (blinded_sig, &bks, pkey); 257 sig = GNUNET_CRYPTO_rsa_unblind (blinded_sig, &bks, pkey);
@@ -275,4 +310,5 @@ main (int argc,
275 return 0; 310 return 0;
276} 311}
277 312
313
278/* end of gnunet-crypto-tvg.c */ 314/* end of gnunet-crypto-tvg.c */
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c
index 02d2020ad..8e30ac416 100644
--- a/src/util/gnunet-ecc.c
+++ b/src/util/gnunet-ecc.c
@@ -79,7 +79,7 @@ static void
79create_keys (const char *fn, const char *prefix) 79create_keys (const char *fn, const char *prefix)
80{ 80{
81 FILE *f; 81 FILE *f;
82 struct GNUNET_CRYPTO_EddsaPrivateKey *pk; 82 struct GNUNET_CRYPTO_EddsaPrivateKey pk;
83 struct GNUNET_CRYPTO_EddsaPublicKey target_pub; 83 struct GNUNET_CRYPTO_EddsaPublicKey target_pub;
84 static char vanity[KEY_STR_LEN + 1]; 84 static char vanity[KEY_STR_LEN + 1];
85 size_t len; 85 size_t len;
@@ -141,17 +141,16 @@ create_keys (const char *fn, const char *prefix)
141 while (0 < make_keys--) 141 while (0 < make_keys--)
142 { 142 {
143 fprintf (stderr, "."); 143 fprintf (stderr, ".");
144 if (NULL == (pk = GNUNET_CRYPTO_eddsa_key_create ())) 144 GNUNET_CRYPTO_eddsa_key_create (&pk);
145 {
146 GNUNET_break (0);
147 break;
148 }
149 if (NULL != prefix) 145 if (NULL != prefix)
150 { 146 {
151 struct GNUNET_CRYPTO_EddsaPublicKey newkey; 147 struct GNUNET_CRYPTO_EddsaPublicKey newkey;
152 148
153 GNUNET_CRYPTO_eddsa_key_get_public (pk, &newkey); 149 GNUNET_CRYPTO_eddsa_key_get_public (&pk,
154 if (0 != memcmp (&target_pub, &newkey, n)) 150 &newkey);
151 if (0 != memcmp (&target_pub,
152 &newkey,
153 n))
155 { 154 {
156 make_keys++; 155 make_keys++;
157 continue; 156 continue;
@@ -169,16 +168,17 @@ create_keys (const char *fn, const char *prefix)
169 } 168 }
170 } 169 }
171 if (GNUNET_TESTING_HOSTKEYFILESIZE != 170 if (GNUNET_TESTING_HOSTKEYFILESIZE !=
172 fwrite (pk, 1, GNUNET_TESTING_HOSTKEYFILESIZE, f)) 171 fwrite (&pk,
172 1,
173 GNUNET_TESTING_HOSTKEYFILESIZE,
174 f))
173 { 175 {
174 fprintf (stderr, 176 fprintf (stderr,
175 _ ("\nFailed to write to `%s': %s\n"), 177 _ ("\nFailed to write to `%s': %s\n"),
176 fn, 178 fn,
177 strerror (errno)); 179 strerror (errno));
178 GNUNET_free (pk);
179 break; 180 break;
180 } 181 }
181 GNUNET_free (pk);
182 } 182 }
183 if (UINT_MAX == make_keys) 183 if (UINT_MAX == make_keys)
184 fprintf (stderr, _ ("\nFinished!\n")); 184 fprintf (stderr, _ ("\nFinished!\n"));
@@ -201,49 +201,75 @@ print_hex (const char *msg, const void *buf, size_t size)
201 201
202 202
203static void 203static void
204print_examples_ecdh () 204print_examples_ecdh (void)
205{ 205{
206 struct GNUNET_CRYPTO_EcdhePrivateKey *dh_priv1; 206 struct GNUNET_CRYPTO_EcdhePrivateKey dh_priv1;
207 struct GNUNET_CRYPTO_EcdhePublicKey *dh_pub1; 207 struct GNUNET_CRYPTO_EcdhePublicKey dh_pub1;
208 struct GNUNET_CRYPTO_EcdhePrivateKey *dh_priv2; 208 struct GNUNET_CRYPTO_EcdhePrivateKey dh_priv2;
209 struct GNUNET_CRYPTO_EcdhePublicKey *dh_pub2; 209 struct GNUNET_CRYPTO_EcdhePublicKey dh_pub2;
210 struct GNUNET_HashCode hash; 210 struct GNUNET_HashCode hash;
211 char buf[128]; 211 char buf[128];
212 212
213 dh_pub1 = GNUNET_new (struct GNUNET_CRYPTO_EcdhePublicKey); 213 GNUNET_CRYPTO_ecdhe_key_create (&dh_priv1);
214 dh_priv1 = GNUNET_CRYPTO_ecdhe_key_create (); 214 GNUNET_CRYPTO_ecdhe_key_create (&dh_priv2);
215 dh_pub2 = GNUNET_new (struct GNUNET_CRYPTO_EcdhePublicKey); 215 GNUNET_CRYPTO_ecdhe_key_get_public (&dh_priv1,
216 dh_priv2 = GNUNET_CRYPTO_ecdhe_key_create (); 216 &dh_pub1);
217 GNUNET_CRYPTO_ecdhe_key_get_public (dh_priv1, dh_pub1); 217 GNUNET_CRYPTO_ecdhe_key_get_public (&dh_priv2,
218 GNUNET_CRYPTO_ecdhe_key_get_public (dh_priv2, dh_pub2); 218 &dh_pub2);
219 219
220 GNUNET_assert (NULL != 220 GNUNET_assert (NULL !=
221 GNUNET_STRINGS_data_to_string (dh_priv1, 32, buf, 128)); 221 GNUNET_STRINGS_data_to_string (&dh_priv1,
222 sizeof (dh_priv1),
223 buf,
224 sizeof (buf)));
222 printf ("ECDHE key 1:\n"); 225 printf ("ECDHE key 1:\n");
223 printf ("private: %s\n", buf); 226 printf ("private: %s\n",
224 print_hex ("private(hex)", dh_priv1, sizeof *dh_priv1); 227 buf);
225 GNUNET_assert (NULL != GNUNET_STRINGS_data_to_string (dh_pub1, 32, buf, 128)); 228 print_hex ("private(hex)",
226 printf ("public: %s\n", buf); 229 &dh_priv1, sizeof (dh_priv1));
227 print_hex ("public(hex)", dh_pub1, sizeof *dh_pub1); 230 GNUNET_assert (NULL !=
231 GNUNET_STRINGS_data_to_string (&dh_pub1,
232 sizeof (dh_pub1),
233 buf,
234 sizeof (buf)));
235 printf ("public: %s\n",
236 buf);
237 print_hex ("public(hex)",
238 &dh_pub1,
239 sizeof (dh_pub1));
228 240
229 GNUNET_assert (NULL != 241 GNUNET_assert (NULL !=
230 GNUNET_STRINGS_data_to_string (dh_priv2, 32, buf, 128)); 242 GNUNET_STRINGS_data_to_string (&dh_priv2,
243 sizeof (dh_priv2),
244 buf,
245 sizeof (buf)));
231 printf ("ECDHE key 2:\n"); 246 printf ("ECDHE key 2:\n");
232 printf ("private: %s\n", buf); 247 printf ("private: %s\n", buf);
233 print_hex ("private(hex)", dh_priv2, sizeof *dh_priv2); 248 print_hex ("private(hex)",
234 GNUNET_assert (NULL != GNUNET_STRINGS_data_to_string (dh_pub2, 32, buf, 128)); 249 &dh_priv2,
250 sizeof (dh_priv2));
251 GNUNET_assert (NULL !=
252 GNUNET_STRINGS_data_to_string (&dh_pub2,
253 sizeof (dh_pub2),
254 buf,
255 sizeof (buf)));
235 printf ("public: %s\n", buf); 256 printf ("public: %s\n", buf);
236 print_hex ("public(hex)", dh_pub2, sizeof *dh_pub2); 257 print_hex ("public(hex)",
258 &dh_pub2,
259 sizeof (dh_pub2));
237 260
238 GNUNET_assert (GNUNET_OK == 261 GNUNET_assert (GNUNET_OK ==
239 GNUNET_CRYPTO_ecc_ecdh (dh_priv1, dh_pub2, &hash)); 262 GNUNET_CRYPTO_ecc_ecdh (&dh_priv1,
240 GNUNET_assert (NULL != GNUNET_STRINGS_data_to_string (&hash, 64, buf, 128)); 263 &dh_pub2,
241 printf ("ECDH shared secret: %s\n", buf); 264 &hash));
242 265 GNUNET_assert (NULL !=
243 GNUNET_free (dh_priv1); 266 GNUNET_STRINGS_data_to_string (&hash,
244 GNUNET_free (dh_priv2); 267 sizeof (hash),
245 GNUNET_free (dh_pub1); 268 buf,
246 GNUNET_free (dh_pub2); 269 sizeof (buf)));
270 printf ("ECDH shared secret: %s\n",
271 buf);
272
247} 273}
248 274
249 275
@@ -251,7 +277,7 @@ print_examples_ecdh ()
251 * Print some random example operations to stdout. 277 * Print some random example operations to stdout.
252 */ 278 */
253static void 279static void
254print_examples () 280print_examples (void)
255{ 281{
256 print_examples_ecdh (); 282 print_examples_ecdh ();
257 // print_examples_ecdsa (); 283 // print_examples_ecdsa ();
@@ -475,7 +501,7 @@ main (int argc, char *const *argv)
475 NULL)) 501 NULL))
476 ? 0 502 ? 0
477 : 1; 503 : 1;
478 GNUNET_free ((void *) argv); 504 GNUNET_free_nz ((void *) argv);
479 return ret; 505 return ret;
480} 506}
481 507
diff --git a/src/util/gnunet-resolver.c b/src/util/gnunet-resolver.c
index 6a602c64e..8a6c7fbe9 100644
--- a/src/util/gnunet-resolver.c
+++ b/src/util/gnunet-resolver.c
@@ -171,14 +171,18 @@ main (int argc, char *const *argv)
171 }; 171 };
172 int ret; 172 int ret;
173 173
174 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 174 if (GNUNET_OK !=
175 GNUNET_STRINGS_get_utf8_args (argc, argv,
176 &argc, &argv))
175 return 2; 177 return 2;
176 178
177 ret = (GNUNET_OK == 179 ret = (GNUNET_OK ==
178 GNUNET_PROGRAM_run (argc, argv, "gnunet-resolver [hostname]", 180 GNUNET_PROGRAM_run (argc, argv,
181 "gnunet-resolver [hostname]",
179 gettext_noop ("Use build-in GNUnet stub resolver"), 182 gettext_noop ("Use build-in GNUnet stub resolver"),
180 options, &run, NULL)) ? 0 : 1; 183 options,
181 GNUNET_free ((void *) argv); 184 &run, NULL)) ? 0 : 1;
185 GNUNET_free_nz ((void *) argv);
182 return ret; 186 return ret;
183} 187}
184 188
diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c
index bc8ce83c0..70ba48d82 100644
--- a/src/util/gnunet-scrypt.c
+++ b/src/util/gnunet-scrypt.c
@@ -174,7 +174,7 @@ run (void *cls,
174 const char *cfgfile, 174 const char *cfgfile,
175 const struct GNUNET_CONFIGURATION_Handle *config) 175 const struct GNUNET_CONFIGURATION_Handle *config)
176{ 176{
177 struct GNUNET_CRYPTO_EddsaPrivateKey *pk; 177 struct GNUNET_CRYPTO_EddsaPrivateKey pk;
178 char *pids; 178 char *pids;
179 179
180 (void) cls; 180 (void) cls;
@@ -214,15 +214,18 @@ run (void *cls,
214 } 214 }
215 } 215 }
216 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Private Key file: %s\n", pkfn); 216 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Private Key file: %s\n", pkfn);
217 if (NULL == (pk = GNUNET_CRYPTO_eddsa_key_create_from_file (pkfn))) 217 if (GNUNET_SYSERR ==
218 GNUNET_CRYPTO_eddsa_key_from_file (pkfn,
219 GNUNET_YES,
220 &pk))
218 { 221 {
219 fprintf (stderr, _ ("Loading hostkey from `%s' failed.\n"), pkfn); 222 fprintf (stderr, _ ("Loading hostkey from `%s' failed.\n"), pkfn);
220 GNUNET_free (pkfn); 223 GNUNET_free (pkfn);
221 return; 224 return;
222 } 225 }
223 GNUNET_free (pkfn); 226 GNUNET_free (pkfn);
224 GNUNET_CRYPTO_eddsa_key_get_public (pk, &pub); 227 GNUNET_CRYPTO_eddsa_key_get_public (&pk,
225 GNUNET_free (pk); 228 &pub);
226 pids = GNUNET_CRYPTO_eddsa_public_key_to_string (&pub); 229 pids = GNUNET_CRYPTO_eddsa_public_key_to_string (&pub);
227 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peer ID: %s\n", pids); 230 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peer ID: %s\n", pids);
228 GNUNET_free (pids); 231 GNUNET_free (pids);
@@ -319,7 +322,7 @@ main (int argc, char *const *argv)
319 NULL)) 322 NULL))
320 ? 0 323 ? 0
321 : 1; 324 : 1;
322 GNUNET_free ((void *) argv); 325 GNUNET_free_nz ((void *) argv);
323 GNUNET_free_non_null (pwfn); 326 GNUNET_free_non_null (pwfn);
324 return ret; 327 return ret;
325} 328}
diff --git a/src/util/gnunet-timeout.c b/src/util/gnunet-timeout.c
index f650475cb..4c3c9125d 100644
--- a/src/util/gnunet-timeout.c
+++ b/src/util/gnunet-timeout.c
@@ -45,13 +45,11 @@ sigchld_handler (int val)
45 if (WIFEXITED (status) != 0) 45 if (WIFEXITED (status) != 0)
46 { 46 {
47 ret = WEXITSTATUS (status); 47 ret = WEXITSTATUS (status);
48 fprintf (stderr, "Process exited with result %u\n", ret);
49 _exit (ret); /* return same status code */ 48 _exit (ret); /* return same status code */
50 } 49 }
51 if (WIFSIGNALED (status) != 0) 50 if (WIFSIGNALED (status) != 0)
52 { 51 {
53 ret = WTERMSIG (status); 52 ret = WTERMSIG (status);
54 fprintf (stderr, "Process received signal %u\n", ret);
55 kill (getpid (), ret); /* kill self with the same signal */ 53 kill (getpid (), ret); /* kill self with the same signal */
56 } 54 }
57 _exit (-1); 55 _exit (-1);
diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c
index 84100ff56..48c46ee49 100644
--- a/src/util/gnunet-uri.c
+++ b/src/util/gnunet-uri.c
@@ -184,7 +184,7 @@ main (int argc, char *const *argv)
184 shc_chld = NULL; 184 shc_chld = NULL;
185 GNUNET_DISK_pipe_close (sigpipe); 185 GNUNET_DISK_pipe_close (sigpipe);
186 sigpipe = NULL; 186 sigpipe = NULL;
187 GNUNET_free ((void *) argv); 187 GNUNET_free_nz ((void *) argv);
188 return ((GNUNET_OK == ret) && (0 == exit_code)) ? 0 : 1; 188 return ((GNUNET_OK == ret) && (0 == exit_code)) ? 0 : 1;
189} 189}
190 190
diff --git a/src/util/mq.c b/src/util/mq.c
index 003e0955d..78dc7dba2 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -297,7 +297,8 @@ done:
297 * @param error the error type 297 * @param error the error type
298 */ 298 */
299void 299void
300GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq, enum GNUNET_MQ_Error error) 300GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq,
301 enum GNUNET_MQ_Error error)
301{ 302{
302 if (NULL == mq->error_handler) 303 if (NULL == mq->error_handler)
303 { 304 {
@@ -306,7 +307,8 @@ GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq, enum GNUNET_MQ_Error error)
306 (int) error); 307 (int) error);
307 return; 308 return;
308 } 309 }
309 mq->error_handler (mq->error_handler_cls, error); 310 mq->error_handler (mq->error_handler_cls,
311 error);
310} 312}
311 313
312 314
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index 722aac872..5799d893b 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -875,7 +875,7 @@ GNUNET_OS_start_process_s (int pipe_control,
875 binary_path, 875 binary_path,
876 argv); 876 argv);
877 while (argv_size > 0) 877 while (argv_size > 0)
878 GNUNET_free (argv[--argv_size]); 878 GNUNET_free_nz (argv[--argv_size]);
879 GNUNET_free (argv); 879 GNUNET_free (argv);
880 return proc; 880 return proc;
881} 881}
@@ -975,7 +975,7 @@ GNUNET_OS_process_status (struct GNUNET_OS_Process *proc,
975 * @param proc pointer to process structure 975 * @param proc pointer to process structure
976 * @param type status type 976 * @param type status type
977 * @param code return code/signal number 977 * @param code return code/signal number
978 * @return #GNUNET_OK on success, #GNUNET_NO if the process is still running, #GNUNET_SYSERR otherwise 978 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
979 */ 979 */
980int 980int
981GNUNET_OS_process_wait_status (struct GNUNET_OS_Process *proc, 981GNUNET_OS_process_wait_status (struct GNUNET_OS_Process *proc,
diff --git a/src/util/perf_crypto_asymmetric.c b/src/util/perf_crypto_asymmetric.c
index 7594733b0..49d9ec644 100644
--- a/src/util/perf_crypto_asymmetric.c
+++ b/src/util/perf_crypto_asymmetric.c
@@ -93,18 +93,18 @@ main (int argc, char *argv[])
93 start = GNUNET_TIME_absolute_get (); 93 start = GNUNET_TIME_absolute_get ();
94 for (i = 0; i < l; i++) 94 for (i = 0; i < l; i++)
95 GNUNET_assert (GNUNET_OK == 95 GNUNET_assert (GNUNET_OK ==
96 GNUNET_CRYPTO_eddsa_sign (eddsa[i], 96 GNUNET_CRYPTO_eddsa_sign_ (eddsa[i],
97 &sig[i].purp, 97 &sig[i].purp,
98 &sig[i].sig)); 98 &sig[i].sig));
99 log_duration ("EdDSA", "sign HashCode"); 99 log_duration ("EdDSA", "sign HashCode");
100 100
101 start = GNUNET_TIME_absolute_get (); 101 start = GNUNET_TIME_absolute_get ();
102 for (i = 0; i < l; i++) 102 for (i = 0; i < l; i++)
103 GNUNET_assert (GNUNET_OK == 103 GNUNET_assert (GNUNET_OK ==
104 GNUNET_CRYPTO_eddsa_verify (0, 104 GNUNET_CRYPTO_eddsa_verify_ (0,
105 &sig[i].purp, 105 &sig[i].purp,
106 &sig[i].sig, 106 &sig[i].sig,
107 &dspub[i])); 107 &dspub[i]));
108 log_duration ("EdDSA", "verify HashCode"); 108 log_duration ("EdDSA", "verify HashCode");
109 109
110 start = GNUNET_TIME_absolute_get (); 110 start = GNUNET_TIME_absolute_get ();
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index 3d3e5216d..93393bd7c 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -513,9 +513,9 @@ queue_ready_task (struct GNUNET_SCHEDULER_Task *task)
513{ 513{
514 enum GNUNET_SCHEDULER_Priority p = check_priority (task->priority); 514 enum GNUNET_SCHEDULER_Priority p = check_priority (task->priority);
515 515
516 GNUNET_CONTAINER_DLL_insert (ready_head[p], 516 GNUNET_CONTAINER_DLL_insert_tail (ready_head[p],
517 ready_tail[p], 517 ready_tail[p],
518 task); 518 task);
519 task->in_ready_list = GNUNET_YES; 519 task->in_ready_list = GNUNET_YES;
520 ready_count++; 520 ready_count++;
521} 521}
@@ -584,28 +584,26 @@ dump_backtrace (struct GNUNET_SCHEDULER_Task *t)
584static void 584static void
585destroy_task (struct GNUNET_SCHEDULER_Task *t) 585destroy_task (struct GNUNET_SCHEDULER_Task *t)
586{ 586{
587 unsigned int i;
588
589 LOG (GNUNET_ERROR_TYPE_DEBUG, 587 LOG (GNUNET_ERROR_TYPE_DEBUG,
590 "destroying task %p\n", 588 "destroying task %p\n",
591 t); 589 t);
592 590
593 if (GNUNET_YES == t->own_handles) 591 if (GNUNET_YES == t->own_handles)
594 { 592 {
595 for (i = 0; i != t->fds_len; ++i) 593 for (unsigned int i = 0; i != t->fds_len; ++i)
596 { 594 {
597 const struct GNUNET_NETWORK_Handle *fd = t->fds[i].fd; 595 const struct GNUNET_NETWORK_Handle *fd = t->fds[i].fd;
598 const struct GNUNET_DISK_FileHandle *fh = t->fds[i].fh; 596 const struct GNUNET_DISK_FileHandle *fh = t->fds[i].fh;
599 if (fd) 597 if (fd)
600 { 598 {
601 GNUNET_NETWORK_socket_free_memory_only_ ((struct 599 GNUNET_NETWORK_socket_free_memory_only_ (
602 GNUNET_NETWORK_Handle *) fd); 600 (struct GNUNET_NETWORK_Handle *) fd);
603 } 601 }
604 if (fh) 602 if (fh)
605 { 603 {
606 // FIXME: on WIN32 this is not enough! A function 604 // FIXME: on WIN32 this is not enough! A function
607 // GNUNET_DISK_file_free_memory_only would be nice 605 // GNUNET_DISK_file_free_memory_only would be nice
608 GNUNET_free ((void *) fh); 606 GNUNET_free_nz ((void *) fh);
609 } 607 }
610 } 608 }
611 } 609 }
diff --git a/src/util/service.c b/src/util/service.c
index 999a9e017..9dc14eba9 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -468,7 +468,6 @@ check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list,
468 const struct in6_addr *ip) 468 const struct in6_addr *ip)
469{ 469{
470 unsigned int i; 470 unsigned int i;
471 unsigned int j;
472 471
473 if (NULL == list) 472 if (NULL == list)
474 return GNUNET_NO; 473 return GNUNET_NO;
@@ -476,7 +475,7 @@ check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list,
476NEXT: 475NEXT:
477 while (0 != GNUNET_is_zero (&list[i].network)) 476 while (0 != GNUNET_is_zero (&list[i].network))
478 { 477 {
479 for (j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++) 478 for (unsigned int j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++)
480 if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) != 479 if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) !=
481 (((int *) &list[i].network)[j] & ((int *) &list[i].netmask)[j])) 480 (((int *) &list[i].network)[j] & ((int *) &list[i].netmask)[j]))
482 { 481 {
diff --git a/src/util/strings.c b/src/util/strings.c
index 4e7451283..9510b3b3b 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -62,25 +62,25 @@
62 * (or number of bytes that would have been written) 62 * (or number of bytes that would have been written)
63 */ 63 */
64size_t 64size_t
65GNUNET_STRINGS_buffer_fill (char *buffer, size_t size, unsigned int count, ...) 65GNUNET_STRINGS_buffer_fill (char *buffer,
66 size_t size,
67 unsigned int count, ...)
66{ 68{
67 size_t needed; 69 size_t needed;
68 size_t slen;
69 const char *s;
70 va_list ap; 70 va_list ap;
71 71
72 needed = 0; 72 needed = 0;
73 va_start (ap, count); 73 va_start (ap, count);
74 while (count > 0) 74 while (count > 0)
75 { 75 {
76 s = va_arg (ap, const char *); 76 const char *s = va_arg (ap, const char *);
77 77 size_t slen = strlen (s) + 1;
78 slen = strlen (s) + 1; 78
79 if (buffer != NULL) 79 GNUNET_assert (slen <= size - needed);
80 { 80 if (NULL != buffer)
81 GNUNET_assert (needed + slen <= size); 81 GNUNET_memcpy (&buffer[needed],
82 GNUNET_memcpy (&buffer[needed], s, slen); 82 s,
83 } 83 slen);
84 needed += slen; 84 needed += slen;
85 count--; 85 count--;
86 } 86 }
@@ -104,6 +104,7 @@ GNUNET_STRINGS_pp2s (const struct GNUNET_PeerIdentity *pids,
104 size_t off; 104 size_t off;
105 size_t plen = num_pids * 5 + 1; 105 size_t plen = num_pids * 5 + 1;
106 106
107 GNUNET_assert (num_pids < UINT32_MAX / 5);
107 off = 0; 108 off = 0;
108 buf = GNUNET_malloc (plen); 109 buf = GNUNET_malloc (plen);
109 for (unsigned int i = 0; i < num_pids; i++) 110 for (unsigned int i = 0; i < num_pids; i++)
@@ -266,11 +267,14 @@ convert_with_table (const char *input,
266 const char *tok; 267 const char *tok;
267 unsigned long long last; 268 unsigned long long last;
268 unsigned int i; 269 unsigned int i;
270 char *sptr;
269 271
270 ret = 0; 272 ret = 0;
271 last = 0; 273 last = 0;
272 in = GNUNET_strdup (input); 274 in = GNUNET_strdup (input);
273 for (tok = strtok (in, " "); tok != NULL; tok = strtok (NULL, " ")) 275 for (tok = strtok_r (in, " ", &sptr);
276 tok != NULL;
277 tok = strtok_r (NULL, " ", &sptr))
274 { 278 {
275 do 279 do
276 { 280 {
@@ -518,9 +522,14 @@ fail:
518 * string is returned. 522 * string is returned.
519 */ 523 */
520char * 524char *
521GNUNET_STRINGS_to_utf8 (const char *input, size_t len, const char *charset) 525GNUNET_STRINGS_to_utf8 (const char *input,
526 size_t len,
527 const char *charset)
522{ 528{
523 return GNUNET_STRINGS_conv (input, len, charset, "UTF-8"); 529 return GNUNET_STRINGS_conv (input,
530 len,
531 charset,
532 "UTF-8");
524} 533}
525 534
526 535
@@ -536,9 +545,14 @@ GNUNET_STRINGS_to_utf8 (const char *input, size_t len, const char *charset)
536 * string is returned. 545 * string is returned.
537 */ 546 */
538char * 547char *
539GNUNET_STRINGS_from_utf8 (const char *input, size_t len, const char *charset) 548GNUNET_STRINGS_from_utf8 (const char *input,
549 size_t len,
550 const char *charset)
540{ 551{
541 return GNUNET_STRINGS_conv (input, len, "UTF-8", charset); 552 return GNUNET_STRINGS_conv (input,
553 len,
554 "UTF-8",
555 charset);
542} 556}
543 557
544 558
@@ -687,7 +701,7 @@ const char *
687GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta, 701GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta,
688 int do_round) 702 int do_round)
689{ 703{
690 static char buf[128]; 704 static GNUNET_THREAD_LOCAL char buf[128];
691 const char *unit = _ (/* time unit */ "µs"); 705 const char *unit = _ (/* time unit */ "µs");
692 uint64_t dval = delta.rel_value_us; 706 uint64_t dval = delta.rel_value_us;
693 707
@@ -741,7 +755,7 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta,
741const char * 755const char *
742GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t) 756GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t)
743{ 757{
744 static char buf[255]; 758 static GNUNET_THREAD_LOCAL char buf[255];
745 time_t tt; 759 time_t tt;
746 struct tm *tp; 760 struct tm *tp;
747 761
@@ -868,6 +882,7 @@ GNUNET_STRINGS_data_to_string (const void *data,
868 unsigned int vbit; 882 unsigned int vbit;
869 const unsigned char *udata; 883 const unsigned char *udata;
870 884
885 GNUNET_assert (size < SIZE_MAX / 8 - 4);
871 udata = data; 886 udata = data;
872 if (out_size < (size * 8 + 4) / 5) 887 if (out_size < (size * 8 + 4) / 5)
873 { 888 {
@@ -927,7 +942,10 @@ GNUNET_STRINGS_data_to_string_alloc (const void *buf, size_t size)
927 len += 5 - len % 5; 942 len += 5 - len % 5;
928 len /= 5; 943 len /= 5;
929 str_buf = GNUNET_malloc (len + 1); 944 str_buf = GNUNET_malloc (len + 1);
930 end = GNUNET_STRINGS_data_to_string (buf, size, str_buf, len); 945 end = GNUNET_STRINGS_data_to_string (buf,
946 size,
947 str_buf,
948 len);
931 if (NULL == end) 949 if (NULL == end)
932 { 950 {
933 GNUNET_free (str_buf); 951 GNUNET_free (str_buf);
@@ -954,14 +972,14 @@ GNUNET_STRINGS_string_to_data (const char *enc,
954 void *out, 972 void *out,
955 size_t out_size) 973 size_t out_size)
956{ 974{
957 unsigned int rpos; 975 size_t rpos;
958 unsigned int wpos; 976 size_t wpos;
959 unsigned int bits; 977 unsigned int bits;
960 unsigned int vbit; 978 unsigned int vbit;
961 int ret; 979 int ret;
962 int shift; 980 int shift;
963 unsigned char *uout; 981 unsigned char *uout;
964 unsigned int encoded_len = out_size * 8; 982 size_t encoded_len;
965 983
966 if (0 == enclen) 984 if (0 == enclen)
967 { 985 {
@@ -969,6 +987,8 @@ GNUNET_STRINGS_string_to_data (const char *enc,
969 return GNUNET_OK; 987 return GNUNET_OK;
970 return GNUNET_SYSERR; 988 return GNUNET_SYSERR;
971 } 989 }
990 GNUNET_assert (out_size < SIZE_MAX / 8);
991 encoded_len = out_size * 8;
972 uout = out; 992 uout = out;
973 wpos = out_size; 993 wpos = out_size;
974 rpos = enclen; 994 rpos = enclen;
@@ -1169,7 +1189,7 @@ GNUNET_STRINGS_check_filename (const char *filename,
1169 & (GNUNET_STRINGS_CHECK_EXISTS | GNUNET_STRINGS_CHECK_IS_DIRECTORY 1189 & (GNUNET_STRINGS_CHECK_EXISTS | GNUNET_STRINGS_CHECK_IS_DIRECTORY
1170 | GNUNET_STRINGS_CHECK_IS_LINK))) 1190 | GNUNET_STRINGS_CHECK_IS_LINK)))
1171 { 1191 {
1172 if (0 != stat (filename, &st)) 1192 if (0 != lstat (filename, &st))
1173 { 1193 {
1174 if (0 != (checks & GNUNET_STRINGS_CHECK_EXISTS)) 1194 if (0 != (checks & GNUNET_STRINGS_CHECK_EXISTS))
1175 return GNUNET_NO; 1195 return GNUNET_NO;
@@ -1401,15 +1421,14 @@ static char *const *
1401_make_continuous_arg_copy (int argc, char *const *argv) 1421_make_continuous_arg_copy (int argc, char *const *argv)
1402{ 1422{
1403 size_t argvsize = 0; 1423 size_t argvsize = 0;
1404 int i;
1405 char **new_argv; 1424 char **new_argv;
1406 char *p; 1425 char *p;
1407 1426
1408 for (i = 0; i < argc; i++) 1427 for (int i = 0; i < argc; i++)
1409 argvsize += strlen (argv[i]) + 1 + sizeof(char *); 1428 argvsize += strlen (argv[i]) + 1 + sizeof(char *);
1410 new_argv = GNUNET_malloc (argvsize + sizeof(char *)); 1429 new_argv = GNUNET_malloc (argvsize + sizeof(char *));
1411 p = (char *) &new_argv[argc + 1]; 1430 p = (char *) &new_argv[argc + 1];
1412 for (i = 0; i < argc; i++) 1431 for (int i = 0; i < argc; i++)
1413 { 1432 {
1414 new_argv[i] = p; 1433 new_argv[i] = p;
1415 strcpy (p, argv[i]); 1434 strcpy (p, argv[i]);
@@ -1859,6 +1878,7 @@ GNUNET_STRINGS_base64_encode (const void *in, size_t len, char **output)
1859 char *opt; 1878 char *opt;
1860 1879
1861 ret = 0; 1880 ret = 0;
1881 GNUNET_assert (len / 4 < SIZE_MAX);
1862 opt = GNUNET_malloc (2 + (len * 4 / 3) + 8); 1882 opt = GNUNET_malloc (2 + (len * 4 / 3) + 8);
1863 for (size_t i = 0; i < len; ++i) 1883 for (size_t i = 0; i < len; ++i)
1864 { 1884 {
@@ -1897,6 +1917,42 @@ GNUNET_STRINGS_base64_encode (const void *in, size_t len, char **output)
1897} 1917}
1898 1918
1899 1919
1920/**
1921 * Encode into Base64url. RFC7515
1922 *
1923 * @param in the data to encode
1924 * @param len the length of the input
1925 * @param output where to write the output (*output should be NULL,
1926 * is allocated)
1927 * @return the size of the output
1928 */
1929size_t
1930GNUNET_STRINGS_base64url_encode (const void *in, size_t len, char **output)
1931{
1932 char *enc;
1933 size_t pos;
1934
1935 GNUNET_STRINGS_base64_encode (in, len, output);
1936 enc = *output;
1937 /* Replace with correct characters for base64url */
1938 pos = 0;
1939 while ('\0' != enc[pos])
1940 {
1941 if ('+' == enc[pos])
1942 enc[pos] = '-';
1943 if ('/' == enc[pos])
1944 enc[pos] = '_';
1945 if ('=' == enc[pos])
1946 {
1947 enc[pos] = '\0';
1948 break;
1949 }
1950 pos++;
1951 }
1952 return strlen (enc);
1953}
1954
1955
1900#define cvtfind(a) \ 1956#define cvtfind(a) \
1901 ((((a) >= 'A') && ((a) <= 'Z')) \ 1957 ((((a) >= 'A') && ((a) <= 'Z')) \
1902 ? (a) - 'A' \ 1958 ? (a) - 'A' \
@@ -1932,6 +1988,7 @@ GNUNET_STRINGS_base64_decode (const char *data, size_t len, void **out)
1932 goto END; \ 1988 goto END; \
1933 } 1989 }
1934 1990
1991 GNUNET_assert (len / 3 < SIZE_MAX);
1935 output = GNUNET_malloc ((len * 3 / 4) + 8); 1992 output = GNUNET_malloc ((len * 3 / 4) + 8);
1936 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1993 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1937 "base64_decode decoding len=%d\n", 1994 "base64_decode decoding len=%d\n",
@@ -1978,4 +2035,57 @@ END:
1978} 2035}
1979 2036
1980 2037
2038/**
2039 * Decode from Base64url. RFC7515
2040 *
2041 * @param data the data to decode
2042 * @param len the length of the input
2043 * @param output where to write the output (*output should be NULL,
2044 * is allocated)
2045 * @return the size of the output
2046 */
2047size_t
2048GNUNET_STRINGS_base64url_decode (const char *data, size_t len, void **out)
2049{
2050 char *s;
2051 int padding;
2052 size_t ret;
2053
2054 /* make enough space for padding */
2055 GNUNET_assert (len < SIZE_MAX - 3);
2056 s = GNUNET_malloc (len + 3);
2057 memcpy (s, data, len);
2058
2059 for (int i = 0; i < strlen (s); i++)
2060 {
2061 if (s[i] == '-')
2062 s[i] = '+';
2063 if (s[i] == '_')
2064 s[i] = '/';
2065 }
2066 padding = len % 4;
2067 switch (padding) // Pad with trailing '='s
2068 {
2069 case 0:
2070 break; // No pad chars in this case
2071 case 2:
2072 memcpy (&s[len],
2073 "==",
2074 2);
2075 len += 2;
2076 break; // Two pad chars
2077 case 3:
2078 s[len] = '=';
2079 len++;
2080 break; // One pad char
2081 default:
2082 GNUNET_assert (0);
2083 break;
2084 }
2085 ret = GNUNET_STRINGS_base64_decode (s, len, out);
2086 GNUNET_free (s);
2087 return ret;
2088}
2089
2090
1981/* end of strings.c */ 2091/* end of strings.c */
diff --git a/src/util/test_common_allocation.c b/src/util/test_common_allocation.c
index e2fc29e82..a24af7124 100644
--- a/src/util/test_common_allocation.c
+++ b/src/util/test_common_allocation.c
@@ -27,7 +27,7 @@
27 27
28 28
29static int 29static int
30check () 30check (void)
31{ 31{
32#define MAX_TESTVAL 1024 32#define MAX_TESTVAL 1024
33 char *ptrs[MAX_TESTVAL]; 33 char *ptrs[MAX_TESTVAL];
@@ -134,6 +134,28 @@ check ()
134} 134}
135 135
136 136
137static int
138check2 (void)
139{
140 char *a1 = NULL;
141 unsigned int a1_len = 0;
142 const char *a2 = "test";
143
144 GNUNET_array_append (a1,
145 a1_len,
146 'x');
147 GNUNET_array_concatenate (a1,
148 a1_len,
149 a2,
150 4);
151 GNUNET_assert (0 == strncmp ("xtest",
152 a1,
153 5));
154 GNUNET_assert (5 == a1_len);
155 return 0;
156}
157
158
137int 159int
138main (int argc, char *argv[]) 160main (int argc, char *argv[])
139{ 161{
@@ -142,7 +164,7 @@ main (int argc, char *argv[])
142 GNUNET_log_setup ("test-common-allocation", 164 GNUNET_log_setup ("test-common-allocation",
143 "WARNING", 165 "WARNING",
144 NULL); 166 NULL);
145 ret = check (); 167 ret = check () | check2 ();
146 if (ret != 0) 168 if (ret != 0)
147 fprintf (stderr, 169 fprintf (stderr,
148 "ERROR %d.\n", 170 "ERROR %d.\n",
diff --git a/src/util/test_crypto_ecdh_ecdsa.c b/src/util/test_crypto_ecdh_ecdsa.c
index 8a581ef73..3cc12de9b 100644
--- a/src/util/test_crypto_ecdh_ecdsa.c
+++ b/src/util/test_crypto_ecdh_ecdsa.c
@@ -32,39 +32,37 @@
32static int 32static int
33test_ecdh () 33test_ecdh ()
34{ 34{
35 struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_dsa; 35 struct GNUNET_CRYPTO_EcdsaPrivateKey priv_dsa;
36 struct GNUNET_CRYPTO_EcdhePrivateKey *priv_ecdh; 36 struct GNUNET_CRYPTO_EcdhePrivateKey priv_ecdh;
37 struct GNUNET_CRYPTO_EcdsaPublicKey id1; 37 struct GNUNET_CRYPTO_EcdsaPublicKey id1;
38 struct GNUNET_CRYPTO_EcdhePublicKey id2; 38 struct GNUNET_CRYPTO_EcdhePublicKey id2;
39 struct GNUNET_HashCode dh[2]; 39 struct GNUNET_HashCode dh[2];
40 40
41 /* Generate keys */ 41 /* Generate keys */
42 priv_dsa = GNUNET_CRYPTO_ecdsa_key_create (); 42 GNUNET_CRYPTO_ecdsa_key_create (&priv_dsa);
43 GNUNET_CRYPTO_ecdsa_key_get_public (priv_dsa, 43 GNUNET_CRYPTO_ecdsa_key_get_public (&priv_dsa,
44 &id1); 44 &id1);
45 for (unsigned int j = 0; j < 4; j++) 45 for (unsigned int j = 0; j < 4; j++)
46 { 46 {
47 fprintf (stderr, ","); 47 fprintf (stderr, ",");
48 priv_ecdh = GNUNET_CRYPTO_ecdhe_key_create (); 48 GNUNET_CRYPTO_ecdhe_key_create (&priv_ecdh);
49 /* Extract public keys */ 49 /* Extract public keys */
50 GNUNET_CRYPTO_ecdhe_key_get_public (priv_ecdh, 50 GNUNET_CRYPTO_ecdhe_key_get_public (&priv_ecdh,
51 &id2); 51 &id2);
52 /* Do ECDH */ 52 /* Do ECDH */
53 GNUNET_assert (GNUNET_OK == 53 GNUNET_assert (GNUNET_OK ==
54 GNUNET_CRYPTO_ecdsa_ecdh (priv_dsa, 54 GNUNET_CRYPTO_ecdsa_ecdh (&priv_dsa,
55 &id2, 55 &id2,
56 &dh[0])); 56 &dh[0]));
57 GNUNET_assert (GNUNET_OK == 57 GNUNET_assert (GNUNET_OK ==
58 GNUNET_CRYPTO_ecdh_ecdsa (priv_ecdh, 58 GNUNET_CRYPTO_ecdh_ecdsa (&priv_ecdh,
59 &id1, 59 &id1,
60 &dh[1])); 60 &dh[1]));
61 /* Check that both DH results are equal. */ 61 /* Check that both DH results are equal. */
62 GNUNET_assert (0 == memcmp (&dh[0], 62 GNUNET_assert (0 ==
63 &dh[1], 63 GNUNET_memcmp (&dh[0],
64 sizeof(struct GNUNET_HashCode))); 64 &dh[1]));
65 GNUNET_free (priv_ecdh);
66 } 65 }
67 GNUNET_free (priv_dsa);
68 return 0; 66 return 0;
69} 67}
70 68
@@ -75,8 +73,7 @@ main (int argc, char *argv[])
75 if (! gcry_check_version ("1.6.0")) 73 if (! gcry_check_version ("1.6.0"))
76 { 74 {
77 fprintf (stderr, 75 fprintf (stderr,
78 _ ( 76 "libgcrypt has not the expected version (version %s is required).\n",
79 "libgcrypt has not the expected version (version %s is required).\n"),
80 "1.6.0"); 77 "1.6.0");
81 return 0; 78 return 0;
82 } 79 }
diff --git a/src/util/test_crypto_ecdh_eddsa.c b/src/util/test_crypto_ecdh_eddsa.c
index 68f8c4671..6efd4d2fe 100644
--- a/src/util/test_crypto_ecdh_eddsa.c
+++ b/src/util/test_crypto_ecdh_eddsa.c
@@ -32,39 +32,37 @@
32static int 32static int
33test_ecdh () 33test_ecdh ()
34{ 34{
35 struct GNUNET_CRYPTO_EddsaPrivateKey *priv_dsa; 35 struct GNUNET_CRYPTO_EddsaPrivateKey priv_dsa;
36 struct GNUNET_CRYPTO_EcdhePrivateKey *priv_ecdh; 36 struct GNUNET_CRYPTO_EcdhePrivateKey priv_ecdh;
37 struct GNUNET_CRYPTO_EddsaPublicKey id1; 37 struct GNUNET_CRYPTO_EddsaPublicKey id1;
38 struct GNUNET_CRYPTO_EcdhePublicKey id2; 38 struct GNUNET_CRYPTO_EcdhePublicKey id2;
39 struct GNUNET_HashCode dh[2]; 39 struct GNUNET_HashCode dh[2];
40 40
41 /* Generate keys */ 41 /* Generate keys */
42 priv_dsa = GNUNET_CRYPTO_eddsa_key_create (); 42 GNUNET_CRYPTO_eddsa_key_create (&priv_dsa);
43 GNUNET_CRYPTO_eddsa_key_get_public (priv_dsa, 43 GNUNET_CRYPTO_eddsa_key_get_public (&priv_dsa,
44 &id1); 44 &id1);
45 for (unsigned int j = 0; j < 4; j++) 45 for (unsigned int j = 0; j < 4; j++)
46 { 46 {
47 fprintf (stderr, ","); 47 fprintf (stderr, ",");
48 priv_ecdh = GNUNET_CRYPTO_ecdhe_key_create (); 48 GNUNET_CRYPTO_ecdhe_key_create (&priv_ecdh);
49 /* Extract public keys */ 49 /* Extract public keys */
50 GNUNET_CRYPTO_ecdhe_key_get_public (priv_ecdh, 50 GNUNET_CRYPTO_ecdhe_key_get_public (&priv_ecdh,
51 &id2); 51 &id2);
52 /* Do ECDH */ 52 /* Do ECDH */
53 GNUNET_assert (GNUNET_OK == 53 GNUNET_assert (GNUNET_OK ==
54 GNUNET_CRYPTO_eddsa_ecdh (priv_dsa, 54 GNUNET_CRYPTO_eddsa_ecdh (&priv_dsa,
55 &id2, 55 &id2,
56 &dh[0])); 56 &dh[0]));
57 GNUNET_assert (GNUNET_OK == 57 GNUNET_assert (GNUNET_OK ==
58 GNUNET_CRYPTO_ecdh_eddsa (priv_ecdh, 58 GNUNET_CRYPTO_ecdh_eddsa (&priv_ecdh,
59 &id1, 59 &id1,
60 &dh[1])); 60 &dh[1]));
61 /* Check that both DH results are equal. */ 61 /* Check that both DH results are equal. */
62 GNUNET_assert (0 == memcmp (&dh[0], 62 GNUNET_assert (0 ==
63 &dh[1], 63 GNUNET_memcmp (&dh[0],
64 sizeof(struct GNUNET_HashCode))); 64 &dh[1]));
65 GNUNET_free (priv_ecdh);
66 } 65 }
67 GNUNET_free (priv_dsa);
68 return 0; 66 return 0;
69} 67}
70 68
diff --git a/src/util/test_crypto_ecdhe.c b/src/util/test_crypto_ecdhe.c
index 6f91be746..1144f1fe5 100644
--- a/src/util/test_crypto_ecdhe.c
+++ b/src/util/test_crypto_ecdhe.c
@@ -31,8 +31,8 @@
31int 31int
32main (int argc, char *argv[]) 32main (int argc, char *argv[])
33{ 33{
34 struct GNUNET_CRYPTO_EcdhePrivateKey *priv1; 34 struct GNUNET_CRYPTO_EcdhePrivateKey priv1;
35 struct GNUNET_CRYPTO_EcdhePrivateKey *priv2; 35 struct GNUNET_CRYPTO_EcdhePrivateKey priv2;
36 struct GNUNET_CRYPTO_EcdhePublicKey pub1; 36 struct GNUNET_CRYPTO_EcdhePublicKey pub1;
37 struct GNUNET_CRYPTO_EcdhePublicKey pub2; 37 struct GNUNET_CRYPTO_EcdhePublicKey pub2;
38 struct GNUNET_HashCode ecdh1; 38 struct GNUNET_HashCode ecdh1;
@@ -41,9 +41,7 @@ main (int argc, char *argv[])
41 if (! gcry_check_version ("1.6.0")) 41 if (! gcry_check_version ("1.6.0"))
42 { 42 {
43 fprintf (stderr, 43 fprintf (stderr,
44 _ 44 "libgcrypt has not the expected version (version %s is required).\n",
45 (
46 "libgcrypt has not the expected version (version %s is required).\n"),
47 "1.6.0"); 45 "1.6.0");
48 return 0; 46 return 0;
49 } 47 }
@@ -55,16 +53,15 @@ main (int argc, char *argv[])
55 { 53 {
56 fprintf (stderr, 54 fprintf (stderr,
57 "."); 55 ".");
58 priv1 = GNUNET_CRYPTO_ecdhe_key_create (); 56 GNUNET_CRYPTO_ecdhe_key_create (&priv1);
59 priv2 = GNUNET_CRYPTO_ecdhe_key_create (); 57 GNUNET_CRYPTO_ecdhe_key_create (&priv2);
60 GNUNET_CRYPTO_ecdhe_key_get_public (priv1, &pub1); 58 GNUNET_CRYPTO_ecdhe_key_get_public (&priv1, &pub1);
61 GNUNET_CRYPTO_ecdhe_key_get_public (priv2, &pub2); 59 GNUNET_CRYPTO_ecdhe_key_get_public (&priv2, &pub2);
62 GNUNET_CRYPTO_ecc_ecdh (priv1, &pub2, &ecdh1); 60 GNUNET_CRYPTO_ecc_ecdh (&priv1, &pub2, &ecdh1);
63 GNUNET_CRYPTO_ecc_ecdh (priv2, &pub1, &ecdh2); 61 GNUNET_CRYPTO_ecc_ecdh (&priv2, &pub1, &ecdh2);
64 GNUNET_assert (0 == memcmp (&ecdh1, &ecdh2, 62 GNUNET_assert (0 ==
65 sizeof(struct GNUNET_HashCode))); 63 GNUNET_memcmp (&ecdh1,
66 GNUNET_free (priv1); 64 &ecdh2));
67 GNUNET_free (priv2);
68 } 65 }
69 return 0; 66 return 0;
70} 67}
diff --git a/src/util/test_crypto_ecdsa.c b/src/util/test_crypto_ecdsa.c
index 826097d52..cfa236d6d 100644
--- a/src/util/test_crypto_ecdsa.c
+++ b/src/util/test_crypto_ecdsa.c
@@ -33,62 +33,74 @@
33#define PERF GNUNET_YES 33#define PERF GNUNET_YES
34 34
35 35
36static struct GNUNET_CRYPTO_EcdsaPrivateKey *key; 36static struct GNUNET_CRYPTO_EcdsaPrivateKey key;
37 37
38 38
39static int 39static int
40testSignVerify () 40testSignVerify (void)
41{ 41{
42 struct GNUNET_CRYPTO_EcdsaSignature sig; 42 struct GNUNET_CRYPTO_EcdsaSignature sig;
43 struct GNUNET_CRYPTO_EccSignaturePurpose purp; 43 struct GNUNET_CRYPTO_EccSignaturePurpose purp;
44 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 44 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
45 int i;
46 struct GNUNET_TIME_Absolute start; 45 struct GNUNET_TIME_Absolute start;
47 int ok = GNUNET_OK; 46 int ok = GNUNET_OK;
48 47
49 fprintf (stderr, "%s", "W"); 48 fprintf (stderr, "%s", "W");
50 GNUNET_CRYPTO_ecdsa_key_get_public (key, &pkey); 49 GNUNET_CRYPTO_ecdsa_key_get_public (&key,
50 &pkey);
51 start = GNUNET_TIME_absolute_get (); 51 start = GNUNET_TIME_absolute_get ();
52 purp.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)); 52 purp.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose));
53 purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); 53 purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
54 54
55 for (i = 0; i < ITER; i++) 55 for (unsigned int i = 0; i < ITER; i++)
56 { 56 {
57 fprintf (stderr, "%s", "."); fflush (stderr); 57 fprintf (stderr, "%s", ".");
58 if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_sign (key, &purp, &sig)) 58 fflush (stderr);
59 if (GNUNET_SYSERR ==
60 GNUNET_CRYPTO_ecdsa_sign_ (&key,
61 &purp,
62 &sig))
59 { 63 {
60 fprintf (stderr, 64 fprintf (stderr,
61 "%s",
62 "GNUNET_CRYPTO_ecdsa_sign returned SYSERR\n"); 65 "GNUNET_CRYPTO_ecdsa_sign returned SYSERR\n");
63 ok = GNUNET_SYSERR; 66 ok = GNUNET_SYSERR;
64 continue; 67 continue;
65 } 68 }
66 if (GNUNET_SYSERR == 69 if (GNUNET_SYSERR ==
67 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_TEST, &purp, &sig, 70 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_TEST,
68 &pkey)) 71 &purp,
72 &sig,
73 &pkey))
69 { 74 {
70 printf ("GNUNET_CRYPTO_ecdsa_verify failed!\n"); 75 fprintf (stderr,
76 "GNUNET_CRYPTO_ecdsa_verify failed!\n");
71 ok = GNUNET_SYSERR; 77 ok = GNUNET_SYSERR;
72 continue; 78 continue;
73 } 79 }
74 if (GNUNET_SYSERR != 80 if (GNUNET_SYSERR !=
75 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, 81 GNUNET_CRYPTO_ecdsa_verify_ (
76 &purp, &sig, &pkey)) 82 GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN,
83 &purp,
84 &sig,
85 &pkey))
77 { 86 {
78 printf ("GNUNET_CRYPTO_ecdsa_verify failed to fail!\n"); 87 fprintf (stderr,
88 "GNUNET_CRYPTO_ecdsa_verify failed to fail!\n");
79 ok = GNUNET_SYSERR; 89 ok = GNUNET_SYSERR;
80 continue; 90 continue;
81 } 91 }
82 } 92 }
83 printf ("%d ECDSA sign/verify operations %s\n", ITER, 93 printf ("%d ECDSA sign/verify operations %s\n",
94 ITER,
84 GNUNET_STRINGS_relative_time_to_string ( 95 GNUNET_STRINGS_relative_time_to_string (
85 GNUNET_TIME_absolute_get_duration (start), GNUNET_YES)); 96 GNUNET_TIME_absolute_get_duration (start),
97 GNUNET_YES));
86 return ok; 98 return ok;
87} 99}
88 100
89 101
90static int 102static int
91testDeriveSignVerify () 103testDeriveSignVerify (void)
92{ 104{
93 struct GNUNET_CRYPTO_EcdsaSignature sig; 105 struct GNUNET_CRYPTO_EcdsaSignature sig;
94 struct GNUNET_CRYPTO_EccSignaturePurpose purp; 106 struct GNUNET_CRYPTO_EccSignaturePurpose purp;
@@ -96,43 +108,57 @@ testDeriveSignVerify ()
96 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 108 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
97 struct GNUNET_CRYPTO_EcdsaPublicKey dpub; 109 struct GNUNET_CRYPTO_EcdsaPublicKey dpub;
98 110
99 dpriv = GNUNET_CRYPTO_ecdsa_private_key_derive (key, "test-derive", 111 dpriv = GNUNET_CRYPTO_ecdsa_private_key_derive (&key,
112 "test-derive",
100 "test-CTX"); 113 "test-CTX");
101 GNUNET_CRYPTO_ecdsa_key_get_public (key, &pkey); 114 GNUNET_CRYPTO_ecdsa_key_get_public (&key,
102 GNUNET_CRYPTO_ecdsa_public_key_derive (&pkey, "test-derive", "test-CTX", 115 &pkey);
116 GNUNET_CRYPTO_ecdsa_public_key_derive (&pkey,
117 "test-derive",
118 "test-CTX",
103 &dpub); 119 &dpub);
104 purp.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)); 120 purp.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose));
105 purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); 121 purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
106 122
107 if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_sign (dpriv, &purp, &sig)) 123 if (GNUNET_SYSERR ==
124 GNUNET_CRYPTO_ecdsa_sign_ (dpriv,
125 &purp,
126 &sig))
108 { 127 {
109 fprintf (stderr, "%s", "GNUNET_CRYPTO_ecdsa_sign returned SYSERR\n"); 128 fprintf (stderr, "%s", "GNUNET_CRYPTO_ecdsa_sign returned SYSERR\n");
110 GNUNET_free (dpriv); 129 GNUNET_free (dpriv);
111 return GNUNET_SYSERR; 130 return GNUNET_SYSERR;
112 } 131 }
113 if (GNUNET_SYSERR == 132 if (GNUNET_SYSERR ==
114 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_TEST, 133 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_TEST,
115 &purp, &sig, 134 &purp,
116 &dpub)) 135 &sig,
136 &dpub))
117 { 137 {
118 printf ("GNUNET_CRYPTO_ecdsa_verify failed!\n"); 138 fprintf (stderr,
139 "GNUNET_CRYPTO_ecdsa_verify failed!\n");
119 GNUNET_free (dpriv); 140 GNUNET_free (dpriv);
120 return GNUNET_SYSERR; 141 return GNUNET_SYSERR;
121 } 142 }
122 if (GNUNET_SYSERR != 143 if (GNUNET_SYSERR !=
123 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_TEST, 144 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_TEST,
124 &purp, &sig, 145 &purp,
125 &pkey)) 146 &sig,
147 &pkey))
126 { 148 {
127 printf ("GNUNET_CRYPTO_ecdsa_verify failed to fail!\n"); 149 fprintf (stderr,
150 "GNUNET_CRYPTO_ecdsa_verify failed to fail!\n");
128 GNUNET_free (dpriv); 151 GNUNET_free (dpriv);
129 return GNUNET_SYSERR; 152 return GNUNET_SYSERR;
130 } 153 }
131 if (GNUNET_SYSERR != 154 if (GNUNET_SYSERR !=
132 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, 155 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN,
133 &purp, &sig, &dpub)) 156 &purp,
157 &sig,
158 &dpub))
134 { 159 {
135 printf ("GNUNET_CRYPTO_ecdsa_verify failed to fail!\n"); 160 fprintf (stderr,
161 "GNUNET_CRYPTO_ecdsa_verify failed to fail!\n");
136 GNUNET_free (dpriv); 162 GNUNET_free (dpriv);
137 return GNUNET_SYSERR; 163 return GNUNET_SYSERR;
138 } 164 }
@@ -143,7 +169,7 @@ testDeriveSignVerify ()
143 169
144#if PERF 170#if PERF
145static int 171static int
146testSignPerformance () 172testSignPerformance (void)
147{ 173{
148 struct GNUNET_CRYPTO_EccSignaturePurpose purp; 174 struct GNUNET_CRYPTO_EccSignaturePurpose purp;
149 struct GNUNET_CRYPTO_EcdsaSignature sig; 175 struct GNUNET_CRYPTO_EcdsaSignature sig;
@@ -160,7 +186,7 @@ testSignPerformance ()
160 for (i = 0; i < ITER; i++) 186 for (i = 0; i < ITER; i++)
161 { 187 {
162 fprintf (stderr, "%s", "."); fflush (stderr); 188 fprintf (stderr, "%s", "."); fflush (stderr);
163 if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_sign (key, &purp, &sig)) 189 if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_sign_ (key, &purp, &sig))
164 { 190 {
165 fprintf (stderr, "%s", 191 fprintf (stderr, "%s",
166 "GNUNET_CRYPTO_ecdsa_sign returned SYSERR\n"); 192 "GNUNET_CRYPTO_ecdsa_sign returned SYSERR\n");
@@ -180,26 +206,24 @@ testSignPerformance ()
180 206
181 207
182static void 208static void
183perf_keygen () 209perf_keygen (void)
184{ 210{
185 struct GNUNET_TIME_Absolute start; 211 struct GNUNET_TIME_Absolute start;
186 struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; 212 struct GNUNET_CRYPTO_EcdsaPrivateKey pk;
187 int i;
188 213
189 fprintf (stderr, "%s", "W"); 214 fprintf (stderr, "%s", "W");
190 start = GNUNET_TIME_absolute_get (); 215 start = GNUNET_TIME_absolute_get ();
191 for (i = 0; i < 10; i++) 216 for (unsigned int i = 0; i < 10; i++)
192 { 217 {
193 fprintf (stderr, "."); fflush (stderr);
194 pk = GNUNET_CRYPTO_ecdsa_key_create ();
195 GNUNET_free (pk);
196 }
197 for (; i < 25; i++)
198 fprintf (stderr, "."); 218 fprintf (stderr, ".");
219 fflush (stderr);
220 GNUNET_CRYPTO_ecdsa_key_create (&pk);
221 }
199 fflush (stderr); 222 fflush (stderr);
200 printf ("10 ECDSA keys created in %s\n", 223 printf ("10 ECDSA keys created in %s\n",
201 GNUNET_STRINGS_relative_time_to_string ( 224 GNUNET_STRINGS_relative_time_to_string (
202 GNUNET_TIME_absolute_get_duration (start), GNUNET_YES)); 225 GNUNET_TIME_absolute_get_duration (start),
226 GNUNET_YES));
203} 227}
204 228
205 229
@@ -211,16 +235,14 @@ main (int argc, char *argv[])
211 if (! gcry_check_version ("1.6.0")) 235 if (! gcry_check_version ("1.6.0"))
212 { 236 {
213 fprintf (stderr, 237 fprintf (stderr,
214 _ 238 "libgcrypt has not the expected version (version %s is required).\n",
215 (
216 "libgcrypt has not the expected version (version %s is required).\n"),
217 "1.6.0"); 239 "1.6.0");
218 return 0; 240 return 0;
219 } 241 }
220 if (getenv ("GNUNET_GCRYPT_DEBUG")) 242 if (getenv ("GNUNET_GCRYPT_DEBUG"))
221 gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0); 243 gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0);
222 GNUNET_log_setup ("test-crypto-ecc", "WARNING", NULL); 244 GNUNET_log_setup ("test-crypto-ecc", "WARNING", NULL);
223 key = GNUNET_CRYPTO_ecdsa_key_create (); 245 GNUNET_CRYPTO_ecdsa_key_create (&key);
224 if (GNUNET_OK != testDeriveSignVerify ()) 246 if (GNUNET_OK != testDeriveSignVerify ())
225 { 247 {
226 failure_count++; 248 failure_count++;
@@ -234,7 +256,6 @@ main (int argc, char *argv[])
234#endif 256#endif
235 if (GNUNET_OK != testSignVerify ()) 257 if (GNUNET_OK != testSignVerify ())
236 failure_count++; 258 failure_count++;
237 GNUNET_free (key);
238 perf_keygen (); 259 perf_keygen ();
239 260
240 if (0 != failure_count) 261 if (0 != failure_count)
diff --git a/src/util/test_crypto_eddsa.c b/src/util/test_crypto_eddsa.c
index c0ad387e1..5baf696b1 100644
--- a/src/util/test_crypto_eddsa.c
+++ b/src/util/test_crypto_eddsa.c
@@ -35,11 +35,11 @@
35#define PERF GNUNET_YES 35#define PERF GNUNET_YES
36 36
37 37
38static struct GNUNET_CRYPTO_EddsaPrivateKey *key; 38static struct GNUNET_CRYPTO_EddsaPrivateKey key;
39 39
40 40
41static int 41static int
42testSignVerify () 42testSignVerify (void)
43{ 43{
44 struct GNUNET_CRYPTO_EddsaSignature sig; 44 struct GNUNET_CRYPTO_EddsaSignature sig;
45 struct GNUNET_CRYPTO_EccSignaturePurpose purp; 45 struct GNUNET_CRYPTO_EccSignaturePurpose purp;
@@ -48,7 +48,8 @@ testSignVerify ()
48 int ok = GNUNET_OK; 48 int ok = GNUNET_OK;
49 49
50 fprintf (stderr, "%s", "W"); 50 fprintf (stderr, "%s", "W");
51 GNUNET_CRYPTO_eddsa_key_get_public (key, &pkey); 51 GNUNET_CRYPTO_eddsa_key_get_public (&key,
52 &pkey);
52 start = GNUNET_TIME_absolute_get (); 53 start = GNUNET_TIME_absolute_get ();
53 purp.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)); 54 purp.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose));
54 purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); 55 purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
@@ -56,33 +57,45 @@ testSignVerify ()
56 for (unsigned int i = 0; i < ITER; i++) 57 for (unsigned int i = 0; i < ITER; i++)
57 { 58 {
58 fprintf (stderr, "%s", "."); fflush (stderr); 59 fprintf (stderr, "%s", "."); fflush (stderr);
59 if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_sign (key, &purp, &sig)) 60 if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_sign_ (&key,
61 &purp,
62 &sig))
60 { 63 {
61 fprintf (stderr, "%s", "GNUNET_CRYPTO_eddsa_sign returned SYSERR\n"); 64 fprintf (stderr,
65 "GNUNET_CRYPTO_eddsa_sign returned SYSERR\n");
62 ok = GNUNET_SYSERR; 66 ok = GNUNET_SYSERR;
63 continue; 67 continue;
64 } 68 }
65 if (GNUNET_SYSERR == 69 if (GNUNET_SYSERR ==
66 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TEST, &purp, &sig, 70 GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_TEST,
67 &pkey)) 71 &purp,
72 &sig,
73 &pkey))
68 { 74 {
69 printf ("GNUNET_CRYPTO_eddsa_verify failed!\n"); 75 fprintf (stderr,
76 "GNUNET_CRYPTO_eddsa_verify failed!\n");
70 ok = GNUNET_SYSERR; 77 ok = GNUNET_SYSERR;
71 continue; 78 continue;
72 } 79 }
73 if (GNUNET_SYSERR != 80 if (GNUNET_SYSERR !=
74 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, 81 GNUNET_CRYPTO_eddsa_verify_ (
75 &purp, &sig, &pkey)) 82 GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN,
83 &purp,
84 &sig,
85 &pkey))
76 { 86 {
77 printf ("GNUNET_CRYPTO_eddsa_verify failed to fail!\n"); 87 fprintf (stderr,
88 "GNUNET_CRYPTO_eddsa_verify failed to fail!\n");
78 ok = GNUNET_SYSERR; 89 ok = GNUNET_SYSERR;
79 continue; 90 continue;
80 } 91 }
81 } 92 }
82 fprintf (stderr, "\n"); 93 fprintf (stderr, "\n");
83 printf ("%d EdDSA sign/verify operations %s\n", ITER, 94 printf ("%d EdDSA sign/verify operations %s\n",
95 ITER,
84 GNUNET_STRINGS_relative_time_to_string ( 96 GNUNET_STRINGS_relative_time_to_string (
85 GNUNET_TIME_absolute_get_duration (start), GNUNET_YES)); 97 GNUNET_TIME_absolute_get_duration (start),
98 GNUNET_YES));
86 return ok; 99 return ok;
87} 100}
88 101
@@ -100,12 +113,17 @@ testSignPerformance ()
100 purp.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)); 113 purp.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose));
101 purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); 114 purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
102 fprintf (stderr, "%s", "W"); 115 fprintf (stderr, "%s", "W");
103 GNUNET_CRYPTO_eddsa_key_get_public (key, &pkey); 116 GNUNET_CRYPTO_eddsa_key_get_public (&key,
117 &pkey);
104 start = GNUNET_TIME_absolute_get (); 118 start = GNUNET_TIME_absolute_get ();
105 for (unsigned int i = 0; i < ITER; i++) 119 for (unsigned int i = 0; i < ITER; i++)
106 { 120 {
107 fprintf (stderr, "%s", "."); fflush (stderr); 121 fprintf (stderr, "%s", ".");
108 if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_sign (key, &purp, &sig)) 122 fflush (stderr);
123 if (GNUNET_SYSERR ==
124 GNUNET_CRYPTO_eddsa_sign_ (&key,
125 &purp,
126 &sig))
109 { 127 {
110 fprintf (stderr, "%s", "GNUNET_CRYPTO_eddsa_sign returned SYSERR\n"); 128 fprintf (stderr, "%s", "GNUNET_CRYPTO_eddsa_sign returned SYSERR\n");
111 ok = GNUNET_SYSERR; 129 ok = GNUNET_SYSERR;
@@ -113,7 +131,8 @@ testSignPerformance ()
113 } 131 }
114 } 132 }
115 fprintf (stderr, "\n"); 133 fprintf (stderr, "\n");
116 printf ("%d EdDSA sign operations %s\n", ITER, 134 printf ("%d EdDSA sign operations %s\n",
135 ITER,
117 GNUNET_STRINGS_relative_time_to_string ( 136 GNUNET_STRINGS_relative_time_to_string (
118 GNUNET_TIME_absolute_get_duration (start), 137 GNUNET_TIME_absolute_get_duration (start),
119 GNUNET_YES)); 138 GNUNET_YES));
@@ -125,43 +144,53 @@ testSignPerformance ()
125 144
126 145
127static int 146static int
128testCreateFromFile () 147testCreateFromFile (void)
129{ 148{
130 struct GNUNET_CRYPTO_EddsaPublicKey p1; 149 struct GNUNET_CRYPTO_EddsaPublicKey p1;
131 struct GNUNET_CRYPTO_EddsaPublicKey p2; 150 struct GNUNET_CRYPTO_EddsaPublicKey p2;
132 151
133 key = GNUNET_CRYPTO_eddsa_key_create_from_file (KEYFILE); 152 GNUNET_assert (0 <=
134 GNUNET_assert (NULL != key); 153 GNUNET_CRYPTO_eddsa_key_from_file (KEYFILE,
135 GNUNET_CRYPTO_eddsa_key_get_public (key, &p1); 154 GNUNET_YES,
136 GNUNET_free (key); 155 &key));
137 key = GNUNET_CRYPTO_eddsa_key_create_from_file (KEYFILE); 156 GNUNET_CRYPTO_eddsa_key_get_public (&key,
138 GNUNET_assert (NULL != key); 157 &p1);
139 GNUNET_CRYPTO_eddsa_key_get_public (key, &p2); 158 GNUNET_assert (GNUNET_NO ==
140 GNUNET_assert (0 == memcmp (&p1, &p2, sizeof(p1))); 159 GNUNET_CRYPTO_eddsa_key_from_file (KEYFILE,
141 GNUNET_free (key); 160 GNUNET_YES,
161 &key));
162 GNUNET_CRYPTO_eddsa_key_get_public (&key,
163 &p2);
164 GNUNET_assert (0 ==
165 GNUNET_memcmp (&p1,
166 &p2));
142 GNUNET_assert (0 == unlink (KEYFILE)); 167 GNUNET_assert (0 == unlink (KEYFILE));
143 key = GNUNET_CRYPTO_eddsa_key_create_from_file (KEYFILE); 168 GNUNET_assert (GNUNET_OK ==
144 GNUNET_assert (NULL != key); 169 GNUNET_CRYPTO_eddsa_key_from_file (KEYFILE,
145 GNUNET_CRYPTO_eddsa_key_get_public (key, &p2); 170 GNUNET_NO,
146 GNUNET_assert (0 != memcmp (&p1, &p2, sizeof(p1))); 171 &key));
147 GNUNET_free (key); 172 GNUNET_CRYPTO_eddsa_key_get_public (&key,
173 &p2);
174 GNUNET_assert (0 !=
175 GNUNET_memcmp (&p1,
176 &p2));
148 return GNUNET_OK; 177 return GNUNET_OK;
149} 178}
150 179
151 180
152static void 181static void
153perf_keygen () 182perf_keygen (void)
154{ 183{
155 struct GNUNET_TIME_Absolute start; 184 struct GNUNET_TIME_Absolute start;
156 struct GNUNET_CRYPTO_EddsaPrivateKey *pk; 185 struct GNUNET_CRYPTO_EddsaPrivateKey pk;
157 186
158 fprintf (stderr, "%s", "W"); 187 fprintf (stderr, "%s", "W");
159 start = GNUNET_TIME_absolute_get (); 188 start = GNUNET_TIME_absolute_get ();
160 for (unsigned int i = 0; i < 10; i++) 189 for (unsigned int i = 0; i < 10; i++)
161 { 190 {
162 fprintf (stderr, "."); fflush (stderr); 191 fprintf (stderr, ".");
163 pk = GNUNET_CRYPTO_eddsa_key_create (); 192 fflush (stderr);
164 GNUNET_free (pk); 193 GNUNET_CRYPTO_eddsa_key_create (&pk);
165 } 194 }
166 fprintf (stderr, "\n"); 195 fprintf (stderr, "\n");
167 printf ("10 EdDSA keys created in %s\n", 196 printf ("10 EdDSA keys created in %s\n",
@@ -178,22 +207,22 @@ main (int argc, char *argv[])
178 if (! gcry_check_version ("1.6.0")) 207 if (! gcry_check_version ("1.6.0"))
179 { 208 {
180 fprintf (stderr, 209 fprintf (stderr,
181 _ ( 210 "libgcrypt has not the expected version (version %s is required).\n",
182 "libgcrypt has not the expected version (version %s is required).\n"),
183 "1.6.0"); 211 "1.6.0");
184 return 0; 212 return 0;
185 } 213 }
186 if (getenv ("GNUNET_GCRYPT_DEBUG")) 214 if (getenv ("GNUNET_GCRYPT_DEBUG"))
187 gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0); 215 gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0);
188 GNUNET_log_setup ("test-crypto-eddsa", "WARNING", NULL); 216 GNUNET_log_setup ("test-crypto-eddsa",
189 key = GNUNET_CRYPTO_eddsa_key_create (); 217 "WARNING",
218 NULL);
219 GNUNET_CRYPTO_eddsa_key_create (&key);
190#if PERF 220#if PERF
191 if (GNUNET_OK != testSignPerformance ()) 221 if (GNUNET_OK != testSignPerformance ())
192 failure_count++; 222 failure_count++;
193#endif 223#endif
194 if (GNUNET_OK != testSignVerify ()) 224 if (GNUNET_OK != testSignVerify ())
195 failure_count++; 225 failure_count++;
196 GNUNET_free (key);
197 if (GNUNET_OK != testCreateFromFile ()) 226 if (GNUNET_OK != testCreateFromFile ())
198 failure_count++; 227 failure_count++;
199 GNUNET_assert (0 == unlink (KEYFILE)); 228 GNUNET_assert (0 == unlink (KEYFILE));
diff --git a/src/util/test_crypto_rsa.c b/src/util/test_crypto_rsa.c
index 277f58ba0..2a676c711 100644
--- a/src/util/test_crypto_rsa.c
+++ b/src/util/test_crypto_rsa.c
@@ -46,7 +46,7 @@ main (int argc,
46 struct GNUNET_CRYPTO_RsaSignature *bsig; 46 struct GNUNET_CRYPTO_RsaSignature *bsig;
47 struct GNUNET_CRYPTO_RsaBlindingKeySecret bsec; 47 struct GNUNET_CRYPTO_RsaBlindingKeySecret bsec;
48 struct GNUNET_HashCode hash; 48 struct GNUNET_HashCode hash;
49 char *blind_buf; 49 void *blind_buf;
50 size_t bsize; 50 size_t bsize;
51 51
52 GNUNET_log_setup ("test-rsa", "WARNING", NULL); 52 GNUNET_log_setup ("test-rsa", "WARNING", NULL);
@@ -64,7 +64,7 @@ main (int argc,
64 64
65 /* Encoding */ 65 /* Encoding */
66 size_t size; 66 size_t size;
67 char *enc; 67 void *enc;
68 enc = NULL; 68 enc = NULL;
69 size = GNUNET_CRYPTO_rsa_private_key_encode (priv, &enc); 69 size = GNUNET_CRYPTO_rsa_private_key_encode (priv, &enc);
70 70
@@ -90,7 +90,7 @@ main (int argc,
90 GNUNET_assert (GNUNET_OK == 90 GNUNET_assert (GNUNET_OK ==
91 GNUNET_CRYPTO_rsa_verify (&hash, sig, pub_copy)); 91 GNUNET_CRYPTO_rsa_verify (&hash, sig, pub_copy));
92 { 92 {
93 char *buf; 93 void *buf;
94 size_t buf_size; 94 size_t buf_size;
95 struct GNUNET_CRYPTO_RsaPublicKey *pub2; 95 struct GNUNET_CRYPTO_RsaPublicKey *pub2;
96 struct GNUNET_CRYPTO_RsaSignature *sig2; 96 struct GNUNET_CRYPTO_RsaSignature *sig2;
diff --git a/src/util/test_scheduler.c b/src/util/test_scheduler.c
index 02a70a560..471ca64e5 100644
--- a/src/util/test_scheduler.c
+++ b/src/util/test_scheduler.c
@@ -234,7 +234,7 @@ taskSig (void *cls)
234 * checks that "ok" is correct at the end. 234 * checks that "ok" is correct at the end.
235 */ 235 */
236static int 236static int
237checkSignal () 237checkSignal (void)
238{ 238{
239 int ok; 239 int ok;
240 240
diff --git a/src/util/tweetnacl-gnunet.c b/src/util/tweetnacl-gnunet.c
deleted file mode 100644
index f01667adb..000000000
--- a/src/util/tweetnacl-gnunet.c
+++ /dev/null
@@ -1,560 +0,0 @@
1/*
2 This file has been placed in the public domain.
3
4 Based on TweetNaCl version 20140427
5
6 Originally obtained from:
7 https://tweetnacl.cr.yp.to/20140427/tweetnacl.h
8
9 SPDX-License-Identifier: 0BSD
10*/
11
12#include "platform.h"
13#include "gnunet_crypto_lib.h"
14#include "tweetnacl-gnunet.h"
15#define FOR(i,n) for (i = 0; i < n; ++i)
16
17typedef uint8_t u8;
18typedef uint32_t u32;
19typedef uint64_t u64;
20typedef int64_t i64;
21typedef i64 gf[16];
22
23static const u8 _9[32] = {9};
24static const gf
25 gf0,
26 gf1 = {1},
27 _121665 = {0xDB41,1},
28 D = {0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898,
29 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203},
30 D2 = {0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130,
31 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406},
32 X = {0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c,
33 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169},
34 Y = {0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666,
35 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666},
36 I = {0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7,
37 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83};
38
39static int
40vn (const u8 *x,const u8 *y,int n)
41{
42 u32 i,d = 0;
43 FOR (i,n) d |= x[i] ^ y[i];
44 return (1 & ((d - 1) >> 8)) - 1;
45}
46
47static int
48crypto_verify_32 (const u8 *x,const u8 *y)
49{
50 return vn (x,y,32);
51}
52
53static void
54set25519 (gf r, const gf a)
55{
56 int i;
57 FOR (i,16) r[i] = a[i];
58}
59
60static void
61car25519 (gf o)
62{
63 int i;
64 i64 c;
65 FOR (i,16) {
66 o[i] += (1LL << 16);
67 c = o[i] >> 16;
68 o[(i + 1) * (i<15)] += c - 1 + 37 * (c - 1) * (i==15);
69 o[i] -= c << 16;
70 }
71}
72
73static void
74sel25519 (gf p,gf q,int b)
75{
76 i64 t,i,c = ~(b - 1);
77 FOR (i,16) {
78 t = c & (p[i] ^ q[i]);
79 p[i] ^= t;
80 q[i] ^= t;
81 }
82}
83
84static void
85pack25519 (u8 *o,const gf n)
86{
87 int i,j,b;
88 gf m,t;
89 FOR (i,16) t[i] = n[i];
90 car25519 (t);
91 car25519 (t);
92 car25519 (t);
93 FOR (j,2) {
94 m[0] = t[0] - 0xffed;
95 for (i = 1; i<15; i++) {
96 m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1);
97 m[i - 1] &= 0xffff;
98 }
99 m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1);
100 b = (m[15] >> 16) & 1;
101 m[14] &= 0xffff;
102 sel25519 (t,m,1 - b);
103 }
104 FOR (i,16) {
105 o[2 * i] = t[i] & 0xff;
106 o[2 * i + 1] = t[i] >> 8;
107 }
108}
109
110static int
111neq25519 (const gf a, const gf b)
112{
113 u8 c[32],d[32];
114 pack25519 (c,a);
115 pack25519 (d,b);
116 return crypto_verify_32 (c,d);
117}
118
119static uint8_t
120par25519 (const gf a)
121{
122 u8 d[32];
123 pack25519 (d,a);
124 return d[0] & 1;
125}
126
127static void
128unpack25519 (gf o, const u8 *n)
129{
130 int i;
131 FOR (i,16) o[i] = n[2 * i] + ((i64) n[2 * i + 1] << 8);
132 o[15] &= 0x7fff;
133}
134
135static void
136A (gf o,const gf a,const gf b)
137{
138 int i;
139 FOR (i,16) o[i] = a[i] + b[i];
140}
141
142static void
143Z (gf o,const gf a,const gf b)
144{
145 int i;
146 FOR (i,16) o[i] = a[i] - b[i];
147}
148
149static void
150M (gf o,const gf a,const gf b)
151{
152 i64 i,j,t[31];
153 FOR (i,31) t[i] = 0;
154 FOR (i,16) FOR (j,16) t[i + j] += a[i] * b[j];
155 FOR (i,15) t[i] += 38 * t[i + 16];
156 FOR (i,16) o[i] = t[i];
157 car25519 (o);
158 car25519 (o);
159}
160
161static void
162S (gf o,const gf a)
163{
164 M (o,a,a);
165}
166
167static void
168inv25519 (gf o,const gf i)
169{
170 gf c;
171 int a;
172 FOR (a,16) c[a] = i[a];
173 for (a = 253; a>=0; a--) {
174 S (c,c);
175 if ((a!=2)&&(a!=4))
176 M (c,c,i);
177 }
178 FOR (a,16) o[a] = c[a];
179}
180
181static void pow2523 (gf o,const gf i)
182{
183 gf c;
184 int a;
185 FOR (a,16) c[a] = i[a];
186 for (a = 250; a>=0; a--) {
187 S (c,c);
188 if (a!=1)
189 M (c,c,i);
190 }
191 FOR (a,16) o[a] = c[a];
192}
193
194int
195GNUNET_TWEETNACL_scalarmult_curve25519 (u8 *q,const u8 *n,const u8 *p)
196{
197 u8 z[32];
198 i64 x[80],r,i;
199 gf a,b,c,d,e,f;
200 FOR (i,31) z[i] = n[i];
201 z[31] = (n[31] & 127) | 64;
202 z[0] &= 248;
203 unpack25519 (x,p);
204 FOR (i,16) {
205 b[i] = x[i];
206 d[i] = a[i] = c[i] = 0;
207 }
208 a[0] = d[0] = 1;
209 for (i = 254; i>=0; --i) {
210 r = (z[i >> 3] >> (i & 7)) & 1;
211 sel25519 (a,b,r);
212 sel25519 (c,d,r);
213 A (e,a,c);
214 Z (a,a,c);
215 A (c,b,d);
216 Z (b,b,d);
217 S (d,e);
218 S (f,a);
219 M (a,c,a);
220 M (c,b,e);
221 A (e,a,c);
222 Z (a,a,c);
223 S (b,a);
224 Z (c,d,f);
225 M (a,c,_121665);
226 A (a,a,d);
227 M (c,c,a);
228 M (a,d,f);
229 M (d,b,x);
230 S (b,e);
231 sel25519 (a,b,r);
232 sel25519 (c,d,r);
233 }
234 FOR (i,16) {
235 x[i + 16] = a[i];
236 x[i + 32] = c[i];
237 x[i + 48] = b[i];
238 x[i + 64] = d[i];
239 }
240 inv25519 (x + 32,x + 32);
241 M (x + 16,x + 16,x + 32);
242 pack25519 (q,x + 16);
243 return 0;
244}
245
246int
247GNUNET_TWEETNACL_scalarmult_curve25519_base (u8 *q,const u8 *n)
248{
249 return GNUNET_TWEETNACL_scalarmult_curve25519 (q,n,_9);
250}
251
252static int
253crypto_hash (u8 *out,const u8 *m,u64 n)
254{
255 struct GNUNET_HashCode *hc = (void *) out;
256 GNUNET_CRYPTO_hash (m, n, hc);
257 return 0;
258}
259
260static void
261add (gf p[4],gf q[4])
262{
263 gf a,b,c,d,t,e,f,g,h;
264
265 Z (a, p[1], p[0]);
266 Z (t, q[1], q[0]);
267 M (a, a, t);
268 A (b, p[0], p[1]);
269 A (t, q[0], q[1]);
270 M (b, b, t);
271 M (c, p[3], q[3]);
272 M (c, c, D2);
273 M (d, p[2], q[2]);
274 A (d, d, d);
275 Z (e, b, a);
276 Z (f, d, c);
277 A (g, d, c);
278 A (h, b, a);
279
280 M (p[0], e, f);
281 M (p[1], h, g);
282 M (p[2], g, f);
283 M (p[3], e, h);
284}
285
286static void
287cswap (gf p[4],gf q[4],u8 b)
288{
289 int i;
290 FOR (i,4)
291 sel25519 (p[i],q[i],b);
292}
293
294static void
295pack (u8 *r,gf p[4])
296{
297 gf tx, ty, zi;
298 inv25519 (zi, p[2]);
299 M (tx, p[0], zi);
300 M (ty, p[1], zi);
301 pack25519 (r, ty);
302 r[31] ^= par25519 (tx) << 7;
303}
304
305static void
306scalarmult (gf p[4],gf q[4],const u8 *s)
307{
308 int i;
309 set25519 (p[0],gf0);
310 set25519 (p[1],gf1);
311 set25519 (p[2],gf1);
312 set25519 (p[3],gf0);
313 for (i = 255; i >= 0; --i) {
314 u8 b = (s[i / 8] >> (i & 7)) & 1;
315 cswap (p,q,b);
316 add (q,p);
317 add (p,p);
318 cswap (p,q,b);
319 }
320}
321
322static void
323scalarbase (gf p[4],const u8 *s)
324{
325 gf q[4];
326 set25519 (q[0],X);
327 set25519 (q[1],Y);
328 set25519 (q[2],gf1);
329 M (q[3],X,Y);
330 scalarmult (p,q,s);
331}
332
333static const u64 L[32] = {0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6,
334 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0,
335 0, 0, 0, 0, 0, 0, 0, 0,
336 0, 0, 0, 0x10};
337
338static void
339modL (u8 *r,i64 x[64])
340{
341 i64 carry,i,j;
342 for (i = 63; i >= 32; --i) {
343 carry = 0;
344 for (j = i - 32; j < i - 12; ++j) {
345 x[j] += carry - 16 * x[i] * L[j - (i - 32)];
346 carry = (x[j] + 128) >> 8;
347 x[j] -= carry << 8;
348 }
349 x[j] += carry;
350 x[i] = 0;
351 }
352 carry = 0;
353 FOR (j,32) {
354 x[j] += carry - (x[31] >> 4) * L[j];
355 carry = x[j] >> 8;
356 x[j] &= 255;
357 }
358 FOR (j,32) x[j] -= carry * L[j];
359 FOR (i,32) {
360 x[i + 1] += x[i] >> 8;
361 r[i] = x[i] & 255;
362 }
363}
364
365static void
366reduce (u8 *r)
367{
368 i64 x[64],i;
369 FOR (i,64) x[i] = (u64) r[i];
370 FOR (i,64) r[i] = 0;
371 modL (r,x);
372}
373
374static int
375unpackneg (gf r[4],const u8 p[32])
376{
377 gf t, chk, num, den, den2, den4, den6;
378 set25519 (r[2],gf1);
379 unpack25519 (r[1],p);
380 S (num,r[1]);
381 M (den,num,D);
382 Z (num,num,r[2]);
383 A (den,r[2],den);
384
385 S (den2,den);
386 S (den4,den2);
387 M (den6,den4,den2);
388 M (t,den6,num);
389 M (t,t,den);
390
391 pow2523 (t,t);
392 M (t,t,num);
393 M (t,t,den);
394 M (t,t,den);
395 M (r[0],t,den);
396
397 S (chk,r[0]);
398 M (chk,chk,den);
399 if (neq25519 (chk, num))
400 M (r[0],r[0],I);
401
402 S (chk,r[0]);
403 M (chk,chk,den);
404 if (neq25519 (chk, num))
405 return -1;
406
407 if (par25519 (r[0]) == (p[31] >> 7))
408 Z (r[0],gf0,r[0]);
409
410 M (r[3],r[0],r[1]);
411 return 0;
412}
413
414/* The following functions have been added for GNUnet */
415
416void
417GNUNET_TWEETNACL_sign_pk_from_seed (u8 *pk, const u8 *seed)
418{
419 u8 d[64];
420 gf p[4];
421
422 crypto_hash (d, seed, 32);
423 d[0] &= 248;
424 d[31] &= 127;
425 d[31] |= 64;
426
427 scalarbase (p, d);
428 pack (pk, p);
429}
430
431void
432GNUNET_TWEETNACL_scalarmult_gnunet_ecdsa (u8 *pk, const u8 *s)
433{
434 u8 d[64];
435 gf p[4];
436
437 // Treat s as little endian.
438 for (u32 i = 0; i < 32; i++)
439 d[i] = s[31 - i];
440
441 // For GNUnet, we don't normalize d
442
443 scalarbase (p, d);
444 pack (pk, p);
445}
446
447void
448GNUNET_TWEETNACL_sign_sk_from_seed (u8 *sk, const u8 *seed)
449{
450 u8 d[64];
451 gf p[4];
452 u8 pk[32];
453 int i;
454
455 crypto_hash (d, seed, 32);
456 d[0] &= 248;
457 d[31] &= 127;
458 d[31] |= 64;
459
460 scalarbase (p,d);
461 pack (pk,p);
462
463 FOR (i,32) sk[i] = seed[i];
464 FOR (i,32) sk[32 + i] = pk[i];
465}
466
467int
468GNUNET_TWEETNACL_sign_ed25519_pk_to_curve25519 (u8 *x25519_pk,
469 const u8 *ed25519_pk)
470{
471 gf ge_a[4];
472 gf x;
473 gf one_minus_y;
474
475 if (0 != unpackneg (ge_a, ed25519_pk))
476 return -1;
477
478 set25519 (one_minus_y, gf1);
479 Z (one_minus_y, one_minus_y, ge_a[1]);
480
481 set25519 (x, gf1);
482 A (x, x, ge_a[1]);
483
484 inv25519 (one_minus_y, one_minus_y);
485 M (x, x, one_minus_y);
486 pack25519 (x25519_pk, x);
487
488 return 0;
489}
490
491int GNUNET_TWEETNACL_sign_detached_verify (const u8 *sig,
492 const u8 *m,
493 u64 n,
494 const u8 *pk)
495{
496 struct GNUNET_HashContext *hc;
497 u8 t[32],h[64];
498 gf p[4],q[4];
499
500 if (unpackneg (q,pk))
501 return -1;
502
503 hc = GNUNET_CRYPTO_hash_context_start ();
504 GNUNET_CRYPTO_hash_context_read (hc, sig, 32);
505 GNUNET_CRYPTO_hash_context_read (hc, pk, 32);
506 GNUNET_CRYPTO_hash_context_read (hc, m, n);
507 GNUNET_CRYPTO_hash_context_finish (hc, (void *) h);
508
509 reduce (h);
510 scalarmult (p,q,h);
511
512 scalarbase (q,sig+32);
513 add (p,q);
514 pack (t,p);
515
516 if (crypto_verify_32 (sig, t))
517 return -1;
518 return 0;
519}
520
521int
522GNUNET_TWEETNACL_sign_detached (u8 *sig,
523 const u8 *m,
524 u64 n,
525 const u8 *sk)
526{
527 struct GNUNET_HashContext *hc;
528 u8 d[64],h[64],r[64];
529 i64 i,j,x[64];
530 gf p[4];
531
532 crypto_hash (d, sk, 32);
533 d[0] &= 248;
534 d[31] &= 127;
535 d[31] |= 64;
536
537 hc = GNUNET_CRYPTO_hash_context_start ();
538 GNUNET_CRYPTO_hash_context_read (hc, d + 32, 32);
539 GNUNET_CRYPTO_hash_context_read (hc, m, n);
540 GNUNET_CRYPTO_hash_context_finish (hc, (void *) r);
541
542 reduce (r);
543 scalarbase (p,r);
544 pack (sig,p);
545
546 hc = GNUNET_CRYPTO_hash_context_start ();
547 GNUNET_CRYPTO_hash_context_read (hc, sig, 32);
548 GNUNET_CRYPTO_hash_context_read (hc, sk + 32, 32);
549 GNUNET_CRYPTO_hash_context_read (hc, m, n);
550 GNUNET_CRYPTO_hash_context_finish (hc, (void *) h);
551
552 reduce (h);
553
554 FOR (i,64) x[i] = 0;
555 FOR (i,32) x[i] = (u64) r[i];
556 FOR (i,32) FOR (j,32) x[i + j] += h[i] * (u64) d[j];
557 modL (sig + 32,x);
558
559 return 0;
560}
diff --git a/src/util/tweetnacl-gnunet.h b/src/util/tweetnacl-gnunet.h
deleted file mode 100644
index d052d8824..000000000
--- a/src/util/tweetnacl-gnunet.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 This file has been placed in the public domain.
3
4 Based on TweetNaCl version 20140427
5
6 Originally obtained from:
7 https://tweetnacl.cr.yp.to/20140427/tweetnacl.h
8
9 SPDX-License-Identifier: 0BSD
10 */
11
12
13#ifndef TWEETNACL_H
14#define TWEETNACL_H
15#include <stdint.h>
16
17
18#define GNUNET_TWEETNACL_SIGN_SECRETKEYBYTES 64
19#define GNUNET_TWEETNACL_SIGN_PUBLICBYTES 32
20#define GNUNET_TWEETNACL_SCALARMULT_BYTES 32
21
22int
23GNUNET_TWEETNACL_scalarmult_curve25519 (uint8_t *,
24 const uint8_t *,
25 const uint8_t *);
26extern int
27GNUNET_TWEETNACL_scalarmult_curve25519_base (uint8_t *,
28 const uint8_t *);
29void
30GNUNET_TWEETNACL_sign_pk_from_seed (uint8_t *pk, const uint8_t *seed);
31
32void
33GNUNET_TWEETNACL_sign_sk_from_seed (uint8_t *sk, const uint8_t *seed);
34
35int
36GNUNET_TWEETNACL_sign_ed25519_pk_to_curve25519 (uint8_t *x25519_pk,
37 const uint8_t *ed25519_pk);
38
39int
40GNUNET_TWEETNACL_sign_detached_verify (const uint8_t *sig,
41 const uint8_t *m,
42 uint64_t n,
43 const uint8_t *pk);
44
45int
46GNUNET_TWEETNACL_sign_detached (uint8_t *sig,
47 const uint8_t *m,
48 uint64_t n,
49 const uint8_t *sk);
50
51void
52GNUNET_TWEETNACL_scalarmult_gnunet_ecdsa (uint8_t *pk, const uint8_t *s);
53
54#endif
diff --git a/src/vpn/gnunet-helper-vpn.c b/src/vpn/gnunet-helper-vpn.c
index 4e35fa2c3..c693d24ea 100644
--- a/src/vpn/gnunet-helper-vpn.c
+++ b/src/vpn/gnunet-helper-vpn.c
@@ -59,6 +59,7 @@
59 */ 59 */
60#define MAX_SIZE 65536 60#define MAX_SIZE 65536
61 61
62#if ! defined(__ANDROID__)
62#ifndef _LINUX_IN6_H 63#ifndef _LINUX_IN6_H
63/** 64/**
64 * This is in linux/include/net/ipv6.h, but not always exported... 65 * This is in linux/include/net/ipv6.h, but not always exported...
@@ -70,6 +71,7 @@ struct in6_ifreq
70 unsigned int ifr6_ifindex; 71 unsigned int ifr6_ifindex;
71}; 72};
72#endif 73#endif
74#endif
73 75
74 76
75/** 77/**
diff --git a/src/vpn/gnunet-vpn.c b/src/vpn/gnunet-vpn.c
index 6dcd227c7..a7f7fc30c 100644
--- a/src/vpn/gnunet-vpn.c
+++ b/src/vpn/gnunet-vpn.c
@@ -357,7 +357,7 @@ main (int argc, char *const *argv)
357 NULL)) 357 NULL))
358 ? ret 358 ? ret
359 : 1; 359 : 1;
360 GNUNET_free ((void *) argv); 360 GNUNET_free_nz ((void *) argv);
361 return ret; 361 return ret;
362} 362}
363 363