gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 34/37: include denom_pub into coin_ev_hash


From: gnunet
Subject: [taler-exchange] 34/37: include denom_pub into coin_ev_hash
Date: Fri, 04 Feb 2022 16:54:04 +0100

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

gian-demarmels pushed a commit to branch master
in repository exchange.

commit 22130128663a00760b83789437985711028d169e
Author: Gian Demarmels <gian@demarmels.org>
AuthorDate: Mon Jan 17 15:10:47 2022 +0100

    include denom_pub into coin_ev_hash
---
 src/exchange/taler-exchange-httpd_recoup.c   |  1 +
 src/exchange/taler-exchange-httpd_withdraw.c |  1 +
 src/exchangedb/test_exchangedb.c             |  1 +
 src/include/taler_crypto_lib.h               |  2 ++
 src/lib/exchange_api_withdraw2.c             |  1 +
 src/util/crypto.c                            | 31 +++++++++++++++++++++++-----
 src/util/denom.c                             | 22 --------------------
 7 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_recoup.c 
b/src/exchange/taler-exchange-httpd_recoup.c
index cb77ba3f..388277c4 100644
--- a/src/exchange/taler-exchange-httpd_recoup.c
+++ b/src/exchange/taler-exchange-httpd_recoup.c
@@ -266,6 +266,7 @@ verify_and_execute_recoup (
         NULL);
     }
     if (GNUNET_OK != TALER_coin_ev_hash (&blinded_planchet,
+                                         &dk->denom_pub,
                                          &pc.h_blind))
     {
       GNUNET_break (0);
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c 
b/src/exchange/taler-exchange-httpd_withdraw.c
index a82a6daa..c07250e3 100644
--- a/src/exchange/taler-exchange-httpd_withdraw.c
+++ b/src/exchange/taler-exchange-httpd_withdraw.c
@@ -503,6 +503,7 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
   wc.wsrd.h_denomination_pub
     = wc.collectable.denom_pub_hash;
   if (GNUNET_OK != TALER_coin_ev_hash (&wc.blinded_planchet,
+                                       &dk->denom_pub,
                                        &wc.wsrd.h_coin_envelope))
   {
     GNUNET_break (0);
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 97acab2a..9dfae795 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -1732,6 +1732,7 @@ run (void *cls)
                                       &c_hash,
                                       &pd.blinded_planchet));
     GNUNET_assert (GNUNET_OK == TALER_coin_ev_hash (&pd.blinded_planchet,
+                                                    &dkp->pub,
                                                     &cbc.h_coin_envelope));
     GNUNET_assert (GNUNET_OK ==
                    TALER_denom_sign_blinded (&cbc.sig,
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 9870572b..5475a802 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -1258,11 +1258,13 @@ TALER_test_coin_valid (const struct 
TALER_CoinPublicInfo *coin_public_info,
  * Compute the hash of a blinded coin.
  *
  * @param blinded_planchet blinded planchet
+ * @param denom_pub denomination publick key
  * @param[out] bch where to write the hash
  * @return #GNUNET_OK when successful, #GNUNET_SYSERR if an internal error 
occured
  */
 enum GNUNET_GenericReturnValue
 TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet,
+                    const struct TALER_DenominationPublicKey *denom_pub,
                     struct TALER_BlindedCoinHash *bch);
 
 
diff --git a/src/lib/exchange_api_withdraw2.c b/src/lib/exchange_api_withdraw2.c
index 6db0815c..5341055b 100644
--- a/src/lib/exchange_api_withdraw2.c
+++ b/src/lib/exchange_api_withdraw2.c
@@ -438,6 +438,7 @@ TALER_EXCHANGE_withdraw2 (
     TALER_amount_hton (&req.amount_with_fee,
                        &wh->requested_amount);
     if (GNUNET_OK != TALER_coin_ev_hash (&pd->blinded_planchet,
+                                         &dk->key,
                                          &req.h_coin_envelope))
     {
       GNUNET_break (0);
diff --git a/src/util/crypto.c b/src/util/crypto.c
index fd309c93..bed70f3d 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -502,22 +502,43 @@ TALER_refresh_get_commitment (struct 
TALER_RefreshCommitmentP *rc,
 
 enum GNUNET_GenericReturnValue
 TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet,
+                    const struct TALER_DenominationPublicKey *denom_pub,
                     struct TALER_BlindedCoinHash *bch)
 {
   switch (blinded_planchet->cipher)
   {
   case TALER_DENOMINATION_RSA:
+    // FIXME: Include denom_pub into hash
     GNUNET_CRYPTO_hash (
       blinded_planchet->details.rsa_blinded_planchet.blinded_msg,
       blinded_planchet->details.rsa_blinded_planchet.blinded_msg_size,
       &bch->hash);
     return GNUNET_OK;
   case TALER_DENOMINATION_CS:
-    GNUNET_CRYPTO_hash (
-      &blinded_planchet->details.cs_blinded_planchet.nonce,
-      sizeof (blinded_planchet->details.cs_blinded_planchet.nonce),
-      &bch->hash);
-    return GNUNET_OK;
+    {
+      char delim = ':';
+      size_t buf_len = sizeof(denom_pub->details.cs_public_key)
+                       + sizeof (blinded_planchet->details.cs_blinded_planchet.
+                                 nonce)
+                       + sizeof(delim);
+      void*buf = GNUNET_malloc (buf_len);
+      memcpy (buf,
+              &denom_pub->details.cs_public_key,
+              sizeof(denom_pub->details.cs_public_key));
+      memcpy (buf + sizeof(denom_pub->details.cs_public_key),
+              &delim,
+              sizeof(delim));
+      memcpy (buf + sizeof(denom_pub->details.cs_public_key) + sizeof(delim),
+              &blinded_planchet->details.cs_blinded_planchet.nonce,
+              sizeof (blinded_planchet->details.cs_blinded_planchet.nonce));
+      GNUNET_CRYPTO_hash (
+        buf,
+        buf_len,
+        &bch->hash);
+      GNUNET_free (buf);
+      return GNUNET_OK;
+    }
+
   default:
     GNUNET_break (0);
     return GNUNET_SYSERR;
diff --git a/src/util/denom.c b/src/util/denom.c
index fa890978..88bdd611 100644
--- a/src/util/denom.c
+++ b/src/util/denom.c
@@ -198,33 +198,11 @@ TALER_denom_sig_unblind (
   case TALER_DENOMINATION_CS:
     {
       struct GNUNET_CRYPTO_CsBlindingSecret bs[2];
-      // struct TALER_DenominationCsPublicR r_pub_blind;
-      // struct GNUNET_CRYPTO_CsC c[2];
-      // struct TALER_CoinPubHash c_hash;
-
-      // TALER_coin_pub_hash (coin_pub,
-      //                      age_commitment_hash,
-      //                      c_hash);
-
       GNUNET_CRYPTO_cs_blinding_secrets_derive (&bks->nonce, bs);
 
-      // GNUNET_CRYPTO_cs_calc_blinded_c (bs,
-      //                                  &alg_values->r_pub,
-      //                                  &denom_pub->details.cs_public_key,
-      //                                  &c_hash->hash,
-      //                                  sizeof(struct GNUNET_HashCode),
-      //                                  c,
-      //                                  r_pub_blind->r_pub);
-
       GNUNET_CRYPTO_cs_unblind 
(&bdenom_sig->details.blinded_cs_answer.s_scalar,
                                 &bs[bdenom_sig->details.blinded_cs_answer.b],
                                 &denom_sig->details.cs_signature.s_scalar);
-
-      // GNUNET_memcpy (&denom_sig->details.cs_signature.r_point,
-      //                
&r_pub_blind.r_pub[bdenom_sig->details.blinded_cs_answer.b
-      //                ],
-      //                sizeof(struct GNUNET_CRYPTO_CsRPublic));
-
       denom_sig->cipher = TALER_DENOMINATION_CS;
       return GNUNET_OK;
     }

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