diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-17 14:09:58 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-17 14:09:58 +0100 |
commit | 06c23275587272873b49801648c7fb52331fbdf9 (patch) | |
tree | cdeb7a0a7c5fafbdb58099620c93b00b8a44b01b /src/auditor | |
parent | 2d7d658e8b488bb155d977507bee31a1f95b912d (diff) | |
download | exchange-06c23275587272873b49801648c7fb52331fbdf9.tar.xz |
verify deposit signature during audit
Diffstat (limited to 'src/auditor')
-rw-r--r-- | src/auditor/Makefile.am | 1 | ||||
-rw-r--r-- | src/auditor/taler-auditor.c | 32 |
2 files changed, 32 insertions, 1 deletions
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am index c5d55a479..04e7dcb8f 100644 --- a/src/auditor/Makefile.am +++ b/src/auditor/Makefile.am @@ -20,6 +20,7 @@ taler_auditor_SOURCES = \ taler_auditor_LDADD = \ $(LIBGCRYPT_LIBS) \ $(top_builddir)/src/util/libtalerutil.la \ + $(top_builddir)/src/json/libtalerjson.la \ $(top_builddir)/src/wire/libtalerwire.la \ $(top_builddir)/src/exchangedb/libtalerexchangedb.la \ $(top_builddir)/src/auditordb/libtalerauditordb.la \ diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index f79589776..c018a714b 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c @@ -1425,6 +1425,7 @@ refresh_session_cb (void *cls, * * @param cls closure * @param rowid unique serial ID for the deposit in our DB + * @param timestamp when did the deposit happen * @param merchant_pub public key of the merchant * @param coin_pub public key of the coin * @param coin_sig signature from the coin @@ -1441,6 +1442,7 @@ refresh_session_cb (void *cls, static int deposit_cb (void *cls, uint64_t rowid, + struct GNUNET_TIME_Absolute timestamp, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig, @@ -1454,6 +1456,7 @@ deposit_cb (void *cls, struct CoinContext *cc = cls; struct CoinSummary *cs; const struct TALER_EXCHANGEDB_DenominationKeyInformationP *dki; + struct TALER_DepositRequestPS dr; cs = get_coin_summary (cc, coin_pub); @@ -1464,7 +1467,34 @@ deposit_cb (void *cls, } dki = cs->dki; - // TODO: verify signature + dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT); + dr.purpose.size = htonl (sizeof (dr)); + dr.h_proposal_data = *h_proposal_data; + if (GNUNET_OK != + TALER_JSON_hash (receiver_wire_account, + &dr.h_wire)) + { + GNUNET_break (0); + return GNUNET_SYSERR; + } + dr.timestamp = GNUNET_TIME_absolute_hton (timestamp); + dr.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline); + TALER_amount_hton (&dr.amount_with_fee, + amount_with_fee); + dr.deposit_fee = dki->properties.fee_deposit; + dr.merchant = *merchant_pub; + dr.coin_pub = *coin_pub; + if (GNUNET_OK != + GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT, + &dr.purpose, + &coin_sig->eddsa_signature, + &coin_pub->eddsa_pub)) + { + report_row_inconsistency ("deposit", + rowid, + "invalid signature for coin deposit"); + return GNUNET_OK; + } // TODO: update expected amounts in 'cc' return GNUNET_OK; |