gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 03/12: worked on keyshare request


From: gnunet
Subject: [taler-anastasis] 03/12: worked on keyshare request
Date: Mon, 20 Apr 2020 09:45:58 +0200

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

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

commit 3d9ffeedd92743e175cdc5564cab78e89f50c2cf
Author: Dennis Neufeld <address@hidden>
AuthorDate: Sat Apr 18 08:42:24 2020 +0000

    worked on keyshare request
---
 src/backend/anastasis-httpd_truth.c     | 37 +++++++++++----------------------
 src/lib/anastasis_api_keyshare_lookup.c | 14 ++++++-------
 2 files changed, 19 insertions(+), 32 deletions(-)

diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index 7db3d6a..6704b68 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -23,6 +23,7 @@
 #include "platform.h"
 #include "anastasis-httpd.h"
 #include "anastasis-httpd_truth.h"
+#include "anastasis_crypto_lib.h"
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_rest_lib.h>
 
@@ -40,11 +41,13 @@ AH_handler_truth_get (struct MHD_Connection *connection,
 {
   // FIXME: Handle truth get
   uuid_t uuid;
-  struct GNUNET_CRYPTO_SymmetricSessionKey decryption_key;
+  struct ANASTASIS_CRYPTO_TruthKey truth_key;
   struct GNUNET_HashCode challenge_response;
   const char *challenge_response_s;
   void *encrypted_truth;
+  size_t encrypted_truth_size;
   void *decrypted_truth;
+  size_t decrypted_truth_size;
   void *encrypted_keyshare;
   char result[GNUNET_CRYPTO_AES_KEY_LENGTH];
   char *truth_mime;
@@ -77,8 +80,9 @@ AH_handler_truth_get (struct MHD_Connection *connection,
          (GNUNET_OK !=
           GNUNET_STRINGS_string_to_data (tdk,
                                          strlen (tdk),
-                                         &decryption_key,
-                                         sizeof (&decryption_key))))
+                                         &truth_key,
+                                         sizeof (struct
+                                                 ANASTASIS_CRYPTO_TruthKey))))
     {
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (connection,
@@ -93,7 +97,6 @@ AH_handler_truth_get (struct MHD_Connection *connection,
   {
     // load encrypted truth from db
     enum ANASTASIS_DB_QueryStatus qs;
-    size_t encrypted_truth_size;
 
     qs = db->get_escrow_challenge (db->cls,
                                    &uuid,
@@ -112,28 +115,12 @@ AH_handler_truth_get (struct MHD_Connection *connection,
     }
   }
   {
-    struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
-
-    GNUNET_CRYPTO_symmetric_derive_iv (&iv,
-                                       &decryption_key,
-                                       "ECT",
-                                       strlen ("ECT"));
-
-    decrypted_truth = GNUNET_malloc (GNUNET_CRYPTO_AES_KEY_LENGTH);
-
     // decrypt encrypted_truth
-    if (GNUNET_CRYPTO_AES_KEY_LENGTH !=
-        GNUNET_CRYPTO_symmetric_decrypt (result,
-                                         GNUNET_CRYPTO_AES_KEY_LENGTH,
-                                         &decryption_key,
-                                         &iv,
-                                         decrypted_truth
-                                         ))
-    {
-      printf ("Wrong return value from decrypt block.\n");
-      ret = 1;
-      goto error;
-    }
+    ANASTASIS_CRYPTO_truth_decrypt (&truth_key,
+                                    encrypted_truth,
+                                    &encrypted_truth_size,
+                                    &decrypted_truth,
+                                    &decrypted_truth_size);
   }
   {
     // validate challenge response
diff --git a/src/lib/anastasis_api_keyshare_lookup.c 
b/src/lib/anastasis_api_keyshare_lookup.c
index addad7a..8675ae4 100644
--- a/src/lib/anastasis_api_keyshare_lookup.c
+++ b/src/lib/anastasis_api_keyshare_lookup.c
@@ -66,17 +66,17 @@ struct ANASTASIS_KeyShareLookupOperation
   /**
    * Identification of the Truth Object
    */
-  uuid_t truth_uuid;
+  const uuid_t *truth_uuid;
 
   /**
    * Key to decrypt the truth on the server
    */
-  struct ANASTASIS_CRYPTO_TruthKey truth_key;
+  const struct ANASTASIS_CRYPTO_TruthKey *truth_key;
 
   /**
    * Hash of the response (security question)
    */
-  struct GNUNET_HashCode hashed_answer;
+  const struct GNUNET_HashCode *hashed_answer;
 };
 
 /**
@@ -209,7 +209,7 @@ handle_header (char *buffer,
                        "Truth-Decryption-Key"))
   {
     if (GNUNET_OK !=
-        GNUNET_STRINGS_string_to_data (hdr_val,
+        GNUNET_STRINGS_data_to_string (hdr_val,
                                        strlen (hdr_val),
                                        &kslo->truth_key,
                                        sizeof (struct
@@ -249,7 +249,7 @@ ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context *ctx,
   struct ANASTASIS_KeyShareLookupOperation *kslo;
   CURL *eh;
   char *uuid_str;
-  char *hashed_answer;
+  char *hashed_answer_str;
   char *path;
 
   kslo = GNUNET_new (struct ANASTASIS_KeyShareLookupOperation);
@@ -259,8 +259,8 @@ ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context *ctx,
   kslo->truth_key = truth_key;
   uuid_str = GNUNET_STRINGS_data_to_string_alloc (&truth_uuid,
                                                   sizeof (truth_uuid));
-  hashed_answer = GNUNET_STRINGS_data_to_string_alloc (&hashed_answer,
-                                                       sizeof (hashed_answer));
+  hashed_answer_str = GNUNET_STRINGS_data_to_string_alloc (&hashed_answer,
+                                                           sizeof 
(hashed_answer));
   GNUNET_asprintf (&path,
                    "truth/%s",
                    uuid_str);

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



reply via email to

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