gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated (8b13d9c -> 039678d)


From: gnunet
Subject: [taler-anastasis] branch master updated (8b13d9c -> 039678d)
Date: Mon, 13 Apr 2020 09:18:07 +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 8b13d9c  worked on policy creation
     new 9ccfb81  fixed api test
     new b580d7c  merge
     new 039678d  merge

The 3 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_upload.c |  2 +-
 src/backend/anastasis-httpd_truth_upload.c  | 29 +++++++++++++++++++----
 src/include/anastasis_database_plugin.h     |  5 ++--
 src/lib/anastasis.c                         | 36 ++++++++++++++++-------------
 src/lib/test_anastasis_api.c                |  5 ++--
 src/lib/testing_api_cmd_truth_store.c       |  7 ------
 src/stasis/plugin_anastasis_postgres.c      |  6 ++---
 src/stasis/test_anastasis_db.c              |  1 -
 8 files changed, 53 insertions(+), 38 deletions(-)

diff --git a/src/backend/anastasis-httpd_policy_upload.c 
b/src/backend/anastasis-httpd_policy_upload.c
index 3dd049c..07ca302 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -794,7 +794,7 @@ AH_handler_policy_post (struct MHD_Connection *connection,
       struct ANASTASIS_UploadSignaturePS usp = {
         .purpose.size = htonl (sizeof (usp)),
         .purpose.purpose = htonl (TALER_SIGNATURE_ANASTASIS_POLICY_UPLOAD),
-        // .old_recovery_data_hash = puc->old_policy_upload_hash,
+        // usp.old_recovery_data_hash = puc->old_policy_upload_hash,
         .new_recovery_data_hash = puc->new_policy_upload_hash
       };
       if (GNUNET_OK !=
diff --git a/src/backend/anastasis-httpd_truth_upload.c 
b/src/backend/anastasis-httpd_truth_upload.c
index f9c8e41..a464a84 100644
--- a/src/backend/anastasis-httpd_truth_upload.c
+++ b/src/backend/anastasis-httpd_truth_upload.c
@@ -45,10 +45,9 @@ verify_and_execute_truth (struct MHD_Connection *connection,
   qs = db->store_truth (db->cls,
                         uuid,
                         &truth->keyshare_data,
-                        sizeof (&truth->keyshare_data),
                         truth->truth_mime,
                         truth->encrypted_truth,
-                        sizeof (&truth->encrypted_truth),
+                        truth->encrypted_truth_size,
                         &truth->aes_gcm_tag,
                         &truth->nonce,
                         truth->method,
@@ -76,6 +75,7 @@ AH_handler_truth_post (struct MHD_Connection *connection,
                        size_t *truth_data_size)
 {
   json_t *json;
+  MHD_RESULT ret;
   uuid_t uuid;
   int res;
   struct ANASTASIS_DB_Truth truth;
@@ -126,7 +126,7 @@ AH_handler_truth_post (struct MHD_Connection *connection,
                 "Truth json from upload: %s\nResult: %i\n",
                 json_dumps (json, JSON_COMPACT),
                 res);
-    json_decref (json);
+
     if (GNUNET_SYSERR == res)
       return MHD_NO; /* hard failure */
     if (GNUNET_NO == res)
@@ -134,7 +134,28 @@ AH_handler_truth_post (struct MHD_Connection *connection,
     res = verify_and_execute_truth (connection,
                                     &truth,
                                     &uuid);
+    json_decref (json);
     GNUNET_JSON_parse_free (spec);
-    return res;
+    if (GNUNET_OK == res)
+    {
+      {
+        struct MHD_Response *resp;
+
+        resp = MHD_create_response_from_buffer (0,
+                                                NULL,
+                                                MHD_RESPMEM_PERSISTENT);
+        TALER_MHD_add_global_headers (resp);
+        ret = MHD_queue_response (connection,
+                                  MHD_HTTP_NO_CONTENT,
+                                  resp);
+        MHD_destroy_response (resp);
+      }
+      return ret;
+    }
+    GNUNET_break (0);
+    return TALER_MHD_reply_with_error (connection,
+                                       MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                       TALER_EC_SYNC_DB_FETCH_ERROR,
+                                       "database failure");
   }
 }
diff --git a/src/include/anastasis_database_plugin.h 
b/src/include/anastasis_database_plugin.h
index 0553bb0..9929b66 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -245,7 +245,6 @@ struct ANASTASIS_DatabasePlugin
  * @param cls closure
  * @param uuid 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
  * @param nonce nonce used to compute encryption key for encrypted_truth
  * @param aes_gcm_tag authentication tag of encrypted_truth
@@ -257,8 +256,8 @@ struct ANASTASIS_DatabasePlugin
   enum ANASTASIS_DB_QueryStatus
   (*store_truth)(void *cls,
                  const uuid_t *uuid,
-                 const void *key_share_data,
-                 size_t key_share_data_size,
+                 const struct
+                 ANASTASIS_CRYPTO_EncryptedKeyShare *key_share_data,
                  const char *mime_type,
                  const void *encrypted_truth,
                  size_t encrypted_truth_size,
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 5518e3a..109478f 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -169,7 +169,7 @@ policy_lookup_cb (void *cls,
                   unsigned int http_status,
                   const struct ANASTASIS_DownloadDetails *dd)
 {
-  //FIXME
+  // FIXME
   struct ANASTASIS_Recovery *r = cls;
   r->plo = NULL;
   if (MHD_HTTP_OK == http_status)
@@ -222,10 +222,12 @@ ANASTASIS_recovery_begin (const json_t *id_data,
 
   if (version != 0)
   {
-    while (i < provider_candidates_length || r->encrypted_recovery_document != 
NULL)
+    while (i < provider_candidates_length || r->encrypted_recovery_document !=
+           NULL)
     {
       r->plo = ANASTASIS_policy_lookup_version (r->ctx,
-                                                
anastasis_provider_url_candidates[i],
+                                                
anastasis_provider_url_candidates
+                                                [i],
                                                 &r->pub_key,
                                                 &policy_lookup_cb,
                                                 r,
@@ -236,7 +238,8 @@ ANASTASIS_recovery_begin (const json_t *id_data,
   }
   else
   {
-    while (i < provider_candidates_length || r->encrypted_recovery_document != 
NULL)
+    while (i < provider_candidates_length || r->encrypted_recovery_document !=
+           NULL)
     {
       r->plo = ANASTASIS_policy_lookup (r->ctx,
                                         anastasis_provider_url_candidates[i],
@@ -261,9 +264,10 @@ ANASTASIS_recovery_begin (const json_t *id_data,
                                               &size_plaintext);
 
 
-  recovery_document = json_loadb((char 
*)plaintext,size_plaintext,JSON_DECODE_ANY,&json_error);
+  recovery_document = json_loadb ((char *) plaintext,size_plaintext,
+                                  JSON_DECODE_ANY,&json_error);
 
-  //FIXME CALLBACK AND RECOVERY DOCUMENT BUILD
+  // FIXME CALLBACK AND RECOVERY DOCUMENT BUILD
 
 
 
@@ -396,14 +400,14 @@ struct ANASTASIS_Policy
    * salt used to encrypt the master key
    */
   struct ANASTASIS_CRYPTO_Salt salt;
-   /**
-   * size of the truths
-   */
+  /**
+  * size of the truths
+  */
   unsigned int truths_len;
-   /**
-   * set of truths inside this policy
-   */
-   struct ANASTASIS_Truth *truths[];
+  /**
+  * set of truths inside this policy
+  */
+  struct ANASTASIS_Truth *truths[];
 };
 
 /**
@@ -420,14 +424,14 @@ ANASTASIS_policy_create (struct ANASTASIS_Truth *truths[],
   p = GNUNET_new (struct ANASTASIS_Policy);
   struct ANASTASIS_CRYPTO_PolicyKey policy_key;
   struct ANASTASIS_CRYPTO_KeyShare key_shares[truths_len];
-  //p->truths = truths;
-  //p->truths_len = truths_len;
+  // p->truths = truths;
+  // p->truths_len = truths_len;
 
   for (unsigned int i = 0; i < truths_len; i++)
   {
     key_shares[i] = truths[i]->key_share;
   }
-  //FIXME SALT
+  // FIXME SALT
   ANASTASIS_CRYPTO_policy_key_derive (&key_shares,
                                       truths_len,
                                       &p->salt,
diff --git a/src/lib/test_anastasis_api.c b/src/lib/test_anastasis_api.c
index d24c90f..0a0605f 100644
--- a/src/lib/test_anastasis_api.c
+++ b/src/lib/test_anastasis_api.c
@@ -260,18 +260,17 @@ run (void *cls,
                           " s:s," /* method */
                           " s:o," /* nonce */
                           " s:o," /* aes_gcm_tag */
-                          " s:o," /* truth_hash */
                           " s:o," /* encrypted_truth */
                           " s:s}", /* truth_mime */
                           "keyshare_data", GNUNET_JSON_from_data_auto (
                             &keyshare_data),
-                          "method", "Truth test (method)",
+                          "method", "Truth test 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", "Truth test (mime)"
+                          "truth_mime", "Truth test mime"
                           );
   if (NULL == truth_data)
   {
diff --git a/src/lib/testing_api_cmd_truth_store.c 
b/src/lib/testing_api_cmd_truth_store.c
index 2f3286f..f975d32 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -139,13 +139,6 @@ truth_store_cb (void *cls,
     switch (ud->us)
     {
     case ANASTASIS_US_SUCCESS:
-      if (0 != GNUNET_memcmp (&tss->curr_hash,
-                              ud->details.curr_backup_hash))
-      {
-        GNUNET_break (0);
-        TALER_TESTING_interpreter_fail (tss->is);
-        return;
-      }
       break;
     case ANASTASIS_US_PAYMENT_REQUIRED:
       {
diff --git a/src/stasis/plugin_anastasis_postgres.c 
b/src/stasis/plugin_anastasis_postgres.c
index 3a544aa..569a3bf 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -979,8 +979,8 @@ postgres_record_payment (void *cls,
 static enum ANASTASIS_DB_QueryStatus
 postgres_store_truth (void *cls,
                       const uuid_t *uuid,
-                      const void *key_share_data,
-                      size_t key_share_data_size,
+                      const struct
+                      ANASTASIS_CRYPTO_EncryptedKeyShare *key_share_data,
                       const char *mime_type,
                       const void *encrypted_truth,
                       size_t encrypted_truth_size,
@@ -1009,7 +1009,7 @@ postgres_store_truth (void *cls,
   {
     struct GNUNET_PQ_QueryParam params[] = {
       GNUNET_PQ_query_param_auto_from_type (uuid),
-      GNUNET_PQ_query_param_fixed_size (key_share_data, key_share_data_size),
+      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),
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index 0f6a03a..1f08d1c 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -260,7 +260,6 @@ run (void *cls)
           plugin->store_truth (plugin->cls,
                                &uuid,
                                "key_share_data",
-                               sizeof ("key_share_data"),
                                mime_type,
                                "encrypted_truth",
                                sizeof ("encrypted_truth"),

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



reply via email to

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