stuff
authorChristian Grothoff <christian@grothoff.org>
Thu, 14 Oct 2010 09:30:07 +0000 (09:30 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 14 Oct 2010 09:30:07 +0000 (09:30 +0000)
src/util/crypto_ksk.c
src/util/test_crypto_ksk.c

index 2a49966b41131e68a4003393df32d4a39c3f007f..07ac939b43e10f5629bd224175a3d8ef43130df6 100644 (file)
@@ -87,6 +87,8 @@ mpz_randomize (gcry_mpi_t n, unsigned int nbits, GNUNET_HashCode * rnd)
 
       if (i > 0)
        GNUNET_CRYPTO_hash (&hc, sizeof (GNUNET_HashCode), &tmp);
+      fprintf (stderr, "H: %s\n", GNUNET_h2s (&tmp));
+
       for (j=0;j<sizeof(GNUNET_HashCode) / sizeof(uint32_t); j++)
         {
 #if HAVE_GCRY_MPI_LSHIFT 
index d5a965d4234b4e456ab95d6c47663dd5889b7286..29c98b931194c7cc520e0cafb22ac9274461f890 100644 (file)
@@ -55,13 +55,18 @@ testCorrectKey ()
     }
   GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey);
   GNUNET_CRYPTO_rsa_key_free (hostkey);
+#if 1
+  for (i=0;i<sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded);i++)
+    printf(out, sizeof (out), "%02x", ((unsigned char*) &pkey)[i]);
+  printf ("\n");
+#endif
   for (i=0;i<sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded);i++)
     {
       snprintf(out, sizeof (out), "%02x", ((unsigned char*) &pkey)[i]);
       if (0 != strncmp (out, &want[i*2], 2))
        {
          fprintf (stderr,
-                  "Wanted %.2s but got %2s\n",
+                  " Failed! Wanted %.2s but got %2s\n",
                   &want[i*2],
                   out);
          return GNUNET_SYSERR;
@@ -230,6 +235,8 @@ main (int argc, char *argv[])
   struct GNUNET_CRYPTO_RsaPrivateKey *hostkey;
 
   GNUNET_log_setup ("test-crypto-ksk", "WARNING", NULL);
+  if (GNUNET_OK != testCorrectKey ())
+    failureCount++;
   GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &in);
   hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in);
   if (hostkey == NULL)
@@ -237,9 +244,6 @@ main (int argc, char *argv[])
       printf ("\nGNUNET_CRYPTO_rsa_key_create_from_hash failed!\n");
       return 1;
     }
-
-  if (GNUNET_OK != testCorrectKey ())
-    failureCount++;
   if (GNUNET_OK != testMultiKey ("foo"))
     failureCount++;
   if (GNUNET_OK != testMultiKey ("bar"))