summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-07-08 17:58:45 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-08 17:59:05 +0200
commit8e03498a487d3d00c20167dc19c24f9a0fe1a647 (patch)
treeab0955d0d1b88b319a24c5c12bd91dc17b401564 /src
parent97dfbec0811b1a0b92618f195e228c43376e4828 (diff)
downloadexchange-8e03498a487d3d00c20167dc19c24f9a0fe1a647.tar.gz
exchange-8e03498a487d3d00c20167dc19c24f9a0fe1a647.tar.bz2
exchange-8e03498a487d3d00c20167dc19c24f9a0fe1a647.zip
add h_denom to melt signatures (for #6416)
Diffstat (limited to 'src')
-rw-r--r--src/auditor/taler-helper-auditor-coins.c4
-rw-r--r--src/exchange/taler-exchange-httpd_melt.c1
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c1
-rw-r--r--src/include/taler_signatures.h3
-rw-r--r--src/lib/exchange_api_common.c2
-rw-r--r--src/lib/exchange_api_melt.c15
6 files changed, 16 insertions, 10 deletions
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index 1a03ac72..b9352177 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -1283,6 +1283,8 @@ refresh_session_cb (void *cls,
.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,
amount_with_fee);
if (GNUNET_OK !=
@@ -1620,6 +1622,8 @@ deposit_cb (void *cls,
.coin_pub = *coin_pub
};
+ GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
+ &dr.h_denom_pub);
if (GNUNET_OK !=
TALER_JSON_merchant_wire_signature_hash (receiver_wire_account,
&dr.h_wire))
diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c
index 3a0195cf..2eab4b4a 100644
--- a/src/exchange/taler-exchange-httpd_melt.c
+++ b/src/exchange/taler-exchange-httpd_melt.c
@@ -380,6 +380,7 @@ handle_melt (struct MHD_Connection *connection,
.purpose.size = htonl (sizeof (body)),
.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT),
.rc = rmc->refresh_session.rc,
+ .h_denom_pub = rmc->refresh_session.coin.denom_pub_hash,
.coin_pub = rmc->refresh_session.coin.coin_pub
};
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index ee65cd6e..97983295 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -131,6 +131,7 @@ TEH_RESPONSE_compile_transaction_history (
.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT),
.purpose.size = htonl (sizeof (ms)),
.rc = melt->rc,
+ .h_denom_pub = melt->h_denom_pub,
.coin_pub = *coin_pub
};
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 81e2e1c8..3e4b893f 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -586,9 +586,8 @@ struct TALER_RefreshMeltCoinAffirmationPS
/**
* 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
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 27dbbb86..17be0d51 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -586,6 +586,8 @@ TALER_EXCHANGE_verify_coin_history (
&sig),
GNUNET_JSON_spec_fixed_auto ("rc",
&rm.rc),
+ GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
+ &rm.h_denom_pub),
TALER_JSON_spec_amount_nbo ("melt_fee",
&rm.melt_fee),
GNUNET_JSON_spec_end ()
diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c
index 0695f997..1ef83bf7 100644
--- a/src/lib/exchange_api_melt.c
+++ b/src/lib/exchange_api_melt.c
@@ -392,9 +392,11 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
struct GNUNET_CURL_Context *ctx;
struct MeltData *md;
struct TALER_CoinSpendSignatureP confirm_sig;
- struct TALER_RefreshMeltCoinAffirmationPS melt;
- struct GNUNET_HashCode h_denom_pub;
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 ==
TEAH_handle_is_ready (exchange));
@@ -405,9 +407,6 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_break (0);
return NULL;
}
- melt.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
- melt.purpose.size = htonl (sizeof (struct
- TALER_RefreshMeltCoinAffirmationPS));
melt.rc = md->rc;
TALER_amount_hton (&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);
GNUNET_CRYPTO_eddsa_key_get_public (&md->melted_coin.coin_priv.eddsa_priv,
&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,
&melt,
&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}",
"coin_pub",
GNUNET_JSON_from_data_auto (&melt.coin_pub),
"denom_pub_hash",
- GNUNET_JSON_from_data_auto (&h_denom_pub),
+ GNUNET_JSON_from_data_auto (&melt.h_denom_pub),
"denom_sig",
GNUNET_JSON_from_rsa_signature (
md->melted_coin.sig.rsa_signature),