summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-10-27 13:42:54 +0200
committerChristian Grothoff <christian@grothoff.org>2021-10-27 13:42:54 +0200
commit77142acbe800d6f8fe0d8f65374403353ede5d30 (patch)
tree82b827d26040a2ba2f38a1cf356946479d38428a
parentb148a5a81a4b6e96daba8c9fbb0e53afff8dcdca (diff)
downloadexchange-77142acbe800d6f8fe0d8f65374403353ede5d30.tar.gz
exchange-77142acbe800d6f8fe0d8f65374403353ede5d30.tar.bz2
exchange-77142acbe800d6f8fe0d8f65374403353ede5d30.zip
fix lib/ FTBFS
-rw-r--r--src/exchange-tools/taler-auditor-offline.c8
-rw-r--r--src/exchange-tools/taler-exchange-offline.c8
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c4
-rw-r--r--src/exchange/taler-exchange-httpd_melt.c4
-rw-r--r--src/exchange/taler-exchange-httpd_recoup.c4
-rw-r--r--src/include/taler_exchange_service.h5
-rw-r--r--src/include/taler_json_lib.h8
-rw-r--r--src/json/json_helper.c8
-rw-r--r--src/lib/exchange_api_common.c24
-rw-r--r--src/lib/exchange_api_handle.c4
-rw-r--r--src/lib/exchange_api_link.c4
-rw-r--r--src/lib/exchange_api_management_get_keys.c4
-rw-r--r--src/lib/exchange_api_melt.c3
-rw-r--r--src/lib/exchange_api_refresh_common.c48
-rw-r--r--src/lib/exchange_api_refresh_common.h95
-rw-r--r--src/lib/exchange_api_refreshes_reveal.c5
16 files changed, 64 insertions, 172 deletions
diff --git a/src/exchange-tools/taler-auditor-offline.c b/src/exchange-tools/taler-auditor-offline.c
index 8f44aa56a..74e17efc9 100644
--- a/src/exchange-tools/taler-auditor-offline.c
+++ b/src/exchange-tools/taler-auditor-offline.c
@@ -760,8 +760,8 @@ show_denomkeys (const json_t *denomkeys)
struct TALER_Amount fee_refund;
struct TALER_MasterSignatureP master_sig;
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_denomination_public_key ("denom_pub",
- &denom_pub),
+ TALER_JSON_spec_denom_pub ("denom_pub",
+ &denom_pub),
TALER_JSON_spec_amount ("value",
currency,
&coin_value),
@@ -1060,8 +1060,8 @@ sign_denomkeys (const json_t *denomkeys)
struct TALER_Amount fee_refund;
struct TALER_MasterSignatureP master_sig;
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_denomination_public_key ("denom_pub",
- &denom_pub),
+ TALER_JSON_spec_denom_pub ("denom_pub",
+ &denom_pub),
TALER_JSON_spec_amount ("value",
currency,
&coin_value),
diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c
index b90e0227c..01661eac7 100644
--- a/src/exchange-tools/taler-exchange-offline.c
+++ b/src/exchange-tools/taler-exchange-offline.c
@@ -2604,8 +2604,8 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("section_name",
&section_name),
- TALER_JSON_spec_denomination_public_key ("denom_pub",
- &denom_pub),
+ TALER_JSON_spec_denom_pub ("denom_pub",
+ &denom_pub),
TALER_JSON_spec_amount ("value",
currency,
&coin_value),
@@ -3023,8 +3023,8 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("section_name",
&section_name),
- TALER_JSON_spec_denomination_public_key ("denom_pub",
- &denom_pub),
+ TALER_JSON_spec_denom_pub ("denom_pub",
+ &denom_pub),
TALER_JSON_spec_amount ("value",
currency,
&coin_value),
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index bff0e6a28..4f7e10e60 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -330,8 +330,8 @@ TEH_handler_deposit (struct MHD_Connection *connection,
&deposit.amount_with_fee),
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
&deposit.coin.denom_pub_hash),
- TALER_JSON_spec_denomination_signature ("ub_sig",
- &deposit.coin.denom_sig),
+ TALER_JSON_spec_denom_sig ("ub_sig",
+ &deposit.coin.denom_sig),
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
&deposit.merchant_pub),
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c
index 626f52a61..c33473b4b 100644
--- a/src/exchange/taler-exchange-httpd_melt.c
+++ b/src/exchange/taler-exchange-httpd_melt.c
@@ -590,8 +590,8 @@ TEH_handler_melt (struct MHD_Connection *connection,
enum GNUNET_GenericReturnValue ret;
MHD_RESULT res;
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_denomination_signature ("denom_sig",
- &rmc.refresh_session.coin.denom_sig),
+ TALER_JSON_spec_denom_sig ("denom_sig",
+ &rmc.refresh_session.coin.denom_sig),
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
&rmc.refresh_session.coin.denom_pub_hash),
GNUNET_JSON_spec_fixed_auto ("confirm_sig",
diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c
index 3ea394e7c..98ab314ab 100644
--- a/src/exchange/taler-exchange-httpd_recoup.c
+++ b/src/exchange/taler-exchange-httpd_recoup.c
@@ -523,8 +523,8 @@ TEH_handler_recoup (struct MHD_Connection *connection,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
&coin.denom_pub_hash),
- TALER_JSON_spec_denomination_signature ("denom_sig",
- &coin.denom_sig),
+ TALER_JSON_spec_denom_sig ("denom_sig",
+ &coin.denom_sig),
GNUNET_JSON_spec_fixed_auto ("coin_blind_key_secret",
&coin_bks),
GNUNET_JSON_spec_fixed_auto ("coin_sig",
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 91395540f..72c233258 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1590,8 +1590,6 @@ struct TALER_EXCHANGE_RefreshesRevealHandle;
* prior to calling this function.
*
* @param exchange the exchange handle; the exchange must be ready to operate
- * @param refresh_data_length size of the @a refresh_data (returned
- * in the `res_size` argument from #TALER_EXCHANGE_refresh_prepare())
* @param refresh_data the refresh data as returned from
#TALER_EXCHANGE_refresh_prepare())
* @param noreveal_index response from the exchange to the
@@ -1605,8 +1603,7 @@ struct TALER_EXCHANGE_RefreshesRevealHandle;
struct TALER_EXCHANGE_RefreshesRevealHandle *
TALER_EXCHANGE_refreshes_reveal (
struct TALER_EXCHANGE_Handle *exchange,
- size_t refresh_data_length,
- const char *refresh_data,
+ const json_t *refresh_data,
uint32_t noreveal_index,
TALER_EXCHANGE_RefreshesRevealCallback reveal_cb,
void *reveal_cb_cls);
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index a4b17297f..42c3669d2 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -311,8 +311,8 @@ TALER_JSON_spec_relative_time (const char *name,
* @return corresponding field spec
*/
struct GNUNET_JSON_Specification
-TALER_JSON_spec_denomination_public_key (const char *field,
- struct TALER_DenominationPublicKey *pk);
+TALER_JSON_spec_denom_pub (const char *field,
+ struct TALER_DenominationPublicKey *pk);
/**
@@ -323,8 +323,8 @@ TALER_JSON_spec_denomination_public_key (const char *field,
* @return corresponding field spec
*/
struct GNUNET_JSON_Specification
-TALER_JSON_spec_denomination_signature (const char *field,
- struct TALER_DenominationSignature *sig);
+TALER_JSON_spec_denom_sig (const char *field,
+ struct TALER_DenominationSignature *sig);
/**
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index d468b4bce..d509f4eff 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -506,8 +506,8 @@ clean_denom_pub (void *cls,
struct GNUNET_JSON_Specification
-TALER_JSON_spec_denomination_public_key (const char *field,
- struct TALER_DenominationPublicKey *pk)
+TALER_JSON_spec_denom_pub (const char *field,
+ struct TALER_DenominationPublicKey *pk)
{
struct GNUNET_JSON_Specification ret = {
.parser = &parse_denom_pub,
@@ -599,8 +599,8 @@ clean_denom_sig (void *cls,
struct GNUNET_JSON_Specification
-TALER_JSON_spec_denomination_signature (const char *field,
- struct TALER_DenominationSignature *sig)
+TALER_JSON_spec_denom_sig (const char *field,
+ struct TALER_DenominationSignature *sig)
{
struct GNUNET_JSON_Specification ret = {
.parser = &parse_denom_sig,
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 1cb11f1be..4da7e33e8 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -26,22 +26,6 @@
#include "taler_signatures.h"
-/**
- * Parse history given in JSON format and return it in binary
- * format.
- *
- * @param exchange connection to the exchange we can use
- * @param history JSON array with the history
- * @param reserve_pub public key of the reserve to inspect
- * @param currency currency we expect the balance to be in
- * @param[out] balance final balance
- * @param history_length number of entries in @a history
- * @param[out] rhistory array of length @a history_length, set to the
- * parsed history entries
- * @return #GNUNET_OK if history was valid and @a rhistory and @a balance
- * were set,
- * #GNUNET_SYSERR if there was a protocol violation in @a history
- */
enum GNUNET_GenericReturnValue
TALER_EXCHANGE_parse_reserve_history (
struct TALER_EXCHANGE_Handle *exchange,
@@ -954,14 +938,6 @@ TALER_EXCHANGE_verify_coin_history (
}
-/**
- * Obtain meta data about an exchange (online) signing
- * key.
- *
- * @param keys from where to obtain the meta data
- * @param exchange_pub public key to lookup
- * @return NULL on error (@a exchange_pub not known)
- */
const struct TALER_EXCHANGE_SigningPublicKey *
TALER_EXCHANGE_get_signing_key_info (
const struct TALER_EXCHANGE_Keys *keys,
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index b63fa35c3..f2f8b594f 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -345,8 +345,8 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
&denom_key->fee_refresh),
TALER_JSON_spec_amount_any ("fee_refund",
&denom_key->fee_refund),
- TALER_JSON_spec_denomination_public_key ("denom_pub",
- &denom_key->key),
+ TALER_JSON_spec_denom_pub ("denom_pub",
+ &denom_key->key),
GNUNET_JSON_spec_end ()
};
diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c
index e36ffcd93..920224d4d 100644
--- a/src/lib/exchange_api_link.c
+++ b/src/lib/exchange_api_link.c
@@ -95,8 +95,8 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
struct TALER_DenominationPublicKey rpub;
struct TALER_CoinSpendSignatureP link_sig;
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_denomination_public_key ("denom_pub",
- &rpub),
+ TALER_JSON_spec_denom_pub ("denom_pub",
+ &rpub),
GNUNET_JSON_spec_rsa_signature ("ev_sig",
&bsig),
GNUNET_JSON_spec_fixed_auto ("link_sig",
diff --git a/src/lib/exchange_api_management_get_keys.c b/src/lib/exchange_api_management_get_keys.c
index a3e3eccce..980836792 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),
- TALER_JSON_spec_denomination_public_key ("denom_pub",
- &denom_key->key),
+ TALER_JSON_spec_denom_pub ("denom_pub",
+ &denom_key->key),
TALER_JSON_spec_amount_any ("fee_withdraw",
&denom_key->fee_withdraw),
TALER_JSON_spec_amount_any ("fee_deposit",
diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c
index 43117d5c6..f3032e8b2 100644
--- a/src/lib/exchange_api_melt.c
+++ b/src/lib/exchange_api_melt.c
@@ -471,7 +471,8 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_assert (GNUNET_YES ==
TEAH_handle_is_ready (exchange));
- md = TALER_EXCHANGE_deserialize_melt_data_ (refresh_data);
+ md = TALER_EXCHANGE_deserialize_melt_data_ (refresh_data,
+ exchange->key_data.currency);
if (NULL == md)
{
GNUNET_break (0);
diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c
index 65f36b969..245e5ddaf 100644
--- a/src/lib/exchange_api_refresh_common.c
+++ b/src/lib/exchange_api_refresh_common.c
@@ -100,11 +100,13 @@ serialize_melted_coin (const struct MeltedCoin *mc)
* Deserialize information about a coin we are melting.
*
* @param[out] mc information to deserialize
+ * @param currency expected currency
* @param in JSON object to read data from
* @return #GNUNET_NO to report errors
*/
static enum GNUNET_GenericReturnValue
deserialize_melted_coin (struct MeltedCoin *mc,
+ const char *currency,
const json_t *in)
{
json_t *trans_privs;
@@ -116,15 +118,18 @@ deserialize_melted_coin (struct MeltedCoin *mc,
TALER_JSON_spec_denom_pub ("denom_pub",
&mc->pub_key),
TALER_JSON_spec_amount ("melt_amount_with_fee",
+ currency,
&mc->melt_amount_with_fee),
TALER_JSON_spec_amount ("original_value",
+ currency,
&mc->original_value),
TALER_JSON_spec_amount ("melt_fee",
- &mc->melt_fee),
+ currency,
+ &mc->fee_melt),
TALER_JSON_spec_absolute_time ("expire_deposit",
&mc->expire_deposit),
- TALER_JSON_spec_json ("transfer_privs",
- &trans_privs),
+ GNUNET_JSON_spec_json ("transfer_privs",
+ &trans_privs),
GNUNET_JSON_spec_end ()
};
@@ -190,33 +195,35 @@ serialize_melt_data (const struct MeltData *md)
json_t *ps;
ps = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_fixed_auto ("ps",
- &md->fresh_coins[i][j]));
+ GNUNET_JSON_pack_data_auto ("ps",
+ &md->fresh_coins[i][j]));
GNUNET_assert (0 ==
json_array_append (planchet_secrets,
ps));
}
GNUNET_assert (0 ==
json_array_append (
+ fresh_coins,
GNUNET_JSON_PACK (
TALER_JSON_pack_denom_pub ("denom_pub",
&md->fresh_pks[i]),
- TALER_JSON_pack_array_steal ("planchet_secrets",
- ps)))
+ GNUNET_JSON_pack_array_steal ("planchet_secrets",
+ planchet_secrets)))
);
}
return GNUNET_JSON_PACK (
- TALER_JSON_pack_array_steal ("fresh_coins",
- fresh_coins),
- TALER_JSON_pack_object_steal ("melted_coin",
- serialize_melted_coin (&mc->melted_coin)),
- GNUNET_JSON_pack_fixed_auto ("rc",
- &md->rc));
+ GNUNET_JSON_pack_array_steal ("fresh_coins",
+ fresh_coins),
+ GNUNET_JSON_pack_object_steal ("melted_coin",
+ serialize_melted_coin (&md->melted_coin)),
+ GNUNET_JSON_pack_data_auto ("rc",
+ &md->rc));
}
struct MeltData *
-TALER_EXCHANGE_deserialize_melt_data_ (const json_t *melt_data)
+TALER_EXCHANGE_deserialize_melt_data_ (const json_t *melt_data,
+ const char *currency)
{
struct MeltData *md = GNUNET_new (struct MeltData);
json_t *fresh_coins;
@@ -250,7 +257,8 @@ TALER_EXCHANGE_deserialize_melt_data_ (const json_t *melt_data)
return NULL;
}
if (GNUNET_OK !=
- deserialize_melted_coin (&md->mc,
+ deserialize_melted_coin (&md->melted_coin,
+ currency,
melted_coin))
{
GNUNET_break (0);
@@ -278,8 +286,8 @@ TALER_EXCHANGE_deserialize_melt_data_ (const json_t *melt_data)
};
if (GNUNET_OK !=
- GNUNET_JSON_parse (melt_data,
- spec,
+ GNUNET_JSON_parse (ji,
+ ispec,
NULL, NULL))
{
GNUNET_break (0);
@@ -296,8 +304,8 @@ TALER_EXCHANGE_deserialize_melt_data_ (const json_t *melt_data)
for (unsigned int j = 0; j<TALER_CNC_KAPPA; j++)
{
struct GNUNET_JSON_Specification jspec[] = {
- GNUNET_JSON_spec_data_auto ("ps",
- &md->fresh_coins[i][j]),
+ GNUNET_JSON_spec_fixed_auto ("ps",
+ &md->fresh_coins[i][j]),
GNUNET_JSON_spec_end ()
};
@@ -451,5 +459,5 @@ TALER_EXCHANGE_refresh_prepare (
GNUNET_free (rce[i].new_coins);
}
TALER_EXCHANGE_free_melt_data_ (&md);
- return buf;
+ return ret;
}
diff --git a/src/lib/exchange_api_refresh_common.h b/src/lib/exchange_api_refresh_common.h
index ffef78b0f..7b531e701 100644
--- a/src/lib/exchange_api_refresh_common.h
+++ b/src/lib/exchange_api_refresh_common.h
@@ -27,97 +27,6 @@
#include "taler_signatures.h"
-/* structures for committing refresh data to disk before doing the
- network interaction(s) */
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * Header of serialized information about a coin we are melting.
- */
-struct MeltedCoinP
-{
- /**
- * Private key of the coin.
- */
- struct TALER_CoinSpendPrivateKeyP coin_priv;
-
- /**
- * Amount this coin contributes to the melt, including fee.
- */
- struct TALER_AmountNBO melt_amount_with_fee;
-
- /**
- * The applicable fee for withdrawing a coin of this denomination
- */
- struct TALER_AmountNBO fee_melt;
-
- /**
- * The original value of the coin.
- */
- struct TALER_AmountNBO original_value;
-
- /**
- * Transfer private keys for each cut-and-choose dimension.
- */
- struct TALER_TransferPrivateKeyP transfer_priv[TALER_CNC_KAPPA];
-
- /**
- * Timestamp indicating when coins of this denomination become invalid.
- */
- struct GNUNET_TIME_AbsoluteNBO expire_deposit;
-
- /**
- * Size of the encoded public key that follows.
- */
- uint16_t pbuf_size;
-
- /**
- * Size of the encoded signature that follows.
- */
- uint16_t sbuf_size;
-
- /* Followed by serializations of:
- 1) struct TALER_DenominationPublicKey pub_key;
- 2) struct TALER_DenominationSignature sig;
- */
-};
-
-
-/**
- * Header of serialized data about a melt operation, suitable for
- * persisting it on disk.
- */
-struct MeltDataP
-{
-
- /**
- * Hash over the melting session.
- */
- struct TALER_RefreshCommitmentP rc;
-
- /**
- * Number of coins we are melting, in NBO
- */
- uint16_t num_melted_coins GNUNET_PACKED;
-
- /**
- * Number of coins we are creating, in NBO
- */
- uint16_t num_fresh_coins GNUNET_PACKED;
-
- /* Followed by serializations of:
- 1) struct MeltedCoinP melted_coins[num_melted_coins];
- 2) struct TALER_EXCHANGE_DenomPublicKey fresh_pks[num_fresh_coins];
- 3) TALER_CNC_KAPPA times:
- 3a) struct TALER_PlanchetSecretsP fresh_coins[num_fresh_coins];
- */
-};
-
-
-GNUNET_NETWORK_STRUCT_END
-
-
/**
* Information about a coin we are melting.
*/
@@ -205,10 +114,12 @@ struct MeltData
* Deserialize melt data.
*
* @param data json data to deserialize
+ * @param currency expected currency for the coins
* @return deserialized melt data, NULL on error
*/
struct MeltData *
-TALER_EXCHANGE_deserialize_melt_data_ (const json_t *data);
+TALER_EXCHANGE_deserialize_melt_data_ (const json_t *data,
+ const char *currency);
/**
diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c
index 1cb9eada1..0af37c021 100644
--- a/src/lib/exchange_api_refreshes_reveal.c
+++ b/src/lib/exchange_api_refreshes_reveal.c
@@ -292,8 +292,7 @@ handle_refresh_reveal_finished (void *cls,
struct TALER_EXCHANGE_RefreshesRevealHandle *
TALER_EXCHANGE_refreshes_reveal (
struct TALER_EXCHANGE_Handle *exchange,
- size_t refresh_data_length,
- const char *refresh_data,
+ const json_t *refresh_data,
uint32_t noreveal_index,
TALER_EXCHANGE_RefreshesRevealCallback reveal_cb,
void *reveal_cb_cls)
@@ -326,7 +325,7 @@ TALER_EXCHANGE_refreshes_reveal (
return NULL;
}
md = TALER_EXCHANGE_deserialize_melt_data_ (refresh_data,
- refresh_data_length);
+ exchange->key_data.currency);
if (NULL == md)
{
GNUNET_break (0);