Link libgnunetblockgroup to libgnunetblock
[oweals/gnunet.git] / src / util / test_crypto_eddsa.c
index 209eea5c648e064f9368cbd58e1919967a38f97b..4b12eb983368cc684b5d16b05ee20de5f6a018f4 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2002-2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2002-2013 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 
 */
 /**
@@ -56,7 +56,7 @@ testSignVerify ()
 
   for (i = 0; i < ITER; i++)
   {
-    FPRINTF (stderr, "%s",  ".");
+    FPRINTF (stderr, "%s",  "."); fflush (stderr);
     if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_sign (key, &purp, &sig))
     {
       FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_eddsa_sign returned SYSERR\n");
@@ -80,7 +80,7 @@ testSignVerify ()
       continue;
     }
   }
-  printf ("%d ECC sign/verify operations %s\n", ITER,
+  printf ("%d EdDSA sign/verify operations %s\n", ITER,
           GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES));
   return ok;
 }
@@ -104,7 +104,7 @@ testSignPerformance ()
   start = GNUNET_TIME_absolute_get ();
   for (i = 0; i < ITER; i++)
   {
-    FPRINTF (stderr, "%s",  ".");
+    FPRINTF (stderr, "%s",  "."); fflush (stderr);
     if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_sign (key, &purp, &sig))
     {
       FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_eddsa_sign returned SYSERR\n");
@@ -152,15 +152,18 @@ perf_keygen ()
   struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
   int i;
 
+  FPRINTF (stderr, "%s",  "W");
   start = GNUNET_TIME_absolute_get ();
   for (i=0;i<10;i++)
   {
-    fprintf (stderr, ".");
+    fprintf (stderr, "."); fflush (stderr);
     pk = GNUNET_CRYPTO_eddsa_key_create ();
     GNUNET_free (pk);
   }
-  fprintf (stderr, "\n");
-  printf ("Creating 10 EdDSA keys took %s\n",
+  for (;i<25;i++)
+    fprintf (stderr, ".");
+  fflush (stderr);
+  printf ("10 EdDSA keys created in %s\n",
           GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES));
 }
 
@@ -170,13 +173,15 @@ main (int argc, char *argv[])
 {
   int failure_count = 0;
 
-  if (! gcry_check_version ("1.5.0"))
+  if (! gcry_check_version ("1.6.0"))
   {
     FPRINTF (stderr,
              _("libgcrypt has not the expected version (version %s is required).\n"),
-             "1.5.0");
+             "1.6.0");
     return 0;
   }
+  if (getenv ("GNUNET_GCRYPT_DEBUG"))
+    gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u , 0);
   GNUNET_log_setup ("test-crypto-eddsa", "WARNING", NULL);
   key = GNUNET_CRYPTO_eddsa_key_create ();
 #if PERF