diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-02-17 15:10:14 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-02-17 15:18:09 +0100 |
commit | a351bfc4b4ca15ce7fd998cf9691e85cf84dc426 (patch) | |
tree | 88ec3b739914739f05d4c8cae2a2af40d29ebf82 /src/util/util.c | |
parent | 8bdf6ab19df70c16d335ecf82f2c3b2117eeb70e (diff) |
-fix CS nonce reuse check logic
Diffstat (limited to 'src/util/util.c')
-rw-r--r-- | src/util/util.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/util/util.c b/src/util/util.c index 2ff295b0..5b7181a1 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -46,6 +46,73 @@ TALER_b2s (const void *buf, } +void +TALER_denom_fee_set_hton (struct TALER_DenomFeeSetNBOP *nbo, + const struct TALER_DenomFeeSet *fees) +{ + TALER_amount_hton (&nbo->withdraw, + &fees->withdraw); + TALER_amount_hton (&nbo->deposit, + &fees->deposit); + TALER_amount_hton (&nbo->refresh, + &fees->refresh); + TALER_amount_hton (&nbo->refund, + &fees->refund); +} + + +void +TALER_denom_fee_set_ntoh (struct TALER_DenomFeeSet *fees, + const struct TALER_DenomFeeSetNBOP *nbo) +{ + TALER_amount_ntoh (&fees->withdraw, + &nbo->withdraw); + TALER_amount_ntoh (&fees->deposit, + &nbo->deposit); + TALER_amount_ntoh (&fees->refresh, + &nbo->refresh); + TALER_amount_ntoh (&fees->refund, + &nbo->refund); +} + + +enum GNUNET_GenericReturnValue +TALER_denom_fee_check_currency ( + const char *currency, + const struct TALER_DenomFeeSet *fees) +{ + if (GNUNET_YES != + TALER_amount_is_currency (&fees->withdraw, + currency)) + { + GNUNET_break (0); + return GNUNET_NO; + } + if (GNUNET_YES != + TALER_amount_is_currency (&fees->deposit, + currency)) + { + GNUNET_break (0); + return GNUNET_NO; + } + if (GNUNET_YES != + TALER_amount_is_currency (&fees->refresh, + currency)) + { + GNUNET_break (0); + return GNUNET_NO; + } + if (GNUNET_YES != + TALER_amount_is_currency (&fees->refund, + currency)) + { + GNUNET_break (0); + return GNUNET_NO; + } + return GNUNET_OK; +} + + #ifdef __APPLE__ char * strchrnul (const char *s, |