aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/exchange-tools/taler-exchange-keyup.c7
-rw-r--r--src/exchangedb/exchangedb_fees.c12
-rw-r--r--src/exchangedb/test_exchangedb_fees.c7
-rw-r--r--src/include/taler_exchangedb_lib.h6
-rw-r--r--src/include/taler_signatures.h7
5 files changed, 33 insertions, 6 deletions
diff --git a/src/exchange-tools/taler-exchange-keyup.c b/src/exchange-tools/taler-exchange-keyup.c
index c3e58db9c..29ccd449e 100644
--- a/src/exchange-tools/taler-exchange-keyup.c
+++ b/src/exchange-tools/taler-exchange-keyup.c
@@ -878,15 +878,18 @@ exchange_keys_update_denomkeys ()
* Sign @a af with @a priv
*
* @param[in|out] af fee structure to sign
+ * @param wireplugin name of the plugin for which we sign
* @param priv private key to use for signing
*/
static void
sign_af (struct TALER_EXCHANGEDB_AggregateFees *af,
+ const char *wireplugin,
const struct GNUNET_CRYPTO_EddsaPrivateKey *priv)
{
struct TALER_MasterWireFeePS wf;
- TALER_EXCHANGEDB_fees_2_wf (af,
+ TALER_EXCHANGEDB_fees_2_wf (wireplugin,
+ af,
&wf);
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (priv,
@@ -980,6 +983,7 @@ create_wire_fee_for_method (void *cls,
GNUNET_free (amounts);
GNUNET_free (opt);
sign_af (af,
+ wiremethod,
&master_priv.eddsa_priv);
if (NULL == af_tail)
af_head = af;
@@ -992,6 +996,7 @@ create_wire_fee_for_method (void *cls,
if ( (GNUNET_OK == *ret) &&
(GNUNET_OK !=
TALER_EXCHANGEDB_fees_write (fn,
+ wiremethod,
af_head)) )
*ret = GNUNET_SYSERR;
GNUNET_free (section);
diff --git a/src/exchangedb/exchangedb_fees.c b/src/exchangedb/exchangedb_fees.c
index 5adee5d41..e3e16712d 100644
--- a/src/exchangedb/exchangedb_fees.c
+++ b/src/exchangedb/exchangedb_fees.c
@@ -142,17 +142,22 @@ TALER_EXCHANGEDB_fees_read (const struct GNUNET_CONFIGURATION_Handle *cfg,
/**
* Convert @a af to @a wf.
*
+ * @param wireplugin name of the wire plugin the fees are for
* @param[in,out] af aggregate fees, host format (updated to round time)
* @param[out] wf aggregate fees, disk / signature format
*/
void
-TALER_EXCHANGEDB_fees_2_wf (struct TALER_EXCHANGEDB_AggregateFees *af,
+TALER_EXCHANGEDB_fees_2_wf (const char *wireplugin,
+ struct TALER_EXCHANGEDB_AggregateFees *af,
struct TALER_MasterWireFeePS *wf)
{
(void) GNUNET_TIME_round_abs (&af->start_date);
(void) GNUNET_TIME_round_abs (&af->end_date);
wf->purpose.size = htonl (sizeof (*wf));
wf->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES);
+ GNUNET_CRYPTO_hash (wireplugin,
+ strlen (wireplugin) + 1,
+ &wf->h_wire_method);
wf->start_date = GNUNET_TIME_absolute_hton (af->start_date);
wf->end_date = GNUNET_TIME_absolute_hton (af->end_date);
TALER_amount_hton (&wf->wire_fee,
@@ -164,11 +169,13 @@ TALER_EXCHANGEDB_fees_2_wf (struct TALER_EXCHANGEDB_AggregateFees *af,
* Write given fee structure to disk.
*
* @param filename where to write the fees
+ * @param wireplugin which plugin the fees are about
* @param af fee structure to write
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
TALER_EXCHANGEDB_fees_write (const char *filename,
+ const char *wireplugin,
struct TALER_EXCHANGEDB_AggregateFees *af)
{
struct GNUNET_DISK_FileHandle *fh;
@@ -201,7 +208,8 @@ TALER_EXCHANGEDB_fees_write (const char *filename,
GNUNET_DISK_file_close (fh));
return GNUNET_SYSERR;
}
- TALER_EXCHANGEDB_fees_2_wf (af,
+ TALER_EXCHANGEDB_fees_2_wf (wireplugin,
+ af,
&wd.wf);
wd.master_sig = af->master_sig;
af = af->next;
diff --git a/src/exchangedb/test_exchangedb_fees.c b/src/exchangedb/test_exchangedb_fees.c
index b82abc5fd..2bee77452 100644
--- a/src/exchangedb/test_exchangedb_fees.c
+++ b/src/exchangedb/test_exchangedb_fees.c
@@ -36,7 +36,8 @@ sign_af (struct TALER_EXCHANGEDB_AggregateFees *af,
{
struct TALER_MasterWireFeePS wf;
- TALER_EXCHANGEDB_fees_2_wf (af,
+ TALER_EXCHANGEDB_fees_2_wf ("test",
+ af,
&wf);
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (priv,
@@ -99,6 +100,7 @@ main (int argc,
if (GNUNET_OK !=
TALER_EXCHANGEDB_fees_write (tmpfile,
+ "test",
af))
{
GNUNET_break (0);
@@ -121,7 +123,8 @@ main (int argc,
{
struct TALER_MasterWireFeePS wf;
- TALER_EXCHANGEDB_fees_2_wf (p,
+ TALER_EXCHANGEDB_fees_2_wf ("test",
+ p,
&wf);
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_WIRE_FEES,
diff --git a/src/include/taler_exchangedb_lib.h b/src/include/taler_exchangedb_lib.h
index 02e8cdfec..e4057470f 100644
--- a/src/include/taler_exchangedb_lib.h
+++ b/src/include/taler_exchangedb_lib.h
@@ -345,11 +345,13 @@ TALER_EXCHANGEDB_fees_read (const struct GNUNET_CONFIGURATION_Handle *cfg,
/**
* Convert @a af to @a wf.
*
+ * @param wireplugin name of the wire plugin the fees are for
* @param[in,out] af aggregate fees, host format (updated to round time)
* @param[out] wf aggregate fees, disk / signature format
*/
void
-TALER_EXCHANGEDB_fees_2_wf (struct TALER_EXCHANGEDB_AggregateFees *af,
+TALER_EXCHANGEDB_fees_2_wf (const char *wireplugin,
+ struct TALER_EXCHANGEDB_AggregateFees *af,
struct TALER_MasterWireFeePS *wf);
@@ -357,11 +359,13 @@ TALER_EXCHANGEDB_fees_2_wf (struct TALER_EXCHANGEDB_AggregateFees *af,
* Write given fee structure to disk.
*
* @param filename where to write the fees
+ * @param wireplugin name of the plugin for which we write the fees
* @param af fee structure to write
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
TALER_EXCHANGEDB_fees_write (const char *filename,
+ const char *wireplugin,
struct TALER_EXCHANGEDB_AggregateFees *af);
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 8659deb3a..ac20f3447 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -898,6 +898,13 @@ struct TALER_MasterWireFeePS
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/**
+ * Hash over the wire method (yes, H("test") or H("sepa")), in lower
+ * case, including 0-terminator. Used to uniquely identify which
+ * wire method these fees apply to.
+ */
+ struct GNUNET_HashCode h_wire_method;
+
+ /**
* Start date when the fee goes into effect.
*/
struct GNUNET_TIME_AbsoluteNBO start_date;