rename, fix
authorSchanzenbach, Martin <mschanzenbach@posteo.de>
Tue, 21 Apr 2020 13:45:12 +0000 (15:45 +0200)
committerSchanzenbach, Martin <mschanzenbach@posteo.de>
Tue, 21 Apr 2020 13:45:12 +0000 (15:45 +0200)
src/revocation/gnunet-revocation.c
src/revocation/gnunet-service-revocation.c
src/revocation/plugin_block_revocation.c
src/revocation/revocation_api.c
src/revocation/test_revocation.c
src/revocation/test_revocation.conf

index 2230114ae40081b2f845fc6e86fa5ed760986dcd..2c46a20e7d4f6250f7c98c2b49d08930943e04af 100644 (file)
@@ -86,7 +86,7 @@ static unsigned long long matching_bits;
 /**
  * Epoch length
  */
-static struct GNUNET_TIME_Relative epoch_length;
+static struct GNUNET_TIME_Relative epoch_duration;
 
 /**
  * Task used for proof-of-work calculation.
@@ -348,7 +348,7 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
     if (GNUNET_YES ==
         GNUNET_REVOCATION_check_pow (&proof_of_work,
                                      (unsigned int) matching_bits,
-                                     epoch_length))
+                                     epoch_duration))
     {
       fprintf (stderr, "%s", _ ("Revocation certificate ready\n"));
       if (perform)
@@ -432,12 +432,12 @@ run (void *cls,
   }
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg,
                                                         "REVOCATION",
-                                                        "EPOCH_LENGTH",
-                                                        &epoch_length))
+                                                        "EPOCH_DURATION",
+                                                        &epoch_duration))
   {
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
                                "REVOCATION",
-                               "EPOCH_LENGTH");
+                               "EPOCH_DURATION");
     return;
   }
 
@@ -470,7 +470,7 @@ run (void *cls,
     if (GNUNET_YES !=
         GNUNET_REVOCATION_check_pow (&proof_of_work,
                                      (unsigned int) matching_bits,
-                                     epoch_length))
+                                     epoch_duration))
     {
       struct GNUNET_REVOCATION_PowCalculationHandle *ph;
       ph = GNUNET_REVOCATION_pow_start (&proof_of_work,
index a9fbd57a7bf0b179dfa883464470a25c098e76f1..3c08e8452f60a2fd58299ba734a7d480d196b8b6 100644 (file)
@@ -131,7 +131,7 @@ static unsigned long long revocation_work_required;
 /**
  * Length of an expiration expoch
  */
-static struct GNUNET_TIME_Relative epoch_length;
+static struct GNUNET_TIME_Relative epoch_duration;
 
 /**
  * Our application ID for set union operations.  Must be the
@@ -174,7 +174,7 @@ verify_revoke_message (const struct RevokeMessage *rm)
 {
   if (GNUNET_YES != GNUNET_REVOCATION_check_pow (&rm->proof_of_work,
                                    (unsigned int) revocation_work_required,
-                                   epoch_length))
+                                   epoch_duration))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Proof of work invalid!\n");
@@ -846,12 +846,12 @@ run (void *cls,
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_time (cfg,
                                              "REVOCATION",
-                                             "EPOCH_LENGTH",
-                                             &epoch_length))
+                                             "EPOCH_DURATION",
+                                             &epoch_duration))
   {
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
                                "REVOCATION",
-                               "EPOCH_LENGTH");
+                               "EPOCH_DURATION");
     GNUNET_SCHEDULER_shutdown ();
     GNUNET_free (fn);
     return;
index f384cfe1d95759cae6f53a2038a4cf95d7d8eb33..291c56f706866332c63ab843732015993c23fb76 100644 (file)
@@ -52,7 +52,7 @@
 struct InternalContext
 {
   unsigned int matching_bits;
-  struct GNUNET_TIME_Relative epoch_length;
+  struct GNUNET_TIME_Relative epoch_duration;
 };
 
 
@@ -146,7 +146,7 @@ block_plugin_revocation_evaluate (void *cls,
   if (0 >=
       GNUNET_REVOCATION_check_pow (&rm->proof_of_work,
                                    ic->matching_bits,
-                                   ic->epoch_length))
+                                   ic->epoch_duration))
   {
     GNUNET_break_op (0);
     return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
@@ -210,7 +210,7 @@ libgnunet_plugin_block_revocation_init (void *cls)
   struct GNUNET_BLOCK_PluginFunctions *api;
   struct InternalContext *ic;
   unsigned long long matching_bits;
-  struct GNUNET_TIME_Relative epoch_length;
+  struct GNUNET_TIME_Relative epoch_duration;
 
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (cfg,
@@ -221,8 +221,8 @@ libgnunet_plugin_block_revocation_init (void *cls)
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_time (cfg,
                                            "REVOCATION",
-                                           "EPOCH_LENGTH",
-                                           &epoch_length))
+                                           "EPOCH_DURATION",
+                                           &epoch_duration))
     return NULL;
 
   api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions);
@@ -232,7 +232,7 @@ libgnunet_plugin_block_revocation_init (void *cls)
   api->types = types;
   ic = GNUNET_new (struct InternalContext);
   ic->matching_bits = (unsigned int) matching_bits;
-  ic->epoch_length = epoch_length;
+  ic->epoch_duration = epoch_duration;
   api->cls = ic;
   return api;
 }
index 7bf7799de70f6291f13717f5a95902f60dcf1d93..bff004698e37151c189cb6b3f769fd5e4ea7d19d 100644 (file)
@@ -311,7 +311,7 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
     GNUNET_MQ_handler_end ()
   };
   unsigned long long matching_bits;
-  struct GNUNET_TIME_Relative epoch_length;
+  struct GNUNET_TIME_Relative epoch_duration;
   struct RevokeMessage *rm;
   struct GNUNET_MQ_Envelope *env;
 
@@ -328,8 +328,8 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
   if ((GNUNET_OK !=
        GNUNET_CONFIGURATION_get_value_time (cfg,
                                               "REVOCATION",
-                                              "EPOCH_LENGTH",
-                                              &epoch_length)))
+                                              "EPOCH_DURATION",
+                                              &epoch_duration)))
   {
     GNUNET_break (0);
     GNUNET_free (h);
@@ -337,7 +337,7 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
   }
   if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow,
                                                  (unsigned int) matching_bits,
-                                                 epoch_length))
+                                                 epoch_duration))
   {
     GNUNET_break (0);
     GNUNET_free (h);
@@ -431,7 +431,7 @@ calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph)
 enum GNUNET_GenericReturnValue
 GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
                              unsigned int difficulty,
-                             struct GNUNET_TIME_Relative epoch_length)
+                             struct GNUNET_TIME_Relative epoch_duration)
 {
   char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
            + sizeof (struct GNUNET_TIME_AbsoluteNBO)
@@ -462,7 +462,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
                                    &pow->signature,
                                    &pow->key))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Proof of work signature invalid!\n");
     return GNUNET_NO;
   }
@@ -508,12 +508,12 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
    * Check expiration
    */
   ts = GNUNET_TIME_absolute_ntoh (pow->timestamp);
-  ttl = GNUNET_TIME_relative_multiply (epoch_length,
+  ttl = GNUNET_TIME_relative_multiply (epoch_duration,
                                        epochs);
   /**
    * Extend by 10% for unsynchronized clocks
    */
-  buffer = GNUNET_TIME_relative_divide (epoch_length,
+  buffer = GNUNET_TIME_relative_divide (epoch_duration,
                                         10);
   exp = GNUNET_TIME_absolute_add (ts, ttl);
   exp = GNUNET_TIME_absolute_add (exp,
index 84f90fe544a6d5d7d21886da8503e2932c1ed3a7..a7de15a3f71f67c7b1af2063ea8cd814fb95837e 100644 (file)
@@ -141,14 +141,14 @@ revocation_cb (void *cls, enum GNUNET_GenericReturnValue is_valid)
   }
 }
 
+struct GNUNET_REVOCATION_Pow proof_of_work;
+
 
 static void
 ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
 {
   static int completed = 0;
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
-  struct GNUNET_REVOCATION_Pow proof_of_work;
-
 
   if ((NULL != ego) && (cls == &testpeers[0]))
   {
index f195429b46d7179bbdfa530f4e895f9d5dd29ad5..66e2cdcc9bf097b9b22612d674c456288831f42f 100644 (file)
@@ -7,7 +7,7 @@ SERVICEHOME=$GNUNET_TMP/test-revocation-service
 [revocation]
 WORKBITS = 3
 IMMEDIATE_START = YES
-EPOCH_LENGTH = 365 d
+EPOCH_DURATION = 365 d
 
 [identity]
 # Directory where we store information about our egos