-fix time assertion introduce in last patch
[oweals/gnunet.git] / src / util / test_peer.c
index 3817d82437d6da788f18f88e3120d42a980bbc3e..c2cd4931515639f207d645597f3083f58010acc0 100644 (file)
  */
 
 #include "platform.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_peer_lib.h"
+#include "gnunet_util_lib.h"
+#include <gcrypt.h>
 
 #define NUMBER_OF_PEERS 10
 
-#define DEBUG GNUNET_EXTRA_LOGGING
-
 /**
  * A list of Peer ID's to play with
  */
@@ -44,11 +42,11 @@ generatePeerIdList ()
 
   for (i = 0; i < NUMBER_OF_PEERS; i++)
   {
-    GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
-                                      &pidArr[i].hashPubKey);
-#if DEBUG
-    printf ("Peer %d: %s\n", i, GNUNET_i2s (&pidArr[i]));
-#endif
+    gcry_randomize (&pidArr[i],
+                    sizeof (struct GNUNET_PeerIdentity),
+                    GCRY_STRONG_RANDOM);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Peer %d: %s\n", i, GNUNET_i2s (&pidArr[i]));
   }
 }
 
@@ -69,7 +67,7 @@ check ()
     pid = GNUNET_PEER_intern (&pidArr[i]);
     if (pid != (i + 1))
     {
-      fprintf (stderr, "Unexpected Peer ID returned by intern function\n");
+      FPRINTF (stderr, "%s",  "Unexpected Peer ID returned by intern function\n");
       return 1;
     }
   }
@@ -80,7 +78,7 @@ check ()
     pid = GNUNET_PEER_intern (&pidArr[i]);
     if (pid != (i + 1))
     {
-      fprintf (stderr, "Unexpected Peer ID returned by intern function\n");
+      FPRINTF (stderr, "%s",  "Unexpected Peer ID returned by intern function\n");
       return 1;
     }
   }
@@ -124,7 +122,7 @@ check ()
 int
 main ()
 {
-  int i;
+  unsigned int i;
 
   GNUNET_log_setup ("test-peer", "ERROR", NULL);
   for (i = 0; i < 1; i++)