gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: fixed tests without uuid


From: gnunet
Subject: [taler-anastasis] branch master updated: fixed tests without uuid
Date: Tue, 07 Jul 2020 00:07:38 +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 ef50f36  fixed tests without uuid
ef50f36 is described below

commit ef50f36aa1503165a0aae3e007d9222e0f715e1c
Author: Dominik Meister <dominiksamuel.meister@students.bfh.ch>
AuthorDate: Tue Jul 7 00:07:31 2020 +0200

    fixed tests without uuid
---
 src/backend/anastasis-httpd_truth.c        | 27 ++++++++++++++----------
 src/backend/anastasis-httpd_truth.h        |  4 ++--
 src/backend/anastasis-httpd_truth_upload.c | 31 +++++++++++++++++-----------
 src/include/anastasis_database_plugin.h    | 16 ++++++++-------
 src/lib/Makefile.am                        |  2 +-
 src/lib/anastasis.c                        | 27 +++++++++++++-----------
 src/lib/anastasis_api_keyshare_lookup.c    | 10 +++------
 src/lib/anastasis_api_truth_store.c        | 13 ++++++------
 src/lib/testing_api_cmd_keyshare_lookup.c  | 23 +++++++++------------
 src/lib/testing_api_trait_truth_pub.c      |  4 ++--
 src/lib/testing_cmd_truth_upload.c         |  2 +-
 src/stasis/plugin_anastasis_postgres.c     | 33 ++++++++++++++++--------------
 src/stasis/test_anastasis_db.c             | 15 +++++++++-----
 13 files changed, 112 insertions(+), 95 deletions(-)

diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index e4e48fa..b97bec3 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -30,7 +30,7 @@
 
 /**
  * @param connection the MHD connection to handle
- * @param url handles a URL of the format "/truth/$UUID[&response=$RESPONSE]"
+ * @param url handles a URL of the format 
"/truth/$TRUTH_PUBLIC_KEY[&response=$RESPONSE]"
  * @param con_cls
  * @return MHD result code
  */
@@ -40,7 +40,7 @@ AH_handler_truth_get (struct MHD_Connection *connection,
                       void **con_cls)
 {
   // FIXME: Handle truth get
-  uuid_t uuid;
+  struct ANASTASIS_CRYPTO_TruthPublicKeyP truth_public_key;
   struct ANASTASIS_CRYPTO_TruthKeyP truth_key;
   struct GNUNET_HashCode challenge_response;
   const char *challenge_response_s;
@@ -53,20 +53,25 @@ AH_handler_truth_get (struct MHD_Connection *connection,
   char *method;
   int ret;
 
-  /* extract uuid from url */
+  /* extract public key from url */
   GNUNET_assert (0 == strncmp (url,
                                "/truth/",
                                strlen ("/truth/")));
   {
-    const char *uuid_str;
+    const char *pub_key_str;
 
-    uuid_str = &url[strlen ("/truth/")];
-    uuid_parse (uuid_str, uuid);
+    pub_key_str = &url[strlen ("/truth/")];
+    GNUNET_assert (NULL != pub_key_str);
+
+    GNUNET_STRINGS_string_to_data (pub_key_str,
+                                   strlen (pub_key_str),
+                                   &truth_public_key,
+                                   sizeof(struct
+                                          ANASTASIS_CRYPTO_TruthPublicKeyP));
 
-    GNUNET_assert (NULL != uuid_str);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Uuid from Url (keyshare lookup): %s\n",
-                TALER_B2S (&uuid));
+                "public key from Url (keyshare lookup): %s\n",
+                TALER_B2S (&truth_public_key));
 
     challenge_response_s = MHD_lookup_connection_value (connection,
                                                         MHD_GET_ARGUMENT_KIND,
@@ -111,7 +116,7 @@ AH_handler_truth_get (struct MHD_Connection *connection,
     enum ANASTASIS_DB_QueryStatus qs;
 
     qs = db->get_escrow_challenge (db->cls,
-                                   &uuid,
+                                   &truth_public_key,
                                    &encrypted_truth,
                                    &encrypted_truth_size,
                                    &truth_mime,
@@ -163,7 +168,7 @@ AH_handler_truth_get (struct MHD_Connection *connection,
         size_t encrypted_keyshare_size;
 
         qs = db->get_key_share (db->cls,
-                                &uuid,
+                                &truth_public_key,
                                 &encrypted_keyshare,
                                 &encrypted_keyshare_size);
 
diff --git a/src/backend/anastasis-httpd_truth.h 
b/src/backend/anastasis-httpd_truth.h
index aa3ae6e..ead9e16 100644
--- a/src/backend/anastasis-httpd_truth.h
+++ b/src/backend/anastasis-httpd_truth.h
@@ -26,7 +26,7 @@
 
 /**
  * @param connection the MHD connection to handle
- * @param url handles a URL of the format "/truth/$UUID[&response=$RESPONSE]"
+ * @param url handles a URL of the format 
"/truth/$TRUTH_PUBLIC_KEY[&response=$RESPONSE]"
  * @param con_cls
  * @return MHD result code
  */
@@ -38,7 +38,7 @@ AH_handler_truth_get (struct MHD_Connection *connection,
 /**
  * @param connection the MHD connection to handle
  * @param con_cls the connection's closure
- * @param url handles a URL of the format "/truth/$UUID
+ * @param url handles a URL of the format "/truth/$TRUTH_PUBLIC_KEY
  * @param truth_data truth data
  * @param truth_data_size number of bytes (left) in @a truth_data
  * @return MHD result code
diff --git a/src/backend/anastasis-httpd_truth_upload.c 
b/src/backend/anastasis-httpd_truth_upload.c
index 3952a5a..645e4e0 100644
--- a/src/backend/anastasis-httpd_truth_upload.c
+++ b/src/backend/anastasis-httpd_truth_upload.c
@@ -29,7 +29,6 @@
 #include <taler/taler_json_lib.h>
 #include <taler/taler_merchant_service.h>
 #include <taler/taler_signatures.h>
-#include <uuid/uuid.h>
 
 /**
  * @param connection the MHD connection to handle
@@ -39,11 +38,12 @@
 static int
 verify_and_execute_truth (struct MHD_Connection *connection,
                           struct ANASTASIS_DB_Truth *truth,
-                          const uuid_t *uuid)
+                          const struct
+                          ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key)
 {
   enum ANASTASIS_DB_QueryStatus qs;
   qs = db->store_truth (db->cls,
-                        uuid,
+                        truth_public_key,
                         &truth->keyshare_data,
                         truth->truth_mime,
                         truth->encrypted_truth,
@@ -60,7 +60,7 @@ verify_and_execute_truth (struct MHD_Connection *connection,
 /**
  * @param connection the MHD connection to handle
  * @param con_cls the connection's closure
- * @param url handles a URL of the format "/truth/$UUID
+ * @param url handles a URL of the format "/truth/$TRUTH_PUBLIC_KEY
  * @param truth_data truth data
  * @param truth_data_size number of bytes (left) in @a truth_data
  * @return MHD result code
@@ -74,22 +74,29 @@ AH_handler_truth_post (struct MHD_Connection *connection,
 {
   json_t *json;
   MHD_RESULT ret;
-  uuid_t uuid;
+  struct ANASTASIS_CRYPTO_TruthPublicKeyP truth_public_key;
   int res;
   struct ANASTASIS_DB_Truth truth;
 
-  /* extract uuid from url */
+  /* extract public key from url */
   GNUNET_assert (0 == strncmp (url,
                                "/truth/",
                                strlen ("/truth/")));
   {
-    const char *uuid_str;
+    const char *pub_key_str;
+
+    pub_key_str = &url[strlen ("/truth/")];
+    GNUNET_assert (NULL != pub_key_str);
+
+    GNUNET_STRINGS_string_to_data (pub_key_str,
+                                   strlen (pub_key_str),
+                                   &truth_public_key,
+                                   sizeof(struct
+                                          ANASTASIS_CRYPTO_TruthPublicKeyP));
 
-    uuid_str = &url[strlen ("/truth/")];
-    uuid_parse (uuid_str, uuid);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Uuid from Url: %s\n",
-                uuid_str);
+                "public key from Url: %s\n",
+                pub_key_str);
   }
   {
     struct GNUNET_JSON_Specification spec[] = {
@@ -129,7 +136,7 @@ AH_handler_truth_post (struct MHD_Connection *connection,
       return MHD_YES; /* failure */
     res = verify_and_execute_truth (connection,
                                     &truth,
-                                    &uuid);
+                                    &truth_public_key);
     json_decref (json);
     GNUNET_JSON_parse_free (spec);
     if (GNUNET_OK == res)
diff --git a/src/include/anastasis_database_plugin.h 
b/src/include/anastasis_database_plugin.h
index 407eae0..c725be4 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -26,7 +26,6 @@
 #include "anastasis_service.h"
 #include <jansson.h>
 #include <taler/taler_util.h>
-#include <uuid/uuid.h>
 
 /**
  * @brief Specification for a /truth operation.
@@ -243,7 +242,7 @@ struct ANASTASIS_DatabasePlugin
  * Upload Truth, which contains the Truth and the KeyShare.
  *
  * @param cls closure
- * @param uuid the identifier for the Truth
+ * @param truth_public_key the identifier for the Truth
  * @param key_share_data contains information of an EncryptedKeyShare
  * @param method name of method
  * @param nonce nonce used to compute encryption key for encrypted_truth
@@ -255,7 +254,8 @@ struct ANASTASIS_DatabasePlugin
  */
   enum ANASTASIS_DB_QueryStatus
   (*store_truth)(void *cls,
-                 const uuid_t *uuid,
+                 const struct
+                 ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
                  const struct
                  ANASTASIS_CRYPTO_EncryptedKeyShareP *key_share_data,
                  const char *mime_type,
@@ -268,7 +268,7 @@ struct ANASTASIS_DatabasePlugin
 
   /**
   * @param cls closure
-  * @param uuid the identifier for the Truth
+  * @param truth_public_key the identifier for the Truth
   * @param truth contains the encrypted truth
   * @param truth_size size of the encrypted truth
   * @param truth_mime mime type of truth
@@ -276,7 +276,8 @@ struct ANASTASIS_DatabasePlugin
   */
   enum ANASTASIS_DB_QueryStatus
   (*get_escrow_challenge)(void *cls,
-                          const uuid_t *uuid,
+                          const struct
+                          ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
                           void **truth,
                           size_t *truth_size,
                           char **truth_mime,
@@ -284,14 +285,15 @@ struct ANASTASIS_DatabasePlugin
 
   /**
   * @param cls closure
-  * @param uuid the identifier for the Truth
+  * @param truth_public_key the identifier for the Truth
   * @param key_share contains the encrypted Keyshare
   * @param key_share_size size of the Keyshare
   * @return transaction status
   */
   enum ANASTASIS_DB_QueryStatus
   (*get_key_share)(void *cls,
-                   const uuid_t *uuid,
+                   const struct
+                   ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
                    void **key_share,
                    size_t *key_share_size);
 
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 2123a29..cd1d449 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -66,7 +66,7 @@ libanastasistesting_la_SOURCES = \
   testing_api_trait_account_pub.c \
   testing_api_trait_account_priv.c \
   testing_api_trait_payment_identifier.c \
-  testing_api_trait_uuid.c \
+  testing_api_trait_truth_pub.c \
   testing_api_trait_hash.c \
   testing_api_trait_salt.c \
   testing_cmd_truth_upload.c \
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index e1eade3..a9fa287 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -646,9 +646,8 @@ policy_lookup_cb (void *cls,
 
     for (int a = 0; a < r->ri->dps[j].nonces_length; a++)
     {
-      char buf[33];
-      strncpy (buf,nonces + a * 33,33);
-      buf[32] = '\0';
+      char buf[52];
+      strncpy (buf,nonces + a * 52,52);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "At %s:%d buf is %s\n", __FILE__, __LINE__,
                   buf);
@@ -1686,17 +1685,21 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
                 TALER_B2S (policies[k]),
                 (unsigned long long) sizeof (struct ANASTASIS_Policy));
 
-    char nonces[33 * policies[k]->nonces_length + 1];
-    for (unsigned int a = 0; a < policies[k]->nonces_length; a++)
+
+    char nonces[52 * policies[k]->nonces_length + 1];
+    for (unsigned int b = 0; b < policies[k]->nonces_length; b++)
     {
-      char buf[33];
-      GNUNET_STRINGS_data_to_string (&policies[k]->nonces[a],
-                                     sizeof(struct ANASTASIS_CRYPTO_NonceP),
-                                     buf,
-                                     strlen (buf));
-      strncpy (nonces + a * strlen (buf), buf, strlen (buf));
+      char *nonce_str;
+      nonce_str = GNUNET_STRINGS_data_to_string_alloc (&policies[k]->nonces[b],
+                                                       sizeof (policies[k]->
+                                                               nonces[b]));
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "nonce is:  %s\n",
+                  nonce_str);
+      strncpy (nonces + b * strlen (nonce_str), nonce_str, strlen (nonce_str));
     }
-    nonces[33 * policies[k]->nonces_length] = '\0';
+
+    nonces[52 * policies[k]->nonces_length] = '\0';
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "At %s:%d nonces are %s b\n", __FILE__, __LINE__,
                 nonces);
diff --git a/src/lib/anastasis_api_keyshare_lookup.c 
b/src/lib/anastasis_api_keyshare_lookup.c
index 4a6d408..a79803a 100644
--- a/src/lib/anastasis_api_keyshare_lookup.c
+++ b/src/lib/anastasis_api_keyshare_lookup.c
@@ -253,7 +253,6 @@ ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context *ctx,
   struct ANASTASIS_KeyShareLookupOperation *kslo;
   CURL *eh;
   struct curl_slist *job_headers;
-  char pub_key_str[33];
   char *hashed_answer_str;
   char *path;
 
@@ -288,17 +287,14 @@ ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context 
*ctx,
   kslo->cb_cls = cb_cls;
   */
   kslo->truth_key = truth_key;
+  char *pub_key_str;
 
-  GNUNET_STRINGS_data_to_string (truth_public_key,
-                                 sizeof(struct
-                                        ANASTASIS_CRYPTO_TruthPublicKeyP),
-                                 pub_key_str,
-                                 strlen (pub_key_str));
+  pub_key_str = GNUNET_STRINGS_data_to_string_alloc (truth_public_key,
+                                                     sizeof 
(*truth_public_key));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "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
diff --git a/src/lib/anastasis_api_truth_store.c 
b/src/lib/anastasis_api_truth_store.c
index beaa16e..3370224 100644
--- a/src/lib/anastasis_api_truth_store.c
+++ b/src/lib/anastasis_api_truth_store.c
@@ -282,17 +282,16 @@ ANASTASIS_truth_store (struct GNUNET_CURL_Context *ctx,
   {
     if (NULL != truth_public_key)
     {
-      char pub_key_str[33];
+      char *pub_key_str;
       char *path;
 
-      GNUNET_STRINGS_data_to_string (truth_public_key,
-                                     sizeof(struct
-                                            ANASTASIS_CRYPTO_TruthPublicKeyP),
-                                     pub_key_str,
-                                     strlen (pub_key_str));
+      pub_key_str = GNUNET_STRINGS_data_to_string_alloc (truth_public_key,
+                                                         sizeof (*
+                                                                 
truth_public_key));
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "truth public key in keyshare lookup:  %s\n",
+                  "truth public key in truth store :  %s\n",
                   pub_key_str);
+
       GNUNET_asprintf (&path,
                        "truth/%s",
                        pub_key_str);
diff --git a/src/lib/testing_api_cmd_keyshare_lookup.c 
b/src/lib/testing_api_cmd_keyshare_lookup.c
index 6d13aad..7218d27 100644
--- a/src/lib/testing_api_cmd_keyshare_lookup.c
+++ b/src/lib/testing_api_cmd_keyshare_lookup.c
@@ -132,18 +132,15 @@ keyshare_lookup_run (void *cls,
       return;
     }
     {
-      const struct ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key;
-
       if (GNUNET_OK !=
           ANASTASIS_TESTING_get_trait_truth_public_key (upload_cmd,
                                                         0,
-                                                        &truth_public_key))
+                                                        
&ksls->truth_public_key))
       {
         GNUNET_break (0);
         TALER_TESTING_interpreter_fail (ksls->is);
         return;
       }
-      ksls->truth_public_key = truth_public_key;
       if (NULL == ksls->truth_public_key)
       {
         GNUNET_break (0);
@@ -153,17 +150,17 @@ keyshare_lookup_run (void *cls,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Truth public key from trait: %s\n",
                   TALER_B2S (ksls->truth_public_key));
-      if (GNUNET_OK !=
-          ANASTASIS_TESTING_get_trait_truth_public_key (upload_cmd,
-                                                        0,
-                                                        
&ksls->truth_public_key))
-      {
-        GNUNET_break (0);
-        TALER_TESTING_interpreter_fail (ksls->is);
-        return;
-      }
     }
   }
+
+  char *pub_key_str;
+  pub_key_str = GNUNET_STRINGS_data_to_string_alloc (ksls->truth_public_key,
+                                                     sizeof (*ksls->
+                                                             
truth_public_key));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "truth public key in keyshare testing cmd:  %s\n",
+              pub_key_str);
+
   ksls->kslo = ANASTASIS_keyshare_lookup (is->ctx,
                                           ksls->anastasis_url,
                                           ksls->truth_public_key,
diff --git a/src/lib/testing_api_trait_truth_pub.c 
b/src/lib/testing_api_trait_truth_pub.c
index 6c8a5bf..76d0fed 100644
--- a/src/lib/testing_api_trait_truth_pub.c
+++ b/src/lib/testing_api_trait_truth_pub.c
@@ -44,7 +44,7 @@ ANASTASIS_TESTING_get_trait_truth_public_key
   const struct ANASTASIS_CRYPTO_TruthPublicKeyP **tpk)
 {
   return cmd->traits (cmd->cls,
-                      (const void **) u,
+                      (const void **) tpk,
                       ANASTASIS_TESTING_TRAIT_TRUTH_PUB,
                       index);
 }
@@ -65,7 +65,7 @@ ANASTASIS_TESTING_make_trait_truth_public_key
   struct TALER_TESTING_Trait ret = {
     .index = index,
     .trait_name = ANASTASIS_TESTING_TRAIT_TRUTH_PUB,
-    .ptr = (const void *) u
+    .ptr = (const void *) tpk
   };
   return ret;
 }
diff --git a/src/lib/testing_cmd_truth_upload.c 
b/src/lib/testing_cmd_truth_upload.c
index 6769e3b..7d7e7e7 100644
--- a/src/lib/testing_cmd_truth_upload.c
+++ b/src/lib/testing_cmd_truth_upload.c
@@ -115,7 +115,7 @@ struct TruthUploadState
 * caller MUST free 't' using ANASTASIS_truth_free()
 *
 * @param cls closure for callback
-* @param t Truth object (contains provider url and uuid)
+* @param t Truth object (contains provider url and truth public key)
 */
 static void
 truth_upload_cb (void *cls,
diff --git a/src/stasis/plugin_anastasis_postgres.c 
b/src/stasis/plugin_anastasis_postgres.c
index 251b129..28f8ef9 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -27,7 +27,6 @@
 #include "anastasis_database_plugin.h"
 #include "anastasis_database_lib.h"
 #include "anastasis_error_codes.h"
-#include <uuid/uuid.h>
 
 /**
  * How often do we re-try if we run into a DB serialization error?
@@ -963,7 +962,7 @@ postgres_record_payment (void *cls,
  * Upload Truth, which contains the Truth and the KeyShare.
  *
  * @param cls closure
- * @param uuid the identifier for the Truth
+ * @param truth_public_key the identifier for the Truth
  * @param key_share_data contains information of an EncryptedKeyShare
  * @param key_share_data_size size of key_share_data
  * @param method name of method
@@ -976,7 +975,8 @@ postgres_record_payment (void *cls,
  */
 static enum ANASTASIS_DB_QueryStatus
 postgres_store_truth (void *cls,
-                      const uuid_t *uuid,
+                      const struct
+                      ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
                       const struct
                       ANASTASIS_CRYPTO_EncryptedKeyShareP *key_share_data,
                       const char *mime_type,
@@ -1004,7 +1004,7 @@ postgres_store_truth (void *cls,
 
   {
     struct GNUNET_PQ_QueryParam params[] = {
-      GNUNET_PQ_query_param_auto_from_type (uuid),
+      GNUNET_PQ_query_param_auto_from_type (truth_public_key),
       GNUNET_PQ_query_param_auto_from_type (key_share_data),
       GNUNET_PQ_query_param_string (method),
       GNUNET_PQ_query_param_fixed_size (encrypted_truth,
@@ -1051,7 +1051,7 @@ postgres_store_truth (void *cls,
  * Get the encrypted truth to validate the challenge response
  *
  * @param cls closure
- * @param uuid the identifier for the Truth
+ * @param truth_public_key the identifier for the Truth
  * @param truth contains the encrypted truth
  * @param truth_size size of encrypted truth
  * @param truth_mime mime type of truth
@@ -1059,7 +1059,9 @@ postgres_store_truth (void *cls,
  */
 enum ANASTASIS_DB_QueryStatus
 postgres_get_escrow_challenge (void *cls,
-                               const uuid_t *uuid,
+                               const struct
+                               ANASTASIS_CRYPTO_TruthPublicKeyP *
+                               truth_public_key,
                                void **truth,
                                size_t *truth_size,
                                char **truth_mime,
@@ -1067,7 +1069,7 @@ postgres_get_escrow_challenge (void *cls,
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (uuid),
+    GNUNET_PQ_query_param_auto_from_type (truth_public_key),
     GNUNET_PQ_query_param_end
   };
   struct GNUNET_PQ_ResultSpec rs[] = {
@@ -1091,20 +1093,21 @@ postgres_get_escrow_challenge (void *cls,
 
 /**
 * @param cls closure
-* @param uuid the identifier for the Truth
+* @param truth_public_key the identifier for the Truth
 * @param key_share contains the encrypted Keyshare
 * @param key_share_size size of the Keyshare
 * @return transaction status
 */
 enum ANASTASIS_DB_QueryStatus
 postgres_get_key_share (void *cls,
-                        const uuid_t *uuid,
+                        const struct
+                        ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
                         void **key_share,
                         size_t *key_share_size)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (uuid),
+    GNUNET_PQ_query_param_auto_from_type (truth_public_key),
     GNUNET_PQ_query_param_end
   };
   struct GNUNET_PQ_ResultSpec rs[] = {
@@ -1358,7 +1361,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
        The contract terms will change (nonce will be added) when moved to the
        contract terms table */
     GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS anastasis_truth"
-                            "(truth_id UUID PRIMARY KEY NOT NULL,"
+                            "(truth_public_key BYTEA PRIMARY KEY NOT NULL,"
                             " key_share_data BYTEA NOT NULL,"
                             " method VARCHAR,"
                             " encrypted_truth BYTEA NOT NULL,"
@@ -1471,7 +1474,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             1),
     GNUNET_PQ_make_prepare ("truth_insert",
                             "INSERT INTO anastasis_truth "
-                            "(truth_id"
+                            "(truth_public_key"
                             ",key_share_data"
                             ",method"
                             ",encrypted_truth"
@@ -1492,14 +1495,14 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             5),
     GNUNET_PQ_make_prepare ("truth_select",
                             "SELECT "
-                            "truth_id"
+                            "truth_public_key"
                             ",key_share_data"
                             ",method"
                             ",encrypted_truth"
                             ",truth_mime"
                             ",expiration"
                             " FROM anastasis_truth"
-                            " WHERE truth_id =$1;",
+                            " WHERE truth_public_key =$1;",
                             1),
     GNUNET_PQ_make_prepare ("latest_recoverydocument_select",
                             "SELECT "
@@ -1549,7 +1552,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             "key_share_data "
                             "FROM "
                             "anastasis_truth "
-                            "WHERE truth_id =$1;",
+                            "WHERE truth_public_key =$1;",
                             1),
     GNUNET_PQ_make_prepare ("recoverydocument_select_hash",
                             "SELECT "
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index 63a6bfc..e57c8cf 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -26,7 +26,6 @@
 #include "anastasis_database_plugin.h"
 #include "anastasis_database_lib.h"
 #include "anastasis_error_codes.h"
-#include <uuid/uuid.h>
 #include <gnunet/gnunet_signatures.h>
 
 
@@ -212,8 +211,14 @@ run (void *cls)
   mime_type = "Picture";
   method = "Methode";
   TALER_string_to_amount ("EUR:30",&amount);
-  uuid_t uuid;
-  uuid_generate (uuid);
+
+  struct ANASTASIS_CRYPTO_TruthPublicKeyP truth_public_key;
+  struct ANASTASIS_CRYPTO_NonceP truth_nonce;
+  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
+                              &truth_nonce,
+                              sizeof (struct ANASTASIS_CRYPTO_NonceP));
+  ANASTASIS_CRYPTO_truth_public_key_derive (&truth_nonce,
+                                            &truth_public_key);
 
   uint32_t nonce;
   RND_BLK (&nonce);
@@ -240,7 +245,7 @@ run (void *cls)
 
   FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->store_truth (plugin->cls,
-                               &uuid,
+                               &truth_public_key,
                                "key_share_data",
                                mime_type,
                                "encrypted_truth",
@@ -265,7 +270,7 @@ run (void *cls)
 
   FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->get_key_share (plugin->cls,
-                                 &uuid,
+                                 &truth_public_key,
                                  &res_key_share,
                                  &keysharesize));
 

-- 
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]