gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 120/130: [age restriction] progress 3/n


From: gnunet
Subject: [taler-exchange] 120/130: [age restriction] progress 3/n
Date: Wed, 17 Nov 2021 12:26:08 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

commit 591cefd3159a2982703a81b637fd7887ecef9a7a
Author: Özgür Kesim <oec-taler@kesim.org>
AuthorDate: Tue Nov 16 14:43:54 2021 +0100

    [age restriction] progress 3/n
    
    - remove redundant struct members for age commitment hash
    - undo pre-mature implementation in taler-exchange-secmod-rsa.c
    - carry through age restriction parameter for TALER_denom_blind
---
 src/benchmark/taler-aggregator-benchmark.c   |  1 +
 src/exchange/taler-exchange-httpd_recoup.c   |  1 +
 src/exchangedb/test_exchangedb.c             |  2 ++
 src/include/taler_crypto_lib.h               |  6 +++++-
 src/lib/exchange_api_deposit.c               |  2 +-
 src/lib/exchange_api_refreshes_reveal.c      |  4 ++--
 src/testing/testing_api_cmd_insert_deposit.c |  1 +
 src/util/crypto.c                            |  6 ++++--
 src/util/denom.c                             |  2 ++
 src/util/taler-exchange-secmod-rsa.c         | 26 +-------------------------
 10 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/src/benchmark/taler-aggregator-benchmark.c 
b/src/benchmark/taler-aggregator-benchmark.c
index c49f8473..16a0ad5b 100644
--- a/src/benchmark/taler-aggregator-benchmark.c
+++ b/src/benchmark/taler-aggregator-benchmark.c
@@ -516,6 +516,7 @@ run (void *cls,
     GNUNET_assert (GNUNET_OK ==
                    TALER_denom_blind (&denom_pub,
                                       &bks,
+                                      NULL, /* FIXME-oec */
                                       &coin_pub,
                                       &c_hash,
                                       &pd.coin_ev,
diff --git a/src/exchange/taler-exchange-httpd_recoup.c 
b/src/exchange/taler-exchange-httpd_recoup.c
index be4471c0..b5074ce3 100644
--- a/src/exchange/taler-exchange-httpd_recoup.c
+++ b/src/exchange/taler-exchange-httpd_recoup.c
@@ -448,6 +448,7 @@ verify_and_execute_recoup (
     if (GNUNET_OK !=
         TALER_denom_blind (&dk->denom_pub,
                            coin_bks,
+                           NULL, /* FIXME-Oec: TALER_AgeHash * */
                            &coin->coin_pub,
                            &c_hash,
                            &coin_ev,
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index fb32aa0b..3c3f9fd0 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -534,6 +534,7 @@ test_melting (void)
     GNUNET_assert (GNUNET_OK ==
                    TALER_denom_blind (&dkp->pub,
                                       &bks,
+                                      NULL, /* FIXME-Oec */
                                       &refresh_session.coin.coin_pub,
                                       &c_hash,
                                       &pd.coin_ev,
@@ -1608,6 +1609,7 @@ run (void *cls)
     GNUNET_assert (GNUNET_OK ==
                    TALER_denom_blind (&dkp->pub,
                                       &bks,
+                                      NULL, /* FIXME-Oec */
                                       &coin_pub,
                                       &c_hash,
                                       &pd.coin_ev,
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 3da178ca..0a40282e 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -752,6 +752,7 @@ TALER_denom_sig_free (struct TALER_DenominationSignature 
*denom_sig);
  *
  * @param dk denomination public key to blind for
  * @param coin_bks blinding secret to use
+ * @param age_commitment_hash hash of the age commitment to be used for the 
coin. NULL if no commitment is made.
  * @param coin_pub public key of the coin to blind
  * @param[out] c_hash resulting hashed coin
  * @param[out] coin_ev blinded coin to submit
@@ -761,6 +762,7 @@ TALER_denom_sig_free (struct TALER_DenominationSignature 
*denom_sig);
 enum GNUNET_GenericReturnValue
 TALER_denom_blind (const struct TALER_DenominationPublicKey *dk,
                    const union TALER_DenominationBlindingKeyP *coin_bks,
+                   const struct TALER_AgeHash *age_commitment_hash,
                    const struct TALER_CoinSpendPublicKeyP *coin_pub,
                    struct TALER_CoinPubHash *c_hash,
                    void **coin_ev,
@@ -899,7 +901,7 @@ TALER_blinded_denom_sig_cmp (
  * Obtain denomination public key from a denomination private key.
  *
  * @param denom_priv private key to convert
- * @param age_mask age mask to use
+ * @param age_mask age mask to be applied
  * @param[out] denom_pub where to return the public key
  */
 void
@@ -955,10 +957,12 @@ TALER_coin_ev_hash (const void *coin_ev,
  * Compute the hash of a coin.
  *
  * @param coin_pub public key of the coin
+ * @param age_commitment_hash hash of the age commitment vector. NULL, if no 
age commitment was set
  * @param[out] coin_h where to write the hash
  */
 void
 TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub,
+                     const struct TALER_AgeHash *age_commitment_hash,
                      struct TALER_CoinPubHash *coin_h);
 
 
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 39397425..408601c6 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -513,7 +513,7 @@ verify_signatures (const struct 
TALER_EXCHANGE_DenomPublicKey *dki,
       .coin_pub = *coin_pub,
       .denom_pub_hash = *denom_pub_hash,
       .denom_sig = *denom_sig,
-      .age_commitment_hash = coin_pub->age_commitment_hash
+      .age_commitment_hash = NULL /* FIXME-Oec */
     };
 
     if (GNUNET_YES !=
diff --git a/src/lib/exchange_api_refreshes_reveal.c 
b/src/lib/exchange_api_refreshes_reveal.c
index fdd7e7ee..2b7fcf8c 100644
--- a/src/lib/exchange_api_refreshes_reveal.c
+++ b/src/lib/exchange_api_refreshes_reveal.c
@@ -166,9 +166,9 @@ refresh_reveal_ok (struct 
TALER_EXCHANGE_RefreshesRevealHandle *rrh,
        hence recomputing it here... */
     GNUNET_CRYPTO_eddsa_key_get_public (&fc->coin_priv.eddsa_priv,
                                         &coin_pub.eddsa_pub);
-    /* FIXME-Oec: Age commitment hash.
-     * must be put into coin_pub.age_mask */
+    /* FIXME-Oec: Age commitment hash. */
     TALER_coin_pub_hash (&coin_pub,
+                         NULL, /* FIXME-Oec */
                          &coin_hash);
     if (GNUNET_OK !=
         TALER_planchet_to_coin (pk,
diff --git a/src/testing/testing_api_cmd_insert_deposit.c 
b/src/testing/testing_api_cmd_insert_deposit.c
index 10d33fde..6b5d9d74 100644
--- a/src/testing/testing_api_cmd_insert_deposit.c
+++ b/src/testing/testing_api_cmd_insert_deposit.c
@@ -210,6 +210,7 @@ insert_deposit_run (void *cls,
     GNUNET_assert (GNUNET_OK ==
                    TALER_denom_blind (&dpk,
                                       &bks,
+                                      NULL, /* FIXME-Oec */
                                       &deposit.coin.coin_pub,
                                       &c_hash,
                                       &pd.coin_ev,
diff --git a/src/util/crypto.c b/src/util/crypto.c
index 2d3a569a..0bd91625 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -188,6 +188,7 @@ TALER_planchet_prepare (const struct 
TALER_DenominationPublicKey *dk,
   if (GNUNET_OK !=
       TALER_denom_blind (dk,
                          &ps->blinding_key,
+                         NULL, /* FIXME-Oec */
                          &coin_pub,
                          c_hash,
                          &pd->coin_ev,
@@ -318,9 +319,10 @@ TALER_coin_ev_hash (const void *coin_ev,
 
 void
 TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub,
+                     const struct TALER_AgeHash *age_commitment_hash,
                      struct TALER_CoinPubHash *coin_h)
 {
-  if (GNUNET_is_zero (&coin_pub->age_commitment_hash))
+  if (NULL == age_commitment_hash)
   {
     /* No age commitment was set */
     GNUNET_CRYPTO_hash (&coin_pub->eddsa_pub,
@@ -340,7 +342,7 @@ TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP 
*coin_pub,
                    key_s);
 
     GNUNET_memcpy (&data[key_s],
-                   &coin_pub->age_commitment_hash,
+                   age_commitment_hash,
                    age_s);
 
     GNUNET_CRYPTO_hash (&data,
diff --git a/src/util/denom.c b/src/util/denom.c
index a5305343..bb135140 100644
--- a/src/util/denom.c
+++ b/src/util/denom.c
@@ -219,6 +219,7 @@ TALER_denom_priv_to_pub (const struct 
TALER_DenominationPrivateKey *denom_priv,
 enum GNUNET_GenericReturnValue
 TALER_denom_blind (const struct TALER_DenominationPublicKey *dk,
                    const union TALER_DenominationBlindingKeyP *coin_bks,
+                   const struct TALER_AgeHash *age_commitment_hash,
                    const struct TALER_CoinSpendPublicKeyP *coin_pub,
                    struct TALER_CoinPubHash *c_hash,
                    void **coin_ev,
@@ -228,6 +229,7 @@ TALER_denom_blind (const struct TALER_DenominationPublicKey 
*dk,
   {
   case TALER_DENOMINATION_RSA:
     TALER_coin_pub_hash (coin_pub,
+                         age_commitment_hash,
                          c_hash);
     if (GNUNET_YES !=
         GNUNET_CRYPTO_rsa_blind (&c_hash->hash,
diff --git a/src/util/taler-exchange-secmod-rsa.c 
b/src/util/taler-exchange-secmod-rsa.c
index 49b241b2..6bca58f8 100644
--- a/src/util/taler-exchange-secmod-rsa.c
+++ b/src/util/taler-exchange-secmod-rsa.c
@@ -39,7 +39,6 @@
 #include <pthread.h>
 #include <sys/eventfd.h>
 #include "taler_error_codes.h"
-#include "taler_extensions.h"
 #include "taler_signatures.h"
 #include "secmod_common.h"
 
@@ -152,14 +151,6 @@ struct Denomination
    * Length of (new) RSA keys (in bits).
    */
   uint32_t rsa_keysize;
-
-  /**
-   * Age Restriction Mask.
-   * If non-zero, it defines the age restriction groups that apply to this
-   * denomination.
-   */
-  struct TALER_AgeMask age_mask;
-
 };
 
 
@@ -1433,7 +1424,7 @@ parse_key (struct Denomination *denom,
     struct DenominationKey *before;
 
     TALER_denom_priv_to_pub (&priv,
-                             denom->age_mask,
+                             (struct TALER_AgeMask) { .mask = 0 }, /* 
FIXME-Oec */
                              &pub);
     dk = GNUNET_new (struct DenominationKey);
     dk->denom_priv = priv;
@@ -1653,21 +1644,6 @@ parse_denomination_cfg (const char *ct,
   }
   denom->rsa_keysize = (unsigned int) rsa_keysize;
   denom->section = GNUNET_strdup (ct);
-
-  /* Load the (optional) age groups/mask for this denomination */
-  denom->age_mask.mask = 0;
-  if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno (kcfg, ct,
-                                                          "age-restricted"))
-  {
-    if (GNUNET_OK != TALER_get_age_mask (kcfg, &denom->age_mask))
-    {
-      GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
-                                 "extenstions",
-                                 "age-restriction",
-                                 "invalid age groups");
-      return GNUNET_SYSERR;
-    }
-  }
   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]