aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-05-31 23:43:05 +0200
committerChristian Grothoff <christian@grothoff.org>2022-05-31 23:43:05 +0200
commitedddc9384e9bc4331d57291de7318bbe401e49b0 (patch)
treebe9387df3a4fa4e8cb71590501fb3740920c5bb6
parent02a2c3560aa08c3c7f389706b0e24007e2010bc5 (diff)
downloadgnunet-edddc9384e9bc4331d57291de7318bbe401e49b0.tar.gz
gnunet-edddc9384e9bc4331d57291de7318bbe401e49b0.zip
protocol change: swap xquery and result filter, integrate mutator with result filter
-rw-r--r--src/block/bg_bf.c34
-rw-r--r--src/block/block.c6
-rw-r--r--src/block/plugin_block_template.c25
-rw-r--r--src/block/plugin_block_test.c3
-rw-r--r--src/dht/gnunet-service-dht_clients.c3
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c96
-rw-r--r--src/dht/plugin_block_dht.c3
-rw-r--r--src/dns/plugin_block_dns.c37
-rw-r--r--src/fs/gnunet-service-fs.c2
-rw-r--r--src/fs/gnunet-service-fs.h8
-rw-r--r--src/fs/gnunet-service-fs_cp.c1
-rw-r--r--src/fs/gnunet-service-fs_pr.c10
-rw-r--r--src/fs/gnunet-service-fs_pr.h2
-rw-r--r--src/fs/plugin_block_fs.c11
-rw-r--r--src/gns/plugin_block_gns.c4
-rw-r--r--src/include/gnunet_block_group_lib.h2
-rw-r--r--src/include/gnunet_block_lib.h3
-rw-r--r--src/include/gnunet_block_plugin.h21
-rw-r--r--src/regex/plugin_block_regex.c121
19 files changed, 172 insertions, 220 deletions
diff --git a/src/block/bg_bf.c b/src/block/bg_bf.c
index 601f605a2..520d750aa 100644
--- a/src/block/bg_bf.c
+++ b/src/block/bg_bf.c
@@ -55,7 +55,6 @@ struct BfGroupInternals
55 * Serialize state of a block group. 55 * Serialize state of a block group.
56 * 56 *
57 * @param bg group to serialize 57 * @param bg group to serialize
58 * @param[out] nonce set to the nonce of the @a bg
59 * @param[out] raw_data set to the serialized state 58 * @param[out] raw_data set to the serialized state
60 * @param[out] raw_data_size set to the number of bytes in @a raw_data 59 * @param[out] raw_data_size set to the number of bytes in @a raw_data
61 * @return #GNUNET_OK on success, #GNUNET_NO if serialization is not 60 * @return #GNUNET_OK on success, #GNUNET_NO if serialization is not
@@ -63,24 +62,25 @@ struct BfGroupInternals
63 */ 62 */
64static enum GNUNET_GenericReturnValue 63static enum GNUNET_GenericReturnValue
65bf_group_serialize_cb (struct GNUNET_BLOCK_Group *bg, 64bf_group_serialize_cb (struct GNUNET_BLOCK_Group *bg,
66 uint32_t *nonce,
67 void **raw_data, 65 void **raw_data,
68 size_t *raw_data_size) 66 size_t *raw_data_size)
69{ 67{
70 struct BfGroupInternals *gi = bg->internal_cls; 68 struct BfGroupInternals *gi = bg->internal_cls;
71 char *raw; 69 void *raw;
72 70
73 raw = GNUNET_malloc (gi->bf_size); 71 raw = GNUNET_malloc (gi->bf_size + sizeof (uint32_t));
74 if (GNUNET_OK != 72 if (GNUNET_OK !=
75 GNUNET_CONTAINER_bloomfilter_get_raw_data (gi->bf, 73 GNUNET_CONTAINER_bloomfilter_get_raw_data (gi->bf,
76 raw, 74 raw + sizeof (uint32_t),
77 gi->bf_size)) 75 gi->bf_size))
78 { 76 {
79 GNUNET_free (raw); 77 GNUNET_free (raw);
80 GNUNET_break (0); 78 GNUNET_break (0);
81 return GNUNET_SYSERR; 79 return GNUNET_SYSERR;
82 } 80 }
83 *nonce = gi->bf_mutator; 81 memcpy (raw,
82 &gi->bf_mutator,
83 sizeof (uint32_t));
84 *raw_data = raw; 84 *raw_data = raw;
85 *raw_data_size = gi->bf_size; 85 *raw_data_size = gi->bf_size;
86 return GNUNET_OK; 86 return GNUNET_OK;
@@ -164,7 +164,6 @@ bf_group_destroy_cb (struct GNUNET_BLOCK_Group *bg)
164 * @param bf_size size of the Bloom filter 164 * @param bf_size size of the Bloom filter
165 * @param bf_k K-value for the Bloom filter 165 * @param bf_k K-value for the Bloom filter
166 * @param type block type 166 * @param type block type
167 * @param nonce random value used to seed the group creation
168 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh 167 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
169 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh 168 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
170 * @return block group handle, NULL if block groups are not supported 169 * @return block group handle, NULL if block groups are not supported
@@ -175,13 +174,32 @@ GNUNET_BLOCK_GROUP_bf_create (void *cls,
175 size_t bf_size, 174 size_t bf_size,
176 unsigned int bf_k, 175 unsigned int bf_k,
177 enum GNUNET_BLOCK_Type type, 176 enum GNUNET_BLOCK_Type type,
178 uint32_t nonce,
179 const void *raw_data, 177 const void *raw_data,
180 size_t raw_data_size) 178 size_t raw_data_size)
181{ 179{
182 struct BfGroupInternals *gi; 180 struct BfGroupInternals *gi;
183 struct GNUNET_BLOCK_Group *bg; 181 struct GNUNET_BLOCK_Group *bg;
182 uint32_t nonce;
184 183
184 if ( (NULL != raw_data) &&
185 (raw_data_size < sizeof (nonce)) )
186 {
187 GNUNET_break_op (0);
188 return NULL;
189 }
190 if (NULL != raw_data)
191 {
192 memcpy (&nonce,
193 raw_data,
194 sizeof (nonce));
195 raw_data += sizeof (nonce);
196 raw_data_size -= sizeof (nonce);
197 }
198 else
199 {
200 nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
201 UINT32_MAX);
202 }
185 gi = GNUNET_new (struct BfGroupInternals); 203 gi = GNUNET_new (struct BfGroupInternals);
186 gi->bf = GNUNET_CONTAINER_bloomfilter_init ((bf_size != raw_data_size) ? 204 gi->bf = GNUNET_CONTAINER_bloomfilter_init ((bf_size != raw_data_size) ?
187 NULL : raw_data, 205 NULL : raw_data,
diff --git a/src/block/block.c b/src/block/block.c
index 98095b51c..4b2d8a960 100644
--- a/src/block/block.c
+++ b/src/block/block.c
@@ -91,6 +91,7 @@ struct MinglePacker
91 91
92GNUNET_NETWORK_STRUCT_END 92GNUNET_NETWORK_STRUCT_END
93 93
94
94void 95void
95GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in, 96GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in,
96 uint32_t mingle_number, 97 uint32_t mingle_number,
@@ -172,11 +173,9 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx)
172 173
173enum GNUNET_GenericReturnValue 174enum GNUNET_GenericReturnValue
174GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg, 175GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg,
175 uint32_t *nonce,
176 void **raw_data, 176 void **raw_data,
177 size_t *raw_data_size) 177 size_t *raw_data_size)
178{ 178{
179 *nonce = 0;
180 *raw_data = NULL; 179 *raw_data = NULL;
181 *raw_data_size = 0; 180 *raw_data_size = 0;
182 if (NULL == bg) 181 if (NULL == bg)
@@ -184,7 +183,6 @@ GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg,
184 if (NULL == bg->serialize_cb) 183 if (NULL == bg->serialize_cb)
185 return GNUNET_NO; 184 return GNUNET_NO;
186 return bg->serialize_cb (bg, 185 return bg->serialize_cb (bg,
187 nonce,
188 raw_data, 186 raw_data,
189 raw_data_size); 187 raw_data_size);
190} 188}
@@ -248,7 +246,6 @@ find_plugin (struct GNUNET_BLOCK_Context *ctx,
248struct GNUNET_BLOCK_Group * 246struct GNUNET_BLOCK_Group *
249GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx, 247GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
250 enum GNUNET_BLOCK_Type type, 248 enum GNUNET_BLOCK_Type type,
251 uint32_t nonce,
252 const void *raw_data, 249 const void *raw_data,
253 size_t raw_data_size, 250 size_t raw_data_size,
254 ...) 251 ...)
@@ -267,7 +264,6 @@ GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
267 raw_data_size); 264 raw_data_size);
268 bg = plugin->create_group (plugin->cls, 265 bg = plugin->create_group (plugin->cls,
269 type, 266 type,
270 nonce,
271 raw_data, 267 raw_data,
272 raw_data_size, 268 raw_data_size,
273 ap); 269 ap);
diff --git a/src/block/plugin_block_template.c b/src/block/plugin_block_template.c
index dcaf1afaa..46a370924 100644
--- a/src/block/plugin_block_template.c
+++ b/src/block/plugin_block_template.c
@@ -48,7 +48,6 @@
48 * 48 *
49 * @param ctx block context in which the block group is created 49 * @param ctx block context in which the block group is created
50 * @param type type of the block for which we are creating the group 50 * @param type type of the block for which we are creating the group
51 * @param nonce random value used to seed the group creation
52 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh 51 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
53 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh 52 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
54 * @param va variable arguments specific to @a type 53 * @param va variable arguments specific to @a type
@@ -58,7 +57,6 @@
58static struct GNUNET_BLOCK_Group * 57static struct GNUNET_BLOCK_Group *
59block_plugin_template_create_group (void *cls, 58block_plugin_template_create_group (void *cls,
60 enum GNUNET_BLOCK_Type type, 59 enum GNUNET_BLOCK_Type type,
61 uint32_t nonce,
62 const void *raw_data, 60 const void *raw_data,
63 size_t raw_data_size, 61 size_t raw_data_size,
64 va_list va) 62 va_list va)
@@ -85,7 +83,6 @@ block_plugin_template_create_group (void *cls,
85 bf_size, 83 bf_size,
86 BLOOMFILTER_K, 84 BLOOMFILTER_K,
87 type, 85 type,
88 nonce,
89 raw_data, 86 raw_data,
90 raw_data_size); 87 raw_data_size);
91} 88}
@@ -124,9 +121,9 @@ block_plugin_template_check_query (void *cls,
124 */ 121 */
125static enum GNUNET_GenericReturnValue 122static enum GNUNET_GenericReturnValue
126block_plugin_template_check_block (void *cls, 123block_plugin_template_check_block (void *cls,
127 enum GNUNET_BLOCK_Type type, 124 enum GNUNET_BLOCK_Type type,
128 const void *block, 125 const void *block,
129 size_t block_size) 126 size_t block_size)
130{ 127{
131 return GNUNET_SYSERR; 128 return GNUNET_SYSERR;
132} 129}
@@ -150,14 +147,14 @@ block_plugin_template_check_block (void *cls,
150 */ 147 */
151static enum GNUNET_BLOCK_ReplyEvaluationResult 148static enum GNUNET_BLOCK_ReplyEvaluationResult
152block_plugin_template_check_reply ( 149block_plugin_template_check_reply (
153 void *cls, 150 void *cls,
154 enum GNUNET_BLOCK_Type type, 151 enum GNUNET_BLOCK_Type type,
155 struct GNUNET_BLOCK_Group *group, 152 struct GNUNET_BLOCK_Group *group,
156 const struct GNUNET_HashCode *query, 153 const struct GNUNET_HashCode *query,
157 const void *xquery, 154 const void *xquery,
158 size_t xquery_size, 155 size_t xquery_size,
159 const void *reply_block, 156 const void *reply_block,
160 size_t reply_block_size) 157 size_t reply_block_size)
161{ 158{
162 return GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED; 159 return GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED;
163} 160}
diff --git a/src/block/plugin_block_test.c b/src/block/plugin_block_test.c
index 05d379387..2e404bbc2 100644
--- a/src/block/plugin_block_test.c
+++ b/src/block/plugin_block_test.c
@@ -46,7 +46,6 @@
46 * 46 *
47 * @param ctx block context in which the block group is created 47 * @param ctx block context in which the block group is created
48 * @param type type of the block for which we are creating the group 48 * @param type type of the block for which we are creating the group
49 * @param nonce random value used to seed the group creation
50 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh 49 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
51 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh 50 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
52 * @param va variable arguments specific to @a type 51 * @param va variable arguments specific to @a type
@@ -56,7 +55,6 @@
56static struct GNUNET_BLOCK_Group * 55static struct GNUNET_BLOCK_Group *
57block_plugin_test_create_group (void *cls, 56block_plugin_test_create_group (void *cls,
58 enum GNUNET_BLOCK_Type type, 57 enum GNUNET_BLOCK_Type type,
59 uint32_t nonce,
60 const void *raw_data, 58 const void *raw_data,
61 size_t raw_data_size, 59 size_t raw_data_size,
62 va_list va) 60 va_list va)
@@ -83,7 +81,6 @@ block_plugin_test_create_group (void *cls,
83 bf_size, 81 bf_size,
84 BLOOMFILTER_K, 82 BLOOMFILTER_K,
85 type, 83 type,
86 nonce,
87 raw_data, 84 raw_data,
88 raw_data_size); 85 raw_data_size);
89} 86}
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index 6a4f58d1f..fd65102b3 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -381,9 +381,6 @@ transmit_request (struct ClientQueryRecord *cqr)
381 GNUNET_NO); 381 GNUNET_NO);
382 bg = GNUNET_BLOCK_group_create (GDS_block_context, 382 bg = GNUNET_BLOCK_group_create (GDS_block_context,
383 cqr->type, 383 cqr->type,
384 GNUNET_CRYPTO_random_u32 (
385 GNUNET_CRYPTO_QUALITY_WEAK,
386 UINT32_MAX),
387 NULL, /* raw data */ 384 NULL, /* raw data */
388 0, /* raw data size */ 385 0, /* raw data size */
389 "seen-set-size", 386 "seen-set-size",
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 2f9cbab84..9a3abc376 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -39,15 +39,15 @@
39 __VA_ARGS__) 39 __VA_ARGS__)
40 40
41/** 41/**
42 * Enable slow sanity checks to debug issues. 42 * Enable slow sanity checks to debug issues.
43 * 43 *
44 * TODO: might want to eventually implement probabilistic 44 * TODO: might want to eventually implement probabilistic
45 * load-based path verification, but for now it is all or nothing 45 * load-based path verification, but for now it is all or nothing
46 * based on this define. 46 * based on this define.
47 * 47 *
48 * 0: do not check -- if signatures become performance critical 48 * 0: do not check -- if signatures become performance critical
49 * 1: check all external inputs -- normal production for now 49 * 1: check all external inputs -- normal production for now
50 * 2: check internal computations as well -- for debugging 50 * 2: check internal computations as well -- for debugging
51 */ 51 */
52#define SANITY_CHECKS 2 52#define SANITY_CHECKS 2
53 53
@@ -235,9 +235,9 @@ struct PeerGetMessage
235 uint16_t desired_replication_level GNUNET_PACKED; 235 uint16_t desired_replication_level GNUNET_PACKED;
236 236
237 /** 237 /**
238 * Size of the extended query. 238 * Size of the result filter.
239 */ 239 */
240 uint16_t xquery_size; 240 uint16_t result_filter_size GNUNET_PACKED;
241 241
242 /** 242 /**
243 * Bloomfilter (for peer identities) to stop circular routes 243 * Bloomfilter (for peer identities) to stop circular routes
@@ -249,14 +249,10 @@ struct PeerGetMessage
249 */ 249 */
250 struct GNUNET_HashCode key; 250 struct GNUNET_HashCode key;
251 251
252 /** 252 /* result bloomfilter */
253 * Bloomfilter mutator.
254 */
255 uint32_t bf_mutator;
256 253
257 /* xquery */ 254 /* xquery */
258 255
259 /* result bloomfilter */
260}; 256};
261GNUNET_NETWORK_STRUCT_END 257GNUNET_NETWORK_STRUCT_END
262 258
@@ -654,9 +650,6 @@ send_find_peer_message (void *cls)
654 650
655 bg = GNUNET_BLOCK_group_create (GDS_block_context, 651 bg = GNUNET_BLOCK_group_create (GDS_block_context,
656 GNUNET_BLOCK_TYPE_DHT_URL_HELLO, 652 GNUNET_BLOCK_TYPE_DHT_URL_HELLO,
657 GNUNET_CRYPTO_random_u32 (
658 GNUNET_CRYPTO_QUALITY_WEAK,
659 UINT32_MAX),
660 NULL, 653 NULL,
661 0, 654 0,
662 "filter-size", 655 "filter-size",
@@ -1287,9 +1280,9 @@ get_target_peers (const struct GNUNET_HashCode *key,
1287 1280
1288 1281
1289/** 1282/**
1290 * If we got a HELLO, consider it for our own routing table 1283 * If we got a HELLO, consider it for our own routing table
1291 * 1284 *
1292 * @param bd block data we got 1285 * @param bd block data we got
1293 */ 1286 */
1294static void 1287static void
1295hello_check (const struct GDS_DATACACHE_BlockData *bd) 1288hello_check (const struct GDS_DATACACHE_BlockData *bd)
@@ -1345,7 +1338,7 @@ GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd,
1345 GNUNET_h2s (&bd->key), 1338 GNUNET_h2s (&bd->key),
1346 (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE) ? "x" : "-", 1339 (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE) ? "x" : "-",
1347 (options & GNUNET_DHT_RO_RECORD_ROUTE) ? "R" : "-"); 1340 (options & GNUNET_DHT_RO_RECORD_ROUTE) ? "R" : "-");
1348 1341
1349 /* if we got a HELLO, consider it for our own routing table */ 1342 /* if we got a HELLO, consider it for our own routing table */
1350 hello_check (bd); 1343 hello_check (bd);
1351 GNUNET_CONTAINER_bloomfilter_add (bf, 1344 GNUNET_CONTAINER_bloomfilter_add (bf,
@@ -1464,10 +1457,9 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1464 unsigned int target_count; 1457 unsigned int target_count;
1465 struct PeerInfo **targets; 1458 struct PeerInfo **targets;
1466 size_t msize; 1459 size_t msize;
1467 size_t reply_bf_size; 1460 size_t result_filter_size;
1468 void *reply_bf; 1461 void *result_filter;
1469 unsigned int skip_count; 1462 unsigned int skip_count;
1470 uint32_t bf_nonce;
1471 1463
1472 GNUNET_assert (NULL != peer_bf); 1464 GNUNET_assert (NULL != peer_bf);
1473 GNUNET_STATISTICS_update (GDS_stats, 1465 GNUNET_STATISTICS_update (GDS_stats,
@@ -1499,20 +1491,17 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1499 } 1491 }
1500 if (GNUNET_OK != 1492 if (GNUNET_OK !=
1501 GNUNET_BLOCK_group_serialize (bg, 1493 GNUNET_BLOCK_group_serialize (bg,
1502 &bf_nonce, 1494 &result_filter,
1503 &reply_bf, 1495 &result_filter_size))
1504 &reply_bf_size))
1505 { 1496 {
1506 reply_bf = NULL; 1497 result_filter = NULL;
1507 reply_bf_size = 0; 1498 result_filter_size = 0;
1508 bf_nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
1509 UINT32_MAX);
1510 } 1499 }
1511 msize = xquery_size + reply_bf_size; 1500 msize = xquery_size + result_filter_size;
1512 if (msize + sizeof(struct PeerGetMessage) >= GNUNET_MAX_MESSAGE_SIZE) 1501 if (msize + sizeof(struct PeerGetMessage) >= GNUNET_MAX_MESSAGE_SIZE)
1513 { 1502 {
1514 GNUNET_break (0); 1503 GNUNET_break (0);
1515 GNUNET_free (reply_bf); 1504 GNUNET_free (result_filter);
1516 GNUNET_free (targets); 1505 GNUNET_free (targets);
1517 return GNUNET_NO; 1506 return GNUNET_NO;
1518 } 1507 }
@@ -1523,7 +1512,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1523 struct PeerInfo *target = targets[i]; 1512 struct PeerInfo *target = targets[i];
1524 struct PeerGetMessage *pgm; 1513 struct PeerGetMessage *pgm;
1525 char buf[sizeof (*pgm) + msize] GNUNET_ALIGN; 1514 char buf[sizeof (*pgm) + msize] GNUNET_ALIGN;
1526 char *xq; 1515 char *rf;
1527 1516
1528 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1517 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1529 "Routing GET for %s after %u hops to %s\n", 1518 "Routing GET for %s after %u hops to %s\n",
@@ -1537,8 +1526,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1537 pgm->options = htons (options); 1526 pgm->options = htons (options);
1538 pgm->hop_count = htons (hop_count + 1); 1527 pgm->hop_count = htons (hop_count + 1);
1539 pgm->desired_replication_level = htons (desired_replication_level); 1528 pgm->desired_replication_level = htons (desired_replication_level);
1540 pgm->xquery_size = htonl (xquery_size); 1529 pgm->result_filter_size = htonl (result_filter_size);
1541 pgm->bf_mutator = bf_nonce;
1542 GNUNET_break (GNUNET_YES == 1530 GNUNET_break (GNUNET_YES ==
1543 GNUNET_CONTAINER_bloomfilter_test (peer_bf, 1531 GNUNET_CONTAINER_bloomfilter_test (peer_bf,
1544 &target->phash)); 1532 &target->phash));
@@ -1547,13 +1535,13 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1547 pgm->bloomfilter, 1535 pgm->bloomfilter,
1548 DHT_BLOOM_SIZE)); 1536 DHT_BLOOM_SIZE));
1549 pgm->key = *key; 1537 pgm->key = *key;
1550 xq = (char *) &pgm[1]; 1538 rf = (char *) &pgm[1];
1551 GNUNET_memcpy (xq, 1539 GNUNET_memcpy (rf,
1540 result_filter,
1541 result_filter_size);
1542 GNUNET_memcpy (&rf[result_filter_size],
1552 xquery, 1543 xquery,
1553 xquery_size); 1544 xquery_size);
1554 GNUNET_memcpy (&xq[xquery_size],
1555 reply_bf,
1556 reply_bf_size);
1557 do_send (target, 1545 do_send (target,
1558 &pgm->header); 1546 &pgm->header);
1559 } 1547 }
@@ -1562,7 +1550,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1562 target_count - skip_count, 1550 target_count - skip_count,
1563 GNUNET_NO); 1551 GNUNET_NO);
1564 GNUNET_free (targets); 1552 GNUNET_free (targets);
1565 GNUNET_free (reply_bf); 1553 GNUNET_free (result_filter);
1566 return (skip_count < target_count) ? GNUNET_OK : GNUNET_NO; 1554 return (skip_count < target_count) ? GNUNET_OK : GNUNET_NO;
1567} 1555}
1568 1556
@@ -1852,7 +1840,7 @@ handle_dht_p2p_put (void *cls,
1852 if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE)) 1840 if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
1853 { 1841 {
1854 unsigned int failure_offset; 1842 unsigned int failure_offset;
1855 1843
1856 GNUNET_memcpy (pp, 1844 GNUNET_memcpy (pp,
1857 put_path, 1845 put_path,
1858 putlen * sizeof(struct GNUNET_DHT_PathElement)); 1846 putlen * sizeof(struct GNUNET_DHT_PathElement));
@@ -1861,10 +1849,10 @@ handle_dht_p2p_put (void *cls,
1861 memset (&pp[putlen].sig, 1849 memset (&pp[putlen].sig,
1862 0, 1850 0,
1863 sizeof (pp[putlen].sig)); 1851 sizeof (pp[putlen].sig));
1864#if SANITY_CHECKS 1852#if SANITY_CHECKS
1865 /* TODO: might want to eventually implement probabilistic 1853 /* TODO: might want to eventually implement probabilistic
1866 load-based path verification, but for now it is all or nothing */ 1854 load-based path verification, but for now it is all or nothing */
1867 failure_offset 1855 failure_offset
1868 = GNUNET_DHT_verify_path (bd.data, 1856 = GNUNET_DHT_verify_path (bd.data,
1869 bd.data_size, 1857 bd.data_size,
1870 bd.expiration_time, 1858 bd.expiration_time,
@@ -1883,7 +1871,7 @@ handle_dht_p2p_put (void *cls,
1883 GNUNET_assert (failure_offset <= putlen); 1871 GNUNET_assert (failure_offset <= putlen);
1884 bd.put_path = &pp[failure_offset]; 1872 bd.put_path = &pp[failure_offset];
1885 bd.put_path_length = putlen - failure_offset; 1873 bd.put_path_length = putlen - failure_offset;
1886 } 1874 }
1887 } 1875 }
1888 else 1876 else
1889 { 1877 {
@@ -2073,10 +2061,10 @@ check_dht_p2p_get (void *cls,
2073 const struct PeerGetMessage *get) 2061 const struct PeerGetMessage *get)
2074{ 2062{
2075 uint16_t msize = ntohs (get->header.size); 2063 uint16_t msize = ntohs (get->header.size);
2076 uint32_t xquery_size = ntohl (get->xquery_size); 2064 uint32_t result_filter_size = ntohl (get->result_filter_size);
2077 2065
2078 (void) cls; 2066 (void) cls;
2079 if (msize < sizeof(*get) + xquery_size) 2067 if (msize < sizeof(*get) + result_filter_size)
2080 { 2068 {
2081 GNUNET_break_op (0); 2069 GNUNET_break_op (0);
2082 return GNUNET_SYSERR; 2070 return GNUNET_SYSERR;
@@ -2098,14 +2086,15 @@ handle_dht_p2p_get (void *cls,
2098 struct Target *t = cls; 2086 struct Target *t = cls;
2099 struct PeerInfo *peer = t->pi; 2087 struct PeerInfo *peer = t->pi;
2100 uint16_t msize = ntohs (get->header.size); 2088 uint16_t msize = ntohs (get->header.size);
2101 uint32_t xquery_size = ntohl (get->xquery_size); 2089 uint32_t result_filter_size = ntohl (get->result_filter_size);
2102 uint32_t hop_count = ntohs (get->hop_count); 2090 uint32_t hop_count = ntohs (get->hop_count);
2103 size_t reply_bf_size = msize - (sizeof(*get) + xquery_size);
2104 enum GNUNET_BLOCK_Type type = (enum GNUNET_BLOCK_Type) ntohl (get->type); 2091 enum GNUNET_BLOCK_Type type = (enum GNUNET_BLOCK_Type) ntohl (get->type);
2105 enum GNUNET_DHT_RouteOption options = (enum GNUNET_DHT_RouteOption) ntohs ( 2092 enum GNUNET_DHT_RouteOption options = (enum GNUNET_DHT_RouteOption) ntohs (
2106 get->options); 2093 get->options);
2107 enum GNUNET_BLOCK_ReplyEvaluationResult eval = GNUNET_BLOCK_REPLY_OK_MORE; 2094 enum GNUNET_BLOCK_ReplyEvaluationResult eval = GNUNET_BLOCK_REPLY_OK_MORE;
2108 const void *xquery = (const void *) &get[1]; 2095 const void *result_filter = (const void *) &get[1];
2096 const void *xquery = result_filter + result_filter_size;
2097 size_t xquery_size = msize - sizeof (*get) - result_filter_size;
2109 2098
2110 /* parse and validate message */ 2099 /* parse and validate message */
2111 GNUNET_STATISTICS_update (GDS_stats, 2100 GNUNET_STATISTICS_update (GDS_stats,
@@ -2140,11 +2129,10 @@ handle_dht_p2p_get (void *cls,
2140 &peer->phash)); 2129 &peer->phash));
2141 bg = GNUNET_BLOCK_group_create (GDS_block_context, 2130 bg = GNUNET_BLOCK_group_create (GDS_block_context,
2142 type, 2131 type,
2143 get->bf_mutator, 2132 result_filter,
2144 xquery + xquery_size, 2133 result_filter_size,
2145 reply_bf_size,
2146 "filter-size", 2134 "filter-size",
2147 reply_bf_size, 2135 result_filter_size,
2148 NULL); 2136 NULL);
2149 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2137 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2150 "GET for %s at %s after %u hops\n", 2138 "GET for %s at %s after %u hops\n",
@@ -2353,7 +2341,7 @@ handle_dht_p2p_result (void *cls,
2353 }; 2341 };
2354 const struct GNUNET_DHT_PathElement *get_path 2342 const struct GNUNET_DHT_PathElement *get_path
2355 = &bd.put_path[bd.put_path_length]; 2343 = &bd.put_path[bd.put_path_length];
2356 2344
2357 /* parse and validate message */ 2345 /* parse and validate message */
2358 if (GNUNET_TIME_absolute_is_past (bd.expiration_time)) 2346 if (GNUNET_TIME_absolute_is_past (bd.expiration_time))
2359 { 2347 {
@@ -2416,7 +2404,7 @@ handle_dht_p2p_result (void *cls,
2416#if SANITY_CHECKS 2404#if SANITY_CHECKS
2417 /* TODO: might want to eventually implement probabilistic 2405 /* TODO: might want to eventually implement probabilistic
2418 load-based path verification, but for now it is all or nothing */ 2406 load-based path verification, but for now it is all or nothing */
2419 failure_offset 2407 failure_offset
2420 = GNUNET_DHT_verify_path (bd.data, 2408 = GNUNET_DHT_verify_path (bd.data,
2421 bd.data_size, 2409 bd.data_size,
2422 bd.expiration_time, 2410 bd.expiration_time,
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c
index 3dd3dd792..bee16736c 100644
--- a/src/dht/plugin_block_dht.c
+++ b/src/dht/plugin_block_dht.c
@@ -46,7 +46,6 @@
46 * 46 *
47 * @param ctx block context in which the block group is created 47 * @param ctx block context in which the block group is created
48 * @param type type of the block for which we are creating the group 48 * @param type type of the block for which we are creating the group
49 * @param nonce random value used to seed the group creation
50 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh 49 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
51 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh 50 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
52 * @param va variable arguments specific to @a type 51 * @param va variable arguments specific to @a type
@@ -56,7 +55,6 @@
56static struct GNUNET_BLOCK_Group * 55static struct GNUNET_BLOCK_Group *
57block_plugin_dht_create_group (void *cls, 56block_plugin_dht_create_group (void *cls,
58 enum GNUNET_BLOCK_Type type, 57 enum GNUNET_BLOCK_Type type,
59 uint32_t nonce,
60 const void *raw_data, 58 const void *raw_data,
61 size_t raw_data_size, 59 size_t raw_data_size,
62 va_list va) 60 va_list va)
@@ -83,7 +81,6 @@ block_plugin_dht_create_group (void *cls,
83 bf_size, 81 bf_size,
84 BLOOMFILTER_K, 82 BLOOMFILTER_K,
85 type, 83 type,
86 nonce,
87 raw_data, 84 raw_data,
88 raw_data_size); 85 raw_data_size);
89} 86}
diff --git a/src/dns/plugin_block_dns.c b/src/dns/plugin_block_dns.c
index a596beb28..0531a8a5f 100644
--- a/src/dns/plugin_block_dns.c
+++ b/src/dns/plugin_block_dns.c
@@ -46,7 +46,6 @@
46 * 46 *
47 * @param ctx block context in which the block group is created 47 * @param ctx block context in which the block group is created
48 * @param type type of the block for which we are creating the group 48 * @param type type of the block for which we are creating the group
49 * @param nonce random value used to seed the group creation
50 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh 49 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
51 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh 50 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
52 * @param va variable arguments specific to @a type 51 * @param va variable arguments specific to @a type
@@ -56,7 +55,6 @@
56static struct GNUNET_BLOCK_Group * 55static struct GNUNET_BLOCK_Group *
57block_plugin_dns_create_group (void *cls, 56block_plugin_dns_create_group (void *cls,
58 enum GNUNET_BLOCK_Type type, 57 enum GNUNET_BLOCK_Type type,
59 uint32_t nonce,
60 const void *raw_data, 58 const void *raw_data,
61 size_t raw_data_size, 59 size_t raw_data_size,
62 va_list va) 60 va_list va)
@@ -83,7 +81,6 @@ block_plugin_dns_create_group (void *cls,
83 bf_size, 81 bf_size,
84 BLOOMFILTER_K, 82 BLOOMFILTER_K,
85 type, 83 type,
86 nonce,
87 raw_data, 84 raw_data,
88 raw_data_size); 85 raw_data_size);
89} 86}
@@ -102,19 +99,19 @@ block_plugin_dns_create_group (void *cls,
102 */ 99 */
103static enum GNUNET_GenericReturnValue 100static enum GNUNET_GenericReturnValue
104block_plugin_dns_check_query (void *cls, 101block_plugin_dns_check_query (void *cls,
105 enum GNUNET_BLOCK_Type type, 102 enum GNUNET_BLOCK_Type type,
106 const struct GNUNET_HashCode *query, 103 const struct GNUNET_HashCode *query,
107 const void *xquery, 104 const void *xquery,
108 size_t xquery_size) 105 size_t xquery_size)
109{ 106{
110 switch (type) 107 switch (type)
111 { 108 {
112 case GNUNET_BLOCK_TYPE_DNS: 109 case GNUNET_BLOCK_TYPE_DNS:
113 if (0 != xquery_size) 110 if (0 != xquery_size)
114 { 111 {
115 GNUNET_break_op (0); 112 GNUNET_break_op (0);
116 return GNUNET_NO; 113 return GNUNET_NO;
117 } 114 }
118 return GNUNET_OK; 115 return GNUNET_OK;
119 default: 116 default:
120 GNUNET_break (0); 117 GNUNET_break (0);
@@ -158,7 +155,7 @@ block_plugin_dns_check_block (void *cls,
158 return GNUNET_NO; 155 return GNUNET_NO;
159 } 156 }
160 if (GNUNET_TIME_absolute_is_past ( 157 if (GNUNET_TIME_absolute_is_past (
161 GNUNET_TIME_absolute_ntoh (ad->expiration_time))) 158 GNUNET_TIME_absolute_ntoh (ad->expiration_time)))
162 { 159 {
163 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 160 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
164 "DNS advertisement has expired\n"); 161 "DNS advertisement has expired\n");
@@ -199,14 +196,14 @@ block_plugin_dns_check_block (void *cls,
199 */ 196 */
200static enum GNUNET_BLOCK_ReplyEvaluationResult 197static enum GNUNET_BLOCK_ReplyEvaluationResult
201block_plugin_dns_check_reply ( 198block_plugin_dns_check_reply (
202 void *cls, 199 void *cls,
203 enum GNUNET_BLOCK_Type type, 200 enum GNUNET_BLOCK_Type type,
204 struct GNUNET_BLOCK_Group *group, 201 struct GNUNET_BLOCK_Group *group,
205 const struct GNUNET_HashCode *query, 202 const struct GNUNET_HashCode *query,
206 const void *xquery, 203 const void *xquery,
207 size_t xquery_size, 204 size_t xquery_size,
208 const void *reply_block, 205 const void *reply_block,
209 size_t reply_block_size) 206 size_t reply_block_size)
210{ 207{
211 struct GNUNET_HashCode phash; 208 struct GNUNET_HashCode phash;
212 209
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 8c6c39885..05c7e2192 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -893,7 +893,7 @@ handle_client_start_search (void *cls,
893 &all_zeros, 893 &all_zeros,
894 sizeof(struct 894 sizeof(struct
895 GNUNET_PeerIdentity))) 895 GNUNET_PeerIdentity)))
896 ? &sm->target : NULL, NULL, 0, 896 ? &sm->target : NULL, NULL,
897 0 /* bf */, 897 0 /* bf */,
898 ntohl (sm->anonymity_level), 898 ntohl (sm->anonymity_level),
899 0 /* priority */, 899 0 /* priority */,
diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h
index a6b73db09..56d102673 100644
--- a/src/fs/gnunet-service-fs.h
+++ b/src/fs/gnunet-service-fs.h
@@ -103,13 +103,9 @@ struct GetMessage
103 int32_t ttl GNUNET_PACKED; 103 int32_t ttl GNUNET_PACKED;
104 104
105 /** 105 /**
106 * The content hash should be mutated using this value 106 * These days not used.
107 * before checking against the bloomfilter (used to
108 * get many different filters for the same hash codes).
109 * The number should be in big-endian format when used
110 * for mingling.
111 */ 107 */
112 uint32_t filter_mutator GNUNET_PACKED; 108 uint32_t reserved GNUNET_PACKED;
113 109
114 /** 110 /**
115 * Which of the optional hash codes are present at the end of the 111 * Which of the optional hash codes are present at the end of the
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 5476aa2be..30b895752 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -1317,7 +1317,6 @@ handle_p2p_get (void *cls,
1317 ? (const char *) &opt[bits] 1317 ? (const char *) &opt[bits]
1318 : NULL, 1318 : NULL,
1319 bfsize, 1319 bfsize,
1320 ntohl (gm->filter_mutator),
1321 1 /* anonymity */, 1320 1 /* anonymity */,
1322 (uint32_t) tec.priority, 1321 (uint32_t) tec.priority,
1323 tec.ttl, 1322 tec.ttl,
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index 154c454ca..f05194907 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -260,9 +260,6 @@ refresh_bloomfilter (enum GNUNET_BLOCK_Type type,
260 pr->bg = 260 pr->bg =
261 GNUNET_BLOCK_group_create (GSF_block_ctx, 261 GNUNET_BLOCK_group_create (GSF_block_ctx,
262 type, 262 type,
263 GNUNET_CRYPTO_random_u32 (
264 GNUNET_CRYPTO_QUALITY_WEAK,
265 UINT32_MAX),
266 NULL, 263 NULL,
267 0, 264 0,
268 "seen-set-size", 265 "seen-set-size",
@@ -286,7 +283,6 @@ refresh_bloomfilter (enum GNUNET_BLOCK_Type type,
286 * @param target preferred target for the request, NULL for none 283 * @param target preferred target for the request, NULL for none
287 * @param bf_data raw data for bloom filter for known replies, can be NULL 284 * @param bf_data raw data for bloom filter for known replies, can be NULL
288 * @param bf_size number of bytes in @a bf_data 285 * @param bf_size number of bytes in @a bf_data
289 * @param mingle mingle value for bf
290 * @param anonymity_level desired anonymity level 286 * @param anonymity_level desired anonymity level
291 * @param priority maximum outgoing cumulative request priority to use 287 * @param priority maximum outgoing cumulative request priority to use
292 * @param ttl current time-to-live for the request 288 * @param ttl current time-to-live for the request
@@ -305,7 +301,6 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
305 const struct GNUNET_PeerIdentity *target, 301 const struct GNUNET_PeerIdentity *target,
306 const char *bf_data, 302 const char *bf_data,
307 size_t bf_size, 303 size_t bf_size,
308 uint32_t mingle,
309 uint32_t anonymity_level, 304 uint32_t anonymity_level,
310 uint32_t priority, 305 uint32_t priority,
311 int32_t ttl, 306 int32_t ttl,
@@ -376,7 +371,6 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
376 { 371 {
377 pr->bg = GNUNET_BLOCK_group_create (GSF_block_ctx, 372 pr->bg = GNUNET_BLOCK_group_create (GSF_block_ctx,
378 pr->public_data.type, 373 pr->public_data.type,
379 mingle,
380 bf_data, 374 bf_data,
381 bf_size, 375 bf_size,
382 "seen-set-size", 376 "seen-set-size",
@@ -533,7 +527,6 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr)
533 int64_t ttl; 527 int64_t ttl;
534 int do_route; 528 int do_route;
535 void *bf_data; 529 void *bf_data;
536 uint32_t bf_nonce;
537 530
538 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 531 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
539 "Building request message for `%s' of type %d\n", 532 "Building request message for `%s' of type %d\n",
@@ -559,7 +552,6 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr)
559 } 552 }
560 if (GNUNET_OK != 553 if (GNUNET_OK !=
561 GNUNET_BLOCK_group_serialize (pr->bg, 554 GNUNET_BLOCK_group_serialize (pr->bg,
562 &bf_nonce,
563 &bf_data, 555 &bf_data,
564 &bf_size)) 556 &bf_size))
565 { 557 {
@@ -582,7 +574,7 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr)
582 now = GNUNET_TIME_absolute_get (); 574 now = GNUNET_TIME_absolute_get ();
583 ttl = (int64_t) (pr->public_data.ttl.abs_value_us - now.abs_value_us); 575 ttl = (int64_t) (pr->public_data.ttl.abs_value_us - now.abs_value_us);
584 gm->ttl = htonl (ttl / 1000LL / 1000LL); 576 gm->ttl = htonl (ttl / 1000LL / 1000LL);
585 gm->filter_mutator = htonl (bf_nonce); 577 gm->reserved = htonl (0);
586 gm->hash_bitmap = htonl (bm); 578 gm->hash_bitmap = htonl (bm);
587 gm->query = pr->public_data.query; 579 gm->query = pr->public_data.query;
588 ext = (struct GNUNET_PeerIdentity *) &gm[1]; 580 ext = (struct GNUNET_PeerIdentity *) &gm[1];
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h
index a10fb9b4c..339e409c5 100644
--- a/src/fs/gnunet-service-fs_pr.h
+++ b/src/fs/gnunet-service-fs_pr.h
@@ -206,7 +206,6 @@ typedef void
206 * @param target preferred target for the request, NULL for none 206 * @param target preferred target for the request, NULL for none
207 * @param bf_data raw data for bloom filter for known replies, can be NULL 207 * @param bf_data raw data for bloom filter for known replies, can be NULL
208 * @param bf_size number of bytes in bf_data 208 * @param bf_size number of bytes in bf_data
209 * @param mingle mingle value for bf
210 * @param anonymity_level desired anonymity level 209 * @param anonymity_level desired anonymity level
211 * @param priority maximum outgoing cumulative request priority to use 210 * @param priority maximum outgoing cumulative request priority to use
212 * @param ttl current time-to-live for the request 211 * @param ttl current time-to-live for the request
@@ -226,7 +225,6 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
226 const struct GNUNET_PeerIdentity *target, 225 const struct GNUNET_PeerIdentity *target,
227 const char *bf_data, 226 const char *bf_data,
228 size_t bf_size, 227 size_t bf_size,
229 uint32_t mingle,
230 uint32_t anonymity_level, 228 uint32_t anonymity_level,
231 uint32_t priority, 229 uint32_t priority,
232 int32_t ttl, 230 int32_t ttl,
diff --git a/src/fs/plugin_block_fs.c b/src/fs/plugin_block_fs.c
index 029f95bc5..18aa289ef 100644
--- a/src/fs/plugin_block_fs.c
+++ b/src/fs/plugin_block_fs.c
@@ -43,7 +43,6 @@
43 * 43 *
44 * @param ctx block context in which the block group is created 44 * @param ctx block context in which the block group is created
45 * @param type type of the block for which we are creating the group 45 * @param type type of the block for which we are creating the group
46 * @param nonce random value used to seed the group creation
47 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh 46 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
48 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh 47 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
49 * @param va variable arguments specific to @a type 48 * @param va variable arguments specific to @a type
@@ -53,7 +52,6 @@
53static struct GNUNET_BLOCK_Group * 52static struct GNUNET_BLOCK_Group *
54block_plugin_fs_create_group (void *cls, 53block_plugin_fs_create_group (void *cls,
55 enum GNUNET_BLOCK_Type type, 54 enum GNUNET_BLOCK_Type type,
56 uint32_t nonce,
57 const void *raw_data, 55 const void *raw_data,
58 size_t raw_data_size, 56 size_t raw_data_size,
59 va_list va) 57 va_list va)
@@ -66,11 +64,9 @@ block_plugin_fs_create_group (void *cls,
66 case GNUNET_BLOCK_TYPE_FS_DBLOCK: 64 case GNUNET_BLOCK_TYPE_FS_DBLOCK:
67 GNUNET_break (NULL == va_arg (va, const char *)); 65 GNUNET_break (NULL == va_arg (va, const char *));
68 return NULL; 66 return NULL;
69
70 case GNUNET_BLOCK_TYPE_FS_IBLOCK: 67 case GNUNET_BLOCK_TYPE_FS_IBLOCK:
71 GNUNET_break (NULL == va_arg (va, const char *)); 68 GNUNET_break (NULL == va_arg (va, const char *));
72 return NULL; 69 return NULL;
73
74 case GNUNET_BLOCK_TYPE_FS_UBLOCK: 70 case GNUNET_BLOCK_TYPE_FS_UBLOCK:
75 guard = va_arg (va, const char *); 71 guard = va_arg (va, const char *);
76 if (0 == strcmp (guard, 72 if (0 == strcmp (guard,
@@ -98,7 +94,6 @@ block_plugin_fs_create_group (void *cls,
98 size, 94 size,
99 BLOOMFILTER_K, 95 BLOOMFILTER_K,
100 type, 96 type,
101 nonce,
102 raw_data, 97 raw_data,
103 raw_data_size); 98 raw_data_size);
104 99
@@ -218,7 +213,7 @@ block_plugin_fs_check_block (void *cls,
218 case GNUNET_BLOCK_TYPE_FS_UBLOCK: 213 case GNUNET_BLOCK_TYPE_FS_UBLOCK:
219 { 214 {
220 const struct UBlock *ub; 215 const struct UBlock *ub;
221 216
222 if (block_size < sizeof(struct UBlock)) 217 if (block_size < sizeof(struct UBlock))
223 { 218 {
224 GNUNET_break_op (0); 219 GNUNET_break_op (0);
@@ -226,8 +221,8 @@ block_plugin_fs_check_block (void *cls,
226 } 221 }
227 ub = block; 222 ub = block;
228 if (block_size != 223 if (block_size !=
229 ntohl (ub->purpose.size) + 224 ntohl (ub->purpose.size)
230 sizeof (struct GNUNET_CRYPTO_EcdsaSignature)) 225 + sizeof (struct GNUNET_CRYPTO_EcdsaSignature))
231 { 226 {
232 GNUNET_break_op (0); 227 GNUNET_break_op (0);
233 return GNUNET_NO; 228 return GNUNET_NO;
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c
index ffca16b6f..a683ecacc 100644
--- a/src/gns/plugin_block_gns.c
+++ b/src/gns/plugin_block_gns.c
@@ -48,7 +48,6 @@
48 * 48 *
49 * @param ctx block context in which the block group is created 49 * @param ctx block context in which the block group is created
50 * @param type type of the block for which we are creating the group 50 * @param type type of the block for which we are creating the group
51 * @param nonce random value used to seed the group creation
52 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh 51 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
53 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh 52 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
54 * @param va variable arguments specific to @a type 53 * @param va variable arguments specific to @a type
@@ -58,7 +57,6 @@
58static struct GNUNET_BLOCK_Group * 57static struct GNUNET_BLOCK_Group *
59block_plugin_gns_create_group (void *cls, 58block_plugin_gns_create_group (void *cls,
60 enum GNUNET_BLOCK_Type type, 59 enum GNUNET_BLOCK_Type type,
61 uint32_t nonce,
62 const void *raw_data, 60 const void *raw_data,
63 size_t raw_data_size, 61 size_t raw_data_size,
64 va_list va) 62 va_list va)
@@ -85,7 +83,6 @@ block_plugin_gns_create_group (void *cls,
85 bf_size, 83 bf_size,
86 BLOOMFILTER_K, 84 BLOOMFILTER_K,
87 type, 85 type,
88 nonce,
89 raw_data, 86 raw_data,
90 raw_data_size); 87 raw_data_size);
91} 88}
@@ -132,7 +129,6 @@ block_plugin_gns_get_key (void *cls,
132} 129}
133 130
134 131
135
136/** 132/**
137 * Function called to validate a query. 133 * Function called to validate a query.
138 * 134 *
diff --git a/src/include/gnunet_block_group_lib.h b/src/include/gnunet_block_group_lib.h
index b03e913c6..d242ceefb 100644
--- a/src/include/gnunet_block_group_lib.h
+++ b/src/include/gnunet_block_group_lib.h
@@ -68,7 +68,6 @@ GNUNET_BLOCK_GROUP_compute_bloomfilter_size (unsigned int entry_count,
68 * @param bf_size size of the Bloom filter 68 * @param bf_size size of the Bloom filter
69 * @param bf_k K-value for the Bloom filter 69 * @param bf_k K-value for the Bloom filter
70 * @param type block type 70 * @param type block type
71 * @param nonce random value used to seed the group creation
72 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh 71 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
73 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh 72 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
74 * @return block group handle, NULL if block groups are not supported 73 * @return block group handle, NULL if block groups are not supported
@@ -79,7 +78,6 @@ GNUNET_BLOCK_GROUP_bf_create (void *cls,
79 size_t bf_size, 78 size_t bf_size,
80 unsigned int bf_k, 79 unsigned int bf_k,
81 enum GNUNET_BLOCK_Type type, 80 enum GNUNET_BLOCK_Type type,
82 uint32_t nonce,
83 const void *raw_data, 81 const void *raw_data,
84 size_t raw_data_size); 82 size_t raw_data_size);
85 83
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index fb417412f..af61dcfb0 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -138,7 +138,6 @@ struct GNUNET_BLOCK_Group;
138struct GNUNET_BLOCK_Group * 138struct GNUNET_BLOCK_Group *
139GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx, 139GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
140 enum GNUNET_BLOCK_Type type, 140 enum GNUNET_BLOCK_Type type,
141 uint32_t nonce,
142 const void *raw_data, 141 const void *raw_data,
143 size_t raw_data_size, 142 size_t raw_data_size,
144 ...); 143 ...);
@@ -148,7 +147,6 @@ GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
148 * Serialize state of a block group. 147 * Serialize state of a block group.
149 * 148 *
150 * @param bg group to serialize 149 * @param bg group to serialize
151 * @param[out] nonce set to the nonce of the @a bg
152 * @param[out] raw_data set to the serialized state 150 * @param[out] raw_data set to the serialized state
153 * @param[out] raw_data_size set to the number of bytes in @a raw_data 151 * @param[out] raw_data_size set to the number of bytes in @a raw_data
154 * @return #GNUNET_OK on success, #GNUNET_NO if serialization is not 152 * @return #GNUNET_OK on success, #GNUNET_NO if serialization is not
@@ -156,7 +154,6 @@ GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
156 */ 154 */
157enum GNUNET_GenericReturnValue 155enum GNUNET_GenericReturnValue
158GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg, 156GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg,
159 uint32_t *nonce,
160 void **raw_data, 157 void **raw_data,
161 size_t *raw_data_size); 158 size_t *raw_data_size);
162 159
diff --git a/src/include/gnunet_block_plugin.h b/src/include/gnunet_block_plugin.h
index 1fa7ccf8b..6f9e8e9dc 100644
--- a/src/include/gnunet_block_plugin.h
+++ b/src/include/gnunet_block_plugin.h
@@ -49,9 +49,9 @@
49 */ 49 */
50typedef void 50typedef void
51(*GNUNET_BLOCK_GroupMarkSeenFunction)( 51(*GNUNET_BLOCK_GroupMarkSeenFunction)(
52 struct GNUNET_BLOCK_Group *bg, 52 struct GNUNET_BLOCK_Group *bg,
53 const struct GNUNET_HashCode *seen_results, 53 const struct GNUNET_HashCode *seen_results,
54 unsigned int seen_results_count); 54 unsigned int seen_results_count);
55 55
56 56
57/** 57/**
@@ -72,7 +72,6 @@ typedef enum GNUNET_GenericReturnValue
72 * Serialize state of a block group. 72 * Serialize state of a block group.
73 * 73 *
74 * @param bg group to serialize 74 * @param bg group to serialize
75 * @param[out] nonce set to the nonce of the @a bg
76 * @param[out] raw_data set to the serialized state 75 * @param[out] raw_data set to the serialized state
77 * @param[out] raw_data_size set to the number of bytes in @a raw_data 76 * @param[out] raw_data_size set to the number of bytes in @a raw_data
78 * @return #GNUNET_OK on success, #GNUNET_NO if serialization is not 77 * @return #GNUNET_OK on success, #GNUNET_NO if serialization is not
@@ -80,7 +79,6 @@ typedef enum GNUNET_GenericReturnValue
80 */ 79 */
81typedef enum GNUNET_GenericReturnValue 80typedef enum GNUNET_GenericReturnValue
82(*GNUNET_BLOCK_GroupSerializeFunction)(struct GNUNET_BLOCK_Group *bg, 81(*GNUNET_BLOCK_GroupSerializeFunction)(struct GNUNET_BLOCK_Group *bg,
83 uint32_t *nonce,
84 void **raw_data, 82 void **raw_data,
85 size_t *raw_data_size); 83 size_t *raw_data_size);
86 84
@@ -156,7 +154,6 @@ struct GNUNET_BLOCK_Group
156typedef struct GNUNET_BLOCK_Group * 154typedef struct GNUNET_BLOCK_Group *
157(*GNUNET_BLOCK_GroupCreateFunction)(void *cls, 155(*GNUNET_BLOCK_GroupCreateFunction)(void *cls,
158 enum GNUNET_BLOCK_Type type, 156 enum GNUNET_BLOCK_Type type,
159 uint32_t nonce,
160 const void *raw_data, 157 const void *raw_data,
161 size_t raw_data_size, 158 size_t raw_data_size,
162 va_list va); 159 va_list va);
@@ -238,11 +235,11 @@ typedef enum GNUNET_BLOCK_ReplyEvaluationResult
238 * #GNUNET_SYSERR if @a type not supported 235 * #GNUNET_SYSERR if @a type not supported
239 */ 236 */
240typedef enum GNUNET_GenericReturnValue 237typedef enum GNUNET_GenericReturnValue
241(*GNUNET_BLOCK_GetKeyFunction) (void *cls, 238(*GNUNET_BLOCK_GetKeyFunction)(void *cls,
242 enum GNUNET_BLOCK_Type type, 239 enum GNUNET_BLOCK_Type type,
243 const void *block, 240 const void *block,
244 size_t block_size, 241 size_t block_size,
245 struct GNUNET_HashCode *key); 242 struct GNUNET_HashCode *key);
246 243
247 244
248/** 245/**
@@ -285,7 +282,7 @@ struct GNUNET_BLOCK_PluginFunctions
285 /** 282 /**
286 * Check that a reply block matches a query. 283 * Check that a reply block matches a query.
287 */ 284 */
288 GNUNET_BLOCK_ReplyEvaluationFunction check_reply; 285 GNUNET_BLOCK_ReplyEvaluationFunction check_reply;
289 286
290}; 287};
291 288
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index 61442ac10..5f23a32df 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -49,7 +49,6 @@
49 * 49 *
50 * @param ctx block context in which the block group is created 50 * @param ctx block context in which the block group is created
51 * @param type type of the block for which we are creating the group 51 * @param type type of the block for which we are creating the group
52 * @param nonce random value used to seed the group creation
53 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh 52 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
54 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh 53 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
55 * @param va variable arguments specific to @a type 54 * @param va variable arguments specific to @a type
@@ -59,7 +58,6 @@
59static struct GNUNET_BLOCK_Group * 58static struct GNUNET_BLOCK_Group *
60block_plugin_regex_create_group (void *cls, 59block_plugin_regex_create_group (void *cls,
61 enum GNUNET_BLOCK_Type type, 60 enum GNUNET_BLOCK_Type type,
62 uint32_t nonce,
63 const void *raw_data, 61 const void *raw_data,
64 size_t raw_data_size, 62 size_t raw_data_size,
65 va_list va) 63 va_list va)
@@ -86,7 +84,6 @@ block_plugin_regex_create_group (void *cls,
86 bf_size, 84 bf_size,
87 BLOOMFILTER_K, 85 BLOOMFILTER_K,
88 type, 86 type,
89 nonce,
90 raw_data, 87 raw_data,
91 raw_data_size); 88 raw_data_size);
92} 89}
@@ -150,9 +147,9 @@ block_plugin_regex_check_query (void *cls,
150 */ 147 */
151static enum GNUNET_GenericReturnValue 148static enum GNUNET_GenericReturnValue
152block_plugin_regex_check_block (void *cls, 149block_plugin_regex_check_block (void *cls,
153 enum GNUNET_BLOCK_Type type, 150 enum GNUNET_BLOCK_Type type,
154 const void *block, 151 const void *block,
155 size_t block_size) 152 size_t block_size)
156{ 153{
157 switch (type) 154 switch (type)
158 { 155 {
@@ -166,37 +163,37 @@ block_plugin_regex_check_block (void *cls,
166 return GNUNET_OK; 163 return GNUNET_OK;
167 case GNUNET_BLOCK_TYPE_REGEX_ACCEPT: 164 case GNUNET_BLOCK_TYPE_REGEX_ACCEPT:
168 { 165 {
169 const struct RegexAcceptBlock *rba; 166 const struct RegexAcceptBlock *rba;
170 167
171 if (sizeof(struct RegexAcceptBlock) != block_size) 168 if (sizeof(struct RegexAcceptBlock) != block_size)
172 { 169 {
173 GNUNET_break_op (0); 170 GNUNET_break_op (0);
174 return GNUNET_NO; 171 return GNUNET_NO;
175 } 172 }
176 rba = block; 173 rba = block;
177 if (ntohl (rba->purpose.size) != 174 if (ntohl (rba->purpose.size) !=
178 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) 175 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
179 + sizeof(struct GNUNET_TIME_AbsoluteNBO) 176 + sizeof(struct GNUNET_TIME_AbsoluteNBO)
180 + sizeof(struct GNUNET_HashCode)) 177 + sizeof(struct GNUNET_HashCode))
181 { 178 {
182 GNUNET_break_op (0); 179 GNUNET_break_op (0);
183 return GNUNET_NO; 180 return GNUNET_NO;
184 } 181 }
185 if (GNUNET_TIME_absolute_is_past (GNUNET_TIME_absolute_ntoh ( 182 if (GNUNET_TIME_absolute_is_past (GNUNET_TIME_absolute_ntoh (
186 rba->expiration_time))) 183 rba->expiration_time)))
187 { 184 {
188 return GNUNET_NO; 185 return GNUNET_NO;
189 } 186 }
190 if (GNUNET_OK != 187 if (GNUNET_OK !=
191 GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT, 188 GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT,
192 &rba->purpose, 189 &rba->purpose,
193 &rba->signature, 190 &rba->signature,
194 &rba->peer.public_key)) 191 &rba->peer.public_key))
195 { 192 {
196 GNUNET_break_op (0); 193 GNUNET_break_op (0);
197 return GNUNET_NO; 194 return GNUNET_NO;
198 } 195 }
199 return GNUNET_OK; 196 return GNUNET_OK;
200 } 197 }
201 default: 198 default:
202 GNUNET_break (0); 199 GNUNET_break (0);
@@ -223,14 +220,14 @@ block_plugin_regex_check_block (void *cls,
223 */ 220 */
224static enum GNUNET_BLOCK_ReplyEvaluationResult 221static enum GNUNET_BLOCK_ReplyEvaluationResult
225block_plugin_regex_check_reply ( 222block_plugin_regex_check_reply (
226 void *cls, 223 void *cls,
227 enum GNUNET_BLOCK_Type type, 224 enum GNUNET_BLOCK_Type type,
228 struct GNUNET_BLOCK_Group *group, 225 struct GNUNET_BLOCK_Group *group,
229 const struct GNUNET_HashCode *query, 226 const struct GNUNET_HashCode *query,
230 const void *xquery, 227 const void *xquery,
231 size_t xquery_size, 228 size_t xquery_size,
232 const void *reply_block, 229 const void *reply_block,
233 size_t reply_block_size) 230 size_t reply_block_size)
234{ 231{
235 struct GNUNET_HashCode chash; 232 struct GNUNET_HashCode chash;
236 233
@@ -240,7 +237,7 @@ block_plugin_regex_check_reply (
240 if (0 != xquery_size) 237 if (0 != xquery_size)
241 { 238 {
242 const char *s; 239 const char *s;
243 240
244 s = (const char *) xquery; 241 s = (const char *) xquery;
245 GNUNET_assert ('\0' == s[xquery_size - 1]); 242 GNUNET_assert ('\0' == s[xquery_size - 1]);
246 } 243 }
@@ -267,22 +264,22 @@ block_plugin_regex_check_reply (
267 return GNUNET_BLOCK_REPLY_OK_MORE; 264 return GNUNET_BLOCK_REPLY_OK_MORE;
268 case GNUNET_BLOCK_TYPE_REGEX_ACCEPT: 265 case GNUNET_BLOCK_TYPE_REGEX_ACCEPT:
269 { 266 {
270 const struct RegexAcceptBlock *rba; 267 const struct RegexAcceptBlock *rba;
271 268
272 GNUNET_assert (sizeof(struct RegexAcceptBlock) == reply_block_size); 269 GNUNET_assert (sizeof(struct RegexAcceptBlock) == reply_block_size);
273 rba = reply_block; 270 rba = reply_block;
274 GNUNET_assert (ntohl (rba->purpose.size) == 271 GNUNET_assert (ntohl (rba->purpose.size) ==
275 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) 272 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
276 + sizeof(struct GNUNET_TIME_AbsoluteNBO) 273 + sizeof(struct GNUNET_TIME_AbsoluteNBO)
277 + sizeof(struct GNUNET_HashCode)); 274 + sizeof(struct GNUNET_HashCode));
278 GNUNET_CRYPTO_hash (reply_block, 275 GNUNET_CRYPTO_hash (reply_block,
279 reply_block_size, 276 reply_block_size,
280 &chash); 277 &chash);
281 if (GNUNET_YES == 278 if (GNUNET_YES ==
282 GNUNET_BLOCK_GROUP_bf_test_and_set (group, 279 GNUNET_BLOCK_GROUP_bf_test_and_set (group,
283 &chash)) 280 &chash))
284 return GNUNET_BLOCK_REPLY_OK_DUPLICATE; 281 return GNUNET_BLOCK_REPLY_OK_DUPLICATE;
285 return GNUNET_BLOCK_REPLY_OK_MORE; 282 return GNUNET_BLOCK_REPLY_OK_MORE;
286 } 283 }
287 default: 284 default:
288 GNUNET_break (0); 285 GNUNET_break (0);