fix FTBFS of main logic

This commit is contained in:
Christian Grothoff 2022-02-07 10:55:07 +01:00
parent 2164c36f0f
commit 031e365814
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
6 changed files with 62 additions and 29 deletions

View File

@ -493,6 +493,7 @@ run (void *cls,
struct TALER_PlanchetSecretsP ps; struct TALER_PlanchetSecretsP ps;
struct TALER_ExchangeWithdrawValues alg_values; struct TALER_ExchangeWithdrawValues alg_values;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
union TALER_DenominationBlindingKeyP bks;
RANDOMIZE (&coin_pub); RANDOMIZE (&coin_pub);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
@ -500,6 +501,7 @@ run (void *cls,
&denom_pub, &denom_pub,
TALER_DENOMINATION_RSA, TALER_DENOMINATION_RSA,
1024)); 1024));
alg_values.cipher = TALER_DENOMINATION_RSA;
TALER_denom_pub_hash (&denom_pub, TALER_denom_pub_hash (&denom_pub,
&h_denom_pub); &h_denom_pub);
make_amountN (2, 0, &issue.properties.value); make_amountN (2, 0, &issue.properties.value);
@ -521,10 +523,11 @@ run (void *cls,
TALER_planchet_blinding_secret_create (&ps, TALER_planchet_blinding_secret_create (&ps,
&alg_values); &alg_values,
&bks);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_denom_blind (&denom_pub, TALER_denom_blind (&denom_pub,
&ps.blinding_key, &bks,
NULL, /* FIXME-oec */ NULL, /* FIXME-oec */
&coin_pub, &coin_pub,
&alg_values, &alg_values,
@ -538,7 +541,7 @@ run (void *cls,
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_denom_sig_unblind (&denom_sig, TALER_denom_sig_unblind (&denom_sig,
&bds, &bds,
&ps.blinding_key, &bks,
&denom_pub)); &denom_pub));
TALER_blinded_denom_sig_free (&bds); TALER_blinded_denom_sig_free (&bds);
TALER_denom_pub_free (&denom_pub); TALER_denom_pub_free (&denom_pub);

View File

@ -2443,6 +2443,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
#define TALER_TESTING_SIMPLE_TRAITS(op) \ #define TALER_TESTING_SIMPLE_TRAITS(op) \
op (bank_row, const uint64_t) \ op (bank_row, const uint64_t) \
op (reserve_priv, const struct TALER_ReservePrivateKeyP) \ op (reserve_priv, const struct TALER_ReservePrivateKeyP) \
op (planchet_secret, const struct TALER_PlanchetSecretsP) \
op (reserve_pub, const struct TALER_ReservePublicKeyP) \ op (reserve_pub, const struct TALER_ReservePublicKeyP) \
op (merchant_priv, const struct TALER_MerchantPrivateKeyP) \ op (merchant_priv, const struct TALER_MerchantPrivateKeyP) \
op (merchant_pub, const struct TALER_MerchantPublicKeyP) \ op (merchant_pub, const struct TALER_MerchantPublicKeyP) \
@ -2482,7 +2483,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
#define TALER_TESTING_INDEXED_TRAITS(op) \ #define TALER_TESTING_INDEXED_TRAITS(op) \
op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey) \ op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey) \
op (denom_sig, const struct TALER_DenominationSignature) \ op (denom_sig, const struct TALER_DenominationSignature) \
op (planchet_secret, const struct TALER_PlanchetSecretsP) \ op (planchet_secrets, const struct TALER_PlanchetSecretsP) \
op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues) \ op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues) \
op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \ op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \
op (coin_pub, const struct TALER_CoinSpendPublicKeyP) \ op (coin_pub, const struct TALER_CoinSpendPublicKeyP) \

View File

@ -284,7 +284,6 @@ recoup_run (void *cls,
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_planchet_secret (coin_cmd, TALER_TESTING_get_trait_planchet_secret (coin_cmd,
idx,
&planchet)) &planchet))
{ {
GNUNET_break (0); GNUNET_break (0);

View File

@ -277,7 +277,7 @@ recoup_refresh_run (void *cls,
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_planchet_secret (coin_cmd, TALER_TESTING_get_trait_planchet_secrets (coin_cmd,
idx, idx,
&planchet)) &planchet))
{ {

View File

@ -99,6 +99,22 @@ struct WithdrawState
*/ */
struct TALER_ReservePublicKeyP reserve_pub; struct TALER_ReservePublicKeyP reserve_pub;
/**
* Private key of the coin.
*/
struct TALER_CoinSpendPrivateKeyP coin_priv;
/**
* Blinding key used during the operation.
*/
union TALER_DenominationBlindingKeyP bks;
/**
* Values contributed from the exchange during the
* withdraw protocol.
*/
struct TALER_ExchangeWithdrawValues exchange_vals;
/** /**
* Interpreter state (during command). * Interpreter state (during command).
*/ */
@ -263,6 +279,9 @@ reserve_withdraw_cb (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
TALER_denom_sig_deep_copy (&ws->sig, TALER_denom_sig_deep_copy (&ws->sig,
&wr->details.success.sig); &wr->details.success.sig);
ws->coin_priv = wr->details.success.coin_priv;
ws->bks = wr->details.success.bks;
ws->exchange_vals = wr->details.success.exchange_vals;
if (0 != ws->total_backoff.rel_value_us) if (0 != ws->total_backoff.rel_value_us)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@ -388,11 +407,11 @@ withdraw_run (void *cls,
&ws->reserve_pub); &ws->reserve_pub);
if (NULL == ws->reuse_coin_key_ref) if (NULL == ws->reuse_coin_key_ref)
{ {
TALER_planchet_setup_coin_priv (&ws->ps.coin_priv); TALER_planchet_setup_random (&ws->ps);
} }
else else
{ {
const struct TALER_CoinSpendPrivateKeyP *coin_priv; const struct TALER_PlanchetSecretsP *ps;
const struct TALER_TESTING_Command *cref; const struct TALER_TESTING_Command *cref;
char *cstr; char *cstr;
unsigned int index; unsigned int index;
@ -406,11 +425,9 @@ withdraw_run (void *cls,
GNUNET_assert (NULL != cref); GNUNET_assert (NULL != cref);
GNUNET_free (cstr); GNUNET_free (cstr);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_coin_priv (cref, TALER_TESTING_get_trait_planchet_secret (cref,
index, &ps));
&coin_priv)); ws->ps = *ps;
TALER_planchet_setup_coin_priv (&ws->ps.coin_priv);
ws->ps.coin_priv = *coin_priv;
} }
if (NULL == ws->pk) if (NULL == ws->pk)
{ {
@ -513,9 +530,12 @@ withdraw_traits (void *cls,
/* history entry MUST be first due to response code logic below! */ /* history entry MUST be first due to response code logic below! */
TALER_TESTING_make_trait_reserve_history (&ws->reserve_history), TALER_TESTING_make_trait_reserve_history (&ws->reserve_history),
TALER_TESTING_make_trait_coin_priv (0 /* only one coin */, TALER_TESTING_make_trait_coin_priv (0 /* only one coin */,
&ws->ps.coin_priv), &ws->coin_priv),
TALER_TESTING_make_trait_planchet_secret (&ws->ps),
TALER_TESTING_make_trait_blinding_key (0 /* only one coin */, TALER_TESTING_make_trait_blinding_key (0 /* only one coin */,
&ws->ps.blinding_key), &ws->bks),
TALER_TESTING_make_trait_exchange_wd_value (0 /* only one coin */,
&ws->exchange_vals),
TALER_TESTING_make_trait_denom_pub (0 /* only one coin */, TALER_TESTING_make_trait_denom_pub (0 /* only one coin */,
ws->pk), ws->pk),
TALER_TESTING_make_trait_denom_sig (0 /* only one coin */, TALER_TESTING_make_trait_denom_sig (0 /* only one coin */,

View File

@ -146,6 +146,16 @@ TALER_link_recover_transfer_secret (
} }
void
TALER_planchet_setup_random (
struct TALER_PlanchetSecretsP *ps)
{
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG,
ps,
sizeof (*ps));
}
void void
TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed, TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed,
uint32_t coin_num_salt, uint32_t coin_num_salt,
@ -167,9 +177,10 @@ TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed,
} }
// FIXME: bad name!
void void
cs_blinding_seed_derive (const struct cs_blinding_seed_derive (
TALER_PlanchetSecretsP *ps, const struct TALER_PlanchetSecretsP *ps,
const struct GNUNET_CRYPTO_CsRPublic r_pub[2], const struct GNUNET_CRYPTO_CsRPublic r_pub[2],
struct GNUNET_CRYPTO_CsNonce *blind_seed) struct GNUNET_CRYPTO_CsNonce *blind_seed)
{ {
@ -190,8 +201,8 @@ cs_blinding_seed_derive (const struct
void void
TALER_cs_withdraw_nonce_derive (const struct TALER_cs_withdraw_nonce_derive (
TALER_PlanchetSecretsP *ps, const struct TALER_PlanchetSecretsP *ps,
struct TALER_CsNonce *nonce) struct TALER_CsNonce *nonce)
{ {
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
@ -229,10 +240,9 @@ TALER_cs_refresh_nonce_derive (
void void
TALER_planchet_blinding_secret_create (const struct TALER_PlanchetSecretsP *ps, TALER_planchet_blinding_secret_create (
const struct TALER_PlanchetSecretsP *ps,
const struct const struct TALER_ExchangeWithdrawValues *alg_values,
TALER_ExchangeWithdrawValues *alg_values,
union TALER_DenominationBlindingKeyP *bks) union TALER_DenominationBlindingKeyP *bks)
{ {
switch (alg_values->cipher) switch (alg_values->cipher)