aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/revocation/gnunet-revocation-tvg.c8
-rw-r--r--src/revocation/revocation_api.c8
2 files changed, 14 insertions, 2 deletions
diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c
index 805b7c39c..2b850e436 100644
--- a/src/revocation/gnunet-revocation-tvg.c
+++ b/src/revocation/gnunet-revocation-tvg.c
@@ -52,6 +52,7 @@ run (void *cls,
52 struct GNUNET_CRYPTO_EcdsaPublicKey id_pub; 52 struct GNUNET_CRYPTO_EcdsaPublicKey id_pub;
53 struct GNUNET_REVOCATION_PowP pow; 53 struct GNUNET_REVOCATION_PowP pow;
54 struct GNUNET_REVOCATION_PowCalculationHandle *ph; 54 struct GNUNET_REVOCATION_PowCalculationHandle *ph;
55 struct GNUNET_TIME_Relative exp;
55 char* data_enc; 56 char* data_enc;
56 57
57 GNUNET_CRYPTO_ecdsa_key_create (&id_priv); 58 GNUNET_CRYPTO_ecdsa_key_create (&id_priv);
@@ -67,7 +68,7 @@ run (void *cls,
67 &data_enc); 68 &data_enc);
68 fprintf(stdout, "Zone public key (zk):\n%s\n\n", data_enc); 69 fprintf(stdout, "Zone public key (zk):\n%s\n\n", data_enc);
69 GNUNET_free (data_enc); 70 GNUNET_free (data_enc);
70 71 memset (&pow, 0, sizeof (pow));
71 GNUNET_REVOCATION_pow_init (&id_priv, 72 GNUNET_REVOCATION_pow_init (&id_priv,
72 &pow); 73 &pow);
73 ph = GNUNET_REVOCATION_pow_start (&pow, 74 ph = GNUNET_REVOCATION_pow_start (&pow,
@@ -82,6 +83,11 @@ run (void *cls,
82 { 83 {
83 pow_passes++; 84 pow_passes++;
84 } 85 }
86 exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
87 TEST_EPOCHS);
88 GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (&pow,
89 TEST_DIFFICULTY,
90 exp));
85 GNUNET_STRINGS_base64_encode (&pow, 91 GNUNET_STRINGS_base64_encode (&pow,
86 sizeof (struct GNUNET_REVOCATION_PowP), 92 sizeof (struct GNUNET_REVOCATION_PowP),
87 &data_enc); 93 &data_enc);
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 39fdb8b6f..3789e6799 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -394,7 +394,6 @@ static unsigned int
394count_leading_zeroes (const struct GNUNET_HashCode *hash) 394count_leading_zeroes (const struct GNUNET_HashCode *hash)
395{ 395{
396 unsigned int hash_count; 396 unsigned int hash_count;
397
398 hash_count = 0; 397 hash_count = 0;
399 while ((0 == GNUNET_CRYPTO_hash_get_bit (hash, hash_count))) 398 while ((0 == GNUNET_CRYPTO_hash_get_bit (hash, hash_count)))
400 hash_count++; 399 hash_count++;
@@ -436,6 +435,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
436 + sizeof (struct GNUNET_TIME_AbsoluteNBO) 435 + sizeof (struct GNUNET_TIME_AbsoluteNBO)
437 + sizeof (uint64_t)] GNUNET_ALIGN; 436 + sizeof (uint64_t)] GNUNET_ALIGN;
438 struct GNUNET_REVOCATION_SignaturePurposePS spurp; 437 struct GNUNET_REVOCATION_SignaturePurposePS spurp;
438 struct GNUNET_CRYPTO_HashAsciiEncoded h_str;
439 struct GNUNET_HashCode result; 439 struct GNUNET_HashCode result;
440 struct GNUNET_TIME_Absolute ts; 440 struct GNUNET_TIME_Absolute ts;
441 struct GNUNET_TIME_Absolute exp; 441 struct GNUNET_TIME_Absolute exp;
@@ -492,6 +492,12 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
492 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 492 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
493 "Score %u with %" PRIu64 " (#%u)\n", 493 "Score %u with %" PRIu64 " (#%u)\n",
494 tmp_score, pow_val, i); 494 tmp_score, pow_val, i);
495
496 GNUNET_CRYPTO_hash_to_enc (&result,
497 &h_str);
498 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
499 "Hash: %s\n", (char*)&h_str);
500
495 score += tmp_score; 501 score += tmp_score;
496 502
497 } 503 }