add h_denom to melt signatures (for #6416)

This commit is contained in:
Christian Grothoff 2020-07-08 17:58:45 +02:00
parent 97dfbec081
commit 8e03498a48
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
6 changed files with 16 additions and 10 deletions

View File

@ -1283,6 +1283,8 @@ refresh_session_cb (void *cls,
.coin_pub = *coin_pub .coin_pub = *coin_pub
}; };
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
&rmc.h_denom_pub);
TALER_amount_hton (&rmc.amount_with_fee, TALER_amount_hton (&rmc.amount_with_fee,
amount_with_fee); amount_with_fee);
if (GNUNET_OK != if (GNUNET_OK !=
@ -1620,6 +1622,8 @@ deposit_cb (void *cls,
.coin_pub = *coin_pub .coin_pub = *coin_pub
}; };
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
&dr.h_denom_pub);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_JSON_merchant_wire_signature_hash (receiver_wire_account, TALER_JSON_merchant_wire_signature_hash (receiver_wire_account,
&dr.h_wire)) &dr.h_wire))

View File

@ -380,6 +380,7 @@ handle_melt (struct MHD_Connection *connection,
.purpose.size = htonl (sizeof (body)), .purpose.size = htonl (sizeof (body)),
.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT), .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT),
.rc = rmc->refresh_session.rc, .rc = rmc->refresh_session.rc,
.h_denom_pub = rmc->refresh_session.coin.denom_pub_hash,
.coin_pub = rmc->refresh_session.coin.coin_pub .coin_pub = rmc->refresh_session.coin.coin_pub
}; };

View File

@ -131,6 +131,7 @@ TEH_RESPONSE_compile_transaction_history (
.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT), .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT),
.purpose.size = htonl (sizeof (ms)), .purpose.size = htonl (sizeof (ms)),
.rc = melt->rc, .rc = melt->rc,
.h_denom_pub = melt->h_denom_pub,
.coin_pub = *coin_pub .coin_pub = *coin_pub
}; };

View File

@ -586,9 +586,8 @@ struct TALER_RefreshMeltCoinAffirmationPS
/** /**
* Hash over the denomination public key used to sign the coin. * Hash over the denomination public key used to sign the coin.
* FIXME: add here, initialize everywhere!
*/ */
// struct GNUNET_HashCode h_denom_pub GNUNET_PACKED; struct GNUNET_HashCode h_denom_pub GNUNET_PACKED;
/** /**
* How much of the value of the coin should be melted? This amount * How much of the value of the coin should be melted? This amount

View File

@ -586,6 +586,8 @@ TALER_EXCHANGE_verify_coin_history (
&sig), &sig),
GNUNET_JSON_spec_fixed_auto ("rc", GNUNET_JSON_spec_fixed_auto ("rc",
&rm.rc), &rm.rc),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&rm.h_denom_pub),
TALER_JSON_spec_amount_nbo ("melt_fee", TALER_JSON_spec_amount_nbo ("melt_fee",
&rm.melt_fee), &rm.melt_fee),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()

View File

@ -392,9 +392,11 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
struct GNUNET_CURL_Context *ctx; struct GNUNET_CURL_Context *ctx;
struct MeltData *md; struct MeltData *md;
struct TALER_CoinSpendSignatureP confirm_sig; struct TALER_CoinSpendSignatureP confirm_sig;
struct TALER_RefreshMeltCoinAffirmationPS melt;
struct GNUNET_HashCode h_denom_pub;
char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32]; char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32];
struct TALER_RefreshMeltCoinAffirmationPS melt = {
.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT),
.purpose.size = htonl (sizeof (melt)),
};
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
TEAH_handle_is_ready (exchange)); TEAH_handle_is_ready (exchange));
@ -405,9 +407,6 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_break (0); GNUNET_break (0);
return NULL; return NULL;
} }
melt.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
melt.purpose.size = htonl (sizeof (struct
TALER_RefreshMeltCoinAffirmationPS));
melt.rc = md->rc; melt.rc = md->rc;
TALER_amount_hton (&melt.amount_with_fee, TALER_amount_hton (&melt.amount_with_fee,
&md->melted_coin.melt_amount_with_fee); &md->melted_coin.melt_amount_with_fee);
@ -415,16 +414,16 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
&md->melted_coin.fee_melt); &md->melted_coin.fee_melt);
GNUNET_CRYPTO_eddsa_key_get_public (&md->melted_coin.coin_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&md->melted_coin.coin_priv.eddsa_priv,
&melt.coin_pub.eddsa_pub); &melt.coin_pub.eddsa_pub);
GNUNET_CRYPTO_rsa_public_key_hash (md->melted_coin.pub_key.rsa_public_key,
&melt.h_denom_pub);
GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv,
&melt, &melt,
&confirm_sig.eddsa_signature); &confirm_sig.eddsa_signature);
GNUNET_CRYPTO_rsa_public_key_hash (md->melted_coin.pub_key.rsa_public_key,
&h_denom_pub);
melt_obj = json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o}", melt_obj = json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o}",
"coin_pub", "coin_pub",
GNUNET_JSON_from_data_auto (&melt.coin_pub), GNUNET_JSON_from_data_auto (&melt.coin_pub),
"denom_pub_hash", "denom_pub_hash",
GNUNET_JSON_from_data_auto (&h_denom_pub), GNUNET_JSON_from_data_auto (&melt.h_denom_pub),
"denom_sig", "denom_sig",
GNUNET_JSON_from_rsa_signature ( GNUNET_JSON_from_rsa_signature (
md->melted_coin.sig.rsa_signature), md->melted_coin.sig.rsa_signature),