summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/exchange_api_deposit.c13
-rw-r--r--src/lib/exchange_api_handle.c2
-rw-r--r--src/lib/exchange_api_payback.c5
-rw-r--r--src/lib/exchange_api_refresh.c7
-rw-r--r--src/lib/exchange_api_reserve.c11
5 files changed, 27 insertions, 11 deletions
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 3f72ad95..4033cc2e 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -359,6 +359,7 @@ handle_deposit_finished (void *cls,
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
* @param coin_pub coin’s public key
* @param denom_pub denomination key with which the coin is signed
+ * @param denom_pub_hash hash of @a denom_pub
* @param denom_sig exchange’s unblinded signature of the coin
* @param timestamp timestamp when the deposit was finalized
* @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests)
@@ -374,6 +375,7 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
+ const struct GNUNET_HashCode *denom_pub_hash,
struct GNUNET_TIME_Absolute timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
struct GNUNET_TIME_Absolute refund_deadline,
@@ -414,10 +416,11 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
/* check coin signature */
coin_info.coin_pub = *coin_pub;
- coin_info.denom_pub = *denom_pub;
+ coin_info.denom_pub_hash = *denom_pub_hash;
coin_info.denom_sig = *denom_sig;
if (GNUNET_YES !=
- TALER_test_coin_valid (&coin_info))
+ TALER_test_coin_valid (&coin_info,
+ denom_pub))
{
GNUNET_break_op (0);
TALER_LOG_WARNING ("Invalid coin passed for /deposit\n");
@@ -489,6 +492,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
json_t *deposit_obj;
CURL *eh;
struct GNUNET_HashCode h_wire;
+ struct GNUNET_HashCode denom_pub_hash;
struct TALER_Amount amount_without_fee;
(void) GNUNET_TIME_round_abs (&wire_deadline);
@@ -512,6 +516,8 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
TALER_amount_subtract (&amount_without_fee,
amount,
&dki->fee_deposit));
+ GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
+ &denom_pub_hash);
if (GNUNET_OK !=
verify_signatures (dki,
amount,
@@ -520,6 +526,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
coin_pub,
denom_sig,
denom_pub,
+ &denom_pub_hash,
timestamp,
merchant_pub,
refund_deadline,
@@ -541,7 +548,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
"H_wire", GNUNET_JSON_from_data_auto (&h_wire),
"h_contract_terms", GNUNET_JSON_from_data_auto (h_contract_terms),
"coin_pub", GNUNET_JSON_from_data_auto (coin_pub),
- "denom_pub", GNUNET_JSON_from_rsa_public_key (denom_pub->rsa_public_key),
+ "denom_pub_hash", GNUNET_JSON_from_data_auto (&denom_pub_hash),
"ub_sig", GNUNET_JSON_from_rsa_signature (denom_sig->rsa_signature),
"timestamp", GNUNET_JSON_from_time_abs (timestamp),
"merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub),
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index cbcde724..93fe798c 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -432,7 +432,7 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key,
*/
static int
parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
- int check_sigs,
+ int check_sigs,
json_t *denom_key_obj,
struct TALER_MasterPublicKeyP *master_key,
struct GNUNET_HashContext *hash_context)
diff --git a/src/lib/exchange_api_payback.c b/src/lib/exchange_api_payback.c
index 6c1772af..b3624f73 100644
--- a/src/lib/exchange_api_payback.c
+++ b/src/lib/exchange_api_payback.c
@@ -280,6 +280,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
struct GNUNET_CURL_Context *ctx;
struct TALER_PaybackRequestPS pr;
struct TALER_CoinSpendSignatureP coin_sig;
+ struct GNUNET_HashCode h_denom_pub;
json_t *payback_obj;
CURL *eh;
@@ -289,6 +290,8 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
pr.purpose.size = htonl (sizeof (struct TALER_PaybackRequestPS));
GNUNET_CRYPTO_eddsa_key_get_public (&ps->coin_priv.eddsa_priv,
&pr.coin_pub.eddsa_pub);
+ GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key,
+ &h_denom_pub);
pr.h_denom_pub = pk->h_key;
pr.coin_blind = ps->blinding_key;
GNUNET_assert (GNUNET_OK ==
@@ -299,7 +302,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
payback_obj = json_pack ("{s:o, s:o," /* denom pub/sig */
" s:o, s:o," /* coin pub/sig */
" s:o}", /* coin_bks */
- "denom_pub", GNUNET_JSON_from_rsa_public_key (pk->key.rsa_public_key),
+ "denom_pub_hash", GNUNET_JSON_from_data_auto (&h_denom_pub),
"denom_sig", GNUNET_JSON_from_rsa_signature (denom_sig->rsa_signature),
"coin_pub", GNUNET_JSON_from_data_auto (&pr.coin_pub),
"coin_sig", GNUNET_JSON_from_data_auto (&coin_sig),
diff --git a/src/lib/exchange_api_refresh.c b/src/lib/exchange_api_refresh.c
index 230f445e..4b2de2f4 100644
--- a/src/lib/exchange_api_refresh.c
+++ b/src/lib/exchange_api_refresh.c
@@ -1151,6 +1151,7 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
struct MeltData *md;
struct TALER_CoinSpendSignatureP confirm_sig;
struct TALER_RefreshMeltCoinAffirmationPS melt;
+ struct GNUNET_HashCode h_denom_pub;
GNUNET_assert (GNUNET_YES ==
TEAH_handle_is_ready (exchange));
@@ -1174,11 +1175,13 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv,
&melt.purpose,
&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",
- GNUNET_JSON_from_rsa_public_key (md->melted_coin.pub_key.rsa_public_key),
+ "denom_pub_hash",
+ GNUNET_JSON_from_data_auto (&h_denom_pub),
"denom_sig",
GNUNET_JSON_from_rsa_signature (md->melted_coin.sig.rsa_signature),
"confirm_sig",
diff --git a/src/lib/exchange_api_reserve.c b/src/lib/exchange_api_reserve.c
index 4aa5794f..66509bc5 100644
--- a/src/lib/exchange_api_reserve.c
+++ b/src/lib/exchange_api_reserve.c
@@ -187,8 +187,8 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,
struct GNUNET_JSON_Specification withdraw_spec[] = {
GNUNET_JSON_spec_fixed_auto ("reserve_sig",
&sig),
- TALER_JSON_spec_amount_nbo ("withdraw_fee",
- &withdraw_purpose.withdraw_fee),
+ TALER_JSON_spec_amount_nbo ("withdraw_fee",
+ &withdraw_purpose.withdraw_fee),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&withdraw_purpose.h_denomination_pub),
GNUNET_JSON_spec_fixed_auto ("h_coin_envelope",
@@ -1001,6 +1001,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
struct GNUNET_CURL_Context *ctx;
json_t *withdraw_obj;
CURL *eh;
+ struct GNUNET_HashCode h_denom_pub;
wsh = GNUNET_new (struct TALER_EXCHANGE_ReserveWithdrawHandle);
wsh->exchange = exchange;
@@ -1009,9 +1010,11 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
wsh->pk = pk;
wsh->reserve_pub = *reserve_pub;
wsh->c_hash = pd->c_hash;
- withdraw_obj = json_pack ("{s:o, s:o," /* denom_pub and coin_ev */
+ GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key,
+ &h_denom_pub);
+ withdraw_obj = json_pack ("{s:o, s:o," /* denom_pub_hash and coin_ev */
" s:o, s:o}",/* reserve_pub and reserve_sig */
- "denom_pub", GNUNET_JSON_from_rsa_public_key (pk->key.rsa_public_key),
+ "denom_pub_hash", GNUNET_JSON_from_data_auto (&h_denom_pub),
"coin_ev", GNUNET_JSON_from_data (pd->coin_ev,
pd->coin_ev_size),
"reserve_pub", GNUNET_JSON_from_data_auto (reserve_pub),