gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: -modify mingling to preserve less struct


From: gnunet
Subject: [gnunet] branch master updated: -modify mingling to preserve less structure, breaks protocol slightly...
Date: Tue, 24 May 2022 20:42:01 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 6d8e48a1e -modify mingling to preserve less structure, breaks protocol 
slightly...
6d8e48a1e is described below

commit 6d8e48a1e98fb285f16052be585fdf8005a76473
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue May 24 20:41:58 2022 +0200

    -modify mingling to preserve less structure, breaks protocol slightly...
---
 src/block/block.c                | 37 +++++++++++++++++++++++++++++--------
 src/util/container_bloomfilter.c |  9 +++++----
 2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/src/block/block.c b/src/block/block.c
index 2e3c1dc70..98095b51c 100644
--- a/src/block/block.c
+++ b/src/block/block.c
@@ -70,19 +70,40 @@ struct GNUNET_BLOCK_Context
 };
 
 
+GNUNET_NETWORK_STRUCT_BEGIN
+
+
+/**
+ * Serialization to use in #GNUNET_BLOCK_mingle_hash.
+ */
+struct MinglePacker
+{
+  /**
+   * Original hash.
+   */
+  struct GNUNET_HashCode in;
+
+  /**
+   * Mingle value.
+   */
+  uint32_t mingle GNUNET_PACKED;
+};
+
+GNUNET_NETWORK_STRUCT_END
+
 void
 GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in,
                           uint32_t mingle_number,
                           struct GNUNET_HashCode *hc)
 {
-  struct GNUNET_HashCode m;
-
-  GNUNET_CRYPTO_hash (&mingle_number,
-                      sizeof(uint32_t),
-                      &m);
-  GNUNET_CRYPTO_hash_xor (&m,
-                          in,
-                          hc);
+  struct MinglePacker mp = {
+    .in = *in,
+    .mingle = mingle_number
+  };
+
+  GNUNET_CRYPTO_hash (&mp,
+                      sizeof(mp),
+                      hc);
 }
 
 
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c
index d89b46252..8a0487e04 100644
--- a/src/util/container_bloomfilter.c
+++ b/src/util/container_bloomfilter.c
@@ -358,11 +358,12 @@ make_empty_file (const struct GNUNET_DISK_FileHandle *fh, 
size_t size)
  * @param cls closure
  * @param bf the filter to manipulate
  * @param bit the current bit
- * @return GNUNET_YES to continue, GNUNET_NO to stop early
+ * @return #GNUNET_YES to continue, #GNUNET_NO to stop early
  */
-typedef int (*BitIterator) (void *cls,
-                            const struct GNUNET_CONTAINER_BloomFilter *bf,
-                            unsigned int bit);
+typedef int
+(*BitIterator) (void *cls,
+                const struct GNUNET_CONTAINER_BloomFilter *bf,
+                unsigned int bit);
 
 
 /**

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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