gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 19/130: -work on FTBFS;


From: gnunet
Subject: [taler-exchange] 19/130: -work on FTBFS;
Date: Wed, 17 Nov 2021 12:24:27 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

commit f7d08e8c2bbd6c5eaa73f339f551683c9d93ebeb
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Mon Oct 25 17:19:41 2021 +0200

    -work on FTBFS;
---
 src/include/taler_signatures.h                     |  2 +-
 src/include/taler_util.h                           | 11 ++++++++
 src/lib/exchange_api_common.c                      |  6 ++--
 src/lib/exchange_api_deposit.c                     |  7 +++--
 src/lib/exchange_api_kyc_check.c                   |  4 +--
 src/lib/exchange_api_link.c                        | 32 ++++++++++++----------
 src/lib/exchange_api_management_get_keys.c         | 31 ++++++++-------------
 ...change_api_management_revoke_denomination_key.c |  2 +-
 src/util/payto.c                                   | 10 +++++++
 9 files changed, 61 insertions(+), 44 deletions(-)

diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 34d13380..6293a257 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -1677,7 +1677,7 @@ struct TALER_ReserveCloseConfirmationPS
   /**
    * Hash of the receiver's bank account.
    */
-  struct TALER_PaytoHash h_wire;
+  struct TALER_PaytoHash h_payto;
 
   /**
    * Wire transfer subject.
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index 4faa75c4..d62882b4 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -327,6 +327,17 @@ char *
 TALER_payto_get_method (const char *payto_uri);
 
 
+/**
+ * Compute the hash of a payto URI.
+ *
+ * @param payto URI to hash
+ * @param[out] h_payto where to write the hash
+ */
+void
+TALER_payto_hash (const char *payto,
+                  struct TALER_PaytoHash *h_payto);
+
+
 /**
  * Obtain the account name from a payto URL.
  *
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 143cedda..1cb11f1b 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -340,10 +340,8 @@ TALER_EXCHANGE_parse_reserve_history (
       }
       TALER_amount_hton (&rcc.closing_amount,
                          &amount);
-      GNUNET_CRYPTO_hash (
-        rh->details.close_details.receiver_account_details,
-        strlen (rh->details.close_details.receiver_account_details) + 1,
-        &rcc.h_wire);
+      TALER_payto_hash (rh->details.close_details.receiver_account_details,
+                        &rcc.h_payto);
       rcc.wtid = rh->details.close_details.wtid;
       rcc.purpose.size = htonl (sizeof (rcc));
       rcc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED);
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 461a282c..e8fe5faf 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -502,6 +502,7 @@ TALER_EXCHANGE_deposit_permission_sign (
   const struct TALER_Amount *deposit_fee,
   const struct TALER_MerchantWireHash *h_wire,
   const struct TALER_PrivateContractHash *h_contract_terms,
+  const struct TALER_ExtensionContractHash *h_extensions,
   const struct TALER_DenominationHash *h_denom_pub,
   const struct TALER_CoinSpendPrivateKeyP *coin_priv,
   struct GNUNET_TIME_Absolute wallet_timestamp,
@@ -520,6 +521,7 @@ TALER_EXCHANGE_deposit_permission_sign (
     .merchant = *merchant_pub
   };
 
+  // FIXME: sign also over h_extensions!
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_TIME_round_abs (&wallet_timestamp));
   GNUNET_assert (GNUNET_OK ==
@@ -541,8 +543,9 @@ TALER_EXCHANGE_deposit (
   struct TALER_EXCHANGE_Handle *exchange,
   const struct TALER_Amount *amount,
   struct GNUNET_TIME_Absolute wire_deadline,
-  json_t *wire_details,
+  const json_t *wire_details,
   const struct TALER_PrivateContractHash *h_contract_terms,
+  const json_t *extension_details,
   const struct TALER_CoinSpendPublicKeyP *coin_pub,
   const struct TALER_DenominationSignature *denom_sig,
   const struct TALER_DenominationPublicKey *denom_pub,
@@ -642,7 +645,7 @@ TALER_EXCHANGE_deposit (
     TALER_JSON_pack_amount ("contribution",
                             amount),
     GNUNET_JSON_pack_object_incref ("wire",
-                                    wire_details),
+                                    (json_t *) wire_details),
     GNUNET_JSON_pack_data_auto ("h_wire",
                                 &h_wire),
     GNUNET_JSON_pack_data_auto ("h_contract_terms",
diff --git a/src/lib/exchange_api_kyc_check.c b/src/lib/exchange_api_kyc_check.c
index 82fddd45..f64dfe4e 100644
--- a/src/lib/exchange_api_kyc_check.c
+++ b/src/lib/exchange_api_kyc_check.c
@@ -64,7 +64,7 @@ struct TALER_EXCHANGE_KycCheckHandle
   /**
    * Hash of the payto:// URL that is being KYC'ed.
    */
-  struct GNUNET_HashCode h_payto;
+  struct TALER_PaytoHash h_payto;
 };
 
 
@@ -216,7 +216,7 @@ handle_kyc_check_finished (void *cls,
 struct TALER_EXCHANGE_KycCheckHandle *
 TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange,
                           uint64_t payment_target,
-                          const struct GNUNET_HashCode *h_payto,
+                          const struct TALER_PaytoHash *h_payto,
                           struct GNUNET_TIME_Relative timeout,
                           TALER_EXCHANGE_KycStatusCallback cb,
                           void *cb_cls)
diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c
index ceb31884..e36ffcd9 100644
--- a/src/lib/exchange_api_link.c
+++ b/src/lib/exchange_api_link.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2015-2020 Taler Systems SA
+  Copyright (C) 2015-2021 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
@@ -92,12 +92,15 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
                  struct TALER_DenominationPublicKey *pub)
 {
   struct GNUNET_CRYPTO_RsaSignature *bsig;
-  struct GNUNET_CRYPTO_RsaPublicKey *rpub;
+  struct TALER_DenominationPublicKey rpub;
   struct TALER_CoinSpendSignatureP link_sig;
   struct GNUNET_JSON_Specification spec[] = {
-    GNUNET_JSON_spec_rsa_public_key ("denom_pub", &rpub),
-    GNUNET_JSON_spec_rsa_signature ("ev_sig", &bsig),
-    GNUNET_JSON_spec_fixed_auto ("link_sig", &link_sig),
+    TALER_JSON_spec_denomination_public_key ("denom_pub",
+                                             &rpub),
+    GNUNET_JSON_spec_rsa_signature ("ev_sig",
+                                    &bsig),
+    GNUNET_JSON_spec_fixed_auto ("link_sig",
+                                 &link_sig),
     GNUNET_JSON_spec_end ()
   };
   struct TALER_TransferSecretP secret;
@@ -121,21 +124,21 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle 
*lh,
 
   /* extract coin and signature */
   *coin_priv = fc.coin_priv;
-  sig->rsa_signature
+  sig->cipher = TALER_DENOMINATION_RSA;
+  sig->details.rsa_signature
     = TALER_rsa_unblind (bsig,
                          &fc.blinding_key.bks,
-                         rpub);
+                         rpub.details.rsa_public_key);
   /* verify link_sig */
   {
     struct TALER_PlanchetDetail pd;
-    struct GNUNET_HashCode c_hash;
+    struct TALER_CoinPubHash c_hash;
     struct TALER_CoinSpendPublicKeyP old_coin_pub;
 
     GNUNET_CRYPTO_eddsa_key_get_public (&lh->coin_priv.eddsa_priv,
                                         &old_coin_pub.eddsa_pub);
-    pub->rsa_public_key = rpub;
     if (GNUNET_OK !=
-        TALER_planchet_prepare (pub,
+        TALER_planchet_prepare (&rpub,
                                 &fc,
                                 &c_hash,
                                 &pd))
@@ -161,7 +164,8 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
   }
 
   /* clean up */
-  pub->rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (rpub);
+  TALER_denom_pub_deep_copy (pub,
+                             &rpub);
   GNUNET_JSON_parse_free (spec);
   return GNUNET_OK;
 }
@@ -323,10 +327,8 @@ parse_link_ok (struct TALER_EXCHANGE_LinkHandle *lh,
     GNUNET_assert (off_coin <= num_coins);
     for (i = 0; i<off_coin; i++)
     {
-      if (NULL != sigs[i].rsa_signature)
-        GNUNET_CRYPTO_rsa_signature_free (sigs[i].rsa_signature);
-      if (NULL != pubs[i].rsa_public_key)
-        GNUNET_CRYPTO_rsa_public_key_free (pubs[i].rsa_public_key);
+      TALER_denom_sig_free (&sigs[i]);
+      TALER_denom_pub_free (&pubs[i]);
     }
   }
   return ret;
diff --git a/src/lib/exchange_api_management_get_keys.c 
b/src/lib/exchange_api_management_get_keys.c
index e9cab581..a3e3eccc 100644
--- a/src/lib/exchange_api_management_get_keys.c
+++ b/src/lib/exchange_api_management_get_keys.c
@@ -179,8 +179,8 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle 
*gh,
                                      &denom_key->expire_deposit),
       TALER_JSON_spec_absolute_time ("stamp_expire_legal",
                                      &denom_key->expire_legal),
-      GNUNET_JSON_spec_rsa_public_key ("denom_pub",
-                                       &denom_key->key.rsa_public_key),
+      TALER_JSON_spec_denomination_public_key ("denom_pub",
+                                               &denom_key->key),
       TALER_JSON_spec_amount_any ("fee_withdraw",
                                   &denom_key->fee_withdraw),
       TALER_JSON_spec_amount_any ("fee_deposit",
@@ -212,20 +212,20 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle 
*gh,
     }
 
     {
+      struct TALER_DenominationHash h_denom_pub;
       struct GNUNET_TIME_Relative duration
         = GNUNET_TIME_absolute_get_difference (denom_key->valid_from,
                                                
denom_key->withdraw_valid_until);
-      struct GNUNET_HashCode h_denom_pub;
 
-      GNUNET_CRYPTO_rsa_public_key_hash (denom_key->key.rsa_public_key,
-                                         &h_denom_pub);
+      TALER_denom_pub_hash (&denom_key->key,
+                            &h_denom_pub);
       if (GNUNET_OK !=
-          TALER_exchange_secmod_rsa_verify (&h_denom_pub,
-                                            section_name,
-                                            denom_key->valid_from,
-                                            duration,
-                                            &fk.denom_secmod_public_key,
-                                            &denom_key->denom_secmod_sig))
+          TALER_exchange_secmod_denom_verify (&h_denom_pub,
+                                              section_name,
+                                              denom_key->valid_from,
+                                              duration,
+                                              &fk.denom_secmod_public_key,
+                                              &denom_key->denom_secmod_sig))
       {
         GNUNET_break_op (0);
         ok = false;
@@ -246,14 +246,7 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle 
*gh,
             &fk);
   }
   for (unsigned int i = 0; i<fk.num_denom_keys; i++)
-  {
-    if (NULL != fk.denom_keys[i].key.rsa_public_key)
-    {
-      GNUNET_CRYPTO_rsa_public_key_free (
-        fk.denom_keys[i].key.rsa_public_key);
-      fk.denom_keys[i].key.rsa_public_key = NULL;
-    }
-  }
+    TALER_denom_pub_free (&fk.denom_keys[i].key);
   GNUNET_free (fk.sign_keys);
   GNUNET_free (fk.denom_keys);
   GNUNET_JSON_parse_free (spec);
diff --git a/src/lib/exchange_api_management_revoke_denomination_key.c 
b/src/lib/exchange_api_management_revoke_denomination_key.c
index b9e2a556..4a1a79d0 100644
--- a/src/lib/exchange_api_management_revoke_denomination_key.c
+++ b/src/lib/exchange_api_management_revoke_denomination_key.c
@@ -125,7 +125,7 @@ struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle 
*
 TALER_EXCHANGE_management_revoke_denomination_key (
   struct GNUNET_CURL_Context *ctx,
   const char *url,
-  const struct GNUNET_HashCode *h_denom_pub,
+  const struct TALER_DenominationHash *h_denom_pub,
   const struct TALER_MasterSignatureP *master_sig,
   TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb,
   void *cb_cls)
diff --git a/src/util/payto.c b/src/util/payto.c
index 58f1bf63..26872f1e 100644
--- a/src/util/payto.c
+++ b/src/util/payto.c
@@ -254,3 +254,13 @@ TALER_payto_validate (const char *payto_uri)
 
   return NULL;
 }
+
+
+void
+TALER_payto_hash (const char *payto,
+                  struct TALER_PaytoHash *h_payto)
+{
+  GNUNET_CRYPTO_hash (payto,
+                      strlen (payto) + 1,
+                      &h_payto->hash);
+}

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