aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_helper_rsa.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-14 16:04:32 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-14 16:04:40 +0100
commit1a1fafbd438f3f21a15c990d904e192b045d2391 (patch)
treecdd32023fd1d7c530caeae0487528d7eaac2aa29 /src/util/test_helper_rsa.c
parentbf54ee30d4727217264f470321cc2f91facf63cc (diff)
downloadexchange-1a1fafbd438f3f21a15c990d904e192b045d2391.tar.xz
introducing GNUNET_TIME_Timestamp, recoup now with amounts
Diffstat (limited to 'src/util/test_helper_rsa.c')
-rw-r--r--src/util/test_helper_rsa.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c
index bafa45ba8..ac4ae1dc0 100644
--- a/src/util/test_helper_rsa.c
+++ b/src/util/test_helper_rsa.c
@@ -64,7 +64,7 @@ struct KeyData
/**
* Validity start point.
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* Key expires for signing at @e start_time plus this value.
@@ -137,7 +137,7 @@ free_keys (void)
static void
key_cb (void *cls,
const char *section_name,
- struct GNUNET_TIME_Absolute start_time,
+ struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Relative validity_duration,
const struct TALER_RsaPubHashP *h_rsa,
const struct TALER_DenominationPublicKey *denom_pub,
@@ -297,15 +297,19 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh)
switch (ec)
{
case TALER_EC_NONE:
- if (GNUNET_TIME_absolute_get_remaining (keys[i].start_time).rel_value_us >
- GNUNET_TIME_UNIT_SECONDS.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_remaining (
+ keys[i].start_time.abs_time),
+ >,
+ GNUNET_TIME_UNIT_SECONDS))
{
/* key worked too early */
GNUNET_break (0);
return 4;
}
- if (GNUNET_TIME_absolute_get_duration (keys[i].start_time).rel_value_us >
- keys[i].validity_duration.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_duration (
+ keys[i].start_time.abs_time),
+ >,
+ keys[i].validity_duration))
{
/* key worked too later */
GNUNET_break (0);
@@ -344,12 +348,14 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh)
case TALER_EC_EXCHANGE_DENOMINATION_HELPER_TOO_EARLY:
/* This 'failure' is expected, we're testing also for the
error handling! */
- if ( (0 ==
- GNUNET_TIME_absolute_get_remaining (
- keys[i].start_time).rel_value_us) &&
- (GNUNET_TIME_absolute_get_duration (
- keys[i].start_time).rel_value_us <
- keys[i].validity_duration.rel_value_us) )
+ if ( (GNUNET_TIME_relative_is_zero (
+ GNUNET_TIME_absolute_get_remaining (
+ keys[i].start_time.abs_time))) &&
+ (GNUNET_TIME_relative_cmp (
+ GNUNET_TIME_absolute_get_duration (
+ keys[i].start_time.abs_time),
+ <,
+ keys[i].validity_duration)) )
{
/* key should have worked! */
GNUNET_break (0);
@@ -422,11 +428,15 @@ perf_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh,
{
if (! keys[i].valid)
continue;
- if (GNUNET_TIME_absolute_get_remaining (keys[i].start_time).rel_value_us >
- GNUNET_TIME_UNIT_SECONDS.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_remaining (
+ keys[i].start_time.abs_time),
+ >,
+ GNUNET_TIME_UNIT_SECONDS))
continue;
- if (GNUNET_TIME_absolute_get_duration (keys[i].start_time).rel_value_us >
- keys[i].validity_duration.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_duration (
+ keys[i].start_time.abs_time),
+ >,
+ keys[i].validity_duration))
continue;
{
struct TALER_CoinPubHash c_hash;