fixed src util and other stuff

This commit is contained in:
Gian Demarmels 2022-02-05 23:42:17 +01:00
parent 9fc3b7a278
commit 34a7f59060
No known key found for this signature in database
GPG Key ID: 030CEDDCCC92D778
3 changed files with 23 additions and 21 deletions

View File

@ -94,6 +94,7 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
struct TALER_BlindedDenominationSignature bsig; struct TALER_BlindedDenominationSignature bsig;
struct TALER_DenominationPublicKey rpub; struct TALER_DenominationPublicKey rpub;
struct TALER_CoinSpendSignatureP link_sig; struct TALER_CoinSpendSignatureP link_sig;
union TALER_DenominationBlindingKeyP bks;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_denom_pub ("denom_pub", TALER_JSON_spec_denom_pub ("denom_pub",
&rpub), &rpub),
@ -104,7 +105,6 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
struct TALER_TransferSecretP secret; struct TALER_TransferSecretP secret;
struct TALER_PlanchetSecretsP fc;
/* parse reply */ /* parse reply */
if (GNUNET_OK != if (GNUNET_OK !=
@ -120,19 +120,19 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
&secret); &secret);
TALER_planchet_setup_refresh (&secret, TALER_planchet_setup_refresh (&secret,
coin_num, coin_num,
&fc); coin_priv,
&bks);
/* extract coin and signature */ /* extract coin and signature */
if (GNUNET_OK != if (GNUNET_OK !=
TALER_denom_sig_unblind (sig, TALER_denom_sig_unblind (sig,
&bsig, &bsig,
&fc.blinding_key, &bks,
&rpub)) &rpub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
*coin_priv = fc.coin_priv;
/* verify link_sig */ /* verify link_sig */
{ {
struct TALER_ExchangeWithdrawValues alg_values; struct TALER_ExchangeWithdrawValues alg_values;
@ -148,7 +148,8 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
if (GNUNET_OK != if (GNUNET_OK !=
TALER_planchet_prepare (&rpub, TALER_planchet_prepare (&rpub,
&alg_values, &alg_values,
&fc, &bks,
coin_priv,
&c_hash, &c_hash,
&pd)) &pd))
{ {

View File

@ -162,7 +162,7 @@ verify_melt_signature_ok (struct TALER_EXCHANGE_MeltHandle *mh,
confirm.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT); confirm.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT);
confirm.purpose.size confirm.purpose.size
= htonl (sizeof (struct TALER_RefreshMeltConfirmationPS)); = htonl (sizeof (struct TALER_RefreshMeltConfirmationPS));
confirm.rc = mh->md->rc; confirm.rc = mh->md.rc;
confirm.noreveal_index = htonl (*noreveal_index); confirm.noreveal_index = htonl (*noreveal_index);
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT,
@ -253,7 +253,7 @@ verify_melt_signature_spend_conflict (struct TALER_EXCHANGE_MeltHandle *mh,
} }
/* Find out which coin was deemed problematic by the exchange */ /* Find out which coin was deemed problematic by the exchange */
mc = &mh->md->melted_coin; mc = &mh->md.melted_coin;
/* verify coin history */ /* verify coin history */
memset (&h_denom_pub, memset (&h_denom_pub,
0, 0,
@ -476,25 +476,25 @@ start_melt (struct TALER_EXCHANGE_MeltHandle *mh)
} }
TALER_denom_pub_hash (&mh->md.melted_coin.pub_key, TALER_denom_pub_hash (&mh->md.melted_coin.pub_key,
&h_denom_pub); &h_denom_pub);
TALER_wallet_melt_sign (&md->melted_coin.melt_amount_with_fee, TALER_wallet_melt_sign (&mh->md.melted_coin.melt_amount_with_fee,
&md->melted_coin.fee_melt, &mh->md.melted_coin.fee_melt,
&md->rc, &mh->md.rc,
&h_denom_pub, &h_denom_pub,
&md->melted_coin.coin_priv, &mh->md.melted_coin.coin_priv,
&confirm_sig); &confirm_sig);
GNUNET_CRYPTO_eddsa_key_get_public (&md->melted_coin.coin_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&mh->md.melted_coin.coin_priv.eddsa_priv,
&coin_pub.eddsa_pub); &coin_pub.eddsa_pub);
melt_obj = GNUNET_JSON_PACK ( melt_obj = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("denom_pub_hash", GNUNET_JSON_pack_data_auto ("denom_pub_hash",
&h_denom_pub), &h_denom_pub),
TALER_JSON_pack_denom_sig ("denom_sig", TALER_JSON_pack_denom_sig ("denom_sig",
&md->melted_coin.sig), &mh->md.melted_coin.sig),
GNUNET_JSON_pack_data_auto ("confirm_sig", GNUNET_JSON_pack_data_auto ("confirm_sig",
&confirm_sig), &confirm_sig),
TALER_JSON_pack_amount ("value_with_fee", TALER_JSON_pack_amount ("value_with_fee",
&md->melted_coin.melt_amount_with_fee), &mh->md.melted_coin.melt_amount_with_fee),
GNUNET_JSON_pack_data_auto ("rc", GNUNET_JSON_pack_data_auto ("rc",
&md->rc)); &mh->md.rc));
{ {
char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2];
char *end; char *end;
@ -577,16 +577,18 @@ csr_cb (void *cls,
struct TALER_EXCHANGE_MeltHandle *mh = cls; struct TALER_EXCHANGE_MeltHandle *mh = cls;
unsigned int nks_off = 0; unsigned int nks_off = 0;
for (unsigned int i = 0; i<rd->fresh_pks_len; i++) for (unsigned int i = 0; i<mh->rd->fresh_pks_len; i++)
{ {
const struct TALER_EXCHANGE_DenomPublicKey *fresh_pk = &rd->fresh_pks[i]; const struct TALER_EXCHANGE_DenomPublicKey *fresh_pk =
&mh->rd->fresh_pks[i];
struct TALER_ExchangeWithdrawValues *wv = &mh->alg_values[i]; struct TALER_ExchangeWithdrawValues *wv = &mh->alg_values[i];
switch (fresh_pk->cipher) switch (fresh_pk->key.cipher)
{ {
case TALER_DENOMINATION_INVALID: case TALER_DENOMINATION_INVALID:
GNUNET_break (0); GNUNET_break (0);
fail_mh (mh). // FIXME:
// fail_mh (mh).
return; return;
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
GNUNET_assert (TALER_DENOMINATION_RSA == wv->cipher); GNUNET_assert (TALER_DENOMINATION_RSA == wv->cipher);
@ -614,7 +616,6 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_RefreshData *rd, const struct TALER_EXCHANGE_RefreshData *rd,
TALER_EXCHANGE_MeltCallback melt_cb, TALER_EXCHANGE_MeltCallback melt_cb,
void *melt_cb_cls) void *melt_cb_cls)
s
{ {
const struct TALER_EXCHANGE_NonceKey *nks[GNUNET_NZL (rd->refresh_pks_len)]; const struct TALER_EXCHANGE_NonceKey *nks[GNUNET_NZL (rd->refresh_pks_len)];
unsigned int nks_off = 0; unsigned int nks_off = 0;

View File

@ -127,7 +127,7 @@ struct MeltData
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_EXCHANGE_get_melt_data_ ( TALER_EXCHANGE_get_melt_data_ (
const struct TALER_PlanchetSecretsP *ps, const struct TALER_PlanchetSecretsP *ps,
const struct struct TALER_EXCHANGE_RefreshData *rd, const struct TALER_EXCHANGE_RefreshData *rd,
const struct TALER_ExchangeWithdrawValues *alg_values, const struct TALER_ExchangeWithdrawValues *alg_values,
struct MeltData *md); struct MeltData *md);