diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-02-11 12:46:12 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-02-11 12:46:12 +0100 |
commit | b6265ac8e031e24b383a3326eaf80e1ba7946fa1 (patch) | |
tree | a472645352b1815c9609b89755cb0970a5cfce17 /src | |
parent | 7d2f39e7660e7e9363da0b07e6f7e8bb9f47cb5e (diff) | |
download | merchant-b6265ac8e031e24b383a3326eaf80e1ba7946fa1.tar.gz merchant-b6265ac8e031e24b383a3326eaf80e1ba7946fa1.tar.bz2 merchant-b6265ac8e031e24b383a3326eaf80e1ba7946fa1.zip |
-fix FTBFS, but with logic holes
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/taler-merchant-httpd_post-tips-ID-pickup.c | 12 | ||||
-rw-r--r-- | src/include/taler_merchant_service.h | 5 | ||||
-rw-r--r-- | src/include/taler_merchant_testing_lib.h | 2 | ||||
-rw-r--r-- | src/lib/merchant_api_tip_pickup.c | 24 | ||||
-rw-r--r-- | src/lib/merchant_api_tip_pickup2.c | 5 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_tip_pickup.c | 28 |
6 files changed, 49 insertions, 27 deletions
diff --git a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c index 03b232d4..73916758 100644 --- a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c +++ b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c @@ -241,7 +241,7 @@ pick_context_cleanup (void *cls) stop_operations (pc); /* should not be any... */ for (unsigned int i = 0; i<pc->planchets_length; i++) - GNUNET_free (pc->planchets[i].coin_ev); + TALER_planchet_detail_free (&pc->planchets[i]); GNUNET_array_grow (pc->planchets, pc->planchets_length, 0); @@ -682,9 +682,8 @@ TMH_post_tips_ID_pickup (const struct TMH_RequestHandler *rh, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("denom_pub_hash", &pd->denom_pub_hash), - GNUNET_JSON_spec_varsize ("coin_ev", - (void **) &pd->coin_ev, - &pd->coin_ev_size), + TALER_JSON_spec_blinded_planchet ("coin_ev", + &pd->blinded_planchet), GNUNET_JSON_spec_end () }; { @@ -717,9 +716,8 @@ TMH_post_tips_ID_pickup (const struct TMH_RequestHandler *rh, GNUNET_CRYPTO_hash_context_read (hc, &pd->denom_pub_hash, sizeof (pd->denom_pub_hash)); - GNUNET_CRYPTO_hash_context_read (hc, - pd->coin_ev, - pd->coin_ev_size); + TALER_blinded_planchet_hash (&pd->blinded_planchet, + hc); } GNUNET_CRYPTO_hash_context_finish (hc, &pc->pickup_id.hash); diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index a16f8c2b..89f550b7 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -3615,7 +3615,8 @@ typedef void void *cls, const struct TALER_MERCHANT_HttpResponse *hr, unsigned int num_sigs, - const struct TALER_DenominationSignature sigs[]); + const struct TALER_DenominationSignature sigs[], + const struct TALER_CoinSpendPrivateKeyP coin_privs[]); /** @@ -3626,7 +3627,7 @@ struct TALER_MERCHANT_PlanchetData /** * Planchet secrets. */ - struct TALER_PlanchetSecretsP ps; + struct TALER_PlanchetMasterSecretP ps; /** * Denomination key desired. diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h index b846b622..b2a50588 100644 --- a/src/include/taler_merchant_testing_lib.h +++ b/src/include/taler_merchant_testing_lib.h @@ -1536,7 +1536,7 @@ TALER_TESTING_cmd_merchant_kyc_get (const char *label, op (paths, const char *) \ op (payto_uris, const char *) \ op (amounts, const struct TALER_Amount) \ - op (planchet_secrets, const struct TALER_PlanchetSecretsP) + op (planchet_secrets, const struct TALER_PlanchetMasterSecretP) TALER_MERCHANT_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT) diff --git a/src/lib/merchant_api_tip_pickup.c b/src/lib/merchant_api_tip_pickup.c index c16866a5..315f2ba9 100644 --- a/src/lib/merchant_api_tip_pickup.c +++ b/src/lib/merchant_api_tip_pickup.c @@ -40,7 +40,7 @@ struct PlanchetData /** * Secrets of the planchet. */ - struct TALER_PlanchetSecretsP ps; + struct TALER_PlanchetMasterSecretP ps; /** * Denomination key we are withdrawing. @@ -51,6 +51,11 @@ struct PlanchetData * Hash of the public key of the coin we are signing. */ struct TALER_CoinPubHash c_hash; + + // FIXME: initialize these: + struct TALER_ExchangeWithdrawValues alg_values; + union TALER_DenominationBlindingKeyP bks; + struct TALER_CoinSpendPrivateKeyP coin_priv; }; @@ -111,6 +116,7 @@ pickup_done_cb (void *cls, tp->cb (tp->cb_cls, hr, 0, + NULL, NULL); TALER_MERCHANT_tip_pickup_cancel (tp); return; @@ -130,8 +136,10 @@ pickup_done_cb (void *cls, if (GNUNET_OK != TALER_planchet_to_coin (&tp->planchets[i].pk.key, &blind_sigs[i], - &tp->planchets[i].ps, + &tp->planchets[i].bks, + &tp->planchets[i].coin_priv, &tp->planchets[i].c_hash, + &tp->planchets[i].alg_values, &fc)) { ok = GNUNET_SYSERR; @@ -144,7 +152,8 @@ pickup_done_cb (void *cls, tp->cb (tp->cb_cls, hr, num_blind_sigs, - sigs); + sigs, + NULL /* FIXME: pass coin_privs! */); } else { @@ -157,6 +166,7 @@ pickup_done_cb (void *cls, tp->cb (tp->cb_cls, &hrx, 0, + NULL, NULL); } for (unsigned int i = 0; i<num_blind_sigs; i++) @@ -192,13 +202,15 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context *ctx, tp->planchets[i].ps = pds[i].ps; if (GNUNET_OK != TALER_planchet_prepare (&pds[i].pk->key, - &tp->planchets[i].ps, + &tp->planchets[i].alg_values, + &tp->planchets[i].bks, + &tp->planchets[i].coin_priv, &tp->planchets[i].c_hash, &details[i])) { GNUNET_break (0); for (unsigned int j = 0; j<i; j++) - GNUNET_free (details[j].coin_ev); + TALER_planchet_detail_free (&details[j]); GNUNET_array_grow (tp->planchets, tp->num_planchets, 0); @@ -222,7 +234,7 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context *ctx, &pickup_done_cb, tp); for (unsigned int j = 0; j<num_planchets; j++) - GNUNET_free (details[j].coin_ev); + TALER_planchet_detail_free (&details[j]); if (NULL == tp->tpo2) { GNUNET_break (0); diff --git a/src/lib/merchant_api_tip_pickup2.c b/src/lib/merchant_api_tip_pickup2.c index ef9ccc21..cd1a0c83 100644 --- a/src/lib/merchant_api_tip_pickup2.c +++ b/src/lib/merchant_api_tip_pickup2.c @@ -257,9 +257,8 @@ TALER_MERCHANT_tip_pickup2 (struct GNUNET_CURL_Context *ctx, p = GNUNET_JSON_PACK ( GNUNET_JSON_pack_data_auto ("denom_pub_hash", &planchet->denom_pub_hash), - GNUNET_JSON_pack_data_varsize ("coin_ev", - planchet->coin_ev, - planchet->coin_ev_size)); + TALER_JSON_pack_blinded_planchet ("coin_ev", + &planchet->blinded_planchet)); if (0 != json_array_append_new (pa, p)) diff --git a/src/testing/testing_api_cmd_tip_pickup.c b/src/testing/testing_api_cmd_tip_pickup.c index 3c01b416..229ba301 100644 --- a/src/testing/testing_api_cmd_tip_pickup.c +++ b/src/testing/testing_api_cmd_tip_pickup.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2018 Taler Systems SA + Copyright (C) 2014-2022 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -104,7 +104,14 @@ struct TipPickupState * The array of planchet secrets, in the same order of @a * amounts. */ - struct TALER_PlanchetSecretsP *psa; + struct TALER_PlanchetMasterSecretP *psa; + + /** + * The array of coin private keys, in the same order of @a + * amounts. + */ + // FIXME: initialize! + struct TALER_CoinSpendPrivateKeyP *coin_privs; /** * Set (by the interpreter) to an array of @a num_coins @@ -135,7 +142,8 @@ static void pickup_cb (void *cls, const struct TALER_MERCHANT_HttpResponse *hr, unsigned int num_sigs, - const struct TALER_DenominationSignature *sigs) + const struct TALER_DenominationSignature *sigs, + const struct TALER_CoinSpendPrivateKeyP *coin_privs) { struct TipPickupState *tps = cls; @@ -167,6 +175,10 @@ pickup_cb (void *cls, for (unsigned int i = 0; i<num_sigs; i++) TALER_denom_sig_deep_copy (&tps->sigs[i], &sigs[i]); + tps->coin_privs + = GNUNET_memdup (coin_privs, + num_sigs + * sizeof (struct TALER_CoinSpendPrivateKeyP)); TALER_TESTING_interpreter_next (tps->is); } @@ -229,7 +241,7 @@ tip_pickup_run (void *cls, struct TALER_MERCHANT_PlanchetData planchets[num_planchets]; tps->psa = GNUNET_new_array (num_planchets, - struct TALER_PlanchetSecretsP); + struct TALER_PlanchetMasterSecretP); tps->dks = GNUNET_new_array (num_planchets, const struct TALER_EXCHANGE_DenomPublicKey *); tps->amounts_obj = GNUNET_new_array (num_planchets, @@ -254,11 +266,11 @@ tip_pickup_run (void *cls, &tps->amounts_obj[i]); if (NULL == tps->dks[i]) TALER_TESTING_FAIL (is); - TALER_planchet_setup_random (&tps->psa[i]); + TALER_planchet_master_setup_random (&tps->psa[i]); } else { - const struct TALER_PlanchetSecretsP *ps; + const struct TALER_PlanchetMasterSecretP *ps; if (GNUNET_OK != TALER_TESTING_get_trait_denom_pub (replay_cmd, @@ -279,7 +291,6 @@ tip_pickup_run (void *cls, TALER_TESTING_get_trait_tip_id (authorize_cmd, &tip_id)) TALER_TESTING_FAIL (is); - tps->tpo = TALER_MERCHANT_tip_pickup (is->ctx, tps->merchant_url, tip_id, @@ -308,6 +319,7 @@ tip_pickup_cleanup (void *cls, GNUNET_free (tps->amounts_obj); GNUNET_free (tps->dks); GNUNET_free (tps->psa); + GNUNET_free (tps->coin_privs); if (NULL != tps->sigs) { for (unsigned int i = 0; i<tps->num_coins; i++) @@ -338,7 +350,7 @@ tip_pickup_traits (void *cls, TALER_TESTING_make_trait_planchet_secrets (index, &tps->psa[index]), TALER_TESTING_make_trait_coin_priv (index, - &tps->psa[index].coin_priv), + &tps->coin_privs[index]), TALER_TESTING_make_trait_denom_pub (index, tps->dks[index]), TALER_TESTING_make_trait_denom_sig (index, |