summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-05-24 20:41:58 +0200
committerChristian Grothoff <christian@grothoff.org>2022-05-24 20:41:58 +0200
commit6d8e48a1e98fb285f16052be585fdf8005a76473 (patch)
treee9aef8a7df284602e98e6ae44a10b2a824f6f4f6
parent064499b6c26209e4be22a370f23e1cb6b680b615 (diff)
-modify mingling to preserve less structure, breaks protocol slightly...
-rw-r--r--src/block/block.c37
-rw-r--r--src/util/container_bloomfilter.c9
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);
/**