tolerate additional IPv4 address now available for gnunet.org
[oweals/gnunet.git] / src / util / perf_crypto_asymmetric.c
index f16c8e498d52e3a2b78d6e98d78ab3d361c41687..a2cb3a6cef40aa7ea5a5565428e168ba61e9008b 100644 (file)
@@ -1,21 +1,21 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2015 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2015 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
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-     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.
+     SPDX-License-Identifier: AGPL3.0-or-later
 */
 
 /**
@@ -29,7 +29,7 @@
 
 static struct GNUNET_TIME_Absolute start;
 
-#define l 50
+#define l 500
 
 struct TestSig
 {
@@ -75,7 +75,8 @@ main (int argc, char *argv[])
     sig[i].purp.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)
                               + sizeof (struct GNUNET_HashCode));
     GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
-                                &sig[i].h, sizeof (&sig[0].h));
+                                &sig[i].h,
+                                sizeof (sig[i].h));
   }
   log_duration ("", "Init");
 
@@ -87,16 +88,23 @@ main (int argc, char *argv[])
   start = GNUNET_TIME_absolute_get();
   for (i = 0; i < l; i++)
     GNUNET_CRYPTO_eddsa_key_get_public (eddsa[i], &dspub[i]);
-  log_duration ("EdDSA", "get pubilc");
+  log_duration ("EdDSA", "get public");
 
   start = GNUNET_TIME_absolute_get();
   for (i = 0; i < l; i++)
-    GNUNET_CRYPTO_eddsa_sign (eddsa[i], &sig[i].purp, &sig[i].sig);
+    GNUNET_assert (GNUNET_OK ==
+                   GNUNET_CRYPTO_eddsa_sign (eddsa[i],
+                                             &sig[i].purp,
+                                             &sig[i].sig));
   log_duration ("EdDSA", "sign HashCode");
 
   start = GNUNET_TIME_absolute_get();
   for (i = 0; i < l; i++)
-    GNUNET_CRYPTO_eddsa_verify (0, &sig[i].purp, &sig[i].sig, &dspub[i]);
+    GNUNET_assert (GNUNET_OK ==
+                   GNUNET_CRYPTO_eddsa_verify (0,
+                                               &sig[i].purp,
+                                               &sig[i].sig,
+                                               &dspub[i]));
   log_duration ("EdDSA", "verify HashCode");
 
   start = GNUNET_TIME_absolute_get();
@@ -113,7 +121,7 @@ main (int argc, char *argv[])
   for (i = 0; i < l - 1; i+=2)
   {
     GNUNET_CRYPTO_ecc_ecdh (ecdhe[i], &dhpub[i+1], &sig[i].h);
-    GNUNET_CRYPTO_ecc_ecdh (ecdhe[i+1], &dhpub[i], &sig[i+i].h);
+    GNUNET_CRYPTO_ecc_ecdh (ecdhe[i+1], &dhpub[i], &sig[i+1].h);
   }
   log_duration ("ECDH", "do DH");