diff options
Diffstat (limited to 'src/revocation')
-rw-r--r-- | src/revocation/gnunet-revocation.c | 14 | ||||
-rw-r--r-- | src/revocation/gnunet-service-revocation.c | 12 | ||||
-rw-r--r-- | src/revocation/plugin_block_revocation.c | 9 | ||||
-rw-r--r-- | src/revocation/revocation_api.c | 9 |
4 files changed, 29 insertions, 15 deletions
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index b5737158b..99fecdd35 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -307,17 +307,9 @@ calculate_pow (void *cls) | |||
307 | return; | 307 | return; |
308 | } | 308 | } |
309 | pow_passes++; | 309 | pow_passes++; |
310 | /** | 310 | pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, |
311 | * Otherwise CTRL-C does not work | 311 | &calculate_pow, |
312 | */ | 312 | ph); |
313 | if (0 == pow_passes % 128) | ||
314 | pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, | ||
315 | &calculate_pow, | ||
316 | ph); | ||
317 | else | ||
318 | pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, | ||
319 | &calculate_pow, | ||
320 | ph); | ||
321 | 313 | ||
322 | } | 314 | } |
323 | 315 | ||
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 863289aae..6f70720ba 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -306,12 +306,19 @@ publicize_rm (const struct RevokeMessage *rm) | |||
306 | struct RevokeMessage *cp; | 306 | struct RevokeMessage *cp; |
307 | struct GNUNET_HashCode hc; | 307 | struct GNUNET_HashCode hc; |
308 | struct GNUNET_SETU_Element e; | 308 | struct GNUNET_SETU_Element e; |
309 | ssize_t pklen; | ||
309 | const struct GNUNET_IDENTITY_PublicKey *pk; | 310 | const struct GNUNET_IDENTITY_PublicKey *pk; |
310 | 311 | ||
311 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; | 312 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; |
312 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 313 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; |
314 | pklen = GNUNET_IDENTITY_key_get_length (pk); | ||
315 | if (0 > pklen) | ||
316 | { | ||
317 | GNUNET_break_op (0); | ||
318 | return GNUNET_SYSERR; | ||
319 | } | ||
313 | GNUNET_CRYPTO_hash (pk, | 320 | GNUNET_CRYPTO_hash (pk, |
314 | GNUNET_IDENTITY_key_get_length (pk), | 321 | pklen, |
315 | &hc); | 322 | &hc); |
316 | if (GNUNET_YES == | 323 | if (GNUNET_YES == |
317 | GNUNET_CONTAINER_multihashmap_contains (revocation_map, | 324 | GNUNET_CONTAINER_multihashmap_contains (revocation_map, |
@@ -384,7 +391,8 @@ check_revoke_message (void *cls, | |||
384 | uint16_t size; | 391 | uint16_t size; |
385 | 392 | ||
386 | size = ntohs (rm->header.size); | 393 | size = ntohs (rm->header.size); |
387 | if (size <= sizeof(struct RevokeMessage)) | 394 | if (size <= sizeof(struct RevokeMessage) || |
395 | (size > UINT16_MAX)) | ||
388 | { | 396 | { |
389 | GNUNET_break (0); | 397 | GNUNET_break (0); |
390 | return GNUNET_SYSERR; | 398 | return GNUNET_SYSERR; |
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c index 3c9344a49..1928d09cd 100644 --- a/src/revocation/plugin_block_revocation.c +++ b/src/revocation/plugin_block_revocation.c | |||
@@ -134,6 +134,7 @@ block_plugin_revocation_evaluate (void *cls, | |||
134 | { | 134 | { |
135 | struct InternalContext *ic = cls; | 135 | struct InternalContext *ic = cls; |
136 | struct GNUNET_HashCode chash; | 136 | struct GNUNET_HashCode chash; |
137 | ssize_t pklen; | ||
137 | const struct RevokeMessage *rm = reply_block; | 138 | const struct RevokeMessage *rm = reply_block; |
138 | 139 | ||
139 | if (NULL == reply_block) | 140 | if (NULL == reply_block) |
@@ -153,8 +154,14 @@ block_plugin_revocation_evaluate (void *cls, | |||
153 | GNUNET_break_op (0); | 154 | GNUNET_break_op (0); |
154 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 155 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
155 | } | 156 | } |
157 | pklen = GNUNET_IDENTITY_key_get_length (pk); | ||
158 | if (0 > pklen) | ||
159 | { | ||
160 | GNUNET_break_op (0); | ||
161 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | ||
162 | } | ||
156 | GNUNET_CRYPTO_hash (pk, | 163 | GNUNET_CRYPTO_hash (pk, |
157 | GNUNET_IDENTITY_key_get_length (pk), | 164 | pklen, |
158 | &chash); | 165 | &chash); |
159 | if (GNUNET_YES == | 166 | if (GNUNET_YES == |
160 | GNUNET_BLOCK_GROUP_bf_test_and_set (group, | 167 | GNUNET_BLOCK_GROUP_bf_test_and_set (group, |
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 5cf191847..e2f871c23 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -492,6 +492,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
492 | unsigned int tmp_score = 0; | 492 | unsigned int tmp_score = 0; |
493 | unsigned int epochs; | 493 | unsigned int epochs; |
494 | uint64_t pow_val; | 494 | uint64_t pow_val; |
495 | ssize_t pklen; | ||
495 | const struct GNUNET_IDENTITY_PublicKey *pk; | 496 | const struct GNUNET_IDENTITY_PublicKey *pk; |
496 | 497 | ||
497 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 498 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; |
@@ -517,9 +518,15 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
517 | GNUNET_memcpy (&buf[sizeof(uint64_t)], | 518 | GNUNET_memcpy (&buf[sizeof(uint64_t)], |
518 | &pow->timestamp, | 519 | &pow->timestamp, |
519 | sizeof (uint64_t)); | 520 | sizeof (uint64_t)); |
521 | pklen = GNUNET_IDENTITY_key_get_length (pk); | ||
522 | if (0 > pklen) | ||
523 | { | ||
524 | GNUNET_break (0); | ||
525 | return GNUNET_NO; | ||
526 | } | ||
520 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], | 527 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], |
521 | pk, | 528 | pk, |
522 | GNUNET_IDENTITY_key_get_length (pk)); | 529 | pklen); |
523 | for (unsigned int i = 0; i < POW_COUNT; i++) | 530 | for (unsigned int i = 0; i < POW_COUNT; i++) |
524 | { | 531 | { |
525 | pow_val = GNUNET_ntohll (pow->pow[i]); | 532 | pow_val = GNUNET_ntohll (pow->pow[i]); |