diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-19 18:25:50 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-19 18:25:50 +0000 |
commit | 4d4b906ac2f35d42f6b66a5c042588b3ab76c3b5 (patch) | |
tree | 775f1afe496efa4a0ecb845bbb438c5bca252d5c | |
parent | cc606d031944fcdd6459e127905c6a83917d45d4 (diff) | |
download | gnunet-gtk-4d4b906ac2f35d42f6b66a5c042588b3ab76c3b5.tar.gz gnunet-gtk-4d4b906ac2f35d42f6b66a5c042588b3ab76c3b5.zip |
- use short hashes
-rw-r--r-- | src/gns/gnunet-gns-gtk.c | 13 | ||||
-rw-r--r-- | src/gns/gnunet-gns-gtk.h | 2 | ||||
-rw-r--r-- | src/gns/gnunet-gns-gtk_zone.c | 13 |
3 files changed, 16 insertions, 12 deletions
diff --git a/src/gns/gnunet-gns-gtk.c b/src/gns/gnunet-gns-gtk.c index a4c6cac0..c7b47363 100644 --- a/src/gns/gnunet-gns-gtk.c +++ b/src/gns/gnunet-gns-gtk.c | |||
@@ -288,6 +288,7 @@ static void | |||
288 | run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 288 | run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
289 | { | 289 | { |
290 | struct GNUNET_GNS_Context *gns = GNUNET_malloc (sizeof (struct GNUNET_GNS_Context)); | 290 | struct GNUNET_GNS_Context *gns = GNUNET_malloc (sizeof (struct GNUNET_GNS_Context)); |
291 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded shenc; | ||
291 | char *keyfile; | 292 | char *keyfile; |
292 | char *label; | 293 | char *label; |
293 | 294 | ||
@@ -296,7 +297,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
296 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (get_configuration (), | 297 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (get_configuration (), |
297 | "gns", | 298 | "gns", |
298 | "ZONEKEY_DIRECTORY", | 299 | "ZONEKEY_DIRECTORY", |
299 | &zonekey_directory)) | 300 | &zonekey_direc struct GNUNET_CRYPTO_ShortHashAsciiEncoded shenc; |
301 | GNUNET_CRYPTO_short_hash_to_enc(&zc_ctx->zone, &shenc);tory)) | ||
300 | { | 302 | { |
301 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 303 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
302 | _("Option `%s' missing in section `%s'\n"), | 304 | _("Option `%s' missing in section `%s'\n"), |
@@ -315,10 +317,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
315 | return; | 317 | return; |
316 | } | 318 | } |
317 | else | 319 | else |
318 | { | 320 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
319 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
320 | "Using `%s'\n", keyfile); | 321 | "Using `%s'\n", keyfile); |
321 | } | ||
322 | gns->pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); | 322 | gns->pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); |
323 | GNUNET_free (keyfile); | 323 | GNUNET_free (keyfile); |
324 | keyfile = NULL; | 324 | keyfile = NULL; |
@@ -329,7 +329,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
329 | return; | 329 | return; |
330 | } | 330 | } |
331 | GNUNET_CRYPTO_rsa_key_get_public (gns->pkey, &gns->pubkey); | 331 | GNUNET_CRYPTO_rsa_key_get_public (gns->pkey, &gns->pubkey); |
332 | GNUNET_CRYPTO_hash (&gns->pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &gns->zone); | 332 | GNUNET_CRYPTO_short_hash (&gns->pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &gns->zone); |
333 | 333 | ||
334 | 334 | ||
335 | gns->ns = GNUNET_NAMESTORE_connect (get_configuration ()); | 335 | gns->ns = GNUNET_NAMESTORE_connect (get_configuration ()); |
@@ -352,7 +352,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
352 | gns->ls = GTK_LIST_STORE (gtk_builder_get_object (gns->builder, "GNUNET_GNS_GTK_type_liststore")); | 352 | gns->ls = GTK_LIST_STORE (gtk_builder_get_object (gns->builder, "GNUNET_GNS_GTK_type_liststore")); |
353 | GNUNET_assert (NULL != gns->ts); | 353 | GNUNET_assert (NULL != gns->ts); |
354 | 354 | ||
355 | zone_as_string = GNUNET_strdup (GNUNET_h2s_full (&gns->zone)); | 355 | GNUNET_CRYPTO_short_hash_to_enc(&gns->zone, &shenc); |
356 | zone_as_string = GNUNET_strdup ((char *) &shenc); | ||
356 | label = g_markup_printf_escaped (_("<b>Editing zone %s</b>"), | 357 | label = g_markup_printf_escaped (_("<b>Editing zone %s</b>"), |
357 | zone_as_string); | 358 | zone_as_string); |
358 | gtk_label_set_markup (GTK_LABEL (get_object ("GNUNET_GNS_GTK_zone_label")), | 359 | gtk_label_set_markup (GTK_LABEL (get_object ("GNUNET_GNS_GTK_zone_label")), |
diff --git a/src/gns/gnunet-gns-gtk.h b/src/gns/gnunet-gns-gtk.h index 0eb8db14..4148918b 100644 --- a/src/gns/gnunet-gns-gtk.h +++ b/src/gns/gnunet-gns-gtk.h | |||
@@ -42,7 +42,7 @@ struct GNUNET_GNS_Context | |||
42 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; | 42 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; |
43 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 43 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
44 | 44 | ||
45 | GNUNET_HashCode zone; | 45 | struct GNUNET_CRYPTO_ShortHashCode zone; |
46 | 46 | ||
47 | }; | 47 | }; |
48 | 48 | ||
diff --git a/src/gns/gnunet-gns-gtk_zone.c b/src/gns/gnunet-gns-gtk_zone.c index 61f74ee2..7a63ee1e 100644 --- a/src/gns/gnunet-gns-gtk_zone.c +++ b/src/gns/gnunet-gns-gtk_zone.c | |||
@@ -339,7 +339,7 @@ GNUNET_GNS_GTK_main_treeview_key_press_popup_menu_cb (GtkWidget *widget, GdkEven | |||
339 | struct ZoneIteration_Context | 339 | struct ZoneIteration_Context |
340 | { | 340 | { |
341 | struct GNUNET_GNS_Context *gns; | 341 | struct GNUNET_GNS_Context *gns; |
342 | GNUNET_HashCode zone; | 342 | struct GNUNET_CRYPTO_ShortHashCode zone; |
343 | struct GNUNET_NAMESTORE_ZoneIterator * it; | 343 | struct GNUNET_NAMESTORE_ZoneIterator * it; |
344 | }; | 344 | }; |
345 | 345 | ||
@@ -381,12 +381,17 @@ void zone_iteration_proc (void *cls, | |||
381 | GNUNET_assert (zc_ctx != NULL); | 381 | GNUNET_assert (zc_ctx != NULL); |
382 | if ((NULL == zone_key) && (NULL == name)) | 382 | if ((NULL == zone_key) && (NULL == name)) |
383 | { | 383 | { |
384 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Zone `%s 'iteration done\n", GNUNET_h2s(&zc_ctx->zone)); | 384 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded shenc; |
385 | GNUNET_CRYPTO_short_hash_to_enc(&zc_ctx->zone, &shenc); | ||
386 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Zone `%s 'iteration done\n", &shenc); | ||
385 | GNUNET_free (zc_ctx); | 387 | GNUNET_free (zc_ctx); |
386 | return; | 388 | return; |
387 | } | 389 | } |
390 | |||
391 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded shenc; | ||
392 | GNUNET_CRYPTO_short_hash_to_enc(&zc_ctx->zone, &shenc); | ||
388 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Zone `%s' iteration result `%s', %u records\n", | 393 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Zone `%s' iteration result `%s', %u records\n", |
389 | GNUNET_h2s(&zc_ctx->zone), name, rd_count); | 394 | shenc, name, rd_count); |
390 | 395 | ||
391 | GNUNET_assert(GTK_IS_TREE_STORE(zc_ctx->gns->ts)); | 396 | GNUNET_assert(GTK_IS_TREE_STORE(zc_ctx->gns->ts)); |
392 | gtk_tree_store_append(zc_ctx->gns->ts, &iter_name, NULL); | 397 | gtk_tree_store_append(zc_ctx->gns->ts, &iter_name, NULL); |
@@ -476,8 +481,6 @@ GNUNET_GNS_GTK_main_treeview_realize_cb (GtkWidget *widget, | |||
476 | zc_ctx = GNUNET_malloc (sizeof (struct ZoneIteration_Context)); | 481 | zc_ctx = GNUNET_malloc (sizeof (struct ZoneIteration_Context)); |
477 | zc_ctx->gns = user_data; | 482 | zc_ctx->gns = user_data; |
478 | zc_ctx->zone = gns->zone; | 483 | zc_ctx->zone = gns->zone; |
479 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Starting one `%s' iteration\n", GNUNET_h2s(&zc_ctx->zone)); | ||
480 | |||
481 | zc_ctx->it = GNUNET_NAMESTORE_zone_iteration_start(gns->ns, &gns->zone, | 484 | zc_ctx->it = GNUNET_NAMESTORE_zone_iteration_start(gns->ns, &gns->zone, |
482 | GNUNET_NAMESTORE_RF_NONE, | 485 | GNUNET_NAMESTORE_RF_NONE, |
483 | GNUNET_NAMESTORE_RF_NONE, | 486 | GNUNET_NAMESTORE_RF_NONE, |