diff options
Diffstat (limited to 'src/util/test_crypto_ecdsa.c')
-rw-r--r-- | src/util/test_crypto_ecdsa.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/util/test_crypto_ecdsa.c b/src/util/test_crypto_ecdsa.c index 27c0fb137..bf5fcf571 100644 --- a/src/util/test_crypto_ecdsa.c +++ b/src/util/test_crypto_ecdsa.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | #define ITER 25 | 31 | #define ITER 25 |
32 | 32 | ||
33 | #define PERF GNUNET_YES | 33 | #define PERF GNUNET_NO |
34 | 34 | ||
35 | 35 | ||
36 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *key; | 36 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *key; |
@@ -54,7 +54,7 @@ testSignVerify () | |||
54 | 54 | ||
55 | for (i = 0; i < ITER; i++) | 55 | for (i = 0; i < ITER; i++) |
56 | { | 56 | { |
57 | FPRINTF (stderr, "%s", "."); | 57 | FPRINTF (stderr, "%s", "."); fflush (stderr); |
58 | if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_sign (key, &purp, &sig)) | 58 | if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_sign (key, &purp, &sig)) |
59 | { | 59 | { |
60 | FPRINTF (stderr, | 60 | FPRINTF (stderr, |
@@ -156,7 +156,7 @@ testSignPerformance () | |||
156 | start = GNUNET_TIME_absolute_get (); | 156 | start = GNUNET_TIME_absolute_get (); |
157 | for (i = 0; i < ITER; i++) | 157 | for (i = 0; i < ITER; i++) |
158 | { | 158 | { |
159 | FPRINTF (stderr, "%s", "."); | 159 | FPRINTF (stderr, "%s", "."); fflush (stderr); |
160 | if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_sign (key, &purp, &sig)) | 160 | if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_sign (key, &purp, &sig)) |
161 | { | 161 | { |
162 | FPRINTF (stderr, "%s", | 162 | FPRINTF (stderr, "%s", |
@@ -180,15 +180,18 @@ perf_keygen () | |||
180 | struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; | 180 | struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; |
181 | int i; | 181 | int i; |
182 | 182 | ||
183 | FPRINTF (stderr, "%s", "W"); | ||
183 | start = GNUNET_TIME_absolute_get (); | 184 | start = GNUNET_TIME_absolute_get (); |
184 | for (i=0;i<10;i++) | 185 | for (i=0;i<10;i++) |
185 | { | 186 | { |
186 | fprintf (stderr, "."); | 187 | fprintf (stderr, "."); fflush (stderr); |
187 | pk = GNUNET_CRYPTO_ecdsa_key_create (); | 188 | pk = GNUNET_CRYPTO_ecdsa_key_create (); |
188 | GNUNET_free (pk); | 189 | GNUNET_free (pk); |
189 | } | 190 | } |
190 | fprintf (stderr, "\n"); | 191 | for (;i<25;i++) |
191 | printf ("Creating 10 ECDSA keys took %s\n", | 192 | fprintf (stderr, "."); |
193 | fflush (stderr); | ||
194 | printf ("10 ECDSA keys created in %s\n", | ||
192 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES)); | 195 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES)); |
193 | } | 196 | } |
194 | 197 | ||
@@ -198,14 +201,16 @@ main (int argc, char *argv[]) | |||
198 | { | 201 | { |
199 | int failure_count = 0; | 202 | int failure_count = 0; |
200 | 203 | ||
201 | if (! gcry_check_version ("1.5.0")) | 204 | if (! gcry_check_version ("1.6.0")) |
202 | { | 205 | { |
203 | FPRINTF (stderr, | 206 | FPRINTF (stderr, |
204 | _ | 207 | _ |
205 | ("libgcrypt has not the expected version (version %s is required).\n"), | 208 | ("libgcrypt has not the expected version (version %s is required).\n"), |
206 | "1.5.0"); | 209 | "1.6.0"); |
207 | return 0; | 210 | return 0; |
208 | } | 211 | } |
212 | if (getenv ("GNUNET_GCRYPT_DEBUG")) | ||
213 | gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u , 0); | ||
209 | GNUNET_log_setup ("test-crypto-ecc", "WARNING", NULL); | 214 | GNUNET_log_setup ("test-crypto-ecc", "WARNING", NULL); |
210 | key = GNUNET_CRYPTO_ecdsa_key_create (); | 215 | key = GNUNET_CRYPTO_ecdsa_key_create (); |
211 | if (GNUNET_OK != testDeriveSignVerify ()) | 216 | if (GNUNET_OK != testDeriveSignVerify ()) |