diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-02-12 15:39:33 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-02-12 15:39:33 +0000 |
commit | c616caf93688874d0f315209793e6f9c9b22a7cc (patch) | |
tree | 146d21cc660a1c56c9720c39116f5298a0bd38db /src/util | |
parent | 458349a5fedd8cd8efece9756ddf9eecbaf60501 (diff) | |
download | gnunet-c616caf93688874d0f315209793e6f9c9b22a7cc.tar.gz gnunet-c616caf93688874d0f315209793e6f9c9b22a7cc.zip |
-key gen perf
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/test_crypto_ecc.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/util/test_crypto_ecc.c b/src/util/test_crypto_ecc.c index 1adb41888..fb6d5968a 100644 --- a/src/util/test_crypto_ecc.c +++ b/src/util/test_crypto_ecc.c | |||
@@ -201,6 +201,27 @@ test_ecdh () | |||
201 | sizeof (struct GNUNET_HashCode))); | 201 | sizeof (struct GNUNET_HashCode))); |
202 | } | 202 | } |
203 | 203 | ||
204 | static void | ||
205 | perf_keygen () | ||
206 | { | ||
207 | struct GNUNET_TIME_Absolute start; | ||
208 | struct GNUNET_CRYPTO_EccPrivateKey *pk; | ||
209 | int i; | ||
210 | |||
211 | start = GNUNET_TIME_absolute_get (); | ||
212 | for (i=0;i<10;i++) | ||
213 | { | ||
214 | fprintf (stderr, "."); | ||
215 | pk = GNUNET_CRYPTO_ecc_key_create (); | ||
216 | GNUNET_CRYPTO_ecc_key_free (pk); | ||
217 | } | ||
218 | fprintf (stderr, "\n"); | ||
219 | printf ("Creating 10 ECC keys took %llu ms\n", | ||
220 | (unsigned long long) | ||
221 | GNUNET_TIME_absolute_get_duration (start).rel_value); | ||
222 | } | ||
223 | |||
224 | |||
204 | 225 | ||
205 | int | 226 | int |
206 | main (int argc, char *argv[]) | 227 | main (int argc, char *argv[]) |
@@ -228,6 +249,7 @@ main (int argc, char *argv[]) | |||
228 | GNUNET_CRYPTO_ecc_key_free (key); | 249 | GNUNET_CRYPTO_ecc_key_free (key); |
229 | GNUNET_assert (0 == UNLINK (KEYFILE)); | 250 | GNUNET_assert (0 == UNLINK (KEYFILE)); |
230 | test_ecdh (); | 251 | test_ecdh (); |
252 | perf_keygen (); | ||
231 | 253 | ||
232 | if (failureCount != 0) | 254 | if (failureCount != 0) |
233 | { | 255 | { |