-work on refresh_common FTBFS
This commit is contained in:
parent
f173296c3c
commit
e735475623
@ -299,16 +299,24 @@ TALER_EXCHANGE_recoup_refresh (
|
||||
json_t *recoup_obj;
|
||||
CURL *eh;
|
||||
char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32];
|
||||
struct TALER_CoinSpendPrivateKeyP coin_priv;
|
||||
union TALER_DenominationBlindingKeyP bks;
|
||||
|
||||
GNUNET_assert (GNUNET_YES ==
|
||||
TEAH_handle_is_ready (exchange));
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&ps->coin_priv.eddsa_priv,
|
||||
TALER_planchet_setup_coin_priv (ps,
|
||||
exchange_vals,
|
||||
&coin_priv);
|
||||
TALER_planchet_blinding_secret_create (ps,
|
||||
exchange_vals,
|
||||
&bks);
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv.eddsa_priv,
|
||||
&coin_pub.eddsa_pub);
|
||||
TALER_denom_pub_hash (&pk->key,
|
||||
&h_denom_pub);
|
||||
TALER_wallet_recoup_refresh_sign (&h_denom_pub,
|
||||
&ps->blinding_key,
|
||||
&ps->coin_priv,
|
||||
&bks,
|
||||
&coin_priv,
|
||||
&coin_sig);
|
||||
recoup_obj = GNUNET_JSON_PACK (
|
||||
GNUNET_JSON_pack_data_auto ("denom_pub_hash",
|
||||
@ -318,7 +326,7 @@ TALER_EXCHANGE_recoup_refresh (
|
||||
GNUNET_JSON_pack_data_auto ("coin_sig",
|
||||
&coin_sig),
|
||||
GNUNET_JSON_pack_data_auto ("coin_blind_key_secret",
|
||||
&ps->blinding_key));
|
||||
&bks));
|
||||
|
||||
{
|
||||
char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2];
|
||||
|
@ -45,42 +45,40 @@ TALER_EXCHANGE_free_melt_data_ (struct MeltData *md)
|
||||
enum GNUNET_GenericReturnValue
|
||||
TALER_EXCHANGE_get_melt_data_ (
|
||||
const struct TALER_PlanchetSecretsP *ps,
|
||||
const struct struct TALER_EXCHANGE_RefreshData *rd,
|
||||
const struct TALER_EXCHANGE_RefreshData *rd,
|
||||
const struct TALER_ExchangeWithdrawValues *alg_values,
|
||||
struct MeltData *md)
|
||||
{
|
||||
struct MeltData md;
|
||||
json_t *ret;
|
||||
struct TALER_Amount total;
|
||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||
struct TALER_TransferSecretP trans_sec[TALER_CNC_KAPPA];
|
||||
struct TALER_RefreshCommitmentEntry rce[TALER_CNC_KAPPA];
|
||||
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&melt_priv->eddsa_priv,
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&rd->melt_priv.eddsa_priv,
|
||||
&coin_pub.eddsa_pub);
|
||||
/* build up melt data structure */
|
||||
memset (&md,
|
||||
memset (md,
|
||||
0,
|
||||
sizeof (md));
|
||||
md.num_fresh_coins = rd->fresh_pks_len;
|
||||
md.melted_coin.coin_priv = rd->melt_priv;
|
||||
md.melted_coin.melt_amount_with_fee = rd->melt_amount;
|
||||
md.melted_coin.fee_melt = rd->melt_pk->fee_refresh;
|
||||
md.melted_coin.original_value = rd->melt_pk->value;
|
||||
md.melted_coin.expire_deposit = rd->melt_pk->expire_deposit;
|
||||
sizeof (*md));
|
||||
md->num_fresh_coins = rd->fresh_pks_len;
|
||||
md->melted_coin.coin_priv = rd->melt_priv;
|
||||
md->melted_coin.melt_amount_with_fee = rd->melt_amount;
|
||||
md->melted_coin.fee_melt = rd->melt_pk.fee_refresh;
|
||||
md->melted_coin.original_value = rd->melt_pk.value;
|
||||
md->melted_coin.expire_deposit = rd->melt_pk.expire_deposit;
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_amount_set_zero (melt_amount->currency,
|
||||
TALER_amount_set_zero (rd->melt_amount.currency,
|
||||
&total));
|
||||
TALER_denom_pub_deep_copy (&md.melted_coin.pub_key,
|
||||
&rd->melt_pk->key);
|
||||
TALER_denom_sig_deep_copy (&md.melted_coin.sig,
|
||||
rd->melt_sig);
|
||||
md.fresh_pks = GNUNET_new_array (rd->fresh_pks_len,
|
||||
struct TALER_DenominationPublicKey);
|
||||
TALER_denom_pub_deep_copy (&md->melted_coin.pub_key,
|
||||
&rd->melt_pk.key);
|
||||
TALER_denom_sig_deep_copy (&md->melted_coin.sig,
|
||||
&rd->melt_sig);
|
||||
md->fresh_pks = GNUNET_new_array (rd->fresh_pks_len,
|
||||
struct TALER_DenominationPublicKey);
|
||||
for (unsigned int i = 0; i<rd->fresh_pks_len; i++)
|
||||
{
|
||||
TALER_denom_pub_deep_copy (&md.fresh_pks[i],
|
||||
&fresh_pks[i].key);
|
||||
TALER_denom_pub_deep_copy (&md->fresh_pks[i],
|
||||
&rd->fresh_pks[i].key);
|
||||
if ( (0 >
|
||||
TALER_amount_add (&total,
|
||||
&total,
|
||||
@ -91,19 +89,25 @@ TALER_EXCHANGE_get_melt_data_ (
|
||||
&rd->fresh_pks[i].fee_withdraw)) )
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_EXCHANGE_free_melt_data_ (&md);
|
||||
TALER_EXCHANGE_free_melt_data_ (md);
|
||||
memset (md,
|
||||
0,
|
||||
sizeof (*md));
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
}
|
||||
/* verify that melt_amount is above total cost */
|
||||
if (1 ==
|
||||
TALER_amount_cmp (&total,
|
||||
rd->melt_amount) )
|
||||
&rd->melt_amount) )
|
||||
{
|
||||
/* Eh, this operation is more expensive than the
|
||||
@a melt_amount. This is not OK. */
|
||||
GNUNET_break (0);
|
||||
TALER_EXCHANGE_free_melt_data_ (&md);
|
||||
TALER_EXCHANGE_free_melt_data_ (md);
|
||||
memset (md,
|
||||
0,
|
||||
sizeof (*md));
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
@ -112,20 +116,20 @@ TALER_EXCHANGE_get_melt_data_ (
|
||||
{
|
||||
// FIXME: derive!
|
||||
GNUNET_CRYPTO_ecdhe_key_create (
|
||||
&md.melted_coin.transfer_priv[i].ecdhe_priv);
|
||||
&md->melted_coin.transfer_priv[i].ecdhe_priv);
|
||||
GNUNET_CRYPTO_ecdhe_key_get_public (
|
||||
&md.melted_coin.transfer_priv[i].ecdhe_priv,
|
||||
&md->melted_coin.transfer_priv[i].ecdhe_priv,
|
||||
&rce[i].transfer_pub.ecdhe_pub);
|
||||
TALER_link_derive_transfer_secret (&rd->melt_priv,
|
||||
&md.melted_coin.transfer_priv[i],
|
||||
&md->melted_coin.transfer_priv[i],
|
||||
&trans_sec[i]);
|
||||
md.fresh_coins[i] = GNUNET_new_array (rd->fresh_pks_len,
|
||||
struct TALER_PlanchetSecretsP);
|
||||
md->fresh_coins[i] = GNUNET_new_array (rd->fresh_pks_len,
|
||||
struct TALER_PlanchetSecretsP);
|
||||
rce[i].new_coins = GNUNET_new_array (rd->fresh_pks_len,
|
||||
struct TALER_RefreshCoinData);
|
||||
for (unsigned int j = 0; j<rd->fresh_pks_len; j++)
|
||||
{
|
||||
struct TALER_PlanchetSecretsP *fc = &md.fresh_coins[i][j];
|
||||
struct TALER_PlanchetSecretsP *fc = &md->fresh_coins[i][j];
|
||||
struct TALER_RefreshCoinData *rcd = &rce[i].new_coins[j];
|
||||
struct TALER_ExchangeWithdrawValues alg_values;
|
||||
struct TALER_PlanchetDetail pd;
|
||||
@ -137,17 +141,20 @@ TALER_EXCHANGE_get_melt_data_ (
|
||||
// TODO: implement cipher handling
|
||||
alg_values.cipher = TALER_DENOMINATION_RSA;
|
||||
if (GNUNET_OK !=
|
||||
TALER_planchet_prepare (&md.fresh_pks[j],
|
||||
TALER_planchet_prepare (&md->fresh_pks[j],
|
||||
&alg_values,
|
||||
fc,
|
||||
&c_hash,
|
||||
&pd))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
TALER_EXCHANGE_free_melt_data_ (&md);
|
||||
return NULL;
|
||||
TALER_EXCHANGE_free_melt_data_ (md);
|
||||
memset (md,
|
||||
0,
|
||||
sizeof (*md));
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
rcd->dk = &md.fresh_pks[j];
|
||||
rcd->dk = &md->fresh_pks[j];
|
||||
rcd->coin_ev =
|
||||
pd.blinded_planchet.details.rsa_blinded_planchet.blinded_msg;
|
||||
rcd->coin_ev_size =
|
||||
@ -156,15 +163,15 @@ TALER_EXCHANGE_get_melt_data_ (
|
||||
}
|
||||
|
||||
/* Compute refresh commitment */
|
||||
TALER_refresh_get_commitment (&md.rc,
|
||||
TALER_refresh_get_commitment (&md->rc,
|
||||
TALER_CNC_KAPPA,
|
||||
fresh_pks_len,
|
||||
rd->fresh_pks_len,
|
||||
rce,
|
||||
&coin_pub,
|
||||
&rd->melt_amount);
|
||||
for (unsigned int i = 0; i < TALER_CNC_KAPPA; i++)
|
||||
{
|
||||
for (unsigned int j = 0; j < fresh_pks_len; j++)
|
||||
for (unsigned int j = 0; j < rd->fresh_pks_len; j++)
|
||||
GNUNET_free (rce[i].new_coins[j].coin_ev);
|
||||
GNUNET_free (rce[i].new_coins);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user