gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: make API actually workable:


From: gnunet
Subject: [taler-exchange] branch master updated: make API actually workable:
Date: Fri, 04 Feb 2022 23:09:23 +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 cfc6c3fc make API actually workable:
cfc6c3fc is described below

commit cfc6c3fcd04e9bed639816828d05e8645d80860f
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Fri Feb 4 23:09:19 2022 +0100

    make API actually workable:
---
 src/include/taler_exchange_service.h    | 11 +++++++++--
 src/lib/exchange_api_melt.c             |  2 +-
 src/lib/exchange_api_refreshes_reveal.c | 20 ++++++++++++++------
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index ba80da3e..8fe1bf7d 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1609,6 +1609,8 @@ struct TALER_EXCHANGE_MeltHandle;
  *
  * @param cls closure
  * @param hr HTTP response data
+ * @param num_coins number of fresh coins to be created, length of the @a 
exchange_vals array, 0 if the operation failed
+ * @param alg_values array @a num_coins of exchange values contributed to the 
refresh operation
  * @param noreveal_index choice by the exchange in the cut-and-choose protocol,
  *                    UINT32_MAX on error
  * @param sign_key exchange key used to sign @a full_response, or NULL
@@ -1617,6 +1619,8 @@ typedef void
 (*TALER_EXCHANGE_MeltCallback) (
   void *cls,
   const struct TALER_EXCHANGE_HttpResponse *hr,
+  unsigned int num_coins,
+  const struct TALER_ExchangeWithdrawValues *alg_values,
   uint32_t noreveal_index,
   const struct TALER_ExchangePublicKeyP *sign_key);
 
@@ -1670,7 +1674,7 @@ TALER_EXCHANGE_melt_cancel (struct 
TALER_EXCHANGE_MeltHandle *mh);
  *
  * @param cls closure
  * @param hr HTTP response data
- * @param num_coins number of fresh coins created, length of the @a 
exchange_vals, @a sigs and @a coin_privs arrays, 0 if the operation failed
+ * @param num_coins number of fresh coins created, length of the @a sigs and 
@a coin_privs arrays, 0 if the operation failed
  * @param exchange_vals array of contributions from the exchange on the 
refreshes
  * @param coin_privs array of @a num_coins private keys for the coins that 
were created, NULL on error
  * @param sigs array of signature over @a num_coins coins, NULL on error
@@ -1681,7 +1685,6 @@ typedef void
   const struct TALER_EXCHANGE_HttpResponse *hr,
   unsigned int num_coins,
   const struct TALER_CoinSpendPrivateKeyP *coin_privs,
-  const struct TALER_ExchangeWithdrawValues *exchange_vals,
   const struct TALER_DenominationSignature *sigs);
 
 
@@ -1703,6 +1706,8 @@ struct TALER_EXCHANGE_RefreshesRevealHandle;
  * @param exchange the exchange handle; the exchange must be ready to operate
  * @param ps the fresh secret that defines the refresh operation
  * @param rd the refresh data that characterizes the refresh operation
+ * @param num_coins number of fresh coins to be created, length of the @a 
exchange_vals array, must match value in @a rd
+ * @param alg_values array @a num_coins of exchange values contributed to the 
refresh operation
  * @param noreveal_index response from the exchange to the
  *        #TALER_EXCHANGE_melt() invocation
  * @param reveal_cb the callback to call with the final result of the
@@ -1716,6 +1721,8 @@ TALER_EXCHANGE_refreshes_reveal (
   struct TALER_EXCHANGE_Handle *exchange,
   const struct TALER_PlanchetSecretsP *ps,
   const struct TALER_EXCHANGE_RefreshData *rd,
+  unsigned int num_coins,
+  const struct TALER_ExchangeWithdrawValues *alg_values,
   uint32_t noreveal_index,
   TALER_EXCHANGE_RefreshesRevealCallback reveal_cb,
   void *reveal_cb_cls);
diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c
index 204e5254..b93d255e 100644
--- a/src/lib/exchange_api_melt.c
+++ b/src/lib/exchange_api_melt.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2015-2021 Taler Systems SA
+  Copyright (C) 2015-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 published by the Free Software
diff --git a/src/lib/exchange_api_refreshes_reveal.c 
b/src/lib/exchange_api_refreshes_reveal.c
index 85d20e55..a233df4b 100644
--- a/src/lib/exchange_api_refreshes_reveal.c
+++ b/src/lib/exchange_api_refreshes_reveal.c
@@ -95,12 +95,14 @@ struct TALER_EXCHANGE_RefreshesRevealHandle
  *
  * @param rrh operation handle
  * @param json reply from the exchange
- * @param[out] sigs array of length `num_fresh_coins`, initialized to contain 
RSA signatures
+ * @param[out] sigs array of length `num_fresh_coins`, initialized to contain 
the coin private keys
+ * @param[out] sigs array of length `num_fresh_coins`, initialized to contain 
signatures
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
  */
 static enum GNUNET_GenericReturnValue
 refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh,
                    const json_t *json,
+                   struct TALER_CoinSpendPrivateKeyP *coin_privs,
                    struct TALER_DenominationSignature *sigs)
 {
   json_t *jsona;
@@ -165,6 +167,7 @@ refresh_reveal_ok (struct 
TALER_EXCHANGE_RefreshesRevealHandle *rrh,
 
     /* needed to verify the signature, and we didn't store it earlier,
        hence recomputing it here... */
+    coin_privs[i] = fc->coin_priv;
     GNUNET_CRYPTO_eddsa_key_get_public (&fc->coin_priv.eddsa_priv,
                                         &coin_pub.eddsa_pub);
     /* FIXME-Oec: Age commitment hash. */
@@ -223,13 +226,15 @@ handle_refresh_reveal_finished (void *cls,
   case MHD_HTTP_OK:
     {
       struct TALER_DenominationSignature sigs[rrh->md->num_fresh_coins];
-      int ret;
+      struct TALER_CoinSpendPrivateKeyP coin_privs[rrh->md->num_fresh_coins];
+      enum GNUNET_GenericReturnValue ret;
 
       memset (sigs,
               0,
               sizeof (sigs));
       ret = refresh_reveal_ok (rrh,
                                j,
+                               coin_privs,
                                sigs);
       if (GNUNET_OK != ret)
       {
@@ -241,7 +246,7 @@ handle_refresh_reveal_finished (void *cls,
         rrh->reveal_cb (rrh->reveal_cb_cls,
                         &hr,
                         rrh->md->num_fresh_coins,
-                        rrh->md->fresh_coins[rrh->noreveal_index],
+                        coin_privs,
                         sigs);
         rrh->reveal_cb = NULL;
       }
@@ -300,6 +305,8 @@ TALER_EXCHANGE_refreshes_reveal (
   struct TALER_EXCHANGE_Handle *exchange,
   const struct TALER_PlanchetSecretsP *ps,
   const struct TALER_EXCHANGE_RefreshData *rd,
+  unsigned int num_coins,
+  const struct TALER_ExchangeWithdrawValues *alg_values,
   uint32_t noreveal_index,
   TALER_EXCHANGE_RefreshesRevealCallback reveal_cb,
   void *reveal_cb_cls)
@@ -363,11 +370,9 @@ TALER_EXCHANGE_refreshes_reveal (
                                           GNUNET_JSON_from_data_auto (
                                             &denom_hash)));
 
-    // TODO: implement cipher handling
-    alg_values.cipher = TALER_DENOMINATION_RSA;
     if (GNUNET_OK !=
         TALER_planchet_prepare (&md.fresh_pks[i],
-                                &alg_values,
+                                &rrh->exchange_vals[i],
                                 &md.fresh_coins[noreveal_index][i],
                                 &c_hash,
                                 &pd))
@@ -452,6 +457,8 @@ TALER_EXCHANGE_refreshes_reveal (
   }
   /* finally, we can actually issue the request */
   rrh = GNUNET_new (struct TALER_EXCHANGE_RefreshesRevealHandle);
+  rrh->exchange_vals = GNUNET_new_array (struct TALER_ExchangeWithdrawValues,
+                                         md.num_fresh_coins);
   rrh->exchange = exchange;
   rrh->noreveal_index = noreveal_index;
   rrh->reveal_cb = reveal_cb;
@@ -505,6 +512,7 @@ TALER_EXCHANGE_refreshes_reveal_cancel (
   GNUNET_free (rrh->url);
   TALER_curl_easy_post_finished (&rrh->ctx);
   TALER_EXCHANGE_free_melt_data_ (rrh->md); /* does not free 'md' itself */
+  GNUNET_free (rrh->exchange_vals);
   GNUNET_free (rrh->md);
   GNUNET_free (rrh);
 }

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