[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: prepared recover test
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: prepared recover test |
Date: |
Sun, 10 May 2020 17:32:56 +0200 |
This is an automated email from the git hooks/post-receive script.
ds-meister pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 162afbe prepared recover test
162afbe is described below
commit 162afbe0594b2eddfd294d855900bac1fe28de03
Author: Dominik Meister <address@hidden>
AuthorDate: Sun May 10 17:32:48 2020 +0200
prepared recover test
---
src/include/anastasis_testing_lib.h | 27 +------------
src/lib/Makefile.am | 1 -
src/lib/test_anastasis.c | 27 +++++++++++--
src/lib/testing_cmd_challenge_answer.c | 8 ++--
src/lib/testing_cmd_recover_secret.c | 59 ++++++++++++++++++++--------
src/lib/testing_trait_recovery.c | 70 ----------------------------------
6 files changed, 74 insertions(+), 118 deletions(-)
diff --git a/src/include/anastasis_testing_lib.h
b/src/include/anastasis_testing_lib.h
index acc4d05..0a7dbce 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -663,30 +663,6 @@ enum ANASTASIS_TESTING_RecoverSecretOption
};
-/**
- * Obtain a recover from @a cmd.
- *
- * @param cmd command to extract the recovery from.
- * @param index the index of the recovery
- * @param r[out] set to the recovery coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_recovery (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_Recovery **r);
-
-
-/**
- * Offer a recovery process.
- *
- * @param index the recovery index number.
- * @param r the recovery to offer.
- * @return #GNUNET_OK on success.
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_recovery (unsigned int index,
- const struct ANASTASIS_Recovery *r);
/**
* Make the "recover secret" command.
*
@@ -707,7 +683,8 @@ ANASTASIS_TESTING_cmd_recover_secret (const char *label,
unsigned int http_status,
enum
ANASTASIS_TESTING_RecoverSecretOption
rso,
- const char *download_ref);
+ const char *download_ref,
+ const char *core_secret_ref);
/* ********************* test challenge answer ********************* */
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index a800bfb..de8cf44 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -76,7 +76,6 @@ libanastasistesting_la_SOURCES = \
testing_trait_truth.c \
testing_trait_policy.c \
testing_trait_core_secret.c \
- testing_trait_recovery.c \
testing_trait_challenge.c
libanastasistesting_la_LIBADD = \
$(top_builddir)/src/lib/libanastasisrest.la \
diff --git a/src/lib/test_anastasis.c b/src/lib/test_anastasis.c
index fc98911..fdd47f5 100644
--- a/src/lib/test_anastasis.c
+++ b/src/lib/test_anastasis.c
@@ -252,7 +252,7 @@ run (void *cls,
ANASTASIS_TESTING_SSO_NONE,
"policy-create-1",
NULL),
- /*
+/**
ANASTASIS_TESTING_cmd_recover_secret ("recover-secret-1",
anastasis_url,
ANASTASIS_TESTING_make_id_data_example (
@@ -260,9 +260,28 @@ run (void *cls,
0,
MHD_HTTP_PAYMENT_REQUIRED,
ANASTASIS_TESTING_RSO_NONE,
- salt-request-1),
- */
-
+ "salt-request-1",
+ "secret-share-1"),
+
+ ANASTASIS_TESTING_cmd_challenge_answer ("challenge-answer-1",
+ MHD_HTTP_OK,
+ "recover-secret-1",
+ 0,
+ "HashOfSomeTruth1",
+ strlen("HashOfSomeTruth1")),
+ ANASTASIS_TESTING_cmd_challenge_answer ("challenge-answer-2",
+ MHD_HTTP_OK,
+ "recover-secret-1",
+ 1,
+ "HashOfSomeTruth2",
+ strlen("HashOfSomeTruth2")),
+ ANASTASIS_TESTING_cmd_challenge_answer ("challenge-answer-3",
+ MHD_HTTP_OK,
+ "recover-secret-1",
+ 2,
+ "HashOfSomeTruth3",
+ strlen("HashOfSomeTruth3")),
+*//
TALER_TESTING_cmd_end ()
};
diff --git a/src/lib/testing_cmd_challenge_answer.c
b/src/lib/testing_cmd_challenge_answer.c
index f6d3a43..97f8310 100644
--- a/src/lib/testing_cmd_challenge_answer.c
+++ b/src/lib/testing_cmd_challenge_answer.c
@@ -68,8 +68,11 @@ challenge_answer_cb (void *af_cls,
enum TALER_ErrorCode ec)
{
struct ChallengeState *cs = af_cls;
- // FIXME
-
+ if (ec != MHD_HTTP_OK)
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (cs->is);
+ }
TALER_TESTING_interpreter_next (cs->is);
}
@@ -131,7 +134,6 @@ static void
challenge_answer_cleanup (void *cls,
const struct TALER_TESTING_Command *cmd)
{
- // FIXME: Cleanup logic
struct ChallengeState *cs = cls;
GNUNET_free (cs);
}
diff --git a/src/lib/testing_cmd_recover_secret.c
b/src/lib/testing_cmd_recover_secret.c
index e586b9d..086b8a0 100644
--- a/src/lib/testing_cmd_recover_secret.c
+++ b/src/lib/testing_cmd_recover_secret.c
@@ -56,7 +56,10 @@ struct RecoverSecretState
* Reference to download command we expect to lookup.
*/
const char *download_reference;
-
+ /**
+ * Reference to download command we expect to lookup.
+ */
+ const char *core_secret_reference;
/**
* Options for how we are supposed to do the download.
*/
@@ -77,6 +80,11 @@ struct RecoverSecretState
* Recovery information from the lookup
*/
struct ANASTASIS_RecoveryInformation *ri;
+ /**
+ * Coresecret to check if decryption worked
+ */
+ const void *core_secret;
+
};
static void
@@ -100,9 +108,14 @@ core_secret_cb (void *cls,
const void *secret,
size_t secret_size)
{
-/**
- * FIXME check if same as uploaded by secret share
- */
+ struct RecoverSecretState *rss = cls;
+ if (0 != memcmp(secret, rss->core_secret, secret_size))
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (rss->is);
+ return;
+ }
+ TALER_TESTING_interpreter_next (rss->is);
}
/**
@@ -143,7 +156,27 @@ recover_secret_run (void *cls,
return;
}
}
-
+ if (NULL != rss->core_secret_reference)
+ {
+ ref = TALER_TESTING_interpreter_lookup_command
+ (is,
+ rss->core_secret_reference);
+ if (NULL == ref)
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (rss->is);
+ return;
+ }
+ if (GNUNET_OK !=
+ ANASTASIS_TESTING_get_trait_core_secret (ref,
+ 0,
+ &rss->core_secret))
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (rss->is);
+ return;
+ }
+ }
rss->recovery = ANASTASIS_recovery_begin (is->ctx,
rss->id_data,
rss->version,
@@ -175,7 +208,7 @@ recover_secret_cleanup (void *cls,
{
// FIXME: Cleanup logic
struct RecoverSecretState *rss = cls;
-
+ ANASTASIS_recovery_abort(rss->recovery);
GNUNET_free (rss);
}
@@ -197,14 +230,8 @@ recover_secret_traits (void *cls,
{
struct RecoverSecretState *rss = cls;
struct TALER_TESTING_Trait traits[] = {
- ANASTASIS_TESTING_make_trait_recovery (0,
- rss->recovery),
- ANASTASIS_TESTING_make_trait_challenge (0,
- rss->ri->cs[0]),
- ANASTASIS_TESTING_make_trait_challenge (1,
- rss->ri->cs[1]),
- ANASTASIS_TESTING_make_trait_challenge (2,
- rss->ri->cs[2]),
+ ANASTASIS_TESTING_make_trait_challenge (index,
+ rss->ri->cs[index]),
TALER_TESTING_trait_end ()
};
@@ -234,7 +261,8 @@ ANASTASIS_TESTING_cmd_recover_secret (const char *label,
unsigned int http_status,
enum
ANASTASIS_TESTING_RecoverSecretOption
rso,
- const char *download_ref)
+ const char *download_ref,
+ const char *core_secret_ref)
{
struct RecoverSecretState *rss;
@@ -245,6 +273,7 @@ ANASTASIS_TESTING_cmd_recover_secret (const char *label,
rss->rsopt = rso;
rss->anastasis_url = anastasis_url;
rss->download_reference = download_ref;
+ rss->core_secret_reference = core_secret_ref;
struct TALER_TESTING_Command cmd = {
.cls = rss,
diff --git a/src/lib/testing_trait_recovery.c b/src/lib/testing_trait_recovery.c
deleted file mode 100644
index f571d6d..0000000
--- a/src/lib/testing_trait_recovery.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2020 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
-
- TALER is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with TALER; see the file COPYING. If not, see
- <http://www.gnu.org/licenses/>
-*/
-/**
- * @file lib/testing_trait_recovery.c
- * @brief traits to offer a recovery process
- * @author Christian Grothoff
- * @author Dominik Meister
- * @author Dennis Neufeld
- */
-#include "platform.h"
-#include "anastasis_testing_lib.h"
-
-#define ANASTASIS_TESTING_TRAIT_RECOVERY "anastasis-recovery"
-
-/**
- * Obtain a recover from @a cmd.
- *
- * @param cmd command to extract the recovery from.
- * @param index the index of the recovery
- * @param r[out] set to the recovery coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_recovery (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_Recovery **r)
-{
- return cmd->traits (cmd->cls,
- (const void **) r,
- ANASTASIS_TESTING_TRAIT_RECOVERY,
- index);
-}
-
-
-/**
- * Offer a recovery process.
- *
- * @param index the recovery index number.
- * @param r the recovery to offer.
- * @return #GNUNET_OK on success.
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_recovery
- (unsigned int index,
- const struct ANASTASIS_Recovery *r)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = ANASTASIS_TESTING_TRAIT_RECOVERY,
- .ptr = (const void *) r
- };
- return ret;
-}
-/* end of testing_trait_recovery.c */
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: prepared recover test,
gnunet <=