gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated (bd7a177 -> 283d700)


From: gnunet
Subject: [taler-anastasis] branch master updated (bd7a177 -> 283d700)
Date: Wed, 15 Apr 2020 17:00:35 +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 bd7a177  worked on salt api
     new f3d5abe  worked on salt api testing
     new 283d700  deleted aes_gcm_tag and nonce from truth: encrypted_truth 
contains them

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_truth_upload.c |   4 -
 src/include/anastasis_database_plugin.h    |   2 -
 src/lib/anastasis_api_curl_defaults.h      |   2 +-
 src/lib/testing_api_cmd_salt.c             | 167 +++++++++++++++++++++++++++++
 src/lib/testing_api_cmd_truth_store.c      |  13 ---
 src/stasis/plugin_anastasis_postgres.c     |  19 +---
 src/stasis/test_anastasis_db.c             |   2 -
 7 files changed, 169 insertions(+), 40 deletions(-)
 create mode 100644 src/lib/testing_api_cmd_salt.c

diff --git a/src/backend/anastasis-httpd_truth_upload.c 
b/src/backend/anastasis-httpd_truth_upload.c
index a464a84..3952a5a 100644
--- a/src/backend/anastasis-httpd_truth_upload.c
+++ b/src/backend/anastasis-httpd_truth_upload.c
@@ -48,8 +48,6 @@ verify_and_execute_truth (struct MHD_Connection *connection,
                         truth->truth_mime,
                         truth->encrypted_truth,
                         truth->encrypted_truth_size,
-                        &truth->aes_gcm_tag,
-                        &truth->nonce,
                         truth->method,
                         AH_truth_expiration);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -97,8 +95,6 @@ AH_handler_truth_post (struct MHD_Connection *connection,
     struct GNUNET_JSON_Specification spec[] = {
       GNUNET_JSON_spec_fixed_auto ("keyshare_data", &truth.keyshare_data),
       GNUNET_JSON_spec_string ("method", &truth.method),
-      GNUNET_JSON_spec_fixed_auto ("nonce", &truth.nonce),
-      GNUNET_JSON_spec_fixed_auto ("aes_gcm_tag", &truth.aes_gcm_tag),
       GNUNET_JSON_spec_varsize ("encrypted_truth", &truth.encrypted_truth,
                                 &truth.encrypted_truth_size),
       GNUNET_JSON_spec_string ("truth_mime", &truth.truth_mime),
diff --git a/src/include/anastasis_database_plugin.h 
b/src/include/anastasis_database_plugin.h
index 9929b66..518ff34 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -261,8 +261,6 @@ struct ANASTASIS_DatabasePlugin
                  const char *mime_type,
                  const void *encrypted_truth,
                  size_t encrypted_truth_size,
-                 const struct ANASTASIS_CRYPTO_AesTag *aes_gcm_tag,
-                 const struct ANASTASIS_CRYPTO_Nonce *nonce,
                  const char *method,
                  struct
                  GNUNET_TIME_Relative truth_expiration);
diff --git a/src/lib/anastasis_api_curl_defaults.h 
b/src/lib/anastasis_api_curl_defaults.h
index 4bfac15..275886d 100644
--- a/src/lib/anastasis_api_curl_defaults.h
+++ b/src/lib/anastasis_api_curl_defaults.h
@@ -15,7 +15,7 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file lib/sync_api_curl_defaults.h
+ * @file lib/anastasis_api_curl_defaults.h
  * @brief curl easy handle defaults
  * @author Florian Dold
  */
diff --git a/src/lib/testing_api_cmd_salt.c b/src/lib/testing_api_cmd_salt.c
new file mode 100644
index 0000000..d67b32e
--- /dev/null
+++ b/src/lib/testing_api_cmd_salt.c
@@ -0,0 +1,167 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2019 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify it under the
+  terms of the GNU Affero General Public License as published by the Free 
Software
+  Foundation; either version 3, or (at your option) any later version.
+
+  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+  A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more 
details.
+
+  You should have received a copy of the GNU Affero General Public License 
along with
+  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file lib/testing_api_cmd_salt.c
+ * @brief command to execute the anastasis backend service.
+ * @author Dennis Neufeld
+ * @author Dominik Meister
+ */
+
+#include "platform.h"
+#include "anastasis_testing_lib.h"
+#include <taler/taler_util.h>
+#include <taler/taler_testing_lib.h>
+
+
+/**
+ * State for a "salt" CMD.
+ */
+struct SaltState
+{
+  /**
+   * The interpreter state.
+   */
+  struct TALER_TESTING_Interpreter *is;
+
+  /**
+   * URL of the anastasis backend.
+   */
+  const char *anastasis_url;
+
+  /**
+   * Expected status code.
+   */
+  unsigned int http_status;
+
+  /**
+   * The /salt GET operation handle.
+   */
+  struct ANASTASIS_SaltOperation *so;
+};
+
+
+/**
+ * Function called with the results of a #ANASTASIS_salt().
+ *
+ * @param cls closure
+ * @param http_status HTTP status of the request
+ * @param salt salt from the server
+ */
+static void
+salt_cb (void *cls,
+         unsigned int http_status,
+         const struct ANASTASIS_CRYPTO_Salt *salt)
+{
+  struct SaltState *ss = cls;
+
+  ss->plo = NULL;
+  if (http_status != ss->http_status)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Unexpected response code %u to command %s in %s:%u\n",
+                http_status,
+                ss->is->commands[ss->is->ip].label,
+                __FILE__,
+                __LINE__);
+    TALER_TESTING_interpreter_fail (ss->is);
+    return;
+  }
+}
+
+
+/**
+ * Run a "salt" CMD.
+ *
+ * @param cls closure.
+ * @param cmd command currently being run.
+ * @param is interpreter state.
+ */
+static void
+salt_run (void *cls,
+          const struct TALER_TESTING_Command *cmd,
+          struct TALER_TESTING_Interpreter *is)
+{
+  struct SaltState *ss = cls;
+
+  ss->is = is;
+  ss->so = ANASTASIS_salt (is->ctx,
+                           ss->anastasis_url,
+                           &salt_cb,
+                           ss);
+  if (NULL == ss->so)
+  {
+    GNUNET_break (0);
+    TALER_TESTING_interpreter_fail (ss->is);
+    return;
+  }
+}
+
+
+/**
+ * Free the state of a "salt" CMD, and possibly
+ * cancel it if it did not complete.
+ *
+ * @param cls closure.
+ * @param cmd command being freed.
+ */
+static void
+salt_cleanup (void *cls,
+              const struct TALER_TESTING_Command *cmd)
+{
+  struct SaltState *ss = cls;
+
+  if (NULL != ss->so)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Command '%s' did not complete (salt)\n",
+                cmd->label);
+    ANASTASIS_salt_cancel (ss->so);
+    ss->so = NULL;
+  }
+  GNUNET_free (ss);
+}
+
+
+/**
+ * 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)
+{
+  struct SaltState *ss;
+
+  ss = GNUNET_new (struct SaltState);
+  ss->http_status = http_status;
+  ss->anastasis_url = anastasis_url;
+  {
+    struct TALER_TESTING_Command cmd = {
+      .cls = ss,
+      .label = label,
+      .run = &salt_run,
+      .cleanup = &salt_cleanup
+    };
+
+    return cmd;
+  }
+}
\ No newline at end of file
diff --git a/src/lib/testing_api_cmd_truth_store.c 
b/src/lib/testing_api_cmd_truth_store.c
index 81a502c..108a3b9 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -388,17 +388,9 @@ ANASTASIS_TESTING_make_truth_example (char *method,
 
   json_t *truth_data;
   struct ANASTASIS_CRYPTO_EncryptedKeyShare keyshare_data;
-  struct ANASTASIS_CRYPTO_Nonce nonce;
-  struct ANASTASIS_CRYPTO_AesTag aes_gcm_tag;
   struct GNUNET_HashCode truth_hash;
   const char *encrypted_truth;
 
-  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
-                              &nonce,
-                              sizeof (struct ANASTASIS_CRYPTO_Nonce));
-  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
-                              &aes_gcm_tag,
-                              sizeof (struct ANASTASIS_CRYPTO_AesTag));
   GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
                               &keyshare_data,
                               sizeof (struct
@@ -410,16 +402,11 @@ ANASTASIS_TESTING_make_truth_example (char *method,
 
   truth_data = json_pack ("{s:o," /* keyshare_data */
                           " s:s," /* method */
-                          " s:o," /* nonce */
-                          " s:o," /* aes_gcm_tag */
                           " s:o," /* encrypted_truth */
                           " s:s}", /* truth_mime */
                           "keyshare_data", GNUNET_JSON_from_data_auto (
                             &keyshare_data),
                           "method", method,
-                          "nonce", GNUNET_JSON_from_data_auto (&nonce),
-                          "aes_gcm_tag", GNUNET_JSON_from_data_auto (
-                            &aes_gcm_tag),
                           "encrypted_truth", GNUNET_JSON_from_data (
                             encrypted_truth, strlen (encrypted_truth)),
                           "truth_mime", mime_type
diff --git a/src/stasis/plugin_anastasis_postgres.c 
b/src/stasis/plugin_anastasis_postgres.c
index 569a3bf..399fef7 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -984,8 +984,6 @@ postgres_store_truth (void *cls,
                       const char *mime_type,
                       const void *encrypted_truth,
                       size_t encrypted_truth_size,
-                      const struct ANASTASIS_CRYPTO_AesTag *aes_gcm_tag,
-                      const struct ANASTASIS_CRYPTO_Nonce *nonce,
                       const char *method,
                       struct
                       GNUNET_TIME_Relative truth_expiration)
@@ -1011,8 +1009,6 @@ postgres_store_truth (void *cls,
       GNUNET_PQ_query_param_auto_from_type (uuid),
       GNUNET_PQ_query_param_auto_from_type (key_share_data),
       GNUNET_PQ_query_param_string (method),
-      GNUNET_PQ_query_param_auto_from_type (nonce),
-      GNUNET_PQ_query_param_auto_from_type (aes_gcm_tag),
       GNUNET_PQ_query_param_fixed_size (encrypted_truth,
                                         encrypted_truth_size),
       GNUNET_PQ_query_param_string (mime_type),
@@ -1068,8 +1064,6 @@ postgres_get_escrow_challenge (void *cls,
                                const uuid_t *uuid,
                                void **truth,
                                size_t *truth_size,
-                               unsigned char **aes_gcm_tag,
-                               uint32_t **nonce,
                                char **truth_mime,
                                char **method)
 {
@@ -1082,11 +1076,6 @@ postgres_get_escrow_challenge (void *cls,
     GNUNET_PQ_result_spec_variable_size ("encrypted_truth",
                                          truth,
                                          truth_size),
-    GNUNET_PQ_result_spec_fixed_size ("aes_gcm_tag",
-                                      aes_gcm_tag,
-                                      16),
-    GNUNET_PQ_result_spec_uint32 ("nonce",
-                                  *nonce),
     GNUNET_PQ_result_spec_string ("truth_mime",
                                   truth_mime),
     GNUNET_PQ_result_spec_string ("method",
@@ -1376,8 +1365,6 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             "(truth_id UUID PRIMARY KEY NOT NULL,"
                             " key_share_data BYTEA NOT NULL,"
                             " method VARCHAR,"
-                            " nonce BYTEA NOT NULL,"
-                            " aes_gcm_tag BYTEA NOT NULL,"
                             " encrypted_truth BYTEA NOT NULL,"
                             " truth_mime VARCHAR,"
                             " expiration TIMESTAMP NOT NULL"
@@ -1491,13 +1478,11 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             "(truth_id"
                             ",key_share_data"
                             ",method"
-                            ",nonce"
-                            ",aes_gcm_tag"
                             ",encrypted_truth"
                             ",truth_mime"
                             ",expiration"
                             ") VALUES "
-                            "($1, $2, $3, $4, $5, $6, $7, $8);",
+                            "($1, $2, $3, $4, $5, $6);",
                             7),
     GNUNET_PQ_make_prepare ("recovery_document_insert",
                             "INSERT INTO anastasis_recoverydocument "
@@ -1514,8 +1499,6 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             "truth_id"
                             ",key_share_data"
                             ",method"
-                            ",nonce"
-                            ",aes_gcm_tag"
                             ",encrypted_truth"
                             ",truth_mime"
                             ",expiration"
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index c1cdbd5..308c8ef 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -260,8 +260,6 @@ run (void *cls)
                                mime_type,
                                "encrypted_truth",
                                sizeof ("encrypted_truth"),
-                               aes_gcm_tag,
-                               &nonce,
                                method,
                                rel_time));
 

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



reply via email to

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