gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated (d59ff3f -> 8503982)


From: gnunet
Subject: [taler-anastasis] branch master updated (d59ff3f -> 8503982)
Date: Thu, 16 Apr 2020 09:19:23 +0200

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

dennis-neufeld pushed a change to branch master
in repository anastasis.

    from d59ff3f  worked on anastasis.c
     new 0edea08  fixed salt api test
     new 8503982  fixed some warnings

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/backend/anastasis-httpd_policy.c    |  1 -
 src/backend/anastasis-httpd_salt.c      |  9 +++------
 src/backend/anastasis-httpd_truth.c     |  4 ----
 src/include/anastasis_crypto_lib.h      |  2 +-
 src/include/anastasis_database_plugin.h |  2 --
 src/include/anastasis_service.h         |  2 +-
 src/include/anastasis_testing_lib.h     | 14 ++++++++++++++
 src/lib/Makefile.am                     |  1 +
 src/lib/anastasis_api_salt.c            | 29 ++++++++++++++++++++---------
 src/lib/test_anastasis_api.c            | 12 ++++++++++--
 src/lib/testing_api_cmd_policy_store.c  |  4 ++++
 src/lib/testing_api_cmd_salt.c          | 15 +++++++++++++--
 src/stasis/test_anastasis_db.c          | 15 ---------------
 13 files changed, 67 insertions(+), 43 deletions(-)

diff --git a/src/backend/anastasis-httpd_policy.c 
b/src/backend/anastasis-httpd_policy.c
index ff6ddd6..c3327ba 100644
--- a/src/backend/anastasis-httpd_policy.c
+++ b/src/backend/anastasis-httpd_policy.c
@@ -58,7 +58,6 @@ AH_return_policy (struct MHD_Connection *connection,
   MHD_RESULT ret;
   struct ANASTASIS_AccountSignatureP account_sig;
   struct GNUNET_HashCode recovery_data_hash;
-  struct GNUNET_HashCode prev_hash;
   const char *version_s;
   uint32_t version;
   void *res_recovery_data;
diff --git a/src/backend/anastasis-httpd_salt.c 
b/src/backend/anastasis-httpd_salt.c
index 44e4525..7b27b7f 100644
--- a/src/backend/anastasis-httpd_salt.c
+++ b/src/backend/anastasis-httpd_salt.c
@@ -38,15 +38,12 @@ AH_handler_salt (struct MHD_Connection *connection,
                  const char *url,
                  void **con_cls)
 {
-  struct ANASTASIS_CRYPTO_Salt salt;
-  salt.salt = (char *) AH_server_salt;
-
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Server Salt: %s\n",
-              salt.salt);
+              (char *) AH_server_salt);
   return TALER_MHD_reply_json_pack (connection,
                                     MHD_HTTP_OK,
-                                    "{s:o}",
+                                    "{s:s}",
                                     "server_salt",
-                                    GNUNET_JSON_from_data_auto (&salt));
+                                    (char *) AH_server_salt);
 }
\ No newline at end of file
diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index 0b251ee..7db3d6a 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -47,8 +47,6 @@ AH_handler_truth_get (struct MHD_Connection *connection,
   void *decrypted_truth;
   void *encrypted_keyshare;
   char result[GNUNET_CRYPTO_AES_KEY_LENGTH];
-  uint32_t *nonce;
-  unsigned char *aes_gcm_tag[16];
   char *truth_mime;
   char *method;
   int ret;
@@ -101,8 +99,6 @@ AH_handler_truth_get (struct MHD_Connection *connection,
                                    &uuid,
                                    encrypted_truth,
                                    &encrypted_truth_size,
-                                   aes_gcm_tag,
-                                   &nonce,
                                    &truth_mime,
                                    &method);
     if (qs != ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT)
diff --git a/src/include/anastasis_crypto_lib.h 
b/src/include/anastasis_crypto_lib.h
index 9bfd407..4358442 100644
--- a/src/include/anastasis_crypto_lib.h
+++ b/src/include/anastasis_crypto_lib.h
@@ -57,7 +57,7 @@ struct ANASTASIS_CRYPTO_TruthKey
 */
 struct ANASTASIS_CRYPTO_Salt
 {
-  char*salt;
+  const char *salt;
 };
 
 
diff --git a/src/include/anastasis_database_plugin.h 
b/src/include/anastasis_database_plugin.h
index 518ff34..b58a3e8 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -279,8 +279,6 @@ struct ANASTASIS_DatabasePlugin
                           const uuid_t *uuid,
                           void **truth,
                           size_t *truth_size,
-                          unsigned char **aes_gcm_tag,
-                          uint32_t **nonce,
                           char **truth_mime,
                           char **method);
 
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index d7254b5..d0e13b0 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -252,7 +252,7 @@ struct ANASTASIS_UploadDetails
 typedef void
 (*ANASTASIS_SaltCallback)(void *cls,
                           unsigned int http_status,
-                          struct ANASTASIS_CRYPTO_Salt *salt);
+                          const struct ANASTASIS_CRYPTO_Salt *salt);
 
 
 struct ANASTASIS_SaltOperation *
diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index a9d9962..b6cda89 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -366,4 +366,18 @@ ANASTASIS_TESTING_cmd_truth_lookup (const char *label,
                                     unsigned int http_status,
                                     const char *upload_ref);
 
+/**
+ * Make the "salt" command.
+ *
+ * @param label command label
+ * @param anastasis_url base URL of the ANASTASIS serving
+ *        the salt request.
+ * @param http_status expected HTTP status.
+ * @return the command
+ */
+struct TALER_TESTING_Command
+ANASTASIS_TESTING_cmd_salt (const char *label,
+                            const char *anastasis_url,
+                            unsigned int http_status);
+
 #endif
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index ea2da4a..2ff47a5 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -58,6 +58,7 @@ libanastasistesting_la_SOURCES = \
   testing_api_cmd_policy_store.c \
   testing_api_cmd_truth_store.c \
   testing_api_cmd_policy_lookup.c \
+  testing_api_cmd_salt.c \
   testing_api_helpers.c \
   testing_api_trait_account_pub.c \
   testing_api_trait_account_priv.c \
diff --git a/src/lib/anastasis_api_salt.c b/src/lib/anastasis_api_salt.c
index 67cdaea..b36888d 100644
--- a/src/lib/anastasis_api_salt.c
+++ b/src/lib/anastasis_api_salt.c
@@ -97,7 +97,7 @@ handle_salt_finished (void *cls,
   case MHD_HTTP_OK:
     {
       struct GNUNET_JSON_Specification spec[] = {
-        GNUNET_JSON_spec_fixed_auto ("server_salt", &so->salt),
+        GNUNET_JSON_spec_string ("server_salt", &so->salt.salt),
         GNUNET_JSON_spec_end ()
       };
 
@@ -105,8 +105,19 @@ handle_salt_finished (void *cls,
                      GNUNET_JSON_parse (json,
                                         spec,
                                         NULL, NULL));
+
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Salt json from download: %s\n\n",
+                  json_dumps (json, JSON_COMPACT));
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Salt from download: %s\n\n",
+                  so->salt.salt);
+      so->cb (so->cb_cls,
+              response_code,
+              &so->salt);
+      ANASTASIS_salt_cancel (so);
+      return;
     }
-    break;
   case MHD_HTTP_BAD_REQUEST:
     /* This should never happen, either us or the anastasis server is buggy
        (or API version conflict); just pass JSON reply to the application */
@@ -131,7 +142,7 @@ handle_salt_finished (void *cls,
   {
     so->cb (so->cb_cls,
             response_code,
-            &so->salt);
+            NULL);
     so->cb = NULL;
   }
   ANASTASIS_salt_cancel (so);
@@ -149,17 +160,17 @@ ANASTASIS_salt (struct GNUNET_CURL_Context *ctx,
 
   so = GNUNET_new (struct ANASTASIS_SaltOperation);
   so->url = TALER_url_join (base_url,
-                            "/salt",
+                            "salt",
                             NULL);
   so->ctx = ctx;
   so->cb = cb;
   so->cb_cls = cb_cls;
   eh = ANASTASIS_curl_easy_get_ (so->url);
-  so->job = GNUNET_CURL_job_add (ctx,
-                                 eh,
-                                 GNUNET_NO,
-                                 &handle_salt_finished,
-                                 so);
+  so->job = GNUNET_CURL_job_add2 (ctx,
+                                  eh,
+                                  GNUNET_NO,
+                                  &handle_salt_finished,
+                                  so);
   return so;
 }
 
diff --git a/src/lib/test_anastasis_api.c b/src/lib/test_anastasis_api.c
index ed81e12..984699a 100644
--- a/src/lib/test_anastasis_api.c
+++ b/src/lib/test_anastasis_api.c
@@ -236,8 +236,6 @@ run (void *cls,
   };
 
   struct TALER_TESTING_Command truth[] = {
-    // FIXME: Code for truth handling
-
     ANASTASIS_TESTING_cmd_truth_store ("truth-store-1",
                                        anastasis_url,
                                        NULL,
@@ -249,6 +247,13 @@ run (void *cls,
     TALER_TESTING_cmd_end ()
   };
 
+  struct TALER_TESTING_Command salt[] = {
+    ANASTASIS_TESTING_cmd_salt ("salt-request-1",
+                                anastasis_url,
+                                MHD_HTTP_OK),
+    TALER_TESTING_cmd_end ()
+  };
+
   struct TALER_TESTING_Command commands[] = {
 
     TALER_TESTING_cmd_batch ("pay",
@@ -260,6 +265,9 @@ run (void *cls,
     TALER_TESTING_cmd_batch ("truth",
                              truth),
 
+    TALER_TESTING_cmd_batch ("salt",
+                             salt),
+
 
     /**
      * End the suite.  Fixme: better to have a label for this
diff --git a/src/lib/testing_api_cmd_policy_store.c 
b/src/lib/testing_api_cmd_policy_store.c
index 04b04ec..b4e24e1 100644
--- a/src/lib/testing_api_cmd_policy_store.c
+++ b/src/lib/testing_api_cmd_policy_store.c
@@ -240,6 +240,10 @@ policy_store_cb (void *cls,
       GNUNET_break (0);
       TALER_TESTING_interpreter_fail (pss->is);
       return;
+    default:
+      GNUNET_break (0);
+      TALER_TESTING_interpreter_fail (pss->is);
+      return;
     }
   }
   TALER_TESTING_interpreter_next (pss->is);
diff --git a/src/lib/testing_api_cmd_salt.c b/src/lib/testing_api_cmd_salt.c
index d67b32e..31dd81d 100644
--- a/src/lib/testing_api_cmd_salt.c
+++ b/src/lib/testing_api_cmd_salt.c
@@ -67,7 +67,7 @@ salt_cb (void *cls,
 {
   struct SaltState *ss = cls;
 
-  ss->plo = NULL;
+  ss->so = NULL;
   if (http_status != ss->http_status)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -79,6 +79,17 @@ salt_cb (void *cls,
     TALER_TESTING_interpreter_fail (ss->is);
     return;
   }
+  if (NULL == salt)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Salt is NULL, command %s in %s:%u\n",
+                ss->is->commands[ss->is->ip].label,
+                __FILE__,
+                __LINE__);
+    TALER_TESTING_interpreter_fail (ss->is);
+    return;
+  }
+  TALER_TESTING_interpreter_next (ss->is);
 }
 
 
@@ -99,7 +110,7 @@ salt_run (void *cls,
   ss->is = is;
   ss->so = ANASTASIS_salt (is->ctx,
                            ss->anastasis_url,
-                           &salt_cb,
+                           salt_cb,
                            ss);
   if (NULL == ss->so)
   {
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index 308c8ef..4e11be8 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -86,11 +86,6 @@ struct GNUNET_HashCode recoveryDataHash;
  */
 struct GNUNET_HashCode res_recovery_data_hash;
 
-/**
- * Amount which is deposited, set to random value
- */
-static struct TALER_Amount amount;
-
 /**
  * How many posts are paid by the payment
  */
@@ -111,11 +106,6 @@ static void *res_recovery_data;
  */
 static void *truth_data;
 
-/**
- * Truth for the select test
- */
-static void *truth;
-
 /**
  * Keyshare which is stored into the Database, set to a random value
  */
@@ -131,11 +121,6 @@ static void *res_key_share;
  */
 static char *mime_type;
 
-/**
- * Mime-type of truth for the select test
- */
-static char *res_mime_type;
-
 /**
  * Method
  */

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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