diff options
Diffstat (limited to 'src/exchange')
| -rw-r--r-- | src/exchange/taler-exchange-httpd_csr.c | 16 | ||||
| -rw-r--r-- | src/exchange/taler-exchange-httpd_recoup.c | 19 |
2 files changed, 21 insertions, 14 deletions
diff --git a/src/exchange/taler-exchange-httpd_csr.c b/src/exchange/taler-exchange-httpd_csr.c index 7417996d..02bdb7dd 100644 --- a/src/exchange/taler-exchange-httpd_csr.c +++ b/src/exchange/taler-exchange-httpd_csr.c @@ -41,7 +41,6 @@ TEH_handler_csr (struct TEH_RequestContext *rc, json_t *csr_requests; json_t *csr_response_ewvs; json_t *csr_response; - struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_json ("nks", &csr_requests), @@ -103,13 +102,15 @@ TEH_handler_csr (struct TEH_RequestContext *rc, } GNUNET_JSON_parse_free (spec); - struct TALER_DenominationCSPublicRPairP r_pubs[GNUNET_NZL (csr_requests_num)]; + struct TALER_ExchangeWithdrawValues ewvs[GNUNET_NZL (csr_requests_num)]; for (unsigned int i = 0; i < csr_requests_num; i++) { const struct TALER_CsNonce *nonce = &nonces[i]; const struct TALER_DenominationHash *denom_pub_hash = &denom_pub_hashes[i]; - struct TALER_DenominationCSPublicRPairP *r_pub = &r_pubs[i]; + struct TALER_DenominationCSPublicRPairP *r_pub + = &ewvs[i].details.cs_values.r_pub_pair; + ewvs[i].cipher = TALER_DENOMINATION_CS; // check denomination referenced by denom_pub_hash { struct TEH_KeyStateHandle *ksh; @@ -187,16 +188,11 @@ TEH_handler_csr (struct TEH_RequestContext *rc, csr_response_ewvs = json_array (); for (unsigned int i = 0; i < csr_requests_num; i++) { - const struct TALER_DenominationCSPublicRPairP *r_pub = &r_pubs[i]; json_t *csr_obj; csr_obj = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_varsize ("r_pub_0", - &r_pub->r_pub[0], - sizeof(struct GNUNET_CRYPTO_CsRPublic)), - GNUNET_JSON_pack_data_varsize ("r_pub_1", - &r_pub->r_pub[1], - sizeof(struct GNUNET_CRYPTO_CsRPublic))); + TALER_JSON_pack_exchange_withdraw_values ("ewv", + &ewvs[i])); GNUNET_assert (NULL != csr_obj); GNUNET_assert (0 == json_array_append_new (csr_response_ewvs, diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c index 416eaf69..d4ff5237 100644 --- a/src/exchange/taler-exchange-httpd_recoup.c +++ b/src/exchange/taler-exchange-httpd_recoup.c @@ -165,6 +165,8 @@ recoup_transaction (void *cls, * * @param connection the MHD connection to handle * @param coin information about the coin + * @param exchange_vals values contributed by the exchange + * during withdrawal * @param coin_bks blinding data of the coin (to be checked) * @param coin_sig signature of the coin * @return MHD result code @@ -173,6 +175,7 @@ static MHD_RESULT verify_and_execute_recoup ( struct MHD_Connection *connection, const struct TALER_CoinPublicInfo *coin, + const struct TALER_ExchangeWithdrawValues *exchange_vals, const union TALER_DenominationBlindingKeyP *coin_bks, const struct TALER_CoinSpendSignatureP *coin_sig) { @@ -242,6 +245,9 @@ verify_and_execute_recoup ( NULL); } + /* re-compute client-side blinding so we can + (a bit later) check that this coin was indeed + signed by us. */ { struct TALER_CoinPubHash c_hash; struct TALER_BlindedPlanchet blinded_planchet; @@ -251,7 +257,7 @@ verify_and_execute_recoup ( coin_bks, NULL, /* FIXME-Oec: TALER_AgeHash * */ &coin->coin_pub, - NULL, /* FIXME: handle CS */ + exchange_vals, &c_hash, &blinded_planchet)) { @@ -262,9 +268,10 @@ verify_and_execute_recoup ( TALER_EC_EXCHANGE_RECOUP_BLINDING_FAILED, NULL); } - if (GNUNET_OK != TALER_coin_ev_hash (&blinded_planchet, - &coin->denom_pub_hash, - &pc.h_blind)) + if (GNUNET_OK != + TALER_coin_ev_hash (&blinded_planchet, + &coin->denom_pub_hash, + &pc.h_blind)) { GNUNET_break (0); return TALER_MHD_reply_with_error (connection, @@ -365,11 +372,14 @@ TEH_handler_recoup (struct MHD_Connection *connection, struct TALER_CoinPublicInfo coin; union TALER_DenominationBlindingKeyP coin_bks; struct TALER_CoinSpendSignatureP coin_sig; + struct TALER_ExchangeWithdrawValues exchange_vals; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("denom_pub_hash", &coin.denom_pub_hash), TALER_JSON_spec_denom_sig ("denom_sig", &coin.denom_sig), + TALER_JSON_spec_exchange_withdraw_values ("ewv", + &exchange_vals), GNUNET_JSON_spec_fixed_auto ("coin_blind_key_secret", &coin_bks), GNUNET_JSON_spec_fixed_auto ("coin_sig", @@ -393,6 +403,7 @@ TEH_handler_recoup (struct MHD_Connection *connection, res = verify_and_execute_recoup (connection, &coin, + &exchange_vals, &coin_bks, &coin_sig); GNUNET_JSON_parse_free (spec); |
