gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13235 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r13235 - gnunet/src/util
Date: Fri, 8 Oct 2010 17:42:50 +0200

Author: grothoff
Date: 2010-10-08 17:42:50 +0200 (Fri, 08 Oct 2010)
New Revision: 13235

Modified:
   gnunet/src/util/crypto_hash.c
   gnunet/src/util/crypto_ksk.c
Log:
fix

Modified: gnunet/src/util/crypto_hash.c
===================================================================
--- gnunet/src/util/crypto_hash.c       2010-10-08 14:57:40 UTC (rev 13234)
+++ gnunet/src/util/crypto_hash.c       2010-10-08 15:42:50 UTC (rev 13235)
@@ -127,6 +127,7 @@
   GNUNET_free (fhc->filename);
   if (!GNUNET_DISK_handle_invalid (fhc->fh))
     GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (fhc->fh));
+  gcry_md_close (fhc->md);
   GNUNET_free (fhc);            /* also frees fhc->buffer */
 }
 
@@ -162,7 +163,6 @@
     {
       res = (GNUNET_HashCode *) gcry_md_read (fhc->md, GCRY_MD_SHA512);
       file_hash_finish (fhc, res);
-      gcry_md_close (fhc->md);
       return;
     }
   fhc->task 

Modified: gnunet/src/util/crypto_ksk.c
===================================================================
--- gnunet/src/util/crypto_ksk.c        2010-10-08 14:57:40 UTC (rev 13234)
+++ gnunet/src/util/crypto_ksk.c        2010-10-08 15:42:50 UTC (rev 13235)
@@ -87,14 +87,15 @@
 
       if (i > 0)
        GNUNET_CRYPTO_hash (&hc, sizeof (GNUNET_HashCode), &tmp);
-      for (j = sizeof(GNUNET_HashCode) / sizeof(unsigned int); j > 0; j--)
+      for (j=0;j<sizeof(GNUNET_HashCode) / sizeof(uint32_t); j++)
         {
-#if HAVE_GCRY_MPI_LSHIFT
-          gcry_mpi_lshift (n, n, sizeof(unsigned int));
+#if HAVE_GCRY_MPI_LSHIFT 
+          gcry_mpi_lshift (n, n, sizeof(uint32_t)*8);
 #else
-          gcry_mpi_mul_ui(n, n, pow (2, sizeof(unsigned int)));
+         gcry_mpi_mul_ui(n, n, 1 << (sizeof(uint32_t)*4));
+         gcry_mpi_mul_ui(n, n, 1 << (sizeof(uint32_t)*4));
 #endif
-          gcry_mpi_add_ui(n, n, ((unsigned int *) &tmp)[j]);
+          gcry_mpi_add_ui(n, n, ((uint32_t *) &tmp)[j]);
         }
       hc = tmp;
     }
@@ -301,7 +302,7 @@
   /* Make nbits fit into mpz_t implementation. */
   val_2 = gcry_mpi_set_ui (NULL, 2);
   val_3 = gcry_mpi_set_ui (NULL, 3);
-  prime = gcry_mpi_new(0);
+  prime = gcry_mpi_snew(0);
   result = gcry_mpi_new(0);
   pminus1 = gcry_mpi_new(0);
   *ptest = gcry_mpi_new(0);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]