diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-15 17:10:19 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-15 17:10:19 +0000 |
commit | 7eda3db9f6ce06aa76ede1c329bd14ef50b0a85a (patch) | |
tree | 270542af401bb380b8ff6a458cb1cc6652acead3 | |
parent | fb817eae79ee54ce9cc8dc31a29ba00d7ed3ac7b (diff) | |
download | gnunet-gtk-7eda3db9f6ce06aa76ede1c329bd14ef50b0a85a.tar.gz gnunet-gtk-7eda3db9f6ce06aa76ede1c329bd14ef50b0a85a.zip |
- moving crypto key to ctx
-rw-r--r-- | src/gns/gnunet-gns-gtk.c | 35 | ||||
-rw-r--r-- | src/gns/gnunet-gns-gtk_zone.c | 11 |
2 files changed, 25 insertions, 21 deletions
diff --git a/src/gns/gnunet-gns-gtk.c b/src/gns/gnunet-gns-gtk.c index 143c6406..74906b83 100644 --- a/src/gns/gnunet-gns-gtk.c +++ b/src/gns/gnunet-gns-gtk.c | |||
@@ -36,10 +36,6 @@ static struct GNUNET_GTK_MainLoop *ml; | |||
36 | */ | 36 | */ |
37 | static int tray_only; | 37 | static int tray_only; |
38 | 38 | ||
39 | /** | ||
40 | * Hash of the public key of our zone. | ||
41 | */ | ||
42 | static GNUNET_HashCode zone; | ||
43 | 39 | ||
44 | /** | 40 | /** |
45 | * Private key for the our zone. | 41 | * Private key for the our zone. |
@@ -69,6 +65,12 @@ struct GNUNET_GNS_Context | |||
69 | 65 | ||
70 | GtkBuilder *builder; | 66 | GtkBuilder *builder; |
71 | 67 | ||
68 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; | ||
69 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | ||
70 | |||
71 | GNUNET_HashCode zone; | ||
72 | |||
73 | |||
72 | 74 | ||
73 | }; | 75 | }; |
74 | 76 | ||
@@ -336,12 +338,12 @@ void zone_iteration_proc (void *cls, | |||
336 | static void | 338 | static void |
337 | run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 339 | run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
338 | { | 340 | { |
339 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | ||
340 | struct GNUNET_GNS_Context *gns = GNUNET_malloc (sizeof (struct GNUNET_GNS_Context)); | 341 | struct GNUNET_GNS_Context *gns = GNUNET_malloc (sizeof (struct GNUNET_GNS_Context)); |
341 | char *keyfile; | 342 | char *keyfile; |
342 | char *label; | 343 | char *label; |
343 | 344 | ||
344 | ml = cls; | 345 | ml = cls; |
346 | /* | ||
345 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (get_configuration (), | 347 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (get_configuration (), |
346 | "gns", | 348 | "gns", |
347 | "ZONEKEY_DIRECTORY", | 349 | "ZONEKEY_DIRECTORY", |
@@ -351,7 +353,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
351 | _("Option `%s' missing in section `%s'\n"), | 353 | _("Option `%s' missing in section `%s'\n"), |
352 | "ZONEKEY_DIRECTORY", "namestore"); | 354 | "ZONEKEY_DIRECTORY", "namestore"); |
353 | return; | 355 | return; |
354 | } | 356 | }*/ |
355 | 357 | ||
356 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (get_configuration (), | 358 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (get_configuration (), |
357 | "gns", | 359 | "gns", |
@@ -363,17 +365,18 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
363 | "ZONEKEY", "gns"); | 365 | "ZONEKEY", "gns"); |
364 | return; | 366 | return; |
365 | } | 367 | } |
366 | zone_pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); | 368 | gns->pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); |
367 | GNUNET_free (keyfile); | 369 | GNUNET_free (keyfile); |
368 | keyfile = NULL; | 370 | keyfile = NULL; |
369 | if (NULL == zone_pkey) | 371 | if (NULL == gns->pkey) |
370 | { | 372 | { |
371 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 373 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
372 | _("Failed to read or create private zone key\n")); | 374 | _("Failed to read or create private zone key\n")); |
373 | return; | 375 | return; |
374 | } | 376 | } |
375 | GNUNET_CRYPTO_rsa_key_get_public (zone_pkey, &pub); | 377 | GNUNET_CRYPTO_rsa_key_get_public (gns->pkey, &gns->pubkey); |
376 | GNUNET_CRYPTO_hash (&pub, sizeof (pub), &zone); | 378 | GNUNET_CRYPTO_hash (&gns->pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &gns->zone); |
379 | |||
377 | 380 | ||
378 | gns->ns = GNUNET_NAMESTORE_connect (get_configuration ()); | 381 | gns->ns = GNUNET_NAMESTORE_connect (get_configuration ()); |
379 | if (NULL == gns->ns) | 382 | if (NULL == gns->ns) |
@@ -392,7 +395,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
392 | } | 395 | } |
393 | gns->builder = GNUNET_GTK_main_loop_get_builder(ml); | 396 | gns->builder = GNUNET_GTK_main_loop_get_builder(ml); |
394 | 397 | ||
395 | zone_as_string = GNUNET_strdup (GNUNET_h2s_full (&zone)); | 398 | zone_as_string = GNUNET_strdup (GNUNET_h2s_full (&gns->zone)); |
396 | label = g_markup_printf_escaped (_("<b>Editing zone %s</b>"), | 399 | label = g_markup_printf_escaped (_("<b>Editing zone %s</b>"), |
397 | zone_as_string); | 400 | zone_as_string); |
398 | gtk_label_set_markup (GTK_LABEL (get_object ("GNUNET_GNS_GTK_zone_label")), | 401 | gtk_label_set_markup (GTK_LABEL (get_object ("GNUNET_GNS_GTK_zone_label")), |
@@ -408,16 +411,6 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
408 | "gnunet-gtk" /* FIXME: different icon? */ , | 411 | "gnunet-gtk" /* FIXME: different icon? */ , |
409 | "gnunet-gns-gtk"); | 412 | "gnunet-gns-gtk"); |
410 | 413 | ||
411 | /* | ||
412 | struct ZoneIteration_Context * zc_ctx = GNUNET_malloc (sizeof (struct ZoneIteration_Context)); | ||
413 | zc_ctx->zone = zone; | ||
414 | GNUNET_NAMESTORE_zone_iteration_start(gns->ns, &zone, | ||
415 | GNUNET_NAMESTORE_RF_NONE, | ||
416 | GNUNET_NAMESTORE_RF_NONE, | ||
417 | &zone_iteration_proc, | ||
418 | zc_ctx); | ||
419 | */ | ||
420 | |||
421 | /* make GUI visible */ | 414 | /* make GUI visible */ |
422 | if (!tray_only) | 415 | if (!tray_only) |
423 | { | 416 | { |
diff --git a/src/gns/gnunet-gns-gtk_zone.c b/src/gns/gnunet-gns-gtk_zone.c index 5739c888..dd88df89 100644 --- a/src/gns/gnunet-gns-gtk_zone.c +++ b/src/gns/gnunet-gns-gtk_zone.c | |||
@@ -165,6 +165,17 @@ GNUNET_GNS_GTK_main_treeview_realize_cb (GtkWidget *widget, | |||
165 | /* Append a top level row and leave it empty */ | 165 | /* Append a top level row and leave it empty */ |
166 | gtk_tree_store_append(ts, &toplevel, NULL); | 166 | gtk_tree_store_append(ts, &toplevel, NULL); |
167 | 167 | ||
168 | /* | ||
169 | struct ZoneIteration_Context * zc_ctx = GNUNET_malloc (sizeof (struct ZoneIteration_Context)); | ||
170 | zc_ctx->zone = zone; | ||
171 | GNUNET_NAMESTORE_zone_iteration_start(gns->ns, &zone, | ||
172 | GNUNET_NAMESTORE_RF_NONE, | ||
173 | GNUNET_NAMESTORE_RF_NONE, | ||
174 | &zone_iteration_proc, | ||
175 | zc_ctx); | ||
176 | */ | ||
177 | |||
178 | |||
168 | GNUNET_break (0); | 179 | GNUNET_break (0); |
169 | } | 180 | } |
170 | 181 | ||