fix comments, struct naming; version
authorSchanzenbach, Martin <mschanzenbach@posteo.de>
Wed, 29 Apr 2020 13:08:04 +0000 (15:08 +0200)
committerSchanzenbach, Martin <mschanzenbach@posteo.de>
Wed, 29 Apr 2020 13:08:04 +0000 (15:08 +0200)
src/include/gnunet_revocation_service.h
src/revocation/gnunet-revocation.c
src/revocation/revocation.h
src/revocation/revocation_api.c

index 9a8918b4397cf0b733894e5c7c1658ab69979958..105bb1149772bbc6bd8a764649feb8aa6695f23f 100644 (file)
@@ -48,7 +48,7 @@ extern "C"
 /**
  * Version of the key revocation API.
  */
-#define GNUNET_REVOCATION_VERSION 0x00000000
+#define GNUNET_REVOCATION_VERSION 0x00000001
 
 /**
  * The proof-of-work narrowing factor.
@@ -59,7 +59,10 @@ extern "C"
 
 GNUNET_NETWORK_STRUCT_BEGIN
 
-struct GNUNET_REVOCATION_Pow
+/**
+ * Struct for a proof of work as part of the revocation.
+ */
+struct GNUNET_REVOCATION_PowP
 {
   /**
    * The timestamp of the revocation
@@ -91,7 +94,7 @@ struct GNUNET_REVOCATION_Pow
 /**
  * The signature object we use for the PoW
  */
-struct GNUNET_REVOCATION_SignaturePurpose
+struct GNUNET_REVOCATION_SignaturePurposePS
 {
   /**
    * The signature purpose
@@ -180,7 +183,7 @@ struct GNUNET_REVOCATION_Handle;
  */
 struct GNUNET_REVOCATION_Handle *
 GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                          const struct GNUNET_REVOCATION_Pow *pow,
+                          const struct GNUNET_REVOCATION_PowP *pow,
                           GNUNET_REVOCATION_Callback func, void *func_cls);
 
 
@@ -202,7 +205,7 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h);
  * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
  */
 enum GNUNET_GenericReturnValue
-GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
+GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
                              unsigned int matching_bits,
                              struct GNUNET_TIME_Relative epoch_duration);
 
@@ -215,7 +218,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
  */
 void
 GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
-                            struct GNUNET_REVOCATION_Pow *pow);
+                            struct GNUNET_REVOCATION_PowP *pow);
 
 
 /**
@@ -228,7 +231,7 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
  * @return a handle for use in PoW rounds
  */
 struct GNUNET_REVOCATION_PowCalculationHandle*
-GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow,
+GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow,
                              int epochs,
                              unsigned int difficulty);
 
index 8b7cf33c6a7d43fd53f2b555b14068cb4ec0e2f0..1edd98f0ea5567bea1f0cf15ddfe98dded5daeb8 100644 (file)
@@ -101,7 +101,7 @@ static struct GNUNET_SCHEDULER_Task *pow_task;
 /**
  * Proof-of-work object
  */
-static struct GNUNET_REVOCATION_Pow proof_of_work;
+static struct GNUNET_REVOCATION_PowP proof_of_work;
 
 /**
  * Function run if the user aborts with CTRL-C.
@@ -229,10 +229,10 @@ static void
 sync_pow ()
 {
   if ((NULL != filename) &&
-      (sizeof(struct GNUNET_REVOCATION_Pow) !=
+      (sizeof(struct GNUNET_REVOCATION_PowP) !=
        GNUNET_DISK_fn_write (filename,
                              &proof_of_work,
-                             sizeof(struct GNUNET_REVOCATION_Pow),
+                             sizeof(struct GNUNET_REVOCATION_PowP),
                              GNUNET_DISK_PERM_USER_READ
                              | GNUNET_DISK_PERM_USER_WRITE)))
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename);
@@ -278,10 +278,10 @@ calculate_pow (void *cls)
   if (GNUNET_OK == GNUNET_REVOCATION_pow_round (ph))
   {
     if ((NULL != filename) &&
-        (sizeof(struct GNUNET_REVOCATION_Pow) !=
+        (sizeof(struct GNUNET_REVOCATION_PowP) !=
          GNUNET_DISK_fn_write (filename,
                                &proof_of_work,
-                               sizeof(struct GNUNET_REVOCATION_Pow),
+                               sizeof(struct GNUNET_REVOCATION_PowP),
                                GNUNET_DISK_PERM_USER_READ
                                | GNUNET_DISK_PERM_USER_WRITE)))
       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename);
index 868c2b8531caf2ba35599796312a1c9dc7579875..635c56cfca43424fa55b87a0e49d71b155691a6b 100644 (file)
@@ -92,7 +92,7 @@ struct RevokeMessage
   /**
    * Number that causes a hash collision with the @e public_key.
    */
-  struct GNUNET_REVOCATION_Pow proof_of_work;
+  struct GNUNET_REVOCATION_PowP proof_of_work;
 };
 
 
index 18a312ab821c806c2abf5011a9718658fc6ed39a..12cb63c572add8185ca63f6cbcb7d51a9c538e17 100644 (file)
@@ -83,7 +83,7 @@ struct GNUNET_REVOCATION_PowCalculationHandle
   /**
    * The final PoW result data structure.
    */
-  struct GNUNET_REVOCATION_Pow *pow;
+  struct GNUNET_REVOCATION_PowP *pow;
 
   /**
    * The current nonce to try
@@ -297,7 +297,7 @@ handle_revocation_response (void *cls,
  */
 struct GNUNET_REVOCATION_Handle *
 GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                          const struct GNUNET_REVOCATION_Pow *pow,
+                          const struct GNUNET_REVOCATION_PowP *pow,
                           GNUNET_REVOCATION_Callback func,
                           void *func_cls)
 {
@@ -428,14 +428,14 @@ calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph)
  * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
  */
 enum GNUNET_GenericReturnValue
-GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
+GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
                              unsigned int difficulty,
                              struct GNUNET_TIME_Relative epoch_duration)
 {
   char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
            + sizeof (struct GNUNET_TIME_AbsoluteNBO)
            + sizeof (uint64_t)] GNUNET_ALIGN;
-  struct GNUNET_REVOCATION_SignaturePurpose spurp;
+  struct GNUNET_REVOCATION_SignaturePurposePS spurp;
   struct GNUNET_HashCode result;
   struct GNUNET_TIME_Absolute ts;
   struct GNUNET_TIME_Absolute exp;
@@ -538,10 +538,10 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
  */
 void
 GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
-                            struct GNUNET_REVOCATION_Pow *pow)
+                            struct GNUNET_REVOCATION_PowP *pow)
 {
   struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get ();
-  struct GNUNET_REVOCATION_SignaturePurpose rp;
+  struct GNUNET_REVOCATION_SignaturePurposePS rp;
 
   /**
    * Predate the validity period to prevent rejections due to
@@ -575,7 +575,7 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
  * @return a handle for use in PoW rounds
  */
 struct GNUNET_REVOCATION_PowCalculationHandle*
-GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow,
+GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow,
                              int epochs,
                              unsigned int difficulty)
 {