summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-05-25 11:22:07 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-05-25 11:22:07 +0200
commit19cd0e6d0eca5192a9c8f4f005abd85d531949f1 (patch)
treecc9745d840344074c69e0e96e1cc57761471e7f8
parent2886db8f0b7628eda4aebd8d1a3b4effc1d1d62d (diff)
add some more debug output
-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,
struct GNUNET_CRYPTO_EcdsaPublicKey id_pub;
struct GNUNET_REVOCATION_PowP pow;
struct GNUNET_REVOCATION_PowCalculationHandle *ph;
+ struct GNUNET_TIME_Relative exp;
char* data_enc;
GNUNET_CRYPTO_ecdsa_key_create (&id_priv);
@@ -67,7 +68,7 @@ run (void *cls,
&data_enc);
fprintf(stdout, "Zone public key (zk):\n%s\n\n", data_enc);
GNUNET_free (data_enc);
-
+ memset (&pow, 0, sizeof (pow));
GNUNET_REVOCATION_pow_init (&id_priv,
&pow);
ph = GNUNET_REVOCATION_pow_start (&pow,
@@ -82,6 +83,11 @@ run (void *cls,
{
pow_passes++;
}
+ exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
+ TEST_EPOCHS);
+ GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (&pow,
+ TEST_DIFFICULTY,
+ exp));
GNUNET_STRINGS_base64_encode (&pow,
sizeof (struct GNUNET_REVOCATION_PowP),
&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
count_leading_zeroes (const struct GNUNET_HashCode *hash)
{
unsigned int hash_count;
-
hash_count = 0;
while ((0 == GNUNET_CRYPTO_hash_get_bit (hash, hash_count)))
hash_count++;
@@ -436,6 +435,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
+ sizeof (struct GNUNET_TIME_AbsoluteNBO)
+ sizeof (uint64_t)] GNUNET_ALIGN;
struct GNUNET_REVOCATION_SignaturePurposePS spurp;
+ struct GNUNET_CRYPTO_HashAsciiEncoded h_str;
struct GNUNET_HashCode result;
struct GNUNET_TIME_Absolute ts;
struct GNUNET_TIME_Absolute exp;
@@ -492,6 +492,12 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Score %u with %" PRIu64 " (#%u)\n",
tmp_score, pow_val, i);
+
+ GNUNET_CRYPTO_hash_to_enc (&result,
+ &h_str);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Hash: %s\n", (char*)&h_str);
+
score += tmp_score;
}