From 5ff3189075459aa139739bd7440ed5a29e5e34fe Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 6 Feb 2022 20:04:36 +0100 Subject: [PATCH] -fix recoup testing cmds --- src/exchange-tools/taler-crypto-worker.c | 2 ++ src/include/taler_testing_lib.h | 4 ++- src/testing/testing_api_cmd_insert_deposit.c | 8 ++++-- src/testing/testing_api_cmd_recoup.c | 29 ++++++++++--------- src/testing/testing_api_cmd_recoup_refresh.c | 30 ++++++++++++-------- 5 files changed, 44 insertions(+), 29 deletions(-) diff --git a/src/exchange-tools/taler-crypto-worker.c b/src/exchange-tools/taler-crypto-worker.c index 6690b912b..87c40c775 100644 --- a/src/exchange-tools/taler-crypto-worker.c +++ b/src/exchange-tools/taler-crypto-worker.c @@ -178,6 +178,7 @@ run (void *cls, "sent response\n"); continue; } +#if FIXME_FLORIAN if (0 == strcmp ("setup_refresh_planchet", op)) { struct TALER_TransferSecretP transfer_secret; @@ -222,6 +223,7 @@ run (void *cls, "sent response\n"); continue; } +#endif GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "unsupported operation '%s'\n", op); diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 20e3145f0..5e3fe288b 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -1,6 +1,6 @@ /* This file is part of TALER - (C) 2018 Taler Systems SA + (C) 2018-2022 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 @@ -2482,6 +2482,8 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, #define TALER_TESTING_INDEXED_TRAITS(op) \ op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey) \ op (denom_sig, const struct TALER_DenominationSignature) \ + op (planchet_secret, const struct TALER_PlanchetSecretsP) \ + op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues) \ op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \ op (coin_pub, const struct TALER_CoinSpendPublicKeyP) \ op (absolute_time, const struct GNUNET_TIME_Absolute) \ diff --git a/src/testing/testing_api_cmd_insert_deposit.c b/src/testing/testing_api_cmd_insert_deposit.c index 013c22932..ba8b82363 100644 --- a/src/testing/testing_api_cmd_insert_deposit.c +++ b/src/testing/testing_api_cmd_insert_deposit.c @@ -203,13 +203,15 @@ insert_deposit_run (void *cls, struct TALER_BlindedDenominationSignature bds; struct TALER_PlanchetSecretsP ps; struct TALER_ExchangeWithdrawValues alg_values; + union TALER_DenominationBlindingKeyP bks; alg_values.cipher = TALER_DENOMINATION_RSA; TALER_planchet_blinding_secret_create (&ps, - &alg_values); + &alg_values, + &bks); GNUNET_assert (GNUNET_OK == TALER_denom_blind (&dpk, - &ps.blinding_key, + &bks, NULL, /* FIXME-Oec */ &deposit.coin.coin_pub, &alg_values, @@ -223,7 +225,7 @@ insert_deposit_run (void *cls, GNUNET_assert (GNUNET_OK == TALER_denom_sig_unblind (&deposit.coin.denom_sig, &bds, - &ps.blinding_key, + &bks, &dpk)); TALER_blinded_denom_sig_free (&bds); } diff --git a/src/testing/testing_api_cmd_recoup.c b/src/testing/testing_api_cmd_recoup.c index 7bd477377..da7f00a8e 100644 --- a/src/testing/testing_api_cmd_recoup.c +++ b/src/testing/testing_api_cmd_recoup.c @@ -237,12 +237,12 @@ recoup_run (void *cls, struct RecoupState *ps = cls; const struct TALER_TESTING_Command *coin_cmd; const struct TALER_CoinSpendPrivateKeyP *coin_priv; - const union TALER_DenominationBlindingKeyP *blinding_key; const struct TALER_EXCHANGE_DenomPublicKey *denom_pub; const struct TALER_DenominationSignature *coin_sig; - struct TALER_PlanchetSecretsP planchet; + const struct TALER_PlanchetSecretsP *planchet; char *cref; unsigned int idx; + const struct TALER_ExchangeWithdrawValues *ewv; ps->is = is; if (GNUNET_OK != @@ -264,7 +264,6 @@ recoup_run (void *cls, TALER_TESTING_interpreter_fail (is); return; } - if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv (coin_cmd, idx, @@ -274,18 +273,24 @@ recoup_run (void *cls, TALER_TESTING_interpreter_fail (is); return; } - if (GNUNET_OK != - TALER_TESTING_get_trait_blinding_key (coin_cmd, - idx, - &blinding_key)) + TALER_TESTING_get_trait_exchange_wd_value (coin_cmd, + idx, + &ewv)) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } + if (GNUNET_OK != + TALER_TESTING_get_trait_planchet_secret (coin_cmd, + idx, + &planchet)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); return; } - planchet.coin_priv = *coin_priv; - planchet.blinding_key = *blinding_key; GNUNET_CRYPTO_eddsa_key_get_public ( &coin_priv->eddsa_priv, &ps->reserve_history.details.recoup_details.coin_pub.eddsa_pub); @@ -299,7 +304,6 @@ recoup_run (void *cls, TALER_TESTING_interpreter_fail (is); return; } - if (GNUNET_OK != TALER_TESTING_get_trait_denom_sig (coin_cmd, idx, @@ -309,15 +313,14 @@ recoup_run (void *cls, TALER_TESTING_interpreter_fail (is); return; } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Trying to recoup denomination '%s'\n", TALER_B2S (&denom_pub->h_key)); - ps->ph = TALER_EXCHANGE_recoup (is->exchange, denom_pub, coin_sig, - &planchet, + ewv, + planchet, &recoup_cb, ps); GNUNET_assert (NULL != ps->ph); diff --git a/src/testing/testing_api_cmd_recoup_refresh.c b/src/testing/testing_api_cmd_recoup_refresh.c index 9287cdf30..9b09358f9 100644 --- a/src/testing/testing_api_cmd_recoup_refresh.c +++ b/src/testing/testing_api_cmd_recoup_refresh.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2018 Taler Systems SA + Copyright (C) 2014-2022 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 @@ -231,10 +231,10 @@ recoup_refresh_run (void *cls, struct RecoupRefreshState *ps = cls; const struct TALER_TESTING_Command *coin_cmd; const struct TALER_CoinSpendPrivateKeyP *coin_priv; - const union TALER_DenominationBlindingKeyP *blinding_key; const struct TALER_EXCHANGE_DenomPublicKey *denom_pub; const struct TALER_DenominationSignature *coin_sig; - struct TALER_PlanchetSecretsP planchet; + const struct TALER_PlanchetSecretsP *planchet; + const struct TALER_ExchangeWithdrawValues *ewv; char *cref; unsigned int idx; @@ -258,7 +258,6 @@ recoup_refresh_run (void *cls, TALER_TESTING_interpreter_fail (is); return; } - if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv (coin_cmd, idx, @@ -268,18 +267,24 @@ recoup_refresh_run (void *cls, TALER_TESTING_interpreter_fail (is); return; } - if (GNUNET_OK != - TALER_TESTING_get_trait_blinding_key (coin_cmd, - idx, - &blinding_key)) + TALER_TESTING_get_trait_exchange_wd_value (coin_cmd, + idx, + &ewv)) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } + if (GNUNET_OK != + TALER_TESTING_get_trait_planchet_secret (coin_cmd, + idx, + &planchet)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); return; } - planchet.coin_priv = *coin_priv; - planchet.blinding_key = *blinding_key; if (GNUNET_OK != TALER_TESTING_get_trait_denom_pub (coin_cmd, @@ -308,8 +313,9 @@ recoup_refresh_run (void *cls, ps->ph = TALER_EXCHANGE_recoup_refresh (is->exchange, denom_pub, coin_sig, - &planchet, - recoup_refresh_cb, + ewv, + planchet, + &recoup_refresh_cb, ps); GNUNET_assert (NULL != ps->ph); }