summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-11-17 22:02:08 +0100
committerChristian Grothoff <christian@grothoff.org>2021-11-17 22:02:08 +0100
commit3ccacbd78bf720294363648a496b635abe072408 (patch)
treed03414707aebbaaffa7add6a7ca0ea02be1b6ca7
parent36e8be14334cd619d2847e3e8c1ecc136f402d71 (diff)
downloadanastasis-3ccacbd78bf720294363648a496b635abe072408.tar.gz
anastasis-3ccacbd78bf720294363648a496b635abe072408.tar.bz2
anastasis-3ccacbd78bf720294363648a496b635abe072408.zip
make anastasis build against latest Exchange
-rw-r--r--src/authorization/anastasis_authorization_plugin_email.c2
-rw-r--r--src/backend/anastasis-httpd_truth.c2
-rw-r--r--src/include/anastasis_testing_lib.h467
-rw-r--r--src/testing/Makefile.am16
-rw-r--r--src/testing/testing_api_cmd_config.c4
-rw-r--r--src/testing/testing_api_cmd_keyshare_lookup.c51
-rw-r--r--src/testing/testing_api_cmd_policy_lookup.c2
-rw-r--r--src/testing/testing_api_cmd_policy_store.c22
-rw-r--r--src/testing/testing_api_cmd_truth_store.c24
-rw-r--r--src/testing/testing_cmd_challenge_answer.c42
-rw-r--r--src/testing/testing_cmd_policy_create.c11
-rw-r--r--src/testing/testing_cmd_recover_secret.c16
-rw-r--r--src/testing/testing_cmd_secret_share.c23
-rw-r--r--src/testing/testing_cmd_truth_upload.c8
14 files changed, 205 insertions, 485 deletions
diff --git a/src/authorization/anastasis_authorization_plugin_email.c b/src/authorization/anastasis_authorization_plugin_email.c
index 55ea580..d968252 100644
--- a/src/authorization/anastasis_authorization_plugin_email.c
+++ b/src/authorization/anastasis_authorization_plugin_email.c
@@ -379,7 +379,7 @@ email_process (struct ANASTASIS_AUTHORIZATION_State *as,
connection,
"body"),
(unsigned long long) as->code,
- ANASTASIS_crypto_uuid2s (&as->truth_uuid));
+ ANASTASIS_CRYPTO_uuid2s (&as->truth_uuid));
{
const char *off = as->msg;
diff --git a/src/backend/anastasis-httpd_truth.c b/src/backend/anastasis-httpd_truth.c
index aedd0a2..52d5dab 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -349,7 +349,7 @@ refund_cb (
void *cls,
const struct TALER_MERCHANT_HttpResponse *hr,
const char *taler_refund_uri,
- const struct GNUNET_HashCode *h_contract)
+ const struct TALER_PrivateContractHash *h_contract)
{
struct RefundEntry *re = cls;
diff --git a/src/include/anastasis_testing_lib.h b/src/include/anastasis_testing_lib.h
index a4807a1..ba1b8a3 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -32,231 +32,125 @@
#define ANASTASIS_FAIL() \
do {GNUNET_break (0); return NULL; } while (0)
-/**
- * Index used in #ANASTASIS_TESTING_get_trait_hash() for the current hash.
- */
-#define ANASTASIS_TESTING_TRAIT_HASH_CURRENT 0
-
-/**
- * Obtain a hash from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number, use #ANASTASIS_TESTING_TRAIT_HASH_CURRENT
- * @param[out] h set to the hash coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_hash (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct GNUNET_HashCode **h);
-
-
-/**
- * Offer a hash.
- *
- * @param index the number's index number.
- * @param h the hash to offer.
- * @return trait on success.
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_hash (unsigned int index,
- const struct GNUNET_HashCode *h);
-
-
-/**
- * Obtain a truth decryption key from @a cmd.
- *
- * @param cmd command to extract the public key from.
- * @param index usually 0
- * @param[out] key set to the account public key used in @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_truth_key (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_CRYPTO_TruthKeyP **key);
-
-
-/**
- * Offer an truth decryption key.
- *
- * @param index usually zero
- * @param h the account_pub to offer.
- * @return trait on success.
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_truth_key (
- unsigned int index,
- const struct ANASTASIS_CRYPTO_TruthKeyP *h);
-
-
-/**
- * Obtain an account public key from @a cmd.
- *
- * @param cmd command to extract the public key from.
- * @param index usually 0
- * @param[out] pub set to the account public key used in @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_account_pub (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_CRYPTO_AccountPublicKeyP **pub);
-
-
-/**
- * Offer an account public key.
- *
- * @param index usually zero
- * @param h the account_pub to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_account_pub (
- unsigned int index,
- const struct ANASTASIS_CRYPTO_AccountPublicKeyP *h);
-
-
-/**
- * Obtain an account private key from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param index must be 0
- * @param[out] priv set to the account private key used in @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_account_priv (
- const struct
- TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_CRYPTO_AccountPrivateKeyP **priv);
-
-
-/**
- * Offer an account private key.
- *
- * @param index usually zero
- * @param priv the account_priv to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_account_priv (
- unsigned int index,
- const struct
- ANASTASIS_CRYPTO_AccountPrivateKeyP *priv);
-
-/**
- * Obtain an account public key from @a cmd.
- *
- * @param cmd command to extract the payment identifier from.
- * @param index the payment identifier's index number.
- * @param[out] payment_secret set to the payment secret coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_payment_secret (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_PaymentSecretP **payment_secret);
-
-
-/**
- * Offer a payment secret.
- *
- * @param index usually zero
- * @param h the payment secret to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_payment_secret (
- unsigned int index,
- const struct ANASTASIS_PaymentSecretP *h);
-
-
-/**
- * Obtain an truth UUID from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] tpk set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_truth_uuid (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_CRYPTO_TruthUUIDP **tpk);
-
-
-/**
- * Offer a truth UUID.
- *
- * @param index the number's index number.
- * @param tpk the UUID to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_truth_uuid (
- unsigned int index,
- const struct ANASTASIS_CRYPTO_TruthUUIDP *tpk);
-
/**
- * Obtain an encrypted key share from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] eks set to the key share coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_eks (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_CRYPTO_EncryptedKeyShareP **eks);
-
-
-/**
- * Offer an encrypted key share.
- *
- * @param index the number's index number.
- * @param eks the encrypted key share to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_eks (
- unsigned int index,
- const struct ANASTASIS_CRYPTO_EncryptedKeyShareP *eks);
-
-
-/**
- * Obtain a code from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] code set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_code (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const char **code);
-
-
-/**
- * Offer an authentication code.
- *
- * @param index the number's index number.
- * @param code the code to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_code (unsigned int index,
- const char *code);
+ * Create headers for a trait with name @a name for
+ * statically allocated data of type @a type.
+ */
+#define ANASTASIS_TESTING_MAKE_DECL_SIMPLE_TRAIT(name,type) \
+ enum GNUNET_GenericReturnValue \
+ ANASTASIS_TESTING_get_trait_ ## name ( \
+ const struct TALER_TESTING_Command *cmd, \
+ type **ret); \
+ struct TALER_TESTING_Trait \
+ ANASTASIS_TESTING_make_trait_ ## name ( \
+ type * value);
+
+
+/**
+ * Create C implementation for a trait with name @a name for statically
+ * allocated data of type @a type.
+ */
+#define ANASTASIS_TESTING_MAKE_IMPL_SIMPLE_TRAIT(name,type) \
+ enum GNUNET_GenericReturnValue \
+ ANASTASIS_TESTING_get_trait_ ## name ( \
+ const struct TALER_TESTING_Command *cmd, \
+ type **ret) \
+ { \
+ if (NULL == cmd->traits) return GNUNET_SYSERR; \
+ return cmd->traits (cmd->cls, \
+ (const void **) ret, \
+ TALER_S (name), \
+ 0); \
+ } \
+ struct TALER_TESTING_Trait \
+ ANASTASIS_TESTING_make_trait_ ## name ( \
+ type * value) \
+ { \
+ struct TALER_TESTING_Trait ret = { \
+ .trait_name = TALER_S (name), \
+ .ptr = (const void *) value \
+ }; \
+ return ret; \
+ }
+
+
+/**
+ * Create headers for a trait with name @a name for
+ * statically allocated data of type @a type.
+ */
+#define ANASTASIS_TESTING_MAKE_DECL_INDEXED_TRAIT(name,type) \
+ enum GNUNET_GenericReturnValue \
+ ANASTASIS_TESTING_get_trait_ ## name ( \
+ const struct TALER_TESTING_Command *cmd, \
+ unsigned int index, \
+ type **ret); \
+ struct TALER_TESTING_Trait \
+ ANASTASIS_TESTING_make_trait_ ## name ( \
+ unsigned int index, \
+ type * value);
+
+
+/**
+ * Create C implementation for a trait with name @a name for statically
+ * allocated data of type @a type.
+ */
+#define ANASTASIS_TESTING_MAKE_IMPL_INDEXED_TRAIT(name,type) \
+ enum GNUNET_GenericReturnValue \
+ ANASTASIS_TESTING_get_trait_ ## name ( \
+ const struct TALER_TESTING_Command *cmd, \
+ unsigned int index, \
+ type **ret) \
+ { \
+ if (NULL == cmd->traits) return GNUNET_SYSERR; \
+ return cmd->traits (cmd->cls, \
+ (const void **) ret, \
+ TALER_S (name), \
+ index); \
+ } \
+ struct TALER_TESTING_Trait \
+ ANASTASIS_TESTING_make_trait_ ## name ( \
+ unsigned int index, \
+ type * value) \
+ { \
+ struct TALER_TESTING_Trait ret = { \
+ .index = index, \
+ .trait_name = TALER_S (name), \
+ .ptr = (const void *) value \
+ }; \
+ return ret; \
+ }
+
+
+/**
+ * Call #op on all simple traits.
+ */
+#define ANASTASIS_TESTING_SIMPLE_TRAITS(op) \
+ op (hash, const struct GNUNET_HashCode) \
+ op (truth, const struct ANASTASIS_Truth *) \
+ op (policy, const struct ANASTASIS_Policy *) \
+ op (salt, const struct ANASTASIS_CRYPTO_ProviderSaltP) \
+ op (core_secret, const void *) \
+ op (truth_key, const struct ANASTASIS_CRYPTO_TruthKeyP) \
+ op (account_pub, const struct ANASTASIS_CRYPTO_AccountPublicKeyP) \
+ op (account_priv, const struct ANASTASIS_CRYPTO_AccountPrivateKeyP) \
+ op (payment_secret, const struct ANASTASIS_PaymentSecretP) \
+ op (truth_uuid, const struct ANASTASIS_CRYPTO_TruthUUIDP) \
+ op (eks, const struct ANASTASIS_CRYPTO_EncryptedKeyShareP) \
+ op (code, const char *) \
+ op (filename, const char *)
+
+
+/**
+ * Call #op on all indexed traits.
+ */
+#define ANASTASIS_TESTING_INDEXED_TRAITS(op) \
+ op (challenges, const struct ANASTASIS_Challenge *)
+
+
+ANASTASIS_TESTING_SIMPLE_TRAITS (ANASTASIS_TESTING_MAKE_DECL_SIMPLE_TRAIT)
+
+ANASTASIS_TESTING_INDEXED_TRAITS (ANASTASIS_TESTING_MAKE_DECL_INDEXED_TRAIT)
/**
@@ -505,34 +399,6 @@ ANASTASIS_TESTING_cmd_keyshare_lookup (
/**
- * Obtain a salt from @a cmd.
- *
- * @param cmd command to extract the salt from.
- * @param index the salt's index number.
- * @param[out] s set to the salt coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_salt (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_CRYPTO_ProviderSaltP **s);
-
-
-/**
- * Offer an salt.
- *
- * @param index the salt's index number.
- * @param s the salt to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_salt (
- unsigned int index,
- const struct ANASTASIS_CRYPTO_ProviderSaltP *s);
-
-
-/**
* Make the "/config" command.
*
* @param label command label
@@ -549,31 +415,6 @@ ANASTASIS_TESTING_cmd_config (const char *label,
/* ********************* test truth upload ********************* */
/**
- * Obtain a truth from @a cmd.
- *
- * @param cmd command to extract the truth from.
- * @param index the index of the truth
- * @param[out] t set to the truth coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_truth (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_Truth **t);
-
-
-/**
- * Offer a truth.
- *
- * @param index the truth's index number.
- * @param t the truth to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_truth (unsigned int index,
- const struct ANASTASIS_Truth *t);
-
-/**
* Creates a sample of id_data.
*
* @param id_data some sample data (e.g. AHV, name, surname, ...)
@@ -642,31 +483,6 @@ ANASTASIS_TESTING_cmd_truth_upload_question (
/* ********************* test policy create ********************* */
-/**
- * Obtain a policy from @a cmd.
- *
- * @param cmd command to extract the policy from.
- * @param index the index of the policy
- * @param[out] p set to the policy coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_policy (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_Policy **p);
-
-
-/**
- * Offer a policy.
- *
- * @param index the policy's index number.
- * @param p the policy to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_policy (unsigned int index,
- const struct ANASTASIS_Policy *p);
-
/**
* Make the "policy create" command.
@@ -682,31 +498,6 @@ ANASTASIS_TESTING_cmd_policy_create (const char *label,
/* ********************* test secret share ********************* */
-/**
- * Obtain the core secret from @a cmd.
- *
- * @param cmd command to extract the core secret from.
- * @param index the index of the core secret (usually 0)
- * @param[out] s set to the core secret coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_core_secret (const struct
- TALER_TESTING_Command *cmd,
- unsigned int index,
- const void **s);
-
-
-/**
- * Offer the core secret.
- *
- * @param index the core secret's index number (usually 0).
- * @param s the core secret to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_core_secret (unsigned int index,
- const void *s);
/**
* Types of options for performing the secret sharing. Used as a bitmask.
@@ -824,30 +615,6 @@ ANASTASIS_TESTING_cmd_recover_secret_finish (
/* ********************* test challenge answer ********************* */
-/**
- * Obtain a challenge from @a cmd.
- *
- * @param cmd command to extract the challenge from.
- * @param index the index of the challenge
- * @param[out] c set to the challenge coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-ANASTASIS_TESTING_get_trait_challenge (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct ANASTASIS_Challenge **c);
-
-/**
- * Offer a challenge.
- *
- * @param index the challenge index number.
- * @param r the challenge to offer.
- * @return trait on success
- */
-struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_challenge (unsigned int index,
- const struct ANASTASIS_Challenge *r);
-
/**
* Create a "challenge start" command. Suitable for the "file"
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 8fc710b..9a98530 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -19,24 +19,12 @@ libanastasistesting_la_SOURCES = \
testing_api_cmd_keyshare_lookup.c \
testing_api_cmd_config.c \
testing_api_helpers.c \
- testing_api_trait_account_pub.c \
- testing_api_trait_account_priv.c \
- testing_api_trait_eks.c \
- testing_api_trait_payment_secret.c \
- testing_api_trait_truth_key.c \
- testing_api_trait_truth_uuid.c \
- testing_api_trait_hash.c \
- testing_api_trait_salt.c \
- testing_api_trait_code.c \
+ testing_api_traits.c \
testing_cmd_truth_upload.c \
testing_cmd_policy_create.c \
testing_cmd_secret_share.c \
testing_cmd_recover_secret.c \
- testing_cmd_challenge_answer.c \
- testing_trait_truth.c \
- testing_trait_policy.c \
- testing_trait_core_secret.c \
- testing_trait_challenge.c
+ testing_cmd_challenge_answer.c
libanastasistesting_la_LIBADD = \
$(top_builddir)/src/restclient/libanastasisrest.la \
$(top_builddir)/src/lib/libanastasis.la \
diff --git a/src/testing/testing_api_cmd_config.c b/src/testing/testing_api_cmd_config.c
index 4b4a5cc..b4cf6e0 100644
--- a/src/testing/testing_api_cmd_config.c
+++ b/src/testing/testing_api_cmd_config.c
@@ -167,10 +167,8 @@ config_traits (void *cls,
unsigned int index)
{
struct ConfigState *ss = cls;
-
struct TALER_TESTING_Trait traits[] = {
- ANASTASIS_TESTING_make_trait_salt (0,
- &ss->salt),
+ ANASTASIS_TESTING_make_trait_salt (&ss->salt),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_keyshare_lookup.c b/src/testing/testing_api_cmd_keyshare_lookup.c
index 2d12767..5b2adea 100644
--- a/src/testing/testing_api_cmd_keyshare_lookup.c
+++ b/src/testing/testing_api_cmd_keyshare_lookup.c
@@ -222,7 +222,7 @@ keyshare_lookup_run (void *cls,
const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key;
const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid;
const struct ANASTASIS_PaymentSecretP *payment_secret;
- const char *answer;
+ const char **answer;
ksls->is = is;
if (NULL == ksls->upload_reference)
@@ -244,23 +244,21 @@ keyshare_lookup_run (void *cls,
return;
}
{
- const char *fn;
+ const char **fn;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_string (upload_cmd,
- 0,
- &fn))
+ ANASTASIS_TESTING_get_trait_filename (upload_cmd,
+ &fn))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (ksls->is);
return;
}
- if (NULL != fn)
- ksls->filename = GNUNET_strdup (fn);
+ if (NULL != *fn)
+ ksls->filename = GNUNET_strdup (*fn);
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_truth_uuid (upload_cmd,
- 0,
&truth_uuid))
{
GNUNET_break (0);
@@ -275,7 +273,6 @@ keyshare_lookup_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_truth_key (upload_cmd,
- 0,
&truth_key))
{
GNUNET_break (0);
@@ -304,14 +301,13 @@ keyshare_lookup_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_code (download_cmd,
- 0,
&answer))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (ksls->is);
return;
}
- if (NULL == answer)
+ if (NULL == *answer)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (ksls->is);
@@ -321,19 +317,18 @@ keyshare_lookup_run (void *cls,
else
{
/* answer is the answer */
- answer = ksls->answer;
+ answer = &ksls->answer;
}
if (NULL != ksls->payment_reference)
{
const struct TALER_TESTING_Command *payment_cmd;
- payment_cmd = TALER_TESTING_interpreter_lookup_command
- (is,
- ksls->payment_reference);
+ payment_cmd = TALER_TESTING_interpreter_lookup_command (
+ is,
+ ksls->payment_reference);
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_payment_secret (payment_cmd,
- 0,
&payment_secret))
{
GNUNET_break (0);
@@ -349,9 +344,9 @@ keyshare_lookup_run (void *cls,
{
struct GNUNET_HashCode h_answer;
- if (NULL != answer)
- GNUNET_CRYPTO_hash (answer,
- strlen (answer),
+ if (NULL != *answer)
+ GNUNET_CRYPTO_hash (*answer,
+ strlen (*answer),
&h_answer);
ksls->kslo = ANASTASIS_keyshare_lookup (is->ctx,
ksls->anastasis_url,
@@ -359,7 +354,7 @@ keyshare_lookup_run (void *cls,
truth_key,
payment_secret,
GNUNET_TIME_UNIT_ZERO,
- (NULL != answer)
+ (NULL != *answer)
? &h_answer
: NULL,
&keyshare_lookup_cb,
@@ -414,14 +409,14 @@ keyshare_lookup_traits (void *cls,
{
struct KeyShareLookupState *ksls = cls;
struct TALER_TESTING_Trait traits[] = {
- ANASTASIS_TESTING_make_trait_payment_secret (0,
- &ksls->payment_secret_response),
- TALER_TESTING_make_trait_url (TALER_TESTING_UT_TALER_URL,
- ksls->pay_uri),
- TALER_TESTING_make_trait_order_id (0,
- ksls->order_id),
- ANASTASIS_TESTING_make_trait_code (0,
- ksls->code),
+ ANASTASIS_TESTING_make_trait_payment_secret (
+ &ksls->payment_secret_response),
+ TALER_TESTING_make_trait_payto_uri (
+ (const char **) ksls->pay_uri),
+ TALER_TESTING_make_trait_order_id (
+ (const char **) &ksls->order_id),
+ ANASTASIS_TESTING_make_trait_code (
+ (const char **) ksls->code),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_policy_lookup.c b/src/testing/testing_api_cmd_policy_lookup.c
index f66ee98..1f59b12 100644
--- a/src/testing/testing_api_cmd_policy_lookup.c
+++ b/src/testing/testing_api_cmd_policy_lookup.c
@@ -140,7 +140,6 @@ policy_lookup_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_hash (upload_cmd,
- ANASTASIS_TESTING_TRAIT_HASH_CURRENT,
&pls->upload_hash))
{
GNUNET_break (0);
@@ -149,7 +148,6 @@ policy_lookup_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_account_pub (upload_cmd,
- 0,
&anastasis_pub))
{
GNUNET_break (0);
diff --git a/src/testing/testing_api_cmd_policy_store.c b/src/testing/testing_api_cmd_policy_store.c
index 524ad92..d1ee3c0 100644
--- a/src/testing/testing_api_cmd_policy_store.c
+++ b/src/testing/testing_api_cmd_policy_store.c
@@ -229,7 +229,6 @@ policy_store_run (void *cls,
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_account_priv (ref,
- 0,
&priv))
{
GNUNET_break (0);
@@ -243,7 +242,6 @@ policy_store_run (void *cls,
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_account_pub (ref,
- 0,
&pub))
{
GNUNET_break (0);
@@ -257,7 +255,6 @@ policy_store_run (void *cls,
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_payment_secret (ref,
- 0,
&ps))
{
GNUNET_break (0);
@@ -341,18 +338,13 @@ policy_store_traits (void *cls,
{
struct PolicyStoreState *pss = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_claim_token (0,
- &pss->claim_token),
- TALER_TESTING_make_trait_order_id (0,
- pss->order_id),
- ANASTASIS_TESTING_make_trait_hash (0,
- &pss->curr_hash),
- ANASTASIS_TESTING_make_trait_account_pub (0,
- &pss->anastasis_pub),
- ANASTASIS_TESTING_make_trait_account_priv (0,
- &pss->anastasis_priv),
- ANASTASIS_TESTING_make_trait_payment_secret (0,
- &pss->payment_secret_response),
+ TALER_TESTING_make_trait_claim_token (&pss->claim_token),
+ TALER_TESTING_make_trait_order_id (
+ (const char **) &pss->order_id),
+ ANASTASIS_TESTING_make_trait_hash (&pss->curr_hash),
+ ANASTASIS_TESTING_make_trait_account_pub (&pss->anastasis_pub),
+ ANASTASIS_TESTING_make_trait_account_priv (&pss->anastasis_priv),
+ ANASTASIS_TESTING_make_trait_payment_secret (&pss->payment_secret_response),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_truth_store.c b/src/testing/testing_api_cmd_truth_store.c
index e511926..0972210 100644
--- a/src/testing/testing_api_cmd_truth_store.c
+++ b/src/testing/testing_api_cmd_truth_store.c
@@ -205,7 +205,6 @@ truth_store_run (void *cls,
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_truth_uuid (ref,
- 0,
&uuid))
{
GNUNET_break (0);
@@ -215,7 +214,6 @@ truth_store_run (void *cls,
tss->uuid = *uuid;
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_eks (ref,
- 0,
&eks))
{
GNUNET_break (0);
@@ -335,7 +333,7 @@ truth_store_cleanup (void *cls,
* @param index index number of the object to extract.
* @return #GNUNET_OK on success
*/
-static int
+static enum GNUNET_GenericReturnValue
truth_store_traits (void *cls,
const void **ret,
const char *trait,
@@ -343,18 +341,14 @@ truth_store_traits (void *cls,
{
struct TruthStoreState *tss = cls;
struct TALER_TESTING_Trait traits[] = {
- ANASTASIS_TESTING_make_trait_truth_uuid (0,
- &tss->uuid),
- ANASTASIS_TESTING_make_trait_truth_key (0,
- &tss->key),
- ANASTASIS_TESTING_make_trait_eks (0,
- &tss->encrypted_keyshare),
- ANASTASIS_TESTING_make_trait_payment_secret (0,
- &tss->payment_secret_response),
- TALER_TESTING_make_trait_url (TALER_TESTING_UT_TALER_URL,
- tss->pay_uri),
- TALER_TESTING_make_trait_string (0,
- tss->filename),
+ ANASTASIS_TESTING_make_trait_truth_uuid (&tss->uuid),
+ ANASTASIS_TESTING_make_trait_truth_key (&tss->key),
+ ANASTASIS_TESTING_make_trait_eks (&tss->encrypted_keyshare),
+ ANASTASIS_TESTING_make_trait_payment_secret (&tss->payment_secret_response),
+ TALER_TESTING_make_trait_payto_uri (
+ (const char **) &tss->pay_uri),
+ ANASTASIS_TESTING_make_trait_filename (
+ (const char **) &tss->filename),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_cmd_challenge_answer.c b/src/testing/testing_cmd_challenge_answer.c
index e6122e3..ec8d03d 100644
--- a/src/testing/testing_cmd_challenge_answer.c
+++ b/src/testing/testing_cmd_challenge_answer.c
@@ -259,7 +259,7 @@ challenge_answer_run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct ChallengeState *cs = cls;
- const struct ANASTASIS_Challenge *c;
+ const struct ANASTASIS_Challenge **c;
const struct ANASTASIS_PaymentSecretP *ps;
cs->is = is;
@@ -277,14 +277,15 @@ challenge_answer_run (void *cls,
return;
}
if (GNUNET_OK !=
- ANASTASIS_TESTING_get_trait_challenge (ref,
- cs->challenge_index,
- &c))
+ ANASTASIS_TESTING_get_trait_challenges (ref,
+ cs->challenge_index,
+ &c))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (cs->is);
return;
}
+ cs->c = (struct ANASTASIS_Challenge *) *c;
}
if (NULL != cs->payment_ref)
@@ -301,7 +302,6 @@ challenge_answer_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_payment_secret (ref,
- 0,
&ps))
{
GNUNET_break (0);
@@ -314,12 +314,10 @@ challenge_answer_run (void *cls,
ps = NULL;
}
- cs->c = (struct ANASTASIS_Challenge *) c;
-
if (1 == cs->mode)
{
const struct TALER_TESTING_Command *ref;
- const char *answer;
+ const char **answer;
unsigned long long code;
char dummy;
@@ -333,7 +331,6 @@ challenge_answer_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_code (ref,
- 0,
&answer))
{
GNUNET_break (0);
@@ -341,7 +338,7 @@ challenge_answer_run (void *cls,
return;
}
if (1 !=
- sscanf (answer,
+ sscanf (*answer,
"%llu%c",
&code,
&dummy))
@@ -397,7 +394,7 @@ challenge_start_run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct ChallengeState *cs = cls;
- const struct ANASTASIS_Challenge *c;
+ const struct ANASTASIS_Challenge **c;
const struct TALER_TESTING_Command *ref;
const struct ANASTASIS_PaymentSecretP *ps;
@@ -412,9 +409,9 @@ challenge_start_run (void *cls,
return;
}
if (GNUNET_OK !=
- ANASTASIS_TESTING_get_trait_challenge (ref,
- cs->challenge_index,
- &c))
+ ANASTASIS_TESTING_get_trait_challenges (ref,
+ cs->challenge_index,
+ &c))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (cs->is);
@@ -434,7 +431,6 @@ challenge_start_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_payment_secret (ref,
- 0,
&ps))
{
GNUNET_break (0);
@@ -505,14 +501,14 @@ challenge_create_traits (void *cls,
{
struct ChallengeState *cs = cls;
struct TALER_TESTING_Trait traits[] = {
- ANASTASIS_TESTING_make_trait_code (0,
- cs->code),
- ANASTASIS_TESTING_make_trait_payment_secret (0,
- &cs->payment_order_req),
- TALER_TESTING_make_trait_url (TALER_TESTING_UT_TALER_URL,
- cs->payment_uri),
- TALER_TESTING_make_trait_order_id (0,
- cs->order_id),
+ ANASTASIS_TESTING_make_trait_code (
+ (const char **) cs->code),
+ ANASTASIS_TESTING_make_trait_payment_secret (
+ &cs->payment_order_req),
+ TALER_TESTING_make_trait_payto_uri (
+ (const char **) cs->payment_uri),
+ TALER_TESTING_make_trait_order_id (
+ (const char **) &cs->order_id),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_cmd_policy_create.c b/src/testing/testing_cmd_policy_create.c
index 33d5975..64f7060 100644
--- a/src/testing/testing_cmd_policy_create.c
+++ b/src/testing/testing_cmd_policy_create.c
@@ -82,7 +82,7 @@ policy_create_run (void *cls,
for (unsigned int i = 0; i < pcs->cmd_label_array_length; i++)
{
const struct TALER_TESTING_Command *ref;
- const struct ANASTASIS_Truth *truth;
+ const struct ANASTASIS_Truth **truth;
ref = TALER_TESTING_interpreter_lookup_command (is,
pcs->cmd_label_array[i]);
@@ -94,15 +94,14 @@ policy_create_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_truth (ref,
- 0,
&truth))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (pcs->is);
return;
}
- GNUNET_assert (NULL != truth);
- truths[i] = truth;
+ GNUNET_assert (NULL != *truth);
+ truths[i] = *truth;
}
}
@@ -159,8 +158,8 @@ policy_create_traits (void *cls,
{
struct PolicyCreateState *pcs = cls;
struct TALER_TESTING_Trait traits[] = {
- ANASTASIS_TESTING_make_trait_policy (0,
- pcs->policy),
+ ANASTASIS_TESTING_make_trait_policy (
+ (const struct ANASTASIS_Policy **) &pcs->policy),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_cmd_recover_secret.c b/src/testing/testing_cmd_recover_secret.c
index 8e75e4b..153143d 100644
--- a/src/testing/testing_cmd_recover_secret.c
+++ b/src/testing/testing_cmd_recover_secret.c
@@ -79,7 +79,7 @@ struct RecoverSecretState
/**
* Coresecret to check if decryption worked
*/
- const void *core_secret;
+ const void **core_secret;
/**
* Task scheduled to wait for recovery to complete.
@@ -151,7 +151,7 @@ core_secret_cb (void *cls,
return;
}
if (0 != memcmp (secret,
- rss->core_secret,
+ *rss->core_secret,
secret_size))
{
GNUNET_break (0);
@@ -204,7 +204,6 @@ recover_secret_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_salt (ref,
- 0,
&salt))
{
GNUNET_break (0);
@@ -224,9 +223,9 @@ recover_secret_run (void *cls,
return;
}
if (GNUNET_OK !=
- ANASTASIS_TESTING_get_trait_core_secret (ref,
- 0,
- &rss->core_secret))
+ ANASTASIS_TESTING_get_trait_core_secret (
+ ref,
+ (const void ***) &rss->core_secret))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (rss->is);
@@ -327,8 +326,9 @@ recover_secret_traits (void *cls,
}
{
struct TALER_TESTING_Trait traits[] = {
- ANASTASIS_TESTING_make_trait_challenge (index,
- rss->ri->cs[index]),
+ ANASTASIS_TESTING_make_trait_challenges (
+ index,
+ (const struct ANASTASIS_Challenge **) &rss->ri->cs[index]),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_cmd_secret_share.c b/src/testing/testing_cmd_secret_share.c
index a4f8819..7a9dbc0 100644
--- a/src/testing/testing_cmd_secret_share.c
+++ b/src/testing/testing_cmd_secret_share.c
@@ -199,7 +199,7 @@ secret_share_run (void *cls,
for (unsigned int i = 0; i < sss->cmd_label_array_length; i++)
{
const struct TALER_TESTING_Command *ref;
- const struct ANASTASIS_Policy *policy;
+ const struct ANASTASIS_Policy **policy;
ref = TALER_TESTING_interpreter_lookup_command (is,
sss->cmd_label_array[i]);
@@ -211,22 +211,21 @@ secret_share_run (void *cls,
}
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);
- policies[i] = policy;
+ GNUNET_assert (NULL != *policy);
+ policies[i] = *policy;
}
}
if (NULL != sss->prev_secret_share)
{
const struct TALER_TESTING_Command *ref;
- const char *order_id;
+ const char **order_id;
ref = TALER_TESTING_interpreter_lookup_command (is,
sss->prev_secret_share);
@@ -238,14 +237,13 @@ secret_share_run (void *cls,
}
if (GNUNET_OK !=
TALER_TESTING_get_trait_order_id (ref,
- 0,
&order_id))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (sss->is);
return;
}
- sss->payment_order_id = (char *) order_id;
+ sss->payment_order_id = (char *) *order_id;
if (NULL == sss->payment_order_id)
{
@@ -289,7 +287,6 @@ secret_share_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_salt (ref,
- 0,
&salt))
{
GNUNET_break (0);
@@ -368,12 +365,10 @@ secret_share_traits (void *cls,
{
struct SecretShareState *sss = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_claim_token (0,
- &sss->token),
- ANASTASIS_TESTING_make_trait_core_secret (0,
- sss->core_secret),
- TALER_TESTING_make_trait_order_id (0,
- sss->payment_order_id),
+ TALER_TESTING_make_trait_claim_token (&sss->token),
+ ANASTASIS_TESTING_make_trait_core_secret (&sss->core_secret),
+ TALER_TESTING_make_trait_order_id (
+ (const char **) &sss->payment_order_id),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_cmd_truth_upload.c b/src/testing/testing_cmd_truth_upload.c
index 030549d..99c2879 100644
--- a/src/testing/testing_cmd_truth_upload.c
+++ b/src/testing/testing_cmd_truth_upload.c
@@ -198,7 +198,6 @@ truth_upload_run (void *cls,
}
if (GNUNET_OK !=
ANASTASIS_TESTING_get_trait_salt (ref,
- 0,
&salt))
{
GNUNET_break (0);
@@ -285,10 +284,9 @@ truth_upload_traits (void *cls,
{
struct TruthUploadState *tus = cls;
struct TALER_TESTING_Trait traits[] = {
- ANASTASIS_TESTING_make_trait_truth (0,
- tus->truth),
- ANASTASIS_TESTING_make_trait_payment_secret (0,
- &tus->payment_secret_response),
+ ANASTASIS_TESTING_make_trait_truth (
+ (const struct ANASTASIS_Truth **) &tus->truth),
+ ANASTASIS_TESTING_make_trait_payment_secret (&tus->payment_secret_response),
TALER_TESTING_trait_end ()
};