From a67786078bb3617ea8d4d308b21781fd0a1c2258 Mon Sep 17 00:00:00 2001 From: Gian Demarmels Date: Fri, 4 Feb 2022 16:50:32 +0100 Subject: resolves merge conflicts --- src/bank-lib/fakebank.c | 52 ++++++++++----------- src/exchange/taler-exchange-httpd_csr.c | 3 -- src/exchange/taler-exchange-httpd_recoup-refresh.c | 13 +++--- src/exchange/taler-exchange-httpd_recoup.c | 5 +- .../taler-exchange-httpd_refreshes_reveal.c | 18 +++----- src/exchange/taler-exchange-httpd_withdraw.c | 53 +++++----------------- src/exchangedb/test_exchangedb.c | 4 +- src/include/taler_util.h | 2 +- src/json/json_helper.c | 51 +-------------------- src/lib/exchange_api_link.c | 11 ++--- 10 files changed, 57 insertions(+), 155 deletions(-) (limited to 'src') diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c index 11993e558..ab1d73b4a 100644 --- a/src/bank-lib/fakebank.c +++ b/src/bank-lib/fakebank.c @@ -1386,19 +1386,19 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h, &json); switch (pr) { - case GNUNET_JSON_PR_OUT_OF_MEMORY: - GNUNET_break (0); - return MHD_NO; - case GNUNET_JSON_PR_CONTINUE: - return MHD_YES; - case GNUNET_JSON_PR_REQUEST_TOO_LARGE: - GNUNET_break (0); - return MHD_NO; - case GNUNET_JSON_PR_JSON_INVALID: - GNUNET_break (0); - return MHD_NO; - case GNUNET_JSON_PR_SUCCESS: - break; + case GNUNET_JSON_PR_OUT_OF_MEMORY: + GNUNET_break (0); + return MHD_NO; + case GNUNET_JSON_PR_CONTINUE: + return MHD_YES; + case GNUNET_JSON_PR_REQUEST_TOO_LARGE: + GNUNET_break (0); + return MHD_NO; + case GNUNET_JSON_PR_JSON_INVALID: + GNUNET_break (0); + return MHD_NO; + case GNUNET_JSON_PR_SUCCESS: + break; } { const char *debit_account; @@ -1510,19 +1510,19 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h, &json); switch (pr) { - case GNUNET_JSON_PR_OUT_OF_MEMORY: - GNUNET_break (0); - return MHD_NO; - case GNUNET_JSON_PR_CONTINUE: - return MHD_YES; - case GNUNET_JSON_PR_REQUEST_TOO_LARGE: - GNUNET_break (0); - return MHD_NO; - case GNUNET_JSON_PR_JSON_INVALID: - GNUNET_break (0); - return MHD_NO; - case GNUNET_JSON_PR_SUCCESS: - break; + case GNUNET_JSON_PR_OUT_OF_MEMORY: + GNUNET_break (0); + return MHD_NO; + case GNUNET_JSON_PR_CONTINUE: + return MHD_YES; + case GNUNET_JSON_PR_REQUEST_TOO_LARGE: + GNUNET_break (0); + return MHD_NO; + case GNUNET_JSON_PR_JSON_INVALID: + GNUNET_break (0); + return MHD_NO; + case GNUNET_JSON_PR_SUCCESS: + break; } { struct GNUNET_HashCode uuid; diff --git a/src/exchange/taler-exchange-httpd_csr.c b/src/exchange/taler-exchange-httpd_csr.c index dfe4d4d07..fbad543c8 100644 --- a/src/exchange/taler-exchange-httpd_csr.c +++ b/src/exchange/taler-exchange-httpd_csr.c @@ -94,7 +94,6 @@ TEH_handler_csr (struct TEH_RequestContext *rc, return TEH_RESPONSE_reply_expired_denom_pub_hash ( rc->connection, &denom_pub_hash, - GNUNET_TIME_timestamp_get (), TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED, "CSR"); } @@ -105,7 +104,6 @@ TEH_handler_csr (struct TEH_RequestContext *rc, return TEH_RESPONSE_reply_expired_denom_pub_hash ( rc->connection, &denom_pub_hash, - GNUNET_TIME_timestamp_get (), TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE, "CSR"); } @@ -115,7 +113,6 @@ TEH_handler_csr (struct TEH_RequestContext *rc, return TEH_RESPONSE_reply_expired_denom_pub_hash ( rc->connection, &denom_pub_hash, - GNUNET_TIME_timestamp_get (), TALER_EC_EXCHANGE_GENERIC_DENOMINATION_REVOKED, "CSR"); } diff --git a/src/exchange/taler-exchange-httpd_recoup-refresh.c b/src/exchange/taler-exchange-httpd_recoup-refresh.c index 78a454c85..acaea64f7 100644 --- a/src/exchange/taler-exchange-httpd_recoup-refresh.c +++ b/src/exchange/taler-exchange-httpd_recoup-refresh.c @@ -241,18 +241,17 @@ verify_and_execute_recoup_refresh ( } { - void *coin_ev; - size_t coin_ev_size; struct TALER_CoinPubHash c_hash; + struct TALER_BlindedPlanchet blinded_planchet; if (GNUNET_OK != TALER_denom_blind (&dk->denom_pub, coin_bks, NULL, /* FIXME-Oec: TALER_AgeHash * */ &coin->coin_pub, + NULL, /* FIXME: Implement CS */ &c_hash, - &coin_ev, - &coin_ev_size)) + &blinded_planchet)) { GNUNET_break (0); return TALER_MHD_reply_with_error ( @@ -261,10 +260,10 @@ verify_and_execute_recoup_refresh ( TALER_EC_EXCHANGE_RECOUP_REFRESH_BLINDING_FAILED, NULL); } - TALER_coin_ev_hash (coin_ev, - coin_ev_size, + TALER_coin_ev_hash (&blinded_planchet, + &coin->denom_pub_hash, &h_blind); - GNUNET_free (coin_ev); + TALER_blinded_planchet_free (&blinded_planchet); } pc.coin_sig = coin_sig; diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c index 1978b58d0..416eaf69d 100644 --- a/src/exchange/taler-exchange-httpd_recoup.c +++ b/src/exchange/taler-exchange-httpd_recoup.c @@ -243,9 +243,6 @@ verify_and_execute_recoup ( } { - //FIXME: - void *coin_ev; - size_t coin_ev_size; struct TALER_CoinPubHash c_hash; struct TALER_BlindedPlanchet blinded_planchet; @@ -254,7 +251,7 @@ verify_and_execute_recoup ( coin_bks, NULL, /* FIXME-Oec: TALER_AgeHash * */ &coin->coin_pub, - NULL, /* in RSA Case not needed*/ + NULL, /* FIXME: handle CS */ &c_hash, &blinded_planchet)) { diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index eba8efbda..95ec55b25 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -510,23 +510,17 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection, for (unsigned int i = 0; inum_fresh_coins; i++) { enum TALER_ErrorCode ec = TALER_EC_NONE; - //FIXME: + struct TEH_SignDetails sign_details; + // FIXME: implement cipher handling + sign_details.cipher = TALER_DENOMINATION_RSA; + sign_details.details.rsa_message.msg = rcds[i].coin_ev; + sign_details.details.rsa_message.msg_size = rcds[i].coin_ev_size; rrcs[i].coin_sig = TEH_keys_denomination_sign ( &rrcs[i].h_denom_pub, - rcds[i].coin_ev, - rcds[i].coin_ev_size, + &sign_details, &ec); - struct TEH_SignDetails sign_details; - - // FIXME: implement cipher handling - sign_details.cipher = TALER_DENOMINATION_RSA; - sign_details.details.rsa_message.msg = rctx->rcds[i].coin_ev; - sign_details.details.rsa_message.msg_size = rctx->rcds[i].coin_ev_size; - rctx->ev_sigs[i] = TEH_keys_denomination_sign (&dk_h[i], - &sign_details, - &ec); if (TALER_EC_NONE != ec) { GNUNET_break (0); diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index aab1cafdd..5cae883e2 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -98,13 +98,10 @@ struct WithdrawContext /** * Blinded planchet. */ - //FIXME: + struct TALER_BlindedPlanchet blinded_planchet; /** - * Number of bytes in @e blinded_msg. - */ - size_t blinded_msg_len; - struct TALER_BlindedPlanchet blinded_planchet; + * Set to the resulting signed coin data to be returned to the client. */ struct TALER_EXCHANGEDB_CollectableBlindcoin collectable; @@ -322,12 +319,6 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc, { struct WithdrawContext wc; struct GNUNET_JSON_Specification spec[] = { - //FIXME: - GNUNET_JSON_spec_varsize ("coin_ev", - &wc.blinded_msg, - &wc.blinded_msg_len), - // field "coin_ev" will be parsed later due to different parsing depending - // on denomination cipher, see coin_ev_..._spec GNUNET_JSON_spec_fixed_auto ("reserve_sig", &wc.collectable.reserve_sig), GNUNET_JSON_spec_fixed_auto ("denom_pub_hash", @@ -447,24 +438,6 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc, GNUNET_JSON_parse_free (spec); return mret; } - } -//FIXME: - if (0 > - TALER_amount_add (&wc.collectable.amount_with_fee, - &dk->meta.value, - &dk->meta.fee_withdraw)) - { - GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (rc->connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_WITHDRAW_AMOUNT_FEE_OVERFLOW, - NULL); - // parse coin_ev field, must be done after dk lookup to know denom cipher - { - enum GNUNET_GenericReturnValue res; - wc.blinded_planchet.cipher = dk->denom_pub.cipher; - switch (wc.blinded_planchet.cipher) - if (dk->denom_pub.cipher != wc.blinded_planchet.cipher) { /* denomination cipher and blinded planchet cipher not the same */ @@ -476,20 +449,16 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc, } } + if (0 > + TALER_amount_add (&wc.collectable.amount_with_fee, + &dk->meta.value, + &dk->meta.fee_withdraw)) { - if (0 > - TALER_amount_add (&wc.collectable.amount_with_fee, - &dk->meta.value, - &dk->meta.fee_withdraw)) - { - GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (rc->connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_WITHDRAW_AMOUNT_FEE_OVERFLOW, - NULL); - } - TALER_amount_hton (&wc.wsrd.amount_with_fee, - &wc.collectable.amount_with_fee); + GNUNET_JSON_parse_free (spec); + return TALER_MHD_reply_with_error (rc->connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_EXCHANGE_WITHDRAW_AMOUNT_FEE_OVERFLOW, + NULL); } TALER_amount_hton (&wc.wsrd.amount_with_fee, &wc.collectable.amount_with_fee); diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index ad61d96f7..7895aacad 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -531,7 +531,7 @@ handle_link_data_cb (void *cls, break; } } - //FIXME: + // FIXME: GNUNET_assert (GNUNET_NO != found); } } @@ -1690,7 +1690,7 @@ run (void *cls) struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_AgeHash age_hash; struct TALER_AgeHash *p_ah[2] = {NULL, &age_hash}; - //FIXME: + // FIXME: /* Call TALER_denom_blind()/TALER_denom_sign_blinded() twice, once without * age_hash, once with age_hash */ RND_BLK (&age_hash); diff --git a/src/include/taler_util.h b/src/include/taler_util.h index 26440cb1d..f64811a46 100644 --- a/src/include/taler_util.h +++ b/src/include/taler_util.h @@ -444,7 +444,7 @@ TALER_yna_to_string (enum TALER_EXCHANGE_YesNoAll yna); * @param c the character to search for * @return char* the first occurence of `c` in `s` */ -char * strchrnul (const char *s, int c); +char *strchrnul (const char *s, int c); #endif diff --git a/src/json/json_helper.c b/src/json/json_helper.c index c6dee2480..4acac5061 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c @@ -845,7 +845,7 @@ TALER_JSON_spec_i18n_str (const char *name, return ret; } -//FIXME: + enum GNUNET_GenericReturnValue TALER_JSON_parse_agemask (const json_t *root, struct TALER_AgeMask *mask) @@ -873,57 +873,8 @@ TALER_JSON_parse_agemask (const json_t *root, { return GNUNET_SYSERR; } -//FIXME: - return GNUNET_OK; -/** - * Parse given JSON object to CS R. - * - * @param cls closure, NULL - * @param root the json object representing data - * @param[out] spec where to write the data - * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error - */ -static enum GNUNET_GenericReturnValue -parse_csr (void *cls, - json_t *root, - struct GNUNET_JSON_Specification *spec) -{ - struct GNUNET_CRYPTO_CsRPublic *r_pub = spec->ptr; - - struct GNUNET_JSON_Specification dspec[] = { - GNUNET_JSON_spec_fixed (spec->field, r_pub, sizeof (struct - GNUNET_CRYPTO_CsRPublic)), - GNUNET_JSON_spec_end () - }; - const char *emsg; - unsigned int eline; - - if (GNUNET_OK != - GNUNET_JSON_parse (root, - dspec, - &emsg, - &eline)) - { - GNUNET_break_op (0); - return GNUNET_SYSERR; - } return GNUNET_OK; } -struct GNUNET_JSON_Specification -TALER_JSON_spec_csr (const char *field, - struct GNUNET_CRYPTO_CsRPublic *r_pub) -{ - struct GNUNET_JSON_Specification ret = { - .parser = &parse_csr, - .cleaner = NULL, - .field = field, - .ptr = r_pub - }; - - return ret; -} - - /* end of json/json_helper.c */ diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c index 78f8804a1..e241f5438 100644 --- a/src/lib/exchange_api_link.c +++ b/src/lib/exchange_api_link.c @@ -156,18 +156,13 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, GNUNET_JSON_parse_free (spec); return GNUNET_SYSERR; } - GNUNET_CRYPTO_hash (pd.coin_ev, - pd.coin_ev_size, - &coin_envelope_hash.hash); - //FIXME: + TALER_coin_ev_hash (&pd.blinded_planchet, + &pd.denom_pub_hash, + &coin_envelope_hash); if (GNUNET_OK != TALER_wallet_link_verify (&pd.denom_pub_hash, trans_pub, &coin_envelope_hash, - pd.blinded_planchet.details. - rsa_blinded_planchet.blinded_msg, - pd.blinded_planchet.details. - rsa_blinded_planchet.blinded_msg_size, &old_coin_pub, &link_sig)) { -- cgit v1.2.3