gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: uuid remove


From: gnunet
Subject: [taler-anastasis] branch master updated: uuid remove
Date: Mon, 06 Jul 2020 20:24:06 +0200

This is an automated email from the git hooks/post-receive script.

ds-meister pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new ae580d9  uuid remove
ae580d9 is described below

commit ae580d950e63f3bdf391fa0c1d665571075d1507
Author: Dominik Meister <dominiksamuel.meister@students.bfh.ch>
AuthorDate: Mon Jul 6 20:23:56 2020 +0200

    uuid remove
---
 src/include/anastasis_service.h                    | 20 ++++++----------
 src/include/anastasis_testing_lib.h                | 23 ++++++++++--------
 src/lib/anastasis_api_keyshare_lookup.c            | 27 ++++++++++++----------
 src/lib/anastasis_api_truth_store.c                | 27 +++++++++++++---------
 src/lib/testing_api_cmd_keyshare_lookup.c          | 26 ++++++++++-----------
 src/lib/testing_api_cmd_truth_store.c              | 26 ++++++++++++---------
 ..._trait_uuid.c => testing_api_trait_truth_pub.c} | 24 +++++++++----------
 7 files changed, 92 insertions(+), 81 deletions(-)

diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index 9544458..70abc62 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -29,7 +29,6 @@
 #include "anastasis_crypto_lib.h"
 #include <jansson.h>
 #include "anastasis_error_codes.h"
-#include <uuid/uuid.h>
 
 GNUNET_NETWORK_STRUCT_BEGIN
 
@@ -43,13 +42,6 @@ struct ANASTASIS_PaymentSecretP
 
 struct ANASTASIS_SaltOperation;
 
-/**
- * Uuid used for truth upload/download
- */
-struct ANASTASIS_UuidP
-{
-  uuid_t uuid;
-};
 
 /**
  * Data signed by the account public key of a sync client to
@@ -536,7 +528,7 @@ typedef void
  *
  * @param ctx execution context
  * @param backend_url base URL of the merchant backend
- * @param truth_uuid identification of the Truth
+ * @param truth_public_key identification of the Truth
  * @param truth_key Key used to Decrypt the Truth on the Server
  * @param hashed_answer Hashed answer for the Securityquestion
  * @param cb callback which will work the response gotten from the backend
@@ -546,7 +538,8 @@ typedef void
 struct ANASTASIS_KeyShareLookupOperation *
 ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context *ctx,
                            const char *backend_url,
-                           const uuid_t *truth_uuid,
+                           const struct
+                           ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
                            const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key,
                            const struct GNUNET_HashCode *hashed_answer,
                            ANASTASIS_KeyShareLookupCallback cb,
@@ -582,11 +575,11 @@ typedef void
                                  unsigned int http_status,
                                  const struct ANASTASIS_UploadDetails *up);
 /**
- * Store Truth, does a POST /truth/$UUID
+ * Store Truth, does a POST /truth/$TRUTH_PUBLIC_KEY
  *
  * @param ctx the CURL context used to connect to the backend
  * @param backend_url backend's base URL, including final "/"
- * @param truth_uuid Identfication of the Truth Upload
+ * @param truth_public_key Identfication of the Truth Upload
  * @param prev_truth_data_hash hash of the previous truth upload, NULL for the 
first upload ever
  * @param truth_data contains the data which is stored on the Server in JSON 
Format
  * @param payment_requested
@@ -598,7 +591,8 @@ typedef void
 struct ANASTASIS_TruthStoreOperation *
 ANASTASIS_truth_store (struct GNUNET_CURL_Context *ctx,
                        const char *backend_url,
-                       const uuid_t *truth_uuid,
+                       const struct
+                       ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
                        json_t *truth_data,
                        int payment_requested,
                        const char *paid_order_id,
diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index a6e75a0..2249a65 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -160,28 +160,33 @@ ANASTASIS_TESTING_make_trait_payment_identifier (unsigned 
int index,
                                                  ANASTASIS_PaymentSecretP *h);
 
 /**
- * Obtain an uuid from @a cmd.
+ * Obtain an truth public key from @a cmd.
  *
  * @param cmd command to extract the number from.
  * @param index the number's index number.
- * @param u[out] set to the number coming from @a cmd.
+ * @param tpk[out] set to the number coming from @a cmd.
  * @return #GNUNET_OK on success.
  */
 int
-ANASTASIS_TESTING_get_trait_uuid (const struct TALER_TESTING_Command *cmd,
-                                  unsigned int index,
-                                  const uuid_t **u);
+ANASTASIS_TESTING_get_trait_truth_public_key (const struct
+                                              TALER_TESTING_Command *cmd,
+                                              unsigned int index,
+                                              const struct
+                                              ANASTASIS_CRYPTO_TruthPublicKeyP 
*
+                                              *tpk);
 
 /**
- * Offer an uuid.
+ * Offer a truth public key.
  *
  * @param index the number's index number.
- * @param u the uuid to offer.
+ * @param tpk the public key to offer.
  * @return #GNUNET_OK on success.
  */
 struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_uuid (unsigned int index,
-                                   const uuid_t *u);
+ANASTASIS_TESTING_make_trait_truth_public_key (unsigned int index,
+                                               const struct
+                                               ANASTASIS_CRYPTO_TruthPublicKeyP
+                                               *tpk);
 
 /**
  * Prepare the merchant execution.  Create tables and check if
diff --git a/src/lib/anastasis_api_keyshare_lookup.c 
b/src/lib/anastasis_api_keyshare_lookup.c
index aac19e9..4a6d408 100644
--- a/src/lib/anastasis_api_keyshare_lookup.c
+++ b/src/lib/anastasis_api_keyshare_lookup.c
@@ -67,7 +67,7 @@ struct ANASTASIS_KeyShareLookupOperation
   /**
    * Identification of the Truth Object
    */
-  const uuid_t *truth_uuid;
+  const struct ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key;
 
   /**
    * Key to decrypt the truth on the server
@@ -233,7 +233,7 @@ handle_header (char *buffer,
  *
  * @param ctx execution context
  * @param backend_url base URL of the merchant backend
- * @param truth_uuid identification of the Truth
+ * @param truth_public_key identification of the Truth
  * @param truth_key Key used to Decrypt the Truth on the Server
  * @param hashed_answer Hashed answer for the Securityquestion
  * @param cb callback which will work the response gotten from the backend
@@ -243,7 +243,8 @@ handle_header (char *buffer,
 struct ANASTASIS_KeyShareLookupOperation *
 ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context *ctx,
                            const char *backend_url,
-                           const uuid_t *truth_uuid,
+                           const struct
+                           ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
                            const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key,
                            const struct GNUNET_HashCode *hashed_answer,
                            ANASTASIS_KeyShareLookupCallback cb,
@@ -252,7 +253,7 @@ ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context *ctx,
   struct ANASTASIS_KeyShareLookupOperation *kslo;
   CURL *eh;
   struct curl_slist *job_headers;
-  char uuid_str[37];
+  char pub_key_str[33];
   char *hashed_answer_str;
   char *path;
 
@@ -288,21 +289,23 @@ ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context 
*ctx,
   */
   kslo->truth_key = truth_key;
 
-  GNUNET_assert (GNUNET_NO == uuid_is_null (*truth_uuid));
+  GNUNET_STRINGS_data_to_string (truth_public_key,
+                                 sizeof(struct
+                                        ANASTASIS_CRYPTO_TruthPublicKeyP),
+                                 pub_key_str,
+                                 strlen (pub_key_str));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "UUID in keyshare lookup: %s\n",
-              TALER_B2S (truth_uuid));
-  uuid_unparse (*truth_uuid, uuid_str);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "UUID in keyshare lookup:  %s\n",
-              uuid_str);
+              "truth public key in keyshare lookup:  %s\n",
+              pub_key_str);
+
+
   GNUNET_assert (NULL != hashed_answer);
   hashed_answer_str = GNUNET_STRINGS_data_to_string_alloc (hashed_answer,
                                                            sizeof (struct
                                                                    
GNUNET_HashCode));
   GNUNET_asprintf (&path,
                    "truth/%s",
-                   uuid_str);
+                   pub_key_str);
   // GNUNET_free (uuid_str);
   kslo->url = TALER_url_join (backend_url,
                               path,
diff --git a/src/lib/anastasis_api_truth_store.c 
b/src/lib/anastasis_api_truth_store.c
index f4c744d..beaa16e 100644
--- a/src/lib/anastasis_api_truth_store.c
+++ b/src/lib/anastasis_api_truth_store.c
@@ -243,11 +243,11 @@ handle_header (char *buffer,
 
 
 /**
- * Store Truth, does a POST /truth/$UUID
+ * Store Truth, does a POST /truth/$TRUTH_PUBLIC_KEY
  *
  * @param ctx the CURL context used to connect to the backend
  * @param backend_url backend's base URL, including final "/"
- * @param truth_uuid Identfication of the Truth Upload
+ * @param truth_public_key Identfication of the Truth Upload
  * @param prev_truth_data_hash hash of the previous truth upload, NULL for the 
first upload ever
  * @param truth_data contains the data which is stored on the Server in JSON 
Format
  * @param payment_requested
@@ -259,7 +259,8 @@ handle_header (char *buffer,
 struct ANASTASIS_TruthStoreOperation *
 ANASTASIS_truth_store (struct GNUNET_CURL_Context *ctx,
                        const char *backend_url,
-                       const uuid_t *truth_uuid,
+                       const struct
+                       ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
                        json_t *truth_data,
                        int payment_requested,
                        const char *paid_order_id,
@@ -279,18 +280,22 @@ ANASTASIS_truth_store (struct GNUNET_CURL_Context *ctx,
   /* Finished setting up headers */
   tso = GNUNET_new (struct ANASTASIS_TruthStoreOperation);
   {
-    if (NULL != truth_uuid)
+    if (NULL != truth_public_key)
     {
-      char uuid_str[37];
+      char pub_key_str[33];
       char *path;
 
-      uuid_unparse (*truth_uuid, uuid_str);
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "UUID:  %s\n",
-                  uuid_str);
+      GNUNET_STRINGS_data_to_string (truth_public_key,
+                                     sizeof(struct
+                                            ANASTASIS_CRYPTO_TruthPublicKeyP),
+                                     pub_key_str,
+                                     strlen (pub_key_str));
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "truth public key in keyshare lookup:  %s\n",
+                  pub_key_str);
       GNUNET_asprintf (&path,
                        "truth/%s",
-                       uuid_str);
+                       pub_key_str);
       tso->url = (GNUNET_YES == payment_requested)
                  ? TALER_url_join (backend_url,
                                    path,
@@ -313,7 +318,7 @@ ANASTASIS_truth_store (struct GNUNET_CURL_Context *ctx,
     else
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                  "No uuid set");
+                  "No public key set");
       return NULL;
     }
   }
diff --git a/src/lib/testing_api_cmd_keyshare_lookup.c 
b/src/lib/testing_api_cmd_keyshare_lookup.c
index 37f21a6..6d13aad 100644
--- a/src/lib/testing_api_cmd_keyshare_lookup.c
+++ b/src/lib/testing_api_cmd_keyshare_lookup.c
@@ -65,7 +65,7 @@ struct KeyShareLookupState
   /**
    * Identification of the Truth Object
    */
-  const uuid_t *truth_uuid;
+  const struct ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key;
 
   /**
    * Reference to upload command we expect to lookup.
@@ -132,31 +132,31 @@ keyshare_lookup_run (void *cls,
       return;
     }
     {
-      const uuid_t *uuid;
+      const struct ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key;
 
       if (GNUNET_OK !=
-          ANASTASIS_TESTING_get_trait_uuid (upload_cmd,
-                                            0,
-                                            &uuid))
+          ANASTASIS_TESTING_get_trait_truth_public_key (upload_cmd,
+                                                        0,
+                                                        &truth_public_key))
       {
         GNUNET_break (0);
         TALER_TESTING_interpreter_fail (ksls->is);
         return;
       }
-      ksls->truth_uuid = uuid;
-      if (NULL == ksls->truth_uuid)
+      ksls->truth_public_key = truth_public_key;
+      if (NULL == ksls->truth_public_key)
       {
         GNUNET_break (0);
         TALER_TESTING_interpreter_fail (ksls->is);
         return;
       }
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Uuid from trait: %s\n",
-                  TALER_B2S (ksls->truth_uuid));
+                  "Truth public key from trait: %s\n",
+                  TALER_B2S (ksls->truth_public_key));
       if (GNUNET_OK !=
-          ANASTASIS_TESTING_get_trait_uuid (upload_cmd,
-                                            0,
-                                            &ksls->truth_uuid))
+          ANASTASIS_TESTING_get_trait_truth_public_key (upload_cmd,
+                                                        0,
+                                                        
&ksls->truth_public_key))
       {
         GNUNET_break (0);
         TALER_TESTING_interpreter_fail (ksls->is);
@@ -166,7 +166,7 @@ keyshare_lookup_run (void *cls,
   }
   ksls->kslo = ANASTASIS_keyshare_lookup (is->ctx,
                                           ksls->anastasis_url,
-                                          ksls->truth_uuid,
+                                          ksls->truth_public_key,
                                           &ksls->truth_key,
                                           &ksls->hashed_answer,
                                           &keyshare_lookup_cb,
diff --git a/src/lib/testing_api_cmd_truth_store.c 
b/src/lib/testing_api_cmd_truth_store.c
index e994d20..910cf77 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -20,7 +20,6 @@
  */
 
 #include "platform.h"
-#include <uuid/uuid.h>
 #include "anastasis_testing_lib.h"
 #include <taler/taler_util.h>
 #include <taler/taler_testing_lib.h>
@@ -41,9 +40,9 @@ struct TruthStoreState
   unsigned int http_status;
 
   /**
-   * Uuid of truth
+   *TruthPublicKey of truth
    */
-  uuid_t truth_uuid;
+  struct ANASTASIS_CRYPTO_TruthPublicKeyP truth_public_key;
 
   /**
    * Hash of the current upload.
@@ -255,17 +254,22 @@ truth_store_run (void *cls,
     }
   }
   {
-    // Create an uuid
-    uuid_generate (tss->truth_uuid);
-    GNUNET_assert (GNUNET_NO == uuid_is_null (tss->truth_uuid));
+
+    // Create a truth public key
+    struct ANASTASIS_CRYPTO_NonceP nonce;
+    GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
+                                &nonce,
+                                sizeof (struct ANASTASIS_CRYPTO_NonceP));
+    ANASTASIS_CRYPTO_truth_public_key_derive (&nonce,
+                                              &tss->truth_public_key);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Uuid stored in tss: %s\n",
-                TALER_B2S (&tss->truth_uuid));
+                "public key stored in tss: %s\n",
+                TALER_B2S (&tss->truth_public_key));
   }
 
   tss->tso = ANASTASIS_truth_store (is->ctx,
                                     tss->anastasis_url,
-                                    &tss->truth_uuid,
+                                    &tss->truth_public_key,
                                     tss->truth_data,
                                     (0 !=
                                      (ANASTASIS_TESTING_TSO_REQUEST_PAYMENT
@@ -328,8 +332,8 @@ truth_store_traits (void *cls,
   struct TALER_TESTING_Trait traits[] = {
     ANASTASIS_TESTING_make_trait_hash (ANASTASIS_TESTING_TRAIT_HASH_CURRENT,
                                        &tss->curr_hash),
-    ANASTASIS_TESTING_make_trait_uuid (0,
-                                       &tss->truth_uuid),
+    ANASTASIS_TESTING_make_trait_truth_public_key (0,
+                                                   &tss->truth_public_key),
     TALER_TESTING_make_trait_order_id (0,
                                        tss->payment_order_id),
     TALER_TESTING_trait_end ()
diff --git a/src/lib/testing_api_trait_uuid.c 
b/src/lib/testing_api_trait_truth_pub.c
similarity index 72%
rename from src/lib/testing_api_trait_uuid.c
rename to src/lib/testing_api_trait_truth_pub.c
index 4a61eeb..6c8a5bf 100644
--- a/src/lib/testing_api_trait_uuid.c
+++ b/src/lib/testing_api_trait_truth_pub.c
@@ -17,7 +17,7 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file lib/testing_api_trait_uuid.c
+ * @file lib/testing_api_trait_truth_pub.c
  * @brief traits to offer a hash
  * @author Christian Grothoff
  * @author Dominik Meister
@@ -26,11 +26,11 @@
 #include "platform.h"
 #include "anastasis_testing_lib.h"
 
-#define ANASTASIS_TESTING_TRAIT_UUID "anastasis-uuid"
+#define ANASTASIS_TESTING_TRAIT_TRUTH_PUB "anastasis-truth-pub"
 
 
 /**
- * Obtain an uuid from @a cmd.
+ * Obtain an public key from @a cmd.
  *
  * @param cmd command to extract the number from.
  * @param index the number's index number.
@@ -38,37 +38,37 @@
  * @return #GNUNET_OK on success.
  */
 int
-ANASTASIS_TESTING_get_trait_uuid
+ANASTASIS_TESTING_get_trait_truth_public_key
   (const struct TALER_TESTING_Command *cmd,
   unsigned int index,
-  const uuid_t **u)
+  const struct ANASTASIS_CRYPTO_TruthPublicKeyP **tpk)
 {
   return cmd->traits (cmd->cls,
                       (const void **) u,
-                      ANASTASIS_TESTING_TRAIT_UUID,
+                      ANASTASIS_TESTING_TRAIT_TRUTH_PUB,
                       index);
 }
 
 
 /**
- * Offer an uuid.
+ * Offer a truth public key.
  *
  * @param index the number's index number.
- * @param u the uuid to offer.
+ * @param tpk the public key to offer.
  * @return #GNUNET_OK on success.
  */
 struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_uuid
+ANASTASIS_TESTING_make_trait_truth_public_key
   (unsigned int index,
-  const uuid_t *u)
+  const struct ANASTASIS_CRYPTO_TruthPublicKeyP *tpk)
 {
   struct TALER_TESTING_Trait ret = {
     .index = index,
-    .trait_name = ANASTASIS_TESTING_TRAIT_UUID,
+    .trait_name = ANASTASIS_TESTING_TRAIT_TRUTH_PUB,
     .ptr = (const void *) u
   };
   return ret;
 }
 
 
-/* end of testing_api_trait_uuid.c */
+/* end of testing_api_trait_truth_pub.c */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]