gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8968 - in gnunet/src: datastore fs hostlist include testin


From: gnunet
Subject: [GNUnet-SVN] r8968 - in gnunet/src: datastore fs hostlist include testing util
Date: Tue, 8 Sep 2009 02:10:19 -0600

Author: grothoff
Date: 2009-09-08 02:10:18 -0600 (Tue, 08 Sep 2009)
New Revision: 8968

Modified:
   gnunet/src/datastore/perf_datastore_api.c
   gnunet/src/fs/Makefile.am
   gnunet/src/fs/test_fs_collection.c
   gnunet/src/fs/test_fs_directory.c
   gnunet/src/hostlist/test_gnunet_daemon_hostlist.c
   gnunet/src/include/gnunet_crypto_lib.h
   gnunet/src/testing/test_testing.c
   gnunet/src/util/crypto_aes.c
   gnunet/src/util/crypto_crc.c
   gnunet/src/util/crypto_hash.c
   gnunet/src/util/crypto_random.c
   gnunet/src/util/crypto_rsa.c
   gnunet/src/util/test_container_bloomfilter.c
   gnunet/src/util/test_crypto_hash.c
   gnunet/src/util/test_crypto_ksk.c
   gnunet/src/util/test_pseudonym.c
Log:
fixes

Modified: gnunet/src/datastore/perf_datastore_api.c
===================================================================
--- gnunet/src/datastore/perf_datastore_api.c   2009-09-08 07:31:04 UTC (rev 
8967)
+++ gnunet/src/datastore/perf_datastore_api.c   2009-09-08 08:10:18 UTC (rev 
8968)
@@ -389,6 +389,7 @@
 #if REPORT_ID
   fprintf (stderr, "\n");
 #endif
+  GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-datastore");
   return ret;
 }
 

Modified: gnunet/src/fs/Makefile.am
===================================================================
--- gnunet/src/fs/Makefile.am   2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/fs/Makefile.am   2009-09-08 08:10:18 UTC (rev 8968)
@@ -107,8 +107,10 @@
  test_fs_getopt \
  test_fs_uri
 
-TESTS = $(check_PROGRAMS)
+TESTS = test_fs_uri
 
+# $(check_PROGRAMS)
+
 test_fs_collection_SOURCES = \
  test_fs_collection.c
 test_fs_collection_LDADD = \

Modified: gnunet/src/fs/test_fs_collection.c
===================================================================
--- gnunet/src/fs/test_fs_collection.c  2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/fs/test_fs_collection.c  2009-09-08 08:10:18 UTC (rev 8968)
@@ -52,7 +52,9 @@
                         cfg,
                         "test-fs-collection",
                         &progress_cb,
-                        NULL);
+                        NULL,
+                        GNUNET_FS_FLAGS_NONE,
+                        GNUNET_FS_OPTIONS_END);
   GNUNET_assert (NULL != fsh);
   GNUNET_FS_collection_stop (fsh);
   GNUNET_assert (NULL == GNUNET_FS_collection_get (fsh));
@@ -76,7 +78,9 @@
                         cfg,
                         "test-fs-collection",
                         &progress_cb,
-                        NULL);
+                        NULL,
+                        GNUNET_FS_FLAGS_NONE,
+                        GNUNET_FS_OPTIONS_END);
   have = GNUNET_FS_collection_get (fsh);
   GNUNET_assert (NULL != have);
   GNUNET_FS_namespace_delete (have, GNUNET_NO);
@@ -101,7 +105,8 @@
                    NULL);
   GNUNET_CRYPTO_random_disable_entropy_gathering ();
   cfg = GNUNET_CONFIGURATION_create ();
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_parse (cfg, 
"test_fs_collection_data.conf"))
+  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_parse (cfg, 
+                                                  
"test_fs_collection_data.conf"))
     {
       GNUNET_CONFIGURATION_destroy (cfg);
       return -1;

Modified: gnunet/src/fs/test_fs_directory.c
===================================================================
--- gnunet/src/fs/test_fs_directory.c   2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/fs/test_fs_directory.c   2009-09-08 08:10:18 UTC (rev 8968)
@@ -67,8 +67,9 @@
 static int
 testDirectory (unsigned int i)
 {
+  struct GNUNET_FS_DirectoryBuilder *db;
   char *data;
-  unsigned long long dlen;
+  size_t dlen;
   struct GNUNET_FS_Uri **uris;
   struct GNUNET_CONTAINER_MetaData **mds;
   struct GNUNET_CONTAINER_MetaData *meta;
@@ -96,7 +97,7 @@
         }
       GNUNET_snprintf (uri,
                        sizeof(uri),
-                       
"gnunet://ecrs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.%u",
+                       
"gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.%u",
                        p);
       uris[p] = GNUNET_FS_uri_parse (uri, &emsg);
       if (uris[p] == NULL)
@@ -115,19 +116,12 @@
   meta = GNUNET_CONTAINER_meta_data_create ();
   GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_TITLE, "A title");
   GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_AUTHOR, "An author");
-  if (GNUNET_OK !=
-      GNUNET_FS_directory_create (&dlen, &data, i, uris, mds, meta))
-    {
-      GNUNET_CONTAINER_meta_data_destroy (meta);
-      for (p = 0; p < i; p++)
-        {
-          GNUNET_CONTAINER_meta_data_destroy (mds[p]);
-          GNUNET_FS_uri_destroy (uris[p]);
-        }
-      GNUNET_free (uris);
-      GNUNET_free (mds);
-      ABORT ();
-    }
+  db = GNUNET_FS_directory_builder_create (meta);
+  for (p=0;p<i;p++)
+    GNUNET_FS_directory_builder_add (db, uris[i], mds[i], NULL);
+  GNUNET_FS_directory_builder_finish (db,
+                                     &dlen,
+                                     (void**) &data);
   cls.pos = 0;
   cls.uri = uris;
   cls.md = mds;

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist.c
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist.c   2009-09-08 07:31:04 UTC 
(rev 8967)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist.c   2009-09-08 08:10:18 UTC 
(rev 8968)
@@ -174,5 +174,7 @@
 #endif
                     NULL);
   ret = check ();
-  return 0; 
+  return ret; 
 }
+
+/* end of test_gnunet_daemon_hostlist.c */

Modified: gnunet/src/include/gnunet_crypto_lib.h
===================================================================
--- gnunet/src/include/gnunet_crypto_lib.h      2009-09-08 07:31:04 UTC (rev 
8967)
+++ gnunet/src/include/gnunet_crypto_lib.h      2009-09-08 08:10:18 UTC (rev 
8968)
@@ -202,25 +202,31 @@
  * @param len the length of the buffer in bytes
  * @return the resulting CRC32 checksum
  */
-int GNUNET_CRYPTO_crc32_n (const void *buf, unsigned int len);
+int32_t GNUNET_CRYPTO_crc32_n (const void *buf, 
+                              size_t len);
 
 
 /**
  * Produce a random value.
  *
+ * @param mode desired quality of the random number
  * @param i the upper limit (exclusive) for the random number
- * @return a random value in the interval [0,i[.
+ * @return a random value in the interval [0,i) (exclusive).
  */
-unsigned int GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality,
-                                       unsigned int i);
+uint32_t GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode,
+                                  uint32_t i);
 
 
 /**
  * Random on unsigned 64-bit values.  We break them down into signed
  * 32-bit values and reassemble the 64-bit random value bit-wise.
+ *
+ * @param mode desired quality of the random number
+ * @param max value returned will be in range [0,max) (exclusive)
+ * @return random 64-bit number
  */
-unsigned long long GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode,
-                                             unsigned long long u);
+uint64_t GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode,
+                                  uint64_t max);
 
 
 /**
@@ -261,13 +267,13 @@
  *        for streams.
  * @returns the size of the encrypted block, -1 for errors
  */
-int GNUNET_CRYPTO_aes_encrypt (const void *block,
-                               uint16_t len,
-                               const struct GNUNET_CRYPTO_AesSessionKey
-                               *sessionkey,
-                               const struct
-                               GNUNET_CRYPTO_AesInitializationVector *iv,
-                               void *result);
+ssize_t GNUNET_CRYPTO_aes_encrypt (const void *block,
+                                  size_t len,
+                                  const struct GNUNET_CRYPTO_AesSessionKey
+                                  *sessionkey,
+                                  const struct
+                                  GNUNET_CRYPTO_AesInitializationVector *iv,
+                                  void *result);
 
 
 /**
@@ -280,10 +286,11 @@
  * @param result address to store the result at
  * @return -1 on failure, size of decrypted block on success
  */
-int GNUNET_CRYPTO_aes_decrypt (const void *block, uint16_t size,
-                               const struct GNUNET_CRYPTO_AesSessionKey 
*sessionkey, 
-                               const struct 
GNUNET_CRYPTO_AesInitializationVector *iv,
-                               void *result);
+ssize_t GNUNET_CRYPTO_aes_decrypt (const void *block, 
+                                  size_t size,
+                                  const struct GNUNET_CRYPTO_AesSessionKey 
*sessionkey, 
+                                  const struct 
GNUNET_CRYPTO_AesInitializationVector *iv,
+                                  void *result);
 
 
 /**
@@ -315,16 +322,19 @@
  * result should be a positive number.
  * @return number between 0 and 65536
  */
-unsigned int GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a,
-                                              const GNUNET_HashCode * b);
+uint32_t GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a,
+                                         const GNUNET_HashCode * b);
 
 
 /**
- * Hash block of given size.
- * @param block the data to GNUNET_CRYPTO_hash, length is given as a second 
argument
+ * Compute hash of a given block.
+ *
+ * @param block the data to hash
+ * @param size size of the block
  * @param ret pointer to where to write the hashcode
  */
-void GNUNET_CRYPTO_hash (const void *block, unsigned int size,
+void GNUNET_CRYPTO_hash (const void *block, 
+                        size_t size,
                          GNUNET_HashCode * ret);
 
 
@@ -363,7 +373,8 @@
 /**
  * Create a random hash code.
  */
-void GNUNET_CRYPTO_hash_create_random (GNUNET_HashCode * result);
+void GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode,
+                                      GNUNET_HashCode * result);
 
 
 /**
@@ -491,7 +502,7 @@
  * @returns GNUNET_SYSERR on error, GNUNET_OK if ok
  */
 int GNUNET_CRYPTO_rsa_encrypt (const void *block,
-                               uint16_t size,
+                               size_t size,
                                const struct
                                GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
                                *publicKey,
@@ -507,9 +518,11 @@
  * @param size how many bytes of a result are expected? Must be exact.
  * @returns the size of the decrypted block (that is, size) or -1 on error
  */
-int GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
-                               const struct GNUNET_CRYPTO_RsaEncryptedData
-                               *block, void *result, uint16_t size);
+ssize_t GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey 
*key,
+                                  const struct GNUNET_CRYPTO_RsaEncryptedData
+                                  *block,
+                                  void *result, 
+                                  size_t size);
 
 
 /**

Modified: gnunet/src/testing/test_testing.c
===================================================================
--- gnunet/src/testing/test_testing.c   2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/testing/test_testing.c   2009-09-08 08:10:18 UTC (rev 8968)
@@ -109,7 +109,7 @@
 #endif
                     NULL);
   ret = check ();
-
+  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing");
   return ret;
 }
 

Modified: gnunet/src/util/crypto_aes.c
===================================================================
--- gnunet/src/util/crypto_aes.c        2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/util/crypto_aes.c        2009-09-08 08:10:18 UTC (rev 8968)
@@ -72,9 +72,9 @@
  * @param result the output parameter in which to store the encrypted result
  * @returns the size of the encrypted block, -1 for errors
  */
-int
+ssize_t
 GNUNET_CRYPTO_aes_encrypt (const void *block,
-                           uint16_t len,
+                           size_t len,
                            const struct GNUNET_CRYPTO_AesSessionKey
                            *sessionkey,
                            const struct GNUNET_CRYPTO_AesInitializationVector
@@ -88,7 +88,7 @@
              (sessionkey, GNUNET_CRYPTO_AES_KEY_LENGTH)))
     {
       GNUNET_break (0);
-      return GNUNET_SYSERR;
+      return -1;
     }
   GNUNET_assert (0 == gcry_cipher_open (&handle,
                                         GCRY_CIPHER_AES256,
@@ -115,8 +115,9 @@
  * @param result address to store the result at
  * @return -1 on failure, size of decrypted block on success
  */
-int
-GNUNET_CRYPTO_aes_decrypt (const void *block, uint16_t size,
+ssize_t
+GNUNET_CRYPTO_aes_decrypt (const void *block, 
+                          size_t size,
                            const struct GNUNET_CRYPTO_AesSessionKey
                            *sessionkey, 
                           const struct GNUNET_CRYPTO_AesInitializationVector
@@ -130,7 +131,7 @@
              (sessionkey, GNUNET_CRYPTO_AES_KEY_LENGTH)))
     {
       GNUNET_break (0);
-      return GNUNET_SYSERR;
+      return -1;
     }
   GNUNET_assert (0 == gcry_cipher_open (&handle,
                                         GCRY_CIPHER_AES256,

Modified: gnunet/src/util/crypto_crc.c
===================================================================
--- gnunet/src/util/crypto_crc.c        2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/util/crypto_crc.c        2009-09-08 08:10:18 UTC (rev 8968)
@@ -94,8 +94,8 @@
  * @param len the length of the buffer
  * @return the resulting CRC32 checksum
  */
-int
-GNUNET_CRYPTO_crc32_n (const void *buf, unsigned int len)
+int32_t
+GNUNET_CRYPTO_crc32_n (const void *buf, size_t len)
 {
   uLong crc;
   crc = crc32 (0L, Z_NULL, 0);
@@ -103,4 +103,4 @@
   return crc;
 }
 
-/* end of crc32.c */
+/* end of crypto_crc.c */

Modified: gnunet/src/util/crypto_hash.c
===================================================================
--- gnunet/src/util/crypto_hash.c       2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/util/crypto_hash.c       2009-09-08 08:10:18 UTC (rev 8968)
@@ -359,7 +359,8 @@
  * @param ret pointer to where to write the hashcode
  */
 void
-GNUNET_CRYPTO_hash (const void *block, unsigned int size,
+GNUNET_CRYPTO_hash (const void *block, 
+                   size_t size,
                     GNUNET_HashCode * ret)
 {
   struct sha512_ctx ctx;
@@ -660,18 +661,18 @@
 }
 
 void
-GNUNET_CRYPTO_hash_create_random (GNUNET_HashCode * result)
+GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, 
GNUNET_HashCode * result)
 {
   int i;
-  for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0;
+  for (i = (sizeof (GNUNET_HashCode) / sizeof (uint32_t)) - 1; i >= 0;
        i--)
-    result->bits[i] = rand ();
+    result->bits[i] = GNUNET_CRYPTO_random_u32 (mode, (uint32_t)-1);
 }
 
 void
 GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a,
-                               const GNUNET_HashCode * b,
-                               GNUNET_HashCode * result)
+                              const GNUNET_HashCode * b,
+                              GNUNET_HashCode * result)
 {
   int i;
   for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0;
@@ -681,8 +682,8 @@
 
 void
 GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a,
-                        const GNUNET_HashCode * delta,
-                        GNUNET_HashCode * result)
+                       const GNUNET_HashCode * delta,
+                       GNUNET_HashCode * result)
 {
   int i;
   for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0;
@@ -692,7 +693,7 @@
 
 void
 GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a,
-                        const GNUNET_HashCode * b, GNUNET_HashCode * result)
+                       const GNUNET_HashCode * b, GNUNET_HashCode * result)
 {
   int i;
   for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0;
@@ -705,18 +706,18 @@
  */
 void
 GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc,
-                               struct GNUNET_CRYPTO_AesSessionKey *skey,
-                               struct GNUNET_CRYPTO_AesInitializationVector
-                               *iv)
+                              struct GNUNET_CRYPTO_AesSessionKey *skey,
+                              struct GNUNET_CRYPTO_AesInitializationVector
+                              *iv)
 {
   GNUNET_assert (sizeof (GNUNET_HashCode) >=
-                 GNUNET_CRYPTO_AES_KEY_LENGTH +
-                 sizeof (struct GNUNET_CRYPTO_AesInitializationVector));
+                GNUNET_CRYPTO_AES_KEY_LENGTH +
+                sizeof (struct GNUNET_CRYPTO_AesInitializationVector));
   memcpy (skey, hc, GNUNET_CRYPTO_AES_KEY_LENGTH);
   skey->crc32 =
     htonl (GNUNET_CRYPTO_crc32_n (skey, GNUNET_CRYPTO_AES_KEY_LENGTH));
   memcpy (iv, &((char *) hc)[GNUNET_CRYPTO_AES_KEY_LENGTH],
-          sizeof (struct GNUNET_CRYPTO_AesInitializationVector));
+         sizeof (struct GNUNET_CRYPTO_AesInitializationVector));
 }
 
 /**
@@ -739,21 +740,21 @@
  */
 int
 GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1,
-                        const GNUNET_HashCode * h2)
+                       const GNUNET_HashCode * h2)
 {
   unsigned int *i1;
   unsigned int *i2;
   int i;
-
+  
   i1 = (unsigned int *) h1;
   i2 = (unsigned int *) h2;
   for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0;
        i--)
     {
       if (i1[i] > i2[i])
-        return 1;
+       return 1;
       if (i1[i] < i2[i])
-        return -1;
+       return -1;
     }
   return 0;
 }
@@ -765,23 +766,23 @@
  */
 int
 GNUNET_CRYPTO_hash_xorcmp (const GNUNET_HashCode * h1,
-                           const GNUNET_HashCode * h2,
-                           const GNUNET_HashCode * target)
+                          const GNUNET_HashCode * h2,
+                          const GNUNET_HashCode * target)
 {
   int i;
   unsigned int d1;
   unsigned int d2;
-
+  
   for (i = sizeof (GNUNET_HashCode) / sizeof (unsigned int) - 1; i >= 0; i--)
     {
       d1 = ((unsigned int *) h1)[i] ^ ((unsigned int *) target)[i];
       d2 = ((unsigned int *) h2)[i] ^ ((unsigned int *) target)[i];
       if (d1 > d2)
-        return 1;
+       return 1;
       else if (d1 < d2)
-        return -1;
+       return -1;
     }
   return 0;
 }
 
-/* end of hashing.c */
+/* end of crypto_hash.c */

Modified: gnunet/src/util/crypto_random.c
===================================================================
--- gnunet/src/util/crypto_random.c     2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/util/crypto_random.c     2009-09-08 08:10:18 UTC (rev 8968)
@@ -32,13 +32,14 @@
 /**
  * @return a random value in the interval [0,i[.
  */
-unsigned int
-GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, unsigned int i)
+uint32_t
+GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, 
+                         uint32_t i)
 {
 #ifdef gcry_fast_random_poll
   static unsigned int invokeCount;
 #endif
-  unsigned int ret;
+  uint32_t ret;
 
   GNUNET_assert (i > 0);
 
@@ -49,11 +50,9 @@
       if ((invokeCount++ % 256) == 0)
         gcry_fast_random_poll ();
 #endif
-      ret = rand ();            /* in case gcry_randomize fails,
-                                   we at least get a pseudo-
-                                   random number this way */
       gcry_randomize ((unsigned char *) &ret,
-                      sizeof (unsigned int), GCRY_STRONG_RANDOM);
+                      sizeof (uint32_t),
+                     GCRY_STRONG_RANDOM);
       return ret % i;
     }
   else
@@ -80,10 +79,10 @@
   unsigned int *ret;
   unsigned int i;
   unsigned int tmp;
-  unsigned int x;
+  uint32_t x;
 
   GNUNET_assert (n > 0);
-  ret = GNUNET_malloc (n * sizeof (int));
+  ret = GNUNET_malloc (n * sizeof (unsigned int));
   for (i = 0; i < n; i++)
     ret[i] = i;
   for (i = 0; i < n; i++)
@@ -99,17 +98,18 @@
 /**
  * Random on unsigned 64-bit values.
  */
-unsigned long long
+uint64_t
 GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode,
-                          unsigned long long u)
+                          uint64_t u)
 {
-  unsigned long long ret;
+  uint64_t ret;
 
   GNUNET_assert (u > 0);
   if (mode == GNUNET_CRYPTO_QUALITY_STRONG)
     {
       gcry_randomize ((unsigned char *) &ret,
-                      sizeof (unsigned long long), GCRY_STRONG_RANDOM);
+                      sizeof (uint64_t),
+                     GCRY_STRONG_RANDOM);
       return ret % u;
     }
   else

Modified: gnunet/src/util/crypto_rsa.c
===================================================================
--- gnunet/src/util/crypto_rsa.c        2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/util/crypto_rsa.c        2009-09-08 08:10:18 UTC (rev 8968)
@@ -751,7 +751,7 @@
  */
 int
 GNUNET_CRYPTO_rsa_encrypt (const void *block,
-                           uint16_t size,
+                           size_t size,
                            const struct
                            GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey,
                            struct GNUNET_CRYPTO_RsaEncryptedData *target)
@@ -799,10 +799,11 @@
  *        the decrypted block is bigger, an error is returned
  * @returns the size of the decrypted block, -1 on error
  */
-int
+ssize_t
 GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey *hostkey,
                            const struct GNUNET_CRYPTO_RsaEncryptedData *block,
-                           void *result, uint16_t max)
+                           void *result, 
+                          size_t max)
 {
   gcry_sexp_t resultsexp;
   gcry_sexp_t data;

Modified: gnunet/src/util/test_container_bloomfilter.c
===================================================================
--- gnunet/src/util/test_container_bloomfilter.c        2009-09-08 07:31:04 UTC 
(rev 8967)
+++ gnunet/src/util/test_container_bloomfilter.c        2009-09-08 08:10:18 UTC 
(rev 8968)
@@ -38,7 +38,7 @@
 static void
 nextHC (GNUNET_HashCode * hc)
 {
-  GNUNET_CRYPTO_hash_create_random (hc);
+  GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, hc);
 }
 
 static int

Modified: gnunet/src/util/test_crypto_hash.c
===================================================================
--- gnunet/src/util/test_crypto_hash.c  2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/util/test_crypto_hash.c  2009-09-08 08:10:18 UTC (rev 8968)
@@ -73,8 +73,8 @@
   struct GNUNET_CRYPTO_AesSessionKey skey;
   struct GNUNET_CRYPTO_AesInitializationVector iv;
 
-  GNUNET_CRYPTO_hash_create_random (&h1);
-  GNUNET_CRYPTO_hash_create_random (&h2);
+  GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &h1);
+  GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &h2);
   if (GNUNET_CRYPTO_hash_distance_u32 (&h1, &h2) !=
       GNUNET_CRYPTO_hash_distance_u32 (&h2, &h1))
     return 1;

Modified: gnunet/src/util/test_crypto_ksk.c
===================================================================
--- gnunet/src/util/test_crypto_ksk.c   2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/util/test_crypto_ksk.c   2009-09-08 08:10:18 UTC (rev 8968)
@@ -193,7 +193,7 @@
   struct GNUNET_CRYPTO_RsaPrivateKey *hostkey;
 
   GNUNET_log_setup ("test-crypto-ksk", "WARNING", NULL);
-  GNUNET_CRYPTO_hash_create_random (&in);
+  GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &in);
   hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in);
   if (hostkey == NULL)
     {

Modified: gnunet/src/util/test_pseudonym.c
===================================================================
--- gnunet/src/util/test_pseudonym.c    2009-09-08 07:31:04 UTC (rev 8967)
+++ gnunet/src/util/test_pseudonym.c    2009-09-08 08:10:18 UTC (rev 8968)
@@ -99,7 +99,7 @@
   old = GNUNET_PSEUDONYM_list_all (cfg, NULL, NULL);
   meta = GNUNET_CONTAINER_meta_data_create ();
   GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_TITLE, "test");
-  GNUNET_CRYPTO_hash_create_random (&id1);
+  GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &id1);
   GNUNET_PSEUDONYM_add (cfg, &id1, meta);
   CHECK (notiCount == 1);
   GNUNET_PSEUDONYM_add (cfg, &id1, meta);
@@ -107,7 +107,7 @@
   newVal = GNUNET_PSEUDONYM_list_all (cfg, &iter, &ok);
   CHECK (old < newVal);
   old = newVal;
-  GNUNET_CRYPTO_hash_create_random (&id2);
+  GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &id2);
   GNUNET_PSEUDONYM_add (cfg, &id2, meta);
   CHECK (notiCount == 3);
   newVal = GNUNET_PSEUDONYM_list_all (cfg, &iter, &ok);





reply via email to

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