diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-05-24 20:41:58 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-05-24 20:41:58 +0200 |
commit | 6d8e48a1e98fb285f16052be585fdf8005a76473 (patch) | |
tree | e9aef8a7df284602e98e6ae44a10b2a824f6f4f6 /src | |
parent | 064499b6c26209e4be22a370f23e1cb6b680b615 (diff) | |
download | gnunet-6d8e48a1e98fb285f16052be585fdf8005a76473.tar.gz gnunet-6d8e48a1e98fb285f16052be585fdf8005a76473.zip |
-modify mingling to preserve less structure, breaks protocol slightly...
Diffstat (limited to 'src')
-rw-r--r-- | src/block/block.c | 37 | ||||
-rw-r--r-- | 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 | |||
70 | }; | 70 | }; |
71 | 71 | ||
72 | 72 | ||
73 | GNUNET_NETWORK_STRUCT_BEGIN | ||
74 | |||
75 | |||
76 | /** | ||
77 | * Serialization to use in #GNUNET_BLOCK_mingle_hash. | ||
78 | */ | ||
79 | struct MinglePacker | ||
80 | { | ||
81 | /** | ||
82 | * Original hash. | ||
83 | */ | ||
84 | struct GNUNET_HashCode in; | ||
85 | |||
86 | /** | ||
87 | * Mingle value. | ||
88 | */ | ||
89 | uint32_t mingle GNUNET_PACKED; | ||
90 | }; | ||
91 | |||
92 | GNUNET_NETWORK_STRUCT_END | ||
93 | |||
73 | void | 94 | void |
74 | GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in, | 95 | GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in, |
75 | uint32_t mingle_number, | 96 | uint32_t mingle_number, |
76 | struct GNUNET_HashCode *hc) | 97 | struct GNUNET_HashCode *hc) |
77 | { | 98 | { |
78 | struct GNUNET_HashCode m; | 99 | struct MinglePacker mp = { |
79 | 100 | .in = *in, | |
80 | GNUNET_CRYPTO_hash (&mingle_number, | 101 | .mingle = mingle_number |
81 | sizeof(uint32_t), | 102 | }; |
82 | &m); | 103 | |
83 | GNUNET_CRYPTO_hash_xor (&m, | 104 | GNUNET_CRYPTO_hash (&mp, |
84 | in, | 105 | sizeof(mp), |
85 | hc); | 106 | hc); |
86 | } | 107 | } |
87 | 108 | ||
88 | 109 | ||
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) | |||
358 | * @param cls closure | 358 | * @param cls closure |
359 | * @param bf the filter to manipulate | 359 | * @param bf the filter to manipulate |
360 | * @param bit the current bit | 360 | * @param bit the current bit |
361 | * @return GNUNET_YES to continue, GNUNET_NO to stop early | 361 | * @return #GNUNET_YES to continue, #GNUNET_NO to stop early |
362 | */ | 362 | */ |
363 | typedef int (*BitIterator) (void *cls, | 363 | typedef int |
364 | const struct GNUNET_CONTAINER_BloomFilter *bf, | 364 | (*BitIterator) (void *cls, |
365 | unsigned int bit); | 365 | const struct GNUNET_CONTAINER_BloomFilter *bf, |
366 | unsigned int bit); | ||
366 | 367 | ||
367 | 368 | ||
368 | /** | 369 | /** |