gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: add h_denom_pub to deposit signa


From: gnunet
Subject: [taler-exchange] branch master updated: add h_denom_pub to deposit signatures
Date: Wed, 08 Jul 2020 15:47:31 +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 97dfbec0 add h_denom_pub to deposit signatures
97dfbec0 is described below

commit 97dfbec0811b1a0b92618f195e228c43376e4828
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jul 8 15:46:51 2020 +0200

    add h_denom_pub to deposit signatures
---
 src/exchange/taler-exchange-httpd_deposit.c   |  1 +
 src/exchange/taler-exchange-httpd_responses.c | 21 +++++++++++++++-----
 src/exchangedb/plugin_exchangedb_postgres.c   | 28 +++++++++++++++++++--------
 src/include/taler_exchange_service.h          |  2 ++
 src/include/taler_exchangedb_plugin.h         | 15 ++++++++++++++
 src/include/taler_signatures.h                | 11 +++++++++++
 src/lib/exchange_api_common.c                 |  2 ++
 src/lib/exchange_api_deposit.c                |  4 ++++
 src/testing/testing_api_cmd_deposit.c         |  1 +
 9 files changed, 72 insertions(+), 13 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_deposit.c 
b/src/exchange/taler-exchange-httpd_deposit.c
index 95143758..c2610b4b 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -520,6 +520,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
       .purpose.size = htonl (sizeof (dr)),
       .h_contract_terms = deposit.h_contract_terms,
       .h_wire = deposit.h_wire,
+      .h_denom_pub = deposit.coin.denom_pub_hash,
       .wallet_timestamp = GNUNET_TIME_absolute_hton (deposit.timestamp),
       .refund_deadline = GNUNET_TIME_absolute_hton (deposit.refund_deadline),
       .merchant = deposit.merchant_pub,
diff --git a/src/exchange/taler-exchange-httpd_responses.c 
b/src/exchange/taler-exchange-httpd_responses.c
index f6595161..ee65cd6e 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -66,6 +66,7 @@ TEH_RESPONSE_compile_transaction_history (
           .purpose.size = htonl (sizeof (dr)),
           .h_contract_terms = deposit->h_contract_terms,
           .h_wire = deposit->h_wire,
+          .h_denom_pub = deposit->h_denom_pub,
           .wallet_timestamp = GNUNET_TIME_absolute_hton (deposit->timestamp),
           .refund_deadline = GNUNET_TIME_absolute_hton (
             deposit->refund_deadline),
@@ -94,7 +95,7 @@ TEH_RESPONSE_compile_transaction_history (
             json_array_append_new (
               history,
               json_pack (
-                "{s:s, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
+                "{s:s, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
                 "type",
                 "DEPOSIT",
                 "amount",
@@ -111,6 +112,8 @@ TEH_RESPONSE_compile_transaction_history (
                 GNUNET_JSON_from_data_auto (&deposit->h_contract_terms),
                 "h_wire",
                 GNUNET_JSON_from_data_auto (&deposit->h_wire),
+                "h_denom_pub",
+                GNUNET_JSON_from_data_auto (&deposit->h_denom_pub),
                 "coin_sig",
                 GNUNET_JSON_from_data_auto (&deposit->csig))))
         {
@@ -151,7 +154,7 @@ TEH_RESPONSE_compile_transaction_history (
         if (0 !=
             json_array_append_new (
               history,
-              json_pack ("{s:s, s:o, s:o, s:o, s:o}",
+              json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
                          "type",
                          "MELT",
                          "amount",
@@ -160,6 +163,8 @@ TEH_RESPONSE_compile_transaction_history (
                          TALER_JSON_from_amount (&melt->melt_fee),
                          "rc",
                          GNUNET_JSON_from_data_auto (&melt->rc),
+                         "h_denom_pub",
+                         GNUNET_JSON_from_data_auto (&melt->h_denom_pub),
                          "coin_sig",
                          GNUNET_JSON_from_data_auto (&melt->coin_sig))))
         {
@@ -267,7 +272,7 @@ TEH_RESPONSE_compile_transaction_history (
         if (0 !=
             json_array_append_new (
               history,
-              json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
+              json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
                          "type",
                          "OLD-COIN-RECOUP",
                          "amount",
@@ -278,6 +283,8 @@ TEH_RESPONSE_compile_transaction_history (
                          GNUNET_JSON_from_data_auto (&epub),
                          "coin_pub",
                          GNUNET_JSON_from_data_auto (&pr->coin.coin_pub),
+                         "h_denom_pub",
+                         GNUNET_JSON_from_data_auto (&pr->coin.denom_pub_hash),
                          "timestamp",
                          GNUNET_JSON_from_time_abs (pr->timestamp))))
         {
@@ -315,7 +322,7 @@ TEH_RESPONSE_compile_transaction_history (
         if (0 !=
             json_array_append_new (
               history,
-              json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
+              json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
                          "type",
                          "RECOUP",
                          "amount",
@@ -326,6 +333,8 @@ TEH_RESPONSE_compile_transaction_history (
                          GNUNET_JSON_from_data_auto (&epub),
                          "reserve_pub",
                          GNUNET_JSON_from_data_auto (&recoup->reserve_pub),
+                         "h_denom_pub",
+                         GNUNET_JSON_from_data_auto (&recoup->h_denom_pub),
                          "timestamp",
                          GNUNET_JSON_from_time_abs (recoup->timestamp))))
         {
@@ -369,7 +378,7 @@ TEH_RESPONSE_compile_transaction_history (
         if (0 !=
             json_array_append_new (
               history,
-              json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
+              json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
                          "type",
                          "RECOUP-REFRESH",
                          "amount",
@@ -380,6 +389,8 @@ TEH_RESPONSE_compile_transaction_history (
                          GNUNET_JSON_from_data_auto (&epub),
                          "old_coin_pub",
                          GNUNET_JSON_from_data_auto (&pr->old_coin_pub),
+                         "h_denom_pub",
+                         GNUNET_JSON_from_data_auto (&pr->coin.denom_pub_hash),
                          "timestamp",
                          GNUNET_JSON_from_time_abs (pr->timestamp))))
         {
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 98b3c170..0f96f0e8 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -662,13 +662,15 @@ postgres_get_session (void *cls)
                               ",old_coin_sig"
                               ",amount_with_fee_val"
                               ",amount_with_fee_frac"
+                              ",kc.denom_pub_hash"
                               ",denom.fee_refresh_val "
                               ",denom.fee_refresh_frac "
                               ",melt_serial_id"
                               " FROM refresh_commitments"
-                              "    JOIN known_coins "
-                              "      ON (refresh_commitments.old_coin_pub = 
known_coins.coin_pub)"
-                              "    JOIN denominations denom USING 
(denom_pub_hash)"
+                              " JOIN known_coins kc"
+                              "   ON (refresh_commitments.old_coin_pub = 
kc.coin_pub)"
+                              " JOIN denominations denom"
+                              "   USING (denom_pub_hash)"
                               " WHERE old_coin_pub=$1;",
                               1),
 
@@ -953,6 +955,7 @@ postgres_get_session (void *cls)
                               ",amount_with_fee_frac"
                               ",denom.fee_deposit_val"
                               ",denom.fee_deposit_frac"
+                              ",kc.denom_pub_hash"
                               ",wallet_timestamp"
                               ",refund_deadline"
                               ",wire_deadline"
@@ -963,7 +966,7 @@ postgres_get_session (void *cls)
                               ",coin_sig"
                               ",deposit_serial_id"
                               " FROM deposits"
-                              "    JOIN known_coins"
+                              "    JOIN known_coins kc"
                               "      USING (coin_pub)"
                               "    JOIN denominations denom"
                               "      USING (denom_pub_hash)"
@@ -1296,8 +1299,8 @@ postgres_get_session (void *cls)
                               ",coins.denom_sig"
                               ",recoup_refresh_uuid"
                               " FROM recoup_refresh"
-                              "    JOIN known_coins coins"
-                              "      USING (coin_pub)"
+                              " JOIN known_coins coins"
+                              "   USING (coin_pub)"
                               " WHERE h_blind_ev IN"
                               "   (SELECT rrc.h_coin_ev"
                               "    FROM refresh_commitments"
@@ -1340,6 +1343,7 @@ postgres_get_session (void *cls)
       GNUNET_PQ_make_prepare ("recoup_by_coin",
                               "SELECT"
                               " ro.reserve_pub"
+                              ",coins.denom_pub_hash"
                               ",coin_sig"
                               ",coin_blind"
                               ",amount_val"
@@ -1347,8 +1351,10 @@ postgres_get_session (void *cls)
                               ",timestamp"
                               ",recoup_uuid"
                               " FROM recoup"
-                              "    JOIN reserves_out ro"
-                              "      USING (h_blind_ev)"
+                              " JOIN reserves_out ro"
+                              "   USING (h_blind_ev)"
+                              " JOIN known_coins coins"
+                              "   USING (coin_pub)"
                               " WHERE recoup.coin_pub=$1"
                               " FOR UPDATE;",
                               1),
@@ -4079,6 +4085,8 @@ add_coin_deposit (void *cls,
                                             &deposit->refund_deadline),
         TALER_PQ_result_spec_absolute_time ("wire_deadline",
                                             &deposit->wire_deadline),
+        GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+                                              &deposit->h_denom_pub),
         GNUNET_PQ_result_spec_auto_from_type ("merchant_pub",
                                               &deposit->merchant_pub),
         GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
@@ -4144,6 +4152,8 @@ add_coin_melt (void *cls,
         GNUNET_PQ_result_spec_auto_from_type ("rc",
                                               &melt->rc),
         /* oldcoin_index not needed */
+        GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+                                              &melt->h_denom_pub),
         GNUNET_PQ_result_spec_auto_from_type ("old_coin_sig",
                                               &melt->coin_sig),
         TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
@@ -4335,6 +4345,8 @@ add_coin_recoup (void *cls,
                                               &recoup->reserve_pub),
         GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
                                               &recoup->coin_sig),
+        GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+                                              &recoup->h_denom_pub),
         GNUNET_PQ_result_spec_auto_from_type ("coin_blind",
                                               &recoup->coin_blind),
         TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index 02ab182f..b12edb05 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -751,6 +751,7 @@ TALER_EXCHANGE_wire_cancel (struct 
TALER_EXCHANGE_WireHandle *wh);
  * @param deposit_fee the deposit fee we expect to pay
  * @param h_wire hash of the merchant’s account details
  * @param h_contract_terms hash of the contact of the merchant with the 
customer (further details are never disclosed to the exchange)
+ * @param h_denom_pub hash of the coin denomination's public key
  * @param coin_priv coin’s private key
  * @param wallet_timestamp timestamp when the contract was finalized, must not 
be too far in the future
  * @param merchant_pub the public key of the merchant (used to identify the 
merchant for refund requests)
@@ -763,6 +764,7 @@ TALER_EXCHANGE_deposit_permission_sign (
   const struct TALER_Amount *deposit_fee,
   const struct GNUNET_HashCode *h_wire,
   const struct GNUNET_HashCode *h_contract_terms,
+  const struct GNUNET_HashCode *h_denom_pub,
   const struct TALER_CoinSpendPrivateKeyP *coin_priv,
   struct GNUNET_TIME_Absolute wallet_timestamp,
   const struct TALER_MerchantPublicKeyP *merchant_pub,
diff --git a/src/include/taler_exchangedb_plugin.h 
b/src/include/taler_exchangedb_plugin.h
index d069bd2e..a12aaa42 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -335,6 +335,11 @@ struct TALER_EXCHANGEDB_RecoupListEntry
    */
   struct TALER_CoinSpendSignatureP coin_sig;
 
+  /**
+   * Hash of the public denomination key used to sign the coin.
+   */
+  struct GNUNET_HashCode h_denom_pub;
+
   /**
    * Public key of the reserve the coin was paid back into.
    */
@@ -608,6 +613,11 @@ struct TALER_EXCHANGEDB_DepositListEntry
    */
   struct GNUNET_HashCode h_wire;
 
+  /**
+   * Hash of the public denomination key used to sign the coin.
+   */
+  struct GNUNET_HashCode h_denom_pub;
+
   /**
    * Detailed information about the receiver for executing the transaction.
    * Includes URL in payto://-format and salt.
@@ -781,6 +791,11 @@ struct TALER_EXCHANGEDB_MeltListEntry
    */
   struct TALER_RefreshCommitmentP rc;
 
+  /**
+   * Hash of the public denomination key used to sign the coin.
+   */
+  struct GNUNET_HashCode h_denom_pub;
+
   /**
    * How much value is being melted?  This amount includes the fees,
    * so the final amount contributed to the melt is this value minus
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 7f9e090a..81e2e1c8 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -350,6 +350,11 @@ struct TALER_DepositRequestPS
    */
   struct GNUNET_HashCode h_wire GNUNET_PACKED;
 
+  /**
+   * Hash over the denomination public key used to sign the coin.
+   */
+  struct GNUNET_HashCode h_denom_pub GNUNET_PACKED;
+
   /**
    * Time when this request was generated.  Used, for example, to
    * assess when (roughly) the income was achieved for tax purposes.
@@ -579,6 +584,12 @@ struct TALER_RefreshMeltCoinAffirmationPS
    */
   struct TALER_RefreshCommitmentP rc GNUNET_PACKED;
 
+  /**
+   * Hash over the denomination public key used to sign the coin.
+   * FIXME: add here, initialize everywhere!
+   */
+  // struct GNUNET_HashCode h_denom_pub GNUNET_PACKED;
+
   /**
    * How much of the value of the coin should be melted?  This amount
    * includes the fees, so the final amount contributed to the melt is
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 52c0e20a..27dbbb86 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -523,6 +523,8 @@ TALER_EXCHANGE_verify_coin_history (
                                      &dr.h_contract_terms),
         GNUNET_JSON_spec_fixed_auto ("h_wire",
                                      &dr.h_wire),
+        GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
+                                     &dr.h_denom_pub),
         TALER_JSON_spec_absolute_time_nbo ("timestamp",
                                            &dr.wallet_timestamp),
         TALER_JSON_spec_absolute_time_nbo ("refund_deadline",
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index bb56ce1c..ba3ba48e 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -432,6 +432,7 @@ verify_signatures (const struct 
TALER_EXCHANGE_DenomPublicKey *dki,
       .purpose.size = htonl (sizeof (dr)),
       .h_contract_terms = *h_contract_terms,
       .h_wire = *h_wire,
+      .h_denom_pub = *denom_pub_hash,
       .wallet_timestamp = GNUNET_TIME_absolute_hton (timestamp),
       .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
       .merchant = *merchant_pub,
@@ -497,6 +498,7 @@ verify_signatures (const struct 
TALER_EXCHANGE_DenomPublicKey *dki,
  * @param deposit_fee the deposit fee we expect to pay
  * @param h_wire hash of the merchant’s account details
  * @param h_contract_terms hash of the contact of the merchant with the 
customer (further details are never disclosed to the exchange)
+ * @param h_denom_pub hash of the coin denomination's public key
  * @param coin_priv coin’s private key
  * @param wallet_timestamp timestamp when the contract was finalized, must not 
be too far in the future
  * @param merchant_pub the public key of the merchant (used to identify the 
merchant for refund requests)
@@ -509,6 +511,7 @@ TALER_EXCHANGE_deposit_permission_sign (
   const struct TALER_Amount *deposit_fee,
   const struct GNUNET_HashCode *h_wire,
   const struct GNUNET_HashCode *h_contract_terms,
+  const struct GNUNET_HashCode *h_denom_pub,
   const struct TALER_CoinSpendPrivateKeyP *coin_priv,
   struct GNUNET_TIME_Absolute wallet_timestamp,
   const struct TALER_MerchantPublicKeyP *merchant_pub,
@@ -522,6 +525,7 @@ TALER_EXCHANGE_deposit_permission_sign (
                          (TALER_SIGNATURE_WALLET_COIN_DEPOSIT),
     .h_contract_terms = *h_contract_terms,
     .h_wire = *h_wire,
+    .h_denom_pub = *h_denom_pub,
     .wallet_timestamp = GNUNET_TIME_absolute_hton (wallet_timestamp),
     .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
     .merchant = *merchant_pub
diff --git a/src/testing/testing_api_cmd_deposit.c 
b/src/testing/testing_api_cmd_deposit.c
index e7a4c298..613f981b 100644
--- a/src/testing/testing_api_cmd_deposit.c
+++ b/src/testing/testing_api_cmd_deposit.c
@@ -409,6 +409,7 @@ deposit_run (void *cls,
                                             &denom_pub->fee_deposit,
                                             &h_wire,
                                             &h_contract_terms,
+                                            &denom_pub->h_key,
                                             coin_priv,
                                             ds->wallet_timestamp,
                                             &merchant_pub,

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