summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_payback.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-29 16:42:38 +0200
committerChristian Grothoff <christian@grothoff.org>2017-03-29 16:42:38 +0200
commit21d26132877990d7beac118b33e336aaed395234 (patch)
treed970f8115b00b5125ffc4aef89c0a2dd721c0ee8 /src/exchange/taler-exchange-httpd_payback.c
parent5aebc70da6524d3b27ad4f93a66ba70dbe64fab1 (diff)
downloadexchange-21d26132877990d7beac118b33e336aaed395234.tar.gz
exchange-21d26132877990d7beac118b33e336aaed395234.tar.bz2
exchange-21d26132877990d7beac118b33e336aaed395234.zip
first sketch at db module implementation for #3887
Diffstat (limited to 'src/exchange/taler-exchange-httpd_payback.c')
-rw-r--r--src/exchange/taler-exchange-httpd_payback.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/exchange/taler-exchange-httpd_payback.c b/src/exchange/taler-exchange-httpd_payback.c
index 2b33112d3..31235729e 100644
--- a/src/exchange/taler-exchange-httpd_payback.c
+++ b/src/exchange/taler-exchange-httpd_payback.c
@@ -56,7 +56,11 @@ verify_and_execute_payback (struct MHD_Connection *connection,
struct TEH_KS_StateHandle *key_state;
const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
struct TALER_PaybackRequestPS pr;
-
+ struct TALER_Amount value;
+ struct GNUNET_HashCode h_blind;
+ struct GNUNET_HashCode c_hash;
+ char *coin_ev;
+ size_t coin_ev_size;
/* check denomination exists and is in payback mode */
key_state = TEH_KS_acquire ();
@@ -71,6 +75,8 @@ verify_and_execute_payback (struct MHD_Connection *connection,
TALER_EC_PAYBACK_DENOMINATION_KEY_UNKNOWN,
"denom_pub");
}
+ TALER_amount_ntoh (&value,
+ &dki->issue.properties.value);
/* check denomination signature */
if (GNUNET_YES !=
@@ -104,9 +110,30 @@ verify_and_execute_payback (struct MHD_Connection *connection,
"coin_sig");
}
+ GNUNET_CRYPTO_hash (&coin->coin_pub.eddsa_pub,
+ sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey),
+ &c_hash);
+ if (GNUNET_YES !=
+ GNUNET_CRYPTO_rsa_blind (&c_hash,
+ &coin_bks->bks,
+ coin->denom_pub.rsa_public_key,
+ &coin_ev,
+ &coin_ev_size))
+ {
+ GNUNET_break (0);
+ return TEH_RESPONSE_reply_internal_error (connection,
+ TALER_EC_PAYBACK_BLINDING_FAILED,
+ "coin_bks");
+ }
+ GNUNET_CRYPTO_hash (coin_ev,
+ coin_ev_size,
+ &h_blind);
+ GNUNET_free (coin_ev);
+
return TEH_DB_execute_payback (connection,
coin,
- coin_bks,
+ &value,
+ &h_blind,
coin_sig);
}