diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/perf_crypto_asymmetric.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/util/perf_crypto_asymmetric.c b/src/util/perf_crypto_asymmetric.c index cb4827509..5d82759cc 100644 --- a/src/util/perf_crypto_asymmetric.c +++ b/src/util/perf_crypto_asymmetric.c | |||
@@ -27,17 +27,21 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include <gauger.h> | 28 | #include <gauger.h> |
29 | 29 | ||
30 | struct GNUNET_TIME_Absolute start; | 30 | static struct GNUNET_TIME_Absolute start; |
31 | const int l = 50; | ||
32 | 31 | ||
33 | struct TestSig { | 32 | #define l 50 |
33 | |||
34 | struct TestSig | ||
35 | { | ||
34 | struct GNUNET_CRYPTO_EccSignaturePurpose purp; | 36 | struct GNUNET_CRYPTO_EccSignaturePurpose purp; |
35 | struct GNUNET_HashCode h; | 37 | struct GNUNET_HashCode h; |
36 | struct GNUNET_CRYPTO_EddsaSignature sig; | 38 | struct GNUNET_CRYPTO_EddsaSignature sig; |
37 | }; | 39 | }; |
38 | 40 | ||
41 | |||
39 | static void | 42 | static void |
40 | log_duration (const char *system, const char *description) | 43 | log_duration (const char *system, |
44 | const char *description) | ||
41 | { | 45 | { |
42 | struct GNUNET_TIME_Relative t; | 46 | struct GNUNET_TIME_Relative t; |
43 | char s[64]; | 47 | char s[64]; |
@@ -45,12 +49,15 @@ log_duration (const char *system, const char *description) | |||
45 | sprintf (s, "%6s %15s", system, description); | 49 | sprintf (s, "%6s %15s", system, description); |
46 | t = GNUNET_TIME_absolute_get_duration (start); | 50 | t = GNUNET_TIME_absolute_get_duration (start); |
47 | t = GNUNET_TIME_relative_divide (t, l); | 51 | t = GNUNET_TIME_relative_divide (t, l); |
48 | FPRINTF (stdout, "%s: %10s\n", s, | 52 | FPRINTF (stdout, |
49 | GNUNET_STRINGS_relative_time_to_string(t, GNUNET_NO)); | 53 | "%s: %10s\n", |
50 | 54 | s, | |
55 | GNUNET_STRINGS_relative_time_to_string (t, | ||
56 | GNUNET_NO)); | ||
51 | GAUGER ("UTIL", s, t.rel_value_us, "us"); | 57 | GAUGER ("UTIL", s, t.rel_value_us, "us"); |
52 | } | 58 | } |
53 | 59 | ||
60 | |||
54 | int | 61 | int |
55 | main (int argc, char *argv[]) | 62 | main (int argc, char *argv[]) |
56 | { | 63 | { |
@@ -103,7 +110,7 @@ main (int argc, char *argv[]) | |||
103 | log_duration ("ECDH", "get public"); | 110 | log_duration ("ECDH", "get public"); |
104 | 111 | ||
105 | start = GNUNET_TIME_absolute_get(); | 112 | start = GNUNET_TIME_absolute_get(); |
106 | for (i = 0; i < l; i+=2) | 113 | for (i = 0; i < l - 1; i+=2) |
107 | { | 114 | { |
108 | GNUNET_CRYPTO_ecc_ecdh (ecdhe[i], &dhpub[i+1], &sig[i].h); | 115 | GNUNET_CRYPTO_ecc_ecdh (ecdhe[i], &dhpub[i+1], &sig[i].h); |
109 | GNUNET_CRYPTO_ecc_ecdh (ecdhe[i+1], &dhpub[i], &sig[i+i].h); | 116 | GNUNET_CRYPTO_ecc_ecdh (ecdhe[i+1], &dhpub[i], &sig[i+i].h); |