From 0995bdd1d05356ed5f97954449f5a5c74a41bdc5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 11 Feb 2022 09:36:01 +0100 Subject: -get tests to pass --- src/lib/exchange_api_link.c | 11 ++++++----- src/lib/exchange_api_melt.c | 10 +++++----- src/lib/exchange_api_recoup.c | 2 +- src/lib/exchange_api_recoup_refresh.c | 6 +++--- src/lib/exchange_api_refresh_common.c | 14 +++++--------- src/lib/exchange_api_refresh_common.h | 6 +++--- src/lib/exchange_api_refreshes_reveal.c | 10 +++++----- src/lib/exchange_api_withdraw.c | 4 ++-- 8 files changed, 30 insertions(+), 33 deletions(-) (limited to 'src/lib') diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c index 0b2a1336b..2e3b01a63 100644 --- a/src/lib/exchange_api_link.c +++ b/src/lib/exchange_api_link.c @@ -113,7 +113,7 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, GNUNET_JSON_spec_end () }; struct TALER_TransferSecretP secret; - struct TALER_PlanchetSecretsP ps; + struct TALER_PlanchetMasterSecretP ps; struct TALER_PlanchetDetail pd; struct TALER_CoinPubHash c_hash; @@ -175,14 +175,15 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, // really need to change the derivation structure // during refresh to derive the nonces differently // and make /link possible! - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Link using PS(%u)=%s\n", - (unsigned int) coin_idx, - TALER_B2S (&ps)); + /* FIXME: we cannot get the 'rms' here, and + if the TALER_coin_ev_hash() includes that 'nonce', + we are screwed on/link. */ +#if FIXME_OMIT TALER_cs_refresh_nonce_derive ( &ps, coin_idx, &pd.blinded_planchet.details.cs_blinded_planchet.nonce); +#endif TALER_coin_ev_hash (&pd.blinded_planchet, &pd.denom_pub_hash, &coin_envelope_hash); diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c index 4d585c85f..eec2d0a53 100644 --- a/src/lib/exchange_api_melt.c +++ b/src/lib/exchange_api_melt.c @@ -78,7 +78,7 @@ struct TALER_EXCHANGE_MeltHandle /** * The secret the entire melt operation is seeded from. */ - const struct TALER_PlanchetSecretsP *ps; + const struct TALER_RefreshMasterSecretP *rms; /** * Details about the characteristics of the requested melt operation. @@ -490,7 +490,7 @@ start_melt (struct TALER_EXCHANGE_MeltHandle *mh) struct TALER_DenominationHash h_denom_pub; if (GNUNET_OK != - TALER_EXCHANGE_get_melt_data_ (mh->ps, + TALER_EXCHANGE_get_melt_data_ (mh->rms, mh->rd, mh->alg_values, &mh->md)) @@ -637,7 +637,7 @@ csr_cb (void *cls, struct TALER_EXCHANGE_MeltHandle * TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, - const struct TALER_PlanchetSecretsP *ps, + const struct TALER_RefreshMasterSecretP *rms, const struct TALER_EXCHANGE_RefreshData *rd, TALER_EXCHANGE_MeltCallback melt_cb, void *melt_cb_cls) @@ -657,7 +657,7 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, mh->noreveal_index = TALER_CNC_KAPPA; /* invalid value */ mh->exchange = exchange; mh->rd = rd; - mh->ps = ps; + mh->rms = rms; /* FIXME: deep copy might be safer... */ mh->melt_cb = melt_cb; mh->melt_cb_cls = melt_cb_cls; mh->alg_values = GNUNET_new_array (rd->fresh_pks_len, @@ -683,7 +683,7 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, case TALER_DENOMINATION_CS: wv->cipher = TALER_DENOMINATION_CS; nks[nks_off].pk = fresh_pk; - TALER_cs_refresh_nonce_derive (ps, + TALER_cs_refresh_nonce_derive (rms, i, &nks[nks_off].nonce); nks_off++; diff --git a/src/lib/exchange_api_recoup.c b/src/lib/exchange_api_recoup.c index b6a99ba52..5ae0c55bb 100644 --- a/src/lib/exchange_api_recoup.c +++ b/src/lib/exchange_api_recoup.c @@ -285,7 +285,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange, const struct TALER_EXCHANGE_DenomPublicKey *pk, const struct TALER_DenominationSignature *denom_sig, const struct TALER_ExchangeWithdrawValues *exchange_vals, - const struct TALER_PlanchetSecretsP *ps, + const struct TALER_PlanchetMasterSecretP *ps, TALER_EXCHANGE_RecoupResultCallback recoup_cb, void *recoup_cb_cls) { diff --git a/src/lib/exchange_api_recoup_refresh.c b/src/lib/exchange_api_recoup_refresh.c index dbdf9eb65..44b117b0a 100644 --- a/src/lib/exchange_api_recoup_refresh.c +++ b/src/lib/exchange_api_recoup_refresh.c @@ -287,8 +287,8 @@ TALER_EXCHANGE_recoup_refresh ( const struct TALER_EXCHANGE_DenomPublicKey *pk, const struct TALER_DenominationSignature *denom_sig, const struct TALER_ExchangeWithdrawValues *exchange_vals, - const struct TALER_PlanchetSecretsP *rps, - const struct TALER_PlanchetSecretsP *ps, + const struct TALER_RefreshMasterSecretP *rms, + const struct TALER_PlanchetMasterSecretP *ps, unsigned int idx, TALER_EXCHANGE_RecoupRefreshResultCallback recoup_cb, void *recoup_cb_cls) @@ -343,7 +343,7 @@ TALER_EXCHANGE_recoup_refresh ( it is not strictly clear that the nonce is needed. Best case would be to find a way to include it more 'naturally' somehow, for example with the variant union version of bks! */ - TALER_cs_refresh_nonce_derive (rps, + TALER_cs_refresh_nonce_derive (rms, idx, &nonce); GNUNET_assert ( diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c index c15527369..4c65e390f 100644 --- a/src/lib/exchange_api_refresh_common.c +++ b/src/lib/exchange_api_refresh_common.c @@ -44,7 +44,7 @@ TALER_EXCHANGE_free_melt_data_ (struct MeltData *md) enum GNUNET_GenericReturnValue TALER_EXCHANGE_get_melt_data_ ( - const struct TALER_PlanchetSecretsP *ps, + const struct TALER_RefreshMasterSecretP *rms, const struct TALER_EXCHANGE_RefreshData *rd, const struct TALER_ExchangeWithdrawValues *alg_values, struct MeltData *md) @@ -115,7 +115,7 @@ TALER_EXCHANGE_get_melt_data_ ( for (unsigned int i = 0; imelted_coin.transfer_priv[i]); GNUNET_CRYPTO_ecdhe_key_get_public ( @@ -125,12 +125,12 @@ TALER_EXCHANGE_get_melt_data_ ( &md->melted_coin.transfer_priv[i], &trans_sec[i]); md->fresh_coins[i] = GNUNET_new_array (rd->fresh_pks_len, - struct TALER_PlanchetSecretsP); + struct TALER_PlanchetMasterSecretP); rce[i].new_coins = GNUNET_new_array (rd->fresh_pks_len, struct TALER_RefreshCoinData); for (unsigned int j = 0; jfresh_pks_len; j++) { - struct TALER_PlanchetSecretsP *fc = &md->fresh_coins[i][j]; + struct TALER_PlanchetMasterSecretP *fc = &md->fresh_coins[i][j]; struct TALER_RefreshCoinData *rcd = &rce[i].new_coins[j]; struct TALER_PlanchetDetail pd; struct TALER_CoinPubHash c_hash; @@ -150,12 +150,8 @@ TALER_EXCHANGE_get_melt_data_ ( so this computation is redundant, and here additionally repeated KAPPA times. Could be avoided with slightly more bookkeeping in the future */ - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Refresh using PS(%u)=%s\n", - j, - TALER_B2S (&ps)); TALER_cs_refresh_nonce_derive ( - ps, + rms, j, &pd.blinded_planchet.details.cs_blinded_planchet.nonce); if (GNUNET_OK != diff --git a/src/lib/exchange_api_refresh_common.h b/src/lib/exchange_api_refresh_common.h index 94c4f3234..70085a5b6 100644 --- a/src/lib/exchange_api_refresh_common.h +++ b/src/lib/exchange_api_refresh_common.h @@ -112,21 +112,21 @@ struct MeltData * Arrays of @e num_fresh_coins with information about the fresh * coins to be created, for each cut-and-choose dimension. */ - struct TALER_PlanchetSecretsP *fresh_coins[TALER_CNC_KAPPA]; + struct TALER_PlanchetMasterSecretP *fresh_coins[TALER_CNC_KAPPA]; }; /** * Compute the melt data from the refresh data and secret. * - * @param ps secret internals of the refresh-reveal operation + * @param rms secret internals of the refresh-reveal operation * @param rd refresh data with the characteristics of the operation * @param alg_values contributions from the exchange into the melt * @param[out] rd where to write the derived melt data */ enum GNUNET_GenericReturnValue TALER_EXCHANGE_get_melt_data_ ( - const struct TALER_PlanchetSecretsP *ps, + const struct TALER_RefreshMasterSecretP *rms, const struct TALER_EXCHANGE_RefreshData *rd, const struct TALER_ExchangeWithdrawValues *alg_values, struct MeltData *md); diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c index b675d3db5..ca49f7782 100644 --- a/src/lib/exchange_api_refreshes_reveal.c +++ b/src/lib/exchange_api_refreshes_reveal.c @@ -141,7 +141,7 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh, } for (unsigned int i = 0; imd.num_fresh_coins; i++) { - const struct TALER_PlanchetSecretsP *fc; + const struct TALER_PlanchetMasterSecretP *fc; struct TALER_DenominationPublicKey *pk; json_t *jsonai; struct TALER_BlindedDenominationSignature blind_sig; @@ -316,7 +316,7 @@ handle_refresh_reveal_finished (void *cls, struct TALER_EXCHANGE_RefreshesRevealHandle * TALER_EXCHANGE_refreshes_reveal ( struct TALER_EXCHANGE_Handle *exchange, - const struct TALER_PlanchetSecretsP *ps, + const struct TALER_RefreshMasterSecretP *rms, const struct TALER_EXCHANGE_RefreshData *rd, unsigned int num_coins, const struct TALER_ExchangeWithdrawValues *alg_values, @@ -354,7 +354,7 @@ TALER_EXCHANGE_refreshes_reveal ( return NULL; } if (GNUNET_OK != - TALER_EXCHANGE_get_melt_data_ (ps, + TALER_EXCHANGE_get_melt_data_ (rms, rd, alg_values, &md)) @@ -380,7 +380,7 @@ TALER_EXCHANGE_refreshes_reveal ( struct TALER_DenominationHash denom_hash; struct TALER_PlanchetDetail pd; struct TALER_CoinPubHash c_hash; - struct TALER_PlanchetSecretsP coin_ps; + struct TALER_PlanchetMasterSecretP coin_ps; union TALER_DenominationBlindingKeyP bks; struct TALER_CoinSpendPrivateKeyP coin_priv; @@ -400,7 +400,7 @@ TALER_EXCHANGE_refreshes_reveal ( &alg_values[i], &bks); TALER_cs_refresh_nonce_derive ( - ps, + rms, i, &pd.blinded_planchet.details.cs_blinded_planchet.nonce); if (GNUNET_OK != diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c index d89beff0f..743fea4bb 100644 --- a/src/lib/exchange_api_withdraw.c +++ b/src/lib/exchange_api_withdraw.c @@ -66,7 +66,7 @@ struct TALER_EXCHANGE_WithdrawHandle /** * Seed of the planchet. */ - struct TALER_PlanchetSecretsP ps; + struct TALER_PlanchetMasterSecretP ps; /** * blinding secret @@ -247,7 +247,7 @@ TALER_EXCHANGE_withdraw ( struct TALER_EXCHANGE_Handle *exchange, const struct TALER_EXCHANGE_DenomPublicKey *pk, const struct TALER_ReservePrivateKeyP *reserve_priv, - const struct TALER_PlanchetSecretsP *ps, + const struct TALER_PlanchetMasterSecretP *ps, TALER_EXCHANGE_WithdrawCallback res_cb, void *res_cb_cls) { -- cgit v1.2.3