aboutsummaryrefslogtreecommitdiff
path: root/src/revocation
diff options
context:
space:
mode:
Diffstat (limited to 'src/revocation')
-rw-r--r--src/revocation/gnunet-revocation.c8
-rw-r--r--src/revocation/revocation_api.c5
2 files changed, 11 insertions, 2 deletions
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c
index 99fecdd35..a7f96385c 100644
--- a/src/revocation/gnunet-revocation.c
+++ b/src/revocation/gnunet-revocation.c
@@ -343,7 +343,13 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego)
343 GNUNET_DISK_fn_read (filename, proof_of_work, 343 GNUNET_DISK_fn_read (filename, proof_of_work,
344 GNUNET_REVOCATION_MAX_PROOF_SIZE)))) 344 GNUNET_REVOCATION_MAX_PROOF_SIZE))))
345 { 345 {
346 size_t ksize = GNUNET_IDENTITY_key_get_length (&key); 346 ssize_t ksize = GNUNET_IDENTITY_key_get_length (&key);
347 if (0 > ksize)
348 {
349 fprintf (stderr,
350 _ ("Error: Key is invalid\n"));
351 return;
352 }
347 if (((psize - sizeof (*proof_of_work)) < ksize) || // Key too small 353 if (((psize - sizeof (*proof_of_work)) < ksize) || // Key too small
348 (0 != memcmp (&proof_of_work[1], &key, ksize))) // Keys do not match 354 (0 != memcmp (&proof_of_work[1], &key, ksize))) // Keys do not match
349 { 355 {
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index e2f871c23..f2b95bafa 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -707,6 +707,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
707 unsigned int zeros; 707 unsigned int zeros;
708 int ret; 708 int ret;
709 uint64_t pow_nbo; 709 uint64_t pow_nbo;
710 ssize_t ksize;
710 711
711 pc->current_pow++; 712 pc->current_pow++;
712 pk = (const struct GNUNET_IDENTITY_PublicKey *) &(pc->pow[1]); 713 pk = (const struct GNUNET_IDENTITY_PublicKey *) &(pc->pow[1]);
@@ -722,9 +723,11 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
722 GNUNET_memcpy (&buf[sizeof(uint64_t)], 723 GNUNET_memcpy (&buf[sizeof(uint64_t)],
723 &pc->pow->timestamp, 724 &pc->pow->timestamp,
724 sizeof (uint64_t)); 725 sizeof (uint64_t));
726 ksize = GNUNET_IDENTITY_key_get_length (pk);
727 GNUNET_assert (0 < ksize);
725 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], 728 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
726 pk, 729 pk,
727 GNUNET_IDENTITY_key_get_length (pk)); 730 ksize);
728 GNUNET_CRYPTO_pow_hash (&salt, 731 GNUNET_CRYPTO_pow_hash (&salt,
729 buf, 732 buf,
730 sizeof(buf), 733 sizeof(buf),