gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: fix logic error


From: gnunet
Subject: [taler-anastasis] branch master updated: fix logic error
Date: Sun, 07 Mar 2021 17:13:18 +0100

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 afb5dcb  fix logic error
afb5dcb is described below

commit afb5dcb38a15df09a06fab933d7089f10910b8b3
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Mar 7 17:13:15 2021 +0100

    fix logic error
---
 ...tasis_reducer_recovery_enter_user_attributes.sh | 24 ++++++++++++----------
 src/lib/anastasis_recovery.c                       |  5 ++++-
 src/reducer/anastasis_api_recovery_redux.c         |  7 +++----
 3 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh 
b/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
index 10499cc..7e0f40a 100755
--- a/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
+++ b/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
@@ -324,8 +324,10 @@ echo -n ","
 anastasis-reducer \
   next < $B2FILE > $B1FILE
 echo -n "."
+
+# Note: 'secret' must here be a Crockford base32-encoded value
 anastasis-reducer -a \
-  '{"secret": "veryhardtoguesssecret"}' \
+  '{"secret": "VERYHARDT0GVESSSECRET"}' \
   enter_secret < $B1FILE > $B2FILE
 echo " OK"
 echo -n "Preparing wallet"
@@ -397,12 +399,6 @@ echo -n "Running challenge logic ..."
 UUID0=`jq -r -e .recovery_information.challenges[0].uuid < $R2FILE`
 UUID1=`jq -r -e .recovery_information.challenges[1].uuid < $R2FILE`
 
-export UUID0
-export UUID1
-export R1FILE
-export R2FILE
-bash
-
 anastasis-reducer -a \
   "$(jq -n '
     {
@@ -429,15 +425,21 @@ anastasis-reducer -a '{"answer": "123"}' \
 
 echo " OK"
 
+echo -n "Checking recovered secret ..."
 # finally: check here that we recovered the secret...
 
-bash
-
 STATE=`jq -r -e .recovery_state < $TFILE`
-if test "$STATE" != "CHALLENGE_SELECTING"
+if test "$STATE" != "RECOVERY_FINISHED"
 then
-    exit_fail "Expected new state to be 'CHALLENGE_SELECTING', got '$STATE'"
+    exit_fail "Expected new state to be 'RECOVERY_FINISHED', got '$STATE'"
 fi
 
+SECRET=`jq -r -e .core_secret < $TFILE`
+if test "$SECRET" != "VERYHARDT0GVESSSECRET"
+then
+    exit_fail "Expected recovered secret to be 'VERYHARDT0GVESSSECRET', got 
'$SECRET'"
+fi
+
+echo " OK"
 
 exit 0
diff --git a/src/lib/anastasis_recovery.c b/src/lib/anastasis_recovery.c
index d38aac6..f0bf097 100644
--- a/src/lib/anastasis_recovery.c
+++ b/src/lib/anastasis_recovery.c
@@ -328,7 +328,7 @@ keyshare_lookup_cb (void *cls,
   ANASTASIS_CRYPTO_keyshare_decrypt (&dd->details.eks,
                                      &id,
                                      &c->key_share);
-  c->recovery->solved_challenges[c->recovery->solved_challenge_pos++] = c;
+  recovery->solved_challenges[recovery->solved_challenge_pos++] = c;
 
   {
     struct ANASTASIS_ChallengeStartResponse csr = {
@@ -1067,7 +1067,10 @@ parse_cs_array (struct ANASTASIS_Recovery *r,
                             "key_share");
       if ( (NULL != ks) &&
            (! json_is_null (ks)) )
+      {
         c->ci.solved = true;
+        r->solved_challenges[r->solved_challenge_pos++] = c;
+      }
     }
   }
 
diff --git a/src/reducer/anastasis_api_recovery_redux.c 
b/src/reducer/anastasis_api_recovery_redux.c
index 54bf71e..4d23e24 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -192,6 +192,7 @@ core_secret_cb (void *cls,
 {
   struct SelectChallengeContext *sctx = cls;
 
+  sctx->r = NULL;
   GNUNET_assert (0 ==
                  json_object_set_new (sctx->state,
                                       "core_secret",
@@ -1741,7 +1742,7 @@ policy_lookup_cb (void *cls,
       return;
     }
 
-    cj = json_pack ("{s:o,s:o?,s:s,s:s,s:b}",
+    cj = json_pack ("{s:o,s:o?,s:s,s:s}",
                     "uuid",
                     GNUNET_JSON_from_data_auto (&cd->uuid),
                     "cost",
@@ -1751,9 +1752,7 @@ policy_lookup_cb (void *cls,
                     "type",
                     cd->type,
                     "instructions",
-                    cd->instructions,
-                    "solved",
-                    cd->solved);
+                    cd->instructions);
     GNUNET_assert (NULL != cj);
     GNUNET_assert (0 ==
                    json_array_append_new (challenges,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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