[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27812 - gnunet/src/namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27812 - gnunet/src/namestore |
Date: |
Tue, 9 Jul 2013 09:28:27 +0200 |
Author: grothoff
Date: 2013-07-09 09:28:27 +0200 (Tue, 09 Jul 2013)
New Revision: 27812
Modified:
gnunet/src/namestore/gnunet-namestore.c
gnunet/src/namestore/gnunet-service-namestore.c
Log:
-simplify zone key loading by using synchronous ECC key API
Modified: gnunet/src/namestore/gnunet-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-namestore.c 2013-07-09 07:24:44 UTC (rev
27811)
+++ gnunet/src/namestore/gnunet-namestore.c 2013-07-09 07:28:27 UTC (rev
27812)
@@ -447,28 +447,41 @@
/**
- * Function called with the result of the ECC key generation.
+ * Function called with the result from the check if the namestore
+ * service is actually running. If it is, we start the actual
+ * operation.
*
- * @param cls our configuration
- * @param pk our private key, NULL on failure
- * @param emsg NULL on success, otherwise error message
+ * @param cls closure with our configuration
+ * @param result GNUNET_YES if the namestore service is running
*/
static void
-key_generation_cb (void *cls,
- struct GNUNET_CRYPTO_EccPrivateKey *pk,
- const char *emsg)
+testservice_task (void *cls,
+ int result)
{
const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pub;
struct GNUNET_NAMESTORE_RecordData rd;
- keygen = NULL;
- if (NULL == pk)
+ if (GNUNET_YES != result)
{
- GNUNET_SCHEDULER_shutdown ();
+ FPRINTF (stderr, _("Service `%s' is not running\n"),
+ "namestore");
return;
}
- zone_pkey = pk;
+ if (NULL == keyfile)
+ {
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
+ "ZONEKEY",
&keyfile))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "gns", "ZONEKEY");
+ return;
+ }
+ fprintf (stderr,
+ _("Using default zone file `%s'\n"),
+ keyfile);
+ }
+ zone_pkey = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile);
if (! (add|del|list|(NULL != uri)))
{
@@ -681,51 +694,6 @@
/**
- * Function called with the result from the check if the namestore
- * service is actually running. If it is, we start the actual
- * operation.
- *
- * @param cls closure with our configuration
- * @param result GNUNET_YES if the namestore service is running
- */
-static void
-testservice_task (void *cls,
- int result)
-{
- const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
-
- if (GNUNET_YES != result)
- {
- FPRINTF (stderr, _("Service `%s' is not running\n"),
- "namestore");
- return;
- }
- if (NULL == keyfile)
- {
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
- "ZONEKEY",
&keyfile))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "gns", "ZONEKEY");
- return;
- }
- fprintf (stderr,
- _("Using default zone file `%s'\n"),
- keyfile);
- }
- keygen = GNUNET_CRYPTO_ecc_key_create_start (keyfile,
- &key_generation_cb, (void *)
cfg);
- GNUNET_free (keyfile);
- keyfile = NULL;
- if (NULL == keygen)
- {
- GNUNET_SCHEDULER_shutdown ();
- ret = 1;
- }
-}
-
-
-/**
* Main function that will be run.
*
* @param cls closure
Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c 2013-07-09 07:24:44 UTC
(rev 27811)
+++ gnunet/src/namestore/gnunet-service-namestore.c 2013-07-09 07:28:27 UTC
(rev 27812)
@@ -1702,7 +1702,6 @@
return GNUNET_OK;
pk = GNUNET_CRYPTO_ecc_key_create_from_file (filename);
learn_private_key (pk);
- GNUNET_CRYPTO_ecc_key_free (pk);
(*counter)++;
return GNUNET_OK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27812 - gnunet/src/namestore,
gnunet <=