gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: fix challenge allocation


From: gnunet
Subject: [taler-anastasis] branch master updated: fix challenge allocation
Date: Thu, 14 May 2020 10:05:32 +0200

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

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 1f681d0  fix challenge allocation
1f681d0 is described below

commit 1f681d004831493767979ec8e26ea8e8faf84d13
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu May 14 10:05:27 2020 +0200

    fix challenge allocation
---
 src/lib/anastasis.c | 53 +++++++++++++++++++++++++++++++++--------------------
 1 file changed, 33 insertions(+), 20 deletions(-)

diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 7d9a1a6..aab9438 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -382,6 +382,8 @@ keyshare_lookup_cb (void *cls,
                       core_secret_size);
   }
 }
+
+
 /**
  * Challenge answer from the user like input SMS pin. Is referenced to a 
challenge and
  * sends back an AnswerFeedback.
@@ -435,6 +437,7 @@ ANASTASIS_challenge_answer (struct GNUNET_CURL_Context *ctx,
                                        c);
 }
 
+
 /**
  * Starts the process for a defined escrow challenge. Has a reference to the 
challenge and opens a
  * challenge callback which returns the results of the request.
@@ -462,6 +465,7 @@ ANASTASIS_challenge_run (struct ANASTASIS_Challenge 
*challenge,
                  200);
 }
 
+
 /**
  * User decides which method is to be used, and wants to pay for the 
authentication
  * this is only needed if the cost for the authentication is not zero. Opens a 
Challenge Payment Callback
@@ -479,6 +483,7 @@ ANASTASIS_challenge_select_to_pay (struct 
ANASTASIS_Challenge *challenge,
 
 }
 
+
 /**
  * Function called with the results of a ANASTASIS_policy_lookup
  *
@@ -573,8 +578,9 @@ policy_lookup_cb (void *cls,
   r->solved_challenges = GNUNET_new_array (r->ri->cs_len,
                                            struct ANASTASIS_Challenge);
 
-  struct ANASTASIS_Challenge *cs = GNUNET_new_array (r->ri->cs_len,
-                                                     struct 
ANASTASIS_Challenge);
+  struct ANASTASIS_Challenge **cs = GNUNET_new_array (r->ri->cs_len,
+                                                      struct 
ANASTASIS_Challenge
+                                                      *);
 
 
   for (unsigned int i = 0; i < r->ri->cs_len; i++)
@@ -582,6 +588,8 @@ policy_lookup_cb (void *cls,
     const char *uuid;
     const char *truth_key;
     const char *truth_salt;
+
+    cs[i] = GNUNET_new (struct ANASTASIS_Challenge);
     GNUNET_assert (0 ==
                    json_unpack (json_array_get (esc_methods, i),
                                 "{s:s,"       /* truth uuid */
@@ -590,44 +598,44 @@ policy_lookup_cb (void *cls,
                                 " s:s,"       /* truth salt */
                                 " s:s}",       /* escrow method */
                                 "uuid", &uuid,
-                                "url", &cs[i].url,
+                                "url", &cs[i]->url,
                                 "truth_key", &truth_key,
                                 "salt", &truth_salt,
-                                "escrow_method", &cs[i].escrow_method));
-    cs[i].recovery = r;
+                                "escrow_method", &cs[i]->escrow_method));
+    cs[i]->recovery = r;
     GNUNET_assert (0 ==
                    uuid_parse (uuid,
-                               cs[i].challenge_uuid));
+                               cs[i]->challenge_uuid));
     GNUNET_STRINGS_string_to_data (truth_key,
                                    strlen (truth_key),
-                                   &cs[i].truth_key,
+                                   &cs[i]->truth_key,
                                    sizeof(struct ANASTASIS_CRYPTO_TruthKeyP));
     GNUNET_STRINGS_string_to_data (truth_salt,
                                    strlen (truth_salt),
-                                   &cs[i].truth_salt,
+                                   &cs[i]->truth_salt,
                                    sizeof(struct ANASTASIS_CRYPTO_SaltP));
 
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "At %s:%d challenge_uuid is %s-%llu b\n", __FILE__, __LINE__,
-                TALER_B2S (&cs[i].challenge_uuid),
-                (unsigned long long) sizeof (cs[i].challenge_uuid));
+                TALER_B2S (&cs[i]->challenge_uuid),
+                (unsigned long long) sizeof (cs[i]->challenge_uuid));
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "At %s:%d url is %s\n", __FILE__, __LINE__,
-                cs[i].url);
+                cs[i]->url);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "At %s:%d truth key is %s-%llu b\n", __FILE__, __LINE__,
-                TALER_B2S (&cs[i].truth_key),
-                (unsigned long long) sizeof (cs[i].truth_key));
+                TALER_B2S (&cs[i]->truth_key),
+                (unsigned long long) sizeof (cs[i]->truth_key));
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "At %s:%d truth_salt is %s-%llu b\n", __FILE__, __LINE__,
-                TALER_B2S (&cs[i].truth_salt),
-                (unsigned long long) sizeof (cs[i].truth_salt));
+                TALER_B2S (&cs[i]->truth_salt),
+                (unsigned long long) sizeof (cs[i]->truth_salt));
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "At %s:%d escrow method is %s\n", __FILE__, __LINE__,
-                cs[i].escrow_method);
+                cs[i]->escrow_method);
   }
 
-  for (unsigned int j = 0; j < r->ri->dps_len; j++ )
+  for (unsigned int j = 0; j < r->ri->dps_len; j++)
   {
 
     const char *enc_master_key;
@@ -696,7 +704,7 @@ policy_lookup_cb (void *cls,
                 (unsigned long long) sizeof (r->ri->dps[j].salt));
   }
   r->solved_challenge_pos = 0;
-  r->ri->cs = &cs;
+  r->ri->cs = cs;
   // SETUP POLICY CALLBACK
   if (NULL != r->pc)
   {
@@ -709,7 +717,6 @@ policy_lookup_cb (void *cls,
 }
 
 
-
 /**
 * Starts the recovery process by opening callbacks for the coresecret and a 
policy callback. A list of
 * providers is checked for policies and passed back to the client.
@@ -778,6 +785,7 @@ ANASTASIS_recovery_begin (struct GNUNET_CURL_Context *ctx,
   return r;
 }
 
+
 /**
 * Cancels the recovery process
 * @param r handle to the recovery struct
@@ -1105,6 +1113,7 @@ ANASTASIS_truth_upload (struct GNUNET_CURL_Context *ctx,
   return tu;
 }
 
+
 /**
 * Cancels a upload process
 * @param tu handle for the upload
@@ -1122,6 +1131,7 @@ ANASTASIS_truth_upload_cancel (struct 
ANASTASIS_TruthUpload *tu)
   GNUNET_free (tu);
 }
 
+
 /**
 * Free's the truth object which was allocated
 * @param t object to clean up
@@ -1132,6 +1142,7 @@ ANASTASIS_truth_free (struct ANASTASIS_Truth *t)
   GNUNET_free (t);
 }
 
+
 /**
 * Policy object to upload
 */
@@ -1244,6 +1255,7 @@ ANASTASIS_policy_create (const struct ANASTASIS_Truth 
*truths[],
   return p;
 }
 
+
 /**
 * Destroys a policy object
 * @param p handle for the policy to destroy
@@ -1677,7 +1689,7 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
   dec_policies = json_array ();
   esc_methods = json_array ();
   int index_pss = 0;
-  for (unsigned int k = 0; k < policies_len; k++ )
+  for (unsigned int k = 0; k < policies_len; k++)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "At %s:%d policy is %s-%llu b\n", __FILE__, __LINE__,
@@ -1898,6 +1910,7 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
   return ss;
 }
 
+
 /**
 * Cancels a secret share request
 * @param ss handle to the request

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



reply via email to

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