gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: fix various FIXMEs


From: gnunet
Subject: [taler-exchange] branch master updated: fix various FIXMEs
Date: Sun, 24 Sep 2023 11:51:55 +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 7a3b1c6b fix various FIXMEs
7a3b1c6b is described below

commit 7a3b1c6b88a86ccb98a9d60675f8f0c1a7e3fe45
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Sep 24 11:51:47 2023 +0200

    fix various FIXMEs
---
 src/bank-lib/fakebank.h                            |  5 --
 src/bank-lib/fakebank_bank.c                       |  2 +-
 src/bank-lib/fakebank_tbr_get_history.c            | 10 +--
 src/bank-lib/fakebank_twg_history.c                | 20 +-----
 src/benchmark/taler-aggregator-benchmark.c         | 15 ++---
 src/exchange/taler-exchange-httpd_age-withdraw.c   |  6 +-
 .../taler-exchange-httpd_age-withdraw_reveal.c     | 26 +++-----
 src/exchange/taler-exchange-httpd_batch-deposit.c  | 76 ++++++++++------------
 src/exchange/taler-exchange-httpd_coins_get.c      |  1 -
 src/exchange/taler-exchange-httpd_common_kyc.c     | 12 ++--
 .../taler-exchange-httpd_refreshes_reveal.c        |  3 -
 src/exchange/taler-exchange-httpd_responses.c      |  2 +-
 src/include/taler_crypto_lib.h                     |  5 +-
 src/lib/exchange_api_age_withdraw.c                | 11 ++--
 src/testing/testing_api_cmd_batch_withdraw.c       | 31 ++++-----
 src/testing/testing_api_cmd_withdraw.c             | 18 ++---
 src/util/age_restriction.c                         | 59 ++++++-----------
 src/util/exchange_signatures.c                     |  4 --
 18 files changed, 109 insertions(+), 197 deletions(-)

diff --git a/src/bank-lib/fakebank.h b/src/bank-lib/fakebank.h
index a9285ec1..6310231b 100644
--- a/src/bank-lib/fakebank.h
+++ b/src/bank-lib/fakebank.h
@@ -484,11 +484,6 @@ struct HistoryContext
    */
   struct Account *acc;
 
-  /**
-   * Payto URI of the account.
-   */
-  char *payto_uri;
-
   /**
    * JSON object we are building to return.
    */
diff --git a/src/bank-lib/fakebank_bank.c b/src/bank-lib/fakebank_bank.c
index ec7862ac..483a3228 100644
--- a/src/bank-lib/fakebank_bank.c
+++ b/src/bank-lib/fakebank_bank.c
@@ -77,7 +77,7 @@ TALER_FAKEBANK_bank_main_ (
       GNUNET_JSON_pack_string ("currency",
                                h->currency),
       GNUNET_JSON_pack_string ("name",
-                               "libeufin-bank" /* FIXME: spec!? */));
+                               "taler-corebank"));
   }
 
   if ( (0 == strcmp (url,
diff --git a/src/bank-lib/fakebank_tbr_get_history.c 
b/src/bank-lib/fakebank_tbr_get_history.c
index 59efd8ea..8147d943 100644
--- a/src/bank-lib/fakebank_tbr_get_history.c
+++ b/src/bank-lib/fakebank_tbr_get_history.c
@@ -44,7 +44,6 @@ history_cleanup (void *cls)
 {
   struct HistoryContext *hc = cls;
 
-  GNUNET_free (hc->payto_uri);
   json_decref (hc->history);
   GNUNET_free (hc);
 }
@@ -95,13 +94,6 @@ TALER_FAKEBANK_tbr_get_history_incoming (
                                          TALER_EC_BANK_UNKNOWN_ACCOUNT,
                                          account);
     }
-    /* FIXME: was simply: acc->payto_uri -- same!? */
-    GNUNET_asprintf (&hc->payto_uri,
-                     "payto://x-taler-bank/localhost/%s?receiver-name=%s",
-                     account,
-                     hc->acc->receiver_name);
-    GNUNET_assert (0 == strcmp (hc->payto_uri,
-                                hc->acc->payto_uri));
     hc->history = json_array ();
     if (NULL == hc->history)
     {
@@ -297,7 +289,7 @@ finish:
       MHD_HTTP_OK,
       GNUNET_JSON_pack_string (
         "credit_account",
-        hc->payto_uri),
+        hc->acc->payto_uri),
       GNUNET_JSON_pack_array_steal (
         "incoming_transactions",
         h));
diff --git a/src/bank-lib/fakebank_twg_history.c 
b/src/bank-lib/fakebank_twg_history.c
index 06228507..44bae314 100644
--- a/src/bank-lib/fakebank_twg_history.c
+++ b/src/bank-lib/fakebank_twg_history.c
@@ -42,7 +42,6 @@ history_cleanup (void *cls)
 {
   struct HistoryContext *hc = cls;
 
-  GNUNET_free (hc->payto_uri);
   json_decref (hc->history);
   GNUNET_free (hc);
 }
@@ -93,13 +92,6 @@ TALER_FAKEBANK_twg_get_debit_history_ (
                                          TALER_EC_BANK_UNKNOWN_ACCOUNT,
                                          account);
     }
-    GNUNET_asprintf (&hc->payto_uri,
-                     "payto://x-taler-bank/localhost/%s?receiver-name=%s",
-                     account,
-                     hc->acc->receiver_name);
-    /* New invariant: */
-    GNUNET_assert (0 == strcmp (hc->payto_uri,
-                                hc->acc->payto_uri));
     hc->history = json_array ();
     if (NULL == hc->history)
     {
@@ -294,7 +286,7 @@ finish:
       MHD_HTTP_OK,
       GNUNET_JSON_pack_string (
         "debit_account",
-        hc->payto_uri),
+        hc->acc->payto_uri),
       GNUNET_JSON_pack_array_steal (
         "outgoing_transactions",
         h));
@@ -347,14 +339,6 @@ TALER_FAKEBANK_twg_get_credit_history_ (
                                          TALER_EC_BANK_UNKNOWN_ACCOUNT,
                                          account);
     }
-    /* FIXME: was simply: acc->payto_uri -- same!? */
-    GNUNET_asprintf (&hc->payto_uri,
-                     "payto://x-taler-bank/%s/%s?receiver-name=%s",
-                     h->hostname,
-                     account,
-                     hc->acc->receiver_name);
-    GNUNET_assert (0 == strcmp (hc->payto_uri,
-                                hc->acc->payto_uri));
     hc->history = json_array ();
     if (NULL == hc->history)
     {
@@ -529,7 +513,7 @@ finish:
       MHD_HTTP_OK,
       GNUNET_JSON_pack_string (
         "credit_account",
-        hc->payto_uri),
+        hc->acc->payto_uri),
       GNUNET_JSON_pack_array_steal (
         "incoming_transactions",
         h));
diff --git a/src/benchmark/taler-aggregator-benchmark.c 
b/src/benchmark/taler-aggregator-benchmark.c
index b59d3a8c..9b2b1d4f 100644
--- a/src/benchmark/taler-aggregator-benchmark.c
+++ b/src/benchmark/taler-aggregator-benchmark.c
@@ -535,15 +535,12 @@ run (void *cls,
       GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
                                   &seed,
                                   sizeof(seed));
-
-      GNUNET_assert (GNUNET_OK ==
-                     TALER_age_restriction_commit (
-                       &mask,
-                       13,
-                       &seed,
-                       &acp));
-
-      TALER_age_commitment_hash (&acp.commitment, &hac);
+      TALER_age_restriction_commit (&mask,
+                                    13,
+                                    &seed,
+                                    &acp);
+      TALER_age_commitment_hash (&acp.commitment,
+                                 &hac);
     }
 
     GNUNET_assert (GNUNET_OK ==
diff --git a/src/exchange/taler-exchange-httpd_age-withdraw.c 
b/src/exchange/taler-exchange-httpd_age-withdraw.c
index 69235da2..47cff626 100644
--- a/src/exchange/taler-exchange-httpd_age-withdraw.c
+++ b/src/exchange/taler-exchange-httpd_age-withdraw.c
@@ -260,9 +260,9 @@ parse_age_withdraw_json (
                                            sizeof(bch));
         }
 
-        /* Check for duplicate planchets
-         * FIXME: is this needed?
-         */
+        /* Check for duplicate planchets. Technically a bug on
+         * the client side that is harmless for us, but still
+         * not allowed per protocol */
         for (unsigned int i = 0; i < off + kappa; i++)
         {
           if (0 == TALER_blinded_planchet_cmp (&awc->coin_evs[off + kappa],
diff --git a/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c 
b/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
index cc55d3f0..b77b5e37 100644
--- a/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
+++ b/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
@@ -293,29 +293,21 @@ calculate_blinded_hash (
   /* calculate age commitment hash */
   {
     struct TALER_AgeCommitmentProof acp;
-    ret = TALER_age_restriction_from_secret (secret,
-                                             &denom_key->denom_pub.age_mask,
-                                             max_age,
-                                             &acp);
 
-    if (GNUNET_OK != ret)
-    {
-      GNUNET_break (0);
-      *result = TALER_MHD_reply_with_ec (connection,
-                                         
TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, /* FIXME[oec]: better error code */
-                                         "derivation of age restriction 
failed");
-      return ret;
-    }
-
-    TALER_age_commitment_hash (&acp.commitment, &ach);
+    TALER_age_restriction_from_secret (secret,
+                                       &denom_key->denom_pub.age_mask,
+                                       max_age,
+                                       &acp);
+    TALER_age_commitment_hash (&acp.commitment,
+                               &ach);
   }
 
   /* Next: calculate planchet */
   {
-    struct TALER_CoinPubHashP c_hash = {0};
+    struct TALER_CoinPubHashP c_hash;
     struct TALER_PlanchetDetail detail = {0};
-    struct TALER_CoinSpendPrivateKeyP coin_priv = {0};
-    union TALER_DenominationBlindingKeyP bks = {0};
+    struct TALER_CoinSpendPrivateKeyP coin_priv;
+    union TALER_DenominationBlindingKeyP bks;
     struct TALER_ExchangeWithdrawValues alg_values = {
       .cipher = denom_key->denom_pub.cipher,
     };
diff --git a/src/exchange/taler-exchange-httpd_batch-deposit.c 
b/src/exchange/taler-exchange-httpd_batch-deposit.c
index fc321730..a2ea6263 100644
--- a/src/exchange/taler-exchange-httpd_batch-deposit.c
+++ b/src/exchange/taler-exchange-httpd_batch-deposit.c
@@ -533,21 +533,24 @@ TEH_handler_batch_deposit (struct TEH_RequestContext *rc,
                                 &bd->wire_deadline),
     GNUNET_JSON_spec_end ()
   };
-  enum GNUNET_GenericReturnValue res;
 
   (void) args;
-  res = TALER_MHD_parse_json_data (connection,
-                                   root,
-                                   spec);
-  if (GNUNET_SYSERR == res)
-  {
-    GNUNET_break (0);
-    return MHD_NO;   /* hard failure */
-  }
-  if (GNUNET_NO == res)
   {
-    GNUNET_break_op (0);
-    return MHD_YES;   /* failure */
+    enum GNUNET_GenericReturnValue res;
+
+    res = TALER_MHD_parse_json_data (connection,
+                                     root,
+                                     spec);
+    if (GNUNET_SYSERR == res)
+    {
+      GNUNET_break (0);
+      return MHD_NO; /* hard failure */
+    }
+    if (GNUNET_NO == res)
+    {
+      GNUNET_break_op (0);
+      return MHD_YES; /* failure */
+    }
   }
 
   /* validate merchant's wire details (as far as we can) */
@@ -638,39 +641,32 @@ TEH_handler_batch_deposit (struct TEH_RequestContext *rc,
     struct TALER_EXCHANGEDB_CoinDepositInformation cdis[
       GNUNET_NZL (bd->num_cdis)];
     struct TALER_Amount deposit_fees[GNUNET_NZL (bd->num_cdis)];
+    enum GNUNET_GenericReturnValue res;
 
     bd->cdis = cdis;
     dc.deposit_fees = deposit_fees;
     for (unsigned int i = 0; i<bd->num_cdis; i++)
     {
-      do {
-        res = parse_coin (connection,
-                          &dc,
-                          json_array_get (coins,
-                                          i),
-                          &cdis[i],
-                          &deposit_fees[i]);
-        if (GNUNET_OK != res)
-          break;
-
-        /* If applicable, accumulate all contributions into the policy_details 
*/
-        if (NULL != dc.policy_json)
-        {
-          /* FIXME: how do deposit-fee and policy-fee interact? */
-          struct TALER_Amount amount_without_fee;
-
-          // FIXME-Oec: wrong enum type for 'res' here!
-          res = TALER_amount_subtract (&amount_without_fee,
-                                       &cdis[i].amount_with_fee,
-                                       &deposit_fees[i]);
-          // FIXME-Oec: rval of res not checked
-          res = TALER_amount_add (
-            &dc.policy_details.accumulated_total,
-            &dc.policy_details.accumulated_total,
-            &amount_without_fee);
-        }
-      } while(0);
-
+      struct TALER_Amount amount_without_fee;
+
+      res = parse_coin (connection,
+                        &dc,
+                        json_array_get (coins,
+                                        i),
+                        &cdis[i],
+                        &deposit_fees[i]);
+      if (GNUNET_OK != res)
+        break;
+      GNUNET_assert (0 <=
+                     TALER_amount_subtract (
+                       &amount_without_fee,
+                       &cdis[i].amount_with_fee,
+                       &deposit_fees[i]));
+      GNUNET_assert (0 <=
+                     TALER_amount_add (
+                       &dc.policy_details.accumulated_total,
+                       &dc.policy_details.accumulated_total,
+                       &amount_without_fee));
       if (GNUNET_OK != res)
       {
         for (unsigned int j = 0; j<i; j++)
diff --git a/src/exchange/taler-exchange-httpd_coins_get.c 
b/src/exchange/taler-exchange-httpd_coins_get.c
index e7b54337..655a4c54 100644
--- a/src/exchange/taler-exchange-httpd_coins_get.c
+++ b/src/exchange/taler-exchange-httpd_coins_get.c
@@ -115,7 +115,6 @@ compile_transaction_history (
             json_array_append_new (
               history,
               GNUNET_JSON_PACK (
-                // FIXME: offset missing! (here and in all other cases!)
                 GNUNET_JSON_pack_string ("type",
                                          "DEPOSIT"),
                 TALER_JSON_pack_amount ("amount",
diff --git a/src/exchange/taler-exchange-httpd_common_kyc.c 
b/src/exchange/taler-exchange-httpd_common_kyc.c
index 5d4b4c11..2a7193f4 100644
--- a/src/exchange/taler-exchange-httpd_common_kyc.c
+++ b/src/exchange/taler-exchange-httpd_common_kyc.c
@@ -131,8 +131,8 @@ kyc_aml_finished (void *cls,
                                        &kyc_prox);
   birthdate = json_string_value (json_object_get (kat->attributes,
                                                   TALER_ATTRIBUTE_BIRTHDATE));
-
-  if (TEH_age_restriction_enabled)
+  if ( (TEH_age_restriction_enabled) &&
+       (NULL != birthdate) )
   {
     enum GNUNET_GenericReturnValue ret;
 
@@ -142,15 +142,16 @@ kyc_aml_finished (void *cls,
 
     if (GNUNET_OK != ret)
     {
-      GNUNET_break (0);
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Failed to parse birthdate `%s' from KYC attributes\n",
+                  birthdate);
       if (NULL != kat->response)
         MHD_destroy_response (kat->response);
       kat->http_status = MHD_HTTP_BAD_REQUEST;
       kat->response = TALER_MHD_make_error (
         TALER_EC_GENERIC_PARAMETER_MALFORMED,
         TALER_ATTRIBUTE_BIRTHDATE);
-
-      /* FIXME-Christian: shouldn't we return in the error case? */
+      goto RETURN_RESULT;
     }
   }
 
@@ -195,6 +196,7 @@ kyc_aml_finished (void *cls,
                                           "do_insert_kyc_attributes");
     /* Continued below to return the response */
   }
+RETURN_RESULT:
   /* Finally, return result to main handler */
   kat->cb (kat->cb_cls,
            kat->http_status,
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c 
b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index 4fb16407..81a08623 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -111,9 +111,6 @@ struct RevealContext
   /**
    * Array of information about fresh coins being revealed.
    */
-  /* FIXME: const would be nicer here, but we initialize
-     the 'alg_values' in the verification
-     routine; suboptimal to be fixed... */
   struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrcs;
 
   /**
diff --git a/src/exchange/taler-exchange-httpd_responses.c 
b/src/exchange/taler-exchange-httpd_responses.c
index 4c8b385b..2d5d8dce 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -171,7 +171,7 @@ TEH_RESPONSE_reply_coin_insufficient_funds (
     TALER_JSON_pack_ec (ec),
     GNUNET_JSON_pack_data_auto ("coin_pub",
                                 coin_pub),
-    // FIXME: to be kept only for some of the error types!
+    // FIXME - #7267: to be kept only for some of the error types!
     GNUNET_JSON_pack_data_auto ("h_denom_pub",
                                 h_denom_pub));
 }
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index ffb48285..b7666610 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -5889,9 +5889,8 @@ TALER_age_commitment_hash (
  * @param age The actual age for which an age commitment is generated
  * @param seed The seed that goes into the key generation.  MUST be chosen 
uniformly random.
  * @param[out] comm_proof The generated age commitment, ->priv and ->pub 
allocated via GNUNET_malloc() on success
- * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
  */
-enum GNUNET_GenericReturnValue
+void
 TALER_age_restriction_commit (
   const struct TALER_AgeMask *mask,
   uint8_t age,
@@ -6024,7 +6023,7 @@ TALER_age_commitment_base_public_key;
  * @param max_age The maximum age for this coin.
  * @param[out] comm_proof The commitment and proof for age restriction for age 
@a max_age
  */
-enum GNUNET_GenericReturnValue
+void
 TALER_age_restriction_from_secret (
   const struct TALER_PlanchetMasterSecretP *secret,
   const struct TALER_AgeMask *mask,
diff --git a/src/lib/exchange_api_age_withdraw.c 
b/src/lib/exchange_api_age_withdraw.c
index c78d3cc5..4092c5c2 100644
--- a/src/lib/exchange_api_age_withdraw.c
+++ b/src/lib/exchange_api_age_withdraw.c
@@ -903,12 +903,11 @@ prepare_coins (
       can->secret = input->secrets[k];
       /* Derive the age restriction from the given secret and
        * the maximum age */
-      FAIL_IF (GNUNET_OK !=
-               TALER_age_restriction_from_secret (
-                 &can->secret,
-                 &input->denom_pub->key.age_mask,
-                 awh->max_age,
-                 &can->details.age_commitment_proof));
+      TALER_age_restriction_from_secret (
+        &can->secret,
+        &input->denom_pub->key.age_mask,
+        awh->max_age,
+        &can->details.age_commitment_proof);
 
       TALER_age_commitment_hash (&can->details.age_commitment_proof.commitment,
                                  &can->details.h_age_commitment);
diff --git a/src/testing/testing_api_cmd_batch_withdraw.c 
b/src/testing/testing_api_cmd_batch_withdraw.c
index 41c74c3e..f0b9dcad 100644
--- a/src/testing/testing_api_cmd_batch_withdraw.c
+++ b/src/testing/testing_api_cmd_batch_withdraw.c
@@ -460,14 +460,17 @@ TALER_TESTING_cmd_batch_withdraw (const char *label,
   ws->expected_response_code = expected_response_code;
 
   cnt = 1;
-  va_start (ap, amount);
-  while (NULL != (va_arg (ap, const char *)))
+  va_start (ap,
+            amount);
+  while (NULL != (va_arg (ap,
+                          const char *)))
     cnt++;
   ws->num_coins = cnt;
   ws->coins = GNUNET_new_array (cnt,
                                 struct CoinState);
   va_end (ap);
-  va_start (ap, amount);
+  va_start (ap,
+            amount);
   for (unsigned int i = 0; i<ws->num_coins; i++)
   {
     struct CoinState *cs = &ws->coins[i];
@@ -481,21 +484,10 @@ TALER_TESTING_cmd_batch_withdraw (const char *label,
       GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
                                   &seed,
                                   sizeof(seed));
-
-      if (GNUNET_OK !=
-          TALER_age_restriction_commit (
-            &mask,
-            age,
-            &seed,
-            &cs->age_commitment_proof))
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                    "Failed to generate age commitment for age %d at %s\n",
-                    age,
-                    label);
-        GNUNET_assert (0);
-      }
-
+      TALER_age_restriction_commit (&mask,
+                                    age,
+                                    &seed,
+                                    &cs->age_commitment_proof);
       TALER_age_commitment_hash (&cs->age_commitment_proof.commitment,
                                  &cs->h_age_commitment);
     }
@@ -511,7 +503,8 @@ TALER_TESTING_cmd_batch_withdraw (const char *label,
       GNUNET_assert (0);
     }
     /* move on to next vararg! */
-    amount = va_arg (ap, const char *);
+    amount = va_arg (ap,
+                     const char *);
   }
   GNUNET_assert (NULL == amount);
   va_end (ap);
diff --git a/src/testing/testing_api_cmd_withdraw.c 
b/src/testing/testing_api_cmd_withdraw.c
index 8873c240..c45e29ff 100644
--- a/src/testing/testing_api_cmd_withdraw.c
+++ b/src/testing/testing_api_cmd_withdraw.c
@@ -578,20 +578,10 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,
     GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
                                 &seed,
                                 sizeof(seed));
-
-    if (GNUNET_OK !=
-        TALER_age_restriction_commit (
-          &mask,
-          age,
-          &seed,
-          &ws->age_commitment_proof))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Failed to generate age commitment for age %d at %s\n",
-                  age,
-                  label);
-      GNUNET_assert (0);
-    }
+    TALER_age_restriction_commit (&mask,
+                                  age,
+                                  &seed,
+                                  &ws->age_commitment_proof);
     TALER_age_commitment_hash (&ws->age_commitment_proof.commitment,
                                &ws->h_age_commitment);
   }
diff --git a/src/util/age_restriction.c b/src/util/age_restriction.c
index 73c8255f..883ae5e9 100644
--- a/src/util/age_restriction.c
+++ b/src/util/age_restriction.c
@@ -118,43 +118,41 @@ TALER_get_lowest_age (
 
 
 #ifdef AGE_RESTRICTION_WITH_ECDSA
-/* @brief Helper function to generate a ECDSA private key
+/**
+ * @brief Helper function to generate a ECDSA private key
  *
  * @param seed Input seed
  * @param size Size of the seed in bytes
  * @param[out] pkey ECDSA private key
- * @return GNUNET_OK on success
  */
-static enum GNUNET_GenericReturnValue
+static void
 ecdsa_create_from_seed (
   const void *seed,
   size_t seed_size,
   struct GNUNET_CRYPTO_EcdsaPrivateKey *key)
 {
   enum GNUNET_GenericReturnValue ret;
-  ret = GNUNET_CRYPTO_kdf (key,
-                           sizeof (*key),
-                           &seed,
-                           seed_size,
-                           "age commitment",
-                           sizeof ("age commitment") - 1,
-                           NULL, 0);
-  if (GNUNET_OK != ret)
-    return ret;
 
+  GNUNET_assert (
+    GNUNET_OK ==
+    GNUNET_CRYPTO_kdf (key,
+                       sizeof (*key),
+                       &seed,
+                       seed_size,
+                       "age commitment",
+                       sizeof ("age commitment") - 1,
+                       NULL, 0));
   /* See GNUNET_CRYPTO_ecdsa_key_create */
   key->d[0] &= 248;
   key->d[31] &= 127;
   key->d[31] |= 64;
-
-  return GNUNET_OK;
 }
 
 
 #endif
 
 
-enum GNUNET_GenericReturnValue
+void
 TALER_age_restriction_commit (
   const struct TALER_AgeMask *mask,
   uint8_t age,
@@ -212,24 +210,15 @@ TALER_age_restriction_commit (
     GNUNET_CRYPTO_edx25519_key_get_public (&pkey->priv,
                                            &ncp->commitment.keys[i].pub);
 #else
-    if (GNUNET_OK !=
-        ecdsa_create_from_seed (&seed_i,
-                                sizeof(seed_i),
-                                &pkey->priv))
-    {
-      GNUNET_free (ncp->commitment.keys);
-      GNUNET_free (ncp->proof.keys);
-      return GNUNET_SYSERR;
-    }
-
+    ecdsa_create_from_seed (&seed_i,
+                            sizeof(seed_i),
+                            &pkey->priv);
     GNUNET_CRYPTO_ecdsa_key_get_public (&pkey->priv,
                                         &ncp->commitment.keys[i].pub);
 #endif
 
     seed_i.bits[0] += 1;
   }
-
-  return GNUNET_OK;
 }
 
 
@@ -656,7 +645,7 @@ TALER_age_mask_to_string (
 }
 
 
-enum GNUNET_GenericReturnValue
+void
 TALER_age_restriction_from_secret (
   const struct TALER_PlanchetMasterSecretP *secret,
   const struct TALER_AgeMask *mask,
@@ -720,14 +709,9 @@ TALER_age_restriction_from_secret (
       GNUNET_CRYPTO_edx25519_key_get_public (&pkey->priv,
                                              &ncp->commitment.keys[i].pub);
 #else
-      if (GNUNET_OK != ecdsa_create_from_seed (&seed_i,
-                                               sizeof(seed_i),
-                                               &pkey->priv))
-      {
-        GNUNET_free (ncp->commitment.keys);
-        GNUNET_free (ncp->proof.keys);
-        return GNUNET_SYSERR;
-      }
+      ecdsa_create_from_seed (&seed_i,
+                              sizeof(seed_i),
+                              &pkey->priv);
       GNUNET_CRYPTO_ecdsa_key_get_public (&pkey->priv,
                                           &ncp->commitment.keys[i].pub);
 #endif
@@ -752,9 +736,6 @@ TALER_age_restriction_from_secret (
 #endif
     }
   }
-
-  return GNUNET_OK;
-
 }
 
 
diff --git a/src/util/exchange_signatures.c b/src/util/exchange_signatures.c
index cc6427af..3aa464aa 100644
--- a/src/util/exchange_signatures.c
+++ b/src/util/exchange_signatures.c
@@ -467,10 +467,6 @@ struct TALER_ExchangeKeySetPS
 
   /**
    * Hash over the various denomination signing keys returned.
-   * // FIXME: see discussion with Jonathan Krebs, we should hash
-   * over a stable sort of the keys here, plus likely add
-   * a filter (which ciphers are supported, age restrictions, other?)
-   * instead of just list_issue_date.
    */
   struct GNUNET_HashCode hc GNUNET_PACKED;
 };

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