aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-12-21 14:41:25 +0000
committerNathan S. Evans <evans@in.tum.de>2010-12-21 14:41:25 +0000
commit6a8a1fc8bc5ed304a22c54ce7c4770811a444919 (patch)
treee2e824084154f00e9479e5e1d8ef6605257109f0 /src/dht/gnunet-service-dht.c
parentd1e8d2204007af40267b97832807fb0fea9c2917 (diff)
downloadgnunet-6a8a1fc8bc5ed304a22c54ce7c4770811a444919.tar.gz
gnunet-6a8a1fc8bc5ed304a22c54ce7c4770811a444919.zip
codesonar fix
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r--src/dht/gnunet-service-dht.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 13fda66ae..bb23153ed 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -2959,9 +2959,9 @@ get_forward_count (unsigned int hop_count, size_t target_replication)
2959 else 2959 else
2960 random_value = 2960 random_value =
2961 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 2961 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG,
2962 (unsigned int) -1); 2962 UINT32_MAX);
2963 2963
2964 if (random_value < (target_value * (unsigned int) -1)) 2964 if (random_value < (target_value * UINT32_MAX))
2965 forward_count += 1; 2965 forward_count += 1;
2966 2966
2967 return forward_count; 2967 return forward_count;
@@ -3969,7 +3969,7 @@ republish_content_iterator (void *cls,
3969 memcpy (&put_msg[1], data, size); 3969 memcpy (&put_msg[1], data, size);
3970 new_msg_ctx->unique_id = 3970 new_msg_ctx->unique_id =
3971 GNUNET_ntohll (GNUNET_CRYPTO_random_u64 3971 GNUNET_ntohll (GNUNET_CRYPTO_random_u64
3972 (GNUNET_CRYPTO_QUALITY_WEAK, (uint64_t) - 1)); 3972 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX));
3973 new_msg_ctx->replication = ntohl (DEFAULT_PUT_REPLICATION); 3973 new_msg_ctx->replication = ntohl (DEFAULT_PUT_REPLICATION);
3974 new_msg_ctx->msg_options = ntohl (0); 3974 new_msg_ctx->msg_options = ntohl (0);
3975 new_msg_ctx->network_size = estimate_diameter (); 3975 new_msg_ctx->network_size = estimate_diameter ();
@@ -4166,12 +4166,12 @@ malicious_put_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
4166 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_forever ()); 4166 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_forever ());
4167 memset (&msg_ctx, 0, sizeof (struct DHT_MessageContext)); 4167 memset (&msg_ctx, 0, sizeof (struct DHT_MessageContext));
4168 random_key = 4168 random_key =
4169 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (uint32_t) - 1); 4169 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
4170 GNUNET_CRYPTO_hash (&random_key, sizeof (uint32_t), &key); 4170 GNUNET_CRYPTO_hash (&random_key, sizeof (uint32_t), &key);
4171 memcpy (&msg_ctx.key, &key, sizeof (GNUNET_HashCode)); 4171 memcpy (&msg_ctx.key, &key, sizeof (GNUNET_HashCode));
4172 msg_ctx.unique_id = 4172 msg_ctx.unique_id =
4173 GNUNET_ntohll (GNUNET_CRYPTO_random_u64 4173 GNUNET_ntohll (GNUNET_CRYPTO_random_u64
4174 (GNUNET_CRYPTO_QUALITY_WEAK, (uint64_t) - 1)); 4174 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX));
4175 msg_ctx.replication = ntohl (DHT_DEFAULT_FIND_PEER_REPLICATION); 4175 msg_ctx.replication = ntohl (DHT_DEFAULT_FIND_PEER_REPLICATION);
4176 msg_ctx.msg_options = ntohl (0); 4176 msg_ctx.msg_options = ntohl (0);
4177 msg_ctx.network_size = estimate_diameter (); 4177 msg_ctx.network_size = estimate_diameter ();
@@ -4216,12 +4216,12 @@ malicious_get_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
4216 get_message.type = htonl (GNUNET_BLOCK_DHT_MALICIOUS_MESSAGE_TYPE); 4216 get_message.type = htonl (GNUNET_BLOCK_DHT_MALICIOUS_MESSAGE_TYPE);
4217 memset (&msg_ctx, 0, sizeof (struct DHT_MessageContext)); 4217 memset (&msg_ctx, 0, sizeof (struct DHT_MessageContext));
4218 random_key = 4218 random_key =
4219 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (uint32_t) - 1); 4219 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
4220 GNUNET_CRYPTO_hash (&random_key, sizeof (uint32_t), &key); 4220 GNUNET_CRYPTO_hash (&random_key, sizeof (uint32_t), &key);
4221 memcpy (&msg_ctx.key, &key, sizeof (GNUNET_HashCode)); 4221 memcpy (&msg_ctx.key, &key, sizeof (GNUNET_HashCode));
4222 msg_ctx.unique_id = 4222 msg_ctx.unique_id =
4223 GNUNET_ntohll (GNUNET_CRYPTO_random_u64 4223 GNUNET_ntohll (GNUNET_CRYPTO_random_u64
4224 (GNUNET_CRYPTO_QUALITY_WEAK, (uint64_t) - 1)); 4224 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX));
4225 msg_ctx.replication = ntohl (DHT_DEFAULT_FIND_PEER_REPLICATION); 4225 msg_ctx.replication = ntohl (DHT_DEFAULT_FIND_PEER_REPLICATION);
4226 msg_ctx.msg_options = ntohl (0); 4226 msg_ctx.msg_options = ntohl (0);
4227 msg_ctx.network_size = estimate_diameter (); 4227 msg_ctx.network_size = estimate_diameter ();
@@ -4347,7 +4347,7 @@ send_find_peer_message (void *cls,
4347 memcpy (&msg_ctx.key, &my_identity.hashPubKey, sizeof (GNUNET_HashCode)); 4347 memcpy (&msg_ctx.key, &my_identity.hashPubKey, sizeof (GNUNET_HashCode));
4348 msg_ctx.unique_id = 4348 msg_ctx.unique_id =
4349 GNUNET_ntohll (GNUNET_CRYPTO_random_u64 4349 GNUNET_ntohll (GNUNET_CRYPTO_random_u64
4350 (GNUNET_CRYPTO_QUALITY_STRONG, (uint64_t) - 1)); 4350 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX));
4351 msg_ctx.replication = DHT_DEFAULT_FIND_PEER_REPLICATION; 4351 msg_ctx.replication = DHT_DEFAULT_FIND_PEER_REPLICATION;
4352 msg_ctx.msg_options = DHT_DEFAULT_FIND_PEER_OPTIONS; 4352 msg_ctx.msg_options = DHT_DEFAULT_FIND_PEER_OPTIONS;
4353 msg_ctx.network_size = estimate_diameter (); 4353 msg_ctx.network_size = estimate_diameter ();