gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated (423c8ae -> 23887ac)


From: gnunet
Subject: [taler-anastasis] branch master updated (423c8ae -> 23887ac)
Date: Mon, 04 May 2020 09:47:40 +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 423c8ae  challenge lookup
     new f1b3eb4  modified testing cmd secret_share
     new 88ea9e2  modified testing cmd secret_share
     new 23887ac  modified testing cmd secret_share

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/include/anastasis_testing_lib.h |   5 +-
 src/lib/testing_cmd_secret_share.c  | 126 +++++++++++++++++++++++++++++++++++-
 2 files changed, 128 insertions(+), 3 deletions(-)

diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index b72f3e1..ff45951 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -594,17 +594,20 @@ enum ANASTASIS_TESTING_SecretShareOption
  *
  * @param label command label
  * @param anastasis_url base URL of the anastasis serving our requests.
+ * @param id_data ID data to generate user identifier
  * @param http_status expected HTTP status.
  * @param sso secret share options
+ * @param ... NULL-terminated list of policy create commands
  * @return the command
  */
 struct TALER_TESTING_Command
 ANASTASIS_TESTING_cmd_secret_share (const char *label,
                                     const char *anastasis_url,
+                                    json_t *id_data,
                                     unsigned int http_status,
                                     enum
                                     ANASTASIS_TESTING_SecretShareOption sso,
-                                    const char *upload_ref);
+                                    ...);
 
 /* ********************* test recover secret ********************* */
 
diff --git a/src/lib/testing_cmd_secret_share.c 
b/src/lib/testing_cmd_secret_share.c
index 5e95f24..d2c0958 100644
--- a/src/lib/testing_cmd_secret_share.c
+++ b/src/lib/testing_cmd_secret_share.c
@@ -27,6 +27,30 @@
 #include <taler/taler_testing_lib.h>
 
 
+/**
+* Policy object to upload
+*/
+struct Policy
+{
+  /**
+  * Encrypted policy master key
+  */
+  struct ANASTASIS_CRYPTO_PolicyKeyP policy_key;
+  /**
+   * salt used to encrypt the master key
+   */
+  struct ANASTASIS_CRYPTO_SaltP salt;
+  /**
+   * set of truths inside this policy
+   */
+  uuid_t *uuids;
+  /**
+   * length of methods used
+   */
+  unsigned int uuid_length;
+};
+
+
 /**
  * State for a "secret share" CMD.
  */
@@ -37,6 +61,21 @@ struct SecretShareState
    */
   struct TALER_TESTING_Interpreter *is;
 
+  /**
+   * Label of this command.
+   */
+  const char *label;
+
+  /**
+   * References to commands of previous policy creations.
+   */
+  const char **cmd_label_array;
+
+  /**
+   * Length of array of command labels (cmd_label_array).
+   */
+  unsigned int cmd_label_array_length;
+
   /**
    * URL of the anastasis backend.
    */
@@ -77,6 +116,68 @@ secret_share_run (void *cls,
                   struct TALER_TESTING_Interpreter *is)
 {
   struct SecretShareState *sss = cls;
+  struct Policy policies[sss->cmd_label_array_length];
+
+  GNUNET_assert (sss->cmd_label_array_length > 0);
+  GNUNET_assert (NULL != sss->cmd_label_array);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "At %s:%d cmd label array length is %i\n", __FILE__, __LINE__,
+              sss->cmd_label_array_length);
+
+  sss->is = is;
+  if (NULL != sss->cmd_label_array)
+  {
+    for (unsigned int i = 0; i < sss->cmd_label_array_length; i++)
+    {
+      const struct TALER_TESTING_Command *ref;
+      struct Policy *policy;
+
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "At %s:%d policy create cmd is %s\n", __FILE__, __LINE__,
+                  sss->cmd_label_array[i]);
+
+      ref = TALER_TESTING_interpreter_lookup_command
+              (is,
+              sss->cmd_label_array[i]);
+      if (NULL == ref)
+      {
+        GNUNET_break (0);
+        TALER_TESTING_interpreter_fail (sss->is);
+        return;
+      }
+      if (GNUNET_OK !=
+          ANASTASIS_TESTING_get_trait_policy (ref,
+                                              0,
+                                              &policy))
+      {
+        GNUNET_break (0);
+        TALER_TESTING_interpreter_fail (sss->is);
+        return;
+      }
+      GNUNET_assert (NULL != policy);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "At %s:%d policy is %s-%llu b\n", __FILE__, __LINE__,
+                  TALER_B2S (policy),
+                  (unsigned long long) sizeof (*policy));
+      policies[i] = *policy;
+      GNUNET_assert (0 ==
+                     GNUNET_memcmp (&policies[i],
+                                    policy));
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "At %s:%d policy is %s-%llu b\n", __FILE__, __LINE__,
+                  TALER_B2S (&policies[i]),
+                  (unsigned long long) sizeof (policies[i]));
+    }
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "At %s:%d policy array is %s\n", __FILE__, __LINE__,
+              TALER_b2s (&policies,
+                         sss->cmd_label_array_length
+                         * sizeof (struct Policy)));
+
+  // sss->sso = ANASTASIS_secret_share ();
+
 
   sss->is = is;
   // FIXME: Whole secret share procedure here
@@ -141,25 +242,46 @@ secret_share_traits (void *cls,
  *
  * @param label command label
  * @param anastasis_url base URL of the anastasis serving our requests.
+ * @param id_data ID data to generate user identifier
  * @param http_status expected HTTP status.
  * @param sso secret share options
+ * @param ... NULL-terminated list of policy create commands
  * @return the command
  */
 struct TALER_TESTING_Command
 ANASTASIS_TESTING_cmd_secret_share (const char *label,
                                     const char *anastasis_url,
+                                    json_t *id_data,
                                     unsigned int http_status,
                                     enum
                                     ANASTASIS_TESTING_SecretShareOption sso,
-                                    const char *upload_ref)
+                                    ...)
 {
   struct SecretShareState *sss;
+  va_list ap;
 
   sss = GNUNET_new (struct SecretShareState);
   sss->http_status = http_status;
   sss->ssopt = sso;
   sss->anastasis_url = anastasis_url;
-  sss->upload_reference = upload_ref;
+  sss->label = label;
+
+  va_start (ap, sso);
+  char *policy_create_cmd;
+  while (NULL != (policy_create_cmd = va_arg (ap, const char *)))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "At %s:%d policy create cmd is %s\n", __FILE__, __LINE__,
+                policy_create_cmd);
+    GNUNET_array_append (sss->cmd_label_array,
+                         sss->cmd_label_array_length,
+                         policy_create_cmd);
+  }
+  va_end (ap);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "At %s:%d cmd label array length is %i\n", __FILE__, __LINE__,
+              sss->cmd_label_array_length);
 
   struct TALER_TESTING_Command cmd = {
     .cls = sss,

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



reply via email to

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