gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: pow values should be nbo


From: gnunet
Subject: [gnunet] branch master updated: pow values should be nbo
Date: Mon, 18 May 2020 10:15:32 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 338be6576 pow values should be nbo
338be6576 is described below

commit 338be6576f4d08f01a4d00fcc21956131eb1262b
Author: Martin Schanzenbach <address@hidden>
AuthorDate: Mon May 18 10:10:26 2020 +0200

    pow values should be nbo
---
 src/revocation/revocation_api.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 721c40c2a..39fdb8b6f 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -483,7 +483,7 @@ GNUNET_REVOCATION_check_pow (const struct 
GNUNET_REVOCATION_PowP *pow,
   for (unsigned int i = 0; i < POW_COUNT; i++)
   {
     pow_val = GNUNET_ntohll (pow->pow[i]);
-    GNUNET_memcpy (buf, &pow_val, sizeof(uint64_t));
+    GNUNET_memcpy (buf, &pow->pow[i], sizeof(uint64_t));
     GNUNET_CRYPTO_pow_hash ("gnunet-revocation-proof-of-work",
                             buf,
                             sizeof(buf),
@@ -619,6 +619,7 @@ GNUNET_REVOCATION_pow_round (struct 
GNUNET_REVOCATION_PowCalculationHandle *pc)
   struct GNUNET_HashCode result;
   unsigned int zeros;
   int ret;
+  uint64_t pow_nbo;
 
   pc->current_pow++;
 
@@ -628,8 +629,8 @@ GNUNET_REVOCATION_pow_round (struct 
GNUNET_REVOCATION_PowCalculationHandle *pc)
   for (unsigned int i = 0; i < POW_COUNT; i++)
     if (pc->current_pow == pc->best[i].pow)
       return GNUNET_NO;
-
-  GNUNET_memcpy (buf, &pc->current_pow, sizeof(uint64_t));
+  pow_nbo = GNUNET_htonll (pc->current_pow);
+  GNUNET_memcpy (buf, &pow_nbo, sizeof(uint64_t));
   GNUNET_memcpy (&buf[sizeof(uint64_t)],
                  &pc->pow->timestamp,
                  sizeof (uint64_t));
@@ -647,7 +648,7 @@ GNUNET_REVOCATION_pow_round (struct 
GNUNET_REVOCATION_PowCalculationHandle *pc)
     {
       pc->best[i].bits = zeros;
       pc->best[i].pow = pc->current_pow;
-      pc->pow->pow[i] = GNUNET_htonll (pc->current_pow);
+      pc->pow->pow[i] = pow_nbo;
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "New best score %u with %" PRIu64 " (#%u)\n",
                   zeros, pc->current_pow, i);

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]