gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: fix FTBFS of main logic


From: gnunet
Subject: [taler-exchange] branch master updated: fix FTBFS of main logic
Date: Mon, 07 Feb 2022 10:55:09 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 031e3658 fix FTBFS of main logic
031e3658 is described below

commit 031e365814edd8bde4e4216c83f435a6915a06ab
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Feb 7 10:55:07 2022 +0100

    fix FTBFS of main logic
---
 src/benchmark/taler-aggregator-benchmark.c   |  9 ++++---
 src/include/taler_testing_lib.h              |  3 ++-
 src/testing/testing_api_cmd_recoup.c         |  1 -
 src/testing/testing_api_cmd_recoup_refresh.c |  6 ++---
 src/testing/testing_api_cmd_withdraw.c       | 38 +++++++++++++++++++++-------
 src/util/crypto.c                            | 34 ++++++++++++++++---------
 6 files changed, 62 insertions(+), 29 deletions(-)

diff --git a/src/benchmark/taler-aggregator-benchmark.c 
b/src/benchmark/taler-aggregator-benchmark.c
index 062cb1da..bace7002 100644
--- a/src/benchmark/taler-aggregator-benchmark.c
+++ b/src/benchmark/taler-aggregator-benchmark.c
@@ -493,6 +493,7 @@ run (void *cls,
     struct TALER_PlanchetSecretsP ps;
     struct TALER_ExchangeWithdrawValues alg_values;
     struct TALER_CoinSpendPublicKeyP coin_pub;
+    union TALER_DenominationBlindingKeyP bks;
 
     RANDOMIZE (&coin_pub);
     GNUNET_assert (GNUNET_OK ==
@@ -500,6 +501,7 @@ run (void *cls,
                                             &denom_pub,
                                             TALER_DENOMINATION_RSA,
                                             1024));
+    alg_values.cipher = TALER_DENOMINATION_RSA;
     TALER_denom_pub_hash (&denom_pub,
                           &h_denom_pub);
     make_amountN (2, 0, &issue.properties.value);
@@ -521,10 +523,11 @@ run (void *cls,
 
 
     TALER_planchet_blinding_secret_create (&ps,
-                                           &alg_values);
+                                           &alg_values,
+                                           &bks);
     GNUNET_assert (GNUNET_OK ==
                    TALER_denom_blind (&denom_pub,
-                                      &ps.blinding_key,
+                                      &bks,
                                       NULL, /* FIXME-oec */
                                       &coin_pub,
                                       &alg_values,
@@ -538,7 +541,7 @@ run (void *cls,
     GNUNET_assert (GNUNET_OK ==
                    TALER_denom_sig_unblind (&denom_sig,
                                             &bds,
-                                            &ps.blinding_key,
+                                            &bks,
                                             &denom_pub));
     TALER_blinded_denom_sig_free (&bds);
     TALER_denom_pub_free (&denom_pub);
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 5e3fe288..70bbda7f 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -2443,6 +2443,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait 
*traits,
 #define TALER_TESTING_SIMPLE_TRAITS(op) \
   op (bank_row, const uint64_t)                                    \
   op (reserve_priv, const struct TALER_ReservePrivateKeyP) \
+  op (planchet_secret, const struct TALER_PlanchetSecretsP) \
   op (reserve_pub, const struct TALER_ReservePublicKeyP)   \
   op (merchant_priv, const struct TALER_MerchantPrivateKeyP)       \
   op (merchant_pub, const struct TALER_MerchantPublicKeyP)         \
@@ -2482,7 +2483,7 @@ 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 (planchet_secrets, 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)                \
diff --git a/src/testing/testing_api_cmd_recoup.c 
b/src/testing/testing_api_cmd_recoup.c
index da7f00a8..74c294ef 100644
--- a/src/testing/testing_api_cmd_recoup.c
+++ b/src/testing/testing_api_cmd_recoup.c
@@ -284,7 +284,6 @@ recoup_run (void *cls,
   }
   if (GNUNET_OK !=
       TALER_TESTING_get_trait_planchet_secret (coin_cmd,
-                                               idx,
                                                &planchet))
   {
     GNUNET_break (0);
diff --git a/src/testing/testing_api_cmd_recoup_refresh.c 
b/src/testing/testing_api_cmd_recoup_refresh.c
index 9b09358f..a1f34f70 100644
--- a/src/testing/testing_api_cmd_recoup_refresh.c
+++ b/src/testing/testing_api_cmd_recoup_refresh.c
@@ -277,9 +277,9 @@ recoup_refresh_run (void *cls,
     return;
   }
   if (GNUNET_OK !=
-      TALER_TESTING_get_trait_planchet_secret (coin_cmd,
-                                               idx,
-                                               &planchet))
+      TALER_TESTING_get_trait_planchet_secrets (coin_cmd,
+                                                idx,
+                                                &planchet))
   {
     GNUNET_break (0);
     TALER_TESTING_interpreter_fail (is);
diff --git a/src/testing/testing_api_cmd_withdraw.c 
b/src/testing/testing_api_cmd_withdraw.c
index 7e2eecce..30640915 100644
--- a/src/testing/testing_api_cmd_withdraw.c
+++ b/src/testing/testing_api_cmd_withdraw.c
@@ -99,6 +99,22 @@ struct WithdrawState
    */
   struct TALER_ReservePublicKeyP reserve_pub;
 
+  /**
+   * Private key of the coin.
+   */
+  struct TALER_CoinSpendPrivateKeyP coin_priv;
+
+  /**
+   * Blinding key used during the operation.
+   */
+  union TALER_DenominationBlindingKeyP bks;
+
+  /**
+   * Values contributed from the exchange during the
+   * withdraw protocol.
+   */
+  struct TALER_ExchangeWithdrawValues exchange_vals;
+
   /**
    * Interpreter state (during command).
    */
@@ -263,6 +279,9 @@ reserve_withdraw_cb (void *cls,
   case MHD_HTTP_OK:
     TALER_denom_sig_deep_copy (&ws->sig,
                                &wr->details.success.sig);
+    ws->coin_priv = wr->details.success.coin_priv;
+    ws->bks = wr->details.success.bks;
+    ws->exchange_vals = wr->details.success.exchange_vals;
     if (0 != ws->total_backoff.rel_value_us)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -388,11 +407,11 @@ withdraw_run (void *cls,
                                 &ws->reserve_pub);
   if (NULL == ws->reuse_coin_key_ref)
   {
-    TALER_planchet_setup_coin_priv (&ws->ps.coin_priv);
+    TALER_planchet_setup_random (&ws->ps);
   }
   else
   {
-    const struct TALER_CoinSpendPrivateKeyP *coin_priv;
+    const struct TALER_PlanchetSecretsP *ps;
     const struct TALER_TESTING_Command *cref;
     char *cstr;
     unsigned int index;
@@ -406,11 +425,9 @@ withdraw_run (void *cls,
     GNUNET_assert (NULL != cref);
     GNUNET_free (cstr);
     GNUNET_assert (GNUNET_OK ==
-                   TALER_TESTING_get_trait_coin_priv (cref,
-                                                      index,
-                                                      &coin_priv));
-    TALER_planchet_setup_coin_priv (&ws->ps.coin_priv);
-    ws->ps.coin_priv = *coin_priv;
+                   TALER_TESTING_get_trait_planchet_secret (cref,
+                                                            &ps));
+    ws->ps = *ps;
   }
   if (NULL == ws->pk)
   {
@@ -513,9 +530,12 @@ withdraw_traits (void *cls,
     /* history entry MUST be first due to response code logic below! */
     TALER_TESTING_make_trait_reserve_history (&ws->reserve_history),
     TALER_TESTING_make_trait_coin_priv (0 /* only one coin */,
-                                        &ws->ps.coin_priv),
+                                        &ws->coin_priv),
+    TALER_TESTING_make_trait_planchet_secret (&ws->ps),
     TALER_TESTING_make_trait_blinding_key (0 /* only one coin */,
-                                           &ws->ps.blinding_key),
+                                           &ws->bks),
+    TALER_TESTING_make_trait_exchange_wd_value (0 /* only one coin */,
+                                                &ws->exchange_vals),
     TALER_TESTING_make_trait_denom_pub (0 /* only one coin */,
                                         ws->pk),
     TALER_TESTING_make_trait_denom_sig (0 /* only one coin */,
diff --git a/src/util/crypto.c b/src/util/crypto.c
index b315cd31..b4e610ab 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -146,6 +146,16 @@ TALER_link_recover_transfer_secret (
 }
 
 
+void
+TALER_planchet_setup_random (
+  struct TALER_PlanchetSecretsP *ps)
+{
+  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG,
+                              ps,
+                              sizeof (*ps));
+}
+
+
 void
 TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed,
                               uint32_t coin_num_salt,
@@ -167,11 +177,12 @@ TALER_planchet_setup_refresh (const struct 
TALER_TransferSecretP *secret_seed,
 }
 
 
+// FIXME: bad name!
 void
-cs_blinding_seed_derive (const struct
-                         TALER_PlanchetSecretsP *ps,
-                         const struct GNUNET_CRYPTO_CsRPublic r_pub[2],
-                         struct GNUNET_CRYPTO_CsNonce *blind_seed)
+cs_blinding_seed_derive (
+  const struct TALER_PlanchetSecretsP *ps,
+  const struct GNUNET_CRYPTO_CsRPublic r_pub[2],
+  struct GNUNET_CRYPTO_CsNonce *blind_seed)
 {
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_CRYPTO_hkdf (blind_seed,
@@ -190,9 +201,9 @@ cs_blinding_seed_derive (const struct
 
 
 void
-TALER_cs_withdraw_nonce_derive (const struct
-                                TALER_PlanchetSecretsP *ps,
-                                struct TALER_CsNonce *nonce)
+TALER_cs_withdraw_nonce_derive (
+  const struct TALER_PlanchetSecretsP *ps,
+  struct TALER_CsNonce *nonce)
 {
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_CRYPTO_kdf (nonce,
@@ -229,11 +240,10 @@ TALER_cs_refresh_nonce_derive (
 
 
 void
-TALER_planchet_blinding_secret_create (const struct TALER_PlanchetSecretsP *ps,
-
-                                       const struct
-                                       TALER_ExchangeWithdrawValues 
*alg_values,
-                                       union TALER_DenominationBlindingKeyP 
*bks)
+TALER_planchet_blinding_secret_create (
+  const struct TALER_PlanchetSecretsP *ps,
+  const struct TALER_ExchangeWithdrawValues *alg_values,
+  union TALER_DenominationBlindingKeyP *bks)
 {
   switch (alg_values->cipher)
   {

-- 
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]