diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-05-18 10:10:26 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-05-18 10:10:26 +0200 |
commit | 338be6576f4d08f01a4d00fcc21956131eb1262b (patch) | |
tree | d5f4e76f67535e5f5ccad94af3cd8f34e64d1c85 /src | |
parent | 22343a741e14ea9d5e6ac6ed30af87c3d4a291e1 (diff) | |
download | gnunet-338be6576f4d08f01a4d00fcc21956131eb1262b.tar.gz gnunet-338be6576f4d08f01a4d00fcc21956131eb1262b.zip |
pow values should be nbo
Diffstat (limited to 'src')
-rw-r--r-- | src/revocation/revocation_api.c | 9 |
1 files 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, | |||
483 | for (unsigned int i = 0; i < POW_COUNT; i++) | 483 | for (unsigned int i = 0; i < POW_COUNT; i++) |
484 | { | 484 | { |
485 | pow_val = GNUNET_ntohll (pow->pow[i]); | 485 | pow_val = GNUNET_ntohll (pow->pow[i]); |
486 | GNUNET_memcpy (buf, &pow_val, sizeof(uint64_t)); | 486 | GNUNET_memcpy (buf, &pow->pow[i], sizeof(uint64_t)); |
487 | GNUNET_CRYPTO_pow_hash ("gnunet-revocation-proof-of-work", | 487 | GNUNET_CRYPTO_pow_hash ("gnunet-revocation-proof-of-work", |
488 | buf, | 488 | buf, |
489 | sizeof(buf), | 489 | sizeof(buf), |
@@ -619,6 +619,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) | |||
619 | struct GNUNET_HashCode result; | 619 | struct GNUNET_HashCode result; |
620 | unsigned int zeros; | 620 | unsigned int zeros; |
621 | int ret; | 621 | int ret; |
622 | uint64_t pow_nbo; | ||
622 | 623 | ||
623 | pc->current_pow++; | 624 | pc->current_pow++; |
624 | 625 | ||
@@ -628,8 +629,8 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) | |||
628 | for (unsigned int i = 0; i < POW_COUNT; i++) | 629 | for (unsigned int i = 0; i < POW_COUNT; i++) |
629 | if (pc->current_pow == pc->best[i].pow) | 630 | if (pc->current_pow == pc->best[i].pow) |
630 | return GNUNET_NO; | 631 | return GNUNET_NO; |
631 | 632 | pow_nbo = GNUNET_htonll (pc->current_pow); | |
632 | GNUNET_memcpy (buf, &pc->current_pow, sizeof(uint64_t)); | 633 | GNUNET_memcpy (buf, &pow_nbo, sizeof(uint64_t)); |
633 | GNUNET_memcpy (&buf[sizeof(uint64_t)], | 634 | GNUNET_memcpy (&buf[sizeof(uint64_t)], |
634 | &pc->pow->timestamp, | 635 | &pc->pow->timestamp, |
635 | sizeof (uint64_t)); | 636 | sizeof (uint64_t)); |
@@ -647,7 +648,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) | |||
647 | { | 648 | { |
648 | pc->best[i].bits = zeros; | 649 | pc->best[i].bits = zeros; |
649 | pc->best[i].pow = pc->current_pow; | 650 | pc->best[i].pow = pc->current_pow; |
650 | pc->pow->pow[i] = GNUNET_htonll (pc->current_pow); | 651 | pc->pow->pow[i] = pow_nbo; |
651 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 652 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
652 | "New best score %u with %" PRIu64 " (#%u)\n", | 653 | "New best score %u with %" PRIu64 " (#%u)\n", |
653 | zeros, pc->current_pow, i); | 654 | zeros, pc->current_pow, i); |