From 77142acbe800d6f8fe0d8f65374403353ede5d30 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 27 Oct 2021 13:42:54 +0200 Subject: fix lib/ FTBFS --- src/lib/exchange_api_common.c | 24 -------- src/lib/exchange_api_handle.c | 4 +- src/lib/exchange_api_link.c | 4 +- src/lib/exchange_api_management_get_keys.c | 4 +- src/lib/exchange_api_melt.c | 3 +- src/lib/exchange_api_refresh_common.c | 48 ++++++++------- src/lib/exchange_api_refresh_common.h | 95 +----------------------------- src/lib/exchange_api_refreshes_reveal.c | 5 +- 8 files changed, 41 insertions(+), 146 deletions(-) (limited to 'src/lib') 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; jfresh_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); -- cgit v1.2.3