aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-11 21:43:28 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-11 21:43:34 +0200
commit90ff9edfa9c5fcfa3a36d1653ff105e89b888e21 (patch)
tree780a2071f5072c8e8e044db741eb295c3f3ea2a7 /src/namestore
parent3bcfe59f1ce533246bda271f00b3ee957cae304d (diff)
downloadgnunet-90ff9edfa9c5fcfa3a36d1653ff105e89b888e21.tar.gz
gnunet-90ff9edfa9c5fcfa3a36d1653ff105e89b888e21.zip
fixing #6149
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/perf_namestore_api_zone_iteration.c14
-rw-r--r--src/namestore/test_namestore_api_lookup_nick.c25
-rw-r--r--src/namestore/test_namestore_api_lookup_private.c18
-rw-r--r--src/namestore/test_namestore_api_lookup_public.c24
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow.c24
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow_filter.c24
-rw-r--r--src/namestore/test_namestore_api_monitoring.c33
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c30
-rw-r--r--src/namestore/test_namestore_api_remove.c16
-rw-r--r--src/namestore/test_namestore_api_remove_not_existing_record.c18
-rw-r--r--src/namestore/test_namestore_api_store.c14
-rw-r--r--src/namestore/test_namestore_api_store_update.c18
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_nick.c39
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c33
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c18
15 files changed, 125 insertions, 223 deletions
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/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c
index b3946de34..145a3e885 100644
--- a/src/namestore/test_namestore_api_lookup_nick.c
+++ b/src/namestore/test_namestore_api_lookup_nick.c
@@ -40,7 +40,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
40 40
41static struct GNUNET_SCHEDULER_Task *endbadly_task; 41static struct GNUNET_SCHEDULER_Task *endbadly_task;
42 42
43static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 43static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey;
44 44
45static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 45static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
46 46
@@ -63,11 +63,6 @@ cleanup ()
63 GNUNET_NAMESTORE_disconnect (nsh); 63 GNUNET_NAMESTORE_disconnect (nsh);
64 nsh = NULL; 64 nsh = NULL;
65 } 65 }
66 if (NULL != privkey)
67 {
68 GNUNET_free (privkey);
69 privkey = NULL;
70 }
71 GNUNET_SCHEDULER_shutdown (); 66 GNUNET_SCHEDULER_shutdown ();
72} 67}
73 68
@@ -111,7 +106,7 @@ lookup_it (void *cls,
111 int found_record = GNUNET_NO; 106 int found_record = GNUNET_NO;
112 int found_nick = GNUNET_NO; 107 int found_nick = GNUNET_NO;
113 108
114 if (0 != GNUNET_memcmp (privkey, zone)) 109 if (0 != GNUNET_memcmp (&privkey, zone))
115 { 110 {
116 GNUNET_break (0); 111 GNUNET_break (0);
117 GNUNET_SCHEDULER_cancel (endbadly_task); 112 GNUNET_SCHEDULER_cancel (endbadly_task);
@@ -247,7 +242,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
247 } 242 }
248 /* Lookup */ 243 /* Lookup */
249 nsqe = GNUNET_NAMESTORE_records_lookup (nsh, 244 nsqe = GNUNET_NAMESTORE_records_lookup (nsh,
250 privkey, 245 &privkey,
251 name, 246 name,
252 &fail_cb, 247 &fail_cb,
253 NULL, 248 NULL,
@@ -272,8 +267,11 @@ nick_cont (void *cls, int32_t success, const char *emsg)
272 rd_orig.flags = 0; 267 rd_orig.flags = 0;
273 memset ((char *) rd_orig.data, 'a', TEST_RECORD_DATALEN); 268 memset ((char *) rd_orig.data, 'a', TEST_RECORD_DATALEN);
274 269
275 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 270 nsqe = GNUNET_NAMESTORE_records_store (nsh, &privkey,
276 1, &rd_orig, &put_cont, (void *) name); 271 name,
272 1,
273 &rd_orig,
274 &put_cont, (void *) name);
277} 275}
278 276
279 277
@@ -285,16 +283,15 @@ run (void *cls,
285 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 283 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
286 &endbadly, 284 &endbadly,
287 NULL); 285 NULL);
288 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 286 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
289 GNUNET_assert (privkey != NULL); 287 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey,
290 GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
291 &pubkey); 288 &pubkey);
292 289
293 nsh = GNUNET_NAMESTORE_connect (cfg); 290 nsh = GNUNET_NAMESTORE_connect (cfg);
294 GNUNET_break (NULL != nsh); 291 GNUNET_break (NULL != nsh);
295 292
296 nsqe = GNUNET_NAMESTORE_set_nick (nsh, 293 nsqe = GNUNET_NAMESTORE_set_nick (nsh,
297 privkey, 294 &privkey,
298 TEST_NICK, 295 TEST_NICK,
299 &nick_cont, 296 &nick_cont,
300 (void *) name); 297 (void *) name);
diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c
index e2600855c..98fdb1b43 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,
diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c
index 6640f47ed..83a5a78f6 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,8 +208,13 @@ 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,
diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c
index 7daa6987c..08c428731 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,
diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c
index 694c189e1..634a6a3c4 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,8 +323,13 @@ 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,
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c
index a23424d30..d26492517 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
@@ -107,17 +107,6 @@ do_shutdown ()
107 GNUNET_free ((void *) s_rd_3->data); 107 GNUNET_free ((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..040a63f91 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
@@ -124,16 +124,6 @@ end (void *cls)
124 GNUNET_free ((void *) s_rd_3->data); 124 GNUNET_free ((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..3f0c4c123 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,
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..ab211aeae 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,
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c
index b0244453a..65dbdbd8c 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,
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c
index 35eab2735..f5ffe3899 100644
--- a/src/namestore/test_namestore_api_zone_iteration_nick.c
+++ b/src/namestore/test_namestore_api_zone_iteration_nick.c
@@ -37,9 +37,9 @@
37 37
38static struct GNUNET_NAMESTORE_Handle *nsh; 38static struct GNUNET_NAMESTORE_Handle *nsh;
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
@@ -100,17 +100,6 @@ end (void *cls)
100 GNUNET_free ((void *) s_rd_3->data); 100 GNUNET_free ((void *) s_rd_3->data);
101 GNUNET_free (s_rd_3); 101 GNUNET_free (s_rd_3);
102 } 102 }
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} 103}
115 104
116 105
@@ -171,13 +160,13 @@ zone_proc (void *cls,
171 int failed = GNUNET_NO; 160 int failed = GNUNET_NO;
172 161
173 GNUNET_assert (NULL != zone); 162 GNUNET_assert (NULL != zone);
174 if (0 == GNUNET_memcmp (zone, privkey)) 163 if (0 == GNUNET_memcmp (zone, &privkey))
175 { 164 {
176 failed = check_zone_1 (label, rd_count, rd); 165 failed = check_zone_1 (label, rd_count, rd);
177 if (GNUNET_YES == failed) 166 if (GNUNET_YES == failed)
178 GNUNET_break (0); 167 GNUNET_break (0);
179 } 168 }
180 else if (0 == GNUNET_memcmp (zone, privkey2)) 169 else if (0 == GNUNET_memcmp (zone, &privkey2))
181 { 170 {
182 failed = check_zone_2 (label, rd_count, rd); 171 failed = check_zone_2 (label, rd_count, rd);
183 if (GNUNET_YES == failed) 172 if (GNUNET_YES == failed)
@@ -295,7 +284,7 @@ nick_2_cont (void *cls,
295 284
296 GNUNET_asprintf (&s_name_1, "dummy1"); 285 GNUNET_asprintf (&s_name_1, "dummy1");
297 s_rd_1 = create_record (1); 286 s_rd_1 = create_record (1);
298 GNUNET_NAMESTORE_records_store (nsh, privkey, s_name_1, 287 GNUNET_NAMESTORE_records_store (nsh, &privkey, s_name_1,
299 1, s_rd_1, 288 1, s_rd_1,
300 &put_cont, NULL); 289 &put_cont, NULL);
301 290
@@ -303,7 +292,7 @@ nick_2_cont (void *cls,
303 "Created record 2 \n"); 292 "Created record 2 \n");
304 GNUNET_asprintf (&s_name_2, "dummy2"); 293 GNUNET_asprintf (&s_name_2, "dummy2");
305 s_rd_2 = create_record (1); 294 s_rd_2 = create_record (1);
306 GNUNET_NAMESTORE_records_store (nsh, privkey, s_name_2, 295 GNUNET_NAMESTORE_records_store (nsh, &privkey, s_name_2,
307 1, s_rd_2, &put_cont, NULL); 296 1, s_rd_2, &put_cont, NULL);
308 297
309 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 298 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -312,7 +301,7 @@ nick_2_cont (void *cls,
312 /* name in different zone */ 301 /* name in different zone */
313 GNUNET_asprintf (&s_name_3, "dummy3"); 302 GNUNET_asprintf (&s_name_3, "dummy3");
314 s_rd_3 = create_record (1); 303 s_rd_3 = create_record (1);
315 GNUNET_NAMESTORE_records_store (nsh, privkey2, s_name_3, 304 GNUNET_NAMESTORE_records_store (nsh, &privkey2, s_name_3,
316 1, s_rd_3, 305 1, s_rd_3,
317 &put_cont, NULL); 306 &put_cont, NULL);
318} 307}
@@ -325,7 +314,8 @@ nick_1_cont (void *cls, int32_t success, const char *emsg)
325 "Nick 1 added : %s\n", 314 "Nick 1 added : %s\n",
326 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 315 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
327 316
328 nsqe = GNUNET_NAMESTORE_set_nick (nsh, privkey2, ZONE_NICK_2, &nick_2_cont, 317 nsqe = GNUNET_NAMESTORE_set_nick (nsh,
318 &privkey2, ZONE_NICK_2, &nick_2_cont,
329 &privkey2); 319 &privkey2);
330 if (NULL == nsqe) 320 if (NULL == nsqe)
331 { 321 {
@@ -374,16 +364,13 @@ empty_zone_end (void *cls)
374{ 364{
375 GNUNET_assert (nsh == cls); 365 GNUNET_assert (nsh == cls);
376 zi = NULL; 366 zi = NULL;
377 privkey = GNUNET_CRYPTO_ecdsa_key_create (); 367 GNUNET_CRYPTO_ecdsa_key_create (&privkey);
378 GNUNET_assert (privkey != NULL); 368 GNUNET_CRYPTO_ecdsa_key_create (&privkey2);
379 privkey2 = GNUNET_CRYPTO_ecdsa_key_create ();
380 GNUNET_assert (privkey2 != NULL);
381
382 nsqe = GNUNET_NAMESTORE_set_nick (nsh, 369 nsqe = GNUNET_NAMESTORE_set_nick (nsh,
383 privkey, 370 &privkey,
384 ZONE_NICK_1, 371 ZONE_NICK_1,
385 &nick_1_cont, 372 &nick_1_cont,
386 &privkey); 373 NULL);
387 if (NULL == nsqe) 374 if (NULL == nsqe)
388 { 375 {
389 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 376 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..97093cb71 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,16 +88,6 @@ 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);
@@ -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_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,