gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: fixes with respect to new blindi


From: gnunet
Subject: [taler-exchange] branch master updated: fixes with respect to new blinding API
Date: Fri, 27 Oct 2023 23:54:58 +0200

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 192e3618 fixes with respect to new blinding API
192e3618 is described below

commit 192e361811c93327c80af69b0f5280b30ceae682
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Oct 27 23:54:55 2023 +0200

    fixes with respect to new blinding API
---
 contrib/gana                          |  2 +-
 src/exchangedb/pg_get_known_coin.c    |  4 ----
 src/include/taler_crypto_lib.h        | 37 ++++++++++++++++++-----------------
 src/include/taler_exchange_service.h  |  1 +
 src/lib/exchange_api_batch_withdraw.c | 20 ++++++++++++++-----
 src/lib/exchange_api_refresh_common.c |  5 +++--
 src/pq/pq_result_helper.c             |  2 +-
 7 files changed, 40 insertions(+), 31 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index 840792da..c7d16f85 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 840792da1b88e826a178df77a48f42b0b58a2570
+Subproject commit c7d16f850c5cd09a2f03da97ba87978ca0ba7eed
diff --git a/src/exchangedb/pg_get_known_coin.c 
b/src/exchangedb/pg_get_known_coin.c
index bab48c11..2c4a82d6 100644
--- a/src/exchangedb/pg_get_known_coin.c
+++ b/src/exchangedb/pg_get_known_coin.c
@@ -51,9 +51,6 @@ TEH_PG_get_known_coin (void *cls,
               "Getting known coin data for coin %s\n",
               TALER_B2S (coin_pub));
   coin_info->coin_pub = *coin_pub;
-  /* Used in #postgres_get_known_coin() to fetch
-     the denomination public key and signature for
-     a coin known to the exchange. */
   PREPARE (pg,
            "get_known_coin",
            "SELECT"
@@ -63,7 +60,6 @@ TEH_PG_get_known_coin (void *cls,
            " FROM known_coins"
            " JOIN denominations USING (denominations_serial)"
            " WHERE coin_pub=$1;");
-
   return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
                                                    "get_known_coin",
                                                    params,
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 06bf7f51..82d73700 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -1132,16 +1132,6 @@ TALER_rsa_pub_hash (const struct 
GNUNET_CRYPTO_RsaPublicKey *rsa,
                     struct TALER_RsaPubHashP *h_rsa);
 
 
-/**
- * Return the alg value singleton for creation of
- * blinding secrets for RSA.
- *
- * @return singleton to use for RSA blinding
- */
-const struct TALER_ExchangeWithdrawValues *
-TALER_denom_ewv_rsa_singleton (void);
-
-
 /**
  * Hash @a cs.
  *
@@ -1351,6 +1341,16 @@ struct TALER_ExchangeWithdrawValues
 };
 
 
+/**
+ * Return the alg value singleton for creation of
+ * blinding secrets for RSA.
+ *
+ * @return singleton to use for RSA blinding
+ */
+const struct TALER_ExchangeWithdrawValues *
+TALER_denom_ewv_rsa_singleton (void);
+
+
 /**
  * Create private key for a Taler coin.
  * @param ps planchet secret to derive coin priv key
@@ -1946,14 +1946,15 @@ TALER_planchet_blinding_secret_create (
  * @return #GNUNET_OK on success
  */
 enum GNUNET_GenericReturnValue
-TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
-                        const struct TALER_ExchangeWithdrawValues *alg_values,
-                        const union GNUNET_CRYPTO_BlindingSecretP *bks,
-                        const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
-                        const struct TALER_CoinSpendPrivateKeyP *coin_priv,
-                        const struct TALER_AgeCommitmentHash *ach,
-                        struct TALER_CoinPubHashP *c_hash,
-                        struct TALER_PlanchetDetail *pd);
+TALER_planchet_prepare (
+  const struct TALER_DenominationPublicKey *dk,
+  const struct TALER_ExchangeWithdrawValues *alg_values,
+  const union GNUNET_CRYPTO_BlindingSecretP *bks,
+  const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
+  const struct TALER_CoinSpendPrivateKeyP *coin_priv,
+  const struct TALER_AgeCommitmentHash *ach,
+  struct TALER_CoinPubHashP *c_hash,
+  struct TALER_PlanchetDetail *pd);
 
 
 /**
diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index fb0a578a..8f5f4c4d 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1513,6 +1513,7 @@ struct TALER_EXCHANGE_CsRWithdrawResponse
        * respective coin's withdraw operation.
        */
       struct TALER_ExchangeWithdrawValues alg_values;
+
     } ok;
 
     /**
diff --git a/src/lib/exchange_api_batch_withdraw.c 
b/src/lib/exchange_api_batch_withdraw.c
index d17a00f1..cab4734b 100644
--- a/src/lib/exchange_api_batch_withdraw.c
+++ b/src/lib/exchange_api_batch_withdraw.c
@@ -116,7 +116,6 @@ struct TALER_EXCHANGE_BatchWithdrawHandle
    */
   const struct TALER_EXCHANGE_Keys *keys;
 
-
   /**
    * Handle for the actual (internal) batch withdraw operation.
    */
@@ -305,7 +304,9 @@ withdraw_cs_stage_two_callback (
   switch (csrr->hr.http_status)
   {
   case MHD_HTTP_OK:
-    cd->alg_values = csrr->details.ok.alg_values;
+    cd->alg_values.blinding_inputs
+      = GNUNET_CRYPTO_blinding_input_values_incref (
+          csrr->details.ok.alg_values.blinding_inputs);
     TALER_planchet_setup_coin_priv (&cd->ps,
                                     &cd->alg_values,
                                     &cd->priv);
@@ -376,15 +377,18 @@ TALER_EXCHANGE_batch_withdraw (
     {
     case GNUNET_CRYPTO_BSA_RSA:
       {
+        const struct TALER_ExchangeWithdrawValues *alg_values
+          = TALER_denom_ewv_rsa_singleton ();
+
         TALER_planchet_setup_coin_priv (&cd->ps,
-                                        &cd->alg_values,
+                                        alg_values,
                                         &cd->priv);
         TALER_planchet_blinding_secret_create (&cd->ps,
-                                               &cd->alg_values,
+                                               alg_values,
                                                &cd->bks);
         if (GNUNET_OK !=
             TALER_planchet_prepare (&cd->pk.key,
-                                    NULL,
+                                    alg_values,
                                     &cd->bks,
                                     NULL,
                                     &cd->priv,
@@ -444,6 +448,12 @@ TALER_EXCHANGE_batch_withdraw_cancel (
       TALER_EXCHANGE_csr_withdraw_cancel (cd->csrh);
       cd->csrh = NULL;
     }
+    if (NULL != cd->alg_values.blinding_inputs)
+    {
+      GNUNET_CRYPTO_blinding_input_values_decref (
+        cd->alg_values.blinding_inputs);
+      cd->alg_values.blinding_inputs = NULL;
+    }
     TALER_blinded_planchet_free (&cd->pd.blinded_planchet);
     TALER_denom_pub_free (&cd->pk.key);
   }
diff --git a/src/lib/exchange_api_refresh_common.c 
b/src/lib/exchange_api_refresh_common.c
index 57011a6b..2e92807b 100644
--- a/src/lib/exchange_api_refresh_common.c
+++ b/src/lib/exchange_api_refresh_common.c
@@ -99,6 +99,9 @@ TALER_EXCHANGE_get_melt_data_ (
   {
     struct FreshCoinData *fcd = &md->fcds[j];
 
+    TALER_denom_pub_deep_copy (&fcd->fresh_pk,
+                               &rd->fresh_pks[j].key);
+    GNUNET_assert (NULL != fcd->fresh_pk.bsign_pub_key);
     switch (fcd->fresh_pk.bsign_pub_key->cipher)
     {
     case GNUNET_CRYPTO_BSA_INVALID:
@@ -121,8 +124,6 @@ TALER_EXCHANGE_get_melt_data_ (
                                      &nonces[j].cs_nonce);
       break;
     }
-    TALER_denom_pub_deep_copy (&fcd->fresh_pk,
-                               &rd->fresh_pks[j].key);
     if ( (0 >
           TALER_amount_add (&total,
                             &total,
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index 06c72267..d9a3d8fd 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -623,13 +623,13 @@ extract_denom_sig (void *cls,
     if (sizeof (ubs->details.cs_signature) != len)
     {
       GNUNET_break (0);
+      GNUNET_free (ubs);
       return GNUNET_SYSERR;
     }
     GNUNET_memcpy (&ubs->details.cs_signature,
                    res,
                    len);
     sig->unblinded_sig = ubs;
-    GNUNET_free (ubs);
     return GNUNET_OK;
   }
   GNUNET_break (0);

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