gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated (c0aaeaa -> 0464d49)


From: gnunet
Subject: [taler-anastasis] branch master updated (c0aaeaa -> 0464d49)
Date: Wed, 22 Apr 2020 16:28:33 +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 c0aaeaa  fixed warnings fixed json in anastasis.c
     new 451fa42  corrected truth key creation in api test
     new 0464d49  worked on keyshare lookup api

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.c       |  3 +++
 src/include/anastasis_testing_lib.h       |  6 +++---
 src/lib/anastasis.c                       |  9 ++-------
 src/lib/testing_api_cmd_keyshare_lookup.c |  8 ++++----
 src/lib/testing_api_cmd_truth_store.c     | 25 ++++++++++++++++---------
 src/util/anastasis_crypto.c               | 15 ++++++++-------
 src/util/test_anastasis_crypto.c          |  2 +-
 7 files changed, 37 insertions(+), 31 deletions(-)

diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index 6805ab1..4c2059d 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -123,6 +123,9 @@ AH_handler_truth_get (struct MHD_Connection *connection,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Encrypted truth from db: %s\n",
                 TALER_b2s (encrypted_truth, encrypted_truth_size));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Encrypted truth size from db: %lu\n",
+                encrypted_truth_size);
   }
   {
     // decrypt encrypted_truth
diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index 386eadf..f4f8bd7 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -346,7 +346,7 @@ enum ANASTASIS_TESTING_TruthStoreOption
  * @param key_str a str you want to be a truth key
  * @return truthkey
  */
-struct ANASTASIS_CRYPTO_TruthKey *
+struct ANASTASIS_CRYPTO_TruthKey
 ANASTASIS_TESTING_make_truthkey (const char *key_str);
 
 /**
@@ -374,7 +374,7 @@ ANASTASIS_TESTING_make_truth_example (const char *method,
                                       const char *mime_type,
                                       const struct GNUNET_HashCode answer,
                                       const struct
-                                      ANASTASIS_CRYPTO_TruthKey *key);
+                                      ANASTASIS_CRYPTO_TruthKey key);
 
 /**
  * Make the "truth store" command.
@@ -412,7 +412,7 @@ ANASTASIS_TESTING_cmd_keyshare_lookup (const char *label,
                                        unsigned int http_status,
                                        const struct GNUNET_HashCode answer,
                                        const struct
-                                       ANASTASIS_CRYPTO_TruthKey *key,
+                                       ANASTASIS_CRYPTO_TruthKey key,
                                        const char *upload_ref);
 
 /**
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 1c2b0b2..399f206 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -32,13 +32,8 @@
 struct SaltState
 {
   /**
-   * The interpreter state.
-   */
-  struct TALER_TESTING_Interpreter *is;
-
-  /**
-   * URL of the anastasis backend.
-   */
+  * URL of the anastasis backend.
+  */
   const char *anastasis_url;
 
   /**
diff --git a/src/lib/testing_api_cmd_keyshare_lookup.c 
b/src/lib/testing_api_cmd_keyshare_lookup.c
index 4807f01..8aafc81 100644
--- a/src/lib/testing_api_cmd_keyshare_lookup.c
+++ b/src/lib/testing_api_cmd_keyshare_lookup.c
@@ -60,7 +60,7 @@ struct KeyShareLookupState
   /**
    * Key to decrypt truth
    */
-  const struct ANASTASIS_CRYPTO_TruthKey *truth_key;
+  struct ANASTASIS_CRYPTO_TruthKey truth_key;
 
   /**
    * Identification of the Truth Object
@@ -167,7 +167,7 @@ keyshare_lookup_run (void *cls,
   ksls->kslo = ANASTASIS_keyshare_lookup (is->ctx,
                                           ksls->anastasis_url,
                                           ksls->truth_uuid,
-                                          ksls->truth_key,
+                                          &ksls->truth_key,
                                           &ksls->hashed_answer,
                                           &keyshare_lookup_cb,
                                           ksls);
@@ -245,7 +245,7 @@ ANASTASIS_TESTING_cmd_keyshare_lookup (const char *label,
                                        unsigned int http_status,
                                        const struct GNUNET_HashCode answer,
                                        const struct
-                                       ANASTASIS_CRYPTO_TruthKey *key,
+                                       ANASTASIS_CRYPTO_TruthKey key,
                                        const char *upload_ref)
 {
   struct KeyShareLookupState *ksls;
@@ -255,7 +255,7 @@ ANASTASIS_TESTING_cmd_keyshare_lookup (const char *label,
               TALER_B2S (&answer));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "TruthKey in keyshare lookup cmd: %s\n",
-              TALER_B2S (key));
+              TALER_B2S (&key));
 
   GNUNET_assert (NULL != upload_ref);
   ksls = GNUNET_new (struct KeyShareLookupState);
diff --git a/src/lib/testing_api_cmd_truth_store.c 
b/src/lib/testing_api_cmd_truth_store.c
index 6117aee..9f3eab8 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -356,15 +356,17 @@ truth_store_traits (void *cls,
  * @param key_str a str you want to be a truth key
  * @return truthkey (must be freed)
  */
-struct ANASTASIS_CRYPTO_TruthKey *
+struct ANASTASIS_CRYPTO_TruthKey
 ANASTASIS_TESTING_make_truthkey (const char *key_str)
 {
-  struct ANASTASIS_CRYPTO_TruthKey *key;
+  struct ANASTASIS_CRYPTO_TruthKey key;
 
-  key = GNUNET_new (struct ANASTASIS_CRYPTO_TruthKey);
   GNUNET_CRYPTO_hash (key_str,
                       strlen (key_str),
-                      &key->key);
+                      &key.key);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "TruthKey created: %s\n",
+              TALER_B2S (&key));
   return key;
 }
 
@@ -383,36 +385,41 @@ ANASTASIS_TESTING_make_truth_example (const char *method,
                                       const char *mime_type,
                                       const struct GNUNET_HashCode answer,
                                       const struct
-                                      ANASTASIS_CRYPTO_TruthKey *key)
+                                      ANASTASIS_CRYPTO_TruthKey key)
 {
-
   json_t *truth_data;
   struct ANASTASIS_CRYPTO_EncryptedKeyShare keyshare_data;
   void *encrypted_truth;
   size_t size_encrypted_truth;
 
+  GNUNET_assert (NULL != &answer);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Hashed answer in truth example: %s\n",
               TALER_B2S (&answer));
+  GNUNET_assert (NULL != &key);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "TruthKey in truth example: %s\n",
-              TALER_B2S (key));
+              TALER_B2S (&key));
 
   GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
                               &keyshare_data,
                               sizeof (struct
                                       ANASTASIS_CRYPTO_EncryptedKeyShare));
-  ANASTASIS_CRYPTO_truth_encrypt (key,
+  GNUNET_assert (NULL != &keyshare_data);
+
+  ANASTASIS_CRYPTO_truth_encrypt (&key,
                                   &answer,
                                   sizeof (answer),
                                   &encrypted_truth,
                                   &size_encrypted_truth);
+  GNUNET_assert (NULL != encrypted_truth);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Encrypted truth in json: %s\n",
               TALER_b2s (encrypted_truth, size_encrypted_truth));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Encrypted truth size: %lu\n",
               size_encrypted_truth);
+
   truth_data = json_pack ("{s:o," /* keyshare_data */
                           " s:s," /* method */
                           " s:o," /* encrypted_truth */
@@ -425,10 +432,10 @@ ANASTASIS_TESTING_make_truth_example (const char *method,
                             size_encrypted_truth),
                           "truth_mime", mime_type
                           );
+  GNUNET_assert (NULL != truth_data);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Truth json before upload 0: %s\n",
               json_dumps (truth_data, JSON_COMPACT));
-  GNUNET_assert (NULL != truth_data);
   GNUNET_free (encrypted_truth);
   return truth_data;
 }
diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index 19cb076..cf05ea4 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -87,6 +87,14 @@ anastasis_encrypt (const void *key,
                    void **res,
                    size_t *res_size)
 {
+  struct ANASTASIS_CRYPTO_Nonce *nonce;
+  gcry_cipher_hd_t cipher;
+  struct ANASTASIS_CRYPTO_SymKey sym_key;
+  struct ANASTASIS_CRYPTO_Iv iv;
+  int rc;
+  struct ANASTASIS_CRYPTO_AesTag *tag;
+  char *ciphertext;
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "KEY_E:   %s\n",
               TALER_b2s (key,
@@ -95,13 +103,6 @@ anastasis_encrypt (const void *key,
               "PLAINTEXT_E:   %s\n",
               TALER_b2s (data,
                          data_size));
-  struct ANASTASIS_CRYPTO_Nonce *nonce;
-  gcry_cipher_hd_t cipher;
-  struct ANASTASIS_CRYPTO_SymKey sym_key;
-  struct ANASTASIS_CRYPTO_Iv iv;
-  int rc;
-  struct ANASTASIS_CRYPTO_AesTag *tag;
-  char *ciphertext;
 
   *res_size = data_size
               + sizeof (struct ANASTASIS_CRYPTO_Nonce)
diff --git a/src/util/test_anastasis_crypto.c b/src/util/test_anastasis_crypto.c
index 07a0712..dc6eeff 100644
--- a/src/util/test_anastasis_crypto.c
+++ b/src/util/test_anastasis_crypto.c
@@ -208,8 +208,8 @@ test_truth (void)
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "TRUTH_AFTER:   %s\n",
               TALER_b2s (plaintext, size_plaintext));
-  ret = strncmp (plaintext, test, strlen (test));
   GNUNET_assert (strlen (test) == size_plaintext);
+  ret = strncmp (plaintext, test, strlen (test));
   GNUNET_free (ciphertext);
   GNUNET_free (plaintext);
   return ret;

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



reply via email to

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